Skip to content

Commit

Permalink
Make namedtupled Python3.10 compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
arushi_sharma committed Nov 18, 2022
1 parent 2b8e3ba commit 8d43fa7
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
env/
venv/
*venv*/
__pycache__/
.cache/
*.pyc
Expand Down
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ python:
- "3.4"
- "3.5"
- "3.6"
- "3.9"
- "3.10"

before_install:
- pip install pytest pytest-cov pytest-datafiles
Expand Down
4 changes: 2 additions & 2 deletions namedtupled/integrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ def load_json(data=None, path=None, name='NT'):
def load_yaml(data=None, path=None, name='NT'):
""" Map namedtuples with yaml data. """
if data and not path:
return mapper(yaml.load(data), _nt_name=name)
return mapper(yaml.full_load(data), _nt_name=name)
if path and not data:
with open(path, 'r') as f:
data = yaml.load(f)
data = yaml.full_load(f)
return mapper(data, _nt_name=name)
if data and path:
raise ValueError('expected one source and received two')
Expand Down
3 changes: 2 additions & 1 deletion namedtupled/namedtupled.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from future import standard_library
standard_library.install_aliases()
from collections import Mapping, namedtuple, UserDict
from collections import namedtuple, UserDict
from collections.abc import Mapping


def mapper(mapping, _nt_name='NT'):
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
future==0.15.2
PyYAML==3.11
future==0.18.2
PyYAML==6.0
5 changes: 4 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
setup(
name='namedtupled',
packages=['namedtupled'],
version='0.3.3',
version='0.3.4',
description='Lightweight namedtuple wrapper for attribute-style data access (a la JavaScript objects).',
long_description=brief_description,
classifiers=[
Expand All @@ -62,6 +62,9 @@
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
],
author='brennv',
author_email='[email protected]',
Expand Down

0 comments on commit 8d43fa7

Please sign in to comment.