mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-21 08:14:00 +08:00
Pyupgrade 3.6: Update syntax with Python 3.6+ features (#23305)
Updated Python code with Python 3.6+ features:
- utf-8 encoding is now the default (PEP 3120)
- Replace list comprehensions by Generator Expressions (PEP 289)
- Replace yield loop by yield from (PEP 380)
- Remove the (object) subclass when defining a class
- Replace the IOError alias by OSError (PEP 3151)
- Define sets with curly braces {} instead of set()
- Remove "r" parameter from open function, which is default
Co-Authored-By: Adeeb Shihadeh <8762862+adeebshihadeh@users.noreply.github.com>
Co-Authored-By: GregorKikelj <96022003+GregorKikelj@users.noreply.github.com>
Co-authored-by: Adeeb Shihadeh <8762862+adeebshihadeh@users.noreply.github.com>
Co-authored-by: GregorKikelj <96022003+GregorKikelj@users.noreply.github.com>
old-commit-hash: 332f568a8241fba9459cb70c76840b9670e6993a
This commit is contained in:
@@ -118,6 +118,6 @@ if __name__ == "__main__":
|
||||
l.sort(key=lambda x: -x[1])
|
||||
for x in l:
|
||||
print(x[2])
|
||||
print('avg sum: {0:.2%} over {1} samples {2} seconds\n'.format(
|
||||
print('avg sum: {:.2%} over {} samples {} seconds\n'.format(
|
||||
sum(stat['avg']['total'] for k, stat in stats.items()), i, i * SLEEP_INTERVAL
|
||||
))
|
||||
|
||||
@@ -17,7 +17,7 @@ except PermissionError:
|
||||
print("WARNING: failed to make /dev/shm")
|
||||
|
||||
try:
|
||||
with open('/tmp/sensor-test-results.json', 'r') as infile:
|
||||
with open('/tmp/sensor-test-results.json') as infile:
|
||||
data = json.load(infile)
|
||||
except Exception:
|
||||
data = {'sensor-pass': 0, 'sensor-fail': 0}
|
||||
|
||||
@@ -23,7 +23,7 @@ if __name__ == "__main__":
|
||||
outputs = replay_process(cfg, inputs)
|
||||
|
||||
# Remove message generated by the process under test and merge in the new messages
|
||||
produces = set(o.which() for o in outputs)
|
||||
produces = {o.which() for o in outputs}
|
||||
inputs = [i for i in inputs if i.which() not in produces]
|
||||
outputs = sorted(inputs + outputs, key=lambda x: x.logMonoTime)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user