Skip to content

Commit

Permalink
Update documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikedarcy committed Nov 14, 2018
1 parent 74a02ad commit 24f2231
Show file tree
Hide file tree
Showing 8 changed files with 162 additions and 117 deletions.
56 changes: 32 additions & 24 deletions deriva/core/utils/version_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,43 +8,51 @@ def is_compatible(source_version, compat_versions):
comparison via setuptools version comparison logic (http://setuptools.readthedocs.io/en/latest/setuptools.html#id7).
:param source_version: a source version string
:param compat_versions: an array of tuples with each tuple consisting of a set of strings of the form
<operator><version>. The source_version is evaluated in a conjunction against each
<operator><version> string in the tuple, using the pkg_resources version comparison
function. The result of every tuple evaluation is then evaluated in a disjunction
against other tuples in the array. If any one of the tuples evaluates to True, then the
returned disjunction is logically true, and the source version is assumed to be compatible.
:param compat_versions:
an array of tuples with each tuple consisting of a set of strings of the form
`<operator><version>`. The source_version is evaluated in a conjunction against each
`<operator><version>` string in the tuple, using the pkg_resources version comparison
function. The result of every tuple evaluation is then evaluated in a disjunction
against other tuples in the array. If any one of the tuples evaluates to True, then the
returned disjunction is logically true, and the source version is assumed to be compatible.
:return: boolean indicating compatibility
Example 1:
source_version: 0.1.0
compat_versions: [[">=0.1.0", "<1.0.0"]]
result: True
::
is_compatible("0.1.0", [[">=0.1.0", "<1.0.0"]])
:return: `True`
Example 2:
source_version: 1.1.0
compat_versions: [[">=0.1.0", "<1.0.0"]]
result: False
::
is_compatible("1.1.0", [[">=0.1.0", "<1.0.0"]])
:return: `False`
Example 3:
source_version: 0.5.1-dev
compat_versions: [[">=0.3.5rc4", "<0.5.9-beta", "!=0.5.0"]]
result: True
::
is_compatible("0.5.1-dev", [[">=0.3.5rc4", "<0.5.9-beta", "!=0.5.0"]])
:return: `True`
Example 4:
source_version: 0.7.7
compat_versions: [[">=0.7.0", "<0.7.6"], ["!=0.7.1"]]
result: True (disjunct of "!=0.7.1" cancelled out range ">=0.7.0", "<0.7.6" -- see below)
::
is_compatible("0.7.7", [[">=0.7.0", "<0.7.6"], ["!=0.7.1"]])
:return: `True` (disjunct of "!=0.7.1" cancelled out range ">=0.7.0", "<0.7.6" -- see below)
Example 5:
source_version: 0.7.7
compat_versions: [[">=0.7.0", "<0.7.6", "!=0.7.1"]]
result: False
::
is_compatible("0.7.7", [[">=0.7.0", "<0.7.6", "!=0.7.1"]])
:return: `False`
Example 5:
source_version: version-3.3
compat_versions: [["==version-3.0"], ["==version-3.1"], ["==version-3.3"]]
result: True
::
is_compatible("version-3.3", [["==version-3.0"], ["==version-3.1"], ["==version-3.3"]])
:return: `True`
"""
pattern = "^.*(?P<operator>(>=|<=|>|<|==|!=))(?P<version>.*)$"
compat = None
Expand Down
52 changes: 32 additions & 20 deletions deriva/core/utils/webauthn_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,38 @@ def get_wallet_entries(wallet, credential_type="oauth2", **kwargs):
Currently, only "oauth2" is supported as a credential type, and the following keyword args are supported
(all of these are optional):
credential_source - where the credentials came from (e.g., "https://auth.globus.org")
resource_server - the resource server associated with a credential
scopes - a list of desired scopes
For example:
wallet = client.wallet.extra_values.get("wallet")
get_wallet_entries(wallet, "oauth2", resource_server="identifiers.globus.org")
returns a list of oauth2 credentials associated with the resource server identifiers.globus.org
get_wallet_entries(wallet, "oauth2", credential_source="https://auth.globus.org")
returns a list of oauth2 credentials obtained from auth.globus.org
get_wallet_entries(wallet, "oauth2",
credential_source="https://auth.globus.org",
scopes=["https://auth.globus.org/scopes/identifiers.globus.org/create_update"])
returns a list of oauth2 credentials obtained from auth.globus.org with the requested scope
Eventually, we may support wallets with multiple credential types (at the same time) for talking
to a variety of remote servers, at which point the implementation will probably become a lot more
generalized (with registered wallet providers, etc.).
* `credential_source` - where the credentials came from (e.g., "https://auth.globus.org").
* `resource_server` - the resource server associated with a credential.
* `scopes` - a list of desired scopes.
Example #1:
::
wallet = client.wallet.extra_values.get("wallet")
entries = get_wallet_entries(wallet, "oauth2", resource_server="identifiers.globus.org")
:return: a list of oauth2 credentials associated with the resource server `identifiers.globus.org`.
Example #2:
::
entries = get_wallet_entries(wallet, "oauth2", credential_source="https://auth.globus.org")
:return: a list of oauth2 credentials obtained from `auth.globus.org`.
Example #3:
::
entries = get_wallet_entries(
wallet,
"oauth2",
credential_source="https://auth.globus.org",
scopes=["https://auth.globus.org/scopes/identifiers.globus.org/create_update")
:return: a list of oauth2 credentials obtained from `auth.globus.org` with the requested scope.
.. note::
Eventually, we may support wallets with multiple credential types (at the same time) for talking
to a variety of remote servers, at which point the implementation will probably become a lot more
generalized (with registered wallet providers, etc.).
"""
if wallet is None:
return []
Expand Down
8 changes: 8 additions & 0 deletions docs/api/deriva.core.utils.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ deriva.core.utils.version\_utils module
:undoc-members:
:show-inheritance:

deriva.core.utils.webauthn\_utils module
----------------------------------------

.. automodule:: deriva.core.utils.webauthn_utils
:members:
:undoc-members:
:show-inheritance:


Module contents
---------------
Expand Down
29 changes: 11 additions & 18 deletions docs/api/deriva.transfer.download.processors.rst
Original file line number Diff line number Diff line change
@@ -1,29 +1,22 @@
deriva.transfer.download.processors package
===========================================

Submodules
----------

deriva.transfer.download.processors.bag\_fetch\_download\_processor module
--------------------------------------------------------------------------
Subpackages
-----------

.. automodule:: deriva.transfer.download.processors.bag_fetch_download_processor
:members:
:undoc-members:
:show-inheritance:
.. toctree::

deriva.transfer.download.processors.base\_download\_processor module
--------------------------------------------------------------------
deriva.transfer.download.processors.postprocess
deriva.transfer.download.processors.query
deriva.transfer.download.processors.transform

.. automodule:: deriva.transfer.download.processors.base_download_processor
:members:
:undoc-members:
:show-inheritance:
Submodules
----------

deriva.transfer.download.processors.file\_download\_processor module
--------------------------------------------------------------------
deriva.transfer.download.processors.base\_processor module
----------------------------------------------------------

.. automodule:: deriva.transfer.download.processors.file_download_processor
.. automodule:: deriva.transfer.download.processors.base_processor
:members:
:undoc-members:
:show-inheritance:
Expand Down
Loading

0 comments on commit 24f2231

Please sign in to comment.