Skip to content
Permalink
Browse files

YAPF 0.28.0 fixed a few bugs => reformat

Change-Id: Iac4e8189b9eae50c51d1b881c973a536c2ceb9ba
  • Loading branch information...
svenpanne committed Jul 12, 2019
1 parent 03826fb commit a08e2b4e6575cf2038247be7e86e84a97aad0fb8
Showing with 65 additions and 232 deletions.
  1. +4 −1 .style.yapf
  2. +0 −4 agents/plugins/mk_docker.py
  3. +0 −4 agents/plugins/mk_filestats.py
  4. +0 −1 agents/special/agent_azure
  5. +0 −1 agents/special/agent_prism
  6. +0 −1 agents/special/agent_vsphere
  7. +0 −3 agents/windows/it/remote.py
  8. +0 −2 agents/wnx/integration/local.py
  9. +0 −1 checks/azure.include
  10. +2 −2 checks/bdt_tape_info
  11. +2 −2 checks/bdt_tape_status
  12. +2 −2 checks/cisco_ip_sla
  13. +0 −1 checks/diskstat.include
  14. +2 −2 checks/f5_bigip_cluster_status
  15. +0 −2 checks/legacy_docker.include
  16. +0 −1 checks/ps.include
  17. +0 −1 checks/ucs_c_rack_server_topsystem
  18. +2 −2 checks/viprinet_mem
  19. +0 −2 cmk/ec/export.py
  20. +2 −2 cmk/ec/main.py
  21. +0 −1 cmk/ec/settings.py
  22. +0 −2 cmk/gui/exceptions.py
  23. +0 −2 cmk/gui/htmllib.py
  24. +0 −1 cmk/gui/http.py
  25. +0 −1 cmk/gui/metrics.py
  26. +0 −1 cmk/gui/pages.py
  27. +0 −1 cmk/gui/pagetypes.py
  28. +0 −1 cmk/gui/plugins/dashboard/custom_url.py
  29. +0 −1 cmk/gui/plugins/dashboard/failed_notifications.py
  30. +0 −1 cmk/gui/plugins/dashboard/graph.py
  31. +0 −1 cmk/gui/plugins/dashboard/logo.py
  32. +0 −1 cmk/gui/plugins/dashboard/network_topology.py
  33. +0 −1 cmk/gui/plugins/dashboard/notify_users.py
  34. +0 −1 cmk/gui/plugins/dashboard/overview.py
  35. +0 −1 cmk/gui/plugins/dashboard/snapin.py
  36. +0 −1 cmk/gui/plugins/dashboard/static_text.py
  37. +0 −2 cmk/gui/plugins/dashboard/stats.py
  38. +0 −1 cmk/gui/plugins/dashboard/utils.py
  39. +0 −1 cmk/gui/plugins/dashboard/view.py
  40. +0 −4 cmk/gui/plugins/metrics/utils.py
  41. +0 −1 cmk/gui/plugins/sidebar/utils.py
  42. +0 −1 cmk/gui/plugins/userdb/htpasswd.py
  43. +0 −4 cmk/gui/plugins/userdb/ldap_connector.py
  44. +0 −2 cmk/gui/plugins/userdb/utils.py
  45. +0 −2 cmk/gui/plugins/views/bi.py
  46. +0 −2 cmk/gui/plugins/views/datasources.py
  47. +3 −2 cmk/gui/plugins/views/icons/utils.py
  48. +0 −2 cmk/gui/plugins/views/icons/wato.py
  49. +0 −6 cmk/gui/plugins/views/layouts.py
  50. +0 −3 cmk/gui/plugins/views/mkeventd.py
  51. +0 −1 cmk/gui/plugins/views/utils.py
  52. +0 −1 cmk/gui/plugins/visuals/utils.py
  53. +2 −2 cmk/gui/plugins/wato/check_mk_configuration.py
  54. +10 −10 cmk/gui/plugins/wato/check_parameters/fileinfo-groups.py
  55. +3 −3 cmk/gui/plugins/wato/check_parameters/logwatch_ec.py
  56. +2 −2 cmk/gui/plugins/wato/datasource_programs.py
  57. +0 −2 cmk/gui/plugins/wato/utils/__init__.py
  58. +0 −1 cmk/gui/plugins/wato/utils/simple_modes.py
  59. +0 −2 cmk/gui/sidebar.py
  60. +0 −1 cmk/gui/userdb.py
  61. +0 −3 cmk/gui/valuespec.py
  62. +2 −2 cmk/gui/view_utils.py
  63. +0 −2 cmk/gui/views.py
  64. +0 −1 cmk/gui/visuals.py
  65. +3 −3 cmk/gui/wato/mkeventd.py
  66. +0 −1 cmk/gui/wato/pages/automation.py
  67. +0 −2 cmk/gui/wato/pages/fetch_agent_output.py
  68. +0 −1 cmk/gui/wato/pages/folders.py
  69. +0 −1 cmk/gui/wato/pages/rulesets.py
  70. +0 −2 cmk/gui/wato/pages/services.py
  71. +0 −2 cmk/gui/wato/pages/sites.py
  72. +0 −1 cmk/gui/wato/user_profile.py
  73. +0 −2 cmk/gui/watolib/__init__.py
  74. +0 −1 cmk/gui/watolib/changes.py
  75. +0 −1 cmk/gui/watolib/groups.py
  76. +0 −7 cmk/gui/watolib/host_attributes.py
  77. +0 −3 cmk/gui/watolib/hosts_and_folders.py
  78. +0 −1 cmk/gui/watolib/rulesets.py
  79. +0 −7 cmk/gui/watolib/rulespecs.py
  80. +0 −1 cmk/gui/watolib/tags.py
  81. +0 −2 cmk/special_agents/agent_aws.py
  82. +0 −4 cmk/special_agents/agent_kubernetes.py
  83. +0 −1 cmk/utils/labels.py
  84. +0 −1 cmk/utils/prediction.py
  85. +0 −1 cmk/utils/profile.py
  86. +0 −1 cmk/utils/render.py
  87. +0 −3 cmk/utils/rulesets/ruleset_matcher.py
  88. +0 −4 cmk/utils/schedule.py
  89. +0 −3 cmk/utils/structured_data.py
  90. +0 −1 cmk/utils/tags.py
  91. +0 −2 cmk_base/check_api.py
  92. +0 −2 cmk_base/config.py
  93. +0 −2 cmk_base/data_sources/host_sections.py
  94. +0 −1 cmk_base/data_sources/programs.py
  95. +3 −3 cmk_base/data_sources/snmp.py
  96. +0 −1 cmk_base/decorator.py
  97. +0 −1 cmk_base/discovered_labels.py
  98. +0 −1 cmk_base/snmp_utils.py
  99. +2 −2 doc/treasures/memcached/checks/memcached
  100. +0 −3 doc/treasures/notifications/glpi.py
  101. +0 −1 omd/packages/omd/omdlib/backup.py
  102. +0 −1 omd/packages/omd/omdlib/certs.py
  103. +0 −1 omd/packages/omd/omdlib/main.py
  104. +0 −1 tests/testlib/__init__.py
  105. +0 −1 tests/testlib/base.py
  106. +0 −9 tests/unit/checks/checktestlib.py
  107. +0 −1 tests/unit/checks/generictests/checkhandler.py
  108. +2 −2 tests/unit/checks/test_if_winperf_if.py
  109. +5 −5 tests/unit/cmk/gui/test_background_job.py
  110. +4 −5 tests/unit/cmk/gui/test_sidebar.py
  111. +2 −2 tests/unit/cmk_base/test_check_api.py
  112. +2 −2 tests/unit/cmk_base/test_checking.py
  113. +2 −2 tests/unit/cmk_base/test_checks.py
  114. +2 −2 tests/unit/omdlib/test_site_context.py
  115. +0 −1 web/app/index.wsgi
