Skip to content

Commit 35e9aaf

Browse files
authored
onnx model info and doc fixes (#198)
Adds basic extraction of model info from ONNX models. Removes issue that caused sporadic failures of pagination tests. Fixes missing service documentation.
1 parent 9c018b5 commit 35e9aaf

19 files changed

+289
-52
lines changed

doc/api/services/report_images.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ sasctl.services.report_images
33

44
.. automodule:: sasctl._services.report_images
55
:members:
6-
:undoc-members:
6+
:undoc-members:
7+
:show-inheritance:

doc/api/services/reports.rst

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ sasctl.services.reports
44
.. automodule:: sasctl._services.reports
55
:members:
66
:undoc-members:
7+
:show-inheritance:

doc/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
('py:class','Response'),
110110
('py:class','Request'),
111111
('py:class','_io.BytesIO'),
112-
('py:class','sasctl.utils.pymas.ds2.Ds2Variable'), # not sure what is wrong
112+
('py:class','sasctl.utils.pymas.ds2.Ds2Variable'), # not sure what is wrong
113113
('py:class','sasctl._services.service.Service') # should the Service class be documented?
114114
]
115115

src/sasctl/_services/cas_management.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def check_keys(valid_keys: list, input_keys: list, parameters: str):
3131
3232
Raises
3333
------
34-
ValueError
34+
ValueError
3535
if input_keys are not valid
3636
"""
3737
if not all(key in valid_keys for key in input_keys):

src/sasctl/_services/concepts.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def assign_concepts(
5656
output_postfix : str, optional
5757
Text to be added to the end of all output table names.
5858
match_type : str, optional
59-
Choose from ``{'all', 'longest', 'best'}``.
59+
Choose from ``{'all', 'longest', 'best'}``.
6060
Type of matches to return. Defaults to 'all'.
6161
enable_facts : bool, optional
6262
Whether to enable facts in the results. Defaults to False.

src/sasctl/_services/data_sources.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def get_provider(cls, provider, refresh=False):
4040
A dictionary containing the provider attributes or None.
4141
4242
Notes
43-
-------
43+
-----
4444
If `provider` is a complete representation of the provider it will be
4545
returned unless `refresh` is set. This prevents unnecessary REST calls
4646
when data is already available on the client.

src/sasctl/_services/folders.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def get_folder(cls, folder, refresh=False):
7171
----------
7272
folder : str or dict
7373
May be one of:
74-
74+
7575
- folder name
7676
- folder ID
7777
- folder path

src/sasctl/_services/service.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ def get_item(cls, item, refresh=False):
229229
A dictionary containing the {item} attributes or None.
230230
231231
Notes
232-
-------
232+
-----
233233
If `item` is a complete representation of the {item} it will be
234234
returned unless `refresh` is set. This prevents unnecessary REST
235235
calls when data is already available on the client.

src/sasctl/core.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -1254,7 +1254,7 @@ def _request_token_with_oauth(
12541254
"""Request a token from the SAS SASLogon service.
12551255
12561256
Supports four different flows:
1257-
1257+
12581258
- authenticate with a username & password and receive a token
12591259
- authenticate with a client id & secret and receive a token
12601260
- provide an authorization code and receive a token
@@ -1531,6 +1531,13 @@ def __init__(self, obj, session=None, threads=4):
15311531
# Store the current items to iterate over
15321532
self._obj = obj
15331533

1534+
def __enter__(self):
1535+
return self
1536+
1537+
def __exit__(self, exc_type, exc_val, exc_tb):
1538+
if self._pool is not None:
1539+
self._pool.shutdown(wait=False)
1540+
15341541
def __next__(self):
15351542
if self._pool is None:
15361543
self._pool = concurrent.futures.ThreadPoolExecutor(
@@ -1778,7 +1785,7 @@ class VersionInfo:
17781785
Release cadence for Viya 4. Should be one of 'stable' or 'LTS'.
17791786
release : str, optional
17801787
Release number for Viya 4. Two formats are currently possible:
1781-
1788+
17821789
- YYYY.R.U where R is the LTS release number in YYYY and U is the updates since R
17831790
- YYYY.MM where MM is the month of the release.
17841791
@@ -2028,6 +2035,7 @@ def request(verb, path, session=None, format="auto", **kwargs):
20282035
20292036
Returns
20302037
-------
2038+
str, bytes, or requests.Response
20312039
20322040
"""
20332041
session = session or current_session()
@@ -2111,6 +2119,7 @@ def request_link(obj, rel, **kwargs):
21112119
21122120
Returns
21132121
-------
2122+
RestObj
21142123
21152124
"""
21162125
link = get_link(obj, rel)
@@ -2359,7 +2368,7 @@ def platform_version():
23592368
23602369
Returns
23612370
-------
2362-
str
2371+
str
23632372
SAS Viya version number '3.5' or '4.0'
23642373
23652374
"""

src/sasctl/pzmm/import_model.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ def import_model(
306306
**kwargs
307307
Other keyword arguments are passed to the following function:
308308
:meth:`.ScoreCode.write_score_code`
309-
309+
310310
311311
Returns
312312
-------

src/sasctl/pzmm/pickle_model.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def pickle_trained_model(
3737
object.
3838
3939
The following files are generated by this function:
40-
40+
4141
* '\*.pickle'
4242
Binary pickle file containing a trained model.
4343
* '\*.mojo'

src/sasctl/pzmm/write_json_files.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
import ast
66
import importlib
77
import json
8-
# import math #not used
8+
9+
# import math #not used
910
import pickle
1011
import pickletools
1112
import sys

src/sasctl/pzmm/zip_model.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def zip_files(
7171
"""
7272

7373
if isinstance(model_files, dict):
74-
buffer = io.BytesIO()
74+
buffer = BytesIO()
7575

7676
with zipfile.ZipFile(buffer, "w", zipfile.ZIP_DEFLATED, False) as archive:
7777
for file_name, data in model_files.items():

0 commit comments

Comments
 (0)