From 6befa79e27fb2f69abba218355e42f84b0c4f714 Mon Sep 17 00:00:00 2001 From: Matthew Evans Date: Fri, 11 Jun 2021 11:22:38 +0100 Subject: [PATCH] Fix code sample indentation --- optimade.rst | 282 +++++++++++++++++++++++++-------------------------- 1 file changed, 141 insertions(+), 141 deletions(-) diff --git a/optimade.rst b/optimade.rst index 7089cc47b..7507ac8e0 100644 --- a/optimade.rst +++ b/optimade.rst @@ -516,11 +516,11 @@ Every response SHOULD contain the following fields, and MUST contain at least :f .. code:: jsonc { - "id": "dep_chemical_formula_01", - "type": "warning", - "code": "_exmpl_dep_chemical_formula", - "title": "Deprecation Warning", - "detail": "chemical_formula is deprecated, use instead chemical_formula_hill" + "id": "dep_chemical_formula_01", + "type": "warning", + "code": "_exmpl_dep_chemical_formula", + "title": "Deprecation Warning", + "detail": "chemical_formula is deprecated, use instead chemical_formula_hill" } **Note**: warning :field:`id`\ s MUST NOT be trusted to identify the exceptional situations (i.e., they are not error codes, use instead the field :field:`code` for this. @@ -535,33 +535,33 @@ Every response SHOULD contain the following fields, and MUST contain at least :f .. code:: jsonc { - "meta": { - "query": { - "representation": "/structures/?filter=a=1 AND b=2", - }, - "api_version": "1.0.0", - "schema": "http://schema.optimade.org/openapi/v1.0/optimade.json", - "time_stamp": "2007-04-05T14:30:20Z", - "data_returned": 10, - "data_available": 10, - "more_data_available": false, - "provider": { - "name": "Example provider", - "description": "Provider used for examples, not to be assigned to a real database", - "prefix": "exmpl", - "homepage": "http://example.com" - }, - "implementation": { - "name": "exmpl-optimade", - "version": "0.1.0", - "source_url": "http://git.example.com/exmpl-optimade", - "maintainer": { - "email": "admin@example.com" - }, - "issue_tracker": "http://tracker.example.com/exmpl-optimade" - } - } - // ... + "meta": { + "query": { + "representation": "/structures/?filter=a=1 AND b=2", + }, + "api_version": "1.0.0", + "schema": "http://schema.optimade.org/openapi/v1.0/optimade.json", + "time_stamp": "2007-04-05T14:30:20Z", + "data_returned": 10, + "data_available": 10, + "more_data_available": false, + "provider": { + "name": "Example provider", + "description": "Provider used for examples, not to be assigned to a real database", + "prefix": "exmpl", + "homepage": "http://example.com" + }, + "implementation": { + "name": "exmpl-optimade", + "version": "0.1.0", + "source_url": "http://git.example.com/exmpl-optimade", + "maintainer": { + "email": "admin@example.com" + }, + "issue_tracker": "http://tracker.example.com/exmpl-optimade" + } + } + // ... } - **data**: The schema of this value varies by endpoint, it can be either a *single* `JSON API resource object `__ or a *list* of JSON API resource objects. @@ -631,44 +631,44 @@ An example of a full response: { "links": { - "next": null, - "base_url": { - "href": "http://example.com/optimade", - "meta": { - "_exmpl_db_version": "3.2.1" - } - } + "next": null, + "base_url": { + "href": "http://example.com/optimade", + "meta": { + "_exmpl_db_version": "3.2.1" + } + } }, "meta": { - "query": { - "representation": "/structures?filter=a=1 AND b=2" - }, - "api_version": "1.0.0", - "time_stamp": "2007-04-05T14:30:20Z", - "data_returned": 10, - "data_available": 10, - "last_id": "xy10", - "more_data_available": false, - "provider": { - "name": "Example provider", - "description": "Provider used for examples, not to be assigned to a real database", - "prefix": "exmpl", - "homepage": { - "href": "http://example.com", - "meta": { - "_exmpl_title": "This is an example site" - } - } - }, - "response_message": "OK" - // + "query": { + "representation": "/structures?filter=a=1 AND b=2" + }, + "api_version": "1.0.0", + "time_stamp": "2007-04-05T14:30:20Z", + "data_returned": 10, + "data_available": 10, + "last_id": "xy10", + "more_data_available": false, + "provider": { + "name": "Example provider", + "description": "Provider used for examples, not to be assigned to a real database", + "prefix": "exmpl", + "homepage": { + "href": "http://example.com", + "meta": { + "_exmpl_title": "This is an example site" + } + } + }, + "response_message": "OK" + // }, - "data": [ - // ... - ], - "included": [ - // ... - ], + "data": [ + // ... + ], + "included": [ + // ... + ], } HTTP Response Status Codes @@ -900,27 +900,27 @@ Example: { "data": [ - { - "type": "structures", - "id": "example.db:structs:0001", - "attributes": { - "chemical_formula_descriptive": "Es2 O3", - "url": "http://example.db/structs/0001", - "immutable_id": "http://example.db/structs/0001@123", - "last_modified": "2007-04-05T14:30:20Z" - } - }, - { - "type": "structures", - "id": "example.db:structs:1234", - "attributes": { - "chemical_formula_descriptive": "Es2", - "url": "http://example.db/structs/1234", - "immutable_id": "http://example.db/structs/1234@123", - "last_modified": "2007-04-07T12:02:20Z" - } - } - // ... + { + "type": "structures", + "id": "example.db:structs:0001", + "attributes": { + "chemical_formula_descriptive": "Es2 O3", + "url": "http://example.db/structs/0001", + "immutable_id": "http://example.db/structs/0001@123", + "last_modified": "2007-04-05T14:30:20Z" + } + }, + { + "type": "structures", + "id": "example.db:structs:1234", + "attributes": { + "chemical_formula_descriptive": "Es2", + "url": "http://example.db/structs/1234", + "immutable_id": "http://example.db/structs/1234@123", + "last_modified": "2007-04-07T12:02:20Z" + } + } + // ... ] // ... } @@ -961,20 +961,20 @@ Example: { "data": { - "type": "structures", - "id": "example.db:structs:1234", - "attributes": { - "chemical_formula_descriptive": "Es2", - "url": "http://example.db/structs/1234", - "immutable_id": "http://example.db/structs/1234@123", - "last_modified": "2007-04-07T12:02:20Z" - } + "type": "structures", + "id": "example.db:structs:1234", + "attributes": { + "chemical_formula_descriptive": "Es2", + "url": "http://example.db/structs/1234", + "immutable_id": "http://example.db/structs/1234@123", + "last_modified": "2007-04-07T12:02:20Z" + } }, "meta": { - "query": { - "representation": "/structures/example.db:structs:1234?" - } - // ... + "query": { + "representation": "/structures/example.db:structs:1234?" + } + // ... } // ... } @@ -2165,7 +2165,7 @@ species Elements denoting vacancies MUST have masses equal to 0. - **original\_name**: OPTIONAL. Can be any valid Unicode string, and SHOULD contain (if specified) the name of the species that is used internally in the source database. Note: With regards to "source database", we refer to the immediate source being queried via the OPTIMADE API implementation. - The main use of this field is for source databases that use species names, containing characters that are not allowed (see description of the list property `species_at_sites`_). + The main use of this field is for source databases that use species names, containing characters that are not allowed (see description of the list property `species_at_sites`_). - For systems that have only species formed by a single chemical symbol, and that have at most one species per chemical symbol, SHOULD use the chemical symbol as species name (e.g., :val:`"Ti"` for titanium, :val:`"O"` for oxygen, etc.) However, note that this is OPTIONAL, and client implementations MUST NOT assume that the key corresponds to a chemical symbol, nor assume that if the species name is a valid chemical symbol, that it represents a species with that chemical symbol. @@ -2233,40 +2233,40 @@ assemblies .. code:: jsonc - { - "cartesian_site_positions": [[0,0,0]], - "species_at_sites": ["SiGe-vac"], - "species": [ - { - "name": "SiGe-vac", - "chemical_symbols": ["Si", "Ge", "vacancy"], - "concentration": [0.3, 0.5, 0.2] - } - ] - // ... - } + { + "cartesian_site_positions": [[0,0,0]], + "species_at_sites": ["SiGe-vac"], + "species": [ + { + "name": "SiGe-vac", + "chemical_symbols": ["Si", "Ge", "vacancy"], + "concentration": [0.3, 0.5, 0.2] + } + ] + // ... + } - Using multiple species and the assemblies: .. code:: jsonc - { - "cartesian_site_positions": [ [0,0,0], [0,0,0], [0,0,0] ], - "species_at_sites": ["Si", "Ge", "vac"], - "species": [ - { "name": "Si", "chemical_symbols": ["Si"], "concentration": [1.0] }, - { "name": "Ge", "chemical_symbols": ["Ge"], "concentration": [1.0] }, - { "name": "vac", "chemical_symbols": ["vacancy"], "concentration": [1.0] } - ], - "assemblies": [ - { - "sites_in_groups": [ [0], [1], [2] ], - "group_probabilities": [0.3, 0.5, 0.2] - } - ] - // ... - } + { + "cartesian_site_positions": [ [0,0,0], [0,0,0], [0,0,0] ], + "species_at_sites": ["Si", "Ge", "vac"], + "species": [ + { "name": "Si", "chemical_symbols": ["Si"], "concentration": [1.0] }, + { "name": "Ge", "chemical_symbols": ["Ge"], "concentration": [1.0] }, + { "name": "vac", "chemical_symbols": ["vacancy"], "concentration": [1.0] } + ], + "assemblies": [ + { + "sites_in_groups": [ [0], [1], [2] ], + "group_probabilities": [0.3, 0.5, 0.2] + } + ] + // ... + } - It is up to the database provider to decide which representation to use, typically depending on the internal format in which the structure is stored. However, given a structure identified by a unique ID, the API implementation MUST always provide the same representation for it. @@ -2275,18 +2275,18 @@ assemblies .. code:: jsonc - { - "assemblies": [ - { - "sites_in_groups": [ [0], [1] ], - "group_probabilities": [0.2, 0.8], - }, - { - "sites_in_groups": [ [2], [3] ], - "group_probabilities": [0.3, 0.7] - } - ] - } + { + "assemblies": [ + { + "sites_in_groups": [ [0], [1] ], + "group_probabilities": [0.2, 0.8], + }, + { + "sites_in_groups": [ [2], [3] ], + "group_probabilities": [0.3, 0.7] + } + ] + } Site 0 is present with a probability of 20 % and site 1 with a probability of 80 %. These two sites are correlated (either site 0 or 1 is present). Similarly, site 2 is present with a probability of 30 % and site 3 with a probability of 70 %. These two sites are correlated (either site 2 or 3 is present).