Skip to content

Commit

Permalink
Bump mypy from 0.982 to 0.991 (#1789)
Browse files Browse the repository at this point in the history
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Marcelo Trylesinski <[email protected]>
  • Loading branch information
dependabot[bot] and Kludex authored Dec 2, 2022
1 parent ed530d8 commit dd9d5d7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ importlib-metadata==4.13.0; python_version>='3.7'
isort==5.10.1
pytest==7.1.3
pytest-mock==3.10.0
mypy==0.982
mypy==0.991
types-click==7.1.8
types-pyyaml==6.0.12.1
trustme==0.9.0
Expand Down
10 changes: 6 additions & 4 deletions uvicorn/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ async def serve(self, sockets: Optional[List[socket.socket]] = None) -> None:
color_message = "Finished server process [" + click.style("%d", fg="cyan") + "]"
logger.info(message, process_id, extra={"color_message": color_message})

async def startup(self, sockets: list = None) -> None:
async def startup(self, sockets: Optional[List[socket.socket]] = None) -> None:
await self.lifespan.startup()
if self.lifespan.should_exit:
self.should_exit = True
Expand All @@ -107,15 +107,17 @@ def _share_socket(
) -> socket.SocketType: # pragma py-linux pragma: py-darwin
# Windows requires the socket be explicitly shared across
# multiple workers (processes).
from socket import fromshare # type: ignore
from socket import fromshare # type: ignore[attr-defined]

sock_data = sock.share(os.getpid()) # type: ignore
sock_data = sock.share(os.getpid()) # type: ignore[attr-defined]
return fromshare(sock_data)

self.servers = []
for sock in sockets:
if config.workers > 1 and platform.system() == "Windows":
sock = _share_socket(sock) # pragma py-linux pragma: py-darwin
sock = _share_socket( # type: ignore[assignment]
sock
) # pragma py-linux pragma: py-darwin
server = await loop.create_server(
create_protocol, sock=sock, ssl=config.ssl, backlog=config.backlog
)
Expand Down

0 comments on commit dd9d5d7

Please sign in to comment.