typeddfs._mixins._ini_like_mixin
ο
Mixin for INI, .properties, and TOML.
Module Contentsο
- class typeddfs._mixins._ini_like_mixin._IniLikeMixinο
- classmethod _assert_can_write_properties_class(cls) None ο
- _assert_can_write_properties_instance(self) None ο
- classmethod _properties_files_apply(cls) bool ο
- classmethod _read_properties_like(cls, unescape_keys, unescape_values, comment_chars: Set[str], strip_quotes: bool, path_or_buff, **kwargs) __qualname__ ο
Reads a .properties-like file.
- _to_properties_like(self, escape_keys, escape_values, sep: str, comment_char: str, path_or_buff=None, mode: str = 'w', comment: Union[None, str, Sequence[str]] = None, **kwargs) Optional[str] ο
Writes a .properties-like file.
- classmethod read_ini(cls, path_or_buff, hash_sign: bool = False, strip_quotes: bool = False, **kwargs) __qualname__ ο
Reads an INI file.
Caution
This is provided as a preview. It may have issues and may change.
- Parameters
path_or_buff β Path or buffer
hash_sign β Allow
#
to denote a comment (as well as;
)strip_quotes β Remove quotation marks (ββ or ββ) surrounding the values
kwargs β Passed to
typeddfs.utils.Utils.read()
- classmethod read_properties(cls, path_or_buff, strip_quotes: bool = False, **kwargs) __qualname__ ο
Reads a .properties file. Backslashes, colons, spaces, and equal signs are escaped in keys and values.
Caution
This is provided as a preview. It may have issues and may change. It currently does not support continued lines (ending with an odd number of backslashes).
- Parameters
path_or_buff β Path or buffer
strip_quotes β Remove quotation marks (ββ) surrounding values
kwargs β Passed to
read_csv
; avoid setting
- classmethod read_toml(cls, path_or_buff, aot: Optional[str] = 'row', aot_only: bool = True, **kwargs) __qualname__ ο
Reads a TOML file.
Caution
This is provided as a preview. It may have issues and may change.
- Parameters
path_or_buff β Path or buffer
aot β The name of the array of tables (i.e.
[[ table ]]
) If None, finds the unique outermost TOML key, implyingaot_only
.aot_only β Fail if any outermost keys other than the AOT are found
kwargs β Passed to
Utils.read
- to_ini(self, path_or_buff=None, comment: Union[None, str, Sequence[str]] = None, mode: str = 'w', **kwargs) __qualname__ ο
Writes an INI file.
Caution
This is provided as a preview. It may have issues and may change.
- Parameters
path_or_buff β Path or buffer
comment β Comment line(s) to add at the top of the document
mode β βwβ (write) or βaβ (append)
kwargs β Passed to
typeddfs.utils.Utils.write()
- to_properties(self, path_or_buff=None, mode: str = 'w', *, comment: Union[None, str, Sequence[str]] = None, **kwargs) Optional[str] ο
Writes a .properties file. Backslashes, colons, spaces, and equal signs are escaped in keys. Backslashes are escaped in values. The separator is always
=
.Caution
This is provided as a preview. It may have issues and may change.
- Parameters
path_or_buff β Path or buffer
comment β Comment line(s) to add at the top of the document
mode β Write (βwβ) or append (βaβ)
kwargs β Passed to
typeddfs.utils.Utils.write()
- Returns
The string data if
path_or_buff
is a buffer; None if it is a file
- to_toml(self, path_or_buff=None, aot: str = 'row', comment: Union[None, str, Sequence[str]] = None, mode: str = 'w', **kwargs) __qualname__ ο
Writes a TOML file.
Caution
This is provided as a preview. It may have issues and may change.
- Parameters
path_or_buff β Path or buffer
aot β The name of the array of tables (i.e.
[[ table ]]
)comment β Comment line(s) to add at the top of the document
mode β βwβ (write) or βaβ (append)
kwargs β Passed to
typeddfs.utils.Utils.write()