-
Notifications
You must be signed in to change notification settings - Fork 0
2to3 python conversion with major version bump to 1.0.0-yr.alpha #1
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, minus the questions around callable on non-lists.
@@ -86,7 +87,7 @@ def method_fields(self, handler, fields): | |||
for field in fields - Emitter.RESERVED_FIELDS: | |||
t = getattr(handler, str(field), None) | |||
|
|||
if t and callable(t): | |||
if t and isinstance(t, collections.Callable): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original code should still work here in 3.5; they re-added callable in 3.2
@@ -30,8 +31,8 @@ class Resource(object): | |||
'PUT': 'update', 'DELETE': 'delete' } | |||
|
|||
def __init__(self, handler, authentication=None): | |||
if not callable(handler): | |||
raise AttributeError, "Handler not callable." | |||
if not isinstance(handler, collections.Callable): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't think this works; this isn't a collection.
@@ -86,10 +87,10 @@ def anonymous(self): | |||
if hasattr(self.handler, 'anonymous'): | |||
anon = self.handler.anonymous | |||
|
|||
if callable(anon): | |||
if isinstance(anon, collections.Callable): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-list?
@@ -140,16 +140,16 @@ def test(): | |||
>>> is_valid_javascript_identifier('$210') | |||
True | |||
|
|||
>>> is_valid_javascript_identifier(u'Stra\u00dfe') | |||
>>> is_valid_javascript_identifier(u'Stra\\u00dfe') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't update the comments correctly here, re: u'string'
unicode string classifier.
@@ -221,7 +222,7 @@ def _model(data, fields=()): | |||
if inst: | |||
if hasattr(inst, 'all'): | |||
ret[model] = _related(inst, fields) | |||
elif callable(inst): | |||
elif isinstance(inst, collections.Callable): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not collection?
@@ -236,7 +237,7 @@ def _model(data, fields=()): | |||
else: | |||
maybe = getattr(data, maybe_field, None) | |||
if maybe is not None: | |||
if callable(maybe): | |||
if isinstance(maybe, collections.Callable): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not collection?
ran 2to3 python conversion tool.
wholly untested.