tools#

Various tools.

Functions

create_check_meta(file, path[, dev])

Create, update, or read/check metadata. This function creates a group file["meta"][path] and sets the attributes::.

default_chunks(shape)

docstring_append_cli()

Append the docstring with the default CLI help.

docstring_copy(source_function)

Copies the docstring of the given function to another.

path_meta(module, function)

Create a path for metadata.

read_version(file, path)

Read version of this library from file.

Classes

MyFmt(prog[, indent_increment, ...])

Details

depinning_creep_2024.tools.create_check_meta(file: File, path: str, dev: bool = False) None#

Create, update, or read/check metadata. This function creates a group file["meta"][path] and sets the attributes:

"dependencies": The current version of all relevant dependencies.
"compiler": Compiler information.
Parameters
  • file – HDF5 archive.

  • path – Path relative to file["meta"].

  • dev – Allow uncommitted changes.

depinning_creep_2024.tools.default_chunks(shape)#
depinning_creep_2024.tools.docstring_append_cli()#

Append the docstring with the default CLI help. This function is intended to be used as a decorator.

def foo():
    '''This is a foo doc string'''
    ...

@docstring_append_cli
def bar():
    ...
depinning_creep_2024.tools.docstring_copy(source_function)#

Copies the docstring of the given function to another. This function is intended to be used as a decorator.

def foo():
    '''This is a foo doc string'''
    ...

@docstring_copy(foo)
def bar():
    ...
depinning_creep_2024.tools.path_meta(module: str, function: str) str#

Create a path for metadata.

Parameters
  • module – Name of module.

  • function – Name of function.

Returns

“/meta/{stamp}_module={module}_function={function}”

depinning_creep_2024.tools.read_version(file: File, path: str) str#

Read version of this library from file.

Parameters
  • file – HDF5 archive.

  • path – Path in file to read version from, as attribute “dependencies”.

Returns

Version string.

class depinning_creep_2024.tools.MyFmt(prog, indent_increment=2, max_help_position=24, width=None)#