Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use raw-strings where required #55

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/formats/pkpass/pkpass_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def create(cls, pass_file):
# For every type of image (background, footer, icon, logo, strip
# and thumbnail), only load the image with lowest resolution

image_type = re.split('\.|@', file_name)[0]
image_type = re.split(r'\.|@', file_name)[0]

if image_type in pass_images.keys():
continue
Expand Down
6 changes: 3 additions & 3 deletions src/model/digital_pass.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def as_tuple(self):
@classmethod
def from_css(this_class, css_string):
if css_string.startswith('rgb'):
result = re.search('rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)',
result = re.search(r'rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)',
css_string)

if not result or len(result.groups()) != 3:
Expand All @@ -170,7 +170,7 @@ def from_css(this_class, css_string):
b = result.group(3)

elif css_string.startswith('#'):
result = re.search('\#(\S{2})(\S{2})(\S{2})(\S{2})',
result = re.search(r'\#(\S{2})(\S{2})(\S{2})(\S{2})',
css_string)

if not result or len(result.groups()) != 4:
Expand Down Expand Up @@ -305,7 +305,7 @@ def from_iso_string(cls, string):
# Include hours and seconds if they have not been specified.
# Why? DateTime.new_from_iso8601 does not accept times without them.

matches = re.finditer('(T|t)([0-9]{2}\:?)+(\+|\-|Z)?', string)
matches = re.finditer(r'(T|t)([0-9]{2}\:?)+(\+|\-|Z)?', string)

for match in matches:
missing_info = None
Expand Down
6 changes: 3 additions & 3 deletions src/view/pass_viewer/pass_field_row.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@ def set_value(self, value):
value = GLib.markup_escape_text(value)

# Create a link for URLs
value = re.sub('(?:(https?://)|(www))(\S+)',
value = re.sub(r'(?:(https?://)|(www))(\S+)',
'<a href="https://\\2\\3">\\1\\2\\3</a>',
value)

# Create a link for telephone numbers
value = re.sub('(\+\d+[\(\)\-\d\s\.]+\d)',
value = re.sub(r'(\+\d+[\(\)\-\d\s\.]+\d)',
'<a href="tel:\\1">\\1</a>',
value)

# Create a link for e-mails
value = re.sub('(\S+\@[\w\-]+\.\w+)',
value = re.sub(r'(\S+\@[\w\-]+\.\w+)',
'<a href="mailto:\\1">\\1</a>',
value)

Expand Down