@@ -1158,44 +1158,8 @@ def _get_defaults(func):
1158
1158
1159
1159
1160
1160
def get_type_hints (obj , globalns = None , localns = None ):
1161
- """Return type hints for a function or method object.
1162
-
1163
- This is often the same as obj.__annotations__, but it handles
1164
- forward references encoded as string literals, and if necessary
1165
- adds Optional[t] if a default value equal to None is set.
1166
-
1167
- BEWARE -- the behavior of globalns and localns is counterintuitive
1168
- (unless you are familiar with how eval() and exec() work). The
1169
- search order is locals first, then globals.
1170
-
1171
- - If no dict arguments are passed, an attempt is made to use the
1172
- globals from obj, and these are also used as the locals. If the
1173
- object does not appear to have globals, an exception is raised.
1174
-
1175
- - If one dict argument is passed, it is used for both globals and
1176
- locals.
1177
-
1178
- - If two dict arguments are passed, they specify globals and
1179
- locals, respectively.
1180
- """
1181
- if getattr (obj , '__no_type_check__' , None ):
1182
- return {}
1183
- if globalns is None :
1184
- globalns = getattr (obj , '__globals__' , {})
1185
- if localns is None :
1186
- localns = globalns
1187
- elif localns is None :
1188
- localns = globalns
1189
- defaults = _get_defaults (obj )
1190
- hints = dict (obj .__annotations__ )
1191
- for name , value in hints .items ():
1192
- if isinstance (value , basestring ):
1193
- value = _ForwardRef (value )
1194
- value = _eval_type (value , globalns , localns )
1195
- if name in defaults and defaults [name ] is None :
1196
- value = Optional [value ]
1197
- hints [name ] = value
1198
- return hints
1161
+ """In Python 2 this is not supported and always returns None."""
1162
+ return None
1199
1163
1200
1164
1201
1165
def no_type_check (arg ):
0 commit comments