Skip to content

Commit 67278b9

Browse files
committed
Fixes inconsistency between pre-commit and git hook
So the git commit hook for isort was running with different configuration from the pre-commit CI run. This (a) fixes files to be consistent with (b) the configuration now provided -- e.g. what is first party, and what is local. This should hopefully now prevent any conflicts from reoccurring.
1 parent 17777a4 commit 67278b9

15 files changed

Lines changed: 57 additions & 44 deletions

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ repos:
2525
rev: '5.12.0'
2626
hooks:
2727
- id: isort
28-
args: ["--profile", "black", --line-length=100]
28+
args: ["--profile", "black", "--line-length=100", "--known-local-folder", "tests", "-p", "hamilton"]
2929
- repo: https://github.com/pycqa/flake8
3030
rev: 6.1.0
3131
hooks:

contrib/setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ ignore =
1515

1616
[isort]
1717
known_first_party=hamilton
18+
known_local_folder=tests

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ ignore =
1515

1616
[isort]
1717
known_first_party=hamilton
18+
known_local_folder=tests

tests/execution/test_executors.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,6 @@
33

44
import numpy as np
55
import pytest
6-
from tests.resources.dynamic_parallelism import (
7-
inputs_in_collect,
8-
no_parallel,
9-
parallel_collect_multiple_arguments,
10-
parallel_complex,
11-
parallel_delayed,
12-
parallel_linear_basic,
13-
)
146

157
import hamilton.ad_hoc_utils
168
from hamilton import base, driver
@@ -30,6 +22,15 @@
3022
)
3123
from hamilton.htypes import Collect, Parallelizable
3224

25+
from tests.resources.dynamic_parallelism import (
26+
inputs_in_collect,
27+
no_parallel,
28+
parallel_collect_multiple_arguments,
29+
parallel_complex,
30+
parallel_delayed,
31+
parallel_linear_basic,
32+
)
33+
3334
ADAPTER = base.DefaultAdapter()
3435

3536

tests/execution/test_node_grouping.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from tests.resources.dynamic_parallelism import no_parallel, parallel_complex, parallel_linear_basic
2-
31
from hamilton import ad_hoc_utils, base, graph, node
42
from hamilton.execution import grouping
53
from hamilton.execution.grouping import (
@@ -12,6 +10,8 @@
1210
from hamilton.graph import FunctionGraph
1311
from hamilton.node import NodeType
1412

13+
from tests.resources.dynamic_parallelism import no_parallel, parallel_complex, parallel_linear_basic
14+
1515

1616
def test_group_individually():
1717
fn_graph = FunctionGraph.from_modules(no_parallel, config={})

tests/function_modifiers/test_macros.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
import pandas as pd
55
import pytest
6-
import tests.resources.pipe
76

87
import hamilton.function_modifiers
98
from hamilton import base, driver, function_modifiers, models, node
@@ -12,6 +11,8 @@
1211
from hamilton.function_modifiers.macros import Applicable, ensure_function_empty, pipe, step
1312
from hamilton.node import DependencyType
1413

14+
import tests.resources.pipe
15+
1516

1617
def test_no_code_validator():
1718
def no_code():

tests/function_modifiers/test_recursive.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from typing import Tuple
44

55
import pytest
6-
import tests.resources.reuse_subdag
76

87
from hamilton import ad_hoc_utils, graph
98
from hamilton.function_modifiers import (
@@ -18,6 +17,8 @@
1817
from hamilton.function_modifiers.dependencies import source
1918
from hamilton.function_modifiers.recursive import _validate_config_inputs
2019

20+
import tests.resources.reuse_subdag
21+
2122

2223
def test_collect_function_fns():
2324
val = random.randint(0, 100000)

tests/function_modifiers/test_validation.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
import numpy as np
22
import pandas as pd
33
import pytest
4-
from tests.resources.dq_dummy_examples import (
5-
DUMMY_VALIDATORS_FOR_TESTING,
6-
SampleDataValidator2,
7-
SampleDataValidator3,
8-
)
94

105
from hamilton import node
116
from hamilton.data_quality.base import DataValidationError, ValidationResult
@@ -17,6 +12,12 @@
1712
)
1813
from hamilton.node import DependencyType
1914

15+
from tests.resources.dq_dummy_examples import (
16+
DUMMY_VALIDATORS_FOR_TESTING,
17+
SampleDataValidator2,
18+
SampleDataValidator3,
19+
)
20+
2021

2122
def test_check_output_node_transform():
2223
decorator = check_output(

tests/io/test_materialization.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
from typing import Any, Collection, Dict, List, Optional, Tuple, Type
33

44
import pytest
5-
import tests.resources.cyclic_functions
6-
import tests.resources.test_default_args
75

86
from hamilton import base, graph, node, registry
97
from hamilton.function_modifiers import load_from, save_to, value
@@ -20,6 +18,9 @@
2018
to,
2119
)
2220

21+
import tests.resources.cyclic_functions
22+
import tests.resources.test_default_args
23+
2324
global_mock_data_saver_cache = {}
2425

2526

tests/test_caching.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33

44
import pandas as pd
55
import pytest
6-
from tests import nodes
76

87
from hamilton import base
98
from hamilton.driver import Driver
109
from hamilton.experimental import h_cache
1110

11+
from tests import nodes
12+
1213

1314
@pytest.fixture
1415
def df():

0 commit comments

Comments
 (0)