SAS Viya. Kevin D. Smith
Чтение книги онлайн.
Читать онлайн книгу SAS Viya - Kevin D. Smith страница 13
NOTE: string action=NULL,
NOTE: specifies the name of the action for which you want help.
The name can be in the form 'actionSetName.actionName' or
just 'actionName'.
NOTE: string actionSet=NULL,
NOTE: specifies the name of the action set for which you
want help. This parameter is ignored if the action
parameter is specified.
NOTE: boolean verbose=true
NOTE: when set to True, provides more detail for each parameter.
Looking at the printed notes, you can see that the help action takes the parameters actionset, action, and verbose. We have previously seen the actionset and action parameters. The verbose parameter is enabled, which means that you will get a full description of all of the parameters of the action. You can suppress the parameter descriptions by specifying verbose=False as follows:
In [7]: out = conn.help(action='help', verbose=False)
NOTE: Information for action 'builtins.help':
NOTE: The following parameters are accepted.
Default values are shown.
NOTE: string action=NULL,
NOTE: string actionSet=NULL,
NOTE: boolean verbose=true
In addition to the Help system that is provided by CAS, the SWAT module also enables you to access the action set and action information using mechanisms supplied by Python and IPython. Python supplies the help function to display information about Python objects. This same function can be used to display information about CAS action sets and actions. We have been using the help action on our CAS object. Let’s see what the Python help function displays.
In [8]: help(conn.help)
Help on builtins.Help in module swat.cas.actions object:
class builtins.Help(CASAction)
| Shows the parameters for an action or lists all available actions
|
| Parameters
| ----------
| action : string, optional
| specifies the name of the action for which you want help.
| The name can be in the form 'actionSetName.actionName' or
| just 'actionName'.
|
| actionset : string, optional
| specifies the name of the action set for which you want help.
| This parameter is ignored if the action parameter is
| specified.
|
| verbose : boolean, optional
| when set to True, provides more detail for each parameter.
| Default: True
|
| Returns
| -------
| Help object
... truncated ...
It gets a little confusing in that code snippet because both the name of the function in Python and the name of the action are the same, but you see that the information displayed by Python’s Help system is essentially the same as what CAS displayed. You can also use the IPython/Jupyter Help system (our preferred method) by following the action name with a question mark.
In [9]: conn.help?
Type: builtins.Help
String form: ?.builtins.Help()
File: swat/cas/actions.py
Definition: ?.help(_self_, action=None,
actionset=None,
verbose=True, **kwargs)
Docstring:
Shows the parameters for an action or lists all available actions
Parameters
----------
action : string, optional
specifies the name of the action for which you want help. The name
can be in the form 'actionSetName.actionName' or just 'actionName.
actionset : string, optional
specifies the name of the action set for which you want help. This
parameter is ignored if the action parameter is specified.
verbose : boolean, optional
when set to True, provides more detail for each parameter.
Default: True
Returns
-------
Help object
... truncated ...
These methods of getting help work both on actions and action sets. For example, we know that there is a builtins action set that the help action belongs to. The CAS object has an attribute that maps to the builtins action set just like the help action. We can display the help for the builtins action set as follows:
In [10]: conn.builtins?
Type: Builtins
String form: <swat.cas.actions.Builtins object at 0x7f7ad35b9048>
File: swat/cas/actions.py
Docstring:
System
Actions
-------
builtins.about : Shows the status of the server
builtins.actionsetinfo