Skip to content

Commit

Permalink
import numpy.typing if and only if typing.TYPE_CHECKING
Browse files Browse the repository at this point in the history
  • Loading branch information
benjello committed Apr 23, 2021
1 parent 6c05349 commit 5a53201
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions STYLEGUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ import copy
from typing import List

import numpy
from numpy.typing import ArrayLike
if typing.TYPE_CHECKING:
from numpy.typing import ArrayLike

from openfisca_country_template import entities

Expand Down Expand Up @@ -75,7 +76,9 @@ from openfisca_core import axes
from numpy import ndarray
from copy import deepcopy
import typing
import numpy.typing
if typing.TYPE_CHECKING:
import numpy.typing


def do(this: typing.List) -> numpy.typing.ArrayLike:
that = deepcopy(this)
Expand Down
2 changes: 1 addition & 1 deletion openfisca_core/tracers/computation_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import typing

import numpy
import numpy.typing

from openfisca_core.indexed_enums import EnumArray

if typing.TYPE_CHECKING:
import numpy.typing
from openfisca_core.tracers import FullTracer, TraceNode

Array = typing.Union[EnumArray, numpy.typing.ArrayLike]
Expand Down
2 changes: 1 addition & 1 deletion openfisca_core/tracers/flat_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import typing

import numpy
import numpy.typing

from openfisca_core.indexed_enums import EnumArray

if typing.TYPE_CHECKING:
import numpy.typing
from openfisca_core.tracers import TraceNode, FullTracer

Array = typing.Union[EnumArray, numpy.typing.ArrayLike]
Expand Down

0 comments on commit 5a53201

Please sign in to comment.