@@ -79,25 +79,25 @@ def signature(f):
79
79
args = [
80
80
p .name for p in sig .parameters .values ()
81
81
if p .kind == inspect .Parameter .POSITIONAL_OR_KEYWORD
82
- ]
82
+ ]
83
83
varargs = [
84
84
p .name for p in sig .parameters .values ()
85
85
if p .kind == inspect .Parameter .VAR_POSITIONAL
86
- ]
86
+ ]
87
87
varargs = varargs [0 ] if varargs else None
88
88
keywords = [
89
89
p .name for p in sig .parameters .values ()
90
90
if p .kind == inspect .Parameter .VAR_KEYWORD
91
- ]
91
+ ]
92
92
keywords = keywords [0 ] if keywords else None
93
93
defaults = [
94
94
p .default for p in sig .parameters .values ()
95
95
if p .kind == inspect .Parameter .POSITIONAL_OR_KEYWORD
96
96
and p .default is not p .empty
97
- ] or None
98
- argspec = namedtuple ('Signature' ,['args' ,'defaults' ,
99
- 'varargs' ,'keywords' ])
100
- return argspec (args ,defaults ,varargs ,keywords )
97
+ ] or None
98
+ argspec = namedtuple ('Signature' , ['args' , 'defaults' ,
99
+ 'varargs' , 'keywords' ])
100
+ return argspec (args , defaults , varargs , keywords )
101
101
102
102
# have to explicitly put builtins into the namespace
103
103
range = range
@@ -170,7 +170,7 @@ def iterkeys(obj, **kw):
170
170
def itervalues (obj , ** kw ):
171
171
return obj .itervalues (** kw )
172
172
173
- next = lambda it : it .next ()
173
+ next = lambda it : it .next ()
174
174
else :
175
175
def iteritems (obj , ** kw ):
176
176
return iter (obj .items (** kw ))
@@ -183,6 +183,7 @@ def itervalues(obj, **kw):
183
183
184
184
next = next
185
185
186
+
186
187
def bind_method (cls , name , func ):
187
188
"""Bind a method to class, python 2 and python 3 compatible.
188
189
@@ -307,7 +308,8 @@ def set_function_name(f, name, cls):
307
308
f .__name__ = name
308
309
return f
309
310
310
- class ResourceWarning (Warning ): pass
311
+ class ResourceWarning (Warning ):
312
+ pass
311
313
312
314
string_and_binary_types = string_types + (binary_type ,)
313
315
@@ -398,14 +400,18 @@ def is_platform_little_endian():
398
400
""" am I little endian """
399
401
return sys .byteorder == 'little'
400
402
403
+
401
404
def is_platform_windows ():
402
405
return sys .platform == 'win32' or sys .platform == 'cygwin'
403
406
407
+
404
408
def is_platform_linux ():
405
409
return sys .platform == 'linux2'
406
410
411
+
407
412
def is_platform_mac ():
408
413
return sys .platform == 'darwin'
409
414
415
+
410
416
def is_platform_32bit ():
411
417
return struct .calcsize ("P" ) * 8 < 64
0 commit comments