Skip to content

Conversation

@colinthebomb1
Copy link
Collaborator

Overview:

This PR fixes a warning in regex expressions by using raw strings for regex expressions. The PR also fixes a warning for unused return statements in ast test cases.

Example warnings:

core/rule_parser.py:238
/home/runner/work/QueryBooster/QueryBooster/core/rule_parser.py:238: DeprecationWarning: invalid escape sequence '\(' 'markerStart': ['\(', '\{', '\['],

tests/test_ast.py::test_complete_query
  /opt/hostedtoolcache/Python/3.10.19/x64/lib/python3.10/site-packages/_pytest/python.py:170: PytestReturnNotNoneWarning: Test functions should return None, but tests/test_ast.py::test_complete_query returned <class 'core.ast.node.QueryNode'>.

Code Changes:

  • Used raw strings for regex in rule_parser.py and rule_generator.py
  • Removed unused returns in test_ast.py

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses two types of Python warnings in the codebase: DeprecationWarning for invalid escape sequences in regex patterns and PytestReturnNotNoneWarning for test functions returning values. The fixes are straightforward and maintain the same functionality while eliminating the warnings.

Changes:

  • Converted regex pattern strings to raw strings (r-prefix) to properly handle escape sequences
  • Removed return statements from test functions to comply with pytest conventions

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
tests/test_ast.py Removed return statements from test functions that were causing PytestReturnNotNoneWarning
core/rule_parser.py Converted regex patterns to raw strings to fix DeprecationWarning for invalid escape sequences
core/rule_generator.py Converted regex patterns to raw strings to fix DeprecationWarning for invalid escape sequences

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

1 participant