threatq: fix py2-style artifacts resulting in SyntaxError - #45275
Conversation
This file is the only syntax error present on the repo: ```sh uv run --no-project --python 3.10 -m compileall . -q # ** Error compiling './Packs/ThreatQ/Integrations/ThreatQ/ThreatQ.py'... # File "./Packs/ThreatQ/Integrations/ThreatQ/ThreatQ.py", line 106 # except Exception, e: # ^^^^^^^^^^^^ # SyntaxError: multiple exception types must be parenthesized ```
There was a problem hiding this comment.
Pull request overview
This PR fixes remaining Python 2-style exception syntax in the ThreatQ integration that causes SyntaxError under Python 3, allowing the file to compile cleanly in the Cortex Content repo.
Changes:
- Replaced
except Exception, e:with Python 3-compatible exception handlers. - Removed an unused exception binding in one handler and added
as ewhere the exception object is referenced.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Thank you for your contribution. Your generosity and caring are unrivaled! Make sure to register your contribution by filling the Contribution Registration form, so our content wizard @kamalq97 will know the proposed changes are ready to be reviewed. |
|
Hi @Andrej730, thanks for contributing to the XSOAR marketplace. To receive credit for your generous contribution please follow this link. |
🤖 AI-Powered Code Review AvailableHi @kamalq97, you can leverage AI-powered code review to assist with this PR! Available Commands:
|
d44391a
into
demisto:contrib/Andrej730_fix-threatq-syntax-error
|
Thank you for your contribution. Your external PR has been merged and the changes are now included in one or more internal PRs for further review. Note Contributions containing XSIAM content (Modeling Rules, Parsing Rules, Correlation Rules, or Dashboards) are subject to an additional review process and may take longer to be merged to master. |
## Summary Reintroducing `demisto/content` back to `ruff-ecosystem`, it's a huge repo with 4.5K py file and 2.5M loc, so may have catch some cases for ecosystem report. It was previously commented out in #12129 due to the use of removed `E999` Issue with the use of removed rules upstream is resolved, though apparently `E999` was dropped from selection a while ago and new issue with the use of removed `UP038` occurred, but it's resolved now too - demisto/content#45227 Syntax error in still present in https://github.com/demisto/content/blob/master/Packs/ThreatQ/Integrations/ThreatQ/ThreatQ.py, so keeping `exclude`. Though apparently it doesn't break `ruff-ecosystem` anymore, but keeping it safe for now. I've submitted a fix upstream demisto/content#45275, so `exclude` can be removed later too. ## Test Plan Tested running `ruff-ecosystem` locally, no issues found.
* threatq: fix py2-style artifacts resulting in SyntaxError (#45275) This file is the only syntax error present on the repo: ```sh uv run --no-project --python 3.10 -m compileall . -q # ** Error compiling './Packs/ThreatQ/Integrations/ThreatQ/ThreatQ.py'... # File "./Packs/ThreatQ/Integrations/ThreatQ/ThreatQ.py", line 106 # except Exception, e: # ^^^^^^^^^^^^ # SyntaxError: multiple exception types must be parenthesized ``` * Update RN --------- Co-authored-by: Andrej730 <azhilenkov@gmail.com> Co-authored-by: Kamal Qarain <kqarain@paloaltonetworks.com>
Contributing to Cortex XSOAR Content
Make sure to register your contribution by filling the contribution registration form
The Pull Request will be reviewed only after the contribution registration form is filled.
Status
Description
This file is the only syntax error present in the repo, see below.
content/Packs/ThreatQ/Integrations/ThreatQ/ThreatQ.py
Lines 106 to 108 in dc86e1f
content/Packs/ThreatQ/Integrations/ThreatQ/ThreatQ.py
Lines 325 to 327 in dc86e1f
except Exception, e:looked like either artifact from Python 2 (Python was using this syntax instead ofexcept Exception as e) or just a typo. To fix the issue I've dropped unusedein one case and replaced withas ein another.Must have
relates: https://jira-dc.paloaltonetworks.com/browse/CIAC-17494