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

Amda refac and some global refac #17

Merged
merged 38 commits into from
Oct 7, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
9bd9655
Introduced amda.TimetableIndex to replace xmlid a string
jeandet Aug 4, 2021
4c9d893
AMDA: some cleanups plus introduced DatasetIndex (same idea than Time…
jeandet Aug 5, 2021
cb41689
AMDA: same with CatalogIndex and ParameterIndex
jeandet Aug 5, 2021
308fabc
CDA: Reduce a bit pool size for // tests, this seems to block GH Actions
jeandet Aug 6, 2021
0f295e9
AMDA: Moved config entries to config module and removed SAOP support
jeandet Aug 6, 2021
650f775
AMDA: Now REST client uses http module to ensure useragent is set
jeandet Aug 6, 2021
7103d97
ADMA: some tests cleanups
jeandet Aug 6, 2021
80a69b4
AMDA: removed dataty_constructor param
jeandet Aug 6, 2021
cbd7eb6
Moved 429 and 523 HTTP status codes handling to http module
jeandet Aug 6, 2021
c41b381
New common TimeTable class which fits AMDA needs and can be used with…
jeandet Aug 8, 2021
12a2173
AMDA: Introduced new Catalog class mostly like TimeTable
jeandet Aug 9, 2021
7706a86
AMDA: since get_token is a property token is a better name
jeandet Aug 9, 2021
38400fe
AMDA: REST client refac
jeandet Aug 9, 2021
a64ccc4
AMDA: rest fix error, thx CI
jeandet Aug 9, 2021
ab932ee
AMDA: Rest module refac, indirect request basically uses regular requ…
jeandet Aug 10, 2021
423b0b5
AMDA: Fix LGTM legit warning
jeandet Aug 10, 2021
5a4975c
Try to add pytest for tox
jeandet Aug 10, 2021
22b47d7
update GH actions
jeandet Aug 10, 2021
140b441
CONFIG: Adds ability to set entries from ENV + adds tests
jeandet Aug 10, 2021
20f3cf7
AMDA: adds tests with authentication
jeandet Aug 10, 2021
81ebbbf
Forces tox to forward amda creds from env
jeandet Aug 10, 2021
35bc3f4
Second try to pass AMDA creds on GH Actions
jeandet Aug 10, 2021
58fddcb
try fix AMDA creds on GH actions and typo in http module
jeandet Aug 11, 2021
7e9507d
AMDA: uses new dataset type, skips tests when no credentials are found
jeandet Aug 12, 2021
4ab139c
AMDA: improves naming and implementation consistency
jeandet Aug 12, 2021
4e0b667
LGTM: try to mute false positives
jeandet Aug 12, 2021
79749fc
AMDA: forgot to make get_catalog compatible with CatalogIndex
jeandet Aug 12, 2021
2067e3c
AMDA: Few small refac
jeandet Aug 13, 2021
86d746b
Fix small mistake on previous variable merge function refac
jeandet Aug 15, 2021
80bfdbd
Whole API rework and reorganization + doc WIP
jeandet Aug 22, 2021
7e274c9
New user doc WIP plus some cleanups
jeandet Oct 3, 2021
2d7b6a1
[ssc] Fix regression with python 3.6
jeandet Oct 7, 2021
4527178
Moved AMDA top module from _amda to ws to make it public for API doc
jeandet Oct 7, 2021
637ce68
[GH Actions] adds numpydoc
jeandet Oct 7, 2021
8ba0eea
[Doc] some cleanups, still a lot to do
jeandet Oct 7, 2021
c2d5e21
[lgtm] fixes few actual errors and mute some false positives
jeandet Oct 7, 2021
43c9864
[GH Actions][lgtm] update codecov action and fix legit issue
jeandet Oct 7, 2021
6754c81
[Doc] makes REAMDE point to stable documentation
jeandet Oct 7, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[Doc] some cleanups, still a lot to do
Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
  • Loading branch information
jeandet committed Oct 7, 2021
commit 8ba0eea9bd13d4044580cae3a0eb19e014043369
4 changes: 2 additions & 2 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ Development Lead
Contributors
------------

AMDA_Webservice
^^^^
AMDA Webservice
^^^^^^^^^^^^^^^

* Alexandre Schulz <alexandre.schulz@irap.omp.eu>
* Benjamin Renard <benjamin.renard@irap.omp.eu>
2 changes: 1 addition & 1 deletion docs/amda.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ First import AMDA connection object::

>>> from speasy import amda

Downloading the data is done by using the :meth:`speasy.webservices.amda.ws.AMDA_Webservice.get_data()` or :meth:`speasy.amda.amda.AMDA_Webservice.get_parameter()` methods. For example
Downloading the data is done by using the :meth:`speasy.webservices.amda.ws.AMDA_Webservice.get_data()` or :meth:`speasy.webservices.amda.ws.AMDA_Webservice.get_parameter()` methods. For example
getting `imf` data between 2000-01-01 and 2000-02-01::

>>> parameter = amda.get_data("imf", datetime.datetime(2000,1,1), datetime.datetime(2000,2,1))
Expand Down
2 changes: 1 addition & 1 deletion docs/amda_catalogs.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. _amda-catalogs-label:

AMDA_Webservice Catalogs
-------------
------------------------

Description of AMDAs catalog objects and their representation in :mod:`speasy`. In :mod:`speasy`
catalog metadata is stored as dictionary objects. The catalog's attributes are :
Expand Down
2 changes: 1 addition & 1 deletion docs/amda_datasets.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AMDA_Webservice Datasets
-------------
------------------------

Description of AMDAs dataset objects and their representation in :mod:`speasy`. In :mod:`speasy`
dataset metadata is stored as dictionary objects. The dataset's attributes are :
Expand Down
2 changes: 1 addition & 1 deletion docs/amda_example_1.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AMDA_Webservice Example 1: getting public dataset and parameter
----------------------------------------------------
---------------------------------------------------------------

In this script we download the :data:`tao-ura-sw` dataset and the :data:`imf` parameter on AMDA_Webservice.

Expand Down
2 changes: 1 addition & 1 deletion docs/amda_example_2.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AMDA_Webservice Example 2: getting user defined parameter
----------------------------------------------
---------------------------------------------------------

The following example illustrates how to access parameters defined on your user account within AMDA_Webservice.

Expand Down
2 changes: 1 addition & 1 deletion docs/amda_example_3.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AMDA_Webservice Example 3: listing available parameters
--------------------------------------------
-------------------------------------------------------

Simple example illustrating how to list available parameters, datasets and timetables.

Expand Down
2 changes: 1 addition & 1 deletion docs/amda_example_4.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AMDA_Webservice Example 4: getting timetables
----------------------------------
---------------------------------------------

Download a public timetable.

Expand Down
2 changes: 1 addition & 1 deletion docs/amda_example_get_catalog.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AMDA_Webservice Example 7: getting catalogs
--------------------------------
-------------------------------------------

Download a public catalogs.

Expand Down
2 changes: 1 addition & 1 deletion docs/amda_example_get_user_catalog.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AMDA_Webservice Example 11: getting user catalogs
--------------------------------------
-------------------------------------------------

Downloading private catalogs.

Expand Down
2 changes: 1 addition & 1 deletion docs/amda_example_get_user_timetable.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AMDA_Webservice Example 10: getting user timetables
---------------------------------------
---------------------------------------------------

Downloading private timetables.

Expand Down
4 changes: 2 additions & 2 deletions docs/amda_example_list_catalogs.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
AMDA_Webservice Example 6: listing catalogs
--------------------------------
-------------------------------------------

Listing public catalogs.

.. literalinclude:: ../examples/amda_list_public_catalogs.py
.. literalinclude:: ../examples/amda_list_catalogs.py

Output ::

Expand Down
2 changes: 1 addition & 1 deletion docs/amda_example_list_timetables.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AMDA_Webservice Example 5: listing timetables
----------------------------------
---------------------------------------------

Listing public timetables.

Expand Down
2 changes: 1 addition & 1 deletion docs/amda_example_list_user_catalogs.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AMDA_Webservice Example 9: listing user catalogs
-------------------------------------
------------------------------------------------

Listing private catalogs.

Expand Down
2 changes: 1 addition & 1 deletion docs/amda_example_list_user_timetables.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AMDA_Webservice Example 8: listing user timetables
---------------------------------------
--------------------------------------------------

Listing private timetables.

Expand Down
2 changes: 1 addition & 1 deletion docs/amda_examples.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AMDA_Webservice Examples
-------------
------------------------

.. toctree::
:maxdepth: 1
Expand Down
2 changes: 1 addition & 1 deletion docs/amda_parameters.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AMDA_Webservice Parameter
--------------
-------------------------

Description of AMDAs parameter objects and their representation in :mod:`speasy`. In :mod:`speasy`
parameter metadata is stored as dictionary objects. The parameter's attributes are :
Expand Down
2 changes: 1 addition & 1 deletion docs/amda_products.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AMDA_Webservice Products
-------------
------------------------

List of AMDA_Webservice products.

Expand Down
2 changes: 1 addition & 1 deletion docs/amda_timetables.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. _amda-timetables-label:

AMDA_Webservice Timetables
---------------
--------------------------



Expand Down
5 changes: 5 additions & 0 deletions docs/cdaweb.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CDAWEB
======

.. toctree::
:maxdepth: 1
2 changes: 1 addition & 1 deletion docs/dev_index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Welcome to Speasy's developer documentation!
:caption: Contents:

Indices and tables
==================
------------------
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ Welcome to Speasy's user documentation!
=======================================

.. toctree::
:maxdepth: 2
:maxdepth: 4

readme
installation
user_modules

dev_index

:doc:`Go to developers doc <dev_index>`
5 changes: 5 additions & 0 deletions docs/sscweb.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
SSCWEB
======

.. toctree::
:maxdepth: 1
2 changes: 1 addition & 1 deletion docs/user_modules.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
modules
======
=======

.. toctree::
:maxdepth: 4
Expand Down
29 changes: 21 additions & 8 deletions speasy/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,23 @@ def _save_changes():
class ConfigEntry:
"""Configuration entry class. Used to set and get configuration values.

:param key1: key 1
:type key1: str
:param key2: key 2
:type key2: str
:param default: default value
:type default: str
Attributes
----------
key1: str
Module or category name
key2: str
Entry name
default: str
Default value given by ctor
env_var_name: str
Environment variable name to use to set this entry

Methods
-------
get:
Get entry current value
set:
Set entry value (could be env or file)
"""

def __init__(self, key1: str, key2: str, default: str = ""):
Expand All @@ -41,8 +52,10 @@ def __init__(self, key1: str, key2: str, default: str = ""):
def get(self):
"""Get configuration entry value. If a default is not provided then raise :class:`~speasy.config.exceptions.UndefinedConfigEntry`.

:return: configuration value
:rtype: str
Returns
-------
str:
configuration value
"""
if self.env_var_name in os.environ:
return os.environ[self.env_var_name]
Expand Down
11 changes: 11 additions & 0 deletions speasy/products/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ class Event(DateTimeRange):
meta : dict
Additional event data

Methods
-------

Notes
-----
This class support the same operations as a speasy.common.datetime_range.DateTimeRange.
Expand Down Expand Up @@ -54,6 +57,14 @@ class Catalog:
Catalog name
meta : dict
All additional Catalog meta data

Methods
-------
append:
Append an Event or a list of Event to the end of the Catalog
pop:
Remove and return Event at index (default last)

Examples
--------
>>> my_catalog=Catalog(name='MyCatalog', meta={'tags':['demo', 'docstrings']}, events=[])
Expand Down
Loading