farm-ng-core
|
Classes | |
class | PlatformConfig |
Functions | |
None | set_host_name (str name) |
str | get_host_name () |
str | get_authority () |
uri_pb2.Uri | make_proto_uri (str path, Message message, str|None service_name=None) |
str|None | get_service_name (uri_pb2.Uri uri) |
str | uri_to_string (uri_pb2.Uri uri) |
uri_pb2.Uri | string_to_uri (str string) |
dict[str, str] | uri_query_to_dict (uri_pb2.Uri uri) |
type[Message] | uri_to_protobuf_type (uri_pb2.Uri uri) |
Variables | |
platform_config = PlatformConfig() | |
str core.uri.get_authority | ( | ) |
Return the authority. Example: >>> get_authority() 'farm-ng-1'
str core.uri.get_host_name | ( | ) |
Return the host name. Example: >>> get_host_name() 'farm-ng-1'
str | None core.uri.get_service_name | ( | uri_pb2.Uri | uri | ) |
Return the service name from a protobuf uri. Args: uri: uri_pb2.Uri Returns: str | None: the service name. Example: >>> uri = Uri() >>> uri.query = "type=farm_ng.core.proto.Timestamp&pb=farm_ng/core/timestamp.proto&service_name=service" >>> get_service_name(uri) 'service'
uri_pb2.Uri core.uri.make_proto_uri | ( | str | path, |
Message | message, | ||
str | None | service_name = None |
||
) |
Return a protobuf uri from protobuf message. Args: path: the semantic path. message: the protobuf message. Returns: uri_pb2.Uri: the protobuf uri. Example: >>> from farm_ng.core import timestamp_pb2 >>> stamp = timestamp_pb2.Timestamp( ... stamp=1.2, ... clock_name="clock0", ... semantics="test/proto", ... ) >>> make_proto_uri("tik/tok", stamp) scheme: "protobuf" authority: "farm-ng-1" path: "tik/tok" query: "type=farm_ng.core.proto.Timestamp&pb=farm_ng/core/timestamp.proto"
None core.uri.set_host_name | ( | str | name | ) |
Set the host name.
uri_pb2.Uri core.uri.string_to_uri | ( | str | string | ) |
Return a protobuf uri from a string. Args: string: the string representation of the uri. Returns: uri_pb2.Uri: the protobuf uri. Example: >>> string = "protobuf://farm-ng-1//?type=farm_ng.core.proto.Timestamp&pb=farm_ng/core/timestamp.proto" >>> string_to_uri(string) scheme: "protobuf" authority: "farm-ng-1" path: "" query: "type=farm_ng.core.proto.Timestamp&pb=farm_ng/core/timestamp.proto"
dict[str, str] core.uri.uri_query_to_dict | ( | uri_pb2.Uri | uri | ) |
Return a dictionary from a uri query. Args: uri: uri_pb2.Uri Returns: dict[str, str]: the dictionary representation of the uri query. Example: >>> uri = Uri() >>> uri.query = "type=farm_ng.core.proto.Timestamp&pb=farm_ng/core/timestamp.proto" >>> uri_query_to_dict(uri) {'type': 'farm_ng.core.proto.Timestamp', 'pb': 'farm_ng/core/timestamp.proto'}
type[Message] core.uri.uri_to_protobuf_type | ( | uri_pb2.Uri | uri | ) |
Return the protobuf type from an event. Args: event: event_pb2.Event Returns: Type[Message]: the protobuf type Example: >>> event = Event() >>> event.uri.query = "type=farm_ng.core.proto.Timestamp&pb=farm_ng/core/timestamp.proto" >>> event_to_protobuf_type(event) <class 'farm_ng.core.timestamp_pb2.Timestamp'>
str core.uri.uri_to_string | ( | uri_pb2.Uri | uri | ) |
Return a string from a protobuf uri. Args: uri: uri_pb2.Uri Returns: str: the string representation of the uri. Example: >>> uri = Uri() >>> uri.scheme = "protobuf" >>> uri.authority = "farm-ng-1" >>> uri.query = "type=farm_ng.core.proto.Timestamp&pb=farm_ng/core/timestamp.proto" >>> uri_to_string(uri) 'protobuf://farm-ng-1//?type=farm_ng.core.proto.Timestamp&pb=farm_ng/core/timestamp.proto'
core.uri.platform_config = PlatformConfig() |