Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type hinting #1476

Merged
merged 46 commits into from
Feb 12, 2022
Merged
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
be14dc1
Add models and annotate NetworkDriver class with types
Kircheneer Mar 22, 2021
49791a9
Make tests pass by ignoring the annotations part of the arg spec
Kircheneer Mar 22, 2021
ba7b56f
Unpack optional in NXOSDevice.load_merge_candidate()
Kircheneer Mar 22, 2021
4df5ff2
Add lots of type hints, asserts and some abstract methods. Enable typ…
Kircheneer Mar 22, 2021
f4604a2
Solve type errors
Kircheneer Mar 27, 2021
aca0ebb
Add type checker to github actions
Kircheneer Mar 27, 2021
12f9da7
Specify mypy config file in github action
Kircheneer Mar 27, 2021
d8eaed7
Fix unused imports
Kircheneer Mar 27, 2021
8b8986b
Black formatting
Kircheneer Mar 27, 2021
80f9a98
Fix further pipeline problems
Kircheneer Mar 27, 2021
18907d3
Fix further pipeline errors
Kircheneer Mar 27, 2021
4ee35ba
Put type in quotes
Kircheneer Mar 27, 2021
97e0cae
Convert all typing_extensions try/except imports to pure typing_exten…
Kircheneer Mar 27, 2021
e373e03
Import TypedDict from typing_extensions in nxos.py
Kircheneer Mar 27, 2021
72c3e92
Ignore typing errors from napalm.iosxr_netconf
Kircheneer Apr 30, 2021
5ced7a3
Fix Callable import in mock.py
Kircheneer May 1, 2021
d52a2cb
Add models and annotate NetworkDriver class with types
Kircheneer Mar 22, 2021
066da2d
Make tests pass by ignoring the annotations part of the arg spec
Kircheneer Mar 22, 2021
67aef96
Add lots of type hints, asserts and some abstract methods. Enable typ…
Kircheneer Mar 22, 2021
39b6348
Solve type errors
Kircheneer Mar 27, 2021
c528848
Add type checker to github actions
Kircheneer Mar 27, 2021
d6ed6e2
Fix unused imports
Kircheneer Mar 27, 2021
ce4962c
Black formatting
Kircheneer Mar 27, 2021
3f4c6ad
Fix further pipeline problems
Kircheneer Mar 27, 2021
91dd630
Fix further pipeline errors
Kircheneer Mar 27, 2021
229820f
Convert all typing_extensions try/except imports to pure typing_exten…
Kircheneer Mar 27, 2021
3d09940
Import TypedDict from typing_extensions in nxos.py
Kircheneer Mar 27, 2021
53d7995
Fix Callable import in mock.py
Kircheneer May 1, 2021
10c0c38
Black
Kircheneer Jun 4, 2021
f7c36a0
Black
Kircheneer Jun 4, 2021
37e409a
Black
Kircheneer Jul 25, 2021
81c7a44
Fix linter issues
Kircheneer Jul 25, 2021
5c38927
Fix MyPy issues
Kircheneer Jul 25, 2021
f74e05f
Remove unused import
Kircheneer Jul 25, 2021
47b93ae
Solve type errors
Kircheneer Mar 27, 2021
431ebf4
Add type checker to github actions
Kircheneer Mar 27, 2021
4485899
Fix MyPy issues
Kircheneer Jul 25, 2021
9260bfa
Fix pylama issues
Kircheneer Feb 11, 2022
3bc3ed8
Remove future import.
Kircheneer Feb 11, 2022
a978096
Bump pytest-pythonpath from 0.7.3 to 0.7.4
dependabot[bot] Feb 10, 2022
92119dc
Fix outstanding Mypy errors
Kircheneer Feb 12, 2022
4e675ff
Merge branch 'develop' of https://github.com/napalm-automation/napalm…
Kircheneer Feb 12, 2022
6731176
Fix new type errors from develop rebase.
Kircheneer Feb 12, 2022
ee7e0bb
Re-add new type checking requirements to dev-requirements.
Kircheneer Feb 12, 2022
8c324ef
Apply black.
Kircheneer Feb 12, 2022
e4061c6
Elaborate on assert statement supporting Mypy in convert helper funct…
Kircheneer Feb 12, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix unused imports
Kircheneer committed Feb 12, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit d8eaed72d162f908c89519f8c2bc3eafeedecf7b
2 changes: 0 additions & 2 deletions napalm/base/base.py
Original file line number Diff line number Diff line change
@@ -12,8 +12,6 @@
# License for the specific language governing permissions and limitations under
# the License.

from __future__ import annotations

import sys
from types import TracebackType
from typing import Optional, Dict, Type, Any, Literal, List, Union
13 changes: 6 additions & 7 deletions napalm/base/helpers.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
"""Helper functions for the NAPALM base."""
import itertools
import logging
# std libs
import os
import re
import sys
import itertools
import logging
from collections.abc import Iterable

# third party libs
from typing import Optional, Dict, Any, List, Union, Tuple, TypeVar, Callable, Type
from typing import Optional, Dict, Any, List, Union, Tuple, TypeVar, Callable

import jinja2
import textfsm
from ciscoconfparse import CiscoConfParse
from lxml import etree
from netaddr import EUI
from netaddr import mac_unix
from netaddr import IPAddress
from ciscoconfparse import CiscoConfParse
from netaddr import mac_unix

# local modules
import napalm.base.exceptions
from napalm.base import constants
from napalm.base.canonical_map import base_interfaces, reverse_mapping
from napalm.base.test.models import ConfigDict
from napalm.base.utils.jinja_filters import CustomJinjaFilters
from napalm.base.canonical_map import base_interfaces, reverse_mapping

T = TypeVar("T")
R = TypeVar("R")
4 changes: 2 additions & 2 deletions napalm/base/validate.py
Original file line number Diff line number Diff line change
@@ -5,11 +5,11 @@
"""
from __future__ import annotations

import copy
import re
from typing import Dict, List, Union, TypeVar, Optional, TYPE_CHECKING

import yaml
import copy
import re

if TYPE_CHECKING:
from napalm.base import NetworkDriver
2 changes: 1 addition & 1 deletion napalm/nxapi_plumbing/api_client.py
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
from __future__ import print_function, unicode_literals

from builtins import super
from typing import Optional, List, Dict, Union, Any
from typing import Optional, List, Dict, Any

import requests
from requests.auth import HTTPBasicAuth
2 changes: 1 addition & 1 deletion napalm/nxapi_plumbing/device.py
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@

from __future__ import print_function, unicode_literals

from typing import List, Optional, Dict, Any, Union
from typing import List, Optional, Any, Union

from napalm.nxapi_plumbing.errors import NXAPIError, NXAPICommandError
from napalm.nxapi_plumbing.api_client import RPCClient, XMLClient, RPCBase
2 changes: 1 addition & 1 deletion napalm/nxos/nxos.py
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@

from netaddr import IPAddress
from netaddr.core import AddrFormatError
from netmiko import file_transfer, ConnectHandler
from netmiko import file_transfer
from requests.exceptions import ConnectionError

import napalm.base.constants as c