1
0
Fork 0
Commit Graph

1448 Commits (master)

Author SHA1 Message Date
Fabian P. Schmidt 5a0c2c62af api/serializers: Remove single-use variables (R0914)
Single-use variables clutter the local namespace and decrease reability.
This patch is part of a series to fix the too-many-locals (R0914)
pylint error for the NewObservationListSerializer.validate method.

Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
2019-12-16 00:25:38 +01:00
Fabian P. Schmidt 77b15b042e views/ObservationListView: Calculate filtered value once (R0912)
This commit reduces the number of branches in `get_queryset` in
order to fix a too-many-branches (R0912) pylint error.

Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
2019-12-15 18:12:36 +00:00
Fabian P. Schmidt e6ba1aaec5 views/ObservationListView: Introduce parameter filter mapping (R0912)
This commit reduces the number of branches in `get_queryset` in
order to fix a too-many-branches (R0912) pylint error.

Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
2019-12-15 18:12:36 +00:00
Fabian P. Schmidt cfc3f3accb views/prediction_windows: Refactor parameter parsing into a seperate function (R0912)
Fixes a too-many-branches (R0912) pylint error.

Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
2019-12-15 18:12:36 +00:00
Fabian P. Schmidt 8df2c36075 views/prediction_windows: Initialize variables as late as possible
This should improves the readability of the code.
2019-12-15 18:12:36 +00:00
Fabian P. Schmidt 92b0c2c37f views/prediction_windows: Move parameter parsing to the beginning 2019-12-15 18:12:36 +00:00
Fabian P. Schmidt e034ef9b21 tests/ObservationFactory: Force start and end datetime to be exactly at the second mark
Fixes issue #696.

Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
2019-12-13 17:39:53 +01:00
Fabian P. Schmidt aa3261683d celery|tasks: Fix celery cyclical dependency (R0401)
Fixes the cyclical dependency between celery.py and tasks.py when
the task is called outside of celery by switching to autodiscovered tasks.
Use @shared_task decorator and wrapper tasks to workaround celery bug.

Fixes cyclic-import pylint error (R0401).

Commit based on: librespacefoundation/satnogs/satnogs-db@61f9137a

Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
2019-12-07 15:22:41 +01:00
Fabian P. Schmidt 406f270efc tests/ObservationFactory: Choose from existing satellites & tles
The ObservationFactory called a subfactory "SatelliteFactory" to
generate satellites with random norad ids (in the 2000 - 4000 range).
This range of NORAD IDs can be found in public catalogs, but most of
those satellites are already decayed (and thus they are not part of
any Celestrak list).

Running update_all_tle thus creates many requests to Celestrak
(~<= 200, the number of observation fixtures) by trying to fetch their
TLEs via the satcat/tle.php endpoint.

This commit solves that problem by adding a RealisticObservationFactory
which uses only existing Satellites (fetched from satnogs-db).

A small caveat: Assigned Satellite & TLE for a generated observation
most likely wont match (but this was already the case before).

Another small caveat: The RealisticObservationFactory can generate at
max only observations as there are satellite (a limitation of the
underlying factory.Iterator).

Requires the TLEs to be fetched before the fixtures can be generated.

Fixes #695.

Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
2019-12-06 18:11:29 +01:00
Fabian P. Schmidt 9c50deb38e tasks/update_all_tle: Only try to fetch offical TLEs from catalogs
Similar commit in db: librespacefoundation/satnogs/satnogs-db@34f2641b

Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
2019-12-05 22:59:51 +00:00
Fabian P. Schmidt 114223f7c2 tasks/update_all_tle: Use set instead of list
Simplifies the logic.

Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
2019-12-05 22:59:51 +00:00
Fabian P. Schmidt efd645de6e management/initialize: Show fixture generation statistics
Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
2019-12-04 20:16:48 +01:00
Fabian P. Schmidt 744106b495 management/fetch_data: Show import statistics
Instead of printing several hundred lines on initialization,
show some useful statistics instead.

Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
2019-12-04 20:07:48 +01:00
Alfredos-Panagiotis Damkalis 4656347fff Handle pyephem next_pass() ValueError
Signed-off-by: Alfredos-Panagiotis Damkalis <fredy@fredy.gr>
2019-12-02 20:07:03 +02:00
Fabian P. Schmidt ad388e80b3 views: Ignore false-positive no-member pylint error (E1101)
Pylint throws a false positive for E1101 under Python2
(but runs cleanly in Python3, TODO: To be checked!).

