Skip to content

Commit

Permalink
Fix linting error on type checks
Browse files Browse the repository at this point in the history
  • Loading branch information
jstraw committed Dec 11, 2024
1 parent cca301c commit 293d032
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions pypuppetdb/QueryBuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ def __init__(self, operator):
self.operations = []

def add(self, query):
if type(query) == list:
if isinstance(query, list):
for i in query:
self.add(i)
elif type(query) == str:
elif isinstance(query, str):
self.operations.append(json.loads(query))
elif isinstance(query, (BinaryOperator, InOperator, BooleanOperator)):
self.operations.append(query.json_data())
Expand Down Expand Up @@ -652,7 +652,7 @@ class NullOperator(BinaryOperator):
"""

def __init__(self, field, value):
if type(value) != bool:
if not isinstance(value, bool):
raise APIError("NullOperator value must be boolean")

super().__init__("null?", field, value)
Expand Down
4 changes: 2 additions & 2 deletions pypuppetdb/api/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def nodes(self, unreported=2, with_status=False, with_event_numbers=True, **kwar
# If we happen to only get one node back it
# won't be inside a list so iterating over it
# goes boom. Therefor we wrap a list around it.
if type(nodes) == dict:
if isinstance(nodes, dict):
nodes = [
nodes,
]
Expand Down Expand Up @@ -239,7 +239,7 @@ def catalogs(self, **kwargs):

catalogs = self._query("catalogs", **kwargs)

if type(catalogs) == dict:
if isinstance(catalogs, dict):
catalogs = [
catalogs,
]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_api_pql.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def test_pql_casting(self, api):

nodes = list(api.pql(pql_query))

assert type(nodes[0]) == Node
assert isinstance(nodes[0], Node)
assert nodes[0].name == "greenserver.vm"

httpretty.disable()
Expand Down

0 comments on commit 293d032

Please sign in to comment.