Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-oreilly committed Jan 29, 2025
1 parent 6706fcf commit 8553557
Show file tree
Hide file tree
Showing 3 changed files with 126 additions and 116 deletions.
11 changes: 8 additions & 3 deletions scripts/generate_options_mixin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env
#!/usr/bin/env

import math
import pathlib
Expand Down Expand Up @@ -64,6 +64,9 @@ def generate_mixin(options: dict[str, typing.Any]):
lines = [
"# This file is automatically generated by scripts/generate_options_mixin.py",
"# Do not edit this file directly",
"",
'"""Defines a base class mapping NiiVue properties for AnyWidget."""',
"",
"from __future__ import annotations",
"",
"import typing",
Expand All @@ -74,10 +77,12 @@ def generate_mixin(options: dict[str, typing.Any]):
"",
"",
"class OptionsMixin:",
' """Base class implementing NiiVue properties."""',
"",
]

docstring = ('"""Automatically generated property. ' +
'See generate_options_mixin.py"""')
'See generate_options_mixin.py."""')
for option, value in options.items():
snake_name = RENAME_OVERRIDES.get(option, camel_to_snake(option))
hint = type_hint(value)
Expand All @@ -88,7 +93,7 @@ def generate_mixin(options: dict[str, typing.Any]):
lines.append("")
lines.append(f" @{snake_name}.setter")
lines.append(f" def {snake_name}(self, value: {hint}):")
lines.append(f" {docstring}")
lines.append(f" {docstring}")
lines.append(f' self._opts = {{**self._opts, "{option}": value}}')
lines.append("")
return "\n".join(lines)
Expand Down
2 changes: 1 addition & 1 deletion src/ipyniivue/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import importlib.metadata

from .constants import DragMode, MuliplanarType, SliceType # noqa: F401
from .widget import NiiVue, WidgetObserver # noqa: F401
from .download_dataset import download_dataset # noqa: F401
from .widget import NiiVue, WidgetObserver # noqa: F401

__version__ = importlib.metadata.version("ipyniivue")
Loading

0 comments on commit 8553557

Please sign in to comment.