Skip to content

Commit 9c018b5

Browse files
Documentation update (#181)
* fix for issue #175 * clear most docstrings reference warnings * update more docstrings * suppress ref warnings --------- Co-authored-by: Jon Walker <[email protected]>
1 parent ae0639e commit 9c018b5

31 files changed

+431
-379
lines changed

doc/conf.py

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,23 +44,32 @@
4444
"sphinx.ext.autodoc",
4545
"sphinx.ext.autosummary",
4646
"sphinx.ext.viewcode",
47-
"numpydoc", # "sphinx.ext.napoleon",
47+
"sphinx.ext.napoleon",
4848
"sphinx.ext.intersphinx",
4949
"sphinx.ext.todo",
5050
]
5151

5252
intersphinx_mapping = {
53-
"python": ("https://docs.python.org/3", None),
53+
"python": ("https://docs.python.org/3/", None),
54+
"pandas": ("https://pandas.pydata.org/docs/", None),
55+
"sklearn": ("https://scikit-learn.org/stable/", None),
56+
"numpy": ("https://numpy.org/doc/stable/", None),
5457
"swat": ("https://sassoftware.github.io/python-swat/", None),
5558
"pytest": ("https://docs.pytest.org/en/latest/", None),
5659
"betamax": ("https://betamax.readthedocs.io/en/latest/", None),
57-
"requests": ("https://2.python-requests.org/en/master/", None),
58-
"tox": ("https://tox.readthedocs.io/en/latest/", None),
59-
"flake8": ("http://flake8.pycqa.org/en/latest/", None),
60+
"requests": ("https://requests.readthedocs.io/en/latest/", None),
61+
"tox": ("https://tox.wiki/en/latest/", None),
62+
"flake8": ("https://flake8.pycqa.org/en/latest/", None),
6063
}
6164

6265
autosummary_generate = True
6366

67+
# Napoleon settings
68+
napoleon_google_docstring = False
69+
napoleon_numpy_docstring = True
70+
napoleon_use_ivar = True
71+
napoleon_use_rtype = False
72+
6473
todo_include_todos = True
6574

6675
todo_emit_warnings = True
@@ -92,6 +101,17 @@
92101
# The name of the Pygments (syntax highlighting) style to use.
93102
pygments_style = "sphinx"
94103

104+
# Suppress warnings 'py:class reference target not found: <type>'
105+
nitpicky = True
106+
nitpick_ignore = [
107+
('py:class','optional'),
108+
('py:class','json.encoder.JSONEncoder'), # I don't understand why it can't find it
109+
('py:class','Response'),
110+
('py:class','Request'),
111+
('py:class','_io.BytesIO'),
112+
('py:class','sasctl.utils.pymas.ds2.Ds2Variable'), # not sure what is wrong
113+
('py:class','sasctl._services.service.Service') # should the Service class be documented?
114+
]
95115

96116
# -- Options for HTML output -------------------------------------------------
97117

doc/index.rst

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ sasctl
44

55
Version |version|
66

7-
.. toctree::
8-
:maxdepth: 3
9-
:hidden: true
10-
11-
index
127

138
Introduction
149
------------
@@ -313,7 +308,7 @@ Logging
313308
+++++++
314309

315310
All logging is handled through the built-in :mod:`logging` module with standard module-level loggers. The one exception
316-
to this is :class:`.Session` request/response logging. Sessions contain a :attr:`~sasctl.core.Session.message_log` which is exclusively used
311+
to this is :class:`.Session` request/response logging. Sessions contain a `message_log` which is exclusively used
317312
to record requests and responses made through the session. Message recording can be configured on a per-session basis
318313
by updating this logger, or the ``sasctl.core.session`` logger can be configured to control all message recording by all sessions.
319314

@@ -497,7 +492,7 @@ Python versions.
497492

498493
Useful Tox Commands
499494
+++++++++++++++++++
500-
:mod:`tox` is used to automate common development tasks such as testing, linting, and building documentation.
495+
:mod:`tox` is used to automate common development tasks such as testing, linting, and building documentation.
501496
Running :program:`tox` from the project root directory will automatically build virtual environments for all Python interpreters
502497
found on the system and then install the required packages necessary to perform a given task. The simplest way to run Tox is:
503498

