Skip to content

Commit ceaa2cd

Browse files
committed
Fix linter and doctests
1 parent b4383f0 commit ceaa2cd

File tree

6 files changed

+32
-34
lines changed

6 files changed

+32
-34
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
.eggs/
55
build/
66
dist/
7+
venv/
78
htmlcov/
89
__pycache__/
910
AUTHORS
1011
Changelog
11-
docs/_build
12+
docs/_build
13+
coverage.xml

docs/calculation.rst

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -66,33 +66,33 @@ All WebGeoCalc calculation objects take their input attributes in
6666
to the any Calculation parameters:
6767

6868
>>> Calculation(
69-
api = 'ESA',
70-
kernels = 6,
71-
times = '2014-01-01T01:23:45.000',
72-
calculation_type = 'STATE_VECTOR',
73-
target = '67P/CHURYUMOV-GERASIMENKO (1969 R1)',
74-
observer = 'ROSETTA ORBITER',
75-
reference_frame = '67P/C-G_CK',
76-
aberration_correction = 'NONE',
77-
state_representation = 'LATITUDINAL',
78-
).api
69+
... api = 'ESA',
70+
... kernels = 6,
71+
... times = '2014-01-01T01:23:45.000',
72+
... calculation_type = 'STATE_VECTOR',
73+
... target = '67P/CHURYUMOV-GERASIMENKO (1969 R1)',
74+
... observer = 'ROSETTA ORBITER',
75+
... reference_frame = '67P/C-G_CK',
76+
... aberration_correction = 'NONE',
77+
... state_representation = 'LATITUDINAL',
78+
... ).api
7979
<Api> http://spice.esac.esa.int/webgeocalc/api
8080

8181
3-rd party WGC are also supported, either set :obj:`WGC_URL`
8282
on your system (as mention before), or you can provide directly
8383
its ``URL`` to the :py:attr:`api` parameter:
8484

8585
>>> Calculation(
86-
api = 'https://wgc.obspm.fr/webgeocalc/api',
87-
kernels = 6,
88-
times = '2014-01-01T01:23:45.000',
89-
calculation_type = 'STATE_VECTOR',
90-
target = '67P/CHURYUMOV-GERASIMENKO (1969 R1)',
91-
observer = 'ROSETTA ORBITER',
92-
reference_frame = '67P/C-G_CK',
93-
aberration_correction = 'NONE',
94-
state_representation = 'LATITUDINAL',
95-
).api
86+
... api = 'https://wgc.obspm.fr/webgeocalc/api',
87+
... kernels = 6,
88+
... times = '2014-01-01T01:23:45.000',
89+
... calculation_type = 'STATE_VECTOR',
90+
... target = '67P/CHURYUMOV-GERASIMENKO (1969 R1)',
91+
... observer = 'ROSETTA ORBITER',
92+
... reference_frame = '67P/C-G_CK',
93+
... aberration_correction = 'NONE',
94+
... state_representation = 'LATITUDINAL',
95+
... ).api
9696
<Api> https://wgc.obspm.fr/webgeocalc/api
9797

9898
In each cases, every new API is cached to improve

setup.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
1-
#!/usr/bin/env python
2-
'''Packaging Webgeocalc.'''
1+
"""Packaging Webgeocalc."""
32

4-
# This will try to import setuptools. If not here, it fails with a message
5-
try:
6-
from setuptools import setup
7-
except ImportError:
8-
raise ImportError("This module could not be installed, probably because"
9-
" setuptools is not installed on this computer."
10-
"\nInstall ez_setup ([sudo] pip install ez_setup) and try again.")
3+
from setuptools import setup
114

125
setup(
136
setup_requires=['pbr'],

tests/test_calculation_run.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from webgeocalc.errors import (CalculationAlreadySubmitted, CalculationFailed,
88
CalculationNotCompleted, CalculationTimeOut,
99
ResultAttributeError)
10-
from webgeocalc.vars import JPL_URL, ESA_URL
10+
from webgeocalc.vars import ESA_URL, JPL_URL
1111

1212
@pytest.fixture
1313
def params():
@@ -448,7 +448,8 @@ def test_state_vector_single_time_esa(requests_mock,
448448

449449
requests_mock.post(ESA_URL + '/calculation/new', json=response_sv_esa)
450450
requests_mock.get(
451-
ESA_URL + '/calculation/' + response_sv_esa['calculationId'], json=response_sv_esa)
451+
ESA_URL + '/calculation/' + response_sv_esa['calculationId'],
452+
json=response_sv_esa)
452453
requests_mock.get(
453454
ESA_URL + '/calculation/' + response_sv_esa['calculationId'] + '/results',
454455
json=results_sv_esa)

webgeocalc/calculation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import time
55

6-
from .api import Api, API, JPL_API, ESA_API
6+
from .api import API, Api, ESA_API, JPL_API
77
from .errors import (CalculationAlreadySubmitted, CalculationConflictAttr,
88
CalculationFailed, CalculationIncompatibleAttr,
99
CalculationInvalidAttr, CalculationInvalidValue,
@@ -389,7 +389,7 @@ def run(self, timeout=30, sleep=1):
389389
if self.columns is not None and self.values is not None:
390390
return self.results
391391

392-
for i in range(int(timeout / sleep)):
392+
for _ in range(int(timeout / sleep)):
393393
self.update()
394394

395395
if self.phase == 'COMPLETE':

webgeocalc/cli.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515

1616
class GetApi(argparse.Action):
1717
"""Custom API from key action."""
18+
1819
def __call__(self, parser, args, values, option_string=None):
20+
"""Select API based on the provided key."""
1921
key = values.upper()
2022
api = JPL_API if key == 'JPL' else ESA_API if key == 'ESA' else Api(key)
2123
setattr(args, self.dest, api)

0 commit comments

Comments
 (0)