mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-22 09:36:44 +03:00
Simplify props.py
It had code for handling the differences between old-style and new-style classes in Python 2, but support for Python 2 was dropped long ago.
This commit is contained in:
parent
03cf2e131e
commit
6d609db8c0
|
@ -1,15 +1,11 @@
|
|||
class _OldClass:
|
||||
class _Class:
|
||||
pass
|
||||
|
||||
|
||||
class _NewClass:
|
||||
pass
|
||||
|
||||
|
||||
_all_vars = set(dir(_OldClass) + dir(_NewClass))
|
||||
_built_in_vars = set(dir(_Class))
|
||||
|
||||
|
||||
def props(x):
|
||||
return {
|
||||
key: vars(x).get(key, getattr(x, key)) for key in dir(x) if key not in _all_vars
|
||||
key: vars(x).get(key, getattr(x, key)) for key in dir(x) if key not in _built_in_vars
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user