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 mock import Mock | |
| from pytest import raises | |
| class A(object): | |
| def __init__(self, foo, bar): | |
| self.foo = foo | |
| self.bar = bar |
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
| #!/bin/bash -eu | |
| usage() { | |
| echo " | |
| Usage: prun [-N <job name>] [-l <resource>] [-L <logs root>] [-D] <command> [arguments] | |
| prun means \"process runner\". | |
| Its job is to run a process, capture its logs and system metrics. |
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 contextlib import contextmanager | |
| @contextmanager | |
| def env(**vars): | |
| new_environ = os.environ.copy() | |
| for name, value in vars.items(): | |
| new_environ[name] = 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
| class Descriptor(object): | |
| def __get__(self, inst, owner): | |
| if inst is None: | |
| return self | |
| return inst._descriptors[self] | |
| class BaseClass(object): |
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 AttrDict(dict): | |
| __setattr__ = dict.__setitem__ | |
| __delattr__ = dict.__delitem__ | |
| def __getattr__(self, attr): | |
| if attr in self: | |
| return self[attr] | |
| else: | |
| raise AttributeError(attr) |
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 tempfile import mktemp | |
| class TemporaryFile(object): | |
| def __init__(self, content, prefix='tmp', mode=None): | |
| self.content = content | |
| self.prefix = prefix | |
| self.mode = mode |
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
| #!/bin/bash -eu | |
| VIEW_FILE=$1 | |
| # These variables should be defined by the script user. | |
| #DB_PASSWORD= | |
| #DB_USERNAME= | |
| #DB_SERVICE= | |
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 python | |
| def func(x): | |
| return x + 1 | |
| lambda_ = lambda x: x + 1 | |
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 .actions import Install, Uninstall | |
| from . import requests | |
| class Policy(object): | |
| """A :class:`.Solver` policy. | |
| """ | |
| def install(self, candidates, installed=None): | |
| pass # pragma: no cover |
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
| # Copy/pasted from https://github.com/benhoyt/scandir | |
| # Just kept the linux code | |
| import os | |
| import sys | |
| import stat | |
| import ctypes | |
| import ctypes.util | |