ffcx.options¶
Functions
|
Return (a copy of) the merged option values for FFCX. |
- class ffcx.options.Path(*args, **kwargs)[source]¶
Bases:
PurePath
PurePath subclass that can make system calls.
Path represents a filesystem path but unlike PurePath, also offers methods to do system calls on path objects. Depending on your system, instantiating a Path will return either a PosixPath or a WindowsPath object. You can also instantiate a PosixPath or WindowsPath directly, but cannot instantiate a WindowsPath on a POSIX system or vice versa.
Construct a PurePath from one or several strings and or existing PurePath objects. The strings and path objects are combined so as to yield a canonicalized path, which is incorporated into the new PurePath object.
- absolute()[source]¶
Return an absolute version of this path. This function works even if the path doesn’t point to anything.
No normalization is done, i.e. all ‘.’ and ‘..’ will be kept along. Use resolve() to get the canonical path to a file.
- classmethod cwd()[source]¶
Return a new path pointing to the current working directory (as returned by os.getcwd()).
- expanduser()[source]¶
Return a new path with expanded ~ and ~user constructs (as returned by os.path.expanduser)
- glob(pattern)[source]¶
Iterate over this subtree and yield all existing files (of any kind, including directories) matching the given relative pattern.
- classmethod home()[source]¶
Return a new path pointing to the user’s home directory (as returned by os.path.expanduser(‘~’)).
- is_file()[source]¶
Whether this path is a regular file (also True for symlinks pointing to regular files).
- iterdir()[source]¶
Iterate over the files in this directory. Does not yield any result for the special paths ‘.’ and ‘..’.
- lchmod(mode)[source]¶
Like chmod(), except if the path points to a symlink, the symlink’s permissions are changed, rather than its target’s.
- link_to(target)[source]¶
Make the target path a hard link pointing to this path.
Note this function does not make this path a hard link to target, despite the implication of the function and argument names. The order of arguments (target, link) is the reverse of Path.symlink_to, but matches that of os.link.
- lstat()[source]¶
Like stat(), except if the path points to a symlink, the symlink’s status information is returned, rather than its target’s.
- open(mode='r', buffering=-1, encoding=None, errors=None, newline=None)[source]¶
Open the file pointed by this path and return a file object, as the built-in open() function does.
- read_text(encoding=None, errors=None)[source]¶
Open the file in text mode, read it, and close the file.
- rename(target)[source]¶
Rename this path to the target path.
The target path may be absolute or relative. Relative paths are interpreted relative to the current working directory, not the directory of the Path object.
Returns the new Path instance pointing to the target path.
- replace(target)[source]¶
Rename this path to the target path, overwriting if that path exists.
The target path may be absolute or relative. Relative paths are interpreted relative to the current working directory, not the directory of the Path object.
Returns the new Path instance pointing to the target path.
- resolve(strict=False)[source]¶
Make the path absolute, resolving all symlinks on the way and also normalizing it (for example turning slashes into backslashes under Windows).
- rglob(pattern)[source]¶
Recursively yield all existing files (of any kind, including directories) matching the given relative pattern, anywhere in this subtree.
- samefile(other_path)[source]¶
Return whether other_path is the same or not as this file (as returned by os.path.samefile()).
- symlink_to(target, target_is_directory=False)[source]¶
Make this path a symlink pointing to the target path. Note the order of arguments (link, target) is the reverse of os.symlink.
- touch(mode=438, exist_ok=True)[source]¶
Create this file with the given access mode, if it doesn’t exist.
- ffcx.options.get_options(priority_options: dict | None = None) dict [source]¶
Return (a copy of) the merged option values for FFCX.
Options¶
- priority_options:
take priority over all other option values (see notes)
- returns:
dict
- rtype:
merged option values
Notes
This function sets the log level from the merged option values prior to returning.
The ffcx_options.json files are cached on the first call. Subsequent calls to this function use this cache.
Priority ordering of options from highest to lowest is:
priority_options (API and command line options)
$PWD/ffcx_options.json (local options)
$XDG_CONFIG_HOME/ffcx/ffcx_options.json (user options)
FFCX_DEFAULT_OPTIONS in ffcx.options
XDG_CONFIG_HOME is ~/.config/ if the environment variable is not set.
Example ffcx_options.json file:
{ “assume_aligned”: 32, “epsilon”: 1e-7 }