kopia lustrzana https://github.com/glidernet/ogn-python
flake8 beautifications
rodzic
7a9db4f97f
commit
e495d52234
|
@ -1,6 +1,6 @@
|
||||||
from ogn.commands.dbutils import session
|
from ogn.commands.dbutils import session
|
||||||
from ogn.model import Device, AircraftType
|
from ogn.model import Device, AircraftType
|
||||||
from sqlalchemy import func, and_, true, false
|
from sqlalchemy import func
|
||||||
|
|
||||||
from manager import Manager
|
from manager import Manager
|
||||||
manager = Manager()
|
manager = Manager()
|
||||||
|
@ -10,9 +10,9 @@ manager = Manager()
|
||||||
def aircraft_type_stats():
|
def aircraft_type_stats():
|
||||||
"""Show stats about aircraft types used by devices."""
|
"""Show stats about aircraft types used by devices."""
|
||||||
aircraft_type_query = session.query(Device.aircraft_type,
|
aircraft_type_query = session.query(Device.aircraft_type,
|
||||||
func.count(Device.id)) \
|
func.count(Device.id)) \
|
||||||
.group_by(Device.aircraft_type) \
|
.group_by(Device.aircraft_type) \
|
||||||
.order_by(func.count(Device.id).desc())
|
.order_by(func.count(Device.id).desc())
|
||||||
print("--- Aircraft types ---")
|
print("--- Aircraft types ---")
|
||||||
for [aircraft_type, count] in aircraft_type_query.all():
|
for [aircraft_type, count] in aircraft_type_query.all():
|
||||||
at = AircraftType(aircraft_type)
|
at = AircraftType(aircraft_type)
|
||||||
|
@ -24,8 +24,8 @@ def stealth_stats():
|
||||||
"""Show stats about stealth flag set by devices."""
|
"""Show stats about stealth flag set by devices."""
|
||||||
stealth_query = session.query(Device.stealth,
|
stealth_query = session.query(Device.stealth,
|
||||||
func.count(Device.id)) \
|
func.count(Device.id)) \
|
||||||
.group_by(Device.stealth) \
|
.group_by(Device.stealth) \
|
||||||
.order_by(func.count(Device.id).desc())
|
.order_by(func.count(Device.id).desc())
|
||||||
print("--- Stealth ---")
|
print("--- Stealth ---")
|
||||||
for [is_stealth, count] in stealth_query.all():
|
for [is_stealth, count] in stealth_query.all():
|
||||||
print("{}: {}".format(is_stealth, count))
|
print("{}: {}".format(is_stealth, count))
|
||||||
|
@ -35,9 +35,9 @@ def stealth_stats():
|
||||||
def software_stats():
|
def software_stats():
|
||||||
"""Show stats about software version used by devices."""
|
"""Show stats about software version used by devices."""
|
||||||
software_query = session.query(Device.software_version,
|
software_query = session.query(Device.software_version,
|
||||||
func.count(Device.id)) \
|
func.count(Device.id)) \
|
||||||
.group_by(Device.software_version) \
|
.group_by(Device.software_version) \
|
||||||
.order_by(func.count(Device.id).desc())
|
.order_by(func.count(Device.id).desc())
|
||||||
print("--- Software version ---")
|
print("--- Software version ---")
|
||||||
for [software_version, count] in software_query.all():
|
for [software_version, count] in software_query.all():
|
||||||
print("{}: {}".format(software_version, count))
|
print("{}: {}".format(software_version, count))
|
||||||
|
@ -47,9 +47,9 @@ def software_stats():
|
||||||
def hardware_stats():
|
def hardware_stats():
|
||||||
"""Show stats about hardware version used by devices."""
|
"""Show stats about hardware version used by devices."""
|
||||||
hardware_query = session.query(Device.hardware_version,
|
hardware_query = session.query(Device.hardware_version,
|
||||||
func.count(Device.id)) \
|
func.count(Device.id)) \
|
||||||
.group_by(Device.hardware_version) \
|
.group_by(Device.hardware_version) \
|
||||||
.order_by(func.count(Device.id).desc())
|
.order_by(func.count(Device.id).desc())
|
||||||
print("\n--- Hardware version ---")
|
print("\n--- Hardware version ---")
|
||||||
for [hardware_version, count] in hardware_query.all():
|
for [hardware_version, count] in hardware_query.all():
|
||||||
print("{}: {}".format(hardware_version, count))
|
print("{}: {}".format(hardware_version, count))
|
||||||
|
|
|
@ -2,7 +2,6 @@ import logging
|
||||||
from ogn.commands.dbutils import session
|
from ogn.commands.dbutils import session
|
||||||
from ogn.model import AircraftBeacon, ReceiverBeacon, Device, Receiver, Location
|
from ogn.model import AircraftBeacon, ReceiverBeacon, Device, Receiver, Location
|
||||||
from ogn.parser import parse_aprs, parse_ogn_receiver_beacon, parse_ogn_aircraft_beacon, ParseError
|
from ogn.parser import parse_aprs, parse_ogn_receiver_beacon, parse_ogn_aircraft_beacon, ParseError
|
||||||
from ogn.model.address_origin import AddressOrigin
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue