Skip to content

Commit

Permalink
squash! Upgrade type annotations syntax
Browse files Browse the repository at this point in the history
Not all generic aliases (e.g. Dict, List) can be replaced before Python
3.9.
  • Loading branch information
dlax committed Feb 21, 2024
1 parent f701d8a commit 8122d0d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions pgactivity/pg.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import logging
import os
from typing import Any, Callable, Sequence, TypeVar, overload
from typing import Any, Callable, Dict, Sequence, TypeVar, overload

Row = TypeVar("Row")

Expand All @@ -27,7 +27,7 @@

__version__ = psycopg.__version__

Connection = psycopg.Connection[dict[str, Any]]
Connection = psycopg.Connection[Dict[str, Any]]

class BytesLoader(Loader):
def load(self, data: Buffer) -> bytes:
Expand Down
7 changes: 4 additions & 3 deletions pgactivity/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
Mapping,
MutableSet,
Sequence,
Tuple,
TypeVar,
Union,
overload,
Expand Down Expand Up @@ -1133,7 +1134,7 @@ def toggle_pin_focused(self) -> None:
ActivityStats = Union[
Iterable[WaitingProcess],
Iterable[RunningProcess],
tuple[Iterable[WaitingProcess], SystemInfo],
tuple[Iterable[BlockingProcess], SystemInfo],
tuple[Iterable[LocalRunningProcess], SystemInfo],
Tuple[Iterable[WaitingProcess], SystemInfo],
Tuple[Iterable[BlockingProcess], SystemInfo],
Tuple[Iterable[LocalRunningProcess], SystemInfo],
]
4 changes: 2 additions & 2 deletions pgactivity/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import time
from argparse import Namespace
from functools import partial
from typing import cast
from typing import List, cast

import attr
from blessed import Terminal
Expand Down Expand Up @@ -210,7 +210,7 @@ def main(
if is_local:
# TODO: Use this logic in waiting and blocking cases.
local_pg_procs, io_read, io_write = activities.ps_complete(
cast(list[types.RunningProcess], pg_procs.items),
cast(List[types.RunningProcess], pg_procs.items),
sys_procs,
fs_blocksize,
)
Expand Down

0 comments on commit 8122d0d

Please sign in to comment.