Skip to content

Commit

Permalink
refact: proper capitalisation.
Browse files Browse the repository at this point in the history
  • Loading branch information
sfermigier committed Nov 5, 2024
1 parent 743ec66 commit 418fcd4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 0 additions & 2 deletions ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ lint.extend-ignore = [
"N804", # First argument of a class method should be named `cls`
"N805", # First argument of a method should be named `self`
"N806", # Variable in function should be lowercase
# "N814", # Camelcase ... imported as constant
"N816", # Variable in global scope should not be mixedCase
#
"PD011", # Use `.to_numpy()` instead of `.values`
"PERF203", # `try`-`except` within a loop incurs performance overhead
Expand Down
8 changes: 4 additions & 4 deletions src/abilian/web/forms/form.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,14 @@ def _count_errors(self, group=None, fields=()):
if not _PATCHED:
Field.view_template = None

_wtforms_Field_init = Field.__init__
_wtforms_field_init = Field.__init__

def _core_field_init(self: Any, *args: Any, **kwargs: Any):
view_widget = None
if "view_widget" in kwargs:
view_widget = kwargs.pop("view_widget")

_wtforms_Field_init(self, *args, **kwargs)
_wtforms_field_init(self, *args, **kwargs)
if view_widget is None:
view_widget = self.widget

Expand All @@ -211,13 +211,13 @@ def _core_field_repr(self) -> str:
del _core_field_repr

# support 'widget_options' for some custom widgets
_wtforms_Field_render = Field.__call__
_wtforms_field_render = Field.__call__

def _core_field_render(self, **kwargs):
if "widget_options" in kwargs and not kwargs["widget_options"]:
kwargs.pop("widget_options")

return _wtforms_Field_render(self, **kwargs)
return _wtforms_field_render(self, **kwargs)

patch_logger.info(Field.__call__)
Field.__call__ = _core_field_render
Expand Down

0 comments on commit 418fcd4

Please sign in to comment.