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

Replace attrdict to addict for python 3.10 compatibility #108

Merged
Merged
Show file tree
Hide file tree
Changes from 4 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
8 changes: 1 addition & 7 deletions pyEPR/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,7 @@
import warnings
from pathlib import Path

try:
from attrdict import AttrDict as Dict
except (ImportError, ModuleNotFoundError):
raise ImportError("""Please install python package `AttrDict`.
AttrDict is in PyPI, so it can be installed directly
(https://github.com/bcj/AttrDict) using:
$ pip install attrdict""")
from addict import Dict

##############################################################################
# Python header
Expand Down
8 changes: 5 additions & 3 deletions pyEPR/toolbox/pythonic.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# Constants
from collections import OrderedDict
from ..calcs.constants import Planck, elementary_charge, epsilon_0, pi, π, ħ, ϕ0, e_el

from .. import Dict

# ==============================================================================
# Utility functions
Expand Down Expand Up @@ -177,8 +177,10 @@ def get_instance_vars(obj, Forbidden=[]):
for v in dir(obj):
if not (v.startswith('__') or v.startswith('_')):
if not callable(getattr(obj, v)):
if not (v in Forbidden):
VARS[v] = getattr(obj, v)
# Added for using addict.Dict which is not callable.
if not isinstance(getattr(obj, v), Dict):
if not (v in Forbidden):
VARS[v] = getattr(obj, v)
return VARS


Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
attrdict>=1.8.0
addict
numpy>=1.15.0
pandas>=1.0.1
matplotlib>=3.1.0
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
GyeonghunKim marked this conversation as resolved.
Show resolved Hide resolved
"Programming Language :: Python :: 3.10",
"Topic :: Scientific/Engineering", "Environment :: Console",
"License :: OSI Approved :: Apache Software License"
],
Expand Down