Guid parser
guid_parser ¶
Code to help parse guid formats and transform into UUIDs.
Some functionality copied from Tianocore/edk2 basetools.
GuidParser ¶
Provide support functions for converting between different guid formats.
Also support str uuid and uuid to string.
Note
is_guid_in_c_format
classmethod
¶
is_guid_in_c_format(guidstring: str) -> bool
Determine if guidstring is in c format.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
guidstring |
str
|
string containing guid |
required |
Returns:
Type | Description |
---|---|
bool
|
True if in C format. Otherwise False |
is_guid_in_reg_format
classmethod
¶
is_guid_in_reg_format(guidstring: str) -> bool
Determine if guidstring is in registry format.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
guidstring |
str
|
string containing guid |
required |
Returns:
Type | Description |
---|---|
bool
|
True if in Registry format. Otherwise False |
reg_guid_from_c_format
classmethod
¶
reg_guid_from_c_format(guidstring: str) -> str
Convert a c formatted guidstring to a registry formatted guidstring.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
guidstring |
str
|
c format guidstring |
required |
Returns:
Type | Description |
---|---|
Success
|
guidstring in registry format |
Failure
|
empty string '' |
c_guid_from_reg_format
classmethod
¶
c_guid_from_reg_format(guidstring: str) -> str
Convert registry format guidstring to c format guidstring.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
guidstring |
str
|
registry format guidstring |
required |
Returns:
Type | Description |
---|---|
Success
|
guidstring in c format |
Failure
|
empty string '' |
uuid_from_guidstring
classmethod
¶
uuid_from_guidstring(guidstring: str) -> uuid.UUID
Create a uuid object from the supplied guidstring.
c_guid_str_from_uuid
classmethod
¶
c_guid_str_from_uuid(guid: uuid.UUID) -> str
Get a C string formatted guidstring from a uuid object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
guid |
UUID
|
valid uuid object |
required |
Returns:
Type | Description |
---|---|
Success
|
guidstring in C format |
Failure
|
empty string '' |
reg_guid_str_from_uuid
classmethod
¶
reg_guid_str_from_uuid(guid: uuid.UUID) -> str
Get a registry string formatted guidstring from a uuid object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
guid |
UUID
|
valid uuid object |
required |
Returns:
Type | Description |
---|---|
Success
|
guidstring in registry format |
Failure
|
empty string '' |