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
| #!/usr/bin/env python3 | |
| import json | |
| import os | |
| import re | |
| import sys | |
| import eyed3 | |
| import requests | |
| import tqdm |
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
| /** | |
| * Created by sashgorokhov on 08.06.17. | |
| */ | |
| function get_url_list() { | |
| var audio_list = document.getElementById('au_search_items'); | |
| var audio_item_list = audio_list.getElementsByClassName('audio_item'); | |
| var url_list = []; |
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 time | |
| import contextlib | |
| def retries(timeout=30, sleep_time=0.5, exception=AssertionError): | |
| timeout_at = time.time() + timeout | |
| state = {'fails': 0, 'give_up': False, 'success': False} | |
| @contextlib.contextmanager | |
| def handler(): | |
| try: |
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
| """ | |
| AttrDict is useful for declarative class data mapping. | |
| >>> class Foo(AttrDict): | |
| ... bar = 'bar' | |
| >>> f = Foo() | |
| >>> f | |
| {'bar': 'bar'} | |
| >>> f.bar | |
| 'bar' | |
| >>> Foo(bar='baz', foo='foo') == {'bar': 'baz', 'foo': 'foo'} |
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
| def singleton(cls): | |
| """ | |
| Class decorator. Everyone knows what it does. | |
| >>> class Foo: pass | |
| >>> Foo = singleton(Foo) # cant use class decorators in doctests ;( | |
| >>> f1 = Foo() | |
| >>> f2 = Foo() | |
| >>> f1 == f2 |
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 | |
| def extract_parameters(deep=1, flattern=True): | |
| """ | |
| Return caller function arguments and values. | |
| :param int deep: how much to go up with callers. 1 is for original caller, 2 is for caller of a caller, etc | |
| :param bool flattern: *args arguments are not supported. Adds all keys from kwargs to original data. | |
| :rtype: dict |