Skip to content

Commit b254518

Browse files
authored
Merge pull request #64 from svengt/ruff-linting-formatter
Ruff linting formatter
2 parents 665335f + bca66d4 commit b254518

25 files changed

+1127
-895
lines changed

.editorconfig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# https://editorconfig.org
2+
3+
root = true
4+
5+
[*]
6+
charset = utf-8
7+
end_of_line = lf
8+
indent_size = 4
9+
indent_style = space
10+
insert_final_newline = true
11+
trim_trailing_whitespace = true
12+
13+
[*.{yml,yaml}]
14+
indent_size = 2

.github/workflows/ruff.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Lint and format
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- main
7+
pull_request:
8+
paths-ignore:
9+
- '**.md'
10+
11+
jobs:
12+
ruff:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: astral-sh/ruff-action@v3
17+
- run: ruff check
18+
- run: ruff format --check

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ coverage.xml
5151
.pytest_cache/
5252
cover/
5353

54+
# Linter / formatter
55+
.ruff_cache
56+
5457
# Translations
5558
*.mo
5659
*.pot
@@ -163,4 +166,4 @@ cython_debug/
163166
poetry.lock
164167

165168
.DS_Store
166-
.tool-versions
169+
.tool-versions

inertia/__init__.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1-
from .http import inertia, render, location, InertiaResponse
2-
from .utils import lazy, optional, defer, merge
1+
from .http import InertiaResponse, inertia, location, render
32
from .share import share
3+
from .utils import defer, lazy, merge, optional
4+
5+
__all__ = [
6+
"InertiaResponse",
7+
"inertia",
8+
"location",
9+
"render",
10+
"share",
11+
"defer",
12+
"lazy",
13+
"merge",
14+
"optional",
15+
]

inertia/helpers.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
def deep_transform_callables(prop):
2-
if not isinstance(prop, dict):
3-
return prop() if callable(prop) else prop
4-
5-
for key in list(prop.keys()):
6-
prop[key] = deep_transform_callables(prop[key])
2+
if not isinstance(prop, dict):
3+
return prop() if callable(prop) else prop
4+
5+
for key in list(prop.keys()):
6+
prop[key] = deep_transform_callables(prop[key])
7+
8+
return prop
79

8-
return prop
910

1011
def validate_type(value, name, expected_type):
11-
if not isinstance(value, expected_type):
12-
raise TypeError(f"Expected {expected_type.__name__} for {name}, got {type(value).__name__}")
13-
14-
return value
12+
if not isinstance(value, expected_type):
13+
raise TypeError(
14+
f"Expected {expected_type.__name__} for {name}, got {type(value).__name__}"
15+
)
16+
17+
return value

0 commit comments

Comments
 (0)