Skip to content

Commit

Permalink
Fix pre-commit problems
Browse files Browse the repository at this point in the history
  • Loading branch information
Yrob committed Aug 26, 2024
1 parent db0b847 commit db41454
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: '3.11' # matches what .pre-commit-config.yaml has
- uses: pre-commit/[email protected]
- uses: pre-commit/[email protected]
3 changes: 2 additions & 1 deletion src/schematools/contrib/django/faker/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from __future__ import annotations # noqa: D104

from collections.abc import Callable
from dataclasses import dataclass
from dataclasses import field as dataclass_field
from typing import Any, Callable, ClassVar
from typing import Any, ClassVar
from urllib.parse import urlparse

from django.conf import settings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ def handle(self, *args, **options) -> None:

with tempfile.TemporaryDirectory() as tmpdir:
schemas_root = Path(options["schema_url"]).parent
subprocess.run(
["git", "clone", schemas_root, tmpdir], # noqa: S603
subprocess.run( # noqa: S603
["git", "clone", schemas_root, tmpdir],
)
table1 = self._load_table_from_checkout(
dataset.id, options["table"], tmpdir, options["version1"]
Expand Down Expand Up @@ -153,8 +153,8 @@ def _load_table_from_checkout(
self, dataset_id: str, table_id: str, tmpdir: str, version_ref: str
) -> DatasetTableSchema:
"""Load a DatasetTableSchema for the specified git reference."""
subprocess.run(
["git", "checkout", version_ref], cwd=tmpdir, stdout=subprocess.DEVNULL # noqa: S603
subprocess.run( # noqa: S603
["git", "checkout", version_ref], cwd=tmpdir, stdout=subprocess.DEVNULL
)
tmp_schema_path = Path(tmpdir) / "datasets"
# We create a specific schema loader, because it has to read in the data
Expand Down
2 changes: 1 addition & 1 deletion src/schematools/loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import contextlib
import json
import os
from collections.abc import Callable
from functools import cached_property
from pathlib import Path
from typing import Callable
from urllib.parse import urlparse

import requests
Expand Down
3 changes: 1 addition & 2 deletions src/schematools/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@
import sys
import typing
from collections import UserDict
from collections.abc import Iterator, Mapping
from collections.abc import Callable, Iterator, Mapping
from enum import Enum
from functools import cached_property, total_ordering
from re import Pattern
from typing import (
Any,
Callable,
ClassVar,
NamedTuple,
NoReturn,
Expand Down
4 changes: 2 additions & 2 deletions src/schematools/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@

import operator
import re
from collections.abc import Iterator
from collections.abc import Callable, Iterator
from dataclasses import dataclass
from functools import partial, wraps
from pathlib import Path
from typing import Callable, cast
from typing import cast
from urllib.parse import urlparse

from schematools import MAX_TABLE_NAME_LENGTH
Expand Down
6 changes: 3 additions & 3 deletions tests/django/test_model_mockers.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def test_model_mocker_factory_sets_model_mocker_dataset_and_table_schema_through
== "<class 'dso_api.dynamic_api.afvalwegingen.models.containers'>"
)

assert type(AfvalwegingenContainersModel.get_dataset()) == Dataset
assert isinstance(AfvalwegingenContainersModel.get_dataset(), Dataset)
assert AfvalwegingenContainersModel.get_dataset() == afval_dataset
assert str(AfvalwegingenContainersModel.get_dataset()) == "afvalwegingen"

Expand Down Expand Up @@ -123,14 +123,14 @@ def test_schema_model_mockers_factory(afval_dataset):
}
assert "containers" in model_mockers
ContainersMocker = model_mockers["containers"]
assert type(ContainersMocker) == FactoryMetaClass
assert isinstance(ContainersMocker, FactoryMetaClass)
assert str(ContainersMocker) == (
"<containers_factory for <class 'dso_api.dynamic_api.afvalwegingen.models.containers'>>"
)

assert "clusters" in model_mockers
ClustersMocker = model_mockers["clusters"]
assert type(ClustersMocker) == FactoryMetaClass
assert isinstance(ClustersMocker, FactoryMetaClass)
assert str(ClustersMocker) == (
"<clusters_factory for <class 'dso_api.dynamic_api.afvalwegingen.models.clusters'>>"
)
Expand Down

0 comments on commit db41454

Please sign in to comment.