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
import functools | |
import random | |
import time | |
from collections import defaultdict | |
from threading import Thread | |
class Timer(Thread): | |
def __init__(self, interval, func, *args, **kwargs): | |
super().__init__() |
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
@pytest.fixture | |
def step(): | |
from allure_commons import plugin_manager | |
hook = plugin_manager.hook | |
def report_step(title): | |
_uuid = uuid4() | |
hook.start_step(uuid=_uuid, title=title, params={}) | |
hook.stop_step(uuid=_uuid, title=title, exc_type=None, exc_val=None, exc_tb=None) |
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
import os | |
import sys | |
def list_files_in(path, ext=None): | |
for root, subdirs, files in os.walk(path): | |
# print('\n\nroot = ' + root) | |
for subdir in subdirs: | |
list_files_in(subdir) |
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
from random import randint | |
from PIL import Image | |
import numpy as np | |
W, H, = 1920, 1080 | |
def shades_of(color): | |
if color == 'red': | |
return rand_rgb(0, 255, 0, 0, 0, 0) |
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
grep -E "(word1|word2|wordn)" |
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
try: | |
You do your operations here; | |
...................... | |
except ExceptionI: | |
If there is ExceptionI, then execute this block. | |
except ExceptionII: | |
If there is ExceptionII, then execute this block. | |
...................... | |
else: | |
If there is no exception then execute this block. |