sas.system package¶
Subpackages¶
- sas.system.config package
- Submodules
- sas.system.config.config module
- sas.system.config.config_meta module
ConfigBase
ConfigBase.__annotations__
ConfigBase.__dict__
ConfigBase.__doc__
ConfigBase.__init__()
ConfigBase.__module__
ConfigBase.__setattr__()
ConfigBase.__weakref__
ConfigBase._generate_schema()
ConfigBase._state_copy()
ConfigBase.config_filename()
ConfigBase.defaults
ConfigBase.finalise()
ConfigBase.load()
ConfigBase.load_from_file_object()
ConfigBase.override_with_defaults()
ConfigBase.save()
ConfigBase.save_to_file_object()
ConfigBase.update()
ConfigBase.validate()
ConfigLocked
ConfigMeta
MalformedFile
- sas.system.config.schema_elements module
- Module contents
Submodules¶
sas.system.console module¶
Windows console binding for SasView
- class sas.system.console.Singleton¶
Bases:
type
Metaclass indicating that all object instantiations should return the same instance.
Usage:
class Stateful(metaclass=Singleton): …
The init will only be triggered for the first instance, so you probably shouldn’t parameterize it, or only parameterize it during setup before any other instances are created.
- __annotations__ = {}¶
- __call__(*args, **kwargs)¶
Call self as a function.
- __doc__ = "\n Metaclass indicating that all object instantiations should return the same instance.\n\n Usage:\n\n class Stateful(metaclass=Singleton): ...\n\n The init will only be triggered for the first instance, so you probably shouldn't\n parameterize it, or only parameterize it during setup before any other instances\n are created.\n "¶
- __module__ = 'sas.system.console'¶
- _instances = {}¶
- class sas.system.console.WindowsConsole(*args, **kwargs)¶
Bases:
object
Windows console object.
This only creates the console when you read to it or write from it. This reduces flashing windows when using the app in a pipeline.
This presents as an incomplete standard rw file interface.
Unfortunately it does not regiister as a windows console stdio object so the cpython myreadline code does not call PyOS_InputHook during read. The practical consequence is that pyplot.ion() does not create an interactive plot, and you instead need to call pyplot.pause(0.1) to draw the figure. You can try tracing through myreadline.c to see what we need to do to get sys.stdin recognized as stdin here: https://github.com/python/cpython/blob/main/Parser/myreadline.c
- __dict__ = mappingproxy({'__module__': 'sas.system.console', '__doc__': '\n Windows console object.\n\n This only creates the console when you read to it or write from it. This reduces\n flashing windows when using the app in a pipeline.\n\n This presents as an incomplete standard rw file interface.\n\n Unfortunately it does not regiister as a windows console stdio object so the\n cpython myreadline code does not call PyOS_InputHook during read. The practical\n consequence is that pyplot.ion() does not create an interactive plot, and you\n instead need to call pyplot.pause(0.1) to draw the figure. You can try tracing\n through myreadline.c to see what we need to do to get sys.stdin recognized as\n stdin here: https://github.com/python/cpython/blob/main/Parser/myreadline.c\n ', '__init__': <function WindowsConsole.__init__>, 'close_wait': <function WindowsConsole.close_wait>, '_attach_console': <function WindowsConsole._attach_console>, '_read_fd': <property object>, '_write_fd': <property object>, 'readline': <function WindowsConsole.readline>, 'write': <function WindowsConsole.write>, 'flush': <function WindowsConsole.flush>, 'read': <function WindowsConsole.read>, 'isatty': <function WindowsConsole.isatty>, 'readable': <function WindowsConsole.readable>, 'writeable': <function WindowsConsole.writeable>, 'seekable': <function WindowsConsole.seekable>, 'name': <function WindowsConsole.name>, '__dict__': <attribute '__dict__' of 'WindowsConsole' objects>, '__weakref__': <attribute '__weakref__' of 'WindowsConsole' objects>, '__annotations__': {}})¶
- __doc__ = '\n Windows console object.\n\n This only creates the console when you read to it or write from it. This reduces\n flashing windows when using the app in a pipeline.\n\n This presents as an incomplete standard rw file interface.\n\n Unfortunately it does not regiister as a windows console stdio object so the\n cpython myreadline code does not call PyOS_InputHook during read. The practical\n consequence is that pyplot.ion() does not create an interactive plot, and you\n instead need to call pyplot.pause(0.1) to draw the figure. You can try tracing\n through myreadline.c to see what we need to do to get sys.stdin recognized as\n stdin here: https://github.com/python/cpython/blob/main/Parser/myreadline.c\n '¶
- __init__()¶
- __module__ = 'sas.system.console'¶
- __weakref__¶
list of weak references to the object
- _attach_console()¶
- property _read_fd¶
- property _write_fd¶
- close_wait()¶
Registered with atexit to give users a chance to see the output.
- flush()¶
- isatty()¶
- name()¶
- read(*args, **kwargs)¶
- readable()¶
- readline(*args, **kwargs)¶
- seekable()¶
- write(*args, **kwargs)¶
- writeable()¶
- sas.system.console.attach_windows_console()¶
Attach a console to a windows program that does not normally have one.
Note: Uses a lazy import for win32console so you will to add pywin32 to requirements.txt and tell the installer to include win32.win32console
- sas.system.console.demo()¶
- sas.system.console.setup_console(stderr_as='console')¶
Lazy redirect of stdio to windows console.
Handling of stderr is defined by the caller:
console: create a console for stderr even if stdin/stdout are redirected.
stdout: redirect stderr to whereever stdout is going
null: redirect stderr to the NUL device (untested!!)
none: don’t redirect stderr; instead windows displays an error box with stderr contents
- sas.system.console.setup_console_simple(stderr_to_stdout=True)¶
Simple version of stdio redirection: always open a console, and don’t pause before closing.
sas.system.legal module¶
- class sas.system.legal.Legal¶
Bases:
object
- __dict__ = mappingproxy({'__module__': 'sas.system.legal', '__init__': <function Legal.__init__>, '__dict__': <attribute '__dict__' of 'Legal' objects>, '__weakref__': <attribute '__weakref__' of 'Legal' objects>, '__doc__': None, '__annotations__': {}})¶
- __doc__ = None¶
- __init__()¶
- __module__ = 'sas.system.legal'¶
- __weakref__¶
list of weak references to the object
sas.system.lib module¶
Setup third-party libraries (e.g., qt, sasview, periodictable, bumps)
These functions are used to setup up the GUI and the scripting environment.
- sas.system.lib.reset_sasmodels(sas_opencl)¶
Trigger a reload of all sasmodels calculators using the new value of sas_opencl. The new value will be saved in the sasview configuration file.
- sas.system.lib.setup_qt_env()¶
Setup the Qt environment.
The environment values are set by the user and managed by sasview config.
This function does not import the Qt libraries so it is safe to use from a script.
- sas.system.lib.setup_sasmodels()¶
Initialize sasmodels settings from the sasview configuration.
sas.system.log module¶
- sas.system.log.development()¶
- sas.system.log.print_config(msg='Logger config:')¶
When debugging the logging configuration it is handy to see exactly how it is configured. To do so you will need to pip install the logging_tree package and add log.print_config() at choice points in the code.
- sas.system.log.production()¶
- sas.system.log.setup_logging(level=20)¶
sas.system.user module¶
- sas.system.user.get_user_dir(create_if_nonexistent=True)¶
The directory where the per-user configuration is stored.
Returns ~/.sasview, creating it if it does not already exist.
sas.system.version module¶
sas.system.web module¶
- class sas.system.web.WebLinks¶
Bases:
object
- __dict__ = mappingproxy({'__module__': 'sas.system.web', '__init__': <function WebLinks.__init__>, '__dict__': <attribute '__dict__' of 'WebLinks' objects>, '__weakref__': <attribute '__weakref__' of 'WebLinks' objects>, '__doc__': None, '__annotations__': {}})¶
- __doc__ = None¶
- __init__()¶
- __module__ = 'sas.system.web'¶
- __weakref__¶
list of weak references to the object