mirror of
https://github.com/aljazceru/python-teos.git
synced 2025-12-17 22:24:23 +01:00
Refactor add_appointment cli code
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import re
|
||||
from common.constants import LOCATOR_LEN_HEX
|
||||
|
||||
|
||||
def check_sha256_hex_format(value):
|
||||
@@ -12,3 +13,15 @@ def check_sha256_hex_format(value):
|
||||
:mod:`bool`: Whether or not the value matches the format.
|
||||
"""
|
||||
return isinstance(value, str) and re.match(r"^[0-9A-Fa-f]{64}$", value) is not None
|
||||
|
||||
|
||||
def compute_locator(tx_id):
|
||||
"""
|
||||
Computes an appointment locator given a transaction id.
|
||||
Args:
|
||||
tx_id (:obj:`str`): the transaction id used to compute the locator.
|
||||
Returns:
|
||||
(:obj:`str`): The computed locator.
|
||||
"""
|
||||
|
||||
return tx_id[:LOCATOR_LEN_HEX]
|
||||
|
||||
Reference in New Issue
Block a user