Skip to content

Commit 4bbb628

Browse files
Add Pre commit (#28)
* Create .pre-commit-config.yaml * Update .pre-commit-config.yaml * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update functions.py --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 8bf2334 commit 4bbb628

File tree

8 files changed

+28
-18
lines changed

8 files changed

+28
-18
lines changed

.pre-commit-config.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
# Ruff version.
4+
rev: v0.5.0
5+
hooks:
6+
# Run the linter.
7+
- id: ruff
8+
args: [--fix]
9+
# Run the formatter.
10+
- id: ruff-format

django_ltree/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
default_app_config = 'django_ltree.apps.DjangoLtreeConfig'
1+
default_app_config = "django_ltree.apps.DjangoLtreeConfig"

django_ltree/functions.py

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from django.db.models import fields
33
from .fields import PathField
44

5-
from django_ltree.fields import PathField
65

76
__all__ = ("NLevel",)
87

django_ltree/paths.py

-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ def __next__(self):
2828
if path not in self.skip_paths:
2929
return path
3030

31-
3231
@staticmethod
3332
def guess_the_label_size(path_size: int, combination_size: int) -> int:
3433
# The theoritical limit for this at the time of writing is 2_538_557_185_841_324_496 (python 3.12.2)
@@ -53,5 +52,3 @@ def guess_the_label_size(path_size: int, combination_size: int) -> int:
5352
label_size += 1
5453

5554
return label_size
56-
57-

tests/conftest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def pytest_sessionstart(session):
1313
"NAME": "ltree_test",
1414
"HOST": os.environ.get("DJANGO_DATABASE_HOST", "database"),
1515
"USER": os.environ.get("DJANGO_DATABASE_USER", "postgres"),
16-
"PASSWORD": os.environ.get("DJANGO_DATABASE_PASSWORD", "")
16+
"PASSWORD": os.environ.get("DJANGO_DATABASE_PASSWORD", ""),
1717
}
1818
},
1919
ROOT_URLCONF="tests.urls",

tests/taxonomy/apps.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33

44
class TaxonomyConfig(AppConfig):
5-
name = 'taxonomy'
5+
name = "taxonomy"

tests/taxonomy/migrations/0001_initial.py

+15-9
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,29 @@
77

88

99
class Migration(migrations.Migration):
10-
1110
initial = True
1211

13-
dependencies = [
14-
]
12+
dependencies = []
1513

1614
operations = [
1715
migrations.CreateModel(
18-
name='Taxonomy',
16+
name="Taxonomy",
1917
fields=[
20-
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
21-
('path', django_ltree.fields.PathField(unique=True)),
22-
('name', models.TextField()),
18+
(
19+
"id",
20+
models.AutoField(
21+
auto_created=True,
22+
primary_key=True,
23+
serialize=False,
24+
verbose_name="ID",
25+
),
26+
),
27+
("path", django_ltree.fields.PathField(unique=True)),
28+
("name", models.TextField()),
2329
],
2430
options={
25-
'ordering': ('path',),
26-
'abstract': False,
31+
"ordering": ("path",),
32+
"abstract": False,
2733
},
2834
),
2935
]

tests/test_path_value.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import pytest
2-
31
from django_ltree.fields import PathValue
42

53

0 commit comments

Comments
 (0)