Skip to content

Commit

Permalink
[typing] Define __all__ for modules and remove unused imports (backport
Browse files Browse the repository at this point in the history
#4895) (#4900)

[typing] Define __all__ for modules and remove unused imports (#4895)

* Define __all__ for modules

* Update .pre-commit-config.yaml

* Update XYDataCommands.py

* Update pyproject.toml

(cherry picked from commit f5073cb)

Co-authored-by: Hailin Wang <[email protected]>
  • Loading branch information
mergify[bot] and haiiliin authored Aug 20, 2023
1 parent 4db78f8 commit d0a9a54
Show file tree
Hide file tree
Showing 30 changed files with 982 additions and 690 deletions.
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,9 @@ repos:
hooks:
- id: mypy
files: ^src/
- repo: https://github.com/hakancelikdev/unimport
rev: "1.0.0"
hooks:
- id: unimport
args:
- --include=src
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,6 @@ black = true

[tool.mypy]
ignore_missing_imports = true

[tool.unimport]
include = "src"
1 change: 0 additions & 1 deletion src/ababltin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import sys

from abaqus import Mdb, backwardCompatibility, getInput, mdb
from abaqus.Mdb.MdbCommands import CombineOptResults, openMdb, upgradeMdb
from abaqus.Session.Session import Session
from abaqus.UtilityAndView import BackwardCompatibility, SymbolicConstant
from abaqus.UtilityAndView.AbaqusBoolean import AbaqusBoolean
Expand Down
15 changes: 7 additions & 8 deletions src/abaqus/XY/XYData.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from typing import Sequence, Union, overload

from typing_extensions import Literal
from typing_extensions import TYPE_CHECKING, Literal

from abqpy.decorators import abaqus_class_doc, abaqus_method_doc

Expand All @@ -11,9 +11,8 @@
from ..UtilityAndView.abaqusConstants import abaqusConstants as C
from .QuantityType import QuantityType


class Odb:
...
if TYPE_CHECKING:
from ..Odb.Odb import Odb


@abaqus_class_doc
Expand Down Expand Up @@ -267,7 +266,7 @@ def XYDataFromFile(
@abaqus_method_doc
def XYDataFromHistory(
self,
odb: Odb,
odb: "Odb",
outputVariableName: str,
steps: tuple,
name: str = "",
Expand Down Expand Up @@ -343,7 +342,7 @@ def XYDataFromHistory(
@abaqus_method_doc
def xyDataListFromField(
self,
odb: Odb,
odb: "Odb",
outputPosition: Literal[C.ELEMENT_CENTROID, C.ELEMENT_NODAL, C.INTEGRATION_POINT, C.NODAL],
variable: tuple[
tuple[
Expand Down Expand Up @@ -466,7 +465,7 @@ def xyDataListFromField(
@abaqus_method_doc
def XYDataFromFreeBody(
self,
odb: Odb,
odb: "Odb",
force: Boolean = ON,
moment: Boolean = OFF,
heatFlowRate: Boolean = OFF,
Expand Down Expand Up @@ -522,7 +521,7 @@ def XYDataFromFreeBody(
@abaqus_method_doc
def XYDataFromShellThickness(
self,
odb: Odb,
odb: "Odb",
outputPosition: Literal[C.ELEMENT_CENTROID, C.ELEMENT_NODAL, C.INTEGRATION_POINT, C.NODAL],
variable: tuple[
tuple[
Expand Down
Loading

0 comments on commit d0a9a54

Please sign in to comment.