zhiwei2017 / named_enum Goto Github PK
View Code? Open in Web Editor NEWPython named enumeration, which extends the built-in Enum class with extra features.
Home Page: https://zhiwei2017.github.io/named_enum/
License: MIT License
Python named enumeration, which extends the built-in Enum class with extra features.
Home Page: https://zhiwei2017.github.io/named_enum/
License: MIT License
RIght now there are doctests for each function.
However, that's not enough, unit tests using pytest framework are requisite for next release.
This code:
is following Python 3.7:
https://github.com/python/cpython/blob/041bfafeb00b0e5e565986b01c00bf9cddce3b4c/Lib/enum.py#L135
while in Python3.8, it should be:
metacls._get_mixins_(cls, bases)
ExtendedEnum: In the software development, the normal Enum class is really oft extended with some extra common used functions to simplify its usages
LabeledEnum: the labeled enumeration contains normally 2 attributes: key
and label
, it's used to generate the choices for a dropdown.
The bot created this issue to inform you that pyup.io has been set up on this repo.
Once you have closed it, the bot will open pull requests for updates as soon as they are available.
The source code documentation needs to be enhanced with multiple usage examples
With python 3.11 we have the following error
File "named_enum/test.py", line 7, in <module>
class NBALegendary(LabeledEnum):
File "named_enum/named_enum/meta.py", line 152, in __new__
namespace._convert(_tuple_cls)
File "named_enum/named_enum/meta.py", line 75, in _convert
self[name] = _last_values[i]
~~~~^^^^^^
File "named_enum/meta.py", line 33, in __setitem__
super().__setitem__(key, value)
File "/usr/lib/python3.11/enum.py", line 449, in __setitem__
self._member_names[key] = None
~~~~~~~~~~~~~~~~~~^^^^^
TypeError: list indices must be integers or slices, not str
Same script in python 3.10 seems to work fine
Currently a lot of tests have repeated some code blocks. To avoid the duplication and centralisation the tests, it's good to clean the tests.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.