def _check_magic_name(self) -> None: if filenames.is_magic(self.filename): good_magic = filenames.is_stem_in_list( self.filename, constants.MAGIC_MODULE_NAMES_WHITELIST, ) if not good_magic: self.add_violation(WrongModuleMagicNameViolation())
def _check_underscores(self) -> None: repeating_underscores = self.filename.count('__') if filenames.is_magic(self.filename): repeating_underscores -= 2 if repeating_underscores > 0: self.add_violation(WrongModuleNameUnderscoresViolation())