src.cmd_types.formats
1from dataclasses import dataclass 2 3@dataclass 4class Attribute: 5 """ 6 Attribute dataclass to navigate in some object 7 """ 8 attr_name: str 9 """Name of attribute. Can separate with '.' for more deep attributes""" 10 11 attr_getters: list[str | int] 12 """Getters for attribute. Now only supported getters for the deepest attribute. Calls '__getitem__' methods of the latest attribute""" 13 14@dataclass 15class ErrFormat: 16 """ 17 Formatter for error string 18 """ 19 format_str: str 20 """String to format that will support '.format' method""" 21 22 attrs: list[Attribute] 23 """List of attributes to format string with""" 24 25 errcode: int = 1 26 """Error code"""
@dataclass
class
Attribute:
4@dataclass 5class Attribute: 6 """ 7 Attribute dataclass to navigate in some object 8 """ 9 attr_name: str 10 """Name of attribute. Can separate with '.' for more deep attributes""" 11 12 attr_getters: list[str | int] 13 """Getters for attribute. Now only supported getters for the deepest attribute. Calls '__getitem__' methods of the latest attribute"""
Attribute dataclass to navigate in some object
@dataclass
class
ErrFormat:
15@dataclass 16class ErrFormat: 17 """ 18 Formatter for error string 19 """ 20 format_str: str 21 """String to format that will support '.format' method""" 22 23 attrs: list[Attribute] 24 """List of attributes to format string with""" 25 26 errcode: int = 1 27 """Error code"""
Formatter for error string
ErrFormat( format_str: str, attrs: list[Attribute], errcode: int = 1)