Skip to content

Commit

Permalink
Review SyntaxWarning thrown by Python 3.12 with escape sequences
Browse files Browse the repository at this point in the history
  • Loading branch information
sbesson committed Feb 5, 2024
1 parent 66ca6d9 commit cd3a1a6
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/omero/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ class MyControl(BaseControl):
def _configure(self, parser):
self.add_error("NAME", 100, "some message: %s")
...
def __call__(self, \*args):
def __call__(self, *args):
self.raise_error("NAME", "my text")
"""

Expand Down
4 changes: 2 additions & 2 deletions src/omero/install/win_set_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@


def win_set_path(new_name=dummy, old_name=r"c:\omero_dist", dir=path(".")):
"""
r"""
Parses the Windows cfg and xml files and
replaces the default "c:\omero_dist" with the
given value.
Expand Down Expand Up @@ -77,7 +77,7 @@ def win_set_path(new_name=dummy, old_name=r"c:\omero_dist", dir=path(".")):
print("Failed to set path: ", e)
sys.exit(1)

print("""Usage: %s [oldname] newname
print(r"""Usage: %s [oldname] newname
Replaces the [oldname] entries in the Windows configuration files
with [newname]. By default, [oldname] is set to "c:\omero_dist"
Expand Down
8 changes: 4 additions & 4 deletions src/omero/util/cleanse.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,20 +162,20 @@ def do_cleanse(self):
if object_id.val not in existing_ids:
if object_id.val == -1:
if self.dry_run:
print(" \_ %s (ignored/keep)" % path)
print(r" \_ %s (ignored/keep)" % path)
else:
size = os.stat(path)[ST_SIZE]
self.cleansed.append(path)
self.bytes_cleansed = size
if self.dry_run:
print(" \_ %s (remove)" % path)
print(r" \_ %s (remove)" % path)
else:
try:
os.unlink(path)
except OSError as e:
print(e)
elif self.dry_run:
print(" \_ %s (keep)" % path)
print(r" \_ %s (keep)" % path)
self.deferred_paths = list()

def finalize(self):
Expand Down Expand Up @@ -260,7 +260,7 @@ def delete_empty_dirs(repo, root, client, dry_run):

if dry_run:
for directory in to_delete:
print(" \_ %s%s (remove)" % (root, directory))
print(r" \_ %s%s (remove)" % (root, directory))
elif to_delete:
# probably less than a screenful
batch_size = 20
Expand Down
4 changes: 2 additions & 2 deletions src/omero/util/importperf.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ class ImporterLog(object):
# Regular expression for matching log4j log lines
log_regex = re.compile(
r'^(?P<date_time>\S+\s+\S+)\s+(?P<ms_elapsed>\d+)\s+'
'(?P<thread>\[.*?\])\s+(?P<level>\S+)\s+(?P<class>\S+)\s+-\s+'
'(?P<message>.*)$')
r'(?P<thread>\[.*?\])\s+(?P<level>\S+)\s+(?P<class>\S+)\s+-\s+'
r'(?P<message>.*)$')

# Regular expression for matching possible OMERO.importer status messages
status_regex = re.compile(r'^[A-Z_]*')
Expand Down

0 comments on commit cd3a1a6

Please sign in to comment.