Skip to content

Commit

Permalink
fix docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
loriab committed Jul 24, 2024
1 parent 0118e02 commit 65d93b0
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@
"matplotlib": ("https://matplotlib.org/stable/", None),
"qcengine": ("https://molssi.github.io/QCEngine/", None),
"qcfractal": ("https://molssi.github.io/QCFractal/", None),
"nglview": ("https://nglviewer.org/nglview/release/v2.7.7", None),
}

# -- Options for todo extension ----------------------------------------------
Expand Down
4 changes: 4 additions & 0 deletions qcelemental/models/basemodels.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ def _repr(self) -> str:


class ProtoModel(BaseModel):
"""QCSchema extension of pydantic.BaseModel."""

class Config:
allow_mutation: bool = False
extra: str = "forbid"
Expand Down Expand Up @@ -198,6 +200,8 @@ def compare(self, other: Union["ProtoModel", BaseModel], **kwargs) -> bool:

# remove when QCFractal merges `next`
class AutodocBaseSettings(BaseSettings):
"""Old class for pydantic docstring before autodoc-pydantic came about."""

def __init_subclass__(cls) -> None:
cls.__doc__ = AutoPydanticDocGenerator(cls, always_apply=True)

Expand Down
6 changes: 6 additions & 0 deletions qcelemental/models/molecule.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
except ImportError: # Will also trap ModuleNotFoundError
from pydantic import ConstrainedFloat, ConstrainedInt, Field, constr, validator

try:
# purely for docs-build. not required except for Molecule.show()
import nglview
except ModuleNotFoundError:

Check notice

Code scanning / CodeQL

Empty except Note

'except' clause does nothing but pass and there is no explanatory comment.
pass

# molparse imports separated b/c https://github.com/python/mypy/issues/7203
from ..molparse.from_arrays import from_arrays
from ..molparse.from_schema import from_schema
Expand Down
4 changes: 4 additions & 0 deletions qcelemental/models/procedures.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ class QCInputSpecification(ProtoModel):


class OptimizationInput(ProtoModel):
"""QCSchema input directive for geometry optimization."""

id: Optional[str] = None
hash_index: Optional[str] = None
schema_name: constr( # type: ignore
Expand All @@ -96,6 +98,8 @@ def __repr_args__(self) -> "ReprArgs":


class OptimizationResult(OptimizationInput):
"""QCSchema results model for geometry optimization."""

schema_name: constr( # type: ignore
strip_whitespace=True, regex=qcschema_optimization_output_default
) = qcschema_optimization_output_default
Expand Down

0 comments on commit 65d93b0

Please sign in to comment.