summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2024-07-19 09:32:59 (GMT)
committerThomas Haller <thaller@redhat.com>2024-07-19 09:33:07 (GMT)
commit490ffa07e18b9f23ac03dcdc28ce7463336c66a3 (patch)
tree5462fc5b1d83bcd5731a608a57f540c1be9d96ea
parent6fc66dd8ecc3052e2f703654cf0a137fe24006a7 (diff)
downloadlibnl-490ffa07e18b9f23ac03dcdc28ce7463336c66a3.zip
libnl-490ffa07e18b9f23ac03dcdc28ce7463336c66a3.tar.gz
libnl-490ffa07e18b9f23ac03dcdc28ce7463336c66a3.tar.bz2
python: fix flake8 warnings
./python/netlink/route/tc.py:599:37: C408 Unnecessary dict call - rewrite as a literal. ./python/netlink/route/tc.py:610:16: C416 Unnecessary list comprehension - rewrite using list(). ./python/netlink/util.py:106:47: C408 Unnecessary dict call - rewrite as a literal.
-rw-r--r--python/netlink/route/tc.py4
-rw-r--r--python/netlink/util.py2
2 files changed, 3 insertions, 3 deletions
diff --git a/python/netlink/route/tc.py b/python/netlink/route/tc.py
index daad697..eb0037e 100644
--- a/python/netlink/route/tc.py
+++ b/python/netlink/route/tc.py
@@ -596,7 +596,7 @@ _cls_cache = {}
def get_cls(ifindex, parent, handle=None):
- chain = _cls_cache.get(ifindex, dict())
+ chain = _cls_cache.get(ifindex, {})
try:
cache = chain[parent]
@@ -607,6 +607,6 @@ def get_cls(ifindex, parent, handle=None):
cache.refill()
if handle is None:
- return [cls for cls in cache]
+ return list(cache)
return [cls for cls in cache if cls.handle == handle]
diff --git a/python/netlink/util.py b/python/netlink/util.py
index afe7ef0..3adc509 100644
--- a/python/netlink/util.py
+++ b/python/netlink/util.py
@@ -103,7 +103,7 @@ class MyFormatter(Formatter):
if not isinstance(value, property):
raise ValueError("Invalid formatting string {0}".format(key))
- d = getattr(value.fget, "formatinfo", dict())
+ d = getattr(value.fget, "formatinfo", {})
# value = value.fget() is exactly the same
value = getattr(self._obj, key)