From 8366c87c57f8f81645d7021407e0229a81e06136 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Wed, 29 Jun 2016 03:03:23 -0700 Subject: [PATCH] update to latest `typing` release --- mitmproxy/stateobject.py | 5 ++--- setup.py | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/mitmproxy/stateobject.py b/mitmproxy/stateobject.py index 6283d845a..8db6cda3f 100644 --- a/mitmproxy/stateobject.py +++ b/mitmproxy/stateobject.py @@ -8,8 +8,7 @@ import netlib.basetypes def _is_list(cls): - # The typing module backport is somewhat broken. - # Python 3.5 or 3.6 should fix this. + # The typing module is broken on Python 3.5.0, fixed on 3.5.1. is_list_bugfix = getattr(cls, "__origin__", False) == getattr(List[Any], "__origin__", True) return issubclass(cls, List) or is_list_bugfix @@ -63,7 +62,7 @@ class StateObject(netlib.basetypes.Serializable): obj = cls.from_state(state.pop(attr)) setattr(self, attr, obj) 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)]) else: # primitive types such as int, str, ... setattr(self, attr, cls(state.pop(attr))) diff --git a/setup.py b/setup.py index 04c1a8aee..564eb4d7e 100644 --- a/setup.py +++ b/setup.py @@ -80,7 +80,6 @@ setup( "requests>=2.9.1, <2.11", "six>=1.10, <1.11", "tornado>=4.3, <4.4", - "typing>=3.5.2, <3.6", "urwid>=1.3.1, <1.4", "watchdog>=0.8.3, <0.9", ], @@ -95,6 +94,7 @@ setup( ':python_version == "2.7"': [ "enum34>=1.0.4, <2", "ipaddress>=1.0.15, <1.1", + "typing==3.5.2.2", ], 'dev': [ "tox>=2.3, <3",