Skip to content

Commit

Permalink
Fix ruff.
Browse files Browse the repository at this point in the history
  • Loading branch information
adamghill committed Jul 25, 2024
1 parent 3f4c801 commit 04be090
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions django_unicorn/cacher.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,14 @@ def restore_from_cache(component_cache_key: str, request: HttpRequest = None) ->

if cached_component:
roots = {}
root: "django_unicorn.views.UnicornView" = cached_component
root: django_unicorn.views.UnicornView = cached_component
roots[root.component_cache_key] = root

while root.parent:
root = cache.get(root.parent.component_cache_key)
roots[root.component_cache_key] = root

to_traverse: List["django_unicorn.views.UnicornView"] = []
to_traverse: List[django_unicorn.views.UnicornView] = []
to_traverse.append(root)

while to_traverse:
Expand Down
2 changes: 1 addition & 1 deletion django_unicorn/typer.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def cast_value(type_hint, value):
return value

for _type_hint in type_hints:
if _type_hint == type(None):
if _type_hint == type(None): # noqa: E721
continue

caster = CASTERS.get(_type_hint)
Expand Down
2 changes: 1 addition & 1 deletion tests/components/test_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def test_no_component():

assert (
e.exconly()
== "django_unicorn.errors.ComponentModuleLoadError: The component module 'create_no_component' could not be loaded."
== "django_unicorn.errors.ComponentModuleLoadError: The component module 'create_no_component' could not be loaded." # noqa: E501
)


Expand Down
3 changes: 2 additions & 1 deletion tests/test_cacher.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ def test_caching_components_with_template_html(create_template):
# manually set template_name to None which happens outside of this code normally
component.template_name = None

# Caching will pop the `Template` instance from component.template_name when it enters, adn re-create it when it exits
# Caching will pop the `Template` instance from component.template_name when it enters,
# and re-create it when it exits
cache_full_tree(component)

assert component.template_html
Expand Down
2 changes: 1 addition & 1 deletion tests/views/message/test_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def test_message_component_module_not_loaded(client):

assert (
e.exconly()
== "django_unicorn.errors.ComponentModuleLoadError: The component module 'test_message_module_not_loaded' could not be loaded."
== "django_unicorn.errors.ComponentModuleLoadError: The component module 'test_message_module_not_loaded' could not be loaded." # noqa: E501
)
assert e.value.locations == [
("unicorn.components.test_message_module_not_loaded", "TestMessageModuleNotLoadedView"),
Expand Down

0 comments on commit 04be090

Please sign in to comment.