src/sasctl/_services/cas_management.py

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@ def check_keys(valid_keys: list, input_keys: list, parameters: str):
2929
String describing the type of parameters
3030
that are being tested.
3131
32-
Returns
33-
-------
34-
raises ValueError if input_keys are not valid
32+
Raises
33+
------
34+
ValueError
35+
if input_keys are not valid
3536
"""
3637
if not all(key in valid_keys for key in input_keys):
3738
raise ValueError(
@@ -55,10 +56,12 @@ def check_required_key(
5556
String describing the type of parameters
5657
that are being tested.
5758
58-
Returns
59-
-------
60-
raises ValueError if required_key is not present.
61-
raises TypeError if required_key is neither a list or a string.
59+
Raises
60+
------
61+
ValueError
62+
if required_key is not present.
63+
TypeError
64+
if required_key is neither a list or a string.
6265
"""
6366
if isinstance(required_key, str):
6467
if required_key not in input_keys:
@@ -93,7 +96,7 @@ def list_sessions(cls, query_params: dict = None, server: str = None):
9396
Returns a collection of sessions available on the CAS server.
9497
9598
Parameters
96-
------
99+
----------
97100
query_params : dict, optional
98101
Query parameters.
99102
Valid keys are `start`, `limit`, `filter`,
@@ -129,7 +132,7 @@ def create_session(cls, properties: dict, server: str = None):
129132
"""Creates a new session on the CAS server.
130133
131134
Parameters
132-
------
135+
----------
133136
properties : dict
134137
Properties of the session.
135138
Valid keys are `authenticationType` (required),
@@ -164,7 +167,7 @@ def delete_session(
164167
"""Terminates a session on the CAS server.
165168
166169
Parameters
167-
------
170+
----------
168171
sess_id : str
169172
A string indicating the Session id.
170173
server : str
@@ -225,7 +228,7 @@ def get_caslib(cls, name: str, server: str = None):
225228
226229
Returns
227230
-------
228-
RestObj
231+
RestObj or None
229232
230233
"""
231234
server = server or DEFAULT_SERVER
@@ -278,7 +281,7 @@ def get_table(cls, name: str, caslib: Union[str, dict] = None, server: str = Non
278281
279282
Returns
280283
-------
281-
RestObj
284+
RestObj or None
282285
283286
"""
284287
caslib = caslib or DEFAULT_CASLIB
@@ -309,7 +312,7 @@ def upload_file(
309312
310313
Parameters
311314
----------
312-
file : str or file-like object
315+
file : str or typing.TextIO
313316
File containing data to upload or path to the file.
314317
name : str
315318
Name of the table to create
@@ -321,7 +324,8 @@ def upload_file(
321324
header : bool, optional
322325
Whether the first row of data contains column headers. Defaults to
323326
True.
324-
format_ : {"csv", "xls", "xlsx", "sas7bdat", "sashdat"}, optional
327+
format_ : str, optional
328+
Choose from {"csv", "xls", "xlsx", "sas7bdat", "sashdat"}.
325329
File of input `file`. Not required if format can be discerned from
326330
the file path.
327331
detail : dict, optional
@@ -637,6 +641,11 @@ def del_table(
637641
Returns
638642
-------
639643
RestObj
644+
645+
Raises
646+
------
647+
ValueError
648+
If `query_params` is empty
640649
"""
641650

642651
server = server or DEFAULT_SERVER

src/sasctl/_services/concepts.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def assign_concepts(
3737
3838
Parameters
3939
----------
40-
documents : str or dict or list_like:
40+
documents : str or dict or list
4141
Documents to analyze. May be either the URI to a CAS table where the
4242
documents are currently stored, or an iterable of strings containing
4343
the documents' text.
@@ -55,8 +55,9 @@ def assign_concepts(
5555
model
5656
output_postfix : str, optional
5757
Text to be added to the end of all output table names.
58-
match_type : {'all', 'longest', 'best'}, optional
59-
Type of matches to return. Defaults to 'all'.
58+
match_type : str, optional
59+
Choose from ``{'all', 'longest', 'best'}``.
60+
Type of matches to return. Defaults to 'all'.
6061
enable_facts : bool, optional
6162
Whether to enable facts in the results. Defaults to False.
6263
language : str, optional
@@ -71,8 +72,8 @@ def assign_concepts(
7172
7273
See Also
7374
--------
74-
cas_management.get_caslib
75-
cas_management.get_table
75+
.cas_management.CASManagement.get_caslib
76+
.cas_management.CASManagement.get_table
7677
7778
"""
7879
if documents is None:

src/sasctl/_services/data_sources.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ def table_uri(cls, table):
227227
228228
Parameters
229229
----------
230-
table : dict or CASTable
230+
table : dict or swat.cas.table.CASTable
231231
232232
Returns
233233
-------

src/sasctl/_services/files.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ def create_file(cls, file, folder=None, filename=None, expiration=None):
4141
4242
Parameters
4343
----------
44-
file : str, pathlib.Path, or file_like
44+
file : str, pathlib.Path, or typing.BinaryIO
4545
Path to the file to upload or a file-like object.
4646
folder : str or dict, optional
47-
Name, or, or folder information as returned by :func:`.get_folder`.
47+
Name or folder information as returned by :meth:`.get_folder`.
4848
filename : str, optional
4949
Name to assign to the uploaded file. Defaults to the filename if `file` is a path, otherwise required.
50-
expiration : datetime, optional
50+
expiration : datetime.datetime, optional
5151
A timestamp that indicates when to expire the file. Defaults to no expiration.
5252
5353
Returns
@@ -97,7 +97,8 @@ def get_file_content(cls, file):
9797
9898
Returns
9999
-------
100-
content
100+
str
101+
content
101102
102103
"""
103104
file = cls.get_file(file)

src/sasctl/_services/folders.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,12 @@ def get_folder(cls, folder, refresh=False):
7171
----------
7272
folder : str or dict
7373
May be one of:
74-
- folder name
75-
- folder ID
76-
- folder path
77-
- folder delegate string
78-
- dictionary representation of the folder
74+
75+
- folder name
76+
- folder ID
77+
- folder path
78+
- folder delegate string
79+
- dictionary representation of the folder
7980
refresh : bool, optional
8081
Obtain an updated copy of the folder.
8182

src/sasctl/_services/microanalytic_score.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,12 @@ def execute_module_step(cls, module, step, return_dict=True, **kwargs):
102102
return_dict : bool, optional
103103
Whether the results should be returned as a dictionary instead
104104
of a tuple
105-
kwargs : any
105+
**kwargs
106106
Passed as arguments to the module step
107107
108108
Returns
109109
-------
110-
any
110+
Any
111111
Results of the step execution. Returned as a dictionary if
112112
`return_dict` is True, otherwise returned as a tuple if more
113113
than one value is returned, otherwise the single value.
@@ -180,8 +180,10 @@ def create_module(
180180
name : str
181181
description : str
182182
source : str
183-
language : str { 'python', 'ds2' }
184-
scope : str { 'public', 'private' }
183+
language : str
184+
Choose from ``{'python','ds2'}``
185+
scope : str
186+
Choose from ``{'public','private'}``
185187
186188
Returns
187189
-------

src/sasctl/_services/model_management.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -448,16 +448,16 @@ def create_custom_kpi(
448448
model : str or dict
449449
The name or id of the model, or a dictionary representation of the model.
450450
project : str or dict
451-
The name or id of the project, or a dictionary representation of
452-
the project.
451+
The name or id of the project, or a dictionary representation of
452+
the project.
453453
timeLabel : str or list
454454
Label associated with the dataset used within the performance definition.
455455
kpiName : str or list
456456
Name of the custom KPI.
457457
kpiValue : int or float or list
458458
Value of the custom KPI.
459-
timeSK : int or list, by default None
460-
Indicator for the MM_STD_KPI table to denote performance task order.
459+
timeSK : int or list
460+
Default is None. Indicator for the MM_STD_KPI table to denote performance task order.
461461
"""
462462
from .model_repository import ModelRepository
463463

src/sasctl/_services/model_publish.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,8 @@ def create_destination(
230230
----------
231231
name : str
232232
Name of the publishing destination.
233-
type_ : {'cas', 'mas', 'hadoop', 'teradata'}
233+
type_ : str
234+
Choose from ``{'cas', 'mas', 'hadoop', 'teradata'}``
234235
Type of publishing definition being created
235236
cas_server : str, optional
236237
Name of the CAS server. Defaults to 'cas-shared-default'.

0 commit comments

Comments
 (0)