Fix "pointless" strings detected by pylint (#79943)
Convert these strings to comments, since they are not valid docstrings.
This commit is contained in:
parent
02f6e40534
commit
716631189c
|
@ -67,7 +67,7 @@ def human_to_bytes(number, default_unit=None, isbits=False):
|
|||
unit = default_unit
|
||||
|
||||
if unit is None:
|
||||
''' No unit given, returning raw number '''
|
||||
# No unit given, returning raw number
|
||||
return int(round(num))
|
||||
range_key = unit[0].upper()
|
||||
try:
|
||||
|
|
|
@ -175,9 +175,7 @@ class SunOSHardware(Hardware):
|
|||
|
||||
prtdiag_path = self.module.get_bin_path("prtdiag", opt_dirs=[platform_sbin])
|
||||
rc, out, err = self.module.run_command(prtdiag_path)
|
||||
"""
|
||||
rc returns 1
|
||||
"""
|
||||
# rc returns 1
|
||||
if out:
|
||||
system_conf = out.split('\n')[0]
|
||||
|
||||
|
|
|
@ -46,18 +46,14 @@ class FcWwnInitiatorFactCollector(BaseFactCollector):
|
|||
for line in get_file_lines(fcfile):
|
||||
fc_facts['fibre_channel_wwn'].append(line.rstrip()[2:])
|
||||
elif sys.platform.startswith('sunos'):
|
||||
"""
|
||||
on solaris 10 or solaris 11 should use `fcinfo hba-port`
|
||||
TBD (not implemented): on solaris 9 use `prtconf -pv`
|
||||
"""
|
||||
# on solaris 10 or solaris 11 should use `fcinfo hba-port`
|
||||
# TBD (not implemented): on solaris 9 use `prtconf -pv`
|
||||
cmd = module.get_bin_path('fcinfo')
|
||||
if cmd:
|
||||
cmd = cmd + " hba-port"
|
||||
rc, fcinfo_out, err = module.run_command(cmd)
|
||||
"""
|
||||
# fcinfo hba-port | grep "Port WWN"
|
||||
HBA Port WWN: 10000090fa1658de
|
||||
"""
|
||||
# HBA Port WWN: 10000090fa1658de
|
||||
if rc == 0 and fcinfo_out:
|
||||
for line in fcinfo_out.splitlines():
|
||||
if 'Port WWN' in line:
|
||||
|
|
|
@ -288,7 +288,7 @@ if not HAS_MATCH_HOSTNAME:
|
|||
# The following block of code is under the terms and conditions of the
|
||||
# Python Software Foundation License
|
||||
|
||||
"""The match_hostname() function from Python 3.4, essential when using SSL."""
|
||||
# The match_hostname() function from Python 3.4, essential when using SSL.
|
||||
|
||||
try:
|
||||
# Divergence: Python-3.7+'s _ssl has this exception type but older Pythons do not
|
||||
|
|
|
@ -826,7 +826,7 @@ def get_head_branch(git_path, module, dest, remote, bare=False):
|
|||
repo_path = get_repo_path(dest, bare)
|
||||
except (IOError, ValueError) as err:
|
||||
# No repo path found
|
||||
"""``.git`` file does not have a valid format for detached Git dir."""
|
||||
# ``.git`` file does not have a valid format for detached Git dir.
|
||||
module.fail_json(
|
||||
msg='Current repo does not have a valid reference to a '
|
||||
'separate Git dir or it refers to the invalid path',
|
||||
|
@ -1283,7 +1283,7 @@ def main():
|
|||
repo_path = separate_git_dir
|
||||
except (IOError, ValueError) as err:
|
||||
# No repo path found
|
||||
"""``.git`` file does not have a valid format for detached Git dir."""
|
||||
# ``.git`` file does not have a valid format for detached Git dir.
|
||||
module.fail_json(
|
||||
msg='Current repo does not have a valid reference to a '
|
||||
'separate Git dir or it refers to the invalid path',
|
||||
|
|
|
@ -367,7 +367,7 @@ def main():
|
|||
if os.getenv('XDG_RUNTIME_DIR') is None:
|
||||
os.environ['XDG_RUNTIME_DIR'] = '/run/user/%s' % os.geteuid()
|
||||
|
||||
''' Set CLI options depending on params '''
|
||||
# Set CLI options depending on params
|
||||
# if scope is 'system' or None, we can ignore as there is no extra switch.
|
||||
# The other choices match the corresponding switch
|
||||
if module.params['scope'] != 'system':
|
||||
|
|
|
@ -1283,15 +1283,13 @@ class YumModule(YumDnf):
|
|||
obsoletes = {}
|
||||
for line in out.split('\n'):
|
||||
line = line.split()
|
||||
"""
|
||||
Ignore irrelevant lines:
|
||||
- '*' in line matches lines like mirror lists: "* base: mirror.corbina.net"
|
||||
- len(line) != 3 or 6 could be strings like:
|
||||
"This system is not registered with an entitlement server..."
|
||||
- len(line) = 6 is package obsoletes
|
||||
- checking for '.' in line[0] (package name) likely ensures that it is of format:
|
||||
"package_name.arch" (coreutils.x86_64)
|
||||
"""
|
||||
# Ignore irrelevant lines:
|
||||
# - '*' in line matches lines like mirror lists: "* base: mirror.corbina.net"
|
||||
# - len(line) != 3 or 6 could be strings like:
|
||||
# "This system is not registered with an entitlement server..."
|
||||
# - len(line) = 6 is package obsoletes
|
||||
# - checking for '.' in line[0] (package name) likely ensures that it is of format:
|
||||
# "package_name.arch" (coreutils.x86_64)
|
||||
if '*' in line or len(line) not in [3, 6] or '.' not in line[0]:
|
||||
continue
|
||||
|
||||
|
@ -1620,30 +1618,29 @@ class YumModule(YumDnf):
|
|||
self.yum_basecmd.extend(e_cmd)
|
||||
|
||||
if self.state in ('installed', 'present', 'latest'):
|
||||
""" The need of this entire if conditional has to be changed
|
||||
this function is the ensure function that is called
|
||||
in the main section.
|
||||
|
||||
This conditional tends to disable/enable repo for
|
||||
install present latest action, same actually
|
||||
can be done for remove and absent action
|
||||
|
||||
As solution I would advice to cal
|
||||
try: self.yum_base.repos.disableRepo(disablerepo)
|
||||
and
|
||||
try: self.yum_base.repos.enableRepo(enablerepo)
|
||||
right before any yum_cmd is actually called regardless
|
||||
of yum action.
|
||||
|
||||
Please note that enable/disablerepo options are general
|
||||
options, this means that we can call those with any action
|
||||
option. https://linux.die.net/man/8/yum
|
||||
|
||||
This docstring will be removed together when issue: #21619
|
||||
will be solved.
|
||||
|
||||
This has been triggered by: #19587
|
||||
"""
|
||||
# The need of this entire if conditional has to be changed
|
||||
# this function is the ensure function that is called
|
||||
# in the main section.
|
||||
#
|
||||
# This conditional tends to disable/enable repo for
|
||||
# install present latest action, same actually
|
||||
# can be done for remove and absent action
|
||||
#
|
||||
# As solution I would advice to cal
|
||||
# try: self.yum_base.repos.disableRepo(disablerepo)
|
||||
# and
|
||||
# try: self.yum_base.repos.enableRepo(enablerepo)
|
||||
# right before any yum_cmd is actually called regardless
|
||||
# of yum action.
|
||||
#
|
||||
# Please note that enable/disablerepo options are general
|
||||
# options, this means that we can call those with any action
|
||||
# option. https://linux.die.net/man/8/yum
|
||||
#
|
||||
# This docstring will be removed together when issue: #21619
|
||||
# will be solved.
|
||||
#
|
||||
# This has been triggered by: #19587
|
||||
|
||||
if self.update_cache:
|
||||
self.module.run_command(self.yum_basecmd + ['clean', 'expire-cache'])
|
||||
|
|
|
@ -163,7 +163,7 @@ class CallbackBase(AnsiblePlugin):
|
|||
|
||||
self._hide_in_debug = ('changed', 'failed', 'skipped', 'invocation', 'skip_reason')
|
||||
|
||||
''' helper for callbacks, so they don't all have to include deepcopy '''
|
||||
# helper for callbacks, so they don't all have to include deepcopy
|
||||
_copy_result = deepcopy
|
||||
|
||||
def set_option(self, k, v):
|
||||
|
|
|
@ -56,15 +56,13 @@ class LookupModule(LookupBase):
|
|||
|
||||
ret = []
|
||||
for term in terms:
|
||||
'''
|
||||
https://docs.python.org/3/library/subprocess.html#popen-constructor
|
||||
|
||||
The shell argument (which defaults to False) specifies whether to use the
|
||||
shell as the program to execute. If shell is True, it is recommended to pass
|
||||
args as a string rather than as a sequence
|
||||
|
||||
https://github.com/ansible/ansible/issues/6550
|
||||
'''
|
||||
# https://docs.python.org/3/library/subprocess.html#popen-constructor
|
||||
#
|
||||
# The shell argument (which defaults to False) specifies whether to use the
|
||||
# shell as the program to execute. If shell is True, it is recommended to pass
|
||||
# args as a string rather than as a sequence
|
||||
#
|
||||
# https://github.com/ansible/ansible/issues/6550
|
||||
term = str(term)
|
||||
|
||||
p = subprocess.Popen(term, cwd=self._loader.get_basedir(), shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||
|
|
Loading…
Reference in New Issue