diff --git a/pyproject.toml b/pyproject.toml index 776d2b8aef..ad3cce68ed 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -111,7 +111,7 @@ exclude = [ force-exclude = true [tool.ruff.lint] -select = ["E711", "E721", "E9", "F541", "F63", "F7", "F81", "F82"] +select = ["E711", "E713", "E721", "E9", "F541", "F63", "F7", "F81", "F82"] [tool.towncrier] directory = "changelog.d" diff --git a/python/nav/bin/macwatch.py b/python/nav/bin/macwatch.py index 45be694515..6b7761c43d 100755 --- a/python/nav/bin/macwatch.py +++ b/python/nav/bin/macwatch.py @@ -58,7 +58,7 @@ def prioritize_location(cam_objects): # that we ignore it for the time. prioritized_cams = {0: []} for value in LOCATION_PRIORITY.values(): - if not value in prioritized_cams: + if value not in prioritized_cams: prioritized_cams[value] = [] for curr_cam in cam_objects: category = curr_cam.netbox.category_id diff --git a/python/nav/ipdevpoll/plugins/sensors.py b/python/nav/ipdevpoll/plugins/sensors.py index 7defdb939e..fb0d4f5c9a 100644 --- a/python/nav/ipdevpoll/plugins/sensors.py +++ b/python/nav/ipdevpoll/plugins/sensors.py @@ -204,7 +204,7 @@ def _find_submodules(name): pyfiles = ( n for n in os.listdir(directory) - if (n.endswith('.py') or n.endswith('.pyc')) and not n[0] in '_.' + if (n.endswith('.py') or n.endswith('.pyc')) and n[0] not in '_.' ) names = (os.path.splitext(n)[0] for n in pyfiles) return ["{}.{}".format(name, n) for n in names] diff --git a/python/nav/web/geomap/graph.py b/python/nav/web/geomap/graph.py index 2b38513a86..17f3672f5c 100644 --- a/python/nav/web/geomap/graph.py +++ b/python/nav/web/geomap/graph.py @@ -75,8 +75,8 @@ def build_graph(db_results): # create Edge objects: for connection in connections.values(): if ( - not connection['forward']['local_netboxid'] in graph.nodes - or not connection['reverse']['local_netboxid'] in graph.nodes + connection['forward']['local_netboxid'] not in graph.nodes + or connection['reverse']['local_netboxid'] not in graph.nodes ): continue graph.add_edge( diff --git a/python/nav/web/seeddb/utils/move.py b/python/nav/web/seeddb/utils/move.py index 9c4776701e..b8bdc92af7 100644 --- a/python/nav/web/seeddb/utils/move.py +++ b/python/nav/web/seeddb/utils/move.py @@ -75,7 +75,7 @@ def move(request, model, form_model, redirect, title_attr='id', extra_context=No # If nothing is selected, don't update for key in foreign_keys: - if not form.cleaned_data[key] is None: + if form.cleaned_data[key] is not None: data[key] = form.cleaned_data[key] # Update @@ -139,7 +139,7 @@ def _parse_value_differences(values, data, title_attr, fields): if data: new_values = [] for attr in fields: - if not data[attr] is None: + if data[attr] is not None: new_values.append(("New %s" % attr, data[attr])) else: new_values.append(("New %s" % attr, obj[attr])) diff --git a/tools/eventgenerators/moduleevent.py b/tools/eventgenerators/moduleevent.py index 29e46740df..832c95c766 100755 --- a/tools/eventgenerators/moduleevent.py +++ b/tools/eventgenerators/moduleevent.py @@ -65,7 +65,7 @@ def main(): box, module = spec.split(":") cursor.execute(sql, (box, module)) for deviceid, netboxid, moduleid, sysname, modulename in cursor.fetchall(): - if not deviceid in device_dupes: + if deviceid not in device_dupes: netboxes.append((deviceid, netboxid, moduleid)) sysnames.append((sysname, modulename)) device_dupes.add(deviceid) diff --git a/tools/eventgenerators/snmpevent.py b/tools/eventgenerators/snmpevent.py index 148a3cc702..69499e9cda 100755 --- a/tools/eventgenerators/snmpevent.py +++ b/tools/eventgenerators/snmpevent.py @@ -80,7 +80,7 @@ def handler(nblist, state): database.execute(sql) for netboxid, sysname, typeid in database.fetchall(): - if not netboxid in nbdup: + if netboxid not in nbdup: nb.append(netboxid) sysnames.append(sysname) nbdup.add(netboxid)