Bump pyright version (#2871)

and fix all reported issues.

We aren't sticking to the latest version this time because it has [a bug](https://github.com/microsoft/pyright/issues/5968).
This commit is contained in:
Alexander Kukushkin
2023-09-19 10:32:35 +02:00
committed by GitHub
parent 25ceb68257
commit 28b9d3d2d9
8 changed files with 11 additions and 14 deletions
+1 -1
View File
@@ -173,7 +173,7 @@ jobs:
- uses: jakebailey/pyright-action@v1
with:
version: 1.1.320
version: 1.1.326
docs:
runs-on: ubuntu-latest
+1 -1
View File
@@ -205,7 +205,7 @@ class Etcd3Client(AbstractEtcdClientWithFailover):
def __init__(self, config: Dict[str, Any], dns_resolver: DnsCachingResolver, cache_ttl: int = 300) -> None:
self._token = None
self._cluster_version: Tuple[int] = tuple()
self._cluster_version: Tuple[int, ...] = tuple()
super(Etcd3Client, self).__init__({**config, 'version_prefix': '/v3beta'}, dns_resolver, cache_ttl)
try:
+1 -1
View File
@@ -836,7 +836,7 @@ class Kubernetes(AbstractDCS):
self._api.configure_timeouts(self.loop_wait, self._retry.deadline, self.ttl)
# retriable_http_codes supposed to be either int, list of integers or comma-separated string with integers.
retriable_http_codes = config.get('retriable_http_codes', [])
retriable_http_codes: Union[str, List[Union[str, int]]] = config.get('retriable_http_codes', [])
if not isinstance(retriable_http_codes, list):
retriable_http_codes = [c.strip() for c in str(retriable_http_codes).split(',')]
+1 -1
View File
@@ -90,7 +90,7 @@ class ZooKeeper(AbstractDCS):
def __init__(self, config: Dict[str, Any]) -> None:
super(ZooKeeper, self).__init__(config)
hosts = config.get('hosts', [])
hosts: Union[str, List[str]] = config.get('hosts', [])
if isinstance(hosts, list):
hosts = ','.join(hosts)
+2 -2
View File
@@ -772,13 +772,13 @@ class Ha(object):
if cluster_history:
self.dcs.set_history_value('[]')
elif not cluster_history or cluster_history[-1][0] != primary_timeline - 1 or len(cluster_history[-1]) != 5:
cluster_history = {line[0]: line for line in cluster_history}
cluster_history_dict: Dict[int, List[Any]] = {line[0]: list(line) for line in cluster_history}
history: List[List[Any]] = list(map(list, self.state_handler.get_history(primary_timeline)))
if self.cluster.config:
history = history[-self.cluster.config.max_timelines_history:]
for line in history:
# enrich current history with promotion timestamps stored in DCS
cluster_history_line = list(cluster_history.get(line[0], []))
cluster_history_line = cluster_history_dict.get(line[0], [])
if len(line) == 3 and len(cluster_history_line) >= 4 and cluster_history_line[1] == line[1]:
line.append(cluster_history_line[3])
if len(cluster_history_line) == 5:
+2 -2
View File
@@ -568,7 +568,7 @@ class Postgresql(object):
r'lsn: ([0-9A-Fa-f]+/[0-9A-Fa-f]+), prev ([0-9A-Fa-f]+/[0-9A-Fa-f]+), '
r'.*?desc: (.+)', out.decode('utf-8'))
if match:
return match.groups()
return match.group(1), match.group(2), match.group(3), match.group(4)
return None, None, None, None
def latest_checkpoint_location(self) -> Optional[int]:
@@ -1023,7 +1023,7 @@ class Postgresql(object):
return None, None
@contextmanager
def get_replication_connection_cursor(self, host: Optional[str] = None, port: int = 5432,
def get_replication_connection_cursor(self, host: Optional[str] = None, port: Union[int, str] = 5432,
**kwargs: Any) -> Iterator[Union['cursor', 'Cursor[Any]']]:
conn_kwargs = self.config.replication.copy()
conn_kwargs.update(host=host, port=int(port) if port else None, user=conn_kwargs.pop('username'),
+2 -5
View File
@@ -1026,17 +1026,14 @@ class ConfigHandler(object):
# "notify" connection_pool about the "new" local connection address
self._postgresql.connection_pool.conn_kwargs = local_conn_kwargs
def _get_pg_settings(
self, names: Collection[str]
) -> Dict[str, Tuple[str, str, Optional[str], str, str, Optional[str]]]:
def _get_pg_settings(self, names: Collection[str]) -> Dict[Any, Tuple[Any, ...]]:
return {r[0]: r for r in self._postgresql.query(('SELECT name, setting, unit, vartype, context, sourcefile'
+ ' FROM pg_catalog.pg_settings '
+ ' WHERE pg_catalog.lower(name) = ANY(%s)'),
[n.lower() for n in names])}
@staticmethod
def _handle_wal_buffers(old_values: Dict[str, Tuple[str, str, Optional[str], str, str, Optional[str]]],
changes: CaseInsensitiveDict) -> None:
def _handle_wal_buffers(old_values: Dict[Any, Tuple[Any, ...]], changes: CaseInsensitiveDict) -> None:
wal_block_size = parse_int(old_values['wal_block_size'][1]) or 8192
wal_segment_size = old_values['wal_segment_size']
wal_segment_unit = parse_int(wal_segment_size[2], 'B') or 8192 \
+1 -1
View File
@@ -313,7 +313,7 @@ class SlotsHandler:
' true AS dropped FROM slots WHERE not active) '
'SELECT active, COALESCE(dropped, false) FROM slots'
' FULL OUTER JOIN dropped ON true'), name)
return rows[0] if rows else (False, False)
return (rows[0][0], rows[0][1]) if rows else (False, False)
def _drop_incorrect_slots(self, cluster: Cluster, slots: Dict[str, Any], paused: bool) -> None:
"""Compare required slots and configured as permanent slots with those found, dropping extraneous ones.