Skip to content

Commit d67576a

Browse files
fix: type fixed to satisfy mypy (#125)
cache is declared as type int, however the assignment can in some cases, return None, which mypy picks up and complains out. Set it to Optional, which allows it to be also None.
1 parent be1e947 commit d67576a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/pytest_docker/plugin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import subprocess
55
import time
66
import timeit
7-
from typing import Any, Dict, Iterable, Iterator, List, Tuple, Union
7+
from typing import Any, Dict, Iterable, Iterator, List, Optional, Tuple, Union
88

99
import attr
1010
import pytest
@@ -78,7 +78,7 @@ def port_for(self, service: str, container_port: int) -> int:
7878
"""
7979

8080
# Lookup in the cache.
81-
cache: int = self._services.get(service, {}).get(container_port, None)
81+
cache: Optional[int] = self._services.get(service, {}).get(container_port, None)
8282
if cache is not None:
8383
return cache
8484

0 commit comments

Comments
 (0)