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

cephadm: pin flake8 to 5.0.4 #49040

Merged
merged 3 commits into from
Nov 24, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 2 additions & 6 deletions qa/tasks/cephfs/test_full.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
import logging
import os
from textwrap import dedent
try:
from typing import Optional
except:
# make it work for python2
pass
from typing import Optional
from teuthology.exceptions import CommandFailedError
from tasks.cephfs.fuse_mount import FuseMount
from tasks.cephfs.cephfs_test_case import CephFSTestCase
Expand All @@ -22,7 +18,7 @@ class FullnessTestCase(CephFSTestCase):
data_only = False

# Subclasses define how many bytes should be written to achieve fullness
pool_capacity = None # type: Optional[int]
pool_capacity: Optional[int] = None
fill_mb = None

def is_full(self):
Expand Down
2 changes: 1 addition & 1 deletion src/cephadm/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ commands =
basepython = python3
allowlist_externals = bash
deps =
flake8
flake8 == 5.0.4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, is there any something special about this version or because it's just the latest?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

explained in the commit message.

flake8-quotes
commands =
flake8 --config=tox.ini {posargs:cephadm.py}
Expand Down
4 changes: 2 additions & 2 deletions src/pybind/mgr/cephadm/schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,13 @@ def matches_rank_map(
class HostAssignment(object):

def __init__(self,
spec, # type: ServiceSpec
spec: ServiceSpec,
hosts: List[orchestrator.HostSpec],
unreachable_hosts: List[orchestrator.HostSpec],
draining_hosts: List[orchestrator.HostSpec],
daemons: List[orchestrator.DaemonDescription],
networks: Dict[str, Dict[str, Dict[str, List[str]]]] = {},
filter_new_host=None, # type: Optional[Callable[[str],bool]]
filter_new_host: Optional[Callable[[str], bool]] = None,
allow_colo: bool = False,
primary_daemon_type: Optional[str] = None,
per_host_daemon_type: Optional[str] = None,
Expand Down
3 changes: 1 addition & 2 deletions src/pybind/mgr/cephadm/tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,7 @@ def with_cephadm_module(module_options=None, store=None):
yield m


def wait(m, c):
# type: (CephadmOrchestrator, OrchResult) -> Any
def wait(m: CephadmOrchestrator, c: OrchResult) -> Any:
return raise_if_exception(c)


Expand Down
6 changes: 3 additions & 3 deletions src/pybind/mgr/orchestrator/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# fallback to normal sort
natsorted = sorted # type: ignore

from ceph.deployment.inventory import Device
from ceph.deployment.inventory import Device # noqa: F401; pylint: disable=unused-variable
from ceph.deployment.drive_group import DriveGroupSpec, DeviceSelection, OSDMethod
from ceph.deployment.service_spec import PlacementSpec, ServiceSpec, service_spec_allow_invalid_from_json, TracingSpec
from ceph.deployment.hostspec import SpecValidationError
Expand Down Expand Up @@ -227,8 +227,8 @@ class OrchestratorCli(OrchestratorClientMixin, MgrModule,

def __init__(self, *args: Any, **kwargs: Any) -> None:
super(OrchestratorCli, self).__init__(*args, **kwargs)
self.ident = set() # type: Set[str]
self.fault = set() # type: Set[str]
self.ident: Set[str] = set()
self.fault: Set[str] = set()
self._load()
self._refresh_health()

Expand Down
2 changes: 1 addition & 1 deletion src/pybind/mgr/prometheus/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,7 @@ def get_pg_status(self) -> None:
pg_summary = self.get('pg_summary')

for pool in pg_summary['by_pool']:
num_by_state = defaultdict(int) # type: DefaultDict[str, int]
num_by_state: DefaultDict[str, int] = defaultdict(int)

for state_name, count in pg_summary['by_pool'][pool].items():
for state in state_name.split('+'):
Expand Down