Skip to content

Commit

Permalink
Merge pull request #74 from zhiwei2017/73-incompatible-with-python-311
Browse files Browse the repository at this point in the history
73 incompatible with python 3.11
  • Loading branch information
Lan314 committed May 10, 2023
2 parents f4e1429 + e63a6ce commit d049e3d
Show file tree
Hide file tree
Showing 9 changed files with 496 additions and 480 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: '3.9'
python-version: '3.10'
- name: Run flake8 check
run: make flake8
- name: Run mypy check
Expand All @@ -43,7 +43,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.7', '3.8.5', '3.8', '3.9', '3.10']
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
Expand Down Expand Up @@ -71,10 +71,10 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: '3.9'
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ named-enum
.. python version badge from PyPI
.. image:: https://img.shields.io/pypi/pyversions/named-enum.svg
:target: https://pypi.python.org/pypi/named-enum/
:alt: Python 3.7 | Python 3.8 | Python3.9 | Python3.10
:alt: Python 3.7 | Python 3.8 | Python3.9 | Python3.10 | Python3.11

.. pypi format
.. image:: https://img.shields.io/pypi/format/named-enum.svg
Expand Down
12 changes: 7 additions & 5 deletions named_enum/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ def _clean(self) -> None:
for name in self._member_names:
del self[name]
# _clean the variables as well
self._member_names, self._last_values = [], []
tmp_dict = _EnumDict()
self._member_names = tmp_dict._member_names
self._last_values = tmp_dict._last_values

def _convert(self, tuple_cls: Type[NamedTuple]) -> None:
"""Uses the given tuple class to _convert the items.
Expand All @@ -61,10 +63,10 @@ def _convert(self, tuple_cls: Type[NamedTuple]) -> None:
else:
# converting the type of the value in customized tuple
for value in self._last_values:
if not isinstance(value, Sequence):
raise ValueError("unable to unpack the value for the fields.")
elif isinstance(value, str):
_last_values.append(tuple_cls(value))
if not isinstance(value, Sequence) or isinstance(value, str):
err_msg = "Unable to unpack the value '{}' as {} " \
"for the fields.".format(value, tuple_cls.__name__)
raise ValueError(err_msg)
else:
_last_values.append(tuple_cls(*value))
self._clean()
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def _parse_requirements(filename):
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: Implementation",
"Topic :: Utilities",
"Natural Language :: English",
Expand Down

0 comments on commit d049e3d

Please sign in to comment.