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 regex | |
| test_release = 'Release.Name.v1.3.0.DISC.1.Other.Tags.x.264.<RESOLUTION>.WMV' | |
| memory = [] | |
| main = [] | |
| split_release = test_release.split('.') | |
| split_release.reverse() | |
| split_release_copy = split_release[:] | |
| # Tags that I want to know about |
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 ipdb | |
| import pytest | |
| @pytest.fixture(scope='function') | |
| def resource_a(request): | |
| default_value = '2' | |
| if request.scope == 'function' and 'value' in request.funcargnames: | |
| default_value = request.getfuncargvalue('value') |
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 pytest | |
| @pytest.fixture(scope="class") | |
| def resource_a(request): | |
| r = {'name': 'A'} | |
| def fin(): | |
| print ("\nteardown " + r['name']) | |
| request.addfinalizer(fin) | |
| return r |
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
| tracked_languages = ['persian', 'lithuanian', 'ukrainian', 'romanian', 'vietnamese', 'slovak', 'bulgarian', 'slovenian', | |
| 'hebrew', 'arabic', 'serbian', 'turkish', 'estonian', 'icelandic', 'thai', 'korean', 'hungarian', | |
| 'russian', 'latin', 'czech', 'truefrench', 'japanese', 'chinese', 'portuguese', 'polish', | |
| 'finnish', 'norwegian', 'flemish', 'nordic', 'danish', 'swedish', 'dutch', 'spanish', 'italian', | |
| 'french', 'german'] |
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 ipdb | |
| import pytest | |
| from collections import Mapping | |
| PARTITION_NAME = 'PARTITION' | |
| PARTITION_PASSWORD = 'PASSWORD' | |
| @pytest.fixture(scope='class') | |
| def computer_resource(request): |
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 MockClassicConnection(object): | |
| """Mock classic RPyC connection object. Useful when you want the same code to run remotely or locally. | |
| """ | |
| def __init__(self): | |
| self._conn = None | |
| self.namespace = {} | |
| self.modules = ModuleNamespace(self.getmodule) | |
| if is_py3k: | |
| self.builtin = self.modules.builtins |
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 binascii | |
| import glob | |
| char_count = 32 | |
| for filename in glob.glob('f7w*'): | |
| with open(filename, 'rb') as f, open(filename + '.txt', 'w') as output: | |
| data = binascii.hexlify(f.read()) | |
| for i, line in enumerate([data[i:i+char_count] for i in range(0, len(data), char_count)]): | |
| if i % 4 == 0: |
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 remove_from_console(console, log, levels=['DEBUG']): | |
| to_remove = [x for x in log if x['level'] in levels] | |
| skip_lines = 0 | |
| console_filtered = [] | |
| for index, line in enumerate(console): | |
| if skip_lines: | |
| skip_lines -= 1 | |
| continue |
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 pprint | |
| import random | |
| def weighted_random(weights): | |
| number = random.random() * sum(weights.values()) | |
| for k, v in weights.iteritems(): | |
| if number < v: | |
| break | |
| number -= v |
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 collections | |
| from pprint import pprint as pp | |
| from copy import copy | |
| smp = {'nine': {'eee': True, 'fff': {'ooo': 3, 'type': 'hsm'}, 'type': 'pc'}, | |
| 'one': {'bar': 6, 'foo': 5}, | |
| 'two': {'four': {'bar': 3, 'zzz': 3, 'type': 'g5', 'ge': {'v': 3}}, 'three': {'bar': 9, 'zzz': 9}}} | |
| def find_resource_type(item): |
OlderNewer