]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/cephadm: Do not use variables named 'I', 'O', or 'l' (E741)
authorMichael Fritch <mfritch@suse.com>
Thu, 28 Jan 2021 20:05:56 +0000 (13:05 -0700)
committerMichael Fritch <mfritch@suse.com>
Fri, 5 Feb 2021 18:20:55 +0000 (11:20 -0700)
Signed-off-by: Michael Fritch <mfritch@suse.com>
src/pybind/mgr/cephadm/module.py
src/pybind/mgr/cephadm/schedule.py
src/pybind/mgr/orchestrator/module.py
src/pybind/mgr/tox.ini

index ebc0b4dc16db083243ce90fba471c9ce02f9f64c..e45bd07ae358f083258d4efcf73320c4ddcf49d9 100644 (file)
@@ -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}\'')
 
index 8ad2bae4fa1fc0d498d13bd49934d3a7122df25f..7913c35e6788b957d4243e5116233c15f327ad84 100644 (file)
@@ -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]
index bb62e57da09f5ec532ac0af2f193c49577eb53cb..23c4247870b3769cf7f0ecbb8b1b03a3ace7b0d9 100644 (file)
@@ -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:
index 3d015a8388894bdd38b454ddbf5dcba79736ade9..96f9c3400e551e3c09ab268f13ea8d9f16571034 100644 (file)
@@ -12,7 +12,6 @@ requires = cython
 max-line-length = 100
 ignore =
     E501,
-    E741,
     F401,
     F541,
     F632,