Skip to content

xqute.utils

module

xqute.utils

Utilities for xqute

Classes
  • DuplicateFilter Filter instances are used to perform arbitrary filtering of LogRecords.</>
Functions
  • a_mkdir(path, *args, **kwargs) Make a directory asyncly</>
  • a_read_text(path) (str) Read the text from a file asyncly</>
  • a_write_text(path, content) Write the text to a file asyncly</>
  • asyncify(func) (Callable) Turn a sync function into a Coroutine, can be used as a decorator</>
function

xqute.utils.a_read_text(path)

Read the text from a file asyncly

Parameters
  • path (PathLike) The path of the file
Returns (str)

The content of the file

function

xqute.utils.a_write_text(path, content)

Write the text to a file asyncly

Parameters
  • path (PathLike) The path to the file
  • content (str) The content to be written to the file
function

xqute.utils.asyncify(func)

Turn a sync function into a Coroutine, can be used as a decorator

Parameters
  • func (Callable) The sync function
Returns (Callable)

The Coroutine

function

xqute.utils.a_mkdir(path, *args, **kwargs)

Make a directory asyncly

Parameters
  • path (PathLike) The path to the directory to be made
  • *args args for Path(path).mkdir(...)
  • **kwargs kwargs for Path(path).mkdir(...)
class

xqute.utils.DuplicateFilter()

Bases
logging.Filter

Filter instances are used to perform arbitrary filtering of LogRecords.

Loggers and Handlers can optionally use Filter instances to filter records as desired. The base filter class only allows events which are below a certain point in the logger hierarchy. For example, a filter initialized with "A.B" will allow events logged by loggers "A.B", "A.B.C", "A.B.C.D", "A.B.D" etc. but not "A.BB", "B.A.B" etc. If initialized with the empty string, all events are passed.

Methods
  • filter(record) Determine if the specified record is to be logged.</>
method

filter(record)

Determine if the specified record is to be logged.

Returns True if the record should be logged, or False otherwise. If deemed appropriate, the record may be modified in-place.