Skip to content

Commit

Permalink
Increase mypy scope a in cmk_base code
Browse files Browse the repository at this point in the history
Change-Id: I4e3c37ae38cd272fcbb8234d85339a8efc770e29
  • Loading branch information
LarsMichelsen committed Apr 23, 2019
1 parent 8274da5 commit 7dfb941
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmk_base/data_sources/__init__.py
Expand Up @@ -65,7 +65,7 @@
try:
import cmk_base.cee.keepalive as keepalive
except Exception:
keepalive = None
keepalive = None # type: ignore


def _in_keepalive_mode():
Expand Down
8 changes: 7 additions & 1 deletion cmk_base/snmp_utils.py
Expand Up @@ -74,7 +74,13 @@ def is_snmpv3_host(host_config):
# And if it is a six-tuple, it has the following additional arguments:
# (5) privacy protocol (DES|AES) (-x)
# (6) privacy protocol pass phrase (-X)
SNMPCredentials = Union[str, Tuple[str, str, str, str], Tuple[str, str, str, str], Tuple[str, str]]
SNMPCommunity = str
# TODO: This does not work as intended
#SNMPv3NoAuthNoPriv = Tuple[str, str]
#SNMPv3AuthNoPriv = Tuple[str, str, str, str]
#SNMPv3AuthPriv = Tuple[str, str, str, str, str, str]
#SNMPCredentials = Union[SNMPCommunity, SNMPv3NoAuthNoPriv, SNMPv3AuthNoPriv, SNMPv3AuthPriv]
SNMPCredentials = Union[SNMPCommunity, Tuple[str, ...]]

# Wraps the configuration of a host into a single object for the SNMP code
SNMPHostConfig = NamedTuple(
Expand Down
18 changes: 18 additions & 0 deletions mypy.ini
Expand Up @@ -2,3 +2,21 @@
python_version = 2.7
strict_optional = True
follow_imports = silent

# Used by cmk_base/data_sources/impi.py - not able to make this visible easily
# Disabling checking this external module for the moment to be able to enable
# checking our code.
[mypy-pyghmi.*]
ignore_missing_imports = True

# Used by cmk_base/data_sources/tcp.py. Same as above.
[mypy-Cryptodome.*]
ignore_missing_imports = True

# Used by cmk_base/cee/rrd.py. Same as above
[mypy-rrdtool.*]
ignore_missing_imports = True

# Used by cmk_base/cee/inline_snmp.py. Same as above
[mypy-netsnmp.*]
ignore_missing_imports = True
4 changes: 4 additions & 0 deletions tests/static/Makefile
Expand Up @@ -6,6 +6,10 @@ FILES_TO_CHECK := $(realpath $(addprefix ../../cmk/ec/,defaults.py export.py mai
$(realpath $(wildcard ../../cmk/notification_plugins/*.py)) \
$(realpath $(wildcard ../../cmk/special_agents/*.py)) \
$(realpath $(wildcard ../../cmk_base/*.py)) \
$(wildcard $(realpath ../..)/cmk_base/cee/*.py) \
$(wildcard $(realpath ../..)/cmk_base/automations/*.py) \
$(wildcard $(realpath ../..)/cmk_base/modes/*.py) \
$(wildcard $(realpath ../..)/cmk_base/data_sources/*.py) \
$(realpath $(addprefix ../../cmk/gui/,dashboard.py exceptions.py globals.py htmllib.py \
i18n.py sidebar.py sites.py table.py visuals.py permissions.py)) \
$(realpath $(addprefix ../../cmk/gui/watolib/,rulespecs.py)) \
Expand Down

0 comments on commit 7dfb941

Please sign in to comment.