Skip to content

Commit

Permalink
ci: update black to 24.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
svinota committed Feb 2, 2024
1 parent ca8bf0f commit 7340c49
Show file tree
Hide file tree
Showing 41 changed files with 55 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repos:
name: isort (python)
args: ['-m', '3', '--tc', '-w', '79', '--profile', 'black']
- repo: https://github.com/psf/black
rev: 23.1.0
rev: 24.1.1
hooks:
- id: black
args: ['-C', '-S', '-l', '79']
Expand Down
1 change: 1 addition & 0 deletions pr2modules/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
It will be removed in 0.8.x
'''

import sys
import warnings

Expand Down
1 change: 1 addition & 0 deletions pyroute2/bsd/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
Maybe some day it will be ioctl. For now it's ifconfig and netstat.
'''

import re
import socket
import subprocess
Expand Down
1 change: 1 addition & 0 deletions pyroute2/dhcp/dhcp4socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
================
'''

from pyroute2.common import AddrPool
from pyroute2.dhcp.dhcp4msg import dhcp4msg
from pyroute2.ext.rawsocket import RawSocket
Expand Down
8 changes: 3 additions & 5 deletions pyroute2/ethtool/ethtool.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,9 @@ def __new__(cls, speed, duplex, autoneg, supported_ports, supported_modes):

@classmethod
def from_ioctl(cls, link_settings):
(
map_supported,
map_advertising,
map_lp_advertising,
) = IoctlEthtool.get_link_mode_masks(link_settings)
(map_supported, map_advertising, map_lp_advertising) = (
IoctlEthtool.get_link_mode_masks(link_settings)
)
bits_supported = IoctlEthtool.get_link_mode_bits(map_supported)
supported_ports = []
supported_modes = []
Expand Down
1 change: 1 addition & 0 deletions pyroute2/ipdb/linkedset.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'''
'''

import struct
import threading
from collections import OrderedDict
Expand Down
14 changes: 8 additions & 6 deletions pyroute2/ipdb/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,9 +598,9 @@ def make_encap(cls, encap):
if isinstance(labels, (list, tuple, set)):
labels = '/'.join(
map(
lambda x: str(x['label'])
if isinstance(x, dict)
else str(x),
lambda x: (
str(x['label']) if isinstance(x, dict) else str(x)
),
labels,
)
)
Expand Down Expand Up @@ -659,9 +659,11 @@ def make_nh_key(cls, msg):
if field == 'encap' and isinstance(v, (list, tuple, set)):
v = '/'.join(
map(
lambda x: str(x['label'])
if isinstance(x, dict)
else str(x),
lambda x: (
str(x['label'])
if isinstance(x, dict)
else str(x)
),
v,
)
)
Expand Down
1 change: 1 addition & 0 deletions pyroute2/ipdb/transactional.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'''
'''

import logging
import threading

Expand Down
1 change: 1 addition & 0 deletions pyroute2/iproute/bsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
`IPRoute.recv(...)` method returns valid netlink RTNL raw binary
payload and `IPRoute.get(...)` returns parsed RTNL messages.
'''

import errno
import os
import select
Expand Down
1 change: 1 addition & 0 deletions pyroute2/iproute/windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
Using pyroute2 on Windows requires installing `win_inet_pton` module,
you can use `pip install win_inet_pton`.
'''

import ctypes
import os
from socket import AF_INET
Expand Down
1 change: 1 addition & 0 deletions pyroute2/ipset.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
It supports almost all kernel commands (create, destroy, flush,
rename, swap, test...)
'''

import errno
import socket

Expand Down
1 change: 1 addition & 0 deletions pyroute2/ndb/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ def add_mock_netns(self, netns):
# context manager's __exit__()
'''

import atexit
import ctypes
import ctypes.util
Expand Down
1 change: 1 addition & 0 deletions pyroute2/ndb/objects/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
API
===
'''

