-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Keep only versioned imports for not-builtin types
- Builtins (e.g. Tuple) will be replaced when dropping Py3.8 support, removing _typing module will catch all imports that have to be fixed to avoid deprecation warning in the future.
- Loading branch information
Showing
46 changed files
with
118 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,31 +8,20 @@ | |
# @author Davide Brunato <[email protected]> | ||
# | ||
""" | ||
Version related imports for subscriptable types for type annotations. | ||
Version related imports for subscriptable types for type annotations (no builtins). | ||
""" | ||
import sys | ||
from typing import Any, cast, ClassVar, Generic, Hashable, ItemsView, Optional, \ | ||
NoReturn, Protocol, Sized, SupportsFloat, TYPE_CHECKING, Tuple, Type, \ | ||
TypeVar, Union | ||
|
||
if sys.version_info < (3, 9): | ||
from typing import Callable, Counter, Deque, Dict, List, Iterable, Iterator, \ | ||
Mapping, Match, MutableMapping, MutableSequence, Pattern, Sequence, Set | ||
from typing import Callable, Counter, Deque, Iterable, Iterator, \ | ||
Mapping, Match, MutableMapping, MutableSequence, MutableSet, Pattern, Sequence | ||
else: | ||
from collections import deque, Counter | ||
from collections import deque as Deque, Counter # noqa | ||
from collections.abc import Callable, Iterable, Iterator, Mapping, MutableMapping, \ | ||
MutableSequence, Sequence | ||
MutableSequence, MutableSet, Sequence | ||
from re import Match, Pattern | ||
|
||
Deque = deque | ||
Dict = dict | ||
List = list | ||
Set = set | ||
|
||
Never = NoReturn | ||
|
||
__all__ = ['Any', 'Callable', 'cast', 'ClassVar', 'Counter', 'Deque', 'Dict', 'Generic', | ||
'Hashable', 'Iterable', 'ItemsView', 'Iterator', 'List', 'Match', | ||
'Mapping', 'MutableMapping', 'MutableSequence', 'Never', 'Optional', | ||
'Pattern', 'Protocol', 'Sequence', 'Set', 'Sized', 'SupportsFloat', | ||
'Union', 'Tuple', 'Type', 'TYPE_CHECKING', 'TypeVar'] | ||
__all__ = ['Callable', 'Counter', 'Deque', 'Iterable', 'Iterator', 'Match', | ||
'Mapping', 'MutableMapping', 'MutableSequence', 'MutableSet', | ||
'Pattern', 'Sequence'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,9 +8,11 @@ | |
# @author Davide Brunato <[email protected]> | ||
# | ||
from abc import ABCMeta, abstractmethod | ||
from typing import Any, Dict, Optional, Pattern, Tuple, Type | ||
from typing import Any, Dict, Optional, Tuple, Type | ||
import re | ||
|
||
from elementpath._typing import Pattern | ||
|
||
XSD_NAMESPACE = "http://www.w3.org/2001/XMLSchema" | ||
|
||
### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,8 +8,8 @@ | |
# @author Davide Brunato <[email protected]> | ||
# | ||
import re | ||
from typing import cast, Tuple, Union | ||
|
||
from elementpath._typing import cast, Tuple, Union | ||
from elementpath.aliases import NamespacesType, NsmapType | ||
|
||
# Regex patterns related to names and namespaces | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,8 +8,9 @@ | |
# @author Davide Brunato <[email protected]> | ||
# | ||
from abc import ABCMeta, abstractmethod | ||
from typing import TYPE_CHECKING, Any, Dict, Optional, Set, Union | ||
|
||
from elementpath._typing import TYPE_CHECKING, Any, Dict, Optional, Iterator, Set, Union | ||
from elementpath._typing import Iterator | ||
from elementpath.exceptions import ElementPathTypeError | ||
from elementpath.protocols import XsdTypeProtocol, XsdAttributeProtocol, \ | ||
XsdElementProtocol, XsdSchemaProtocol | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,9 @@ | |
# | ||
# @author Davide Brunato <[email protected]> | ||
# | ||
from elementpath._typing import cast, Any, Iterator, List, Optional, Union | ||
from typing import cast, Any, List, Optional, Union | ||
|
||
from elementpath._typing import Iterator | ||
from elementpath.aliases import NamespacesType | ||
from elementpath.exceptions import ElementPathTypeError | ||
from elementpath.protocols import ElementProtocol, LxmlElementProtocol, \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.