@@ -159,7 +159,6 @@ indent_blank_lines=False
# 'key2': value1 +
# value2,
# }
# LOCAL CHANGE from "False" to "True"
indent_dictionary_value=True

# The number of columns to use for indentation.
@@ -229,6 +228,10 @@ space_between_ending_comma_and_closing_bracket=False
# Split before arguments
split_all_comma_separated_values=False

# Split before arguments, but do not split all subexpressions recursively
# (unless needed).
split_all_top_level_comma_separated_values=False

# Split before arguments if the argument list is terminated by a
# comma.
split_arguments_when_comma_terminated=False
@@ -159,7 +159,6 @@ def report_exception_to_server(exc, location):

class MKDockerClient(docker.DockerClient):
'''a docker.DockerClient that caches containers and node info'''

def __init__(self, config):
super(MKDockerClient, self).__init__(config['base_url'], version=config['api_version'])
all_containers = self.containers.list(all=True)
@@ -182,7 +181,6 @@ class AgentDispatcher(object):
Once it comes to plugins and custom configuration the user needs to use
a little more complex setup. Have a look at the documentation.
'''

@staticmethod
def iter_socket(sock, descriptor):
header = sock.recv(8)
@@ -270,7 +268,6 @@ def check_container(self, container):

def time_it(func):
'''Decorator to time the function'''

@functools.wraps(func)
def wrapped(*args, **kwargs):
before = time.time()
@@ -304,7 +301,6 @@ def set_version_info(client):

def skippable(section):
'''Decorator to skip the section, if configured to do so'''

@functools.wraps(section)
def wrapped(client, config):
section_name = section.func_name.replace('section_', 'docker_')
@@ -156,7 +156,6 @@ class LazyFileStats(object):
Only call os.stat once, and not until corresponding attributes
are actually needed.
"""

def __init__(self, path):
super(LazyFileStats, self).__init__()
LOGGER.debug("Creating LazyFileStats(%r)", path)
@@ -236,7 +235,6 @@ def dumps(self):

class PatternIterator(object):
"""Recursively iterate over all files"""

def __init__(self, pattern_list):
super(PatternIterator, self).__init__()
self._patterns = [os.path.expanduser(p) for p in pattern_list]
@@ -286,15 +284,13 @@ def get_file_iterator(config):

class AbstractFilter(object):
"""Abstract filter interface"""

def matches(self, lazy_file):
"""return a boolean"""
raise NotImplementedError()


class AbstractNumericFilter(AbstractFilter):
"""Common code for filtering by comparing integers"""

def __init__(self, spec_string):
super(AbstractNumericFilter, self).__init__()
try:
@@ -99,7 +99,6 @@ class AsyncMapper(object): # pylint: disable=too-few-public-methods
a tuple (err, value). If err is falsey, value will we be
yielded (default: (1, None)).
'''

