From fb73d8e5c21c6ff448d1cc28b7c4900456022b82 Mon Sep 17 00:00:00 2001 From: Michael Fritch Date: Thu, 28 Jan 2021 13:05:56 -0700 Subject: [PATCH] mgr/cephadm: Do not use variables named 'I', 'O', or 'l' (E741) Signed-off-by: Michael Fritch --- src/pybind/mgr/cephadm/module.py | 6 +++--- src/pybind/mgr/cephadm/schedule.py | 18 +++++++++--------- src/pybind/mgr/orchestrator/module.py | 2 +- src/pybind/mgr/tox.ini | 1 - 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index ebc0b4dc16d..e45bd07ae35 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -637,10 +637,10 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule, if ssh_config is None or len(ssh_config.strip()) == 0: raise OrchestratorValidationError('ssh_config cannot be empty') # StrictHostKeyChecking is [yes|no] ? - l = re.findall(r'StrictHostKeyChecking\s+.*', ssh_config) - if not l: + res = re.findall(r'StrictHostKeyChecking\s+.*', ssh_config) + if not res: raise OrchestratorValidationError('ssh_config requires StrictHostKeyChecking') - for s in l: + for s in res: if 'ask' in s.lower(): raise OrchestratorValidationError(f'ssh_config cannot contain: \'{s}\'') diff --git a/src/pybind/mgr/cephadm/schedule.py b/src/pybind/mgr/cephadm/schedule.py index 8ad2bae4fa1..7913c35e678 100644 --- a/src/pybind/mgr/cephadm/schedule.py +++ b/src/pybind/mgr/cephadm/schedule.py @@ -272,23 +272,23 @@ class HostAssignment(object): return existing -def merge_hostspecs(l: List[HostPlacementSpec], r: List[HostPlacementSpec]) -> Iterable[HostPlacementSpec]: +def merge_hostspecs(lh: List[HostPlacementSpec], rh: List[HostPlacementSpec]) -> Iterable[HostPlacementSpec]: """ - Merge two lists of HostPlacementSpec by hostname. always returns `l` first. + Merge two lists of HostPlacementSpec by hostname. always returns `lh` first. >>> list(merge_hostspecs([HostPlacementSpec(hostname='h', name='x', network='')], ... [HostPlacementSpec(hostname='h', name='y', network='')])) [HostPlacementSpec(hostname='h', network='', name='x')] """ - l_names = {h.hostname for h in l} - yield from l - yield from (h for h in r if h.hostname not in l_names) + lh_names = {h.hostname for h in lh} + yield from lh + yield from (h for h in rh if h.hostname not in lh_names) -def difference_hostspecs(l: List[HostPlacementSpec], r: List[HostPlacementSpec]) -> List[HostPlacementSpec]: +def difference_hostspecs(lh: List[HostPlacementSpec], rh: List[HostPlacementSpec]) -> List[HostPlacementSpec]: """ - returns l "minus" r by hostname. + returns lh "minus" rh by hostname. >>> list(difference_hostspecs([HostPlacementSpec(hostname='h1', name='x', network=''), ... HostPlacementSpec(hostname='h2', name='y', network='')], @@ -296,5 +296,5 @@ def difference_hostspecs(l: List[HostPlacementSpec], r: List[HostPlacementSpec]) [HostPlacementSpec(hostname='h1', network='', name='x')] """ - r_names = {h.hostname for h in r} - return [h for h in l if h.hostname not in r_names] + rh_names = {h.hostname for h in rh} + return [h for h in lh if h.hostname not in rh_names] diff --git a/src/pybind/mgr/orchestrator/module.py b/src/pybind/mgr/orchestrator/module.py index bb62e57da09..23c4247870b 100644 --- a/src/pybind/mgr/orchestrator/module.py +++ b/src/pybind/mgr/orchestrator/module.py @@ -240,7 +240,7 @@ class OrchestratorCli(OrchestratorClientMixin, MgrModule, def _get_device_locations(self, dev_id): # type: (str) -> List[DeviceLightLoc] locs = [d['location'] for d in self.get('devices')['devices'] if d['devid'] == dev_id] - return [DeviceLightLoc(**l) for l in sum(locs, [])] + return [DeviceLightLoc(**loc) for loc in sum(locs, [])] @_cli_read_command(prefix='device ls-lights') def _device_ls(self) -> HandleCommandResult: diff --git a/src/pybind/mgr/tox.ini b/src/pybind/mgr/tox.ini index 3d015a83888..96f9c3400e5 100644 --- a/src/pybind/mgr/tox.ini +++ b/src/pybind/mgr/tox.ini @@ -12,7 +12,6 @@ requires = cython max-line-length = 100 ignore = E501, - E741, F401, F541, F632, -- 2.39.5