mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-22 19:23:34 +00:00
run pre-commit run --all
This commit is contained in:
parent
338e6ce743
commit
122cd4c19f
2
.gitignore
vendored
2
.gitignore
vendored
@ -24,5 +24,3 @@ venv
|
|||||||
.venv
|
.venv
|
||||||
|
|
||||||
/build
|
/build
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,20 @@
|
|||||||
repos:
|
repos:
|
||||||
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
|
rev: v2.4.0
|
||||||
|
hooks:
|
||||||
|
- id: trailing-whitespace
|
||||||
|
- id: end-of-file-fixer
|
||||||
|
- id: check-docstring-first
|
||||||
|
- id: check-yaml
|
||||||
|
- id: debug-statements
|
||||||
|
- id: check-ast
|
||||||
|
|
||||||
|
- repo: https://github.com/asottile/pyupgrade
|
||||||
|
rev: v1.25.2
|
||||||
|
hooks:
|
||||||
|
- id: pyupgrade
|
||||||
|
args: ['--py36-plus']
|
||||||
|
|
||||||
- repo: https://github.com/python/black
|
- repo: https://github.com/python/black
|
||||||
rev: stable
|
rev: stable
|
||||||
hooks:
|
hooks:
|
||||||
|
@ -699,5 +699,3 @@ Other changes:
|
|||||||
- Create pyHS100.py. [GadgetReactor]
|
- Create pyHS100.py. [GadgetReactor]
|
||||||
|
|
||||||
- Initial commit. [GadgetReactor]
|
- Initial commit. [GadgetReactor]
|
||||||
|
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ def sysinfo(dev):
|
|||||||
def state(ctx, dev: SmartDevice):
|
def state(ctx, dev: SmartDevice):
|
||||||
"""Print out device state and versions."""
|
"""Print out device state and versions."""
|
||||||
dev.sync.update()
|
dev.sync.update()
|
||||||
click.echo(click.style("== {} - {} ==".format(dev.alias, dev.model), bold=True))
|
click.echo(click.style(f"== {dev.alias} - {dev.model} ==", bold=True))
|
||||||
|
|
||||||
click.echo(
|
click.echo(
|
||||||
click.style(
|
click.style(
|
||||||
@ -199,8 +199,8 @@ def state(ctx, dev: SmartDevice):
|
|||||||
click.echo("Time: {}".format(dev.sync.get_time()))
|
click.echo("Time: {}".format(dev.sync.get_time()))
|
||||||
click.echo("Hardware: {}".format(dev.hw_info["hw_ver"]))
|
click.echo("Hardware: {}".format(dev.hw_info["hw_ver"]))
|
||||||
click.echo("Software: {}".format(dev.hw_info["sw_ver"]))
|
click.echo("Software: {}".format(dev.hw_info["sw_ver"]))
|
||||||
click.echo("MAC (rssi): {} ({})".format(dev.mac, dev.rssi))
|
click.echo(f"MAC (rssi): {dev.mac} ({dev.rssi})")
|
||||||
click.echo("Location: {}".format(dev.location))
|
click.echo(f"Location: {dev.location}")
|
||||||
|
|
||||||
ctx.invoke(emeter)
|
ctx.invoke(emeter)
|
||||||
|
|
||||||
|
@ -82,6 +82,7 @@ class EmeterStatus(dict):
|
|||||||
def requires_update(f):
|
def requires_update(f):
|
||||||
"""Indicate that `update` should be called before accessing this method.""" # noqa: D202
|
"""Indicate that `update` should be called before accessing this method.""" # noqa: D202
|
||||||
if inspect.iscoroutinefunction(f):
|
if inspect.iscoroutinefunction(f):
|
||||||
|
|
||||||
@functools.wraps(f)
|
@functools.wraps(f)
|
||||||
async def wrapped(*args, **kwargs):
|
async def wrapped(*args, **kwargs):
|
||||||
self = args[0]
|
self = args[0]
|
||||||
@ -89,6 +90,7 @@ def requires_update(f):
|
|||||||
return await f(*args, **kwargs)
|
return await f(*args, **kwargs)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
@functools.wraps(f)
|
@functools.wraps(f)
|
||||||
def wrapped(*args, **kwargs):
|
def wrapped(*args, **kwargs):
|
||||||
self = args[0]
|
self = args[0]
|
||||||
|
@ -604,5 +604,6 @@ def test_children_get_emeter_monthly(dev):
|
|||||||
|
|
||||||
def test_representation(dev):
|
def test_representation(dev):
|
||||||
import re
|
import re
|
||||||
|
|
||||||
pattern = re.compile("<.* model .* at .* (.*), is_on: .* - dev specific: .*>")
|
pattern = re.compile("<.* model .* at .* (.*), is_on: .* - dev specific: .*>")
|
||||||
assert pattern.match(str(dev))
|
assert pattern.match(str(dev))
|
||||||
|
Loading…
Reference in New Issue
Block a user