예제 #1
0
 def _check_modulo_patterns(
     self,
     node: AnyText,
     text_data: Optional[str],
 ) -> None:
     if self._modulo_string_pattern.search(text_data):
         self.add_violation(consistency.ModuloStringFormatViolation(node))
예제 #2
0
    def _check_modulo_patterns(
        self,
        node: AnyText,
        text_data: Optional[str],
    ) -> None:
        parent = nodes.get_parent(node)
        if parent and strings.is_doc_string(parent):
            return  # we allow `%s` in docstrings: they cannot be formatted.

        if self._modulo_string_pattern.search(text_data):
            self.add_violation(consistency.ModuloStringFormatViolation(node))