Debian Codegraph @

debian/patches/six.patch

raw
1 From 46d64db4120d12a96609afb0b85134a8a0b36406 Mon Sep 17 00:00:00 2001
2 From: Alexandre Detiste <[email protected]>
3 Date: Sun, 10 Nov 2024 12:50:24 +0100
4 Subject: [PATCH] finish six removal
5
6 --- a/nixio/hdf5/h5dataset.py
7 +++ b/nixio/hdf5/h5dataset.py
8 @@ -6,11 +6,16 @@
9 # Redistribution and use in source and binary forms, with or without
10 # modification, are permitted under the terms of the BSD License. See
11 # LICENSE file in the root of the Project.
12 -from six import ensure_str
13 import numpy as np
14 from ..datatype import DataType
15 from .. import util
16
17 +def ensure_str(s):
18 + if isinstance(s, bytes):
19 + return s.decode()
20 + else:
21 + return s
22 +
23
24 class H5DataSet:
25
26 --- a/nixio/property.py
27 +++ b/nixio/property.py
28 @@ -13,13 +13,18 @@
29 from collections import Sequence, Iterable
30 from enum import Enum
31 from numbers import Number
32 -from six import ensure_str, ensure_text
33 import numpy as np
34
35 from .datatype import DataType
36 from .entity import Entity
37 from . import util
38
39 +def ensure_str(s):
40 + if isinstance(s, bytes):
41 + return s.decode()
42 + else:
43 + return s
44 +
45
46 class OdmlType(Enum):
47 """
48 @@ -249,7 +254,7 @@ def values(self):
49
50 def data_to_value(dat):
51 if isinstance(dat, bytes):
52 - dat = ensure_str(dat) # py2compat
53 + dat = dat.decode()
54 return dat
55
56 values = tuple(map(data_to_value, data))
57 @@ -274,7 +279,7 @@ def values(self, vals):
58 # Make sure all values are of the same data type
59 vtype = self._check_new_value_types(vals)
60 if vtype == DataType.String:
61 - vals = [ensure_text(v) for v in vals] # py2compat
62 + vals = [str(v) for v in vals]
63 self._h5dataset.shape = np.shape(vals)
64 data = np.array(vals, dtype=vtype)
65 self._h5dataset.write_data(data)
66 diff --git a/scripts/dorelease.py b/scripts/dorelease.py
67 index 3980180c..3773f196 100644
68 --- a/scripts/dorelease.py
69 +++ b/scripts/dorelease.py
70 @@ -105,7 +105,7 @@ def update_info(newver):
71 infodict = json.load(infofile)
72
73 verstring = infodict["VERSION"]
74 - newverstring = re.sub("[0-9\.a-z]+", newver, verstring)
75 + newverstring = re.sub(r"[0-9\.a-z]+", newver, verstring)
76
77 if newverstring == verstring:
78 print("No changes required in info.json")
79 @@ -140,7 +140,7 @@ def update_ci_confs(newver):
80 newconf = []
81 for line in oldconf:
82 if "NIX_BRANCH" in line:
83 - line = re.sub("1\.[0-9\.]+[0-9\.a-z]+(dev){0,1}", nixbranch, line)
84 + line = re.sub(r"1\.[0-9\.]+[0-9\.a-z]+(dev){0,1}", nixbranch, line)
85 line = line.replace("master", nixbranch)
86 newconf.append(line)
87
88 --- a/setup.py
89 +++ b/setup.py
90 @@ -78,7 +83,7 @@ def get_wheel_data():
91 tests_require=['pytest', 'scipy', 'pillow', 'matplotlib'],
92 test_suite='pytest',
93 setup_requires=['pytest-runner'],
94 - install_requires=['numpy', 'h5py', 'six', 'enum34;python_version<"3.4"'],
95 + install_requires=['numpy', 'h5py'],
96 package_data={'nixio': [license_text, description_text]},
97 include_package_data=True,
98 zip_safe=False,