diff options
author | Stefan Israelsson Tampe <stefan.itampe@gmail.com> | 2018-05-07 20:23:49 +0200 |
---|---|---|
committer | Stefan Israelsson Tampe <stefan.itampe@gmail.com> | 2018-05-07 20:23:49 +0200 |
commit | 876d5d0fca204adce5335c5486bf6fb3d2188f22 (patch) | |
tree | 64c84b490c28c278b42a65370ccbeb23365b6cbd /modules/language/python/module | |
parent | 1753734c420edd4a5a641ad8e9c7250534dff136 (diff) |
enum.py works
Diffstat (limited to 'modules/language/python/module')
-rw-r--r-- | modules/language/python/module/enum.py | 10 | ||||
-rw-r--r-- | modules/language/python/module/types.scm | 3 |
2 files changed, 3 insertions, 10 deletions
diff --git a/modules/language/python/module/enum.py b/modules/language/python/module/enum.py index e657af3..34e19b6 100644 --- a/modules/language/python/module/enum.py +++ b/modules/language/python/module/enum.py @@ -108,7 +108,6 @@ class _EnumDict(dict): # This is also why there are checks in EnumMeta like `if Enum is not None` Enum = None -pk('EnumMeta') class EnumMeta(type): """Metaclass for Enum""" @classmethod @@ -129,7 +128,6 @@ class EnumMeta(type): # cannot be mixed with other types (int, float, etc.) if it has an # inherited __new__ unless a new __new__ is defined (or the resulting # class will fail). - pk('new',metacls,cls) member_type, first_enum = metacls._get_mixins_(bases) new, save_new, use_args = metacls._find_new_(classdict, member_type, @@ -351,7 +349,7 @@ class EnumMeta(type): """ return MappingProxyType(cls._member_map_) - + def __repr__(cls): return "<enum %r>" % cls.__name__ @@ -522,7 +520,6 @@ class EnumMeta(type): return __new__, save_new, use_args -pk('enum') class Enum(metaclass=EnumMeta): """Generic enumeration. @@ -654,7 +651,6 @@ class Enum(metaclass=EnumMeta): module_globals[name] = cls return cls -pk('intenum') class IntEnum(int, Enum): """Enum where members are also (and must be) ints""" @@ -663,7 +659,6 @@ class IntEnum(int, Enum): def _reduce_ex_by_name(self, proto): return self.name -pk('flag') class Flag(Enum): """Support for flags""" @@ -772,7 +767,6 @@ class Flag(Enum): inverted = reduce(_or_, inverted_members, self.__class__(0)) return self.__class__(inverted) -pk('intflag') class IntFlag(int, Flag): """Support for integer-based Flags""" @@ -837,8 +831,6 @@ class IntFlag(int, Flag): result = self.__class__(~self._value_) return result -pk('rest') - def _high_bit(value): """returns index of highest bit, or -1 if value is zero or negative""" return value.bit_length() - 1 diff --git a/modules/language/python/module/types.scm b/modules/language/python/module/types.scm index a148426..4448b6a 100644 --- a/modules/language/python/module/types.scm +++ b/modules/language/python/module/types.scm @@ -4,6 +4,7 @@ #:use-module (language python exceptions) #:use-module (language python def) #:use-module (language python bool) + #:use-module (language python dict) #:use-module ((language python module python) #:select (getattr type)) #:export (MappingProxyType DynamicClassAttribute Functiontype LambdaType)) @@ -11,7 +12,7 @@ """ Define names for built-in types that aren't directly accessible as a builtin. """ -(define MappingProxyType <hashtable>) +(define MappingProxyType dict) (define FunctionType <procedure>) (define LambdaType <procedure>) |