run pre-commit run --all

This commit is contained in:
Bas Nijholt
2019-12-12 10:41:52 +01:00
parent 338e6ce743
commit 122cd4c19f
19 changed files with 54 additions and 39 deletions

View File

@@ -172,7 +172,7 @@ def sysinfo(dev):
def state(ctx, dev: SmartDevice):
"""Print out device state and versions."""
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.style(
@@ -199,8 +199,8 @@ def state(ctx, dev: SmartDevice):
click.echo("Time: {}".format(dev.sync.get_time()))
click.echo("Hardware: {}".format(dev.hw_info["hw_ver"]))
click.echo("Software: {}".format(dev.hw_info["sw_ver"]))
click.echo("MAC (rssi): {} ({})".format(dev.mac, dev.rssi))
click.echo("Location: {}".format(dev.location))
click.echo(f"MAC (rssi): {dev.mac} ({dev.rssi})")
click.echo(f"Location: {dev.location}")
ctx.invoke(emeter)

View File

@@ -82,6 +82,7 @@ class EmeterStatus(dict):
def requires_update(f):
"""Indicate that `update` should be called before accessing this method.""" # noqa: D202
if inspect.iscoroutinefunction(f):
@functools.wraps(f)
async def wrapped(*args, **kwargs):
self = args[0]
@@ -89,6 +90,7 @@ def requires_update(f):
return await f(*args, **kwargs)
else:
@functools.wraps(f)
def wrapped(*args, **kwargs):
self = args[0]

View File

@@ -44,4 +44,4 @@
"updating": 0
}
}
}
}

View File

@@ -44,4 +44,4 @@
"updating": 0
}
}
}
}

View File

@@ -46,4 +46,4 @@
"updating": 0
}
}
}
}

View File

@@ -47,4 +47,4 @@
"updating": 0
}
}
}
}

View File

@@ -47,4 +47,4 @@
"updating": 0
}
}
}
}

View File

@@ -44,4 +44,4 @@
"updating": 0
}
}
}
}

View File

@@ -72,4 +72,4 @@
"updating": 0
}
}
}
}

View File

@@ -99,4 +99,4 @@
"updating": 0
}
}
}
}

View File

@@ -90,4 +90,4 @@
"sw_ver": "1.8.6 Build 180809 Rel.091659"
}
}
}
}

View File

@@ -100,4 +100,4 @@
"sw_ver": "1.4.3 Build 170504 Rel.144921"
}
}
}
}

View File

@@ -100,4 +100,4 @@
"sw_ver": "1.1.0 Build 160630 Rel.085319"
}
}
}
}

View File

@@ -101,4 +101,4 @@
"sw_ver": "1.6.0 Build 170703 Rel.141938"
}
}
}
}

View File

@@ -604,5 +604,6 @@ def test_children_get_emeter_monthly(dev):
def test_representation(dev):
import re
pattern = re.compile("<.* model .* at .* (.*), is_on: .* - dev specific: .*>")
assert pattern.match(str(dev))