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 for regex patterns #473

Merged
merged 1 commit into from
Jan 4, 2024

Conversation

FrostyX
Copy link
Member

@FrostyX FrostyX commented Dec 28, 2023

I am fixing the following syntax warnings and more.

/home/jkadlcik/git/tito/src/tito/common.py:81: SyntaxWarning: invalid escape sequence '\d'
source_pattern = re.compile('^Source\d+?:\s*(.)')
/home/jkadlcik/git/tito/src/tito/common.py:732: SyntaxWarning: invalid escape sequence '\s'
ver_regex = re.compile("(\s
)(version)(\s*)(=)(\s*)(['"])(.)(['"])(.)",
/home/jkadlcik/git/tito/src/tito/tar.py:187: SyntaxWarning: invalid escape sequence '\d'
field_size = int(re.match('(\d+)', member_template).group(1)) - 1

I am fixing the following syntax warnings and more.

/home/jkadlcik/git/tito/src/tito/common.py:81: SyntaxWarning: invalid escape sequence '\d'
  source_pattern = re.compile('^Source\d+?:\s*(.*)')
/home/jkadlcik/git/tito/src/tito/common.py:732: SyntaxWarning: invalid escape sequence '\s'
  ver_regex = re.compile("(\s*)(version)(\s*)(=)(\s*)(['\"])(.*)(['\"])(.*)",
/home/jkadlcik/git/tito/src/tito/tar.py:187: SyntaxWarning: invalid escape sequence '\d'
  field_size = int(re.match('(\d+)', member_template).group(1)) - 1
self.changelog_regex = re.compile('\\*\s%s\s%s(\s<%s>)?' % (self.today,
self.git_user, git_email.replace("+", "\+").replace(".", "\.")))
self.changelog_regex = re.compile(r'\\*\s{0}\s{1}(\s<{2}>)?'.format(self.today,
self.git_user, git_email))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks equal to me but I should probably write some tests to be sure.

Copy link
Member

@xsuchy xsuchy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@xsuchy xsuchy merged commit 87f8076 into rpm-software-management:master Jan 4, 2024
10 of 11 checks passed
FrostyX added a commit to FrostyX/tito that referenced this pull request Feb 27, 2024
praiskup pushed a commit that referenced this pull request Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants