Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
- Fixed fields with missing support/queryable
- Fixed some docstring formatting

Co-authored-by: Casper Welzel Andersen <43357585+CasperWA@users.noreply.github.com>
  • Loading branch information
ml-evs and CasperWA committed Sep 9, 2020
1 parent e0c3336 commit fa6b682
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions optimade/models/references.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,8 @@ class ReferenceResource(EntryResource):
- The entry of type <type> and ID <id> MUST be returned in response to a request for `/<type>/<id>` under the versioned base URL.
- **Example**: `"structures"`""",
regex="^references$",
support=SupportLevel.MUST,
queryable=SupportLevel.MUST,
)
attributes: ReferenceResourceAttributes

Expand Down
6 changes: 6 additions & 0 deletions optimade/models/structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,8 @@ class StructureResourceAttributes(EntryResourceAttributes):
- **Query examples**:
- Match only structures with exactly 3 periodic dimensions: `nperiodic_dimensions=3`
- Match all structures with 2 or fewer periodic dimensions: `nperiodic_dimensions<=2`""",
support=SupportLevel.SHOULD,
queryable=SupportLevel.MUST,
)

lattice_vectors: conlist(
Expand Down Expand Up @@ -592,6 +594,8 @@ class StructureResourceAttributes(EntryResourceAttributes):
- **Examples**:
- `["Ti","O2"]` indicates that the first site is hosting a species labeled `"Ti"` and the second a species labeled `"O2"`.
- `["Ac", "Ac", "Ag", "Ir"]` indicating the first two sites contains the `"Ac"` species, while the third and fourth sites contain the `"Ag"` and `"Ir"` species, respectively.""",
support=SupportLevel.SHOULD,
queryable=SupportLevel.OPTIONAL,
)

assemblies: Optional[List[Assembly]] = OptimadeField(
Expand Down Expand Up @@ -920,6 +924,8 @@ class StructureResource(EntryResource):
- **Examples**:
- `"structures"`""",
regex="^structures$",
support=SupportLevel.MUST,
queryable=SupportLevel.MUST,
)

attributes: StructureResourceAttributes
6 changes: 3 additions & 3 deletions optimade/models/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ def StrictField(
- Emits a warning when no description is provided.
Raises:
RuntimeError: if a Field is created with an unexpected key.
RuntimeError: If a `Field` is created with an unexpected key.
Returns:
the pydantic field
The pydantic `Field`.
"""

Expand Down Expand Up @@ -84,7 +84,7 @@ def OptimadeField(
unit: a string describing the unit of the field.
Returns:
the pydantic field with extra validation provided by :func:`StrictField`.
The pydantic field with extra validation provided by [`StrictField`][optimade.models.utils.StrictField].
"""

Expand Down

0 comments on commit fa6b682

Please sign in to comment.