Skip to content
Snippets Groups Projects
Commit 75541103 authored by KERDREUX Jerome's avatar KERDREUX Jerome
Browse files

Format

parent 27cff7fa
No related branches found
No related tags found
1 merge request!1First try of type hints
......@@ -2,12 +2,13 @@ import uuid
from .exceptions import UUIDError
class UUID:
def __init__(self, *args, **kwargs):
self.__uuid = uuid.UUID(*args, **kwargs)
@staticmethod
def random_base(digit=2) -> 'UUID':
def random_base(digit=2) -> "UUID":
"""zeros the last digits of a random uuid, usefull w/ you want to forge some addresses
two digit is great.
"""
......@@ -19,15 +20,15 @@ class UUID:
raise UUIDError
@staticmethod
def random() -> 'UUID':
def random() -> "UUID":
tmp = uuid.uuid1().int
return UUID(int=tmp)
def __add__(self, value:int) -> 'UUID':
def __add__(self, value: int) -> "UUID":
tmp = self.__uuid.int + value
return UUID(int=tmp)
def __sub__(self, value:int) -> 'UUID':
def __sub__(self, value: int) -> "UUID":
tmp = self.__uuid.int - value
return UUID(int=tmp)
......@@ -52,7 +53,7 @@ class UUID:
def get(self) -> uuid.UUID:
return self.__uuid
def set(self, value:uuid.UUID):
def set(self, value: uuid.UUID):
self.__uuid = value
@property
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment