Skip to content

Commit abb5cbc

Browse files
committed
Conform linting to Black, add fix command
1 parent 8ddafbd commit abb5cbc

File tree

12 files changed

+558
-503
lines changed

12 files changed

+558
-503
lines changed

.isort.cfg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,8 @@
22
multi_line_output=3
33
known_first_party=rflink
44
default_section=THIRDPARTY
5+
# black compatibility
6+
include_trailing_comma=True
7+
force_grid_wrap=0
8+
use_parentheses=True
9+
line_length=88

rflink/__main__.py

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -32,52 +32,53 @@
3232
PacketHandling,
3333
RepeaterProtocol,
3434
RflinkProtocol,
35-
create_rflink_connection
35+
create_rflink_connection,
3636
)
3737

3838
PROTOCOLS = {
39-
'command': RflinkProtocol,
40-
'event': EventHandling,
41-
'print': PacketHandling,
42-
'invert': InverterProtocol,
43-
'repeat': RepeaterProtocol,
39+
"command": RflinkProtocol,
40+
"event": EventHandling,
41+
"print": PacketHandling,
42+
"invert": InverterProtocol,
43+
"repeat": RepeaterProtocol,
4444
}
4545

46-
ALL_COMMANDS = ['on', 'off', 'allon', 'alloff', 'up', 'down', 'stop', 'pair']
46+
ALL_COMMANDS = ["on", "off", "allon", "alloff", "up", "down", "stop", "pair"]
4747

4848

4949
def main(argv=sys.argv[1:], loop=None):
5050
"""Parse argument and setup main program loop."""
51-
args = docopt(__doc__, argv=argv,
52-
version=pkg_resources.require('rflink')[0].version)
51+
args = docopt(
52+
__doc__, argv=argv, version=pkg_resources.require("rflink")[0].version
53+
)
5354

5455
level = logging.ERROR
55-
if args['-v']:
56+
if args["-v"]:
5657
level = logging.INFO
57-
if args['-v'] == 2:
58+
if args["-v"] == 2:
5859
level = logging.DEBUG
5960
logging.basicConfig(level=level)
6061

6162
if not loop:
6263
loop = asyncio.get_event_loop()
6364

64-
if args['--ignore']:
65-
ignore = args['--ignore'].split(',')
65+
if args["--ignore"]:
66+
ignore = args["--ignore"].split(",")
6667
else:
6768
ignore = []
6869

6970
command = next((c for c in ALL_COMMANDS if args[c] is True), None)
7071

7172
if command:
72-
protocol = PROTOCOLS['command']
73+
protocol = PROTOCOLS["command"]
7374
else:
74-
protocol = PROTOCOLS[args['-m']]
75+
protocol = PROTOCOLS[args["-m"]]
7576

7677
conn = create_rflink_connection(
7778
protocol=protocol,
78-
host=args['--host'],
79-
port=args['--port'],
80-
baud=args['--baud'],
79+
host=args["--host"],
80+
port=args["--port"],
81+
baud=args["--baud"],
8182
loop=loop,
8283
ignore=ignore,
8384
)
@@ -86,10 +87,10 @@ def main(argv=sys.argv[1:], loop=None):
8687

8788
try:
8889
if command:
89-
for _ in range(int(args['--repeat'])):
90+
for _ in range(int(args["--repeat"])):
9091
loop.run_until_complete(
91-
protocol.send_command_ack(
92-
args['<id>'], command))
92+
protocol.send_command_ack(args["<id>"], command)
93+
)
9394
else:
9495
loop.run_forever()
9596
except KeyboardInterrupt:

0 commit comments

Comments
 (0)