TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/alex-ber/AlexBerUtils/llms.txt
Use this file to discover all available pages before exploring further.
props module provides two independent utilities: Properties, a Python port of java.util.Properties for reading and writing .properties files, and lazyproperty, a descriptor that evaluates a method only on first access and caches the result.
Properties
A Python replacement forjava.util.Properties. Reads files that use key=value, key:value, or whitespace-separated key value syntax. Supports # comments, backslash line continuation, and ${} placeholder substitution.
__init__
Optional initial property dictionary. Currently unused — pass
None or omit.load(stream)
Parses a .properties file from an open readable stream and populates the internal property dictionary.
Any readable stream (file object,
io.StringIO, etc.).IOError — propagated from the underlying stream read.
getProperty(key)
Returns the value for the given key, or an empty string if the key is not found.
Property key to look up.
str — the property value, or '' if absent.
setProperty(key, value)
Sets a property. Both key and value must be strings.
Property key.
Property value.
TypeError — if either argument is not a string.
propertyNames()
Returns an iterator over all property keys.
Returns: KeysView[str]
list(out=sys.stdout)
Prints all properties to a stream in key=value format.
Output stream. Defaults to
sys.stdout.store(out, header="")
Writes all properties to a writable file stream with a timestamp header.
Writable file stream. Must be opened in write mode (
'w').Optional comment header written as the first line. Defaults to
"".ValueError — if the stream is not opened in write mode. IOError — propagated from the stream.
as_dict()
Returns the internal properties as a plain OrderedDict.
Returns: OrderedDict[str, str]
Dict-style access
Properties supports direct dictionary-style get and set via __getitem__ and __setitem__:
lazyproperty
Decorator like@property, but the decorated method is evaluated only on the first access. The result is cached in the instance’s __dict__ and returned directly on every subsequent access without re-evaluation.
lazyproperty is a data descriptor — it lives in the class __dict__ and its __get__ is invoked on every attribute access, ensuring the cache in the instance __dict__ is used after the first evaluation.
__init__(fget)
The method to decorate. Must accept only
self as a parameter (same constraint as @property). The method’s __name__, __doc__, and other attributes are copied to the descriptor via functools.update_wrapper.Immutability
lazyproperty is read-only. Attempting to assign to a lazyproperty attribute unconditionally raises AttributeError.
IllegalArgumentException
Exception raised internally byProperties when a .properties file contains a malformed line.
| Attribute | Type | Description |
|---|---|---|
lineno | int | Line number in the source file where the error occurred. |
msg | str | Human-readable error description. |