def __init__(self, timeout=None, debug=False, fallback=lambda x: (1, None)):
super(AsyncMapper, self).__init__()
self.timeout = timeout
@@ -81,7 +81,6 @@ def flatten(d, separator="."):
with no nested dicts or lists and each element is a path using the
specified separator
"""

def flatten_int(d, separator="."):
result = []
if isinstance(d, list):
@@ -917,7 +917,6 @@ def get_pattern(pattern, line):
# TODO: Refactor to requests
class ESXConnection(object):
"""Encapsulates the API calls to the ESX system"""

@staticmethod
def _connect_to_server(address, no_cert, debug):
"""Initialize server connection"""
@@ -96,22 +96,19 @@ def actual_output(write_config, wait_agent):

class DuplicateSectionError(Exception):
"""Raised when a section is multiply-created."""

def __init__(self, section):
super(DuplicateSectionError, self).__init__(self, 'Section %r already exists' % section)


class NoSectionError(Exception):
"""Raised when no section matches a requested option."""

def __init__(self, section):
super(NoSectionError, self).__init__(self, 'No section: %r' % (section))


class IniWriter(ConfigParser.RawConfigParser):
"""Writer for Windows ini files. Simplified version of RawConfigParser but
supports multiple values for a single key."""

def add_section(self, section):
"""Create a new section in the configuration.
@@ -197,14 +197,12 @@ def actual_output(write_config, wait_agent):

class DuplicateSectionError(Exception):
"""Raised when a section is multiply-created."""

def __init__(self, section):
super(DuplicateSectionError, self).__init__(self, 'Section %r already exists' % section)


class NoSectionError(Exception):
"""Raised when no section matches a requested option."""

def __init__(self, section):
super(NoSectionError, self).__init__(self, 'No section: %r' % section)

@@ -200,7 +200,6 @@ def parse_azure(info):

def discover_azure_by_metrics(*desired_metrics):
"""Return a discovery function, that will discover if any of the metrics are found"""

