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

Ruff: Add and fix PTH113 #11194

Merged
merged 6 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion dojo/settings/.settings.dist.py.sha256sum
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6b9365d002880ae64ab54da905ede076db5a8661960f8f1e2793b7f4d25ff7e8
d15d00db786392dc1099a06bd77aebc3e6aa0d9cfcd58e51b143a06521faaccd
3 changes: 2 additions & 1 deletion dojo/settings/settings.dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import warnings
from datetime import timedelta
from email.utils import getaddresses
from pathlib import Path

import environ
from celery.schedules import crontab
Expand Down Expand Up @@ -332,7 +333,7 @@ def generate_url(scheme, double_slashes, user, password, host, port, path, param


# Read .env file as default or from the command line, DD_ENV_PATH
if os.path.isfile(root("dojo/settings/.env.prod")) or "DD_ENV_PATH" in os.environ:
if Path(root("dojo/settings/.env.prod")).is_file() or "DD_ENV_PATH" in os.environ:
env.read_env(root("dojo/settings/" + env.str("DD_ENV_PATH", ".env.prod")))

# ------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ select = [
"TCH",
"INT",
"ARG003", "ARG004", "ARG005",
"PTH2", "PTH101", "PTH102", "PTH103", "PTH104", "PTH105", "PTH106", "PTH107", "PTH108", "PTH109", "PTH110", "PTH111", "PTH114", "PTH115", "PTH116", "PTH117", "PTH119", "PTH121", "PTH124",
"PTH2", "PTH101", "PTH102", "PTH103", "PTH104", "PTH105", "PTH106", "PTH107", "PTH108", "PTH109", "PTH110", "PTH111", "PTH113", "PTH114", "PTH115", "PTH116", "PTH117", "PTH119", "PTH121", "PTH124",
"TD001", "TD004", "TD005",
"PD",
"PGH",
Expand Down
8 changes: 4 additions & 4 deletions unittests/test_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_file_existence(self):
with self.subTest(parser=parser_dir.name, category="docs"):
doc_file = os.path.join(basedir, "docs", "content", "en", "integrations", "parsers", category, f"{doc_name}.md")
self.assertTrue(
os.path.isfile(doc_file),
Path(doc_file).is_file(),
f"Documentation file '{doc_file}' is missing or using different name",
)

Expand All @@ -55,7 +55,7 @@ def test_file_existence(self):
with self.subTest(parser=parser_dir.name, category="parser"):
parser_test_file = os.path.join(basedir, "unittests", "tools", f"test_{parser_dir.name}_parser.py")
self.assertTrue(
os.path.isfile(parser_test_file),
Path(parser_test_file).is_file(),
f"Unittest of parser '{parser_test_file}' is missing or using different name",
)

Expand All @@ -78,7 +78,7 @@ def test_file_existence(self):
with self.subTest(parser=parser_dir.name, category="importer"):
importer_test_file = os.path.join(basedir, "unittests", "tools", f"test_{parser_dir.name}_importer.py")
self.assertTrue(
os.path.isfile(importer_test_file),
Path(importer_test_file).is_file(),
f"Unittest of importer '{importer_test_file}' is missing or using different name",
)
for file in os.scandir(os.path.join(basedir, "dojo", "tools", parser_dir.name)):
Expand Down Expand Up @@ -110,6 +110,6 @@ def test_parser_existence(self):
with self.subTest(parser=docs.name.split(".md")[0], category="parser"):
parser = os.path.join(basedir, "dojo", "tools", f"{docs.name.split('.md')[0]}", "parser.py")
self.assertTrue(
os.path.isfile(parser),
Path(parser).is_file(),
f"Parser '{parser}' is missing or using different name",
)
Loading