Skip to content

Commit

Permalink
python: fix flake8 warnings
Browse files Browse the repository at this point in the history
./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.
  • Loading branch information
thom311 committed Jul 19, 2024
1 parent 6fc66dd commit 490ffa0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions python/netlink/route/tc.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ def get_class(ifindex, parent, handle=None):

def get_cls(ifindex, parent, handle=None):

chain = _cls_cache.get(ifindex, dict())
chain = _cls_cache.get(ifindex, {})

try:
cache = chain[parent]
Expand All @@ -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]
2 changes: 1 addition & 1 deletion python/netlink/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def _nlattr(self, key):
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)
Expand Down

0 comments on commit 490ffa0

Please sign in to comment.