-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #84 from tykeal/unique_id
unique id
- Loading branch information
Showing
6 changed files
with
80 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
############################################################################## | ||
# COPYRIGHT 2022 Andrew Grimberg | ||
# | ||
# All rights reserved. This program and the accompanying materials | ||
# are made available under the terms of the Apache 2.0 License | ||
# which accompanies this distribution, and is available at | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Contributors: | ||
# Andrew Grimberg - Initial implementation | ||
############################################################################## | ||
"""Rental Control utils.""" | ||
import hashlib | ||
import logging | ||
import uuid | ||
|
||
from .const import NAME | ||
|
||
_LOGGER = logging.getLogger(__name__) | ||
|
||
|
||
def gen_uuid(created: str) -> str: | ||
"""Generation a UUID from the NAME and creation time.""" | ||
m = hashlib.md5(f"{NAME} {created}".encode("utf-8")) | ||
return str(uuid.UUID(m.hexdigest())) |