pymt.utils package¶
Submodules¶
pymt.utils.prefix module¶
- pymt.utils.prefix.names_with_prefix(names, prefix)[source]¶
Find names that begin with a common prefix. In this case, names are a series
.
-separated words, much like module names.Returns a
list
of all names that begin with prefix. The order of matched names is maintained.>>> names_with_prefix(['foo.bar', 'foobar.baz'], 'foo') ['foo.bar'] >>> names_with_prefix(['foo.bar', 'foo.bar', 'foo.foo'], 'foo') ['foo.bar', 'foo.foo']
pymt.utils.utils module¶
Module contents¶
- pymt.utils.err(message: Any | None = None, file: IO | None = None, nl: bool = True, *, err: bool = True, color: bool | None = None, **styles: Any) None ¶
This function combines
echo()
andstyle()
into one call. As such the following two calls are the same:click.secho('Hello World!', fg='green') click.echo(click.style('Hello World!', fg='green'))
All keyword arguments are forwarded to the underlying functions depending on which one they go with.
Non-string types will be converted to
str
. However,bytes
are passed directly toecho()
without applying style. If you want to style bytes that represent text, callbytes.decode()
first.Changed in version 8.0: A non-string
message
is converted to a string. Bytes are passed through without style applied.New in version 2.0.
- pymt.utils.out(message: Any | None = None, file: IO | None = None, nl: bool = True, *, err: bool = True, color: bool | None = None, **styles: Any) None ¶
This function combines
echo()
andstyle()
into one call. As such the following two calls are the same:click.secho('Hello World!', fg='green') click.echo(click.style('Hello World!', fg='green'))
All keyword arguments are forwarded to the underlying functions depending on which one they go with.
Non-string types will be converted to
str
. However,bytes
are passed directly toecho()
without applying style. If you want to style bytes that represent text, callbytes.decode()
first.Changed in version 8.0: A non-string
message
is converted to a string. Bytes are passed through without style applied.New in version 2.0.