import collections
import errno
import json
Expand Down
1 change: 1 addition & 0 deletions pyroute2/ndb/objects/address.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
Please notice that address objects are read-only, you may not change them,
only remove old ones, and create new.
'''

from pyroute2.netlink.rtnl.ifaddrmsg import ifaddrmsg
from pyroute2.requests.address import AddressFieldFilter

Expand Down
1 change: 1 addition & 0 deletions pyroute2/ndb/objects/route.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
See here: :ref:`mpls`
'''

import json
import struct
import time
Expand Down
1 change: 1 addition & 0 deletions pyroute2/ndb/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
2,'eth0','5254.0072.58b2','up'
'''

import json
import warnings
from itertools import chain
Expand Down
1 change: 1 addition & 0 deletions pyroute2/ndb/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
all the tables from the DB, and NDB will create them from scratch
on startup.
'''

import enum
import json
import random
Expand Down
1 change: 1 addition & 0 deletions pyroute2/ndb/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
See also: :ref:`remote`
'''

import errno
import importlib
import queue
Expand Down
1 change: 1 addition & 0 deletions pyroute2/ndb/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@
---
'''

import logging
import shlex
import shutil
Expand Down
1 change: 1 addition & 0 deletions pyroute2/netlink/devlink/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
devlink module
==============
'''

from pyroute2.common import map_namespace
from pyroute2.netlink import genlmsg, nla
from pyroute2.netlink.generic import GenericNetlinkSocket
Expand Down
1 change: 1 addition & 0 deletions pyroute2/netlink/event/acpi_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
'type': 32768}
'''

from pyroute2.common import load_dump
from pyroute2.netlink import genlmsg, nla
from pyroute2.netlink.event import EventSocket
Expand Down
1 change: 1 addition & 0 deletions pyroute2/netlink/event/dquot.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
quota warning 8 for uid 0 on 7:0
'''

from pyroute2.common import load_dump
from pyroute2.netlink import genlmsg
from pyroute2.netlink.event import EventSocket
Expand Down
1 change: 1 addition & 0 deletions pyroute2/netlink/event/thermal.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'''
'''

from enum import Enum

from pyroute2.netlink import genlmsg
Expand Down
1 change: 0 additions & 1 deletion pyroute2/netlink/generic/wireguard.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
}
'''


import errno
import logging
import struct
Expand Down
1 change: 1 addition & 0 deletions pyroute2/netlink/ipq/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
`NF_ACCEPT`, and the packet will be pass the
rule.
'''

from pyroute2.netlink import NLM_F_REQUEST, nlmsg
from pyroute2.netlink.nlsocket import Marshal, NetlinkSocket

Expand Down
13 changes: 7 additions & 6 deletions pyroute2/netlink/nl80211/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
TODO
'''

import datetime
import struct

Expand Down Expand Up @@ -943,9 +944,9 @@ def binary_rsn(self, offset, length, defcipher, defauth):
data = data[16:]

if len(data) >= 4:
rsn_values[
"group_mgmt_cipher_suite"
] = self._get_cipher_list(data)
rsn_values["group_mgmt_cipher_suite"] = (
self._get_cipher_list(data)
)
data = data[4:]

return rsn_values
Expand Down Expand Up @@ -1064,9 +1065,9 @@ def decode(self):
)

if msg_type == NL80211_BSS_ELEMENTS_VHT_OPERATION:
self.value[
"VHT_OPERATION"
] = self.binary_vht_operation(offset + 2, length)
self.value["VHT_OPERATION"] = (
self.binary_vht_operation(offset + 2, length)
)

offset += length + 2

Expand Down
1 change: 1 addition & 0 deletions pyroute2/netlink/proxy.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'''
Netlink proxy engine
'''

import errno
import logging
import struct
Expand Down
1 change: 1 addition & 0 deletions pyroute2/netlink/rtnl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
Module contents:
'''

from pyroute2.common import map_namespace

# RTnetlink multicast group flags (for use with bind())
Expand Down
1 change: 0 additions & 1 deletion pyroute2/netlink/rtnl/tcmsg/act_skbedit.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
- queue: integer
'''


