Skip to content

Commit

Permalink
fix linted warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
m-fila committed Sep 17, 2024
1 parent 84a6965 commit b9dc969
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
4 changes: 2 additions & 2 deletions python/edm4hep/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
res = ROOT.gInterpreter.LoadFile("edm4hep/Constants.h")
if res != 0:
raise RuntimeError("Failed to load Constants.h")
from ROOT import edm4hep
from ROOT import edm4hep # noqa: E402

from podio.pythonizations import load_pythonizations
from podio.pythonizations import load_pythonizations # noqa: E402

load_pythonizations("edm4hep")

Expand Down
3 changes: 2 additions & 1 deletion scripts/createEDM4hepFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ def create_CovMatrixNf(n_dim):
"""Create a covariance matrix of dimension n_dim"""
if n_dim not in (2, 3, 4, 6):
return ValueError(
f"{n_dim} is not a valid dimension for a CovMatrix in EDM4hep. Valid: (2, 3, 4, 6)"
f"{n_dim} is not a valid dimension for a CovMatrix in EDM4hep. "
"Valid: (2, 3, 4, 6)"
)
counter = count(COUNT_START)
# With the current version of cppyy (from ROOT 6.30.06)
Expand Down
14 changes: 9 additions & 5 deletions scripts/updateReadmeLinks.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ def check_readme_links():
new_readme_content = ""

links_are_ok = True
for readme_line in readme_content:
for line in readme_content:
readme_line = line
edm4hep_objects = re.findall(
"\[(.*?)\]\(https:\/\/github.com\/key4hep\/EDM4hep\/blob\/main\/edm4hep\.yaml#L(\d+?)\)",
r"\[(.*?)\]\(https:\/\/github.com\/key4hep\/EDM4hep\/blob\/main\/edm4hep\.yaml#L(\d+?)\)",
readme_line,
)
if edm4hep_objects:
Expand All @@ -41,7 +42,9 @@ def check_readme_links():
]
if len(edm4hep_yaml_line_numbers_with_match) != 1:
print(
f"Error: failed to replace line number for {edm4hep_object}, either no or several matches were found in edm4hep.yaml with the regex '{regex}'"
f"Error: failed to replace line number for {edm4hep_object}, "
f"either no or several matches were found in edm4hep.yaml "
f"with the regex '{regex}'"
)
sys.exit(1)
if edm4hep_yaml_line_numbers_with_match[0] != original_line_number:
Expand All @@ -51,7 +54,7 @@ def check_readme_links():
f"[{edm4hep_object}](https://github.com/key4hep/EDM4hep/blob/main/edm4hep.yaml#L{edm4hep_yaml_line_numbers_with_match[0]})",
)
print(
f"{edm4hep_object} is wrongly linked (line {original_line_number} --> {edm4hep_yaml_line_numbers_with_match[0]})"
f"{edm4hep_object} is wrongly linked (line {original_line_number} --> {edm4hep_yaml_line_numbers_with_match[0]})" # noqa: E501
)
new_readme_content += readme_line
return links_are_ok, new_readme_content
Expand All @@ -67,6 +70,7 @@ def check_readme_links():
print("README.md links updated.")
else:
print(
"README.md links should be updated. (Run ./scripts/updateReadmeLinks.py to fix them)"
"README.md links should be updated. "
"(Run ./scripts/updateReadmeLinks.py to fix them)"
)
sys.exit(1)
2 changes: 1 addition & 1 deletion test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ def pytest_addoption(parser):
def pytest_configure(config):
"""This is a slighty hacky solution to make the pytest configuration
available in test modules outside of fixtures"""
global options
global options # noqa: PLW0603
options = config.option
2 changes: 0 additions & 2 deletions test/utils/test_kinematics.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/usr/bin/env python3

import unittest
import cppyy

import edm4hep

# A few shorthands for slightly easier to read tests below
Expand Down

0 comments on commit b9dc969

Please sign in to comment.