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 time | |
import asyncio | |
import contextvars | |
from random import random | |
from threading import current_thread | |
from concurrent.futures import ThreadPoolExecutor | |
# declare context var | |
request_id = contextvars.ContextVar('Id of request.') |
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 ast | |
import asyncio | |
import code | |
import concurrent.futures | |
import inspect | |
import sys | |
import threading | |
import types | |
import warnings | |
import contextvars |
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 asyncio | |
from datetime import datetime | |
from functools import partial | |
from concurrent.futures import ProcessPoolExecutor | |
from youtube_dl import YoutubeDL as YDL | |
PPE = ProcessPoolExecutor() | |
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
class A: | |
def calc(self): | |
print('A', __class__, self) | |
class B(A): | |
def calc(self): | |
print('B', __class__, self) | |
super().calc() | |
class C(B): |
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 time | |
from selenium import webdriver | |
from selenium.webdriver.chrome.options import Options | |
def main(url, path="chromedriver.exe"): | |
chrome_options = Options() | |
chrome_options.add_argument("--headless") # uncomment for headless | |
driver = webdriver.Chrome(path, chrome_options=chrome_options) | |
driver.get(url) |
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 asyncio | |
from weakref import WeakSet | |
from json import dumps, loads | |
def _validator(dict_data): | |
""" Default validator function for Observer class. """ | |
return dict_data['event'], dict_data['data'] | |
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 asyncio | |
from zipfile import ZipFile | |
__all__ = ("ZipFile", ) | |
@asyncio.coroutine | |
def async_extract(self, member, path=None, pwd=None, loop=None): | |
loop = loop or asyncio.get_event_loop() |
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 | |
from ftplib import FTP | |
import requests | |
def get_connect(url): | |
root, foldr = url.split('//', 1)[-1].split('/', 1) | |
ftp = FTP(root) | |
ftp.login() |
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 | |
from win32com.client import Dispatch | |
def calc_formula(fname): | |
xls = Dispatch("Excel.Application") | |
return xls.Workbooks.Open(os.path.abspath(fname)).Close(True) |
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 | |
from ftplib import FTP | |
import asyncio | |
import aiohttp | |
from aiofiles import open as aopen | |
def get_connect(url): | |
root, foldr = url.split('//', 1)[-1].split('/', 1) |
NewerOlder