Skip to content

Commit

Permalink
Merge pull request #544 from a-detiste/master
Browse files Browse the repository at this point in the history
Finish removal of six module
  • Loading branch information
achilleas-k authored Nov 14, 2024
2 parents f1b448e + 46d64db commit 09bfbf2
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 9 deletions.
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)

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

0 comments on commit 09bfbf2

Please sign in to comment.