Skip to content

Commit

Permalink
fix imports
Browse files Browse the repository at this point in the history
  • Loading branch information
712u3 committed Nov 15, 2023
1 parent 9544c8d commit 2cdc0c4
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 12 deletions.
4 changes: 2 additions & 2 deletions frontik/dependency_manager/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

from typing import TYPE_CHECKING, Any

from frontik.preprocessors import DependencyGroupMarker, Preprocessor
from frontik.dependency_manager.dependencies import DependencyMarker
from frontik.dependency_manager.graph_builder import build_sub_graph, get_dependency_graph
from frontik.dependency_manager.graph_runner import execute_graph
from frontik.dependency_manager.graph_builder import get_dependency_graph, build_sub_graph
from frontik.preprocessors import DependencyGroupMarker, Preprocessor

if TYPE_CHECKING:
from collections.abc import Callable
Expand Down
7 changes: 5 additions & 2 deletions frontik/dependency_manager/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

import asyncio
from graphlib import TopologicalSorter
from frontik.preprocessors import make_full_name
from collections.abc import Callable
from typing import TYPE_CHECKING

from frontik.preprocessors import make_full_name

if TYPE_CHECKING:
from collections.abc import Callable

from frontik.handler import PageHandler


Expand Down
20 changes: 15 additions & 5 deletions frontik/dependency_manager/graph_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,22 @@
from itertools import chain
from typing import TYPE_CHECKING, Any

from frontik.dependency_manager.dependencies import (
Dependency,
DependencyGraph,
DependencyMarker,
get_handler,
make_stub_dependency,
)
from frontik.preprocessors import (
Preprocessor,
get_all_preprocessors_functions,
get_simple_preprocessors_functions,
make_full_name,
)
from frontik.dependency_manager.dependencies import (DependencyGraph, Dependency, DependencyMarker,
make_stub_dependency, get_handler)

if TYPE_CHECKING:
from collections.abc import Callable
from collections.abc import Callable, Iterable

from frontik.handler import PageHandler

Expand Down Expand Up @@ -79,14 +84,19 @@ def get_dependency_graph(page_method_func: Callable, handler_cls: type) -> Depen
return deepcopy(meta_graph)


def _register_side_dependencies(graph, root_dep, side_dependencies, deep_scan):
def _register_side_dependencies(
graph: DependencyGraph,
root_dep: Dependency,
side_dependencies: Iterable,
deep_scan: bool,
) -> None:
for function_or_preprocessor in side_dependencies:
dependency = _make_dependency_for_graph(graph, function_or_preprocessor, deep_scan=deep_scan)
if deep_scan:
_register_sub_dependency(graph, root_dep, dependency, add_to_args=False)


def _register_async_dependencies(graph, async_dependencies):
def _register_async_dependencies(graph: DependencyGraph, async_dependencies: Iterable) -> None:
root_dep = make_stub_dependency()
for dependency_function in async_dependencies:
dependency = _make_dependency_for_graph(graph, dependency_function, deep_scan=True)
Expand Down
3 changes: 1 addition & 2 deletions frontik/dependency_manager/graph_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
import asyncio
from typing import TYPE_CHECKING

from frontik.dependency_manager.dependencies import Dependency, DependencyGraph

if TYPE_CHECKING:
from frontik.dependency_manager.dependencies import Dependency, DependencyGraph
from frontik.handler import PageHandler


Expand Down
2 changes: 1 addition & 1 deletion tests/test_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import pytest

from frontik.dependency_manager import build_and_run_sub_graph, dep, execute_page_method_with_dependencies, async_deps
from frontik.dependency_manager import async_deps, build_and_run_sub_graph, dep, execute_page_method_with_dependencies
from frontik.handler import PageHandler


Expand Down

0 comments on commit 2cdc0c4

Please sign in to comment.