Skip to content

Commit

Permalink
add is_platform_linux & get_random_name utility function
Browse files Browse the repository at this point in the history
  • Loading branch information
AHReccese committed Jan 19, 2024
1 parent c10d31d commit f49afe5
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions reserver/util.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
"""Utility functions."""

from platform import system
from hashlib import sha256
from time import time

def is_platform_linux():
"""
Check whether current platform is linux or not.
:return: bool
"""
return system() == "Linux"

def get_random_name():
"""
Generate a random str based on current timestamp.
:return: str
"""
return sha256(str(time()).encode("utf-8")).hexdigest()

0 comments on commit f49afe5

Please sign in to comment.