making ruff a little happier

This commit is contained in:
hjoaquim
2023-08-29 12:12:24 +01:00
parent 514a243e60
commit c93d77d7f0
3 changed files with 7 additions and 11 deletions

View File

@@ -495,18 +495,17 @@ class MethodDefinition:
elif MethodDefinition.is_annotated_dc(param.annotation):
fields = param.annotation.__args__[0].__dataclass_fields__
for field_name, field in fields.items():
name = field_name
type_ = MethodDefinition.get_type(field)
default = MethodDefinition.get_default(field)
new_type = TYPE_EXPANSION.get(name, ...)
new_type = TYPE_EXPANSION.get(field_name, ...)
updated_type = type_ if new_type is ... else Union[type_, new_type]
formatted[name] = Parameter(
name=name,
formatted[field_name] = Parameter(
name=field_name,
kind=Parameter.POSITIONAL_OR_KEYWORD,
annotation=updated_type,
default=DEFAULT_REPLACEMENT.get(name, default),
default=DEFAULT_REPLACEMENT.get(field_name, default),
)
else:
new_type = TYPE_EXPANSION.get(name, ...)
@@ -754,14 +753,14 @@ class PathHandler:
@classmethod
def build_module_name(cls, path: str) -> str:
"""Build the module name."""
if path == "":
if not path:
return "__extensions__"
return cls.clean_path(path=path)
@classmethod
def build_module_class(cls, path: str) -> str:
"""Build the module class."""
if path == "":
if not path:
return "Extensions"
return f"CLASS_{cls.clean_path(path=path)}"

View File

@@ -297,9 +297,6 @@ def test_format(formatter):
# Assertions
expected_log = "INFO|test_app_name|unknown-commit|test_app_id|test_session_id|test_user_id|Filtered log message"
print(expected_log)
print(formatted_log)
assert formatted_log == expected_log
# Check if the mock methods were called

View File

@@ -256,7 +256,7 @@ def test_get_description_no_doc(signature_inspector):
def some_function():
pass
assert signature_inspector.get_description(some_function) == ""
assert not signature_inspector.get_description(some_function)
@pytest.fixture(scope="module")