Skip to content

Commit

Permalink
Merge pull request #64 from seddonym/black-check
Browse files Browse the repository at this point in the history
Black check
  • Loading branch information
seddonym committed Sep 27, 2019
2 parents 8b028a1 + d80ac77 commit 0ba6b71
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 15 deletions.
1 change: 0 additions & 1 deletion src/importlinter/adapters/building.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import grimp # type: ignore

from importlinter.application.ports import building as ports
from importlinter.domain.ports.graph import ImportGraph

Expand Down
4 changes: 2 additions & 2 deletions src/importlinter/contracts/forbidden.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def check(self, graph: ImportGraph) -> ContractCheck:
is_kept = True
invalid_chains = []

removed_imports = helpers.pop_imports( # type: ignore
graph, self.ignore_imports if self.ignore_imports else []
removed_imports = helpers.pop_imports(
graph, self.ignore_imports if self.ignore_imports else [] # type: ignore
)

self._check_all_modules_exist_in_graph(graph)
Expand Down
8 changes: 3 additions & 5 deletions src/importlinter/contracts/independence.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,13 @@ def check(self, graph: ImportGraph) -> ContractCheck:
is_kept = True
invalid_chains = []

removed_imports = helpers.pop_imports( # type: ignore
graph, self.ignore_imports if self.ignore_imports else []
removed_imports = helpers.pop_imports(
graph, self.ignore_imports if self.ignore_imports else [] # type: ignore
)

self._check_all_modules_exist_in_graph(graph)

for subpackage_1, subpackage_2 in permutations( # type: ignore
self.modules, r=2
):
for subpackage_1, subpackage_2 in permutations(self.modules, r=2): # type: ignore
subpackage_chain_data = {
"upstream_module": subpackage_2.name,
"downstream_module": subpackage_1.name,
Expand Down
4 changes: 2 additions & 2 deletions src/importlinter/contracts/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ def check(self, graph: ImportGraph) -> ContractCheck:
self._validate_containers()

direct_imports_to_ignore = self.ignore_imports if self.ignore_imports else []
removed_imports = helpers.pop_imports( # type: ignore
graph, direct_imports_to_ignore
removed_imports = helpers.pop_imports(
graph, direct_imports_to_ignore # type: ignore
)

for container in self.containers: # type: ignore
Expand Down
4 changes: 1 addition & 3 deletions src/importlinter/domain/ports/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ def find_shortest_chain(self, importer: str, imported: str) -> Optional[Tuple[st
raise NotImplementedError

@abc.abstractmethod
def find_shortest_chains(
self, importer: str, imported: str,
) -> Set[Tuple[str, ...]]:
def find_shortest_chains(self, importer: str, imported: str) -> Set[Tuple[str, ...]]:
"""
Find the shortest import chains that exist between the importer and imported, and
between any modules contained within them. Only one chain per upstream/downstream pair
Expand Down
1 change: 1 addition & 0 deletions tests/adapters/building.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class FakeGraphBuilder(GraphBuilder):
To use, call inject_graph with the graph you wish to inject, ahead
of when the builder would be called.
"""

def build(
self, root_package_name: str, include_external_packages: bool = False
) -> ImportGraph:
Expand Down
6 changes: 4 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ commands =

[testenv:check]
deps =
flake8
mypy
black==19.3b0
flake8==3.7.8
mypy==0.730
commands =
black --check src tests
flake8 src tests setup.py
mypy src/importlinter tests
lint-imports
Expand Down

0 comments on commit 0ba6b71

Please sign in to comment.