- Using the
BaseModel
frompydantic
takes the class members as arguments.- These arguments are displayed (along with the values) in the docs whether the user wants it or not.
This file contains hidden or 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
import os | |
from threading import Thread | |
import cv2 | |
import face_recognition | |
class Face(Thread): | |
def __init__(self): | |
super(Face, self).__init__() |
This file contains hidden or 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
from phonenumbers import geocoder, carrier, parse, timezone, is_valid_number, is_possible_number | |
phone = parse('target number goes here') | |
if is_valid_number(phone) and is_possible_number(phone): | |
state = geocoder.description_for_number(phone, 'en') | |
t_zone = timezone.time_zones_for_number(phone)[0] | |
car = carrier.name_for_number(phone, 'en') | |
print(f'The phone number with {phone} using the Carrier {car} is located in {state} and is currently in the timezone {t_zone}.') |
This file contains hidden or 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
cls | |
$currentTime = Get-Date -format "MMM, dd yyyy hh:mm:ss tt" | |
echo "StartTime: $currentTime`n`n" | |
echo "I will keep the system busy! Go do your thing!`n`t- Vignesh Rao`n`n" | |
echo "Questions?`n" | |
echo "https://vigneshrao.com/contact" |
This file contains hidden or 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
from random import choices | |
from string import ascii_letters, digits | |
def alpha_numeric(length: int = 20) -> str: | |
"""Generates alpha numeric phrase. | |
Args: | |
length: Length of the phrase that should be generated. |
This file contains hidden or 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
class Format: | |
BOLD = '\033[1m' | |
UNDERLINE = '\033[4m' | |
ITALIC = '\x1B[3m' | |
class Colors: | |
VIOLET = '\033[95m' | |
BLUE = '\033[94m' | |
CYAN = '\033[96m' |
This file contains hidden or 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
import asyncio | |
import logging | |
import os | |
import shutil | |
import subprocess | |
logger = logging.getLogger(__name__) | |
logger.addHandler(hdlr=logging.StreamHandler()) | |
logger.setLevel(level=logging.DEBUG) |
This file contains hidden or 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
import inspect | |
import os | |
from datetime import datetime | |
from typing import Any | |
class Format: | |
"""Initiates Format object to define variables that print the message in a certain format. | |
>>> Format |
This file contains hidden or 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
import signal | |
import time | |
from contextlib import contextmanager | |
from types import FrameType | |
from typing import Union, NoReturn | |
@contextmanager | |
def timeout(duration: Union[int, float]) -> NoReturn: | |
"""Creates a timeout handler. |
This file contains hidden or 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
import multiprocessing | |
import time | |
from typing import Callable, Union | |
class TimeoutHandler: | |
"""Initiates TimeoutHandler object to run a function and terminate it after a given time limit. | |
>>> TimeoutHandler |
OlderNewer