mirror of
https://github.com/mvt-project/mvt.git
synced 2026-10-12 18:57:45 +02:00
Make MVTModule.get_slug() a classmethod (#418)
This commit is contained in:
1 parent
73104814ba
commit
1d075abde9
2 files changed
+6
-5
No files matched your search
@@ -53,7 +53,7 @@ class CmdCheckIOCS(Command):
|
|||||||
if self.module_name and iocs_module.__name__ != self.module_name:
|
if self.module_name and iocs_module.__name__ != self.module_name:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if iocs_module().get_slug() != name_only:
|
if iocs_module.get_slug() != name_only:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
log.info(
|
log.info(
|
||||||
|
|||||||
@@ -74,12 +74,13 @@ class MVTModule:
|
|||||||
log.info('Loaded %d results from "%s"', len(results), json_path)
|
log.info('Loaded %d results from "%s"', len(results), json_path)
|
||||||
return cls(results=results, log=log)
|
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"""
|
"""Use the module's class name to retrieve a slug"""
|
||||||
if self.slug:
|
if cls.slug:
|
||||||
return self.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()
|
return re.sub("([a-z0-9])([A-Z])", r"\1_\2", sub).lower()
|
||||||
|
|
||||||
def check_indicators(self) -> None:
|
def check_indicators(self) -> None:
|
||||||
|
|||||||
Reference in new issue
Block a user