def _post_visit(self) -> None: for string, usage_count in self._string_constants.items(): if usage_count > self.options.max_string_usages: self.add_violation( complexity.OverusedStringViolation( text=source.render_string(string) or "''", baseline=self.options.max_string_usages, ), )
def visit_any_string(self, node: AnyText) -> None: """ Forbids incorrect usage of strings. Raises: StringConstantRedefinedViolation ModuloStringFormatViolation """ text_data = source.render_string(node.s) self._check_is_alphabet(node, text_data) self._check_modulo_patterns(node, text_data) self.generic_visit(node)
def visit_any_string(self, node: AnyText) -> None: """Forbids incorrect usage of strings.""" text_data = source.render_string(node.s) self._check_is_alphabet(node, text_data) self._check_modulo_patterns(node, text_data) self.generic_visit(node)