Skip to content

Commit

Permalink
Made TypedDicts conditional.
Browse files Browse the repository at this point in the history
  • Loading branch information
Paebbels committed Jan 10, 2024
1 parent 80c4afc commit 4c1846d
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 24 deletions.
13 changes: 7 additions & 6 deletions sphinx_reports/CodeCoverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
**Report code coverage as Sphinx documentation page(s).**
"""
from pathlib import Path
from typing import Dict, Tuple, Any, List, Iterable, Mapping, Generator, TypedDict
from typing import Dict, Tuple, Any, List, Iterable, Mapping, Generator, TypedDict, TYPE_CHECKING

from docutils import nodes
from pyTooling.Decorators import export
Expand All @@ -43,11 +43,12 @@
from sphinx_reports.Adapter.DocStrCoverage import Analyzer


class package_DictType(TypedDict):
name: str
directory: str
fail_below: int
levels: Dict[int, Dict[str, str]]
if TYPE_CHECKING:
class package_DictType(TypedDict):
name: str
directory: str
fail_below: int
levels: Dict[int, Dict[str, str]]


@export
Expand Down
13 changes: 7 additions & 6 deletions sphinx_reports/DocCoverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
**Report documentation coverage as Sphinx documentation page(s).**
"""
from pathlib import Path
from typing import Dict, Tuple, Any, List, Iterable, Mapping, Generator, TypedDict
from typing import Dict, Tuple, Any, List, Iterable, Mapping, Generator, TypedDict, TYPE_CHECKING

from docutils import nodes
from pyTooling.Decorators import export
Expand All @@ -43,11 +43,12 @@
from sphinx_reports.Adapter.DocStrCoverage import Analyzer


class package_DictType(TypedDict):
name: str
directory: str
fail_below: int
levels: Dict[int, Dict[str, str]]
if TYPE_CHECKING:
class package_DictType(TypedDict):
name: str
directory: str
fail_below: int
levels: Dict[int, Dict[str, str]]


@export
Expand Down
13 changes: 7 additions & 6 deletions sphinx_reports/Unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
**Report unit test results as Sphinx documentation page(s).**
"""
from pathlib import Path
from typing import Dict, Tuple, Any, List, Iterable, Mapping, Generator, TypedDict
from typing import Dict, Tuple, Any, List, Iterable, Mapping, Generator, TypedDict, TYPE_CHECKING

from docutils import nodes
from pyTooling.Decorators import export
Expand All @@ -43,11 +43,12 @@
from sphinx_reports.Adapter.DocStrCoverage import Analyzer


class package_DictType(TypedDict):
name: str
directory: str
fail_below: int
levels: Dict[int, Dict[str, str]]
if TYPE_CHECKING:
class package_DictType(TypedDict):
name: str
directory: str
fail_below: int
levels: Dict[int, Dict[str, str]]


@export
Expand Down
13 changes: 7 additions & 6 deletions sphinx_reports/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
__version__ = "0.3.0"
__keywords__ = ["Python3", "Sphinx", "Extension", "Report", "doc-string", "interrogate"]

from typing import Any, Tuple, Dict, Optional as Nullable, TypedDict, List
from typing import Any, Tuple, Dict, Optional as Nullable, TypedDict, List, TYPE_CHECKING

from docutils import nodes
from pyTooling.Decorators import export
Expand Down Expand Up @@ -157,11 +157,12 @@ def resolve_xref(
raise NotImplementedError()


class setup_ReturnType(TypedDict):
version: str
env_version: int
parallel_read_safe: bool
parallel_write_safe: bool
if TYPE_CHECKING:
class setup_ReturnType(TypedDict):
version: str
env_version: int
parallel_read_safe: bool
parallel_write_safe: bool


@export
Expand Down

0 comments on commit 4c1846d

Please sign in to comment.