mirror of
https://github.com/mvt-project/mvt.git
synced 2024-06-26 14:28:54 +00:00
Make MVTModule.get_slug()
a classmethod
This commit is contained in:
parent
73104814ba
commit
b05077a155
|
@ -53,7 +53,7 @@ class CmdCheckIOCS(Command):
|
|||
if self.module_name and iocs_module.__name__ != self.module_name:
|
||||
continue
|
||||
|
||||
if iocs_module().get_slug() != name_only:
|
||||
if iocs_module.get_slug() != name_only:
|
||||
continue
|
||||
|
||||
log.info(
|
||||
|
|
|
@ -74,12 +74,13 @@ class MVTModule:
|
|||
log.info('Loaded %d results from "%s"', len(results), json_path)
|
||||
return cls(results=results, log=log)
|
||||
|
||||
def get_slug(self) -> str:
|
||||
@classmethod
|
||||
def get_slug(cls) -> str:
|
||||
"""Use the module's class name to retrieve a slug"""
|
||||
if self.slug:
|
||||
return self.slug
|
||||
if cls.slug:
|
||||
return cls.slug
|
||||
|
||||
sub = re.sub("(.)([A-Z][a-z]+)", r"\1_\2", self.__class__.__name__)
|
||||
sub = re.sub("(.)([A-Z][a-z]+)", r"\1_\2", cls.__name__)
|
||||
return re.sub("([a-z0-9])([A-Z])", r"\1_\2", sub).lower()
|
||||
|
||||
def check_indicators(self) -> None:
|
||||
|
|
Loading…
Reference in New Issue
Block a user