Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typing #232

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions foamlib/_cases/_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ async def _run(
async def _rmtree(
path: Union["os.PathLike[str]", str], ignore_errors: bool = False
) -> None:
await aioshutil.rmtree(path, ignore_errors=ignore_errors) # type: ignore [call-arg]
await aioshutil.rmtree(path, ignore_errors=ignore_errors)

@staticmethod
async def _copytree(
Expand Down Expand Up @@ -188,7 +188,7 @@ async def restore_0_dir(self) -> None:
@asynccontextmanager
async def copy(
self, dst: Optional[Union["os.PathLike[str]", str]] = None
) -> "AsyncGenerator[Self]":
) -> AsyncGenerator[Self, None]:
"""
Make a copy of this case.

Expand All @@ -209,7 +209,7 @@ async def copy(
@asynccontextmanager
async def clone(
self, dst: Optional[Union["os.PathLike[str]", str]] = None
) -> "AsyncGenerator[Self]":
) -> AsyncGenerator[Self, None]:
"""
Clone this case (make a clean copy).

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


@pytest.fixture(params=[False, True])
def cavity(request: pytest.FixtureRequest) -> "Generator[FoamCase]":
def cavity(request: pytest.FixtureRequest) -> Generator[FoamCase, None, None]:
tutorials_path = Path(os.environ["FOAM_TUTORIALS"])
path = tutorials_path / "incompressible" / "icoFoam" / "cavity" / "cavity"
of11_path = tutorials_path / "incompressibleFluid" / "cavity"
Expand Down
7 changes: 5 additions & 2 deletions tests/test_cases/test_cavity_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


@pytest_asyncio.fixture(params=[False, True])
async def cavity(request: pytest.FixtureRequest) -> "AsyncGenerator[AsyncFoamCase]":
async def cavity(request: pytest.FixtureRequest) -> AsyncGenerator[AsyncFoamCase, None]:
tutorials_path = Path(os.environ["FOAM_TUTORIALS"])
path = tutorials_path / "incompressible" / "icoFoam" / "cavity" / "cavity"
of11_path = tutorials_path / "incompressibleFluid" / "cavity"
Expand Down Expand Up @@ -74,7 +74,10 @@ async def f(x: Sequence[float]) -> float:
async with cavity.clone() as clone:
clone[0]["U"].boundary_field["movingWall"].value = [x[0], 0, 0]
await clone.run(parallel=False)
ret = clone[-1]["U"].boundary_field["movingWall"].value[0]
U = clone[-1]["U"].boundary_field["movingWall"].value
assert not isinstance(U, (int, float))
assert len(U) == 3
ret = U[0]
assert isinstance(ret, (int, float))
return ret

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


@pytest.fixture
def flange() -> "Generator[FoamCase]":
def flange() -> Generator[FoamCase, None, None]:
tutorials_path = Path(os.environ["FOAM_TUTORIALS"])
path = tutorials_path / "basic" / "laplacianFoam" / "flange"
of11_path = tutorials_path / "legacy" / "basic" / "laplacianFoam" / "flange"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cases/test_flange_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


@pytest_asyncio.fixture(params=[AsyncFoamCase, AsyncSlurmFoamCase])
async def flange(request: pytest.FixtureRequest) -> "AsyncGenerator[AsyncFoamCase]":
async def flange(request: pytest.FixtureRequest) -> AsyncGenerator[AsyncFoamCase, None]:
tutorials_path = Path(os.environ["FOAM_TUTORIALS"])
path = tutorials_path / "basic" / "laplacianFoam" / "flange"
of11_path = tutorials_path / "legacy" / "basic" / "laplacianFoam" / "flange"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_files/test_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def test_new_field(tmp_path: Path) -> None:


@pytest.fixture
def cavity() -> "Generator[FoamCase]":
def cavity() -> Generator[FoamCase, None, None]:
tutorials_path = Path(os.environ["FOAM_TUTORIALS"])
path = tutorials_path / "incompressible" / "icoFoam" / "cavity" / "cavity"
of11_path = tutorials_path / "incompressibleFluid" / "cavity"
Expand Down
Loading