Skip to content

Commit

Permalink
fix pre-commit issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jamagalhaes committed Feb 4, 2025
1 parent 7a24f09 commit d4323a3
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 19 deletions.
2 changes: 1 addition & 1 deletion canvas_sdk/v1/data/coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class CoverageRelationshipCode(models.TextChoices):
"""CoverageRelationshipCode."""

SELF = "18", "Self"
SPOUSE = "01" "Spouse"
SPOUSE = "01Spouse"
CHILD_INSURED_HAS_FINANCIAL_RESP = "19", "Natural Child, insured has financial responsibility"
CHILD_HAS_FINANCIAL_RESP = "43", "Natural Child, insured does not have financial responsibility"
STEP_CHILD = "17", "Step Child"
Expand Down
9 changes: 4 additions & 5 deletions plugin_runner/sandbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,12 @@ def check_name(
):
self.warn(
node,
f'"{name}" is an invalid variable name because it ' 'starts with "_"',
f'"{name}" is an invalid variable name because it starts with "_"',
)
elif name.endswith("__roles__"):
self.error(
node,
f'"{name}" is an invalid variable name because ' 'it ends with "__roles__".',
f'"{name}" is an invalid variable name because it ends with "__roles__".',
)
elif name in FORBIDDEN_FUNC_NAMES:
self.error(node, f'"{name}" is a reserved name.')
Expand Down Expand Up @@ -216,14 +216,13 @@ def visit_Attribute(self, node: ast.Attribute) -> ast.AST:
if node.attr.startswith("_") and node.attr != "_":
self.warn(
node,
f'"{node.attr}" is an invalid attribute name because it starts ' 'with "_".',
f'"{node.attr}" is an invalid attribute name because it starts with "_".',
)

if node.attr.endswith("__roles__"):
self.error(
node,
f'"{node.attr}" is an invalid attribute name because it ends '
'with "__roles__".',
f'"{node.attr}" is an invalid attribute name because it ends with "__roles__".',
)

if isinstance(node.ctx, ast.Load):
Expand Down
24 changes: 12 additions & 12 deletions plugin_runner/tests/test_plugin_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ def test_load_plugins_with_plugin_that_imports_other_modules_outside_plugin_pack
with caplog.at_level(logging.ERROR):
load_or_reload_plugin(install_test_plugin)

assert any(
"Error importing module" in record.message for record in caplog.records
), "log.error() was not called with the expected message."
assert any("Error importing module" in record.message for record in caplog.records), (
"log.error() was not called with the expected message."
)


@pytest.mark.parametrize(
Expand All @@ -102,9 +102,9 @@ def test_load_plugins_with_plugin_that_imports_forbidden_modules(
with caplog.at_level(logging.ERROR):
load_or_reload_plugin(install_test_plugin)

assert any(
"Error importing module" in record.message for record in caplog.records
), "log.error() was not called with the expected message."
assert any("Error importing module" in record.message for record in caplog.records), (
"log.error() was not called with the expected message."
)


@pytest.mark.parametrize(
Expand Down Expand Up @@ -144,9 +144,9 @@ def test_plugin_that_implicitly_imports_allowed_modules(
]["class"]
class_handler(Event(EventRequest(type=EventType.UNKNOWN))).compute()

assert any(
"Hello, World!" in record.message for record in caplog.records
), "log.info() with Template.render() was not called."
assert any("Hello, World!" in record.message for record in caplog.records), (
"log.info() with Template.render() was not called."
)


@pytest.mark.parametrize(
Expand All @@ -170,9 +170,9 @@ def test_plugin_that_implicitly_imports_forbidden_modules(
]["class"]
class_handler(Event(EventRequest(type=EventType.UNKNOWN))).compute()

assert (
any("os list dir" in record.message for record in caplog.records) is False
), "log.info() with os.listdir() was called."
assert any("os list dir" in record.message for record in caplog.records) is False, (
"log.info() with os.listdir() was called."
)


@pytest.mark.parametrize("install_test_plugin", ["example_plugin"], indirect=True)
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d4323a3

Please sign in to comment.