Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply latest Black to the repository #573

Merged
merged 3 commits into from
Sep 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
repos:
- repo: https://github.com/python/black
rev: stable
rev: 20.8b1
hooks:
- id: black
language_version: python3.7
- repo: https://github.com/asottile/seed-isort-config
rev: v2.1.0
rev: v2.2.0
hooks:
- id: seed-isort-config
- repo: https://github.com/timothycrosley/isort
rev: 4.3.21 # pick the isort version you'd like to use from https://github.com/timothycrosley/isort/releases
rev: 5.5.2 # pick the isort version you'd like to use from https://github.com/timothycrosley/isort/releases
hooks:
- id: isort
- repo: https://gitlab.com/pycqa/flake8
Expand Down
4 changes: 3 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@
html_static_path = ["_static"]

html_context = {
"css_files": ["_static/theme_overrides.css",], # override wide tables in RTD theme
"css_files": [
"_static/theme_overrides.css",
], # override wide tables in RTD theme
}


Expand Down
6 changes: 5 additions & 1 deletion importers/e_trac_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,11 @@ def _load_this_line(self, data_store, line_number, line, datafile, change_id):
heading_token.record(self.name, "heading", heading)

speed_valid, speed = convert_speed(
speed_token.text, unit_registry.knots, line_number, self.errors, self.error_type,
speed_token.text,
unit_registry.knots,
line_number,
self.errors,
self.error_type,
)
if speed_valid:
state.speed = speed
Expand Down
4 changes: 3 additions & 1 deletion importers/nisida_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,9 @@ def process_detection(self, data_store, datafile, change_id):
sensor_code_token.record(self.name, "sensor", sensor_name)

sensor = self.platform.get_sensor(
data_store=data_store, sensor_name=sensor_name, change_id=change_id,
data_store=data_store,
sensor_name=sensor_name,
change_id=change_id,
)

# Create the contact object that we're going to add to the database
Expand Down
11 changes: 9 additions & 2 deletions importers/nmea_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,10 @@ def _load_this_line(self, data_store, line_number, line, datafile, change_id):
data_store, platform, sensor, timestamp, self.short_name
)

self.location = Location(errors=self.errors, error_type=self.error_type,)
self.location = Location(
errors=self.errors,
error_type=self.error_type,
)

if not self.location.set_latitude_dms(
degrees=self.latitude[:2],
Expand Down Expand Up @@ -156,7 +159,11 @@ def _load_this_line(self, data_store, line_number, line, datafile, change_id):
self.heading_token.record(self.name, "heading", heading)

speed_valid, speed = convert_speed(
self.speed, unit_registry.knots, line_number, self.errors, self.error_type,
self.speed,
unit_registry.knots,
line_number,
self.errors,
self.error_type,
)
if speed_valid:
state.speed = speed
Expand Down
26 changes: 21 additions & 5 deletions importers/replay_contact_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,10 @@ def _load_this_line(self, data_store, line_number, line, datafile, change_id):
return

combine_tokens(
lat_degrees_token, lat_mins_token, lat_secs_token, lat_hemi_token,
lat_degrees_token,
lat_mins_token,
lat_secs_token,
lat_hemi_token,
).record(self.name, "latitude", loc, "DMS")

if not loc.set_longitude_dms(
Expand All @@ -182,7 +185,10 @@ def _load_this_line(self, data_store, line_number, line, datafile, change_id):
return

combine_tokens(
long_degrees_token, long_mins_token, long_secs_token, long_hemi_token,
long_degrees_token,
long_mins_token,
long_secs_token,
long_hemi_token,
).record(self.name, "longitude", loc, "DMS")

location = loc
Expand All @@ -192,7 +198,9 @@ def _load_this_line(self, data_store, line_number, line, datafile, change_id):
)
vessel_name_token.record(self.name, "vessel name", vessel_name_token.text)
sensor = platform.get_sensor(
data_store=data_store, sensor_name=sensor_name.text, change_id=change_id,
data_store=data_store,
sensor_name=sensor_name.text,
change_id=change_id,
)

timestamp = parse_timestamp(date_token.text, time_token.text)
Expand All @@ -219,7 +227,11 @@ def _load_this_line(self, data_store, line_number, line, datafile, change_id):

if range_token.text.upper() != "NULL":
range_valid, range_val = convert_distance(
range_token.text, unit_registry.yard, line, self.errors, self.error_type,
range_token.text,
unit_registry.yard,
line,
self.errors,
self.error_type,
)
if range_valid:
range_token.record(self.name, "range", range_val)
Expand All @@ -228,7 +240,11 @@ def _load_this_line(self, data_store, line_number, line, datafile, change_id):
if freq_token is not None:
if freq_token.text.upper() != "NULL":
freq_valid, freq_val = convert_frequency(
freq_token.text, unit_registry.hertz, line, self.errors, self.error_type,
freq_token.text,
unit_registry.hertz,
line,
self.errors,
self.error_type,
)
if freq_valid:
freq_token.record(self.name, "frequency", freq_val)
Expand Down
6 changes: 5 additions & 1 deletion importers/replay_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ def _load_this_line(self, data_store, line_number, line, datafile, change_id):
)

state = datafile.create_state(
data_store, platform, sensor, rep_line.timestamp, self.short_name,
data_store,
platform,
sensor,
rep_line.timestamp,
self.short_name,
)

if rep_line.depth is not None:
Expand Down
5 changes: 3 additions & 2 deletions migrations/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from config import DB_HOST, DB_NAME, DB_PASSWORD, DB_PORT, DB_TYPE, DB_USERNAME
from paths import MIGRATIONS_DIRECTORY
from pepys_import.core.store import ( # Don't remove, they are necessary for the discovery of changes!
from pepys_import.core.store import ( # noqa: F401,Don't remove,they're necessary for the discovery of changes!
postgres_db,
sqlite_db,
)
Expand Down Expand Up @@ -160,7 +160,8 @@ def process_revision_directives(context_, revision, directives):
# only create Engine if we don't have a Connection
# from the outside
connectable = engine_from_config(
config.get_section(config.config_ini_section), prefix="sqlalchemy.",
config.get_section(config.config_ini_section),
prefix="sqlalchemy.",
)
if db_type == "sqlite":
listen(connectable, "connect", load_spatialite)
Expand Down