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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
`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>