Skip to content

Commit 4b20755

Browse files
committed
Use raw strings for regular expressions containing regular expression escapes. This seems to have been working before, but flake8 got more strict about it.
1 parent 58fc1a4 commit 4b20755

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

vectordatasource/meta/function.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,9 +337,9 @@ def mz_calculate_ferry_level(shape):
337337
return 13
338338

339339

340-
DECIMAL_UNIT_PATTERN = re.compile('([0-9]+(\.[0-9]*)?) *(mi|km|m|nmi|ft)$')
341-
IMPERIAL_PATTERN = re.compile('([0-9]+(\.[0-9]*)?)\' *(([0-9]+)")?')
342-
NUMERIC_PATTERN = re.compile('^([0-9]+(\.[0-9]*)?)$')
340+
DECIMAL_UNIT_PATTERN = re.compile(r'([0-9]+(\.[0-9]*)?) *(mi|km|m|nmi|ft)$')
341+
IMPERIAL_PATTERN = re.compile(r'([0-9]+(\.[0-9]*)?)\' *(([0-9]+)")?')
342+
NUMERIC_PATTERN = re.compile(r'^([0-9]+(\.[0-9]*)?)$')
343343

344344

345345
UNIT_CONVERSION_FACTORS = {

vectordatasource/transform.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757

5858
# used to detect station names which are followed by a
5959
# parenthetical list of line names.
60-
station_pattern = re.compile('([^(]*)\(([^)]*)\).*')
60+
station_pattern = re.compile(r'([^(]*)\(([^)]*)\).*')
6161

6262
# used to detect if an airport's IATA code is the "short"
6363
# 3-character type. there are also longer codes, and ones
@@ -6676,11 +6676,11 @@ def _bus_network_importance(network, ref):
66766676
return _generic_network_importance(network, ref, {})
66776677

66786678

6679-
_NUMBER_AT_FRONT = re.compile('^(\d+\w*)', re.UNICODE)
6680-
_SINGLE_LETTER_AT_FRONT = re.compile('^([^\W\d]) *(\d+)', re.UNICODE)
6681-
_LETTER_THEN_NUMBERS = re.compile('^[^\d\s_]+[ -]?([^\s]+)',
6679+
_NUMBER_AT_FRONT = re.compile(r'^(\d+\w*)', re.UNICODE)
6680+
_SINGLE_LETTER_AT_FRONT = re.compile(r'^([^\W\d]) *(\d+)', re.UNICODE)
6681+
_LETTER_THEN_NUMBERS = re.compile(r'^[^\d\s_]+[ -]?([^\s]+)',
66826682
re.UNICODE | re.IGNORECASE)
6683-
_UA_TERRITORIAL_RE = re.compile('^(\w)-(\d+)-(\d+)$',
6683+
_UA_TERRITORIAL_RE = re.compile(r'^(\w)-(\d+)-(\d+)$',
66846684
re.UNICODE | re.IGNORECASE)
66856685

66866686

0 commit comments

Comments
 (0)