You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixes issue #82 - Removes SyntaxWarning about invalid escape sequences in regex strings.
Problem
SyntaxWarning appears at lines 224 and 226 about invalid escape sequences '.' in regex strings.
Solution
Convert regex strings to raw strings by adding 'r' prefix.
Changes
Line 224: FLOAT_REGEXP_STR = r'...'
Line 226: RANGE_REGEXP = re.compile(r'...')
Warnings Eliminated:
Line 224: invalid escape sequence '.'
Line 226: invalid escape sequence '.'
Line 144: ast.Str is deprecated
Line 493: ast.Num is deprecated
Line 494: Attribute n is deprecated
Line 496: ast.Str is deprecated
Line 599: ast.Num is deprecated
Line 602: Attribute n is deprecated
Line 603: ast.Num is deprecated
Line 604: Attribute n is deprecated
Hey, I reviewed the changes carefully. The raw string fix is correct, but I noticed a potential issue in the AST handling changes.
In _process_node, there are now two consecutive checks for ast.Constant:
elif isinstance(node, ast.Constant) and isinstance(node.value, str):
return node.value
The second elif can never be reached — once the first isinstance(node, ast.Constant) matches, it returns immediately. The string check will never execute, which could cause subtle bugs if the logic ever needs to differentiate between string and non-string constants in the future.
The original ast.Str check was actually handling this case intentionally.
Please put review comments into context in the pull request you are reviewing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes issue #82 - Removes SyntaxWarning about invalid escape sequences in regex strings.
Problem
SyntaxWarning appears at lines 224 and 226 about invalid escape sequences '.' in regex strings.
Solution
Convert regex strings to raw strings by adding 'r' prefix.
Changes
Warnings Eliminated:
Line 224: invalid escape sequence '.'
Line 226: invalid escape sequence '.'
Line 144: ast.Str is deprecated
Line 493: ast.Num is deprecated
Line 494: Attribute n is deprecated
Line 496: ast.Str is deprecated
Line 599: ast.Num is deprecated
Line 602: Attribute n is deprecated
Line 603: ast.Num is deprecated
Line 604: Attribute n is deprecated
Verification
No SyntaxWarnings
All functionality preserved
Fixes #82