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

UP015 (1) #38367

Closed
wants to merge 1 commit into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

def util_load_json(path: str) -> dict:
"""Load a json to python dict."""
with open(path, mode='r', encoding='utf-8') as f:
with open(path, encoding='utf-8') as f:
return json.loads(f.read())


Expand Down Expand Up @@ -115,7 +115,7 @@

api_token = client.get_api_token()

assert api_token == bool(False)

Check failure on line 118 in Packs/CofenseTriage/Integrations/CofenseTriagev3/CofenseTriagev3_test.py

View workflow job for this annotation

GitHub Actions / pre-commit / pre-commit

Ruff (E712)

Packs/CofenseTriage/Integrations/CofenseTriagev3/CofenseTriagev3_test.py:118:12: E712 Avoid equality comparisons to `False`; use `if not api_token:` for false checks


@patch(MOCKER_HTTP_METHOD)
Expand Down Expand Up @@ -259,7 +259,7 @@
context_output = util_load_json(
os.path.join("test_data", "threat_indicator/threat_indicators_command_context.json"))

with open(os.path.join("test_data", "threat_indicator/threat_indicators_command_readable_output.md"), 'r') as f:
with open(os.path.join("test_data", "threat_indicator/threat_indicators_command_readable_output.md")) as f:
readable_output = f.read()

# Execute
Expand Down Expand Up @@ -505,7 +505,7 @@
context_output = util_load_json(
os.path.join("test_data", "url/list_url_command_context.json"))

with open(os.path.join("test_data", "url/list_url_command_readable_output.md"), 'r') as f:
with open(os.path.join("test_data", "url/list_url_command_readable_output.md")) as f:
readable_output = f.read()

# Execute
Expand Down Expand Up @@ -637,7 +637,7 @@
context_output = util_load_json(
os.path.join("test_data", "threat_indicator/threat_indicators_command_context.json"))

with open(os.path.join("test_data", "threat_indicator/threat_indicators_command_readable_output.md"), 'r') as f:
with open(os.path.join("test_data", "threat_indicator/threat_indicators_command_readable_output.md")) as f:
readable_output = f.read()

# Execute
Expand Down Expand Up @@ -687,8 +687,7 @@
context_output = util_load_json(
os.path.join("test_data", "integration_submission/integration_submission_context.json"))

with open(os.path.join("test_data", "integration_submission/integration_submission_command_readable_output.md"),
'r') as f:
with open(os.path.join("test_data", "integration_submission/integration_submission_command_readable_output.md")) as f:
readable_output = f.read()

# Execute
Expand Down Expand Up @@ -740,7 +739,7 @@
context_output = util_load_json(
os.path.join("test_data", "reporter/reporter_list_context.json"))

with open(os.path.join("test_data", "reporter/reporter_list.md"), 'r') as f:
with open(os.path.join("test_data", "reporter/reporter_list.md")) as f:
readable_output = f.read()

# Execute
Expand Down Expand Up @@ -796,7 +795,7 @@
context_output = util_load_json(
os.path.join("test_data", "attachment_payload/attachment_payload_list_context.json"))

with open(os.path.join("test_data", "attachment_payload/attachment_payload_list.md"), 'r') as f:
with open(os.path.join("test_data", "attachment_payload/attachment_payload_list.md")) as f:
readable_output = f.read()

# Execute
Expand Down Expand Up @@ -916,7 +915,7 @@
context_output = util_load_json(
os.path.join("test_data", "threat_indicator/threat_indicators_command_context.json"))

with open(os.path.join("test_data", "threat_indicator/threat_indicators_command_readable_output.md"), 'r') as f:
with open(os.path.join("test_data", "threat_indicator/threat_indicators_command_readable_output.md")) as f:
readable_output = f.read()

# Execute
Expand Down Expand Up @@ -1061,7 +1060,7 @@
context_output = util_load_json(
os.path.join("test_data", "report_attachment_payload/report_attachment_payload_list_context.json"))

with open(os.path.join("test_data", "report_attachment_payload/report_attachment_payload_list.md"), 'r') as f:
with open(os.path.join("test_data", "report_attachment_payload/report_attachment_payload_list.md")) as f:
readable_output = f.read()

# Execute
Expand Down Expand Up @@ -1145,7 +1144,7 @@
context_output = util_load_json(
os.path.join("test_data", os.path.join("report_attachment", "report_attachment_list_context.json")))

with open(os.path.join("test_data", os.path.join("report_attachment", "report_attachment_list.md")), 'r') as f:
with open(os.path.join("test_data", os.path.join("report_attachment", "report_attachment_list.md"))) as f:
readable_output = f.read()

# Execute
Expand Down Expand Up @@ -1179,7 +1178,7 @@

from CofenseTriagev3 import cofense_report_attachment_download_command

with open(os.path.join("test_data", os.path.join("report_attachment", "report_attachment_download_response.xml")), 'r') as f:
with open(os.path.join("test_data", os.path.join("report_attachment", "report_attachment_download_response.xml"))) as f:
response = f.read()

# Mock response with the valid headers.
Expand Down
Loading