Similar commit in db: librespacefoundation/satnogs/satnogs-db@9359532d

Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
2019-12-02 17:57:52 +00:00
Fabian P. Schmidt 5bfbc65128 Remove fetch_tle management command
This command has been superseeded by `update_all_tle`. While the
latter doesn't allow to update the TLE of only a single satellite,
it comes with the improvement of not only fetching from Celestrak
like `fetch_tle` but also from different other sources.

Additionally, this command is broken since almost a year (#568).

Fixes #568.

Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
2019-12-02 17:44:25 +00:00
Fabian P. Schmidt 76c393979a models|tests: Ignore too-few-public-methods (R0903)
Ignoring too-few-public-methods (R0903) pylint error  for tests.py
where we do not need to care about public methods,
and for django managers in models.py.

Similar commit in db: librespacefoundation/satnogs/satnogs-db@91d8ba20

Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
2019-12-02 16:49:03 +01:00
Fabian P. Schmidt 13da259255 Ignore ungrouped-imports pylint error where it clashes with isort (C0412)
There are clashes between the positioning and ordering of our imports
between pylint and isort, just ignoring them on the pylint side for now.

Based on: librespacefoundation/satnogs/satnogs-db@fc8f9a8c

Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
2019-12-02 10:34:00 +00:00
Fabian P. Schmidt 602b4fee84 settings: Import only the init symbol from sentry_sdk (C0412)
Fixing the clash between ungrouped-imports (C0412) pylint error and
isort is the desired side effect of this commit.

Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
2019-12-02 10:34:00 +00:00
Fabian P. Schmidt 16d36b7bc6 management/commands: Update to use argparse-based interface
With Django 1.8 the interface for argument parsing of custom
django-admin commands was updated to use argparse, deprecating
the 'args and 'option_list' interface, see [1] and [2].

[1]: https://docs.djangoproject.com/en/1.8/howto/custom-management-commands/#django.core.management.BaseCommand.args
[2]: https://docs.djangoproject.com/en/1.8/howto/custom-management-commands/#django.core.management.BaseCommand.option_list

Fixes #568.

Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
2019-12-02 10:24:24 +00:00
Fabian P. Schmidt a0c879d7b8 scheduling/predict_available_observation_windows: Fix docstring
Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
2019-12-02 10:12:32 +00:00
Fabian P. Schmidt 3731be7adf views: Ignore too-many-ancestors error for rest_framework classes (R0901)
Ignoring cases of too many ancestors in API views.py as these
are upstream, not much we can do about it.

Similar commit in db: librespacefoundation/satnogs/satnogs-db@82713517

Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
2019-12-01 19:51:37 +01:00
Fabian P. Schmidt a7acd6f0d0 Update 'satellitetle' dependency
Move 'satellitetle' from 0.7.0 to 0.8.0,
fixes fetch_tle management command (broken due to an API change
by Celestrak).

Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
2019-12-01 18:25:45 +01:00
Fabian P. Schmidt 0fb5eef514 Ignore no-self-use error for serialization and ModelAdmin member functions (R0201)
Fixes no-self-use (R0201) pylint error.
Similar commit in db: librespacefoundation/satnogs/satnogs-db@9989efb4

Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
2019-11-30 20:20:36 +01:00
Fabian P. Schmidt 5c784c1f0e views/ObservationListView: Use for-loop for vetting based filtering
Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
2019-11-30 19:34:49 +01:00
Fabian P. Schmidt 48c27fbe8d views/ObservationListView: Add get_filter_params method (R0915)
This commit refactors the HTTP GET parameter parsing into a new
funciton get_filter_params, reducing the complexity of get_queryset
and thus fixes a too-many-statements (R0915) pylint error.

Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
2019-11-30 19:34:49 +01:00
Fabian P. Schmidt f91e9adbb9 views/observation_new_post: Improve code style (R0915)
This commit should improve the code readability by removing variables
which were only used once.

Fixes a too-many-statements (R0915) pylint error.

Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
2019-11-30 19:34:49 +01:00
Fabian P. Schmidt 87e858e7b5 model: Add missing __str__ methods (W5101)
Fixes pylint-django error W5101 (model-missing-unicode).

Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
2019-11-30 19:17:23 +01:00
Fabian P. Schmidt 0ebc39c2fd tests: Replace deprecated assertEquals with assertEqual (W1505)
Fixes deprecated-method (W1505) pylint error.

Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
2019-11-30 18:40:26 +01:00
Fabian P. Schmidt afb5783324 templatetags/paginator: Register the tag using a decorator
Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
2019-11-30 17:39:36 +01:00
Fabian P. Schmidt b5fc365469 templatetags/paginator: Fix typo
Fixes regression introduces by 211a7c5.

Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
2019-11-30 17:07:07 +01:00
Fabian P. Schmidt dfed5c65e6 base/models: zip-builtin related 2to3 changes
Fixes pylint error zip-builtin-not-iterating (W1637).
Similar commit in db: librespacefoundation/satnogs/satnogs-db@8734748e

Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
2019-11-30 16:43:37 +01:00
Fabian P. Schmidt 01cabde483 pylint: Re-Enable redefined-builtin (W0622)
Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
2019-11-30 16:39:05 +01:00
Fabian P. Schmidt a06fdec256 pylint: Re-Enable redefined-outer-name (W0621)
Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
2019-11-30 16:39:05 +01:00
Fabian P. Schmidt 9b578b6d73 templatetags/tags: Fix name collision for "freq" (W0621)
Fixes a redefined-outer-name pylint error (W0621).

Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
2019-11-30 16:39:05 +01:00
Fabian P. Schmidt 211a7c5252 templatetags/paginator: Fixes name collision (W0621)
Fixes a redefined-outer-name (W0621) pylint error.

Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
2019-11-30 16:39:05 +01:00
Fabian P. Schmidt 39dc6463fe views: Rename station_log to station_log_view (W0621)
Fixes name collision with the station_log variable, and thus fixes
redefined-outer-name (W0621) pylint error.

Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
2019-11-30 16:39:05 +01:00
Fabian P. Schmidt d20943ce8c model: Replace __unicode__ by __str__
The special method __unicode__ is python2-only,
in python3 it's merged with __str__. In order to be py23-compatible
the python_2_unicode_decorator is used, see
https://docs.djangoproject.com/en/1.11/topics/python3/#str-and-unicode-methods

Equivalent commit in db: librespacefoundation/satnogs/satnogs-db@9a0ef30e

Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
2019-11-30 16:30:01 +01:00
Fabian P. Schmidt 3da6043fde Replace built-in xrange function by range function
Fixes xrange-builtin (W1613) pylint error.

Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
2019-11-30 01:12:25 +01:00
Fabian P. Schmidt 7aeedb6c79 templatetags/paginator.py: Simplify a chained comparison between operands
Fixes chained-comparison (R1716) pylint error.

Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
2019-11-30 00:44:08 +01:00
Fabian P. Schmidt ca35c99b83 Remove unnecessary else/elif conditions after raise and return
`raise` and `return` interrupt the control flow, so `else` is unnecessary
after them. The new code should be logically equivalent.

This commit fixes the following pylint errors:
- no-else-return (R1705)
- no-else-raise (R1720)

Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
2019-11-30 00:43:25 +01:00
Fabian P. Schmidt 5679828e69 base/tasks.py: Replace print statement with print function
Fixes pylint error print-statement (E1601), required for the
transition to python3.

Signed-off-by: Fabian P. Schmidt <kerel@mailbox.org>
2019-11-30 00:15:42 +01:00
Alfredos-Panagiotis Damkalis 81f388b4c8 Add button for loading pass predictions in station page
Signed-off-by: Alfredos-Panagiotis Damkalis <fredy@fredy.gr>
2019-11-29 20:32:53 +02:00
Alfredos-Panagiotis Damkalis f8920087ba Show error when mapbox token doesn't exist
Signed-off-by: Alfredos-Panagiotis Damkalis <fredy@fredy.gr>
2019-11-29 20:32:53 +02:00
Alfredos-Panagiotis Damkalis 01e3493f9f Fix double station requests in observations/new page
Signed-off-by: Alfredos-Panagiotis Damkalis <fredy@fredy.gr>
2019-11-29 20:32:16 +02:00
Alfredos-Panagiotis Damkalis 9eed9314e9 Revert observation_new.js to previous version
Signed-off-by: Alfredos-Panagiotis Damkalis <fredy@fredy.gr>
2019-11-29 00:29:58 +02:00
Alfredos-Panagiotis Damkalis 01dc6a1cd4 Fix scheduling permissions for user with online and testing stations
Signed-off-by: Alfredos-Panagiotis Damkalis <fredy@fredy.gr>
2019-11-29 00:20:58 +02:00
Alfredos-Panagiotis Damkalis 7506c87e0e flake8: Ignore 'W503' error
Signed-off-by: Alfredos-Panagiotis Damkalis <fredy@fredy.gr>
2019-11-29 00:07:02 +02:00
Alfredos-Panagiotis Damkalis 460f6ea66d Reduce SQL queries in user page
Signed-off-by: Alfredos-Panagiotis Damkalis <fredy@fredy.gr>
2019-11-28 16:49:10 +02:00
Alfredos-Panagiotis Damkalis be174ad4dd Reduce SQL queries station page
Signed-off-by: Alfredos-Panagiotis Damkalis <fredy@fredy.gr>
2019-11-28 16:46:13 +02:00