Skip to content

Commit 1508f24

Browse files
committed
Add docstrings checking
1 parent ae62307 commit 1508f24

File tree

13 files changed

+191
-232
lines changed

13 files changed

+191
-232
lines changed

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def __getattr__(cls, name):
6161
]
6262

6363
autodoc_member_order = 'bysource'
64-
autoclass_content = 'both'
64+
autoclass_content = 'class'
6565

6666
# Add any paths that contain templates here, relative to this directory.
6767
templates_path = ['_templates']

stagpy/__main__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""The stagpy module is callable"""
1+
"""The stagpy module is callable."""
22

33
import importlib
44
import signal
@@ -9,7 +9,7 @@
99

1010

1111
def main():
12-
"""StagPy entry point"""
12+
"""Implement StagPy entry point."""
1313
if not DEBUG:
1414
signal.signal(signal.SIGINT, sigint_handler)
1515
warnings.simplefilter('ignore')

stagpy/_step.py

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323

2424

2525
class _Geometry:
26-
2726
"""Geometry information.
2827
2928
It is deduced from the information in the header of binary field files
@@ -101,7 +100,7 @@ def __init__(self, header, par):
101100
self._curv_meshes = (t_mesh, p_mesh, r_mesh)
102101

103102
def _init_shape(self):
104-
"""Determine shape of geometry"""
103+
"""Determine shape of geometry."""
105104
shape = self._par['geometry']['shape'].lower()
106105
aspect = self._header['aspect']
107106
if self.rcmb is not None and self.rcmb >= 0:
@@ -178,7 +177,6 @@ def __getattr__(self, attr):
178177

179178

180179
class _Fields(Mapping):
181-
182180
"""Fields data structure.
183181
184182
The :attr:`Step.fields` attribute is an instance of this class.
@@ -308,7 +306,6 @@ def geom(self):
308306

309307

310308
class _Tracers:
311-
312309
"""Tracers data structure.
313310
314311
The :attr:`Step.tracers` attribute is an instance of this class.
@@ -349,7 +346,6 @@ def __iter__(self):
349346

350347

351348
class Step:
352-
353349
"""Time step data structure.
354350
355351
Elements of :class:`_Steps` and :class:`_Snaps` instances are all
@@ -369,27 +365,25 @@ class Step:
369365
>>> assert(sdat.snaps[n].isnap == n)
370366
>>> assert(sdat.steps[n].geom is sdat.steps[n].fields.geom)
371367
>>> assert(sdat.snaps[n] is sdat.snaps[n].fields.step)
368+
369+
Args:
370+
istep (int): the index of the time step that the instance
371+
represents.
372+
sdat (:class:`~stagpy.stagyydata.StagyyData`): the StagyyData
373+
instance owning the :class:`Step` instance.
374+
375+
Attributes:
376+
istep (int): the index of the time step that the instance
377+
represents.
378+
sdat (:class:`~stagpy.stagyydata.StagyyData`): the StagyyData
379+
instance owning the :class:`Step` instance.
380+
fields (:class:`_Fields`): fields available at this time step.
381+
sfields (:class:`_Fields`): surface fields available at this time
382+
step.
383+
tracers (:class:`_Tracers`): tracers available at this time step.
372384
"""
373385

374386
def __init__(self, istep, sdat):
375-
"""Initialization of instances:
376-
377-
Args:
378-
istep (int): the index of the time step that the instance
379-
represents.
380-
sdat (:class:`~stagpy.stagyydata.StagyyData`): the StagyyData
381-
instance owning the :class:`Step` instance.
382-
383-
Attributes:
384-
istep (int): the index of the time step that the instance
385-
represents.
386-
sdat (:class:`~stagpy.stagyydata.StagyyData`): the StagyyData
387-
instance owning the :class:`Step` instance.
388-
fields (:class:`_Fields`): fields available at this time step.
389-
sfields (:class:`_Fields`): surface fields available at this time
390-
step.
391-
tracers (:class:`_Tracers`): tracers available at this time step.
392-
"""
393387
self.istep = istep
394388
self.sdat = sdat
395389
self.fields = _Fields(self, phyvars.FIELD, phyvars.FIELD_EXTRA,
@@ -451,7 +445,6 @@ def isnap(self):
451445

452446

453447
class EmptyStep(Step):
454-
455448
"""Dummy step object for nonexistent snaps.
456449
457450
This class inherits from :class:`Step`, but its :meth:`__getattribute__`

stagpy/commands.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def info_cmd():
5454

5555

5656
def _pretty_print(key_val, sep=': ', min_col_width=39, text_width=None):
57-
"""Print a iterable of key/values
57+
"""Print a iterable of key/values.
5858
5959
Args:
6060
key_val (list of (str, str)): the pairs of section names and text.
@@ -96,7 +96,7 @@ def _pretty_print(key_val, sep=': ', min_col_width=39, text_width=None):
9696

9797

9898
def _layout(dict_vars, dict_vars_extra):
99-
"""Print nicely [(var, description)] from phyvars"""
99+
"""Print nicely [(var, description)] from phyvars."""
100100
desc = [(v, m.description) for v, m in dict_vars.items()]
101101
desc.extend((v, baredoc(m.description))
102102
for v, m in dict_vars_extra.items())

0 commit comments

Comments
 (0)