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

Fix makeprops.py syntax warning #2075

Merged
merged 1 commit into from
Apr 26, 2024
Merged
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
12 changes: 6 additions & 6 deletions config/makeprops.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,19 +582,19 @@ def fix(self, propertyName):

def deprecatedImpl(self, propertyName):
self.srcFile.write(
' new Property(@"^%s\.%s$", true, null),\n'
r' new Property(@"^%s\.%s$", true, null),\n'
Copy link
Member

Choose a reason for hiding this comment

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

If I understand this correctly, these are escape sequences for the regexp, in a python string it should be \\. or use the r"" format which doesn't use escape sequences. Is that correct?

Copy link
Member Author

@externl externl Apr 26, 2024

Choose a reason for hiding this comment

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

Yes, other similar fixes in the past used the r"" format.

% (self.currentSection, self.fix(propertyName))
)

def deprecatedImplWithReplacementImpl(self, propertyName, deprecatedBy):
self.srcFile.write(
' new Property(@"^%s\.%s$", true, @"%s"),\n'
r' new Property(@"^%s\.%s$", true, @"%s"),\n'
% (self.currentSection, self.fix(propertyName), deprecatedBy)
)

def propertyImpl(self, propertyName):
self.srcFile.write(
' new Property(@"^%s\.%s$", false, null),\n'
r' new Property(@"^%s\.%s$", false, null),\n'
% (self.currentSection, self.fix(propertyName))
)

Expand Down Expand Up @@ -657,21 +657,21 @@ def fix(self, propertyName):
def deprecatedImpl(self, propertyName):
if self.currentSection in self.validSections:
self.srcFile.write(
' new Property("/^%s\.%s/", true, null),\n'
r' new Property("/^%s\.%s/", true, null),\n'
% (self.currentSection, self.fix(propertyName))
)

def deprecatedImplWithReplacementImpl(self, propertyName, deprecatedBy):
if self.currentSection in self.validSections:
self.srcFile.write(
' new Property("/^%s\.%s/", true, "%s"),\n'
r' new Property("/^%s\.%s/", true, "%s"),\n'
% (self.currentSection, self.fix(propertyName), deprecatedBy)
)

def propertyImpl(self, propertyName):
if self.currentSection in self.validSections:
self.srcFile.write(
' new Property("/^%s\.%s/", false, null),\n'
r' new Property("/^%s\.%s/", false, null),\n'
% (self.currentSection, self.fix(propertyName))
)

Expand Down