Skip to content

Commit

Permalink
style: Fix C0117: Consider changing "not self.optype == 'boolean'" to…
Browse files Browse the repository at this point in the history
… "self.optype != 'boolean'" (unnecessary-negation) (OSGeo#4895)
  • Loading branch information
echoix committed Dec 31, 2024
1 parent daf96ef commit 37c59a6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion gui/wxpython/tplot/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def check_version(*version) -> bool:
versionInstalled.append(v)
except ValueError:
versionInstalled.append(0)
return not versionInstalled < list(version)
return versionInstalled >= list(version)


def findBetween(s, first, last):
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,6 @@ disable = [
"C0114", # Missing module docstring (missing-module-docstring)
"C0115", # Missing class docstring (missing-class-docstring)
"C0116", # Missing function or method docstring (missing-function-docstring)
"C0117", # Consider changing "not self.optype == 'boolean'" to "self.optype != 'boolean'" (unnecessary-negation)
"C0200", # Consider using enumerate instead of iterating with range and len (consider-using-enumerate)
"C0201", # Consider iterating the dictionary directly instead of calling .keys() (consider-iterating-dictionary)
"C0204", # Metaclass class method %s should have %s as first argument (bad-mcs-classmethod-argument)
Expand Down
18 changes: 9 additions & 9 deletions python/grass/temporal/temporal_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ def p_relation_operator(self, t):
| CLPAREN relationlist CRPAREN
"""
# Check for correct type.
if not self.optype == "relation":
if self.optype != "relation":
raise SyntaxError('Wrong optype "%s" must be "relation"' % self.optype)

# Set three operator components.
Expand All @@ -372,7 +372,7 @@ def p_relation_bool_operator(self, t):
| CLPAREN OR OR COMMA relationlist CRPAREN
| CLPAREN AND AND COMMA relationlist CRPAREN
"""
if not self.optype == "boolean":
if self.optype != "boolean":
raise SyntaxError('Wrong optype "%s" must be "boolean"' % self.optype)

# Set three operator components.
Expand All @@ -399,7 +399,7 @@ def p_relation_bool_combi_operator(self, t):
| CLPAREN AND AND COMMA relationlist COMMA OR CRPAREN
| CLPAREN AND AND COMMA relationlist COMMA AND CRPAREN
"""
if not self.optype == "boolean":
if self.optype != "boolean":
raise SyntaxError('Wrong optype "%s" must be "boolean"' % self.optype)

# Set three operator components.
Expand All @@ -422,7 +422,7 @@ def p_relation_bool_combi_operator2(self, t):
| CLPAREN OR OR COMMA relationlist COMMA temporal CRPAREN
| CLPAREN AND AND COMMA relationlist COMMA temporal CRPAREN
"""
if not self.optype == "boolean":
if self.optype != "boolean":
raise SyntaxError('Wrong optype "%s" must be "boolean"' % self.optype)

# Set three operator components.
Expand All @@ -449,7 +449,7 @@ def p_relation_bool_combi_operator3(self, t):
| CLPAREN AND AND COMMA relationlist COMMA OR COMMA temporal CRPAREN
| CLPAREN AND AND COMMA relationlist COMMA AND COMMA temporal CRPAREN
"""
if not self.optype == "boolean":
if self.optype != "boolean":
raise SyntaxError('Wrong optype "%s" must be "relation"' % self.optype)

# Set three operator components.
Expand All @@ -475,7 +475,7 @@ def p_select_relation_operator(self, t):
| CLPAREN select COMMA relation COMMA temporal CRPAREN
| CLPAREN select COMMA relationlist COMMA temporal CRPAREN
"""
if not self.optype == "select":
if self.optype != "select":
raise SyntaxError('Wrong optype "%s" must be "select"' % self.optype)

if len(t) == 4:
Expand Down Expand Up @@ -512,7 +512,7 @@ def p_hash_relation_operator(self, t):
| CLPAREN HASH COMMA relation COMMA temporal CRPAREN
| CLPAREN HASH COMMA relationlist COMMA temporal CRPAREN
"""
if not self.optype == "hash":
if self.optype != "hash":
raise SyntaxError('Wrong optype "%s" must be "hash"' % self.optype)

if len(t) == 4:
Expand Down Expand Up @@ -549,7 +549,7 @@ def p_raster_relation_operator(self, t):
| CLPAREN arithmetic COMMA relation COMMA temporal CRPAREN
| CLPAREN arithmetic COMMA relationlist COMMA temporal CRPAREN
"""
if not self.optype == "raster":
if self.optype != "raster":
raise SyntaxError('Wrong optype "%s" must be "raster"' % self.optype)

if len(t) == 4:
Expand Down Expand Up @@ -586,7 +586,7 @@ def p_overlay_relation_operator(self, t):
| CLPAREN overlay COMMA relation COMMA temporal CRPAREN
| CLPAREN overlay COMMA relationlist COMMA temporal CRPAREN
"""
if not self.optype == "overlay":
if self.optype != "overlay":
raise SyntaxError('Wrong optype "%s" must be "overlay"' % self.optype)

if len(t) == 4:
Expand Down

0 comments on commit 37c59a6

Please sign in to comment.