diff --git a/docs/_static/collapsible_container.css b/docs/_static/collapsible_container.css deleted file mode 100644 index 52bb284b..00000000 --- a/docs/_static/collapsible_container.css +++ /dev/null @@ -1,19 +0,0 @@ -/* Adapted from: https://github.com/plone/training/blob/master/_static/custom.css */ - -.toggle .admonition-title { - display: block; - clear: both; - cursor: pointer; -} - -.toggle .admonition-title:after { - content: " ▶"; -} - -.toggle .admonition-title.open:after { - content: " ▼"; -} - -.toggle p:last-child { - margin-bottom: 0; -} diff --git a/docs/_static/collapsible_container.js b/docs/_static/collapsible_container.js deleted file mode 100644 index 75042d68..00000000 --- a/docs/_static/collapsible_container.js +++ /dev/null @@ -1,10 +0,0 @@ -// Taken from: https://github.com/plone/training/blob/master/_templates/page.html - -$(document).ready(function() { - $(".toggle > *").hide(); - $(".toggle .admonition-title").show(); - $(".toggle .admonition-title").click(function() { - $(this).parent().children().not(".admonition-title").toggle(400); - $(this).parent().children(".admonition-title").toggleClass("open"); - }) -}); diff --git a/docs/conf.py b/docs/conf.py index a115d7bb..44037db9 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -159,9 +159,7 @@ html_static_path = ['_static'] html_favicon = join('_static', 'favicon.ico') html_logo = join('_static', 'pyinaturalist_logo.png') -html_js_files = ['collapsible_container.js'] html_css_files = [ - 'collapsible_container.css', 'colors.css', 'table.css', 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css', diff --git a/docs/examples.md b/docs/examples.md index 4df43555..1cdd9697 100644 --- a/docs/examples.md +++ b/docs/examples.md @@ -44,8 +44,7 @@ TODO: Can't generate thumbnails for Altair visualizations :end-line: 6 ``` -:::{admonition} Example code -:class: toggle +:::{dropdown} Example code ```{literalinclude} ../examples/observations_to_gpx.py :lines: 1,8- @@ -59,8 +58,7 @@ TODO: Can't generate thumbnails for Altair visualizations :end-line: 17 ``` -:::{admonition} Example code -:class: toggle +:::{dropdown} Example code ```{literalinclude} ../examples/observation_photo_metadata.py :lines: 1,19- diff --git a/docs/user_guide/advanced.md b/docs/user_guide/advanced.md index 34cdf48d..83e75a43 100644 --- a/docs/user_guide/advanced.md +++ b/docs/user_guide/advanced.md @@ -30,8 +30,8 @@ you will need to use an access token. 3. Pass that access token to any API request function that uses it ### Creating an Application -:::{admonition} Why do I need to create an application? -:class: toggle, tip +:::{dropdown} Why do I need to create an application? +:icon: info iNaturalist uses OAuth2, which provides several different methods (or "flows") to access the site. For example, on the [login page](https://www.inaturalist.org/login), you have the option of logging diff --git a/docs/user_guide/general.md b/docs/user_guide/general.md index 36586f9c..07ce7048 100644 --- a/docs/user_guide/general.md +++ b/docs/user_guide/general.md @@ -28,8 +28,8 @@ See {ref}`contributing` for details on setup for local development. ::: :::: -:::{admonition} Python version compatibility -:class: toggle, tip +:::{dropdown} Python version compatibility +:icon: info pyinaturalist currently requires **python 3.7+**. If you need to use an older version of python, here are the last compatible versions of pyinaturalist: @@ -101,8 +101,8 @@ iNaturalist.org: ``` And here is what that same observation looks like in JSON: -:::{admonition} Observation response JSON -:class: toggle +:::{dropdown} Observation response JSON +:icon: code-square ```{literalinclude} ../sample_data/get_observation_2.json ``` ::: diff --git a/pyinaturalist/v0/observation_fields.py b/pyinaturalist/v0/observation_fields.py index 9ac53f2b..c84f34d8 100644 --- a/pyinaturalist/v0/observation_fields.py +++ b/pyinaturalist/v0/observation_fields.py @@ -24,8 +24,9 @@ def get_observation_fields(**params) -> JsonResponse: >>> from pprint import pprint >>> pprint({r['id']: r['name'] for r in response}) - .. admonition:: Example Response - :class: toggle + .. dropdown:: Example Response + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/get_observation_fields.py @@ -75,8 +76,9 @@ def put_observation_field_values( ... access_token=token, ... ) - .. admonition:: Example Response - :class: toggle + .. dropdown:: Example Response + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/post_put_observation_field_value.json :language: javascript diff --git a/pyinaturalist/v0/observations.py b/pyinaturalist/v0/observations.py index 14ab22b3..4208ca1c 100644 --- a/pyinaturalist/v0/observations.py +++ b/pyinaturalist/v0/observations.py @@ -35,37 +35,43 @@ def get_observations(**params) -> Union[List, str]: >>> get_observations(id=45414404, converters='atom') - .. admonition:: Example Response (atom) - :class: toggle + .. dropdown:: Example Response (atom) + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/get_observations.atom :language: xml - .. admonition:: Example Response (csv) - :class: toggle + .. dropdown:: Example Response (csv) + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/get_observations.csv - .. admonition:: Example Response (dwc) - :class: toggle + .. dropdown:: Example Response (dwc) + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/get_observations.dwc :language: xml - .. admonition:: Example Response (json) - :class: toggle + .. dropdown:: Example Response (json) + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/get_observations.json :language: json - .. admonition:: Example Response (kml) - :class: toggle + .. dropdown:: Example Response (kml) + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/get_observations.kml :language: xml - .. admonition:: Example Response (widget) - :class: toggle + .. dropdown:: Example Response (widget) + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/get_observations.js :language: javascript @@ -106,14 +112,16 @@ def create_observation(**params) -> ListResponse: >>> observation_fields={297: 1}, # 297 is the obs. field ID for 'Number of individuals' >>> ) - .. admonition:: Example Response - :class: toggle + .. dropdown:: Example Response + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/create_observation_result.json :language: javascript - .. admonition:: Example Response (failure) - :class: toggle + .. dropdown:: Example Response (failure) + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/create_observation_fail.json :language: javascript @@ -171,8 +179,9 @@ def update_observation(observation_id: int, **params) -> ListResponse: >>> description='updated description!', >>> ) - .. admonition:: Example Response - :class: toggle + .. dropdown:: Example Response + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/update_observation_result.json :language: javascript @@ -218,8 +227,9 @@ def upload_photos(observation_id: int, photos: MultiFile, **params) -> ListRespo >>> access_token=token, >>> ) - .. admonition:: Example Response - :class: toggle + .. dropdown:: Example Response + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/post_observation_photos_list.json :language: javascript @@ -261,8 +271,9 @@ def upload_sounds(observation_id: int, sounds: MultiFile, **params) -> ListRespo >>> token = get_access_token() >>> upload_sounds(1234, '~/observations/2020_09_01_14003156.mp3', access_token=token) - .. admonition:: Example Response - :class: toggle + .. dropdown:: Example Response + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/post_observation_sounds_list.json :language: javascript diff --git a/pyinaturalist/v1/controlled_terms.py b/pyinaturalist/v1/controlled_terms.py index 779b2967..84d4636f 100644 --- a/pyinaturalist/v1/controlled_terms.py +++ b/pyinaturalist/v1/controlled_terms.py @@ -21,8 +21,9 @@ def get_controlled_terms(taxon_id: Optional[int] = None, **params) -> JsonRespon 4: Pupa ... - .. admonition:: Example Response - :class: toggle + .. dropdown:: Example Response + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/get_controlled_terms.json :language: JSON @@ -53,8 +54,9 @@ def get_controlled_terms_for_taxon(taxon_id: int, **params) -> JsonResponse: 4: Pupa ... - .. admonition:: Example Response - :class: toggle + .. dropdown:: Example Response + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/get_controlled_terms_for_taxon.json :language: JSON diff --git a/pyinaturalist/v1/identifications.py b/pyinaturalist/v1/identifications.py index 84c2d14c..fc9bee35 100644 --- a/pyinaturalist/v1/identifications.py +++ b/pyinaturalist/v1/identifications.py @@ -17,8 +17,9 @@ def get_identifications_by_id(identification_id: MultiInt, **params) -> JsonResp Example: >>> get_identifications_by_id(155554373) - .. admonition:: Example Response - :class: toggle + .. dropdown:: Example Response + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/get_identifications.py @@ -52,8 +53,9 @@ def get_identifications(**params) -> JsonResponse: [147500725] Species: 1163860 (improving) added on 2020-12-24 23:52:30+00:00 by jkcook ... - .. admonition:: Example Response - :class: toggle + .. dropdown:: Example Response + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/get_identifications.py diff --git a/pyinaturalist/v1/messages.py b/pyinaturalist/v1/messages.py index b6b0d724..ed2e17df 100644 --- a/pyinaturalist/v1/messages.py +++ b/pyinaturalist/v1/messages.py @@ -22,8 +22,9 @@ def get_message_by_id(message_id: MultiInt, **params) -> JsonResponse: >>> response = get_messages(123456) >>> pprint(response) - .. admonition:: Example Response - :class: toggle + .. dropdown:: Example Response + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/get_messages.json @@ -49,8 +50,9 @@ def get_messages(**params) -> JsonResponse: >>> response = get_messages() >>> pprint(response) - .. admonition:: Example Response - :class: toggle + .. dropdown:: Example Response + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/get_messages.json diff --git a/pyinaturalist/v1/observation_fields.py b/pyinaturalist/v1/observation_fields.py index 2a3f0691..2db9ee21 100644 --- a/pyinaturalist/v1/observation_fields.py +++ b/pyinaturalist/v1/observation_fields.py @@ -31,8 +31,9 @@ def set_observation_field( ... access_token=token, ... ) - .. admonition:: Example Response - :class: toggle + .. dropdown:: Example Response + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/post_put_observation_field_value.json :language: javascript diff --git a/pyinaturalist/v1/observations.py b/pyinaturalist/v1/observations.py index af93c29d..d6322ba9 100644 --- a/pyinaturalist/v1/observations.py +++ b/pyinaturalist/v1/observations.py @@ -72,9 +72,9 @@ def get_observations(**params) -> JsonResponse: >>> response = get_observations(observation_fields={'Species count': 2}) - - .. admonition:: Example Response - :class: toggle + .. dropdown:: Example Response + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/get_observations_node.py @@ -111,8 +111,9 @@ def get_observations_by_id( >>> response = get_observations_by_id(16227955) >>> response = get_observations_by_id([16227955, 16227956]) - .. admonition:: Example Response - :class: toggle + .. dropdown:: Example Response + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/get_observations_by_id.py @@ -160,18 +161,21 @@ def get_observation_histogram(**params) -> HistogramResponse: >>> place_id=8057, >>> ) - .. admonition:: Example Response (observations per month of year) - :class: toggle + .. dropdown:: Example Response (observations per month of year) + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/get_observation_histogram_month_of_year.py - .. admonition:: Example Response (observations per month) - :class: toggle + .. dropdown:: Example Response (observations per month) + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/get_observation_histogram_month.py - .. admonition:: Example Response (observations per day) - :class: toggle + .. dropdown:: Example Response (observations per day) + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/get_observation_histogram_day.py @@ -200,8 +204,9 @@ def get_observation_identifiers(**params) -> JsonResponse: [691216 ] jbrown252 (James Brown) [3959037 ] tnsparkleberry - .. admonition:: Example Response - :class: toggle + .. dropdown:: Example Response + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/get_observation_identifiers_ex_results.json :language: JSON @@ -234,8 +239,9 @@ def get_observation_observers(**params) -> JsonResponse: [5813 ] fluffberger (Fluff Berger) - .. admonition:: Example Response - :class: toggle + .. dropdown:: Example Response + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/get_observation_observers_ex_results.json :language: JSON @@ -266,8 +272,9 @@ def get_observation_species_counts(**params) -> JsonResponse: [55727] Species: Cymbalaria muralis (Ivy-leaved toadflax): 3 ... - .. admonition:: Example Response - :class: toggle + .. dropdown:: Example Response + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/get_observation_species_counts.py @@ -294,8 +301,9 @@ def get_observation_popular_field_values(**params) -> JsonResponse: ... species_name='Danaus plexippus', place_id=24, ... ) - .. admonition:: Example Response - :class: toggle + .. dropdown:: Example Response + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/get_observation_popular_field_values.py @@ -322,8 +330,9 @@ def get_observation_taxonomy(**params) -> JsonResponse: Example: >>> response = get_observation_taxonomy(user_id='my_username') - .. admonition:: Example Response - :class: toggle + .. dropdown:: Example Response + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/get_observation_taxonomy.json :language: JSON @@ -348,8 +357,9 @@ def get_observation_taxon_summary(observation_id: int, **params) -> JsonResponse Example: >>> response = get_observation_taxon_summary(7849808) - .. admonition:: Example Response - :class: toggle + .. dropdown:: Example Response + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/get_observation_taxon_summary.py @@ -388,8 +398,9 @@ def create_observation(**params) -> JsonResponse: ... description='Updated description!', ... ) - .. admonition:: Example Response - :class: toggle + .. dropdown:: Example Response + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/create_observation_v1.json :language: JSON @@ -428,8 +439,9 @@ def update_observation(observation_id: int, **params) -> ListResponse: >>> description='updated description!', >>> ) - .. admonition:: Example Response - :class: toggle + .. dropdown:: Example Response + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/update_observation_result.json :language: javascript @@ -483,8 +495,9 @@ def upload( ... access_token=token, ... ) - .. admonition:: Example Response - :class: toggle + .. dropdown:: Example Response + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/upload_photos_and_sounds.json :language: JSON diff --git a/pyinaturalist/v1/places.py b/pyinaturalist/v1/places.py index a146722a..84434fb1 100644 --- a/pyinaturalist/v1/places.py +++ b/pyinaturalist/v1/places.py @@ -22,8 +22,9 @@ def get_places_by_id(place_id: MultiInt, **params) -> JsonResponse: [89191] Conservation Area Riversdale [67591] Riversdale Beach - .. admonition:: Example Response - :class: toggle + .. dropdown:: Example Response + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/get_places_by_id.py @@ -70,8 +71,9 @@ def get_places_nearby( [97393] Oceania ... - .. admonition:: Example Response - :class: toggle + .. dropdown:: Example Response + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/get_places_nearby.py @@ -103,8 +105,9 @@ def get_places_autocomplete(q: Optional[str] = None, **params) -> JsonResponse: [166186] Irkutsk Oblast - ADD [163077] Irkutsk agglomeration - .. admonition:: Example Response - :class: toggle + .. dropdown:: Example Response + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/get_places_autocomplete.py diff --git a/pyinaturalist/v1/projects.py b/pyinaturalist/v1/projects.py index c9e3047c..0d252541 100644 --- a/pyinaturalist/v1/projects.py +++ b/pyinaturalist/v1/projects.py @@ -46,8 +46,9 @@ def get_projects(**params) -> JsonResponse: [102925 ] Keechelus/Kachess Invasive Plants ... - .. admonition:: Example Response - :class: toggle + .. dropdown:: Example Response + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/get_projects.py @@ -83,8 +84,9 @@ def get_projects_by_id( [8348] Tucson High Native and Invasive Species Inventory [6432] CBWN Invasive Plants - .. admonition:: Example Response - :class: toggle + .. dropdown:: Example Response + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/get_projects_by_id.py @@ -129,8 +131,9 @@ def add_project_observation( Example: >>> add_project_observation(24237, 1234, access_token) - .. admonition:: Example Response - :class: toggle + .. dropdown:: Example Response + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/add_project_observation.json :language: JSON diff --git a/pyinaturalist/v1/search.py b/pyinaturalist/v1/search.py index 7f3ae8c6..f05641a5 100644 --- a/pyinaturalist/v1/search.py +++ b/pyinaturalist/v1/search.py @@ -21,8 +21,9 @@ def search(q: str, **params) -> JsonResponse: [Project] [9978 ] Ohio Dragonfly Survey (Ohio Odonata Survey) [User ] [113886 ] odonatanb (Gilles Belliveau) - .. admonition:: Example Response - :class: toggle + .. dropdown:: Example Response + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/get_search.py diff --git a/pyinaturalist/v1/taxa.py b/pyinaturalist/v1/taxa.py index a88ce366..d6a03108 100644 --- a/pyinaturalist/v1/taxa.py +++ b/pyinaturalist/v1/taxa.py @@ -25,8 +25,9 @@ def get_taxa(**params) -> JsonResponse: [646195] Genus: Vespiodes ... - .. admonition:: Example Response - :class: toggle + .. dropdown:: Example Response + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/get_taxa.json :language: JSON @@ -68,8 +69,9 @@ def get_taxa_by_id( 'wikipedia_summary': 'The Polistinae are eusocial wasps closely related to yellow jackets...', } - .. admonition:: Example Response - :class: toggle + .. dropdown:: Example Response + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/get_taxa_by_id.py @@ -128,13 +130,15 @@ def get_taxa_autocomplete(**params) -> JsonResponse: >>> first_result["matched_term"] "Zygocactus truncatus" # ...Because it matched an older synonym for Schlumbergera - .. admonition:: Example Response - :class: toggle + .. dropdown:: Example Response + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/get_taxa_autocomplete.py - .. admonition:: Example Response (formatted) - :class: toggle + .. dropdown:: Example Response (formatted) + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/get_taxa_autocomplete_minified.py @@ -154,8 +158,9 @@ def get_taxa_map_layers(taxon_id: int, **params) -> JsonResponse: Example: >>> response = get_taxa_map_layers(343248) - .. admonition:: Example Response - :class: toggle + .. dropdown:: Example Response + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/get_taxa_map_layers.json :language: JSON @@ -185,8 +190,9 @@ def get_life_list_metadata( Example: >>> response = get_life_list_metadata(user_id='my_username') - .. admonition:: Example Response - :class: toggle + .. dropdown:: Example Response + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/get_lifelist_metadata.json :language: JSON diff --git a/pyinaturalist/v1/users.py b/pyinaturalist/v1/users.py index b2592a45..995b262a 100644 --- a/pyinaturalist/v1/users.py +++ b/pyinaturalist/v1/users.py @@ -25,8 +25,9 @@ def get_user_by_id(user_id: IntOrStr, **params) -> JsonResponse: >>> pprint(response) [1234] my_username - .. admonition:: Example Response - :class: toggle + .. dropdown:: Example Response + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/get_user_by_id.py @@ -55,8 +56,9 @@ def get_users_autocomplete(q: str, **params) -> JsonResponse: [1234] my_username [12345] my_username_2 - .. admonition:: Example Response - :class: toggle + .. dropdown:: Example Response + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/get_users_autocomplete.py diff --git a/pyinaturalist/v2/observations.py b/pyinaturalist/v2/observations.py index 7e682b88..95ea069d 100644 --- a/pyinaturalist/v2/observations.py +++ b/pyinaturalist/v2/observations.py @@ -66,13 +66,15 @@ def get_observations(**params) -> JsonResponse: >>> response = get_observations(observation_fields={'Species count': 2}) - .. admonition:: Example Response (default/minimal) - :class: toggle + .. dropdown:: Example Response (default/minimal) + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/get_observations_v2_minimal.py - .. admonition:: Example Response (all fields) - :class: toggle + .. dropdown:: Example Response (all fields) + :color: primary + :icon: code-square .. literalinclude:: ../sample_data/get_observations_v2_full.py