From 46d64db4120d12a96609afb0b85134a8a0b36406 Mon Sep 17 00:00:00 2001
From: Alexandre Detiste <alexandre.detiste@gmail.com>
Date: Sun, 10 Nov 2024 12:50:24 +0100
Subject: [PATCH] finish six removal

--- a/nixio/hdf5/h5dataset.py
+++ b/nixio/hdf5/h5dataset.py
@@ -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:
 
--- a/nixio/property.py
+++ b/nixio/property.py
@@ -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):
     """
@@ -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))
@@ -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)
diff --git a/scripts/dorelease.py b/scripts/dorelease.py
index 3980180c..3773f196 100644
--- a/scripts/dorelease.py
+++ b/scripts/dorelease.py
@@ -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")
@@ -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)
 
--- a/setup.py
+++ b/setup.py
@@ -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,
