File: python3.12-syntax.patch

package info (click to toggle)
bmtk 1.1.1%2Bds-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 204,044 kB
  • sloc: python: 37,064; javascript: 1,998; makefile: 42; sh: 33
file content (69 lines) | stat: -rw-r--r-- 3,354 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
From: Andreas Tille <tille@debian.org>
Date: Fri, 6 Dec 2024 10:36:57 +0100
Subject: Fix Python3.12 string syntax

Bug-Debian: https://bugs.debian.org/1085366
Last-Update: 2024-12-06
Forwarded: https://github.com/AllenInstitute/bmtk/pull/406
---
 bmtk/simulator/bionet/modules/comsol.py       | 4 ++--
 bmtk/simulator/filternet/lgnmodel/util_fns.py | 2 +-
 bmtk/utils/io/cell_vars.py                    | 2 +-
 bmtk/utils/sonata/config/sonata_config.py     | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/bmtk/simulator/bionet/modules/comsol.py b/bmtk/simulator/bionet/modules/comsol.py
index 6e152e8..f8f6793 100644
--- a/bmtk/simulator/bionet/modules/comsol.py
+++ b/bmtk/simulator/bionet/modules/comsol.py
@@ -174,9 +174,9 @@ class ComsolMod(SimulatorMod):
         """
 
         # Extract column headers and data from comsol_file
-        headers = pd.read_csv(comsol_file, sep="\s{3,}", header=None, skiprows=8, nrows=1, engine='python')
+        headers = pd.read_csv(comsol_file, sep=r"\s{3,}", header=None, skiprows=8, nrows=1, engine='python')
         headers = headers.to_numpy()[0]
-        data = pd.read_csv(comsol_file, sep="\s+", header=None, skiprows=9)
+        data = pd.read_csv(comsol_file, sep=r"\s+", header=None, skiprows=9)
 
         # Convert V to mV if necessary
         if headers[3][3] == 'V':                        
diff --git a/bmtk/simulator/filternet/lgnmodel/util_fns.py b/bmtk/simulator/filternet/lgnmodel/util_fns.py
index c66025c..9a8801d 100644
--- a/bmtk/simulator/filternet/lgnmodel/util_fns.py
+++ b/bmtk/simulator/filternet/lgnmodel/util_fns.py
@@ -48,7 +48,7 @@ def create_ff_mov(frame_rate, tst, tend, xrng, yrng):
 ##################################################
 def create_grating_movie_list(gr_dir_name):
     gr_fnames = os.listdir(gr_dir_name)
-    gr_fnames_ord = sorted(gr_fnames, key=lambda x: (int(re.sub('\D', '', x)), x))
+    gr_fnames_ord = sorted(gr_fnames, key=lambda x: (int(re.sub(r'\D', '', x)), x))
 
     gr_mov_list = []
     for fname in gr_fnames_ord[:5]:
diff --git a/bmtk/utils/io/cell_vars.py b/bmtk/utils/io/cell_vars.py
index 76c04b0..30c6452 100644
--- a/bmtk/utils/io/cell_vars.py
+++ b/bmtk/utils/io/cell_vars.py
@@ -16,7 +16,7 @@ class CellVarRecorder(object):
     _io = io
 
     class DataTable(object):
-        """A small struct to keep track of different \*/data (and buffer) tables"""
+        """A small struct to keep track of different data (and buffer) tables"""
         def __init__(self, var_name):
             self.var_name = var_name
             # If buffering data, buffer_block will be an in-memory array and will write to data_block during when
diff --git a/bmtk/utils/sonata/config/sonata_config.py b/bmtk/utils/sonata/config/sonata_config.py
index 91906fa..f695ebe 100644
--- a/bmtk/utils/sonata/config/sonata_config.py
+++ b/bmtk/utils/sonata/config/sonata_config.py
@@ -397,7 +397,7 @@ class ConfigParser(object):
         :return: json rvalue with resolved variables. Won't resolve variables that don't exist in manifest.
         """
         ret_val = json_str
-        variables = [m for m in re.finditer('\$\{?[\w]+\}?', json_str)]
+        variables = [m for m in re.finditer(r'\$\{?[\w]+\}?', json_str)]
         for var in variables:
             var_key = var.group()
             # change $VAR or ${VAR} --> VAR