diff --git a/arkindex/documents/management/commands/reindex.py b/arkindex/documents/management/commands/reindex.py index 8aa199a84714f6dc87d3160032904eb3e7a2caa8..313cd320c4e02add843b664aebd5e8dd6e95b117 100644 --- a/arkindex/documents/management/commands/reindex.py +++ b/arkindex/documents/management/commands/reindex.py @@ -89,5 +89,6 @@ class Command(BaseCommand): else: tasks.append(reindex_pages.si()) - task = chain(*tasks).delay(async=False) + # Use this weird dict unpacking to prevent Flake8 W606 (async is a reserved keyword) + task = chain(*tasks).delay(**{'async': False}) print("Task started with ID {}".format(task.id)) diff --git a/arkindex/documents/surface.py b/arkindex/documents/surface.py index d34d320507a9726e5eb4d5625cfa0965c9188a8c..8646df6234aebd4515297f9b5a11f8f08b07efda 100644 --- a/arkindex/documents/surface.py +++ b/arkindex/documents/surface.py @@ -68,7 +68,7 @@ class SurfaceParser(object): assert coords is not None, 'Missing coords' polygon = [ (int(x), int(y)) - for x, y in re.findall('(\d+),(\d+)', coords.get('points')) + for x, y in re.findall(r'(\d+),(\d+)', coords.get('points')) ] text_id = textRegion.get('id') diff --git a/arkindex/documents/surface_link.py b/arkindex/documents/surface_link.py index eb6536647637b9ac657963be6a68d613b78e99b6..d31c0ab4b15ecefd3e6fc9726f2a0d7d19fe3f5c 100644 --- a/arkindex/documents/surface_link.py +++ b/arkindex/documents/surface_link.py @@ -125,7 +125,7 @@ class SurfaceLinker(object): self.acts_raw = sorted([ ActRaw(row[0], row[1]) for row in data - ], key=lambda a: int(re.sub('[^\d+]', '', a.number))) + ], key=lambda a: int(re.sub(r'[^\d+]', '', a.number))) def find_pages(self): # TODO: support all page types ! @@ -260,7 +260,7 @@ class SurfaceLinker(object): return # Get integer without complements - act_int = int(re.sub('[^\d]', '', act.number)) + act_int = int(re.sub(r'[^\d]', '', act.number)) # First act if i == 0 and act_int > 1: @@ -270,7 +270,7 @@ class SurfaceLinker(object): continue next_act = self.acts_raw[i + 1] - next_act_int = int(re.sub('[^\d]', '', next_act.number)) + next_act_int = int(re.sub(r'[^\d]', '', next_act.number)) # If an act seems missing (e.g. 13-15) if next_act_int - act_int > 1: diff --git a/arkindex/documents/tests/test_edit_elementpath.py b/arkindex/documents/tests/test_edit_elementpath.py index 92ff6191421200446e343f2dfc80f71cf2c2679b..994a40327caaf01a65efa8cc826205edd8616ebe 100644 --- a/arkindex/documents/tests/test_edit_elementpath.py +++ b/arkindex/documents/tests/test_edit_elementpath.py @@ -69,7 +69,7 @@ class TestEditElementPath(FixtureTestCase): ) def test_add_parent(self): - """ + r""" Test adding A as a parent of B. X Y \ / @@ -157,7 +157,7 @@ class TestEditElementPath(FixtureTestCase): self.check_parents(elements, 'B', ['A']) def test_remove_child(self): - """ + r""" Test removing child B from parent A. X Y \ / @@ -218,7 +218,7 @@ class TestEditElementPath(FixtureTestCase): self.check_parents(elements, 'G', ['K', 'B', 'D']) def test_remove_child_update(self): - """ + r""" Scenario where updates are required X Y \ / @@ -269,7 +269,7 @@ class TestEditElementPath(FixtureTestCase): self.check_parents(elements, 'F', ['B', 'E']) def test_delete_element(self): - """ + r""" Test the signal works properly and is able to remove all paths when removing an Element. X Y \ / diff --git a/arkindex/images/importer.py b/arkindex/images/importer.py index 9afd4d50639b7212d60c9ae6732a27a3e720cd68..becebd330cfeff763a7549d5957040c4d1e6f733 100644 --- a/arkindex/images/importer.py +++ b/arkindex/images/importer.py @@ -16,7 +16,7 @@ import fnmatch import uuid REGEX_INDEX = re.compile( - b'^(?:line_(\d+) )?(.+) \d+ ([\de\-\.]+) (\d+) (\d+) (\d+) (\d+)') + br'^(?:line_(\d+) )?(.+) \d+ ([\de\-\.]+) (\d+) (\d+) (\d+) (\d+)') logger = logging.getLogger(__name__) diff --git a/tests-requirements.txt b/tests-requirements.txt index c1020c3fd2eddbd1a061d06417b0a067097bd1c6..52b1884f0ab80decbadabd3cbd8128495b919fa2 100644 --- a/tests-requirements.txt +++ b/tests-requirements.txt @@ -1,4 +1,4 @@ -flake8==3.5.0 +flake8==3.6.0 tripoli fakeredis django-nose