Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make namedtupled Python3.10 compatible #27

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
9 changes: 6 additions & 3 deletions 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 All @@ -70,8 +73,8 @@
download_url='https://github.com/brennv/namedtupled/tarball/0.3.3',
keywords='namedtupled namedtuple json yaml attribute style data access javascript objects',
install_requires=[
'future',
'pyyaml',
'future==0.18.2',
'pyyaml==6.0',
],
include_package_data=True,
zip_safe=False)