Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup inspect.py #5351

Merged
merged 1 commit into from
Feb 9, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Lib/inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ def getclasstree(classes, unique=False):
for c in classes:
if c.__bases__:
for parent in c.__bases__:
if not parent in children:
if parent not in children:
children[parent] = []
if c not in children[parent]:
children[parent].append(c)
Expand Down Expand Up @@ -1539,7 +1539,7 @@ def _shadowed_dict(klass):
except KeyError:
pass
else:
if not (type(class_dict) is types.GetSetDescriptorType and
if not (isinstance(class_dict, types.GetSetDescriptorType) and
class_dict.__name__ == "__dict__" and
class_dict.__objclass__ is entry):
return class_dict
Expand All @@ -1561,7 +1561,7 @@ def getattr_static(obj, attr, default=_sentinel):
klass = type(obj)
dict_attr = _shadowed_dict(klass)
if (dict_attr is _sentinel or
type(dict_attr) is types.MemberDescriptorType):
isinstance(dict_attr, types.MemberDescriptorType)):
instance_result = _check_instance(obj, attr)
else:
klass = obj
Expand Down Expand Up @@ -1973,7 +1973,7 @@ def _signature_fromstr(cls, obj, s, skip_bound_arg=True):

def parse_name(node):
assert isinstance(node, ast.arg)
if node.annotation != None:
if node.annotation is not None:
raise ValueError("Annotations are not currently supported")
return node.arg

Expand Down