Skip to content

Updated and Created new PR#85

Open
KOLLIVENNELACHOWDARY wants to merge 1 commit intosugarlabs:masterfrom
KOLLIVENNELACHOWDARY:master
Open

Updated and Created new PR#85
KOLLIVENNELACHOWDARY wants to merge 1 commit intosugarlabs:masterfrom
KOLLIVENNELACHOWDARY:master

Conversation

@KOLLIVENNELACHOWDARY
Copy link

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

  • 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

Verification

No SyntaxWarnings
All functionality preserved

Fixes #82

@KOLLIVENNELACHOWDARY KOLLIVENNELACHOWDARY changed the title Add files via upload Updated and Created new PR Feb 25, 2026
@Bindkushal
Copy link

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):
return node.value

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.

@quozl
Copy link

quozl commented Mar 13, 2026

Please put review comments into context in the pull request you are reviewing.

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.

Calculate on Ubuntu 24.04

3 participants