def discovery_function(parsed):
for name, resource in parsed.iteritems():
metr = resource.get('metrics', {})
@@ -38,8 +38,8 @@ check_info['bdt_tape_info'] = {
'inventory_function': inventory_bdt_tape_info,
'check_function': check_bdt_tape_info,
'service_description': "Tape Library Info",
'snmp_scan_function': lambda oid: ('.1.3.6.1.4.1.20884.10893.2.101' in oid('.1.3.6.1.2.1.1.2.0')
),
'snmp_scan_function': lambda oid:
('.1.3.6.1.4.1.20884.10893.2.101' in oid('.1.3.6.1.2.1.1.2.0')),
'snmp_info': (
'.1.3.6.1.4.1.20884.10893.2.101.1',
[
@@ -57,8 +57,8 @@ check_info['bdt_tape_status'] = {
'inventory_function': inventory_bdt_tape_status,
'check_function': check_bdt_tape_status,
'service_description': "Tape Library Status",
'snmp_scan_function': lambda oid: ('.1.3.6.1.4.1.20884.10893.2.101' in oid('.1.3.6.1.2.1.1.2.0')
),
'snmp_scan_function': lambda oid:
('.1.3.6.1.4.1.20884.10893.2.101' in oid('.1.3.6.1.2.1.1.2.0')),
'snmp_info': (
'.1.3.6.1.4.1.20884.10893.2.101.2',
'1', # bDTGlobalStatus
@@ -112,8 +112,8 @@ def parse_cisco_ip_sla(info):
('Text', None, '', None),
('Connection lost occured', lambda x: 'yes' if x == '1' else 'no', '', 'option'),
('Timeout occured', lambda x: 'yes' if x == '1' else 'no', '', 'option'),
('Completion time over treshold occured', lambda x: 'yes' if x == '1' else 'no', '',
'option'),
('Completion time over treshold occured', lambda x: 'yes'
if x == '1' else 'no', '', 'option'),
),
( # rttMonLatestRttOperEntry
('Latest RTT completion time', int, 'ms/us', 'level'),
@@ -52,7 +52,6 @@ def with_unused_counter_removal(plugin_name):
The decorated parse function will clean up all couters for that plugin which are more
than ten times older than the youngest one to avoid growing up the item state.
'''

def is_plugin_counter_with_age(ident, value):
if not isinstance(value, tuple):
return False
@@ -42,8 +42,8 @@ check_info["f5_bigip_cluster_status"] = {

check_info["f5_bigip_cluster_status.v11_2"] = {
"inventory_function": lambda info: [],
"check_function": lambda x, y, z: (3, "This check is deprecated. Please perform a re-discovery."
),
"check_function": lambda x, y, z:
(3, "This check is deprecated. Please perform a re-discovery."),
"service_description": "BIG-IP Cluster Status",
"node_info": True,
"group": "cluster_status",
@@ -45,7 +45,6 @@ def append_deprecation_warning(check_function):
These legacy parse results correspond to agents/plugins from version
1.5.0b1 to 1.5.0p12
'''

@functools.wraps(check_function)
def wrapper(item, params, parsed):

@@ -332,7 +331,6 @@ def parse_legacy_docker_messed_up_labels(string):
'string' is in the format "key1=value1,key2=value2,...", but there
may be unescaped commas in the values.
'''

def toggle_key_value():
for chunk in string.split('='):
for item in chunk.rsplit(',', 1):
@@ -471,7 +471,6 @@ def cpu_rate(counter, now, lifetime):

class ProcessAggregator(object):
"""Collects information about all instances of monitored processes"""

def __init__(self, cpu_cores, params):
self.cpu_cores = cpu_cores
self.params = params
@@ -35,7 +35,6 @@ def parse_ucs_c_rack_server_topsystem(info):
Input: Single line info with a rack server topsystem information.
Output: Returns dict with dn, address, current time, mode and name as keys (with corresponding values).
"""

def format_data_and_time(date_and_time):
"""Converts date and time and returns in time format.
@@ -25,8 +25,8 @@
# Boston, MA 02110-1301 USA.

check_info["viprinet_mem"] = {
'check_function': lambda _no_item, _no_params, info: (
0, "Memory used: %s" % get_bytes_human_readable(saveint(info[0][0]))),
'check_function': lambda _no_item, _no_params, info:
(0, "Memory used: %s" % get_bytes_human_readable(saveint(info[0][0]))),
'inventory_function': lambda info: len(info) > 0 and [(None, None)] or [],
'service_description': "Memory",
'snmp_info': (".1.3.6.1.4.1.35424.1.2", [2]),
@@ -59,7 +59,6 @@ class MkpRulePackProxy(UserDict.DictMixin):
A newly created instance is not yet connected to a specific rule pack.
This is achieved via the method bind_to.
"""

def __init__(self, rule_pack_id):
# Ideally the 'id_' would not be necessary and the proxy object would
# be bound to it's referenced object upon initialization. Unfortunately,
@@ -405,7 +404,6 @@ def rule_pack_id_to_mkp(package_info):
Every rule pack is contained exactly once in this mapping. If no corresponding
MKP exists, the value of that mapping is None.
"""

def mkp_of(rule_pack_file):
# type: (str) -> Any
"""Find the MKP for the given file"""
@@ -1009,8 +1009,8 @@ def serve(self):
if self._snmptrap is not None and self._snmptrap.fileno() in readable:
try:
message, sender_address = self._snmptrap.recvfrom(65535)
self.process_raw_data(lambda: self._snmp_trap_engine.process_snmptrap(
message, sender_address))
self.process_raw_data(
lambda: self._snmp_trap_engine.process_snmptrap(message, sender_address))
except Exception:
self._logger.exception(
'Exception handling a SNMP trap from "%s". Skipping this one' %
@@ -125,7 +125,6 @@ def _default_port_numbers():

class ECArgumentParser(ArgumentParser):
"""An argument parser for the event console"""

def __init__(self, prog, version, paths, port_numbers):
# type: (str, str, Paths, PortNumbers) -> None
super(ECArgumentParser, self).__init__(prog=prog,
@@ -42,7 +42,6 @@ class RequestTimeout(MKTimeout):

class FinalizeRequest(Exception):
"""Is used to end the HTTP request processing from deeper code levels"""

def __init__(self, code):
# type: (int) -> None
super(FinalizeRequest, self).__init__("%d %s" % (code, HTTP_STATUS_CODES[code]))
@@ -52,7 +51,6 @@ def __init__(self, code):
class HTTPRedirect(FinalizeRequest):
"""Is used to end the HTTP request processing from deeper code levels
and making the client request another page after receiving the response."""

def __init__(self, url):
# type: (str) -> None
super(HTTPRedirect, self).__init__(httplib.FOUND)
@@ -773,7 +773,6 @@ class TimeoutManager(object):
first try to write anything to the client) which will result in an
exception.
"""

def enable_timeout(self, duration):
def handle_request_timeout(signum, frame):
raise RequestTimeout(
@@ -803,7 +802,6 @@ def disable_timeout(self):
class TransactionManager(object):
"""Manages the handling of transaction IDs used by the GUI to prevent against
performing the same action multiple times."""

def __init__(self, request):
super(TransactionManager, self).__init__()
self._request = request
@@ -50,7 +50,6 @@ class Request(object):
and provides some low level functions to the application for accessing these
information. These should be basic HTTP request handling things and no application
specific mechanisms."""

def __init__(self, wsgi_environ):
super(Request, self).__init__()
self._logger = log.logger.getChild("http.Request")
@@ -326,7 +326,6 @@ def _skip_perfometer_by_trivial_metrics(self, required_metric_names, translated_
class MetricometerRenderer(object):
__metaclass__ = abc.ABCMeta
"""Abstract base class for all metricometer renderers"""

@classmethod
def type_name(cls):
raise NotImplementedError()
@@ -121,7 +121,6 @@ def register(path):
It is essentially a decorator that calls register_page_handler().
"""

def wrap(wrapped_callable):
cls_name = "PageClass%s" % path.title().replace(":", "")
LegacyPageClass = type(cls_name, (Page,), {
@@ -1197,7 +1197,6 @@ def __init__(self, type_title=None, with_foreign_groups=True, **kwargs):

class ContactGroupChoice(DualListChoice):
"""A multiple selection of contact groups that are part of the current active config"""

def __init__(self, with_foreign_groups=True, **kwargs):
super(ContactGroupChoice, self).__init__(choices=self._load_groups, **kwargs)
self._with_foreign_groups = with_foreign_groups
@@ -40,7 +40,6 @@
@dashlet_registry.register
class URLDashlet(IFrameDashlet):
"""Dashlet that displays a custom webpage"""

@classmethod
def type_name(cls):
return "url"
@@ -37,7 +37,6 @@
@dashlet_registry.register
class FailedNotificationsDashlet(Dashlet):
"""Dashlet notifying users in case of failure to send notifications"""

@classmethod
def type_name(cls):
return "notify_failed_notifications"
@@ -46,7 +46,6 @@
@dashlet_registry.register
class GraphDashlet(Dashlet):
"""Dashlet for rendering a single performance graph"""

@classmethod
def type_name(cls):
return "pnpgraph"
@@ -36,7 +36,6 @@
@dashlet_registry.register
class MKLogoDashlet(Dashlet):
"""Dashlet that displays the Check_MK logo"""

@classmethod
def type_name(cls):
return "mk_logo"
@@ -36,7 +36,6 @@
@dashlet_registry.register
class NetworkTopologyDashlet(IFrameDashlet):
"""Dashlet that displays a NagVis automap"""

@classmethod
def type_name(cls):
return "network_topology"
@@ -40,7 +40,6 @@
@dashlet_registry.register
class NotifyUsersDashlet(Dashlet):
"""Dashlet that displays GUI notifications for users"""

@classmethod
def type_name(cls):
return "notify_users"

0 comments on commit a08e2b4

Please sign in to comment.
You can’t perform that action at this time.