sas.system package¶
Subpackages¶
- sas.system.config package
- Submodules
- sas.system.config.config module
- sas.system.config.config_meta module
ConfigBaseConfigBase.__annotations__ConfigBase.__dict__ConfigBase.__doc__ConfigBase.__init__()ConfigBase.__module__ConfigBase.__setattr__()ConfigBase.__weakref__ConfigBase._generate_schema()ConfigBase._state_copy()ConfigBase.config_filename()ConfigBase.defaultsConfigBase.finalise()ConfigBase.load()ConfigBase.load_from_file_object()ConfigBase.override_with_defaults()ConfigBase.save()ConfigBase.save_to_file_object()ConfigBase.update()ConfigBase.validate()
ConfigLockedConfigMetaMalformedFile
- sas.system.config.schema_elements module
- Module contents
Submodules¶
sas.system.console module¶
Windows console binding for SasView
- class sas.system.console.Singleton¶
Bases:
typeMetaclass 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:
objectWindows 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: bool = False) Path¶
DEPRECATED Do not use this function to create new files.
v6.1.0: This is only used to move files from previous version locations to new locations
- sas.system.user.copy_old_files_to_new_location()¶
Only run at app startup A check to see if files in the old user locations exist and move them if they haven’t already been moved.
- sas.system.user.copy_resources() None¶
Find the original documentation location (source and built)
The source and built docs for SasView could be in a number of locations. Search for them in the following locations: 1. installed within the module 2. unpacked next to the source 3. in legacy paths from older installation approaches
Installed versions are prioritised over uninstalled versions to make sure that inconveniently named local directories don’t cause issues.
- sas.system.user.create_user_files_if_needed() None¶
Create user documentation directories if necessary and copy built docs there.
- sas.system.user.find_plugins_dir() str¶
A helper function that returns a string representation of the plugins directory as defined by sas.system.user.
- sas.system.user.get_app_dir(create_if_nonexistent: bool = True) Path¶
The directory where the os-specific app data is stored.
Returns the directory as a pathlib.Path object, creating the directory if it does not already exist.
- sas.system.user.get_app_dir_versioned(create_if_nonexistent: bool = True) Path¶
The directory where the version-dependent, os-specific app data is stored.
Returns the directory as a pathlib.Path object, creating the directory if it does not already exist.
- sas.system.user.get_cache_dir(create_if_nonexistent: bool = True) Path¶
The directory where the os-specific cache is stored.
Returns the directory as a pathlib.Path object, creating the directory if it does not already exist.
- sas.system.user.get_config_dir(create_if_nonexistent: bool = True) Path¶
The directory where os-specific configurations are stored.
Returns the directory as a pathlib.Path object, creating the directory if it does not already exist.
- sas.system.user.get_dir_and_create_if_needed(path: Path | str | PathLike[str], create_if_nonexistent: bool = True) Path¶
Returns the requested directory as a pathlib.Path object, creating the directory if it does not already exist.
- sas.system.user.get_log_dir(create_if_nonexistent: bool = True) Path¶
The directory where the os-specific logs are stored.
Returns the directory as a pathlib.Path object, creating the directory if it does not already exist.
- sas.system.user.get_plugin_dir(create_if_nonexistent: bool = True) Path¶
The directory where the os-specific cache for plugin models is stored.
Returns the directory as a pathlib.Path object, creating the directory if it does not already exist.
- sas.system.user.is_copy_successful() bool¶
Obtain the source and build output from within the installed sas module
- sas.system.user.locate_unpacked_resources() tuple[Path, Path]¶
Locate the resources unpacked on disk
- sas.system.user.module_copytree(module: str, src: Path | str | PathLike[str], dest: Path | str | PathLike[str]) None¶
Copy the tree from a module to the specified directory
module: name of the Python module (the “anchor” for importlib.resources) src: source name of the resource inside the module dest: destination directory for the resources to be copied into; will be
created if it doesn’t 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