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

finish six removal #544

Merged
merged 1 commit into from
Nov 14, 2024
Merged
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 .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ init-import=no

# List of qualified module names which can have objects that can redefine
# builtins.
redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io
redefining-builtins-modules=builtins,io


[CLASSES]
Expand Down
7 changes: 6 additions & 1 deletion nixio/hdf5/h5dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@
# Redistribution and use in source and binary forms, with or without
# modification, are permitted under the terms of the BSD License. See
# LICENSE file in the root of the Project.
from six import ensure_str
import numpy as np
from ..datatype import DataType
from .. import util

def ensure_str(s):
if isinstance(s, bytes):
return s.decode()
else:
return s


class H5DataSet:

Expand Down
11 changes: 8 additions & 3 deletions nixio/property.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,18 @@
from collections import Sequence, Iterable
from enum import Enum
from numbers import Number
from six import ensure_str, ensure_text
import numpy as np

from .datatype import DataType
from .entity import Entity
from . import util

def ensure_str(s):
if isinstance(s, bytes):
return s.decode()
else:
return s


class OdmlType(Enum):
"""
Expand Down Expand Up @@ -249,7 +254,7 @@ def values(self):

def data_to_value(dat):
if isinstance(dat, bytes):
dat = ensure_str(dat) # py2compat
dat = dat.decode()
return dat

values = tuple(map(data_to_value, data))
Expand All @@ -274,7 +279,7 @@ def values(self, vals):
# Make sure all values are of the same data type
vtype = self._check_new_value_types(vals)
if vtype == DataType.String:
vals = [ensure_text(v) for v in vals] # py2compat
vals = [str(v) for v in vals]
self._h5dataset.shape = np.shape(vals)
data = np.array(vals, dtype=vtype)
self._h5dataset.write_data(data)
Expand Down
6 changes: 3 additions & 3 deletions scripts/dorelease.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def update_info(newver):
infodict = json.load(infofile)

verstring = infodict["VERSION"]
newverstring = re.sub("[0-9\.a-z]+", newver, verstring)
newverstring = re.sub(r"[0-9\.a-z]+", newver, verstring)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sligthly unrelated, but useful nonetheless, these r"" raw strings will fix a bunch of SyntaxWarnings which would stem to the failure to translate the escape code "\." in this particular case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I always run pyflakes before submitting a PR; and the warnings were there, so ...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Acknowledged, I guess that explains it and the programming languages selection in setup.py. :)


if newverstring == verstring:
print("No changes required in info.json")
Expand Down Expand Up @@ -140,7 +140,7 @@ def update_ci_confs(newver):
newconf = []
for line in oldconf:
if "NIX_BRANCH" in line:
line = re.sub("1\.[0-9\.]+[0-9\.a-z]+(dev){0,1}", nixbranch, line)
line = re.sub(r"1\.[0-9\.]+[0-9\.a-z]+(dev){0,1}", nixbranch, line)
line = line.replace("master", nixbranch)
newconf.append(line)

Expand Down Expand Up @@ -168,7 +168,7 @@ def update_ci_confs(newver):
# newconf = []
# for line in oldconf:
# if "NIX_VERSION" in line:
# line = re.sub("'[1-9\.a-z]+'", "'" + newver + "'", line)
# line = re.sub(r"'[1-9\.a-z]+'", "'" + newver + "'", line)
# newconf.append(line)

# diff = diff_lines(oldconf, newconf)
Expand Down
7 changes: 6 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ def get_wheel_data():
'Programming Language :: Python',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Topic :: Scientific/Engineering'
]

Expand All @@ -78,7 +83,7 @@ def get_wheel_data():
tests_require=['pytest', 'scipy', 'pillow', 'matplotlib'],
test_suite='pytest',
setup_requires=['pytest-runner'],
install_requires=['numpy', 'h5py', 'six', 'enum34;python_version<"3.4"'],
install_requires=['numpy', 'h5py'],
package_data={'nixio': [license_text, description_text]},
include_package_data=True,
zip_safe=False,
Expand Down
Loading