Esempio n. 1
0
 def _check_minus_sign(self, node: ast.Num) -> None:
     if not count_unary_operator(node, ast.USub) > 1:
         return
     self.add_violation(UselessOperatorsViolation(node, text=str(node.n)))
Esempio n. 2
0
 def _check_not(self, node: ast.Num) -> None:
     if count_unary_operator(node, ast.Not) <= 1:
         return
     self.add_violation(UselessOperatorsViolation(node, text=str(node.n)))
Esempio n. 3
0
 def _check_operator_count(self, node: ast.Num) -> None:
     for node_type, limit in self._limits.items():
         if count_unary_operator(node, node_type) > limit:
             self.add_violation(
                 UselessOperatorsViolation(node, text=str(node.n)), )
Esempio n. 4
0
 def _check_plus_sign(self, node: ast.Num) -> None:
     if count_unary_operator(node, ast.UAdd) <= 0:
         return
     self.add_violation(UselessOperatorsViolation(node, text=str(node.n)))