from pyroute2.netlink import nla
from pyroute2.netlink.rtnl.tcmsg.common import tc_actions

Expand Down
1 change: 1 addition & 0 deletions pyroute2/netlink/rtnl/tcmsg/cls_u32.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
# 0xffffff00 = 255.255.255.0 (/24)
# 16 = Destination network field bit offset
'''

import struct
from socket import htons

Expand Down
1 change: 0 additions & 1 deletion pyroute2/netlink/rtnl/tcmsg/sched_cake.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
- wash: False or True (False by default)
'''


from pyroute2.netlink import nla
from pyroute2.netlink.rtnl import TC_H_ROOT

Expand Down
1 change: 1 addition & 0 deletions pyroute2/netlink/rtnl/tcmsg/sched_choke.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
ecn=True)
'''

import logging
import struct

Expand Down
1 change: 1 addition & 0 deletions pyroute2/netlink/rtnl/tcmsg/sched_clsact.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
parent="ffff:fff3", classid=1, direct_action=True)
'''

from pyroute2.netlink.rtnl import TC_H_CLSACT

parent = TC_H_CLSACT
Expand Down
1 change: 1 addition & 0 deletions pyroute2/netlink/rtnl/tcmsg/sched_drr.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
ip.tc('add-class', 'drr', interface, '1:20', quantum=1600)
'''

from pyroute2.netlink import nla
from pyroute2.netlink.rtnl import TC_H_ROOT
from pyroute2.netlink.rtnl.tcmsg.common import stats2 as c_stats2
Expand Down
1 change: 1 addition & 0 deletions pyroute2/netlink/rtnl/tcmsg/sched_hfsc.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* `fsc`: link-share curve
* `usc`: upper-limit curve
'''

from pyroute2.netlink import nla
from pyroute2.netlink.rtnl import RTM_DELQDISC, RTM_NEWQDISC, TC_H_ROOT
from pyroute2.netlink.rtnl.tcmsg.common import get_rate, get_time
Expand Down
1 change: 1 addition & 0 deletions pyroute2/netlink/rtnl/tcmsg/sched_htb.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
target=0x10020,
keys=["0x5/0xf+0", "0x10/0xff+33"])
'''

from pyroute2.netlink import nla
from pyroute2.netlink.rtnl import RTM_DELQDISC, RTM_NEWQDISC, TC_H_ROOT
from pyroute2.netlink.rtnl.tcmsg.common import (
Expand Down
1 change: 1 addition & 0 deletions pyroute2/netlink/rtnl/tcmsg/sched_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
All the methods, variables and classes are optional,
but the naming scheme is fixed.
'''

from pyroute2.netlink import nla
from pyroute2.netlink.rtnl import TC_H_ROOT
from pyroute2.netlink.rtnl.tcmsg import common
Expand Down
1 change: 1 addition & 0 deletions pyroute2/netns/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
SELinux state with `getenforce` command.
'''

import ctypes
import ctypes.util
import errno
Expand Down
1 change: 1 addition & 0 deletions pyroute2/nftables/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'''
'''

from pyroute2.netlink.nfnetlink import nfgen_msg
from pyroute2.netlink.nfnetlink.nftsocket import (
DATA_TYPE_ID_TO_NAME,
Expand Down
6 changes: 3 additions & 3 deletions pyroute2/remote/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,9 @@ def stop_server(signum, frame):
and ipr._brd_socket is not None
):
inputs.append(ipr._brd_socket.fileno())
broadcasts[
ipr._brd_socket.fileno()
] = ipr._brd_socket
broadcasts[ipr._brd_socket.fileno()] = (
ipr._brd_socket
)
except Exception as e:
ret = None
error = e
Expand Down
1 change: 1 addition & 0 deletions pyroute2/requests/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'''
General request and RTNL object data filters.
'''

import weakref
from collections import ChainMap

Expand Down

0 comments on commit 7340c49

Please sign in to comment.