Skip to content

Commit

Permalink
add formatting workflow (#61)
Browse files Browse the repository at this point in the history
* add formatting workflow

* Fix code style issues with oitnb

Co-authored-by: Lint Action <[email protected]>
  • Loading branch information
zacharyburnett and lint-action authored May 27, 2021
1 parent 09fa1a3 commit 8e313a3
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 30 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: formatting

on: pull_request

jobs:
run-linters:
name: Run formatter
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v1
- name: Install dependencies
run: |
pip install wheel
pip install -e .[development]
- name: Run linters / formatters
uses: wearerequired/lint-action@master
with:
oitnb_command_prefix: isort --fss --fass .;
oitnb: true
auto_fix: true
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
- name: Install dependencies
run: |
pip install wheel
pip install flake8
pip install -e .[testing]
- name: Lint with flake8
run: |
Expand Down
4 changes: 2 additions & 2 deletions packetraven/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from packetraven.packets import APRSPacket
from packetraven.packets.tracks import APRSTrack, LocationPacketTrack
from packetraven.packets.writer import write_packet_tracks
from packetraven.predicts import PredictionAPIURL, PredictionError, get_predictions
from packetraven.predicts import get_predictions, PredictionAPIURL, PredictionError
from packetraven.utilities import get_logger, read_configuration, repository_root

LOGGER = get_logger('packetraven', log_format='%(asctime)s | %(message)s')
Expand All @@ -43,7 +43,7 @@ def main():
args_parser.add_argument(
'--tnc',
help='comma-separated list of serial ports / text files of a TNC parsing APRS packets from analog audio to ASCII'
' (set to `auto` to use the first open serial port)',
' (set to `auto` to use the first open serial port)',
)
args_parser.add_argument(
'--database', help='PostGres database table `user@hostname:port/database/table`'
Expand Down
2 changes: 1 addition & 1 deletion packetraven/connections/serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from packetraven.connections.base import (
APRSPacketSource,
LOGGER,
TimeIntervalError,
next_open_serial_port,
TimeIntervalError,
)
from packetraven.packets import APRSPacket

Expand Down
44 changes: 22 additions & 22 deletions packetraven/gui/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from packetraven.packets import APRSPacket
from packetraven.packets.tracks import LocationPacketTrack, PredictedTrajectory
from packetraven.packets.writer import write_packet_tracks
from packetraven.predicts import PredictionError, get_predictions
from packetraven.predicts import get_predictions, PredictionError
from packetraven.utilities import get_logger


Expand Down Expand Up @@ -707,7 +707,7 @@ def toggle(self):
connection.location
for connection in self.__connections
if isinstance(connection, SerialTNC)
or isinstance(connection, RawAPRSTextFile)
or isinstance(connection, RawAPRSTextFile)
]

api_key = self.__configuration['aprs_fi']['aprs_fi_key']
Expand Down Expand Up @@ -995,7 +995,7 @@ def retrieve_packets(self):
sticky='w',
row=self.__elements[f'{callsign}.source'].grid_info()['row'],
column=self.__elements[f'{callsign}.source'].grid_info()['column']
+ 4,
+ 4,
columnspan=3,
)
self.__add_text_box(
Expand All @@ -1007,9 +1007,9 @@ def retrieve_packets(self):
sticky='w',
row=self.__elements[f'{callsign}.callsign'].grid_info()['row'],
column=self.__elements[f'{callsign}.callsign'].grid_info()[
'column'
]
+ 3,
'column'
]
+ 3,
)
self.__add_text_box(
window,
Expand All @@ -1020,7 +1020,7 @@ def retrieve_packets(self):
sticky='w',
row=self.__elements[f'{callsign}.packets'].grid_info()['row'],
column=self.__elements[f'{callsign}.packets'].grid_info()['column']
+ 3,
+ 3,
)

separator = Separator(window, orient=tkinter.HORIZONTAL)
Expand Down Expand Up @@ -1066,9 +1066,9 @@ def retrieve_packets(self):
sticky='w',
row=self.__elements[f'{callsign}.coordinates'].grid_info()['row'],
column=self.__elements[f'{callsign}.coordinates'].grid_info()[
'column'
]
+ 3,
'column'
]
+ 3,
)
self.__add_text_box(
window,
Expand All @@ -1079,9 +1079,9 @@ def retrieve_packets(self):
sticky='w',
row=self.__elements[f'{callsign}.distance'].grid_info()['row'],
column=self.__elements[f'{callsign}.distance'].grid_info()[
'column'
]
+ 3,
'column'
]
+ 3,
)
self.__add_text_box(
window,
Expand All @@ -1092,9 +1092,9 @@ def retrieve_packets(self):
sticky='w',
row=self.__elements[f'{callsign}.ground_speed'].grid_info()['row'],
column=self.__elements[f'{callsign}.ground_speed'].grid_info()[
'column'
]
+ 3,
'column'
]
+ 3,
)

separator = Separator(window, orient=tkinter.HORIZONTAL)
Expand Down Expand Up @@ -1134,9 +1134,9 @@ def retrieve_packets(self):
'row'
],
column=self.__elements[
f'{callsign}.distance_downrange'
].grid_info()['column']
+ 3,
f'{callsign}.distance_downrange'
].grid_info()['column']
+ 3,
)
self.__add_text_box(
window,
Expand All @@ -1149,9 +1149,9 @@ def retrieve_packets(self):
'row'
],
column=self.__elements[
f'{callsign}.distance_overground'
].grid_info()['column']
+ 3,
f'{callsign}.distance_overground'
].grid_info()['column']
+ 3,
)

separator = Separator(window, orient=tkinter.VERTICAL)
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@
'tablecrow>=1.3.6',
],
extras_require={
'testing': ['flake8', 'pytest', 'pytest-cov', 'pytest-xdist', 'pytz'],
'development': ['oitnb'],
'testing': ['pytest', 'pytest-cov', 'pytest-xdist', 'pytz'],
'development': ['flake8', 'isort', 'oitnb'],
},
entry_points={'console_scripts': ['packetraven=packetraven.__main__:main']},
)
2 changes: 1 addition & 1 deletion tests/test_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import pytest
from sshtunnel import SSHTunnelForwarder
from tablecrow.tables.base import random_open_tcp_port
from tablecrow.tables.postgres import PostGresTable, SSH_DEFAULT_PORT, database_has_table
from tablecrow.tables.postgres import database_has_table, PostGresTable, SSH_DEFAULT_PORT
from tablecrow.utilities import split_hostname_port

from packetraven import APRSDatabaseTable
Expand Down
4 changes: 2 additions & 2 deletions tests/test_predicts.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ def test_float_prediction():
burst_altitude,
descent_rate,
float_end_time=datetime.now()
+ timedelta(seconds=burst_altitude / ascent_rate)
+ timedelta(hours=1),
+ timedelta(seconds=burst_altitude / ascent_rate)
+ timedelta(hours=1),
)

response_json = cusf_api.get()
Expand Down

0 comments on commit 8e313a3

Please sign in to comment.