Skip to content

Commit

Permalink
Fix module interface definitions (#969)
Browse files Browse the repository at this point in the history
Removes flake8 F403 and F401 ignores from
module __init__.py files and adds __all__
definitions for module interfaces.
  • Loading branch information
dosaboy authored Aug 30, 2024
1 parent bbb436e commit a2455d4
Show file tree
Hide file tree
Showing 17 changed files with 162 additions and 45 deletions.
42 changes: 32 additions & 10 deletions hotsos/core/host_helpers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,39 +1,61 @@
from .cli import ( # noqa: F403,F401
from .cli import (
CLIHelper,
CLIHelperFile,
)
from .config import ( # noqa: F403,F401
from .config import (
ConfigBase,
IniConfigBase,
)
from .network import ( # noqa: F403,F401
from .network import (
NetworkPort,
HostNetworkingHelper,
)
from .packaging import ( # noqa: F403,F401
from .packaging import (
DPKGVersion,
APTPackageHelper,
DockerImageHelper,
SnapPackageHelper,
)
from .pebble import ( # noqa: F403,F401 pylint: disable=cyclic-import
from .pebble import ( # pylint: disable=cyclic-import
PebbleHelper,
)
from .ssl import ( # noqa: F403,F401
from .ssl import (
SSLCertificate,
SSLCertificatesHelper,
)
from .systemd import ( # noqa: F403,F401 pylint: disable=cyclic-import
from .systemd import ( # pylint: disable=cyclic-import
SystemdHelper,
)
from .uptime import ( # noqa: F403,F401 pylint: disable=cyclic-import
from .uptime import ( # pylint: disable=cyclic-import
UptimeHelper,
)
from .sysctl import ( # noqa: F403,F401
from .sysctl import (
SYSCtlFactory,
SYSCtlConfHelper,
)
from .apparmor import ( # noqa: F403,F401
from .apparmor import (
AAProfileFactory,
ApparmorHelper,
)

__all__ = [
CLIHelper.__name__,
CLIHelperFile.__name__,
ConfigBase.__name__,
IniConfigBase.__name__,
NetworkPort.__name__,
HostNetworkingHelper.__name__,
DPKGVersion.__name__,
APTPackageHelper.__name__,
DockerImageHelper.__name__,
SnapPackageHelper.__name__,
PebbleHelper.__name__,
SSLCertificate.__name__,
SSLCertificatesHelper.__name__,
SystemdHelper.__name__,
UptimeHelper.__name__,
SYSCtlFactory.__name__,
SYSCtlConfHelper.__name__,
AAProfileFactory.__name__,
ApparmorHelper.__name__,
]
7 changes: 6 additions & 1 deletion hotsos/core/issues/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
from .issue_types import * # noqa: F403,F401
from .utils import ( # noqa: F403,F401
from .utils import (
IssuesManager,
IssueContext,
)

__all__ = [
IssuesManager.__name__,
IssueContext.__name__,
]
9 changes: 7 additions & 2 deletions hotsos/core/plugins/juju/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
from .common import JujuChecks # noqa: F403,F401
from .resources import JujuBinaryInterface # noqa: F403,F401
from .common import JujuChecks
from .resources import JujuBinaryInterface

__all__ = [
JujuChecks.__name__,
JujuBinaryInterface.__name__,
]
12 changes: 9 additions & 3 deletions hotsos/core/plugins/kernel/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
from .common import KernelBase # noqa: F403,F401
from .config import SystemdConfig # noqa: F403,F401
from .kernlog import CallTraceManager # noqa: F403,F401
from .common import KernelBase
from .config import SystemdConfig
from .kernlog import CallTraceManager

__all__ = [
CallTraceManager.__name__,
KernelBase.__name__,
SystemdConfig.__name__,
]
9 changes: 7 additions & 2 deletions hotsos/core/plugins/kernel/kernlog/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
from .calltrace import CallTraceManager # noqa: F403,F401
from .events import KernLogEvents # noqa: F403,F401
from .calltrace import CallTraceManager
from .events import KernLogEvents

__all__ = [
CallTraceManager.__name__,
KernLogEvents.__name__,
]
7 changes: 6 additions & 1 deletion hotsos/core/plugins/lxd/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
from .common import LXD, LXDChecks # noqa: F403,F401
from .common import LXD, LXDChecks

__all__ = [
LXD.__name__,
LXDChecks.__name__,
]
12 changes: 10 additions & 2 deletions hotsos/core/plugins/openstack/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
from .common import ( # noqa: F403,F401
from .common import (
OpenstackBase,
OpenStackChecks,
OpenstackEventHandlerBase,
OpenstackEventCallbackBase,
)
from .openstack import OpenstackConfig # noqa: F403,F401
from .openstack import OpenstackConfig

__all__ = [
OpenstackBase.__name__,
OpenStackChecks.__name__,
OpenstackConfig.__name__,
OpenstackEventHandlerBase.__name__,
OpenstackEventCallbackBase.__name__,
]
14 changes: 12 additions & 2 deletions hotsos/core/plugins/openvswitch/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
from .common import OpenvSwitchChecks # noqa: F403,F401
from .ovs import ( # noqa: F403,F401
from .common import OpenvSwitchChecks
from .ovs import (
OpenvSwitchBase,
OVSBFD,
OVSDB,
OVSDPLookups,
OVSBridge,
OVSDPDK,
)

__all__ = [
OpenvSwitchChecks.__name__,
OpenvSwitchBase.__name__,
OVSBFD.__name__,
OVSBridge.__name__,
OVSDB.__name__,
OVSDPDK.__name__,
OVSDPLookups.__name__,
]
9 changes: 7 additions & 2 deletions hotsos/core/plugins/rabbitmq/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
from .common import RabbitMQChecks # noqa: F403,F401
from .report import RabbitMQReport # noqa: F403,F401
from .common import RabbitMQChecks
from .report import RabbitMQReport

__all__ = [
RabbitMQChecks.__name__,
RabbitMQReport.__name__,
]
12 changes: 7 additions & 5 deletions hotsos/core/plugins/storage/ceph/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from .common import CephChecks, CephConfig, CephDaemonAllOSDsFactory
from .cluster import CephCluster, CephCrushMap

__all__ = [CephChecks.__name__,
CephConfig.__name__,
CephDaemonAllOSDsFactory.__name__,
CephCluster.__name__,
CephCrushMap.__name__]
__all__ = [
CephChecks.__name__,
CephConfig.__name__,
CephDaemonAllOSDsFactory.__name__,
CephCluster.__name__,
CephCrushMap.__name__
]
7 changes: 6 additions & 1 deletion hotsos/core/plugins/system/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
from .common import SystemBase, SystemChecks # noqa: F403,F401
from .common import SystemBase, SystemChecks

__all__ = [
SystemBase.__name__,
SystemChecks.__name__,
]
10 changes: 9 additions & 1 deletion hotsos/core/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from datetime import timedelta
from functools import cached_property

from searchkit import ( # noqa: F403,F401, pylint: disable=W0611
from searchkit import (
FileSearcher as _FileSearcher,
ResultFieldInfo,
SearchDef,
Expand All @@ -17,6 +17,14 @@
from hotsos.core.log import log


# This module acts as a proxy to searchkit but with some addons/modifications
__all__ = [
ResultFieldInfo.__name__,
SearchDef.__name__,
SequenceSearchDef.__name__,
]


class FileSearcher(_FileSearcher):
"""
Custom representation of searchkit FilesSearcher that sets some parameters
Expand Down
6 changes: 5 additions & 1 deletion hotsos/core/ycheck/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
from .engine.common import YDefsLoader # noqa: F403,F401
from .engine.common import YDefsLoader

__all__ = [
YDefsLoader.__name__,
]
10 changes: 8 additions & 2 deletions hotsos/core/ycheck/engine/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
from .common import ( # noqa: F403,F401
from .common import (
YDefsLoader,
YHandlerBase,
)
from .properties import YDefsSection # noqa: F403,F401
from .properties import YDefsSection

__all__ = [
YDefsLoader.__name__,
YHandlerBase.__name__,
YDefsSection.__name__,
]
15 changes: 8 additions & 7 deletions hotsos/core/ycheck/engine/properties/__init__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# the following are done to allow the decorators to do their thing
# The following check property modules need to be imported so that the property
# classes within them get autoregistered. We do not add them to the interface
# list for this module since they are not accessed that way.
from hotsos.core.ycheck.engine.properties import ( # noqa: F403,F401
checks,
conclusions,
inputdef,
search,
vardef,
)
import hotsos.core.ycheck.engine.properties.requires.requires # noqa:F403,F401
from hotsos.core.ycheck.engine.properties.requires.types import ( \
# noqa:F403,F401
config,
)
from hotsos.core.ycheck.engine.properties.common import YDefsSection


from .common import YDefsSection # noqa: F403,F401
__all__ = [
YDefsSection.__name__,
]
12 changes: 11 additions & 1 deletion hotsos/core/ycheck/engine/properties/requires/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .common import ( # noqa: F403,F401
from .common import (
intercept_exception,
OpsUtils,
CheckItemsBase,
Expand All @@ -7,3 +7,13 @@
PackageCheckItemsBase,
ServiceCheckItemsBase,
)

__all__ = [
intercept_exception.__name__,
OpsUtils.__name__,
CheckItemsBase.__name__,
YRequirementTypeBase.__name__,
YRequirementTypeWithOpsBase.__name__,
PackageCheckItemsBase.__name__,
ServiceCheckItemsBase.__name__,
]
14 changes: 12 additions & 2 deletions hotsos/plugin_extensions/openstack/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
from . import ( # noqa: F401
from . import (
summary,
service_features,
service_network_checks,
vm_info,
nova_external_events,
)
from .agent import ( # noqa: F403,F401
from .agent import (
events,
exceptions,
)

__all__ = [
events,
exceptions,
nova_external_events,
summary,
service_features,
service_network_checks,
vm_info,
]

0 comments on commit a2455d4

Please sign in to comment.