Skip to content

Commit

Permalink
docs: adapt docstring example to match real CFF structure
Browse files Browse the repository at this point in the history
  • Loading branch information
rmfranken committed Dec 16, 2024
1 parent 43fdf51 commit 343defd
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions gimie/parsers/cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,21 +122,23 @@ def doi_to_url(doi: str) -> str:
def get_cff_doi(data: bytes) -> Optional[str]:
"""Given a CFF file, returns the DOI, if any.
Parameters
----------
data
The cff file body as bytes.
Returns
-------
str, optional
doi formatted as a valid url
Examples
--------
>>> get_cff_doi(bytes("doi: 10.5281/zenodo.1234", encoding="utf8"))
'https://doi.org/10.5281/zenodo.1234'
>>> get_cff_doi(bytes("abc: def", encoding="utf8"))
Parameters
----------
data
The cff file body as bytes.
Returns
-------
str, optional
doi formatted as a valid url
Examples
--------
>>> get_cff_doi(bytes("identifiers:
- type: doi
value: 10.5281/zenodo.1234", encoding="utf8"))
'https://doi.org/10.5281/zenodo.1234'
>>> get_cff_doi(bytes("abc: def", encoding="utf8"))
"""

Expand Down

0 comments on commit 343defd

Please sign in to comment.