encommon.parse package#
Subpackages#
Submodules#
encommon.parse.jinja2 module#
Functions and routines associated with Enasis Network Common Library.
This file is part of Enasis Network software eco-system. Distribution is permitted, for more information consult the project license file.
- class encommon.parse.jinja2.Jinja2(statics: dict[str, Any] | None = None, filters: dict[str, Callable[[...], Any]] | None = None)[source]#
Bases:
object
Parse the provided input and intelligently return value.
Example#
>>> jinja2 = Jinja2() >>> jinja2.parse('{{ 0 | Time }}') '1970-01-01T00:00:00.000000+0000'
- param statics:
Additional values available for parsing.
- param filters:
Additional filter functions for parsing.
- property filters: dict[str, Callable[[...], Any]]#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- property jinjenv: Environment#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- parse(value: Any, statics: dict[str, Any] | None = None, literal: bool = True) Any [source]#
Return the provided input using the Jinja2 environment.
- Parameters:
value – Input that will be processed and returned.
statics – Additional values available for parsing.
literal – Determine if Python objects are evaled.
- Returns:
Provided input using the Jinja2 environment.
- parser(value: str, statics: dict[str, Any] | None = None) Any [source]#
Return the provided input using the Jinja2 environment.
- Parameters:
value – Input that will be processed and returned.
statics – Additional values available for parsing.
- Returns:
Provided input using the Jinja2 environment.
- set_filter(key: str, value: Callable[[...], Any] | None = None) None [source]#
Simply add the provided filter into internal reference.
- Parameters:
key – Where item will be inserted into reference.
value – Item that will be inserted into internal.
encommon.parse.network module#
Functions and routines associated with Enasis Network Common Library.
This file is part of Enasis Network software eco-system. Distribution is permitted, for more information consult the project license file.
- class encommon.parse.network.Network(source: str)[source]#
Bases:
object
Convert the network into the various supported formats.
- Parameters:
source – Network IPv4 or IPv6 network or address.
- property address: str#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- property address_cidr: str#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- property address_host: str#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- property broadcast: str | None#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- property cidr: int#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- property hwaddr: str#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- property netmask: str#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- property network: str#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- property network_cidr: str#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- property padded: str#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- property reverse: str#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- encommon.parse.network.insubnet_ip(address: str, networks: str | list[str] | tuple[str, ...]) bool [source]#
Return the boolean indicating address is in the network.
- Parameters:
address – Provided address to find in the network.
network – Networks which values can be within any.
- Returns:
Boolean indicating address is in the network.
Module contents#
Functions and routines associated with Enasis Network Common Library.
This file is part of Enasis Network software eco-system. Distribution is permitted, for more information consult the project license file.
- class encommon.parse.Jinja2(statics: dict[str, Any] | None = None, filters: dict[str, Callable[[...], Any]] | None = None)[source]#
Bases:
object
Parse the provided input and intelligently return value.
Example#
>>> jinja2 = Jinja2() >>> jinja2.parse('{{ 0 | Time }}') '1970-01-01T00:00:00.000000+0000'
- param statics:
Additional values available for parsing.
- param filters:
Additional filter functions for parsing.
- property filters: dict[str, Callable[[...], Any]]#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- property jinjenv: Environment#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- parse(value: Any, statics: dict[str, Any] | None = None, literal: bool = True) Any [source]#
Return the provided input using the Jinja2 environment.
- Parameters:
value – Input that will be processed and returned.
statics – Additional values available for parsing.
literal – Determine if Python objects are evaled.
- Returns:
Provided input using the Jinja2 environment.
- parser(value: str, statics: dict[str, Any] | None = None) Any [source]#
Return the provided input using the Jinja2 environment.
- Parameters:
value – Input that will be processed and returned.
statics – Additional values available for parsing.
- Returns:
Provided input using the Jinja2 environment.
- set_filter(key: str, value: Callable[[...], Any] | None = None) None [source]#
Simply add the provided filter into internal reference.
- Parameters:
key – Where item will be inserted into reference.
value – Item that will be inserted into internal.
- class encommon.parse.Network(source: str)[source]#
Bases:
object
Convert the network into the various supported formats.
- Parameters:
source – Network IPv4 or IPv6 network or address.
- property address: str#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- property address_cidr: str#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- property address_host: str#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- property broadcast: str | None#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- property cidr: int#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- property hwaddr: str#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- property netmask: str#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- property network: str#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- property network_cidr: str#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- property padded: str#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- property reverse: str#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- encommon.parse.insubnet_ip(address: str, networks: str | list[str] | tuple[str, ...]) bool [source]#
Return the boolean indicating address is in the network.
- Parameters:
address – Provided address to find in the network.
network – Networks which values can be within any.
- Returns:
Boolean indicating address is in the network.