update to latest `typing` release

This commit is contained in:
Maximilian Hils 2016-06-29 03:03:23 -07:00
parent b5a39f7d6a
commit 8366c87c57
2 changed files with 3 additions and 4 deletions

View File

@ -8,8 +8,7 @@ import netlib.basetypes
def _is_list(cls): def _is_list(cls):
# The typing module backport is somewhat broken. # The typing module is broken on Python 3.5.0, fixed on 3.5.1.
# Python 3.5 or 3.6 should fix this.
is_list_bugfix = getattr(cls, "__origin__", False) == getattr(List[Any], "__origin__", True) is_list_bugfix = getattr(cls, "__origin__", False) == getattr(List[Any], "__origin__", True)
return issubclass(cls, List) or is_list_bugfix return issubclass(cls, List) or is_list_bugfix
@ -63,7 +62,7 @@ class StateObject(netlib.basetypes.Serializable):
obj = cls.from_state(state.pop(attr)) obj = cls.from_state(state.pop(attr))
setattr(self, attr, obj) setattr(self, attr, obj)
elif _is_list(cls): elif _is_list(cls):
cls = cls.__parameters__[0] cls = cls.__parameters__[0] if cls.__parameters__ else cls.__args__[0]
setattr(self, attr, [cls.from_state(x) for x in state.pop(attr)]) setattr(self, attr, [cls.from_state(x) for x in state.pop(attr)])
else: # primitive types such as int, str, ... else: # primitive types such as int, str, ...
setattr(self, attr, cls(state.pop(attr))) setattr(self, attr, cls(state.pop(attr)))

View File

@ -80,7 +80,6 @@ setup(
"requests>=2.9.1, <2.11", "requests>=2.9.1, <2.11",
"six>=1.10, <1.11", "six>=1.10, <1.11",
"tornado>=4.3, <4.4", "tornado>=4.3, <4.4",
"typing>=3.5.2, <3.6",
"urwid>=1.3.1, <1.4", "urwid>=1.3.1, <1.4",
"watchdog>=0.8.3, <0.9", "watchdog>=0.8.3, <0.9",
], ],
@ -95,6 +94,7 @@ setup(
':python_version == "2.7"': [ ':python_version == "2.7"': [
"enum34>=1.0.4, <2", "enum34>=1.0.4, <2",
"ipaddress>=1.0.15, <1.1", "ipaddress>=1.0.15, <1.1",
"typing==3.5.2.2",
], ],
'dev': [ 'dev': [
"tox>=2.3, <3", "tox>=2.3, <3",