partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
parse_arguments
Parse the command line arguments :return:
serviceping/commandline.py
def parse_arguments(): """ Parse the command line arguments :return: """ parser = argparse.ArgumentParser() parser.add_argument( "-c", dest="count", default=0, type=int, help="Number of pings to send" ) parser.add_argument( "-i", dest="interval", default=1, type=f...
def parse_arguments(): """ Parse the command line arguments :return: """ parser = argparse.ArgumentParser() parser.add_argument( "-c", dest="count", default=0, type=int, help="Number of pings to send" ) parser.add_argument( "-i", dest="interval", default=1, type=f...
[ "Parse", "the", "command", "line", "arguments", ":", "return", ":" ]
yahoo/serviceping
python
https://github.com/yahoo/serviceping/blob/1f9df5ee5b3cba466426b1164262278472ba4977/serviceping/commandline.py#L7-L28
[ "def", "parse_arguments", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", ")", "parser", ".", "add_argument", "(", "\"-c\"", ",", "dest", "=", "\"count\"", ",", "default", "=", "0", ",", "type", "=", "int", ",", "help", "=", "\"Nu...
1f9df5ee5b3cba466426b1164262278472ba4977
train
_Madoka.create
Create new sketch Params: <int> width <str> path <int> flags <int> seed
madoka/madoka.py
def create(self, width=0, depth=0, path=None, flags=0, seed=0): """Create new sketch Params: <int> width <str> path <int> flags <int> seed """ return self.create_method(self, width, depth, path, flags, seed)
def create(self, width=0, depth=0, path=None, flags=0, seed=0): """Create new sketch Params: <int> width <str> path <int> flags <int> seed """ return self.create_method(self, width, depth, path, flags, seed)
[ "Create", "new", "sketch", "Params", ":", "<int", ">", "width", "<str", ">", "path", "<int", ">", "flags", "<int", ">", "seed" ]
ikegami-yukino/madoka-python
python
https://github.com/ikegami-yukino/madoka-python/blob/a9a1efecbc85ac4a24a78cbb19f9aed77b7162d3/madoka/madoka.py#L247-L255
[ "def", "create", "(", "self", ",", "width", "=", "0", ",", "depth", "=", "0", ",", "path", "=", "None", ",", "flags", "=", "0", ",", "seed", "=", "0", ")", ":", "return", "self", ".", "create_method", "(", "self", ",", "width", ",", "depth", ",...
a9a1efecbc85ac4a24a78cbb19f9aed77b7162d3
train
_Madoka.get
Add key-value Params: <str> key <int> key_length Return: <int> key_value
madoka/madoka.py
def get(self, key, key_length=0): """Add key-value Params: <str> key <int> key_length Return: <int> key_value """ if key_length < 1: key_length = len(key) return self.get_method(self, key, key_length)
def get(self, key, key_length=0): """Add key-value Params: <str> key <int> key_length Return: <int> key_value """ if key_length < 1: key_length = len(key) return self.get_method(self, key, key_length)
[ "Add", "key", "-", "value", "Params", ":", "<str", ">", "key", "<int", ">", "key_length", "Return", ":", "<int", ">", "key_value" ]
ikegami-yukino/madoka-python
python
https://github.com/ikegami-yukino/madoka-python/blob/a9a1efecbc85ac4a24a78cbb19f9aed77b7162d3/madoka/madoka.py#L334-L344
[ "def", "get", "(", "self", ",", "key", ",", "key_length", "=", "0", ")", ":", "if", "key_length", "<", "1", ":", "key_length", "=", "len", "(", "key", ")", "return", "self", ".", "get_method", "(", "self", ",", "key", ",", "key_length", ")" ]
a9a1efecbc85ac4a24a78cbb19f9aed77b7162d3
train
_Madoka.set
Set value to key-value Params: <str> key <int> value <int> key_length Return: <int> key_value
madoka/madoka.py
def set(self, key, value, key_length=0): """Set value to key-value Params: <str> key <int> value <int> key_length Return: <int> key_value """ if key_length < 1: key_length = len(key) if self.k: self._...
def set(self, key, value, key_length=0): """Set value to key-value Params: <str> key <int> value <int> key_length Return: <int> key_value """ if key_length < 1: key_length = len(key) if self.k: self._...
[ "Set", "value", "to", "key", "-", "value", "Params", ":", "<str", ">", "key", "<int", ">", "value", "<int", ">", "key_length", "Return", ":", "<int", ">", "key_value" ]
ikegami-yukino/madoka-python
python
https://github.com/ikegami-yukino/madoka-python/blob/a9a1efecbc85ac4a24a78cbb19f9aed77b7162d3/madoka/madoka.py#L346-L359
[ "def", "set", "(", "self", ",", "key", ",", "value", ",", "key_length", "=", "0", ")", ":", "if", "key_length", "<", "1", ":", "key_length", "=", "len", "(", "key", ")", "if", "self", ".", "k", ":", "self", ".", "_update", "(", "key", ",", "val...
a9a1efecbc85ac4a24a78cbb19f9aed77b7162d3
train
_Madoka.add
Add value to key-value Params: <str> key <int> value <int> key_length Return: <int> key_value
madoka/madoka.py
def add(self, key, value, key_length=0): """Add value to key-value Params: <str> key <int> value <int> key_length Return: <int> key_value """ if key_length < 1: key_length = len(key) val = self.add_method(self, k...
def add(self, key, value, key_length=0): """Add value to key-value Params: <str> key <int> value <int> key_length Return: <int> key_value """ if key_length < 1: key_length = len(key) val = self.add_method(self, k...
[ "Add", "value", "to", "key", "-", "value", "Params", ":", "<str", ">", "key", "<int", ">", "value", "<int", ">", "key_length", "Return", ":", "<int", ">", "key_value" ]
ikegami-yukino/madoka-python
python
https://github.com/ikegami-yukino/madoka-python/blob/a9a1efecbc85ac4a24a78cbb19f9aed77b7162d3/madoka/madoka.py#L361-L375
[ "def", "add", "(", "self", ",", "key", ",", "value", ",", "key_length", "=", "0", ")", ":", "if", "key_length", "<", "1", ":", "key_length", "=", "len", "(", "key", ")", "val", "=", "self", ".", "add_method", "(", "self", ",", "key", ",", "key_le...
a9a1efecbc85ac4a24a78cbb19f9aed77b7162d3
train
_Madoka.inc
Add value to key-value Params: <str> key <int> value <int> key_length Return: <int> key_value
madoka/madoka.py
def inc(self, key, key_length=0): """Add value to key-value Params: <str> key <int> value <int> key_length Return: <int> key_value """ if key_length < 1: key_length = len(key) val = self.add_method(self, key, key...
def inc(self, key, key_length=0): """Add value to key-value Params: <str> key <int> value <int> key_length Return: <int> key_value """ if key_length < 1: key_length = len(key) val = self.add_method(self, key, key...
[ "Add", "value", "to", "key", "-", "value", "Params", ":", "<str", ">", "key", "<int", ">", "value", "<int", ">", "key_length", "Return", ":", "<int", ">", "key_value" ]
ikegami-yukino/madoka-python
python
https://github.com/ikegami-yukino/madoka-python/blob/a9a1efecbc85ac4a24a78cbb19f9aed77b7162d3/madoka/madoka.py#L377-L391
[ "def", "inc", "(", "self", ",", "key", ",", "key_length", "=", "0", ")", ":", "if", "key_length", "<", "1", ":", "key_length", "=", "len", "(", "key", ")", "val", "=", "self", ".", "add_method", "(", "self", ",", "key", ",", "key_length", ",", "1...
a9a1efecbc85ac4a24a78cbb19f9aed77b7162d3
train
_Madoka.clear
Clear sketch
madoka/madoka.py
def clear(self): """Clear sketch""" self.ranking = [] heapq.heapify(self.ranking) self.dq = deque(maxlen=self.k) self.num = 0 return self.clear_method(self)
def clear(self): """Clear sketch""" self.ranking = [] heapq.heapify(self.ranking) self.dq = deque(maxlen=self.k) self.num = 0 return self.clear_method(self)
[ "Clear", "sketch" ]
ikegami-yukino/madoka-python
python
https://github.com/ikegami-yukino/madoka-python/blob/a9a1efecbc85ac4a24a78cbb19f9aed77b7162d3/madoka/madoka.py#L393-L399
[ "def", "clear", "(", "self", ")", ":", "self", ".", "ranking", "=", "[", "]", "heapq", ".", "heapify", "(", "self", ".", "ranking", ")", "self", ".", "dq", "=", "deque", "(", "maxlen", "=", "self", ".", "k", ")", "self", ".", "num", "=", "0", ...
a9a1efecbc85ac4a24a78cbb19f9aed77b7162d3
train
_Madoka.shrink
Shrink sketch Params: <Sketch> src_sketch <int> width <str> path <int> flags
madoka/madoka.py
def shrink(self, src, width=0, path=None, flags=0): """Shrink sketch Params: <Sketch> src_sketch <int> width <str> path <int> flags """ self.shrink_method(self, src, width, path, flags)
def shrink(self, src, width=0, path=None, flags=0): """Shrink sketch Params: <Sketch> src_sketch <int> width <str> path <int> flags """ self.shrink_method(self, src, width, path, flags)
[ "Shrink", "sketch", "Params", ":", "<Sketch", ">", "src_sketch", "<int", ">", "width", "<str", ">", "path", "<int", ">", "flags" ]
ikegami-yukino/madoka-python
python
https://github.com/ikegami-yukino/madoka-python/blob/a9a1efecbc85ac4a24a78cbb19f9aed77b7162d3/madoka/madoka.py#L415-L423
[ "def", "shrink", "(", "self", ",", "src", ",", "width", "=", "0", ",", "path", "=", "None", ",", "flags", "=", "0", ")", ":", "self", ".", "shrink_method", "(", "self", ",", "src", ",", "width", ",", "path", ",", "flags", ")" ]
a9a1efecbc85ac4a24a78cbb19f9aed77b7162d3
train
_Madoka.merge
Merge two sketches Params: <Sketch> sketch <lambda> | <function> lhs_filter <lambda> | <function> rhs_filter
madoka/madoka.py
def merge(self, rhs, lhs_filter=None, rhs_filter=None): """Merge two sketches Params: <Sketch> sketch <lambda> | <function> lhs_filter <lambda> | <function> rhs_filter """ if lhs_filter or rhs_filter: get_ = self.get___method se...
def merge(self, rhs, lhs_filter=None, rhs_filter=None): """Merge two sketches Params: <Sketch> sketch <lambda> | <function> lhs_filter <lambda> | <function> rhs_filter """ if lhs_filter or rhs_filter: get_ = self.get___method se...
[ "Merge", "two", "sketches", "Params", ":", "<Sketch", ">", "sketch", "<lambda", ">", "|", "<function", ">", "lhs_filter", "<lambda", ">", "|", "<function", ">", "rhs_filter" ]
ikegami-yukino/madoka-python
python
https://github.com/ikegami-yukino/madoka-python/blob/a9a1efecbc85ac4a24a78cbb19f9aed77b7162d3/madoka/madoka.py#L425-L453
[ "def", "merge", "(", "self", ",", "rhs", ",", "lhs_filter", "=", "None", ",", "rhs_filter", "=", "None", ")", ":", "if", "lhs_filter", "or", "rhs_filter", ":", "get_", "=", "self", ".", "get___method", "set_", "=", "self", ".", "set___method", "max_value...
a9a1efecbc85ac4a24a78cbb19f9aed77b7162d3
train
_Madoka.filter
Apply filter into all values Params <lambda> | <function> given_filter <bool> only_nonzero
madoka/madoka.py
def filter(self, given_filter, apply_zerovalue=False): """Apply filter into all values Params <lambda> | <function> given_filter <bool> only_nonzero """ get_ = self.get___method set_ = self.set___method max_value = self.max_value for table_...
def filter(self, given_filter, apply_zerovalue=False): """Apply filter into all values Params <lambda> | <function> given_filter <bool> only_nonzero """ get_ = self.get___method set_ = self.set___method max_value = self.max_value for table_...
[ "Apply", "filter", "into", "all", "values", "Params", "<lambda", ">", "|", "<function", ">", "given_filter", "<bool", ">", "only_nonzero" ]
ikegami-yukino/madoka-python
python
https://github.com/ikegami-yukino/madoka-python/blob/a9a1efecbc85ac4a24a78cbb19f9aed77b7162d3/madoka/madoka.py#L469-L484
[ "def", "filter", "(", "self", ",", "given_filter", ",", "apply_zerovalue", "=", "False", ")", ":", "get_", "=", "self", ".", "get___method", "set_", "=", "self", ".", "set___method", "max_value", "=", "self", ".", "max_value", "for", "table_id", "in", "ran...
a9a1efecbc85ac4a24a78cbb19f9aed77b7162d3
train
_Madoka.values
Dump all values Return: <generator> <int> val
madoka/madoka.py
def values(self): """Dump all values Return: <generator> <int> val """ table_id = 0 get = self.get___method for cell_id in range(self.width): val = get(self, table_id, cell_id) if val: yield val
def values(self): """Dump all values Return: <generator> <int> val """ table_id = 0 get = self.get___method for cell_id in range(self.width): val = get(self, table_id, cell_id) if val: yield val
[ "Dump", "all", "values", "Return", ":", "<generator", ">", "<int", ">", "val" ]
ikegami-yukino/madoka-python
python
https://github.com/ikegami-yukino/madoka-python/blob/a9a1efecbc85ac4a24a78cbb19f9aed77b7162d3/madoka/madoka.py#L486-L496
[ "def", "values", "(", "self", ")", ":", "table_id", "=", "0", "get", "=", "self", ".", "get___method", "for", "cell_id", "in", "range", "(", "self", ".", "width", ")", ":", "val", "=", "get", "(", "self", ",", "table_id", ",", "cell_id", ")", "if",...
a9a1efecbc85ac4a24a78cbb19f9aed77b7162d3
train
_Madoka.fromdict
Set values from dict Params: <dict <str> <int>> src_dict
madoka/madoka.py
def fromdict(self, src_dict, method='set'): """Set values from dict Params: <dict <str> <int>> src_dict """ if method == 'set': _method = self.set_method else: _method = self.add_method if hasattr(src_dict, 'iteritems'): for...
def fromdict(self, src_dict, method='set'): """Set values from dict Params: <dict <str> <int>> src_dict """ if method == 'set': _method = self.set_method else: _method = self.add_method if hasattr(src_dict, 'iteritems'): for...
[ "Set", "values", "from", "dict", "Params", ":", "<dict", "<str", ">", "<int", ">>", "src_dict" ]
ikegami-yukino/madoka-python
python
https://github.com/ikegami-yukino/madoka-python/blob/a9a1efecbc85ac4a24a78cbb19f9aed77b7162d3/madoka/madoka.py#L498-L516
[ "def", "fromdict", "(", "self", ",", "src_dict", ",", "method", "=", "'set'", ")", ":", "if", "method", "==", "'set'", ":", "_method", "=", "self", ".", "set_method", "else", ":", "_method", "=", "self", ".", "add_method", "if", "hasattr", "(", "src_di...
a9a1efecbc85ac4a24a78cbb19f9aed77b7162d3
train
Sketch.create
Create new sketch Params: <int> width <int> max_value <str> path <int> flags <int> seed
madoka/madoka.py
def create(self, width=0, max_value=0, path=None, flags=0, seed=0): """Create new sketch Params: <int> width <int> max_value <str> path <int> flags <int> seed """ return _madoka.Sketch_create(self, width, max_value, path, flags,...
def create(self, width=0, max_value=0, path=None, flags=0, seed=0): """Create new sketch Params: <int> width <int> max_value <str> path <int> flags <int> seed """ return _madoka.Sketch_create(self, width, max_value, path, flags,...
[ "Create", "new", "sketch", "Params", ":", "<int", ">", "width", "<int", ">", "max_value", "<str", ">", "path", "<int", ">", "flags", "<int", ">", "seed" ]
ikegami-yukino/madoka-python
python
https://github.com/ikegami-yukino/madoka-python/blob/a9a1efecbc85ac4a24a78cbb19f9aed77b7162d3/madoka/madoka.py#L588-L597
[ "def", "create", "(", "self", ",", "width", "=", "0", ",", "max_value", "=", "0", ",", "path", "=", "None", ",", "flags", "=", "0", ",", "seed", "=", "0", ")", ":", "return", "_madoka", ".", "Sketch_create", "(", "self", ",", "width", ",", "max_v...
a9a1efecbc85ac4a24a78cbb19f9aed77b7162d3
train
Sketch.inc
Increment key-value Params: <str> key <int> key_length Return: <int> key_value
madoka/madoka.py
def inc(self, key, key_length=0): """Increment key-value Params: <str> key <int> key_length Return: <int> key_value """ if key_length < 1: key_length = len(key) return _madoka.Sketch_inc(self, key, key_length)
def inc(self, key, key_length=0): """Increment key-value Params: <str> key <int> key_length Return: <int> key_value """ if key_length < 1: key_length = len(key) return _madoka.Sketch_inc(self, key, key_length)
[ "Increment", "key", "-", "value", "Params", ":", "<str", ">", "key", "<int", ">", "key_length", "Return", ":", "<int", ">", "key_value" ]
ikegami-yukino/madoka-python
python
https://github.com/ikegami-yukino/madoka-python/blob/a9a1efecbc85ac4a24a78cbb19f9aed77b7162d3/madoka/madoka.py#L599-L609
[ "def", "inc", "(", "self", ",", "key", ",", "key_length", "=", "0", ")", ":", "if", "key_length", "<", "1", ":", "key_length", "=", "len", "(", "key", ")", "return", "_madoka", ".", "Sketch_inc", "(", "self", ",", "key", ",", "key_length", ")" ]
a9a1efecbc85ac4a24a78cbb19f9aed77b7162d3
train
Sketch.shrink
Shrink sketch Params: <Sketch> src_sketch <int> width <int> max_value <lambda> | <function> filter <str> path <int> flags
madoka/madoka.py
def shrink(self, src, width=0, max_value=0, filter_method=None, path=None, flags=0): """Shrink sketch Params: <Sketch> src_sketch <int> width <int> max_value <lambda> | <function> filter <str> path <int> flags ...
def shrink(self, src, width=0, max_value=0, filter_method=None, path=None, flags=0): """Shrink sketch Params: <Sketch> src_sketch <int> width <int> max_value <lambda> | <function> filter <str> path <int> flags ...
[ "Shrink", "sketch", "Params", ":", "<Sketch", ">", "src_sketch", "<int", ">", "width", "<int", ">", "max_value", "<lambda", ">", "|", "<function", ">", "filter", "<str", ">", "path", "<int", ">", "flags" ]
ikegami-yukino/madoka-python
python
https://github.com/ikegami-yukino/madoka-python/blob/a9a1efecbc85ac4a24a78cbb19f9aed77b7162d3/madoka/madoka.py#L611-L636
[ "def", "shrink", "(", "self", ",", "src", ",", "width", "=", "0", ",", "max_value", "=", "0", ",", "filter_method", "=", "None", ",", "path", "=", "None", ",", "flags", "=", "0", ")", ":", "if", "filter_method", ":", "get_", "=", "_madoka", ".", ...
a9a1efecbc85ac4a24a78cbb19f9aed77b7162d3
train
create_readme_with_long_description
Try to convert content of README.md into rst format using pypandoc, write it into README and return it. If pypandoc cannot be imported write content of README.md unchanged into README and return it.
setup.py
def create_readme_with_long_description(): '''Try to convert content of README.md into rst format using pypandoc, write it into README and return it. If pypandoc cannot be imported write content of README.md unchanged into README and return it. ''' this_dir = os.path.abspath(os.path.dirname(__f...
def create_readme_with_long_description(): '''Try to convert content of README.md into rst format using pypandoc, write it into README and return it. If pypandoc cannot be imported write content of README.md unchanged into README and return it. ''' this_dir = os.path.abspath(os.path.dirname(__f...
[ "Try", "to", "convert", "content", "of", "README", ".", "md", "into", "rst", "format", "using", "pypandoc", "write", "it", "into", "README", "and", "return", "it", "." ]
theno/fabsetup
python
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/setup.py#L13-L44
[ "def", "create_readme_with_long_description", "(", ")", ":", "this_dir", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ")", "readme_md", "=", "os", ".", "path", ".", "join", "(", "this_dir", ",", ...
ced728abff93551ba5677e63bc1bdc0ef5ca5777
train
openssl
Install or update OpenSSL from source (statically linked, no shared libs). Args: version (str): Git tag or branch to install from. Default: 'master' ignore_test_fail: Continue with installation if `make test` fails. Default: False Example: > fab setup.openssl:...
fabsetup/fabfile/setup/openssl.py
def openssl(version='master', ignore_test_fail=False): ''' Install or update OpenSSL from source (statically linked, no shared libs). Args: version (str): Git tag or branch to install from. Default: 'master' ignore_test_fail: Continue with installation if `make test` fails. ...
def openssl(version='master', ignore_test_fail=False): ''' Install or update OpenSSL from source (statically linked, no shared libs). Args: version (str): Git tag or branch to install from. Default: 'master' ignore_test_fail: Continue with installation if `make test` fails. ...
[ "Install", "or", "update", "OpenSSL", "from", "source", "(", "statically", "linked", "no", "shared", "libs", ")", "." ]
theno/fabsetup
python
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabfile/setup/openssl.py#L15-L64
[ "def", "openssl", "(", "version", "=", "'master'", ",", "ignore_test_fail", "=", "False", ")", ":", "src_base", "=", "'~/repos'", "srcdir", "=", "flo", "(", "'{src_base}/openssl'", ")", "inst_base", "=", "'~/bin/openssl-inst'", "instdir", "=", "flo", "(", "'{i...
ced728abff93551ba5677e63bc1bdc0ef5ca5777
train
stat
Print download statistics for a package. \b Example: pypi stat requests
pypi_cli.py
def stat(package, graph): """Print download statistics for a package. \b Example: pypi stat requests """ client = requests.Session() for name_or_url in package: package = get_package(name_or_url, client) if not package: secho(u'Invalid name or URL: "{name}"'...
def stat(package, graph): """Print download statistics for a package. \b Example: pypi stat requests """ client = requests.Session() for name_or_url in package: package = get_package(name_or_url, client) if not package: secho(u'Invalid name or URL: "{name}"'...
[ "Print", "download", "statistics", "for", "a", "package", "." ]
sloria/pypi-cli
python
https://github.com/sloria/pypi-cli/blob/beb007bf2bdd285209876ce2758982b5d8b54d5d/pypi_cli.py#L97-L143
[ "def", "stat", "(", "package", ",", "graph", ")", ":", "client", "=", "requests", ".", "Session", "(", ")", "for", "name_or_url", "in", "package", ":", "package", "=", "get_package", "(", "name_or_url", ",", "client", ")", "if", "not", "package", ":", ...
beb007bf2bdd285209876ce2758982b5d8b54d5d
train
browse
Browse to a package's PyPI or project homepage.
pypi_cli.py
def browse(package, homepage): """Browse to a package's PyPI or project homepage.""" p = Package(package) try: if homepage: secho(u'Opening homepage for "{0}"...'.format(package), bold=True) url = p.home_page else: secho(u'Opening PyPI page for "{0}"...'.f...
def browse(package, homepage): """Browse to a package's PyPI or project homepage.""" p = Package(package) try: if homepage: secho(u'Opening homepage for "{0}"...'.format(package), bold=True) url = p.home_page else: secho(u'Opening PyPI page for "{0}"...'.f...
[ "Browse", "to", "a", "package", "s", "PyPI", "or", "project", "homepage", "." ]
sloria/pypi-cli
python
https://github.com/sloria/pypi-cli/blob/beb007bf2bdd285209876ce2758982b5d8b54d5d/pypi_cli.py#L157-L169
[ "def", "browse", "(", "package", ",", "homepage", ")", ":", "p", "=", "Package", "(", "package", ")", "try", ":", "if", "homepage", ":", "secho", "(", "u'Opening homepage for \"{0}\"...'", ".", "format", "(", "package", ")", ",", "bold", "=", "True", ")"...
beb007bf2bdd285209876ce2758982b5d8b54d5d
train
search
Search for a pypi package. \b Examples: \b pypi search requests pypi search 'requests oauth' pypi search requests -n 20 pypi search 'requests toolbelt' --web
pypi_cli.py
def search(query, n_results, web): """Search for a pypi package. \b Examples: \b pypi search requests pypi search 'requests oauth' pypi search requests -n 20 pypi search 'requests toolbelt' --web """ if web: secho(u'Opening search page for "{0}"...'....
def search(query, n_results, web): """Search for a pypi package. \b Examples: \b pypi search requests pypi search 'requests oauth' pypi search requests -n 20 pypi search 'requests toolbelt' --web """ if web: secho(u'Opening search page for "{0}"...'....
[ "Search", "for", "a", "pypi", "package", "." ]
sloria/pypi-cli
python
https://github.com/sloria/pypi-cli/blob/beb007bf2bdd285209876ce2758982b5d8b54d5d/pypi_cli.py#L192-L216
[ "def", "search", "(", "query", ",", "n_results", ",", "web", ")", ":", "if", "web", ":", "secho", "(", "u'Opening search page for \"{0}\"...'", ".", "format", "(", "query", ")", ",", "bold", "=", "True", ")", "url", "=", "SEARCH_URL", ".", "format", "(",...
beb007bf2bdd285209876ce2758982b5d8b54d5d
train
info
Get info about a package or packages.
pypi_cli.py
def info(package, long_description, classifiers, license): """Get info about a package or packages. """ client = requests.Session() for name_or_url in package: package = get_package(name_or_url, client) if not package: secho(u'Invalid name or URL: "{name}"'.format(name=name_o...
def info(package, long_description, classifiers, license): """Get info about a package or packages. """ client = requests.Session() for name_or_url in package: package = get_package(name_or_url, client) if not package: secho(u'Invalid name or URL: "{name}"'.format(name=name_o...
[ "Get", "info", "about", "a", "package", "or", "packages", "." ]
sloria/pypi-cli
python
https://github.com/sloria/pypi-cli/blob/beb007bf2bdd285209876ce2758982b5d8b54d5d/pypi_cli.py#L227-L306
[ "def", "info", "(", "package", ",", "long_description", ",", "classifiers", ",", "license", ")", ":", "client", "=", "requests", ".", "Session", "(", ")", "for", "name_or_url", "in", "package", ":", "package", "=", "get_package", "(", "name_or_url", ",", "...
beb007bf2bdd285209876ce2758982b5d8b54d5d
train
bargraph
Return a bar graph as a string, given a dictionary of data.
pypi_cli.py
def bargraph(data, max_key_width=30): """Return a bar graph as a string, given a dictionary of data.""" lines = [] max_length = min(max(len(key) for key in data.keys()), max_key_width) max_val = max(data.values()) max_val_length = max( len(_style_value(val)) for val in data.values())...
def bargraph(data, max_key_width=30): """Return a bar graph as a string, given a dictionary of data.""" lines = [] max_length = min(max(len(key) for key in data.keys()), max_key_width) max_val = max(data.values()) max_val_length = max( len(_style_value(val)) for val in data.values())...
[ "Return", "a", "bar", "graph", "as", "a", "string", "given", "a", "dictionary", "of", "data", "." ]
sloria/pypi-cli
python
https://github.com/sloria/pypi-cli/blob/beb007bf2bdd285209876ce2758982b5d8b54d5d/pypi_cli.py#L328-L352
[ "def", "bargraph", "(", "data", ",", "max_key_width", "=", "30", ")", ":", "lines", "=", "[", "]", "max_length", "=", "min", "(", "max", "(", "len", "(", "key", ")", "for", "key", "in", "data", ".", "keys", "(", ")", ")", ",", "max_key_width", ")...
beb007bf2bdd285209876ce2758982b5d8b54d5d
train
Package.version_downloads
Return a dictionary of version:download_count pairs.
pypi_cli.py
def version_downloads(self): """Return a dictionary of version:download_count pairs.""" ret = OrderedDict() for release, info in self.release_info: download_count = sum(file_['downloads'] for file_ in info) ret[release] = download_count return ret
def version_downloads(self): """Return a dictionary of version:download_count pairs.""" ret = OrderedDict() for release, info in self.release_info: download_count = sum(file_['downloads'] for file_ in info) ret[release] = download_count return ret
[ "Return", "a", "dictionary", "of", "version", ":", "download_count", "pairs", "." ]
sloria/pypi-cli
python
https://github.com/sloria/pypi-cli/blob/beb007bf2bdd285209876ce2758982b5d8b54d5d/pypi_cli.py#L387-L393
[ "def", "version_downloads", "(", "self", ")", ":", "ret", "=", "OrderedDict", "(", ")", "for", "release", ",", "info", "in", "self", ".", "release_info", ":", "download_count", "=", "sum", "(", "file_", "[", "'downloads'", "]", "for", "file_", "in", "inf...
beb007bf2bdd285209876ce2758982b5d8b54d5d
train
Package.max_version
Version with the most downloads. :return: A tuple of the form (version, n_downloads)
pypi_cli.py
def max_version(self): """Version with the most downloads. :return: A tuple of the form (version, n_downloads) """ data = self.version_downloads if not data: return None, 0 return max(data.items(), key=lambda item: item[1])
def max_version(self): """Version with the most downloads. :return: A tuple of the form (version, n_downloads) """ data = self.version_downloads if not data: return None, 0 return max(data.items(), key=lambda item: item[1])
[ "Version", "with", "the", "most", "downloads", "." ]
sloria/pypi-cli
python
https://github.com/sloria/pypi-cli/blob/beb007bf2bdd285209876ce2758982b5d8b54d5d/pypi_cli.py#L440-L448
[ "def", "max_version", "(", "self", ")", ":", "data", "=", "self", ".", "version_downloads", "if", "not", "data", ":", "return", "None", ",", "0", "return", "max", "(", "data", ".", "items", "(", ")", ",", "key", "=", "lambda", "item", ":", "item", ...
beb007bf2bdd285209876ce2758982b5d8b54d5d
train
Package.min_version
Version with the fewest downloads.
pypi_cli.py
def min_version(self): """Version with the fewest downloads.""" data = self.version_downloads if not data: return (None, 0) return min(data.items(), key=lambda item: item[1])
def min_version(self): """Version with the fewest downloads.""" data = self.version_downloads if not data: return (None, 0) return min(data.items(), key=lambda item: item[1])
[ "Version", "with", "the", "fewest", "downloads", "." ]
sloria/pypi-cli
python
https://github.com/sloria/pypi-cli/blob/beb007bf2bdd285209876ce2758982b5d8b54d5d/pypi_cli.py#L451-L456
[ "def", "min_version", "(", "self", ")", ":", "data", "=", "self", ".", "version_downloads", "if", "not", "data", ":", "return", "(", "None", ",", "0", ")", "return", "min", "(", "data", ".", "items", "(", ")", ",", "key", "=", "lambda", "item", ":"...
beb007bf2bdd285209876ce2758982b5d8b54d5d
train
F2D.elasprep
dx4, dy4, dx2dy2, D = elasprep(dx,dy,Te,E=1E11,nu=0.25) Defines the variables that are required to create the 2D finite difference solution coefficient matrix
gflex/f2d.py
def elasprep(self): """ dx4, dy4, dx2dy2, D = elasprep(dx,dy,Te,E=1E11,nu=0.25) Defines the variables that are required to create the 2D finite difference solution coefficient matrix """ if self.Method != 'SAS_NG': self.dx4 = self.dx**4 self.dy4 = self.dy**4 self.dx2...
def elasprep(self): """ dx4, dy4, dx2dy2, D = elasprep(dx,dy,Te,E=1E11,nu=0.25) Defines the variables that are required to create the 2D finite difference solution coefficient matrix """ if self.Method != 'SAS_NG': self.dx4 = self.dx**4 self.dy4 = self.dy**4 self.dx2...
[ "dx4", "dy4", "dx2dy2", "D", "=", "elasprep", "(", "dx", "dy", "Te", "E", "=", "1E11", "nu", "=", "0", ".", "25", ")", "Defines", "the", "variables", "that", "are", "required", "to", "create", "the", "2D", "finite", "difference", "solution", "coefficie...
awickert/gFlex
python
https://github.com/awickert/gFlex/blob/3ac32249375b0f8d342a142585d86ea4d905a5a0/gflex/f2d.py#L184-L196
[ "def", "elasprep", "(", "self", ")", ":", "if", "self", ".", "Method", "!=", "'SAS_NG'", ":", "self", ".", "dx4", "=", "self", ".", "dx", "**", "4", "self", ".", "dy4", "=", "self", ".", "dy", "**", "4", "self", ".", "dx2dy2", "=", "self", ".",...
3ac32249375b0f8d342a142585d86ea4d905a5a0
train
F2D.BC_selector_and_coeff_matrix_creator
Selects the boundary conditions E-W is for inside each panel N-S is for the block diagonal matrix ("with fringes") Then calls the function to build the diagonal matrix The current method of coefficient matrix construction utilizes longer-range symmetry in the coefficient matrix to build it block-wi...
gflex/f2d.py
def BC_selector_and_coeff_matrix_creator(self): """ Selects the boundary conditions E-W is for inside each panel N-S is for the block diagonal matrix ("with fringes") Then calls the function to build the diagonal matrix The current method of coefficient matrix construction utilizes longer-range...
def BC_selector_and_coeff_matrix_creator(self): """ Selects the boundary conditions E-W is for inside each panel N-S is for the block diagonal matrix ("with fringes") Then calls the function to build the diagonal matrix The current method of coefficient matrix construction utilizes longer-range...
[ "Selects", "the", "boundary", "conditions", "E", "-", "W", "is", "for", "inside", "each", "panel", "N", "-", "S", "is", "for", "the", "block", "diagonal", "matrix", "(", "with", "fringes", ")", "Then", "calls", "the", "function", "to", "build", "the", ...
awickert/gFlex
python
https://github.com/awickert/gFlex/blob/3ac32249375b0f8d342a142585d86ea4d905a5a0/gflex/f2d.py#L198-L246
[ "def", "BC_selector_and_coeff_matrix_creator", "(", "self", ")", ":", "# Zeroth, start the timer and print the boundary conditions to the screen", "self", ".", "coeff_start_time", "=", "time", ".", "time", "(", ")", "if", "self", ".", "Verbose", ":", "print", "(", "\"Bo...
3ac32249375b0f8d342a142585d86ea4d905a5a0
train
F2D.BC_Rigidity
Utility function to help implement boundary conditions by specifying them for and applying them to the elastic thickness grid
gflex/f2d.py
def BC_Rigidity(self): """ Utility function to help implement boundary conditions by specifying them for and applying them to the elastic thickness grid """ ######################################### # FLEXURAL RIGIDITY BOUNDARY CONDITIONS # ######################################### # W...
def BC_Rigidity(self): """ Utility function to help implement boundary conditions by specifying them for and applying them to the elastic thickness grid """ ######################################### # FLEXURAL RIGIDITY BOUNDARY CONDITIONS # ######################################### # W...
[ "Utility", "function", "to", "help", "implement", "boundary", "conditions", "by", "specifying", "them", "for", "and", "applying", "them", "to", "the", "elastic", "thickness", "grid" ]
awickert/gFlex
python
https://github.com/awickert/gFlex/blob/3ac32249375b0f8d342a142585d86ea4d905a5a0/gflex/f2d.py#L248-L334
[ "def", "BC_Rigidity", "(", "self", ")", ":", "#########################################", "# FLEXURAL RIGIDITY BOUNDARY CONDITIONS #", "#########################################", "# West", "if", "self", ".", "BC_W", "==", "'Periodic'", ":", "self", ".", "BC_Rigidity_W", "=",...
3ac32249375b0f8d342a142585d86ea4d905a5a0
train
F2D.get_coeff_values
Calculates the matrix of coefficients that is later used via sparse matrix solution techniques (scipy.sparse.linalg.spsolve) to compute the flexural response to the load. This step need only be performed once, and the coefficient matrix can very rapidly compute flexural solutions to any load. This makes...
gflex/f2d.py
def get_coeff_values(self): """ Calculates the matrix of coefficients that is later used via sparse matrix solution techniques (scipy.sparse.linalg.spsolve) to compute the flexural response to the load. This step need only be performed once, and the coefficient matrix can very rapidly compute flexur...
def get_coeff_values(self): """ Calculates the matrix of coefficients that is later used via sparse matrix solution techniques (scipy.sparse.linalg.spsolve) to compute the flexural response to the load. This step need only be performed once, and the coefficient matrix can very rapidly compute flexur...
[ "Calculates", "the", "matrix", "of", "coefficients", "that", "is", "later", "used", "via", "sparse", "matrix", "solution", "techniques", "(", "scipy", ".", "sparse", ".", "linalg", ".", "spsolve", ")", "to", "compute", "the", "flexural", "response", "to", "t...
awickert/gFlex
python
https://github.com/awickert/gFlex/blob/3ac32249375b0f8d342a142585d86ea4d905a5a0/gflex/f2d.py#L336-L540
[ "def", "get_coeff_values", "(", "self", ")", ":", "# don't want to keep typing \"self.\" everwhere!", "D", "=", "self", ".", "D", "drho", "=", "self", ".", "drho", "dx4", "=", "self", ".", "dx4", "dy4", "=", "self", ".", "dy4", "dx2dy2", "=", "self", ".", ...
3ac32249375b0f8d342a142585d86ea4d905a5a0
train
F2D.calc_max_flexural_wavelength
Returns the approximate maximum flexural wavelength This is important when padding of the grid is required: in Flexure (this code), grids are padded out to one maximum flexural wavelength, but in any case, the flexural wavelength is a good characteristic distance for any truncation limit
gflex/f2d.py
def calc_max_flexural_wavelength(self): """ Returns the approximate maximum flexural wavelength This is important when padding of the grid is required: in Flexure (this code), grids are padded out to one maximum flexural wavelength, but in any case, the flexural wavelength is a good characteristic...
def calc_max_flexural_wavelength(self): """ Returns the approximate maximum flexural wavelength This is important when padding of the grid is required: in Flexure (this code), grids are padded out to one maximum flexural wavelength, but in any case, the flexural wavelength is a good characteristic...
[ "Returns", "the", "approximate", "maximum", "flexural", "wavelength", "This", "is", "important", "when", "padding", "of", "the", "grid", "is", "required", ":", "in", "Flexure", "(", "this", "code", ")", "grids", "are", "padded", "out", "to", "one", "maximum"...
awickert/gFlex
python
https://github.com/awickert/gFlex/blob/3ac32249375b0f8d342a142585d86ea4d905a5a0/gflex/f2d.py#L1484-L1501
[ "def", "calc_max_flexural_wavelength", "(", "self", ")", ":", "if", "np", ".", "isscalar", "(", "self", ".", "D", ")", ":", "Dmax", "=", "self", ".", "D", "else", ":", "Dmax", "=", "self", ".", "D", ".", "max", "(", ")", "# This is an approximation if ...
3ac32249375b0f8d342a142585d86ea4d905a5a0
train
F2D.fd_solve
w = fd_solve() Sparse flexural response calculation. Can be performed by direct factorization with UMFpack (defuault) or by an iterative minimum residual technique These are both the fastest of the standard Scipy builtin techniques in their respective classes Requires the coefficient matrix f...
gflex/f2d.py
def fd_solve(self): """ w = fd_solve() Sparse flexural response calculation. Can be performed by direct factorization with UMFpack (defuault) or by an iterative minimum residual technique These are both the fastest of the standard Scipy builtin techniques in their respective classes R...
def fd_solve(self): """ w = fd_solve() Sparse flexural response calculation. Can be performed by direct factorization with UMFpack (defuault) or by an iterative minimum residual technique These are both the fastest of the standard Scipy builtin techniques in their respective classes R...
[ "w", "=", "fd_solve", "()", "Sparse", "flexural", "response", "calculation", ".", "Can", "be", "performed", "by", "direct", "factorization", "with", "UMFpack", "(", "defuault", ")", "or", "by", "an", "iterative", "minimum", "residual", "technique", "These", "a...
awickert/gFlex
python
https://github.com/awickert/gFlex/blob/3ac32249375b0f8d342a142585d86ea4d905a5a0/gflex/f2d.py#L1503-L1544
[ "def", "fd_solve", "(", "self", ")", ":", "if", "self", ".", "Debug", ":", "try", ":", "# Will fail if scalar", "print", "(", "\"self.Te\"", ",", "self", ".", "Te", ".", "shape", ")", "except", ":", "pass", "print", "(", "\"self.qs\"", ",", "self", "."...
3ac32249375b0f8d342a142585d86ea4d905a5a0
train
ripping_of_cds
Install the tools ripit and burnit in order to rip and burn audio cds. More info: http://forums.debian.net/viewtopic.php?f=16&t=36826
fabsetup/fabfile/setup/__init__.py
def ripping_of_cds(): '''Install the tools ripit and burnit in order to rip and burn audio cds. More info: http://forums.debian.net/viewtopic.php?f=16&t=36826 ''' # install and configure ripit install_package('ripit') install_file_legacy(path='~/.ripit/config', username=env.user) # install ...
def ripping_of_cds(): '''Install the tools ripit and burnit in order to rip and burn audio cds. More info: http://forums.debian.net/viewtopic.php?f=16&t=36826 ''' # install and configure ripit install_package('ripit') install_file_legacy(path='~/.ripit/config', username=env.user) # install ...
[ "Install", "the", "tools", "ripit", "and", "burnit", "in", "order", "to", "rip", "and", "burn", "audio", "cds", "." ]
theno/fabsetup
python
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabfile/setup/__init__.py#L34-L45
[ "def", "ripping_of_cds", "(", ")", ":", "# install and configure ripit", "install_package", "(", "'ripit'", ")", "install_file_legacy", "(", "path", "=", "'~/.ripit/config'", ",", "username", "=", "env", ".", "user", ")", "# install burnit", "run", "(", "'mkdir -p ...
ced728abff93551ba5677e63bc1bdc0ef5ca5777
train
i3
Install and customize the tiling window manager i3.
fabsetup/fabfile/setup/__init__.py
def i3(): '''Install and customize the tiling window manager i3.''' install_package('i3') install_file_legacy(path='~/.i3/config', username=env.user, repos_dir='repos') # setup: hide the mouse if not in use # in ~/.i3/config: 'exec /home/<USERNAME>/repos/hhpc/hhpc -i 10 &' install_packages(['ma...
def i3(): '''Install and customize the tiling window manager i3.''' install_package('i3') install_file_legacy(path='~/.i3/config', username=env.user, repos_dir='repos') # setup: hide the mouse if not in use # in ~/.i3/config: 'exec /home/<USERNAME>/repos/hhpc/hhpc -i 10 &' install_packages(['ma...
[ "Install", "and", "customize", "the", "tiling", "window", "manager", "i3", "." ]
theno/fabsetup
python
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabfile/setup/__init__.py#L78-L87
[ "def", "i3", "(", ")", ":", "install_package", "(", "'i3'", ")", "install_file_legacy", "(", "path", "=", "'~/.i3/config'", ",", "username", "=", "env", ".", "user", ",", "repos_dir", "=", "'repos'", ")", "# setup: hide the mouse if not in use", "# in ~/.i3/config...
ced728abff93551ba5677e63bc1bdc0ef5ca5777
train
solarized
Set solarized colors in urxvt, tmux, and vim. More Infos: * Getting solarized colors right with urxvt, st, tmux and vim: https://bbs.archlinux.org/viewtopic.php?id=164108 * Creating ~/.Xresources: https://wiki.archlinux.org/index.php/Rxvt-unicode#Creating_.7E.2F.Xresources * Select a good...
fabsetup/fabfile/setup/__init__.py
def solarized(): '''Set solarized colors in urxvt, tmux, and vim. More Infos: * Getting solarized colors right with urxvt, st, tmux and vim: https://bbs.archlinux.org/viewtopic.php?id=164108 * Creating ~/.Xresources: https://wiki.archlinux.org/index.php/Rxvt-unicode#Creating_.7E.2F.Xresour...
def solarized(): '''Set solarized colors in urxvt, tmux, and vim. More Infos: * Getting solarized colors right with urxvt, st, tmux and vim: https://bbs.archlinux.org/viewtopic.php?id=164108 * Creating ~/.Xresources: https://wiki.archlinux.org/index.php/Rxvt-unicode#Creating_.7E.2F.Xresour...
[ "Set", "solarized", "colors", "in", "urxvt", "tmux", "and", "vim", "." ]
theno/fabsetup
python
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabfile/setup/__init__.py#L92-L117
[ "def", "solarized", "(", ")", ":", "install_packages", "(", "[", "'rxvt-unicode'", ",", "'tmux'", ",", "'vim'", "]", ")", "install_file_legacy", "(", "'~/.Xresources'", ")", "if", "env", ".", "host_string", "==", "'localhost'", ":", "run", "(", "'xrdb ~/.Xres...
ced728abff93551ba5677e63bc1bdc0ef5ca5777
train
vim
Customize vim, install package manager pathogen and some vim-packages. pathogen will be installed as a git repo at ~/repos/vim-pathogen and activated in vim by a symbolic link at ~/.vim/autoload/pathogen.vim A ~/.vimrc will be installed which loads the package manager within of vim. The vim packages ...
fabsetup/fabfile/setup/__init__.py
def vim(): '''Customize vim, install package manager pathogen and some vim-packages. pathogen will be installed as a git repo at ~/repos/vim-pathogen and activated in vim by a symbolic link at ~/.vim/autoload/pathogen.vim A ~/.vimrc will be installed which loads the package manager within of vim. ...
def vim(): '''Customize vim, install package manager pathogen and some vim-packages. pathogen will be installed as a git repo at ~/repos/vim-pathogen and activated in vim by a symbolic link at ~/.vim/autoload/pathogen.vim A ~/.vimrc will be installed which loads the package manager within of vim. ...
[ "Customize", "vim", "install", "package", "manager", "pathogen", "and", "some", "vim", "-", "packages", "." ]
theno/fabsetup
python
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabfile/setup/__init__.py#L122-L167
[ "def", "vim", "(", ")", ":", "install_package", "(", "'vim'", ")", "print_msg", "(", "'## install ~/.vimrc\\n'", ")", "install_file_legacy", "(", "'~/.vimrc'", ")", "print_msg", "(", "'\\n## set up pathogen\\n'", ")", "run", "(", "'mkdir -p ~/.vim/autoload ~/.vim/bund...
ced728abff93551ba5677e63bc1bdc0ef5ca5777
train
pyenv
Install or update the pyenv python environment. Checkout or update the pyenv repo at ~/.pyenv and enable the pyenv. Pyenv wird also als Github-Repo "installiert" unter ~/.pyenv More info: * https://github.com/yyuu/pyenv * https://github.com/yyuu/pyenv/wiki/Common-build-problems#requirements ...
fabsetup/fabfile/setup/__init__.py
def pyenv(): '''Install or update the pyenv python environment. Checkout or update the pyenv repo at ~/.pyenv and enable the pyenv. Pyenv wird also als Github-Repo "installiert" unter ~/.pyenv More info: * https://github.com/yyuu/pyenv * https://github.com/yyuu/pyenv/wiki/Common-build-proble...
def pyenv(): '''Install or update the pyenv python environment. Checkout or update the pyenv repo at ~/.pyenv and enable the pyenv. Pyenv wird also als Github-Repo "installiert" unter ~/.pyenv More info: * https://github.com/yyuu/pyenv * https://github.com/yyuu/pyenv/wiki/Common-build-proble...
[ "Install", "or", "update", "the", "pyenv", "python", "environment", "." ]
theno/fabsetup
python
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabfile/setup/__init__.py#L172-L215
[ "def", "pyenv", "(", ")", ":", "install_packages", "(", "[", "'make'", ",", "'build-essential'", ",", "'libssl-dev'", ",", "'zlib1g-dev'", ",", "'libbz2-dev'", ",", "'libreadline-dev'", ",", "'libsqlite3-dev'", ",", "'wget'", ",", "'curl'", ",", "'llvm'", ",", ...
ced728abff93551ba5677e63bc1bdc0ef5ca5777
train
virtualbox_host
Install a VirtualBox host system. More Infos: * overview: https://wiki.ubuntuusers.de/VirtualBox/ * installation: https://wiki.ubuntuusers.de/VirtualBox/Installation/
fabsetup/fabfile/setup/__init__.py
def virtualbox_host(): '''Install a VirtualBox host system. More Infos: * overview: https://wiki.ubuntuusers.de/VirtualBox/ * installation: https://wiki.ubuntuusers.de/VirtualBox/Installation/ ''' if query_yes_no(question='Uninstall virtualbox-dkms?', default='yes'): run('sudo apt...
def virtualbox_host(): '''Install a VirtualBox host system. More Infos: * overview: https://wiki.ubuntuusers.de/VirtualBox/ * installation: https://wiki.ubuntuusers.de/VirtualBox/Installation/ ''' if query_yes_no(question='Uninstall virtualbox-dkms?', default='yes'): run('sudo apt...
[ "Install", "a", "VirtualBox", "host", "system", "." ]
theno/fabsetup
python
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabfile/setup/__init__.py#L220-L238
[ "def", "virtualbox_host", "(", ")", ":", "if", "query_yes_no", "(", "question", "=", "'Uninstall virtualbox-dkms?'", ",", "default", "=", "'yes'", ")", ":", "run", "(", "'sudo apt-get remove virtualbox-dkms'", ")", "install_packages", "(", "[", "'virtualbox'", ",", ...
ced728abff93551ba5677e63bc1bdc0ef5ca5777
train
server_customizations
Customize the server (user, authorized_keys, ...).
fabsetup/fabfile/setup/__init__.py
def server_customizations(): '''Customize the server (user, authorized_keys, ...).''' username = env.user env.user = 'root' # create user all_users = run('cut -d: -f1 /etc/passwd').split() if username not in all_users: host = env.host run(flo('adduser {username}')) #...
def server_customizations(): '''Customize the server (user, authorized_keys, ...).''' username = env.user env.user = 'root' # create user all_users = run('cut -d: -f1 /etc/passwd').split() if username not in all_users: host = env.host run(flo('adduser {username}')) #...
[ "Customize", "the", "server", "(", "user", "authorized_keys", "...", ")", "." ]
theno/fabsetup
python
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabfile/setup/__init__.py#L243-L272
[ "def", "server_customizations", "(", ")", ":", "username", "=", "env", ".", "user", "env", ".", "user", "=", "'root'", "# create user", "all_users", "=", "run", "(", "'cut -d: -f1 /etc/passwd'", ")", ".", "split", "(", ")", "if", "username", "not", "in", "...
ced728abff93551ba5677e63bc1bdc0ef5ca5777
train
pencil2
Install or update latest Pencil version 2, a GUI prototyping tool. Tip: For svg exports displayed proper in other programs (eg. inkscape, okular, reveal.js presentations) only use the 'Common Shapes' and 'Desktop - Sketchy GUI' elements. More info: github repo (forked version 2): https://githu...
fabsetup/fabfile/setup/__init__.py
def pencil2(): '''Install or update latest Pencil version 2, a GUI prototyping tool. Tip: For svg exports displayed proper in other programs (eg. inkscape, okular, reveal.js presentations) only use the 'Common Shapes' and 'Desktop - Sketchy GUI' elements. More info: github repo (forked ver...
def pencil2(): '''Install or update latest Pencil version 2, a GUI prototyping tool. Tip: For svg exports displayed proper in other programs (eg. inkscape, okular, reveal.js presentations) only use the 'Common Shapes' and 'Desktop - Sketchy GUI' elements. More info: github repo (forked ver...
[ "Install", "or", "update", "latest", "Pencil", "version", "2", "a", "GUI", "prototyping", "tool", "." ]
theno/fabsetup
python
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabfile/setup/__init__.py#L277-L304
[ "def", "pencil2", "(", ")", ":", "repo_name", "=", "'pencil2'", "repo_dir", "=", "flo", "(", "'~/repos/{repo_name}'", ")", "print_msg", "(", "'## fetch latest pencil\\n'", ")", "checkup_git_repo_legacy", "(", "url", "=", "'https://github.com/prikhi/pencil.git'", ",", ...
ced728abff93551ba5677e63bc1bdc0ef5ca5777
train
pencil3
Install or update latest Pencil version 3, a GUI prototyping tool. While it is the newer one and the GUI is more fancy, it is the "more beta" version of pencil. For exmaple, to display a svg export may fail from within a reveal.js presentation. More info: Homepage: http://pencil.evolus.vn/Nex...
fabsetup/fabfile/setup/__init__.py
def pencil3(): '''Install or update latest Pencil version 3, a GUI prototyping tool. While it is the newer one and the GUI is more fancy, it is the "more beta" version of pencil. For exmaple, to display a svg export may fail from within a reveal.js presentation. More info: Homepage: http:...
def pencil3(): '''Install or update latest Pencil version 3, a GUI prototyping tool. While it is the newer one and the GUI is more fancy, it is the "more beta" version of pencil. For exmaple, to display a svg export may fail from within a reveal.js presentation. More info: Homepage: http:...
[ "Install", "or", "update", "latest", "Pencil", "version", "3", "a", "GUI", "prototyping", "tool", "." ]
theno/fabsetup
python
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabfile/setup/__init__.py#L309-L328
[ "def", "pencil3", "(", ")", ":", "repo_name", "=", "'pencil3'", "repo_dir", "=", "flo", "(", "'~/repos/{repo_name}'", ")", "print_msg", "(", "'## fetch latest pencil\\n'", ")", "checkup_git_repo_legacy", "(", "url", "=", "'https://github.com/evolus/pencil.git'", ",", ...
ced728abff93551ba5677e63bc1bdc0ef5ca5777
train
server_prepare_root_bin_dir
Install custom commands for user root at '/root/bin/'.
fabsetup/fabfile/setup/__init__.py
def server_prepare_root_bin_dir(): '''Install custom commands for user root at '/root/bin/'.''' commands = ['run_backup'] for command in commands: install_file_legacy(flo('/root/bin/{command}'), sudo=True) sudo(flo('chmod 755 /root/bin/{command}')) if command == 'run_backup': ...
def server_prepare_root_bin_dir(): '''Install custom commands for user root at '/root/bin/'.''' commands = ['run_backup'] for command in commands: install_file_legacy(flo('/root/bin/{command}'), sudo=True) sudo(flo('chmod 755 /root/bin/{command}')) if command == 'run_backup': ...
[ "Install", "custom", "commands", "for", "user", "root", "at", "/", "root", "/", "bin", "/", "." ]
theno/fabsetup
python
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabfile/setup/__init__.py#L332-L339
[ "def", "server_prepare_root_bin_dir", "(", ")", ":", "commands", "=", "[", "'run_backup'", "]", "for", "command", "in", "commands", ":", "install_file_legacy", "(", "flo", "(", "'/root/bin/{command}'", ")", ",", "sudo", "=", "True", ")", "sudo", "(", "flo", ...
ced728abff93551ba5677e63bc1bdc0ef5ca5777
train
powerline_shell
Install and set up powerline-shell prompt. More infos: * https://github.com/banga/powerline-shell * https://github.com/ohnonot/powerline-shell * https://askubuntu.com/questions/283908/how-can-i-install-and-use-powerline-plugin
fabsetup/fabfile/setup/__init__.py
def powerline_shell(): '''Install and set up powerline-shell prompt. More infos: * https://github.com/banga/powerline-shell * https://github.com/ohnonot/powerline-shell * https://askubuntu.com/questions/283908/how-can-i-install-and-use-powerline-plugin ''' assert env.host == 'localhost',...
def powerline_shell(): '''Install and set up powerline-shell prompt. More infos: * https://github.com/banga/powerline-shell * https://github.com/ohnonot/powerline-shell * https://askubuntu.com/questions/283908/how-can-i-install-and-use-powerline-plugin ''' assert env.host == 'localhost',...
[ "Install", "and", "set", "up", "powerline", "-", "shell", "prompt", "." ]
theno/fabsetup
python
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabfile/setup/__init__.py#L378-L423
[ "def", "powerline_shell", "(", ")", ":", "assert", "env", ".", "host", "==", "'localhost'", ",", "'This task cannot run on a remote host'", "# set up fonts for powerline", "checkup_git_repo_legacy", "(", "'https://github.com/powerline/fonts.git'", ",", "name", "=", "'powerlin...
ced728abff93551ba5677e63bc1bdc0ef5ca5777
train
telegram
Install Telegram desktop client for linux (x64). More infos: https://telegram.org https://desktop.telegram.org/
fabsetup/fabfile/setup/__init__.py
def telegram(): '''Install Telegram desktop client for linux (x64). More infos: https://telegram.org https://desktop.telegram.org/ ''' if not exists('~/bin/Telegram', msg='Download and install Telegram:'): run('mkdir -p /tmp/telegram') run('cd /tmp/telegram && wget https:/...
def telegram(): '''Install Telegram desktop client for linux (x64). More infos: https://telegram.org https://desktop.telegram.org/ ''' if not exists('~/bin/Telegram', msg='Download and install Telegram:'): run('mkdir -p /tmp/telegram') run('cd /tmp/telegram && wget https:/...
[ "Install", "Telegram", "desktop", "client", "for", "linux", "(", "x64", ")", "." ]
theno/fabsetup
python
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabfile/setup/__init__.py#L428-L445
[ "def", "telegram", "(", ")", ":", "if", "not", "exists", "(", "'~/bin/Telegram'", ",", "msg", "=", "'Download and install Telegram:'", ")", ":", "run", "(", "'mkdir -p /tmp/telegram'", ")", "run", "(", "'cd /tmp/telegram && wget https://telegram.org/dl/desktop/linux'", ...
ced728abff93551ba5677e63bc1bdc0ef5ca5777
train
DriftTool._init_boto3_clients
The utililty requires boto3 clients to CloudFormation. Args: None Returns: Good or Bad; True or False
stackility/drift.py
def _init_boto3_clients(self, profile, region): """ The utililty requires boto3 clients to CloudFormation. Args: None Returns: Good or Bad; True or False """ try: session = None if profile and region: sessi...
def _init_boto3_clients(self, profile, region): """ The utililty requires boto3 clients to CloudFormation. Args: None Returns: Good or Bad; True or False """ try: session = None if profile and region: sessi...
[ "The", "utililty", "requires", "boto3", "clients", "to", "CloudFormation", "." ]
muckamuck/stackility
python
https://github.com/muckamuck/stackility/blob/b1696f02661134d31b99b4dea7c0d21d09482d33/stackility/drift.py#L54-L79
[ "def", "_init_boto3_clients", "(", "self", ",", "profile", ",", "region", ")", ":", "try", ":", "session", "=", "None", "if", "profile", "and", "region", ":", "session", "=", "boto3", ".", "session", ".", "Session", "(", "profile_name", "=", "profile", "...
b1696f02661134d31b99b4dea7c0d21d09482d33
train
DriftTool.determine_drift
Determine the drift of the stack. Args: None Returns: Good or Bad; True or False
stackility/drift.py
def determine_drift(self): """ Determine the drift of the stack. Args: None Returns: Good or Bad; True or False """ try: response = self._cloud_formation.detect_stack_drift(StackName=self._stack_name) drift_request_id = re...
def determine_drift(self): """ Determine the drift of the stack. Args: None Returns: Good or Bad; True or False """ try: response = self._cloud_formation.detect_stack_drift(StackName=self._stack_name) drift_request_id = re...
[ "Determine", "the", "drift", "of", "the", "stack", "." ]
muckamuck/stackility
python
https://github.com/muckamuck/stackility/blob/b1696f02661134d31b99b4dea7c0d21d09482d33/stackility/drift.py#L81-L126
[ "def", "determine_drift", "(", "self", ")", ":", "try", ":", "response", "=", "self", ".", "_cloud_formation", ".", "detect_stack_drift", "(", "StackName", "=", "self", ".", "_stack_name", ")", "drift_request_id", "=", "response", ".", "get", "(", "'StackDrift...
b1696f02661134d31b99b4dea7c0d21d09482d33
train
DriftTool._print_drift_report
Report the drift of the stack. Args: None Returns: Good or Bad; True or False Note: not yet implemented
stackility/drift.py
def _print_drift_report(self): """ Report the drift of the stack. Args: None Returns: Good or Bad; True or False Note: not yet implemented """ try: response = self._cloud_formation.describe_stack_resources(StackName=self._sta...
def _print_drift_report(self): """ Report the drift of the stack. Args: None Returns: Good or Bad; True or False Note: not yet implemented """ try: response = self._cloud_formation.describe_stack_resources(StackName=self._sta...
[ "Report", "the", "drift", "of", "the", "stack", "." ]
muckamuck/stackility
python
https://github.com/muckamuck/stackility/blob/b1696f02661134d31b99b4dea7c0d21d09482d33/stackility/drift.py#L128-L162
[ "def", "_print_drift_report", "(", "self", ")", ":", "try", ":", "response", "=", "self", ".", "_cloud_formation", ".", "describe_stack_resources", "(", "StackName", "=", "self", ".", "_stack_name", ")", "rows", "=", "[", "]", "for", "resource", "in", "respo...
b1696f02661134d31b99b4dea7c0d21d09482d33
train
get_setting
Looks for settings under DJANGO_HISTORY_SETTINGS, supporting dot notation for nested lookups, eg. get_setting('EXCLUDE_CHANGES.fields')
djangohistory/helpers.py
def get_setting(name): """ Looks for settings under DJANGO_HISTORY_SETTINGS, supporting dot notation for nested lookups, eg. get_setting('EXCLUDE_CHANGES.fields') """ dh = getattr(settings, 'DJANGO_HISTORY_SETTINGS', {}) result = None for k in name.split('.'): if dh is None: cont...
def get_setting(name): """ Looks for settings under DJANGO_HISTORY_SETTINGS, supporting dot notation for nested lookups, eg. get_setting('EXCLUDE_CHANGES.fields') """ dh = getattr(settings, 'DJANGO_HISTORY_SETTINGS', {}) result = None for k in name.split('.'): if dh is None: cont...
[ "Looks", "for", "settings", "under", "DJANGO_HISTORY_SETTINGS", "supporting", "dot", "notation", "for", "nested", "lookups", "eg", ".", "get_setting", "(", "EXCLUDE_CHANGES", ".", "fields", ")" ]
futurice/django-history
python
https://github.com/futurice/django-history/blob/8b618c331d50aa821182fed16090792993a1096b/djangohistory/helpers.py#L17-L27
[ "def", "get_setting", "(", "name", ")", ":", "dh", "=", "getattr", "(", "settings", ",", "'DJANGO_HISTORY_SETTINGS'", ",", "{", "}", ")", "result", "=", "None", "for", "k", "in", "name", ".", "split", "(", "'.'", ")", ":", "if", "dh", "is", "None", ...
8b618c331d50aa821182fed16090792993a1096b
train
CryptProtectData
Encrypt data
jaraco/windows/dpapi.py
def CryptProtectData( data, description=None, optional_entropy=None, prompt_struct=None, flags=0, ): """ Encrypt data """ data_in = DATA_BLOB(data) entropy = DATA_BLOB(optional_entropy) if optional_entropy else None data_out = DATA_BLOB() res = _CryptProtectData( data_in, description, entropy, None, ...
def CryptProtectData( data, description=None, optional_entropy=None, prompt_struct=None, flags=0, ): """ Encrypt data """ data_in = DATA_BLOB(data) entropy = DATA_BLOB(optional_entropy) if optional_entropy else None data_out = DATA_BLOB() res = _CryptProtectData( data_in, description, entropy, None, ...
[ "Encrypt", "data" ]
jaraco/jaraco.windows
python
https://github.com/jaraco/jaraco.windows/blob/51811efed50b46ad08daa25408a1cc806bc8d519/jaraco/windows/dpapi.py#L103-L126
[ "def", "CryptProtectData", "(", "data", ",", "description", "=", "None", ",", "optional_entropy", "=", "None", ",", "prompt_struct", "=", "None", ",", "flags", "=", "0", ",", ")", ":", "data_in", "=", "DATA_BLOB", "(", "data", ")", "entropy", "=", "DATA_...
51811efed50b46ad08daa25408a1cc806bc8d519
train
CryptUnprotectData
Returns a tuple of (description, data) where description is the the description that was passed to the CryptProtectData call and data is the decrypted result.
jaraco/windows/dpapi.py
def CryptUnprotectData( data, optional_entropy=None, prompt_struct=None, flags=0): """ Returns a tuple of (description, data) where description is the the description that was passed to the CryptProtectData call and data is the decrypted result. """ data_in = DATA_BLOB(data) entropy = DATA_BLOB(optional_entropy...
def CryptUnprotectData( data, optional_entropy=None, prompt_struct=None, flags=0): """ Returns a tuple of (description, data) where description is the the description that was passed to the CryptProtectData call and data is the decrypted result. """ data_in = DATA_BLOB(data) entropy = DATA_BLOB(optional_entropy...
[ "Returns", "a", "tuple", "of", "(", "description", "data", ")", "where", "description", "is", "the", "the", "description", "that", "was", "passed", "to", "the", "CryptProtectData", "call", "and", "data", "is", "the", "decrypted", "result", "." ]
jaraco/jaraco.windows
python
https://github.com/jaraco/jaraco.windows/blob/51811efed50b46ad08daa25408a1cc806bc8d519/jaraco/windows/dpapi.py#L129-L155
[ "def", "CryptUnprotectData", "(", "data", ",", "optional_entropy", "=", "None", ",", "prompt_struct", "=", "None", ",", "flags", "=", "0", ")", ":", "data_in", "=", "DATA_BLOB", "(", "data", ")", "entropy", "=", "DATA_BLOB", "(", "optional_entropy", ")", "...
51811efed50b46ad08daa25408a1cc806bc8d519
train
DATA_BLOB.set_data
Use this method to set the data for this blob
jaraco/windows/dpapi.py
def set_data(self, data): "Use this method to set the data for this blob" if data is None: self.data_size = 0 self.data = None return self.data_size = len(data) # create a string buffer so that null bytes aren't interpreted # as the end of the string self.data = ctypes.cast(ctypes.create_string_bu...
def set_data(self, data): "Use this method to set the data for this blob" if data is None: self.data_size = 0 self.data = None return self.data_size = len(data) # create a string buffer so that null bytes aren't interpreted # as the end of the string self.data = ctypes.cast(ctypes.create_string_bu...
[ "Use", "this", "method", "to", "set", "the", "data", "for", "this", "blob" ]
jaraco/jaraco.windows
python
https://github.com/jaraco/jaraco.windows/blob/51811efed50b46ad08daa25408a1cc806bc8d519/jaraco/windows/dpapi.py#L43-L52
[ "def", "set_data", "(", "self", ",", "data", ")", ":", "if", "data", "is", "None", ":", "self", ".", "data_size", "=", "0", "self", ".", "data", "=", "None", "return", "self", ".", "data_size", "=", "len", "(", "data", ")", "# create a string buffer so...
51811efed50b46ad08daa25408a1cc806bc8d519
train
DATA_BLOB.get_data
Get the data for this blob
jaraco/windows/dpapi.py
def get_data(self): "Get the data for this blob" array = ctypes.POINTER(ctypes.c_char * len(self)) return ctypes.cast(self.data, array).contents.raw
def get_data(self): "Get the data for this blob" array = ctypes.POINTER(ctypes.c_char * len(self)) return ctypes.cast(self.data, array).contents.raw
[ "Get", "the", "data", "for", "this", "blob" ]
jaraco/jaraco.windows
python
https://github.com/jaraco/jaraco.windows/blob/51811efed50b46ad08daa25408a1cc806bc8d519/jaraco/windows/dpapi.py#L54-L57
[ "def", "get_data", "(", "self", ")", ":", "array", "=", "ctypes", ".", "POINTER", "(", "ctypes", ".", "c_char", "*", "len", "(", "self", ")", ")", "return", "ctypes", ".", "cast", "(", "self", ".", "data", ",", "array", ")", ".", "contents", ".", ...
51811efed50b46ad08daa25408a1cc806bc8d519
train
query_input
Ask a question for input via raw_input() and return their answer. "question" is a string that is presented to the user. "default" is the presumed answer if the user just hits <Enter>. The "answer" return value is a str.
fabsetup/utils.py
def query_input(question, default=None, color=default_color): """Ask a question for input via raw_input() and return their answer. "question" is a string that is presented to the user. "default" is the presumed answer if the user just hits <Enter>. The "answer" return value is a str. """ if de...
def query_input(question, default=None, color=default_color): """Ask a question for input via raw_input() and return their answer. "question" is a string that is presented to the user. "default" is the presumed answer if the user just hits <Enter>. The "answer" return value is a str. """ if de...
[ "Ask", "a", "question", "for", "input", "via", "raw_input", "()", "and", "return", "their", "answer", "." ]
theno/fabsetup
python
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/utils.py#L232-L253
[ "def", "query_input", "(", "question", ",", "default", "=", "None", ",", "color", "=", "default_color", ")", ":", "if", "default", "is", "None", "or", "default", "==", "''", ":", "prompt", "=", "' '", "elif", "type", "(", "default", ")", "==", "str", ...
ced728abff93551ba5677e63bc1bdc0ef5ca5777
train
git_ssh_or_die
Check if a ssh-key is created and imported in github. Else, exit with return value 1 (die).
fabsetup/fabfile/__init__.py
def git_ssh_or_die(username, key_dir='~/.ssh'): ''' Check if a ssh-key is created and imported in github. Else, exit with return value 1 (die). ''' key_dir_expanded = os.path.expanduser(key_dir) # ssh pub key dictionary pub_keys = [] # check if ~/.ssh exists, if not die if not os.path....
def git_ssh_or_die(username, key_dir='~/.ssh'): ''' Check if a ssh-key is created and imported in github. Else, exit with return value 1 (die). ''' key_dir_expanded = os.path.expanduser(key_dir) # ssh pub key dictionary pub_keys = [] # check if ~/.ssh exists, if not die if not os.path....
[ "Check", "if", "a", "ssh", "-", "key", "is", "created", "and", "imported", "in", "github", ".", "Else", "exit", "with", "return", "value", "1", "(", "die", ")", "." ]
theno/fabsetup
python
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabfile/__init__.py#L194-L243
[ "def", "git_ssh_or_die", "(", "username", ",", "key_dir", "=", "'~/.ssh'", ")", ":", "key_dir_expanded", "=", "os", ".", "path", ".", "expanduser", "(", "key_dir", ")", "# ssh pub key dictionary", "pub_keys", "=", "[", "]", "# check if ~/.ssh exists, if not die", ...
ced728abff93551ba5677e63bc1bdc0ef5ca5777
train
new_addon
Create a repository for a new fabsetup-task addon. The repo will contain the fabsetup addon boilerplate. Running this task you have to enter: * your github user account (your pypi account should be the same or similar) * addon name * task name * headline, short description, and touched (and cr...
fabsetup/fabfile/__init__.py
def new_addon(): '''Create a repository for a new fabsetup-task addon. The repo will contain the fabsetup addon boilerplate. Running this task you have to enter: * your github user account (your pypi account should be the same or similar) * addon name * task name * headline, short descript...
def new_addon(): '''Create a repository for a new fabsetup-task addon. The repo will contain the fabsetup addon boilerplate. Running this task you have to enter: * your github user account (your pypi account should be the same or similar) * addon name * task name * headline, short descript...
[ "Create", "a", "repository", "for", "a", "new", "fabsetup", "-", "task", "addon", "." ]
theno/fabsetup
python
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabfile/__init__.py#L366-L457
[ "def", "new_addon", "(", ")", ":", "author", ",", "author_email", "=", "git_name_and_email_or_die", "(", ")", "username", "=", "query_input", "(", "'github username:'", ")", "git_ssh_or_die", "(", "username", ")", "addonname", "=", "query_input", "(", "'\\naddon n...
ced728abff93551ba5677e63bc1bdc0ef5ca5777
train
printMetaDataFor
Prints metadata for given location. :param archive: CombineArchive instance :param location: :return:
examples/python/printExample.py
def printMetaDataFor(archive, location): """ Prints metadata for given location. :param archive: CombineArchive instance :param location: :return: """ desc = archive.getMetadataForLocation(location) if desc.isEmpty(): print(" no metadata for '{0}'".format(location)) return ...
def printMetaDataFor(archive, location): """ Prints metadata for given location. :param archive: CombineArchive instance :param location: :return: """ desc = archive.getMetadataForLocation(location) if desc.isEmpty(): print(" no metadata for '{0}'".format(location)) return ...
[ "Prints", "metadata", "for", "given", "location", "." ]
sbmlteam/libCombine
python
https://github.com/sbmlteam/libCombine/blob/d7c11a90129dedbcc8bdba8d204be03f1dd0c3e4/examples/python/printExample.py#L11-L31
[ "def", "printMetaDataFor", "(", "archive", ",", "location", ")", ":", "desc", "=", "archive", ".", "getMetadataForLocation", "(", "location", ")", "if", "desc", ".", "isEmpty", "(", ")", ":", "print", "(", "\" no metadata for '{0}'\"", ".", "format", "(", "...
d7c11a90129dedbcc8bdba8d204be03f1dd0c3e4
train
printArchive
Prints content of combine archive :param fileName: path of archive :return: None
examples/python/printExample.py
def printArchive(fileName): """ Prints content of combine archive :param fileName: path of archive :return: None """ archive = CombineArchive() if archive.initializeFromArchive(fileName) is None: print("Invalid Combine Archive") return None print('*'*80) print('Print ar...
def printArchive(fileName): """ Prints content of combine archive :param fileName: path of archive :return: None """ archive = CombineArchive() if archive.initializeFromArchive(fileName) is None: print("Invalid Combine Archive") return None print('*'*80) print('Print ar...
[ "Prints", "content", "of", "combine", "archive" ]
sbmlteam/libCombine
python
https://github.com/sbmlteam/libCombine/blob/d7c11a90129dedbcc8bdba8d204be03f1dd0c3e4/examples/python/printExample.py#L34-L65
[ "def", "printArchive", "(", "fileName", ")", ":", "archive", "=", "CombineArchive", "(", ")", "if", "archive", ".", "initializeFromArchive", "(", "fileName", ")", "is", "None", ":", "print", "(", "\"Invalid Combine Archive\"", ")", "return", "None", "print", "...
d7c11a90129dedbcc8bdba8d204be03f1dd0c3e4
train
mklink
Like cmd.exe's mklink except it will infer directory status of the target.
jaraco/windows/filesystem/__init__.py
def mklink(): """ Like cmd.exe's mklink except it will infer directory status of the target. """ from optparse import OptionParser parser = OptionParser(usage="usage: %prog [options] link target") parser.add_option( '-d', '--directory', help="Target is a directory (only necessary if not present)", action="...
def mklink(): """ Like cmd.exe's mklink except it will infer directory status of the target. """ from optparse import OptionParser parser = OptionParser(usage="usage: %prog [options] link target") parser.add_option( '-d', '--directory', help="Target is a directory (only necessary if not present)", action="...
[ "Like", "cmd", ".", "exe", "s", "mklink", "except", "it", "will", "infer", "directory", "status", "of", "the", "target", "." ]
jaraco/jaraco.windows
python
https://github.com/jaraco/jaraco.windows/blob/51811efed50b46ad08daa25408a1cc806bc8d519/jaraco/windows/filesystem/__init__.py#L28-L45
[ "def", "mklink", "(", ")", ":", "from", "optparse", "import", "OptionParser", "parser", "=", "OptionParser", "(", "usage", "=", "\"usage: %prog [options] link target\"", ")", "parser", ".", "add_option", "(", "'-d'", ",", "'--directory'", ",", "help", "=", "\"Ta...
51811efed50b46ad08daa25408a1cc806bc8d519
train
_is_target_a_directory
If creating a symlink from link to a target, determine if target is a directory (relative to dirname(link)).
jaraco/windows/filesystem/__init__.py
def _is_target_a_directory(link, rel_target): """ If creating a symlink from link to a target, determine if target is a directory (relative to dirname(link)). """ target = os.path.join(os.path.dirname(link), rel_target) return os.path.isdir(target)
def _is_target_a_directory(link, rel_target): """ If creating a symlink from link to a target, determine if target is a directory (relative to dirname(link)). """ target = os.path.join(os.path.dirname(link), rel_target) return os.path.isdir(target)
[ "If", "creating", "a", "symlink", "from", "link", "to", "a", "target", "determine", "if", "target", "is", "a", "directory", "(", "relative", "to", "dirname", "(", "link", "))", "." ]
jaraco/jaraco.windows
python
https://github.com/jaraco/jaraco.windows/blob/51811efed50b46ad08daa25408a1cc806bc8d519/jaraco/windows/filesystem/__init__.py#L48-L54
[ "def", "_is_target_a_directory", "(", "link", ",", "rel_target", ")", ":", "target", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "link", ")", ",", "rel_target", ")", "return", "os", ".", "path", ".", "isdir", "("...
51811efed50b46ad08daa25408a1cc806bc8d519
train
symlink
An implementation of os.symlink for Windows (Vista and greater)
jaraco/windows/filesystem/__init__.py
def symlink(target, link, target_is_directory=False): """ An implementation of os.symlink for Windows (Vista and greater) """ target_is_directory = ( target_is_directory or _is_target_a_directory(link, target) ) # normalize the target (MS symlinks don't respect forward slashes) target = os.path.normpath(targ...
def symlink(target, link, target_is_directory=False): """ An implementation of os.symlink for Windows (Vista and greater) """ target_is_directory = ( target_is_directory or _is_target_a_directory(link, target) ) # normalize the target (MS symlinks don't respect forward slashes) target = os.path.normpath(targ...
[ "An", "implementation", "of", "os", ".", "symlink", "for", "Windows", "(", "Vista", "and", "greater", ")" ]
jaraco/jaraco.windows
python
https://github.com/jaraco/jaraco.windows/blob/51811efed50b46ad08daa25408a1cc806bc8d519/jaraco/windows/filesystem/__init__.py#L57-L68
[ "def", "symlink", "(", "target", ",", "link", ",", "target_is_directory", "=", "False", ")", ":", "target_is_directory", "=", "(", "target_is_directory", "or", "_is_target_a_directory", "(", "link", ",", "target", ")", ")", "# normalize the target (MS symlinks don't r...
51811efed50b46ad08daa25408a1cc806bc8d519
train
is_reparse_point
Determine if the given path is a reparse point. Return False if the file does not exist or the file attributes cannot be determined.
jaraco/windows/filesystem/__init__.py
def is_reparse_point(path): """ Determine if the given path is a reparse point. Return False if the file does not exist or the file attributes cannot be determined. """ res = api.GetFileAttributes(path) return ( res != api.INVALID_FILE_ATTRIBUTES and bool(res & api.FILE_ATTRIBUTE_REPARSE_POINT) )
def is_reparse_point(path): """ Determine if the given path is a reparse point. Return False if the file does not exist or the file attributes cannot be determined. """ res = api.GetFileAttributes(path) return ( res != api.INVALID_FILE_ATTRIBUTES and bool(res & api.FILE_ATTRIBUTE_REPARSE_POINT) )
[ "Determine", "if", "the", "given", "path", "is", "a", "reparse", "point", ".", "Return", "False", "if", "the", "file", "does", "not", "exist", "or", "the", "file", "attributes", "cannot", "be", "determined", "." ]
jaraco/jaraco.windows
python
https://github.com/jaraco/jaraco.windows/blob/51811efed50b46ad08daa25408a1cc806bc8d519/jaraco/windows/filesystem/__init__.py#L78-L88
[ "def", "is_reparse_point", "(", "path", ")", ":", "res", "=", "api", ".", "GetFileAttributes", "(", "path", ")", "return", "(", "res", "!=", "api", ".", "INVALID_FILE_ATTRIBUTES", "and", "bool", "(", "res", "&", "api", ".", "FILE_ATTRIBUTE_REPARSE_POINT", ")...
51811efed50b46ad08daa25408a1cc806bc8d519
train
_patch_path
r""" Paths have a max length of api.MAX_PATH characters (260). If a target path is longer than that, it needs to be made absolute and prepended with \\?\ in order to work with API calls. See http://msdn.microsoft.com/en-us/library/aa365247%28v=vs.85%29.aspx for details.
jaraco/windows/filesystem/__init__.py
def _patch_path(path): r""" Paths have a max length of api.MAX_PATH characters (260). If a target path is longer than that, it needs to be made absolute and prepended with \\?\ in order to work with API calls. See http://msdn.microsoft.com/en-us/library/aa365247%28v=vs.85%29.aspx for details. """ if path.starts...
def _patch_path(path): r""" Paths have a max length of api.MAX_PATH characters (260). If a target path is longer than that, it needs to be made absolute and prepended with \\?\ in order to work with API calls. See http://msdn.microsoft.com/en-us/library/aa365247%28v=vs.85%29.aspx for details. """ if path.starts...
[ "r", "Paths", "have", "a", "max", "length", "of", "api", ".", "MAX_PATH", "characters", "(", "260", ")", ".", "If", "a", "target", "path", "is", "longer", "than", "that", "it", "needs", "to", "be", "made", "absolute", "and", "prepended", "with", "\\\\"...
jaraco/jaraco.windows
python
https://github.com/jaraco/jaraco.windows/blob/51811efed50b46ad08daa25408a1cc806bc8d519/jaraco/windows/filesystem/__init__.py#L96-L110
[ "def", "_patch_path", "(", "path", ")", ":", "if", "path", ".", "startswith", "(", "'\\\\\\\\?\\\\'", ")", ":", "return", "path", "abs_path", "=", "os", ".", "path", ".", "abspath", "(", "path", ")", "if", "not", "abs_path", "[", "1", "]", "==", "':'...
51811efed50b46ad08daa25408a1cc806bc8d519
train
is_symlink
Assuming path is a reparse point, determine if it's a symlink.
jaraco/windows/filesystem/__init__.py
def is_symlink(path): """ Assuming path is a reparse point, determine if it's a symlink. """ path = _patch_path(path) try: return _is_symlink(next(find_files(path))) # comment below workaround for PyCQA/pyflakes#376 except WindowsError as orig_error: # noqa: F841 tmpl = "Error accessing {path}: {orig_error....
def is_symlink(path): """ Assuming path is a reparse point, determine if it's a symlink. """ path = _patch_path(path) try: return _is_symlink(next(find_files(path))) # comment below workaround for PyCQA/pyflakes#376 except WindowsError as orig_error: # noqa: F841 tmpl = "Error accessing {path}: {orig_error....
[ "Assuming", "path", "is", "a", "reparse", "point", "determine", "if", "it", "s", "a", "symlink", "." ]
jaraco/jaraco.windows
python
https://github.com/jaraco/jaraco.windows/blob/51811efed50b46ad08daa25408a1cc806bc8d519/jaraco/windows/filesystem/__init__.py#L113-L123
[ "def", "is_symlink", "(", "path", ")", ":", "path", "=", "_patch_path", "(", "path", ")", "try", ":", "return", "_is_symlink", "(", "next", "(", "find_files", "(", "path", ")", ")", ")", "# comment below workaround for PyCQA/pyflakes#376", "except", "WindowsErro...
51811efed50b46ad08daa25408a1cc806bc8d519
train
find_files
r""" A pythonic wrapper around the FindFirstFile/FindNextFile win32 api. >>> root_files = tuple(find_files(r'c:\*')) >>> len(root_files) > 1 True >>> root_files[0].filename == root_files[1].filename False This test might fail on a non-standard installation >>> 'Windows' in (fd.filename for fd in root_files) ...
jaraco/windows/filesystem/__init__.py
def find_files(spec): r""" A pythonic wrapper around the FindFirstFile/FindNextFile win32 api. >>> root_files = tuple(find_files(r'c:\*')) >>> len(root_files) > 1 True >>> root_files[0].filename == root_files[1].filename False This test might fail on a non-standard installation >>> 'Windows' in (fd.filename ...
def find_files(spec): r""" A pythonic wrapper around the FindFirstFile/FindNextFile win32 api. >>> root_files = tuple(find_files(r'c:\*')) >>> len(root_files) > 1 True >>> root_files[0].filename == root_files[1].filename False This test might fail on a non-standard installation >>> 'Windows' in (fd.filename ...
[ "r", "A", "pythonic", "wrapper", "around", "the", "FindFirstFile", "/", "FindNextFile", "win32", "api", "." ]
jaraco/jaraco.windows
python
https://github.com/jaraco/jaraco.windows/blob/51811efed50b46ad08daa25408a1cc806bc8d519/jaraco/windows/filesystem/__init__.py#L130-L160
[ "def", "find_files", "(", "spec", ")", ":", "fd", "=", "api", ".", "WIN32_FIND_DATA", "(", ")", "handle", "=", "api", ".", "FindFirstFile", "(", "spec", ",", "byref", "(", "fd", ")", ")", "while", "True", ":", "if", "handle", "==", "api", ".", "INV...
51811efed50b46ad08daa25408a1cc806bc8d519
train
get_final_path
r""" For a given path, determine the ultimate location of that path. Useful for resolving symlink targets. This functions wraps the GetFinalPathNameByHandle from the Windows SDK. Note, this function fails if a handle cannot be obtained (such as for C:\Pagefile.sys on a stock windows system). Consider using trac...
jaraco/windows/filesystem/__init__.py
def get_final_path(path): r""" For a given path, determine the ultimate location of that path. Useful for resolving symlink targets. This functions wraps the GetFinalPathNameByHandle from the Windows SDK. Note, this function fails if a handle cannot be obtained (such as for C:\Pagefile.sys on a stock windows sy...
def get_final_path(path): r""" For a given path, determine the ultimate location of that path. Useful for resolving symlink targets. This functions wraps the GetFinalPathNameByHandle from the Windows SDK. Note, this function fails if a handle cannot be obtained (such as for C:\Pagefile.sys on a stock windows sy...
[ "r", "For", "a", "given", "path", "determine", "the", "ultimate", "location", "of", "that", "path", ".", "Useful", "for", "resolving", "symlink", "targets", ".", "This", "functions", "wraps", "the", "GetFinalPathNameByHandle", "from", "the", "Windows", "SDK", ...
jaraco/jaraco.windows
python
https://github.com/jaraco/jaraco.windows/blob/51811efed50b46ad08daa25408a1cc806bc8d519/jaraco/windows/filesystem/__init__.py#L163-L203
[ "def", "get_final_path", "(", "path", ")", ":", "desired_access", "=", "api", ".", "NULL", "share_mode", "=", "(", "api", ".", "FILE_SHARE_READ", "|", "api", ".", "FILE_SHARE_WRITE", "|", "api", ".", "FILE_SHARE_DELETE", ")", "security_attributes", "=", "api",...
51811efed50b46ad08daa25408a1cc806bc8d519
train
join
r""" Wrapper around os.path.join that works with Windows drive letters. >>> join('d:\\foo', '\\bar') 'd:\\bar'
jaraco/windows/filesystem/__init__.py
def join(*paths): r""" Wrapper around os.path.join that works with Windows drive letters. >>> join('d:\\foo', '\\bar') 'd:\\bar' """ paths_with_drives = map(os.path.splitdrive, paths) drives, paths = zip(*paths_with_drives) # the drive we care about is the last one in the list drive = next(filter(None, revers...
def join(*paths): r""" Wrapper around os.path.join that works with Windows drive letters. >>> join('d:\\foo', '\\bar') 'd:\\bar' """ paths_with_drives = map(os.path.splitdrive, paths) drives, paths = zip(*paths_with_drives) # the drive we care about is the last one in the list drive = next(filter(None, revers...
[ "r", "Wrapper", "around", "os", ".", "path", ".", "join", "that", "works", "with", "Windows", "drive", "letters", "." ]
jaraco/jaraco.windows
python
https://github.com/jaraco/jaraco.windows/blob/51811efed50b46ad08daa25408a1cc806bc8d519/jaraco/windows/filesystem/__init__.py#L292-L303
[ "def", "join", "(", "*", "paths", ")", ":", "paths_with_drives", "=", "map", "(", "os", ".", "path", ".", "splitdrive", ",", "paths", ")", "drives", ",", "paths", "=", "zip", "(", "*", "paths_with_drives", ")", "# the drive we care about is the last one in the...
51811efed50b46ad08daa25408a1cc806bc8d519
train
resolve_path
r""" Find a path from start to target where target is relative to start. >>> tmp = str(getfixture('tmpdir_as_cwd')) >>> findpath('d:\\') 'd:\\' >>> findpath('d:\\', tmp) 'd:\\' >>> findpath('\\bar', 'd:\\') 'd:\\bar' >>> findpath('\\bar', 'd:\\foo') # fails with '\\bar' 'd:\\bar' >>> findpath('bar', 'd...
jaraco/windows/filesystem/__init__.py
def resolve_path(target, start=os.path.curdir): r""" Find a path from start to target where target is relative to start. >>> tmp = str(getfixture('tmpdir_as_cwd')) >>> findpath('d:\\') 'd:\\' >>> findpath('d:\\', tmp) 'd:\\' >>> findpath('\\bar', 'd:\\') 'd:\\bar' >>> findpath('\\bar', 'd:\\foo') # fails...
def resolve_path(target, start=os.path.curdir): r""" Find a path from start to target where target is relative to start. >>> tmp = str(getfixture('tmpdir_as_cwd')) >>> findpath('d:\\') 'd:\\' >>> findpath('d:\\', tmp) 'd:\\' >>> findpath('\\bar', 'd:\\') 'd:\\bar' >>> findpath('\\bar', 'd:\\foo') # fails...
[ "r", "Find", "a", "path", "from", "start", "to", "target", "where", "target", "is", "relative", "to", "start", "." ]
jaraco/jaraco.windows
python
https://github.com/jaraco/jaraco.windows/blob/51811efed50b46ad08daa25408a1cc806bc8d519/jaraco/windows/filesystem/__init__.py#L306-L343
[ "def", "resolve_path", "(", "target", ",", "start", "=", "os", ".", "path", ".", "curdir", ")", ":", "return", "os", ".", "path", ".", "normpath", "(", "join", "(", "start", ",", "target", ")", ")" ]
51811efed50b46ad08daa25408a1cc806bc8d519
train
trace_symlink_target
Given a file that is known to be a symlink, trace it to its ultimate target. Raises TargetNotPresent when the target cannot be determined. Raises ValueError when the specified link is not a symlink.
jaraco/windows/filesystem/__init__.py
def trace_symlink_target(link): """ Given a file that is known to be a symlink, trace it to its ultimate target. Raises TargetNotPresent when the target cannot be determined. Raises ValueError when the specified link is not a symlink. """ if not is_symlink(link): raise ValueError("link must point to a symlin...
def trace_symlink_target(link): """ Given a file that is known to be a symlink, trace it to its ultimate target. Raises TargetNotPresent when the target cannot be determined. Raises ValueError when the specified link is not a symlink. """ if not is_symlink(link): raise ValueError("link must point to a symlin...
[ "Given", "a", "file", "that", "is", "known", "to", "be", "a", "symlink", "trace", "it", "to", "its", "ultimate", "target", "." ]
jaraco/jaraco.windows
python
https://github.com/jaraco/jaraco.windows/blob/51811efed50b46ad08daa25408a1cc806bc8d519/jaraco/windows/filesystem/__init__.py#L349-L364
[ "def", "trace_symlink_target", "(", "link", ")", ":", "if", "not", "is_symlink", "(", "link", ")", ":", "raise", "ValueError", "(", "\"link must point to a symlink on the system\"", ")", "while", "is_symlink", "(", "link", ")", ":", "orig", "=", "os", ".", "pa...
51811efed50b46ad08daa25408a1cc806bc8d519
train
readlink
readlink(link) -> target Return a string representing the path to which the symbolic link points.
jaraco/windows/filesystem/__init__.py
def readlink(link): """ readlink(link) -> target Return a string representing the path to which the symbolic link points. """ handle = api.CreateFile( link, 0, 0, None, api.OPEN_EXISTING, api.FILE_FLAG_OPEN_REPARSE_POINT | api.FILE_FLAG_BACKUP_SEMANTICS, None, ) if handle == api.INVALID_HANDLE_VAL...
def readlink(link): """ readlink(link) -> target Return a string representing the path to which the symbolic link points. """ handle = api.CreateFile( link, 0, 0, None, api.OPEN_EXISTING, api.FILE_FLAG_OPEN_REPARSE_POINT | api.FILE_FLAG_BACKUP_SEMANTICS, None, ) if handle == api.INVALID_HANDLE_VAL...
[ "readlink", "(", "link", ")", "-", ">", "target", "Return", "a", "string", "representing", "the", "path", "to", "which", "the", "symbolic", "link", "points", "." ]
jaraco/jaraco.windows
python
https://github.com/jaraco/jaraco.windows/blob/51811efed50b46ad08daa25408a1cc806bc8d519/jaraco/windows/filesystem/__init__.py#L367-L395
[ "def", "readlink", "(", "link", ")", ":", "handle", "=", "api", ".", "CreateFile", "(", "link", ",", "0", ",", "0", ",", "None", ",", "api", ".", "OPEN_EXISTING", ",", "api", ".", "FILE_FLAG_OPEN_REPARSE_POINT", "|", "api", ".", "FILE_FLAG_BACKUP_SEMANTICS...
51811efed50b46ad08daa25408a1cc806bc8d519
train
patch_os_module
jaraco.windows provides the os.symlink and os.readlink functions. Monkey-patch the os module to include them if not present.
jaraco/windows/filesystem/__init__.py
def patch_os_module(): """ jaraco.windows provides the os.symlink and os.readlink functions. Monkey-patch the os module to include them if not present. """ if not hasattr(os, 'symlink'): os.symlink = symlink os.path.islink = islink if not hasattr(os, 'readlink'): os.readlink = readlink
def patch_os_module(): """ jaraco.windows provides the os.symlink and os.readlink functions. Monkey-patch the os module to include them if not present. """ if not hasattr(os, 'symlink'): os.symlink = symlink os.path.islink = islink if not hasattr(os, 'readlink'): os.readlink = readlink
[ "jaraco", ".", "windows", "provides", "the", "os", ".", "symlink", "and", "os", ".", "readlink", "functions", ".", "Monkey", "-", "patch", "the", "os", "module", "to", "include", "them", "if", "not", "present", "." ]
jaraco/jaraco.windows
python
https://github.com/jaraco/jaraco.windows/blob/51811efed50b46ad08daa25408a1cc806bc8d519/jaraco/windows/filesystem/__init__.py#L398-L407
[ "def", "patch_os_module", "(", ")", ":", "if", "not", "hasattr", "(", "os", ",", "'symlink'", ")", ":", "os", ".", "symlink", "=", "symlink", "os", ".", "path", ".", "islink", "=", "islink", "if", "not", "hasattr", "(", "os", ",", "'readlink'", ")", ...
51811efed50b46ad08daa25408a1cc806bc8d519
train
find_symlinks_cmd
%prog [start-path] Search the specified path (defaults to the current directory) for symlinks, printing the source and target on each line.
jaraco/windows/filesystem/__init__.py
def find_symlinks_cmd(): """ %prog [start-path] Search the specified path (defaults to the current directory) for symlinks, printing the source and target on each line. """ from optparse import OptionParser from textwrap import dedent parser = OptionParser(usage=dedent(find_symlinks_cmd.__doc__).strip()) optio...
def find_symlinks_cmd(): """ %prog [start-path] Search the specified path (defaults to the current directory) for symlinks, printing the source and target on each line. """ from optparse import OptionParser from textwrap import dedent parser = OptionParser(usage=dedent(find_symlinks_cmd.__doc__).strip()) optio...
[ "%prog", "[", "start", "-", "path", "]", "Search", "the", "specified", "path", "(", "defaults", "to", "the", "current", "directory", ")", "for", "symlinks", "printing", "the", "source", "and", "target", "on", "each", "line", "." ]
jaraco/jaraco.windows
python
https://github.com/jaraco/jaraco.windows/blob/51811efed50b46ad08daa25408a1cc806bc8d519/jaraco/windows/filesystem/__init__.py#L421-L443
[ "def", "find_symlinks_cmd", "(", ")", ":", "from", "optparse", "import", "OptionParser", "from", "textwrap", "import", "dedent", "parser", "=", "OptionParser", "(", "usage", "=", "dedent", "(", "find_symlinks_cmd", ".", "__doc__", ")", ".", "strip", "(", ")", ...
51811efed50b46ad08daa25408a1cc806bc8d519
train
SetFileAttributes
Set file attributes. e.g.: SetFileAttributes('C:\\foo', 'hidden') Each attr must be either a numeric value, a constant defined in jaraco.windows.filesystem.api, or one of the nice names defined in this function.
jaraco/windows/filesystem/__init__.py
def SetFileAttributes(filepath, *attrs): """ Set file attributes. e.g.: SetFileAttributes('C:\\foo', 'hidden') Each attr must be either a numeric value, a constant defined in jaraco.windows.filesystem.api, or one of the nice names defined in this function. """ nice_names = collections.defaultdict( lambda k...
def SetFileAttributes(filepath, *attrs): """ Set file attributes. e.g.: SetFileAttributes('C:\\foo', 'hidden') Each attr must be either a numeric value, a constant defined in jaraco.windows.filesystem.api, or one of the nice names defined in this function. """ nice_names = collections.defaultdict( lambda k...
[ "Set", "file", "attributes", ".", "e", ".", "g", ".", ":" ]
jaraco/jaraco.windows
python
https://github.com/jaraco/jaraco.windows/blob/51811efed50b46ad08daa25408a1cc806bc8d519/jaraco/windows/filesystem/__init__.py#L485-L502
[ "def", "SetFileAttributes", "(", "filepath", ",", "*", "attrs", ")", ":", "nice_names", "=", "collections", ".", "defaultdict", "(", "lambda", "key", ":", "key", ",", "hidden", "=", "'FILE_ATTRIBUTE_HIDDEN'", ",", "read_only", "=", "'FILE_ATTRIBUTE_READONLY'", "...
51811efed50b46ad08daa25408a1cc806bc8d519
train
suggest_localhost
Decorator: prompt user for value of env.host_string with default to 'localhost' when env.host_string is empty. Modification of decorator function fabric.network.needs_host
fabsetup/fabutils.py
def suggest_localhost(func): '''Decorator: prompt user for value of env.host_string with default to 'localhost' when env.host_string is empty. Modification of decorator function fabric.network.needs_host ''' from fabric.network import handle_prompt_abort, to_dict @wraps(func) def host_prom...
def suggest_localhost(func): '''Decorator: prompt user for value of env.host_string with default to 'localhost' when env.host_string is empty. Modification of decorator function fabric.network.needs_host ''' from fabric.network import handle_prompt_abort, to_dict @wraps(func) def host_prom...
[ "Decorator", ":", "prompt", "user", "for", "value", "of", "env", ".", "host_string", "with", "default", "to", "localhost", "when", "env", ".", "host_string", "is", "empty", "." ]
theno/fabsetup
python
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabutils.py#L31-L52
[ "def", "suggest_localhost", "(", "func", ")", ":", "from", "fabric", ".", "network", "import", "handle_prompt_abort", ",", "to_dict", "@", "wraps", "(", "func", ")", "def", "host_prompting_wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "whi...
ced728abff93551ba5677e63bc1bdc0ef5ca5777
train
needs_repo_fabsetup_custom
Decorator, ensures that fabsetup-custom exists and it is a git repo.
fabsetup/fabutils.py
def needs_repo_fabsetup_custom(func): '''Decorator, ensures that fabsetup-custom exists and it is a git repo.''' from fabric.api import local @wraps(func) def wrapper(*args, **kwargs): if not os.path.exists(FABSETUP_CUSTOM_DIR): msg = '''\ Git repository ~/.fabsetup-custom with conf...
def needs_repo_fabsetup_custom(func): '''Decorator, ensures that fabsetup-custom exists and it is a git repo.''' from fabric.api import local @wraps(func) def wrapper(*args, **kwargs): if not os.path.exists(FABSETUP_CUSTOM_DIR): msg = '''\ Git repository ~/.fabsetup-custom with conf...
[ "Decorator", "ensures", "that", "fabsetup", "-", "custom", "exists", "and", "it", "is", "a", "git", "repo", "." ]
theno/fabsetup
python
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabutils.py#L99-L160
[ "def", "needs_repo_fabsetup_custom", "(", "func", ")", ":", "from", "fabric", ".", "api", "import", "local", "@", "wraps", "(", "func", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "os", ".", "path", ".", ...
ced728abff93551ba5677e63bc1bdc0ef5ca5777
train
needs_packages
Decorator: ensure that packages are installed on host given by fabric argument `-H` (local or remote).
fabsetup/fabutils.py
def needs_packages(*packages): '''Decorator: ensure that packages are installed on host given by fabric argument `-H` (local or remote). ''' def real_decorator(func): @wraps(func) def wrapper(*args, **kwargs): non_installed = _non_installed(packages) if non_insta...
def needs_packages(*packages): '''Decorator: ensure that packages are installed on host given by fabric argument `-H` (local or remote). ''' def real_decorator(func): @wraps(func) def wrapper(*args, **kwargs): non_installed = _non_installed(packages) if non_insta...
[ "Decorator", ":", "ensure", "that", "packages", "are", "installed", "on", "host", "given", "by", "fabric", "argument", "-", "H", "(", "local", "or", "remote", ")", "." ]
theno/fabsetup
python
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabutils.py#L172-L188
[ "def", "needs_packages", "(", "*", "packages", ")", ":", "def", "real_decorator", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "non_installed", "=", "_non_installed", "(",...
ced728abff93551ba5677e63bc1bdc0ef5ca5777
train
task
Composition of decorator functions for inherent self-documentation on task execution. On execution, each task prints out its name and its first docstring line.
fabsetup/fabutils.py
def task(func, *args, **kwargs): '''Composition of decorator functions for inherent self-documentation on task execution. On execution, each task prints out its name and its first docstring line. ''' prefix = '\n# ' tail = '\n' return fabric.api.task( print_full_name(color=magenta, ...
def task(func, *args, **kwargs): '''Composition of decorator functions for inherent self-documentation on task execution. On execution, each task prints out its name and its first docstring line. ''' prefix = '\n# ' tail = '\n' return fabric.api.task( print_full_name(color=magenta, ...
[ "Composition", "of", "decorator", "functions", "for", "inherent", "self", "-", "documentation", "on", "task", "execution", "." ]
theno/fabsetup
python
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabutils.py#L191-L204
[ "def", "task", "(", "func", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "prefix", "=", "'\\n# '", "tail", "=", "'\\n'", "return", "fabric", ".", "api", ".", "task", "(", "print_full_name", "(", "color", "=", "magenta", ",", "prefix", "=", ...
ced728abff93551ba5677e63bc1bdc0ef5ca5777
train
subtask
Decorator which prints out the name of the decorated function on execution.
fabsetup/fabutils.py
def subtask(*args, **kwargs): '''Decorator which prints out the name of the decorated function on execution. ''' depth = kwargs.get('depth', 2) prefix = kwargs.get('prefix', '\n' + '#' * depth + ' ') tail = kwargs.get('tail', '\n') doc1 = kwargs.get('doc1', False) color = kwargs.get('col...
def subtask(*args, **kwargs): '''Decorator which prints out the name of the decorated function on execution. ''' depth = kwargs.get('depth', 2) prefix = kwargs.get('prefix', '\n' + '#' * depth + ' ') tail = kwargs.get('tail', '\n') doc1 = kwargs.get('doc1', False) color = kwargs.get('col...
[ "Decorator", "which", "prints", "out", "the", "name", "of", "the", "decorated", "function", "on", "execution", "." ]
theno/fabsetup
python
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabutils.py#L213-L233
[ "def", "subtask", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "depth", "=", "kwargs", ".", "get", "(", "'depth'", ",", "2", ")", "prefix", "=", "kwargs", ".", "get", "(", "'prefix'", ",", "'\\n'", "+", "'#'", "*", "depth", "+", "' '", ...
ced728abff93551ba5677e63bc1bdc0ef5ca5777
train
_is_sudoer
Return True if current user is a sudoer, else False. Should be called non-eager if sudo is wanted only.
fabsetup/fabutils.py
def _is_sudoer(what_for=''): '''Return True if current user is a sudoer, else False. Should be called non-eager if sudo is wanted only. ''' if env.get('nosudo', None) is None: if what_for: print(yellow(what_for)) with quiet(): # possible outputs: # e...
def _is_sudoer(what_for=''): '''Return True if current user is a sudoer, else False. Should be called non-eager if sudo is wanted only. ''' if env.get('nosudo', None) is None: if what_for: print(yellow(what_for)) with quiet(): # possible outputs: # e...
[ "Return", "True", "if", "current", "user", "is", "a", "sudoer", "else", "False", "." ]
theno/fabsetup
python
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabutils.py#L248-L265
[ "def", "_is_sudoer", "(", "what_for", "=", "''", ")", ":", "if", "env", ".", "get", "(", "'nosudo'", ",", "None", ")", "is", "None", ":", "if", "what_for", ":", "print", "(", "yellow", "(", "what_for", ")", ")", "with", "quiet", "(", ")", ":", "#...
ced728abff93551ba5677e63bc1bdc0ef5ca5777
train
install_packages
Try to install .deb packages given by list. Return True, if packages could be installed or are installed already, or if they cannot be installed but the user gives feedback to continue. Else return False.
fabsetup/fabutils.py
def install_packages(packages, what_for='for a complete setup to work properly'): '''Try to install .deb packages given by list. Return True, if packages could be installed or are installed already, or if they cannot be installed but the user gives feedback to continue. Else retur...
def install_packages(packages, what_for='for a complete setup to work properly'): '''Try to install .deb packages given by list. Return True, if packages could be installed or are installed already, or if they cannot be installed but the user gives feedback to continue. Else retur...
[ "Try", "to", "install", ".", "deb", "packages", "given", "by", "list", "." ]
theno/fabsetup
python
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabutils.py#L273-L315
[ "def", "install_packages", "(", "packages", ",", "what_for", "=", "'for a complete setup to work properly'", ")", ":", "res", "=", "True", "non_installed_packages", "=", "_non_installed", "(", "packages", ")", "packages_str", "=", "' '", ".", "join", "(", "non_inst...
ced728abff93551ba5677e63bc1bdc0ef5ca5777
train
checkup_git_repos_legacy
Checkout or update git repos. repos must be a list of dicts each with an url and optional with a name value.
fabsetup/fabutils.py
def checkup_git_repos_legacy(repos, base_dir='~/repos', verbose=False, prefix='', postfix=''): '''Checkout or update git repos. repos must be a list of dicts each with an url and optional with a name value. ''' run(flo('mkdir -p {base_dir}')) for repo in repos: ...
def checkup_git_repos_legacy(repos, base_dir='~/repos', verbose=False, prefix='', postfix=''): '''Checkout or update git repos. repos must be a list of dicts each with an url and optional with a name value. ''' run(flo('mkdir -p {base_dir}')) for repo in repos: ...
[ "Checkout", "or", "update", "git", "repos", "." ]
theno/fabsetup
python
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabutils.py#L324-L336
[ "def", "checkup_git_repos_legacy", "(", "repos", ",", "base_dir", "=", "'~/repos'", ",", "verbose", "=", "False", ",", "prefix", "=", "''", ",", "postfix", "=", "''", ")", ":", "run", "(", "flo", "(", "'mkdir -p {base_dir}'", ")", ")", "for", "repo", "in...
ced728abff93551ba5677e63bc1bdc0ef5ca5777
train
checkup_git_repo_legacy
Checkout or update a git repo.
fabsetup/fabutils.py
def checkup_git_repo_legacy(url, name=None, base_dir='~/repos', verbose=False, prefix='', postfix=''): '''Checkout or update a git repo.''' if not name: match = re.match(r'.*/(.+)\.git', url) assert match, flo("Unable to extract repo name from '{url}'") name =...
def checkup_git_repo_legacy(url, name=None, base_dir='~/repos', verbose=False, prefix='', postfix=''): '''Checkout or update a git repo.''' if not name: match = re.match(r'.*/(.+)\.git', url) assert match, flo("Unable to extract repo name from '{url}'") name =...
[ "Checkout", "or", "update", "a", "git", "repo", "." ]
theno/fabsetup
python
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabutils.py#L339-L362
[ "def", "checkup_git_repo_legacy", "(", "url", ",", "name", "=", "None", ",", "base_dir", "=", "'~/repos'", ",", "verbose", "=", "False", ",", "prefix", "=", "''", ",", "postfix", "=", "''", ")", ":", "if", "not", "name", ":", "match", "=", "re", ".",...
ced728abff93551ba5677e63bc1bdc0ef5ca5777
train
install_file_legacy
Install file with path on the host target. The from file is the first of this list which exists: * custom file * custom file.template * common file * common file.template
fabsetup/fabutils.py
def install_file_legacy(path, sudo=False, from_path=None, **substitutions): '''Install file with path on the host target. The from file is the first of this list which exists: * custom file * custom file.template * common file * common file.template ''' # source paths 'from_custom' ...
def install_file_legacy(path, sudo=False, from_path=None, **substitutions): '''Install file with path on the host target. The from file is the first of this list which exists: * custom file * custom file.template * common file * common file.template ''' # source paths 'from_custom' ...
[ "Install", "file", "with", "path", "on", "the", "host", "target", "." ]
theno/fabsetup
python
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabutils.py#L481-L524
[ "def", "install_file_legacy", "(", "path", ",", "sudo", "=", "False", ",", "from_path", "=", "None", ",", "*", "*", "substitutions", ")", ":", "# source paths 'from_custom' and 'from_common'", "from_path", "=", "from_path", "or", "path", "# remove beginning '/' (if an...
ced728abff93551ba5677e63bc1bdc0ef5ca5777
train
install_user_command_legacy
Install command executable file into users bin dir. If a custom executable exists it would be installed instead of the "normal" one. The executable also could exist as a <command>.template file.
fabsetup/fabutils.py
def install_user_command_legacy(command, **substitutions): '''Install command executable file into users bin dir. If a custom executable exists it would be installed instead of the "normal" one. The executable also could exist as a <command>.template file. ''' path = flo('~/bin/{command}') ins...
def install_user_command_legacy(command, **substitutions): '''Install command executable file into users bin dir. If a custom executable exists it would be installed instead of the "normal" one. The executable also could exist as a <command>.template file. ''' path = flo('~/bin/{command}') ins...
[ "Install", "command", "executable", "file", "into", "users", "bin", "dir", "." ]
theno/fabsetup
python
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabutils.py#L527-L535
[ "def", "install_user_command_legacy", "(", "command", ",", "*", "*", "substitutions", ")", ":", "path", "=", "flo", "(", "'~/bin/{command}'", ")", "install_file_legacy", "(", "path", ",", "*", "*", "substitutions", ")", "run", "(", "flo", "(", "'chmod 755 {pat...
ced728abff93551ba5677e63bc1bdc0ef5ca5777
train
_determine_froms
Return 2-Tuple (from_custom, from_default) for a given path. Example: >>> FABSETUP_CUSTOM_DIR = '/home/theno/.fabsetup-custom' >>> >>> # path is an abpath ... >>> addon_package = AddonPackage(module_dir='/home/theno/' ... '.fabsetup-addo...
fabsetup/fabutils.py
def _determine_froms(addon_package, path): '''Return 2-Tuple (from_custom, from_default) for a given path. Example: >>> FABSETUP_CUSTOM_DIR = '/home/theno/.fabsetup-custom' >>> >>> # path is an abpath ... >>> addon_package = AddonPackage(module_dir='/home/theno/' ...
def _determine_froms(addon_package, path): '''Return 2-Tuple (from_custom, from_default) for a given path. Example: >>> FABSETUP_CUSTOM_DIR = '/home/theno/.fabsetup-custom' >>> >>> # path is an abpath ... >>> addon_package = AddonPackage(module_dir='/home/theno/' ...
[ "Return", "2", "-", "Tuple", "(", "from_custom", "from_default", ")", "for", "a", "given", "path", "." ]
theno/fabsetup
python
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabutils.py#L538-L575
[ "def", "_determine_froms", "(", "addon_package", ",", "path", ")", ":", "# from_tail", "if", "path", ".", "startswith", "(", "'~/'", ")", ":", "path_tail", "=", "path", "[", "2", ":", "]", "# path without beginning '~/'", "from_tail", "=", "join", "(", "'hom...
ced728abff93551ba5677e63bc1bdc0ef5ca5777
train
update_or_append_line
Search in file 'filename' for a line starting with 'prefix' and replace the line by 'new_line'. If a line starting with 'prefix' not exists 'new_line' will be appended. If the file not exists, it will be created. Return False if new_line was appended, else True (i.e. if the prefix was found within...
fabsetup/fabutils.py
def update_or_append_line(filename, prefix, new_line, keep_backup=True, append=True): '''Search in file 'filename' for a line starting with 'prefix' and replace the line by 'new_line'. If a line starting with 'prefix' not exists 'new_line' will be appended. If the file not exi...
def update_or_append_line(filename, prefix, new_line, keep_backup=True, append=True): '''Search in file 'filename' for a line starting with 'prefix' and replace the line by 'new_line'. If a line starting with 'prefix' not exists 'new_line' will be appended. If the file not exi...
[ "Search", "in", "file", "filename", "for", "a", "line", "starting", "with", "prefix", "and", "replace", "the", "line", "by", "new_line", "." ]
theno/fabsetup
python
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabutils.py#L686-L712
[ "def", "update_or_append_line", "(", "filename", ",", "prefix", ",", "new_line", ",", "keep_backup", "=", "True", ",", "append", "=", "True", ")", ":", "result", "=", "None", "if", "env", ".", "host_string", "==", "'localhost'", ":", "result", "=", "update...
ced728abff93551ba5677e63bc1bdc0ef5ca5777
train
comment_out_line
Comment line out by putting a comment sign in front of the line. If the file does not contain the line, the files content will not be changed (but the file will be touched in every case).
fabsetup/fabutils.py
def comment_out_line(filename, line, comment='#'): '''Comment line out by putting a comment sign in front of the line. If the file does not contain the line, the files content will not be changed (but the file will be touched in every case). ''' return comment_out_local(filename, line, comment, ...
def comment_out_line(filename, line, comment='#'): '''Comment line out by putting a comment sign in front of the line. If the file does not contain the line, the files content will not be changed (but the file will be touched in every case). ''' return comment_out_local(filename, line, comment, ...
[ "Comment", "line", "out", "by", "putting", "a", "comment", "sign", "in", "front", "of", "the", "line", "." ]
theno/fabsetup
python
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabutils.py#L715-L722
[ "def", "comment_out_line", "(", "filename", ",", "line", ",", "comment", "=", "'#'", ")", ":", "return", "comment_out_local", "(", "filename", ",", "line", ",", "comment", ",", "update_or_append_line", "=", "update_or_append_line", ")" ]
ced728abff93551ba5677e63bc1bdc0ef5ca5777
train
uncomment_or_update_or_append_line
Remove the comment of an commented out line and make the line "active". If such an commented out line not exists it would be appended.
fabsetup/fabutils.py
def uncomment_or_update_or_append_line(filename, prefix, new_line, comment='#', keep_backup=True): '''Remove the comment of an commented out line and make the line "active". If such an commented out line not exists it would be appended. ''' return uua_local(filena...
def uncomment_or_update_or_append_line(filename, prefix, new_line, comment='#', keep_backup=True): '''Remove the comment of an commented out line and make the line "active". If such an commented out line not exists it would be appended. ''' return uua_local(filena...
[ "Remove", "the", "comment", "of", "an", "commented", "out", "line", "and", "make", "the", "line", "active", "." ]
theno/fabsetup
python
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabutils.py#L725-L732
[ "def", "uncomment_or_update_or_append_line", "(", "filename", ",", "prefix", ",", "new_line", ",", "comment", "=", "'#'", ",", "keep_backup", "=", "True", ")", ":", "return", "uua_local", "(", "filename", ",", "prefix", ",", "new_line", ",", "comment", ",", ...
ced728abff93551ba5677e63bc1bdc0ef5ca5777
train
_line_2_pair
Return bash variable declaration as name-value pair. Name as lower case str. Value itself only without surrounding '"' (if any). For example, _line_2_pair('NAME="Ubuntu"') will return ('name', 'Ubuntu')
fabsetup/fabutils.py
def _line_2_pair(line): '''Return bash variable declaration as name-value pair. Name as lower case str. Value itself only without surrounding '"' (if any). For example, _line_2_pair('NAME="Ubuntu"') will return ('name', 'Ubuntu') ''' key, val = line.split('=') return key.lower(), val.strip('"'...
def _line_2_pair(line): '''Return bash variable declaration as name-value pair. Name as lower case str. Value itself only without surrounding '"' (if any). For example, _line_2_pair('NAME="Ubuntu"') will return ('name', 'Ubuntu') ''' key, val = line.split('=') return key.lower(), val.strip('"'...
[ "Return", "bash", "variable", "declaration", "as", "name", "-", "value", "pair", "." ]
theno/fabsetup
python
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabutils.py#L735-L743
[ "def", "_line_2_pair", "(", "line", ")", ":", "key", ",", "val", "=", "line", ".", "split", "(", "'='", ")", "return", "key", ".", "lower", "(", ")", ",", "val", ".", "strip", "(", "'\"'", ")" ]
ced728abff93551ba5677e63bc1bdc0ef5ca5777
train
_fetch_os_release_infos
Return variable content of file '/etc/os-release' as dict. Return-example (in case of an Ubuntu 16.04): { 'name': 'Ubuntu', 'version': '16.04.1 LTS (Xenial Xerus)', 'version_id': '16.04', ... }
fabsetup/fabutils.py
def _fetch_os_release_infos(): '''Return variable content of file '/etc/os-release' as dict. Return-example (in case of an Ubuntu 16.04): { 'name': 'Ubuntu', 'version': '16.04.1 LTS (Xenial Xerus)', 'version_id': '16.04', ... } ''' os_rele...
def _fetch_os_release_infos(): '''Return variable content of file '/etc/os-release' as dict. Return-example (in case of an Ubuntu 16.04): { 'name': 'Ubuntu', 'version': '16.04.1 LTS (Xenial Xerus)', 'version_id': '16.04', ... } ''' os_rele...
[ "Return", "variable", "content", "of", "file", "/", "etc", "/", "os", "-", "release", "as", "dict", "." ]
theno/fabsetup
python
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabutils.py#L746-L764
[ "def", "_fetch_os_release_infos", "(", ")", ":", "os_release_dict", "=", "{", "}", "lines", "=", "[", "]", "with", "fabric", ".", "api", ".", "hide", "(", "'output'", ")", ":", "lines", "=", "run", "(", "'cat /etc/os-release'", ",", "capture", "=", "True...
ced728abff93551ba5677e63bc1bdc0ef5ca5777
train
is_os
Return True if OS name in /etc/lsb-release of host given by fabric param `-H` is the same as given by argument, False else. If arg version_id is not None only return True if it is the same as in /etc/lsb-release, too. Args: name: 'Debian GNU/Linux', 'Ubuntu' version_id(None or str): No...
fabsetup/fabutils.py
def is_os(name, version_id=None): '''Return True if OS name in /etc/lsb-release of host given by fabric param `-H` is the same as given by argument, False else. If arg version_id is not None only return True if it is the same as in /etc/lsb-release, too. Args: name: 'Debian GNU/Linux', 'Ub...
def is_os(name, version_id=None): '''Return True if OS name in /etc/lsb-release of host given by fabric param `-H` is the same as given by argument, False else. If arg version_id is not None only return True if it is the same as in /etc/lsb-release, too. Args: name: 'Debian GNU/Linux', 'Ub...
[ "Return", "True", "if", "OS", "name", "in", "/", "etc", "/", "lsb", "-", "release", "of", "host", "given", "by", "fabric", "param", "-", "H", "is", "the", "same", "as", "given", "by", "argument", "False", "else", "." ]
theno/fabsetup
python
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabutils.py#L767-L791
[ "def", "is_os", "(", "name", ",", "version_id", "=", "None", ")", ":", "result", "=", "False", "os_release_infos", "=", "_fetch_os_release_infos", "(", ")", "if", "name", "==", "os_release_infos", ".", "get", "(", "'name'", ",", "None", ")", ":", "if", "...
ced728abff93551ba5677e63bc1bdc0ef5ca5777
train
dn_cn_of_certificate_with_san
Return the Common Name (cn) from the Distinguished Name (dn) of the certificate which contains the `domain` in its Subject Alternativ Name (san) list. Needs repo ~/.fabsetup-custom. Return None if no certificate is configured with `domain` in SAN.
fabsetup/fabutils.py
def dn_cn_of_certificate_with_san(domain): '''Return the Common Name (cn) from the Distinguished Name (dn) of the certificate which contains the `domain` in its Subject Alternativ Name (san) list. Needs repo ~/.fabsetup-custom. Return None if no certificate is configured with `domain` in SAN. ...
def dn_cn_of_certificate_with_san(domain): '''Return the Common Name (cn) from the Distinguished Name (dn) of the certificate which contains the `domain` in its Subject Alternativ Name (san) list. Needs repo ~/.fabsetup-custom. Return None if no certificate is configured with `domain` in SAN. ...
[ "Return", "the", "Common", "Name", "(", "cn", ")", "from", "the", "Distinguished", "Name", "(", "dn", ")", "of", "the", "certificate", "which", "contains", "the", "domain", "in", "its", "Subject", "Alternativ", "Name", "(", "san", ")", "list", "." ]
theno/fabsetup
python
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabutils.py#L810-L831
[ "def", "dn_cn_of_certificate_with_san", "(", "domain", ")", ":", "cn_dn", "=", "None", "from", "config", "import", "domain_groups", "cns", "=", "[", "domains", "[", "0", "]", "for", "domains", "in", "domain_groups", "if", "domain", "in", "domains", "]", "if"...
ced728abff93551ba5677e63bc1bdc0ef5ca5777
train
extract_minors_from_setup_py
Extract supported python minor versions from setup.py and return them as a list of str. Return example: ['2.6', '2.7', '3.3', '3.4', '3.5', '3.6']
fabsetup/fabutils.py
def extract_minors_from_setup_py(filename_setup_py): '''Extract supported python minor versions from setup.py and return them as a list of str. Return example: ['2.6', '2.7', '3.3', '3.4', '3.5', '3.6'] ''' # eg: minors_str = '2.6\n2.7\n3.3\n3.4\n3.5\n3.6' minors_str = fabric.api.local...
def extract_minors_from_setup_py(filename_setup_py): '''Extract supported python minor versions from setup.py and return them as a list of str. Return example: ['2.6', '2.7', '3.3', '3.4', '3.5', '3.6'] ''' # eg: minors_str = '2.6\n2.7\n3.3\n3.4\n3.5\n3.6' minors_str = fabric.api.local...
[ "Extract", "supported", "python", "minor", "versions", "from", "setup", ".", "py", "and", "return", "them", "as", "a", "list", "of", "str", "." ]
theno/fabsetup
python
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabutils.py#L834-L850
[ "def", "extract_minors_from_setup_py", "(", "filename_setup_py", ")", ":", "# eg: minors_str = '2.6\\n2.7\\n3.3\\n3.4\\n3.5\\n3.6'", "minors_str", "=", "fabric", ".", "api", ".", "local", "(", "flo", "(", "'grep --perl-regexp --only-matching '", "'\"(?<=Programming Language :: Py...
ced728abff93551ba5677e63bc1bdc0ef5ca5777
train
highest_minor
Return highest minor of a list of stable (semantic) versions. Example: >>> python_versions = [ ... '2.6.9', '2.7.14', '3.3.7', '3.4.8', '3.5.5', '3.6.4'] >>> highest_minor(python_versions) '3.6'
fabsetup/fabutils.py
def highest_minor(python_versions): '''Return highest minor of a list of stable (semantic) versions. Example: >>> python_versions = [ ... '2.6.9', '2.7.14', '3.3.7', '3.4.8', '3.5.5', '3.6.4'] >>> highest_minor(python_versions) '3.6' ''' highest = python_versions[-1...
def highest_minor(python_versions): '''Return highest minor of a list of stable (semantic) versions. Example: >>> python_versions = [ ... '2.6.9', '2.7.14', '3.3.7', '3.4.8', '3.5.5', '3.6.4'] >>> highest_minor(python_versions) '3.6' ''' highest = python_versions[-1...
[ "Return", "highest", "minor", "of", "a", "list", "of", "stable", "(", "semantic", ")", "versions", "." ]
theno/fabsetup
python
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabutils.py#L886-L898
[ "def", "highest_minor", "(", "python_versions", ")", ":", "highest", "=", "python_versions", "[", "-", "1", "]", "major", ",", "minor", ",", "patch", "=", "highest", ".", "split", "(", "'.'", ",", "2", ")", "return", "flo", "(", "'{major}.{minor}'", ")" ...
ced728abff93551ba5677e63bc1bdc0ef5ca5777
train
vim_janus
Install or update Janus, a distribution of addons and mappings for vim. More info: https://github.com/carlhuda/janus Customization: https://github.com/carlhuda/janus/wiki/Customization Args: uninstall: If not None, Uninstall janus and restore old vim config
fabsetup/fabfile/setup/vim_janus.py
def vim_janus(uninstall=None): '''Install or update Janus, a distribution of addons and mappings for vim. More info: https://github.com/carlhuda/janus Customization: https://github.com/carlhuda/janus/wiki/Customization Args: uninstall: If not None, Uninstall janus and restore old vim c...
def vim_janus(uninstall=None): '''Install or update Janus, a distribution of addons and mappings for vim. More info: https://github.com/carlhuda/janus Customization: https://github.com/carlhuda/janus/wiki/Customization Args: uninstall: If not None, Uninstall janus and restore old vim c...
[ "Install", "or", "update", "Janus", "a", "distribution", "of", "addons", "and", "mappings", "for", "vim", "." ]
theno/fabsetup
python
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabfile/setup/vim_janus.py#L18-L38
[ "def", "vim_janus", "(", "uninstall", "=", "None", ")", ":", "if", "uninstall", "is", "not", "None", ":", "uninstall_janus", "(", ")", "else", ":", "if", "not", "exists", "(", "'~/.vim/janus'", ")", ":", "print_msg", "(", "'not installed => install'", ")", ...
ced728abff93551ba5677e63bc1bdc0ef5ca5777
train
uninstall_janus
Remove all janus files and dirs and (try to) restore previous vim config.
fabsetup/fabfile/setup/vim_janus.py
def uninstall_janus(): '''Remove all janus files and dirs and (try to) restore previous vim config. ''' if exists('~/.vim/janus'): run('rm -rf ~/.vim', msg='delete janus repo dir') with warn_only(): run('rm -rf ~/.janus', msg='delete ~/.janus dir') run('bash -c "rm ~/...
def uninstall_janus(): '''Remove all janus files and dirs and (try to) restore previous vim config. ''' if exists('~/.vim/janus'): run('rm -rf ~/.vim', msg='delete janus repo dir') with warn_only(): run('rm -rf ~/.janus', msg='delete ~/.janus dir') run('bash -c "rm ~/...
[ "Remove", "all", "janus", "files", "and", "dirs", "and", "(", "try", "to", ")", "restore", "previous", "vim", "config", "." ]
theno/fabsetup
python
https://github.com/theno/fabsetup/blob/ced728abff93551ba5677e63bc1bdc0ef5ca5777/fabsetup/fabfile/setup/vim_janus.py#L112-L131
[ "def", "uninstall_janus", "(", ")", ":", "if", "exists", "(", "'~/.vim/janus'", ")", ":", "run", "(", "'rm -rf ~/.vim'", ",", "msg", "=", "'delete janus repo dir'", ")", "with", "warn_only", "(", ")", ":", "run", "(", "'rm -rf ~/.janus'", ",", "msg", "=", ...
ced728abff93551ba5677e63bc1bdc0ef5ca5777
train
scan
Scan a network port Parameters ---------- host : str Host or ip address to scan port : int, optional Port to scan, default=80 url : str, optional URL to perform get request to on the host and port specified https : bool, optional Perform ssl connection on the ...
serviceping/network.py
def scan(host, port=80, url=None, https=False, timeout=1, max_size=65535): """ Scan a network port Parameters ---------- host : str Host or ip address to scan port : int, optional Port to scan, default=80 url : str, optional URL to perform get request to on the hos...
def scan(host, port=80, url=None, https=False, timeout=1, max_size=65535): """ Scan a network port Parameters ---------- host : str Host or ip address to scan port : int, optional Port to scan, default=80 url : str, optional URL to perform get request to on the hos...
[ "Scan", "a", "network", "port" ]
yahoo/serviceping
python
https://github.com/yahoo/serviceping/blob/1f9df5ee5b3cba466426b1164262278472ba4977/serviceping/network.py#L25-L124
[ "def", "scan", "(", "host", ",", "port", "=", "80", ",", "url", "=", "None", ",", "https", "=", "False", ",", "timeout", "=", "1", ",", "max_size", "=", "65535", ")", ":", "starts", "=", "OrderedDict", "(", ")", "ends", "=", "OrderedDict", "(", "...
1f9df5ee5b3cba466426b1164262278472ba4977
train
ping
Ping a host Parameters ---------- host: str The host or ip address to ping port: int, optional The port to ping, default=80 url: str, optional URL to ping, will do a host/port ping if not provided https: bool, optional Connect via ssl, default=False timeo...
serviceping/network.py
def ping(host, port=80, url=None, https=False, timeout=1, max_size=65535, sequence=0): """ Ping a host Parameters ---------- host: str The host or ip address to ping port: int, optional The port to ping, default=80 url: str, optional URL to ping, will do a host/por...
def ping(host, port=80, url=None, https=False, timeout=1, max_size=65535, sequence=0): """ Ping a host Parameters ---------- host: str The host or ip address to ping port: int, optional The port to ping, default=80 url: str, optional URL to ping, will do a host/por...
[ "Ping", "a", "host" ]
yahoo/serviceping
python
https://github.com/yahoo/serviceping/blob/1f9df5ee5b3cba466426b1164262278472ba4977/serviceping/network.py#L213-L265
[ "def", "ping", "(", "host", ",", "port", "=", "80", ",", "url", "=", "None", ",", "https", "=", "False", ",", "timeout", "=", "1", ",", "max_size", "=", "65535", ",", "sequence", "=", "0", ")", ":", "try", ":", "result", "=", "scan", "(", "host...
1f9df5ee5b3cba466426b1164262278472ba4977
train
upsert
The main reason we have arrived here. This is the entry-point for the utility to create/update a CloudFormation stack.
stackility/command.py
def upsert(version, stack, ini, dryrun, yaml, no_poll, work_directory): """ The main reason we have arrived here. This is the entry-point for the utility to create/update a CloudFormation stack. """ ini_data = read_config_info(ini) if 'environment' not in ini_data: print('[environment] s...
def upsert(version, stack, ini, dryrun, yaml, no_poll, work_directory): """ The main reason we have arrived here. This is the entry-point for the utility to create/update a CloudFormation stack. """ ini_data = read_config_info(ini) if 'environment' not in ini_data: print('[environment] s...
[ "The", "main", "reason", "we", "have", "arrived", "here", ".", "This", "is", "the", "entry", "-", "point", "for", "the", "utility", "to", "create", "/", "update", "a", "CloudFormation", "stack", "." ]
muckamuck/stackility
python
https://github.com/muckamuck/stackility/blob/b1696f02661134d31b99b4dea7c0d21d09482d33/stackility/command.py#L41-L74
[ "def", "upsert", "(", "version", ",", "stack", ",", "ini", ",", "dryrun", ",", "yaml", ",", "no_poll", ",", "work_directory", ")", ":", "ini_data", "=", "read_config_info", "(", "ini", ")", "if", "'environment'", "not", "in", "ini_data", ":", "print", "(...
b1696f02661134d31b99b4dea7c0d21d09482d33
train
delete
Delete the given CloudFormation stack.
stackility/command.py
def delete(stack, region, profile): """ Delete the given CloudFormation stack. """ ini_data = {} environment = {} environment['stack_name'] = stack if region: environment['region'] = region else: environment['region'] = find_myself() if profile: environment[...
def delete(stack, region, profile): """ Delete the given CloudFormation stack. """ ini_data = {} environment = {} environment['stack_name'] = stack if region: environment['region'] = region else: environment['region'] = find_myself() if profile: environment[...
[ "Delete", "the", "given", "CloudFormation", "stack", "." ]
muckamuck/stackility
python
https://github.com/muckamuck/stackility/blob/b1696f02661134d31b99b4dea7c0d21d09482d33/stackility/command.py#L81-L102
[ "def", "delete", "(", "stack", ",", "region", ",", "profile", ")", ":", "ini_data", "=", "{", "}", "environment", "=", "{", "}", "environment", "[", "'stack_name'", "]", "=", "stack", "if", "region", ":", "environment", "[", "'region'", "]", "=", "regi...
b1696f02661134d31b99b4dea7c0d21d09482d33
train
list
List all the CloudFormation stacks in the given region.
stackility/command.py
def list(region, profile): """ List all the CloudFormation stacks in the given region. """ ini_data = {} environment = {} if region: environment['region'] = region else: environment['region'] = find_myself() if profile: environment['profile'] = profile ini_...
def list(region, profile): """ List all the CloudFormation stacks in the given region. """ ini_data = {} environment = {} if region: environment['region'] = region else: environment['region'] = find_myself() if profile: environment['profile'] = profile ini_...
[ "List", "all", "the", "CloudFormation", "stacks", "in", "the", "given", "region", "." ]
muckamuck/stackility
python
https://github.com/muckamuck/stackility/blob/b1696f02661134d31b99b4dea7c0d21d09482d33/stackility/command.py#L108-L127
[ "def", "list", "(", "region", ",", "profile", ")", ":", "ini_data", "=", "{", "}", "environment", "=", "{", "}", "if", "region", ":", "environment", "[", "'region'", "]", "=", "region", "else", ":", "environment", "[", "'region'", "]", "=", "find_mysel...
b1696f02661134d31b99b4dea7c0d21d09482d33
train
drift
Produce a CloudFormation drift report for the given stack.
stackility/command.py
def drift(stack, region, profile): """ Produce a CloudFormation drift report for the given stack. """ logging.debug('finding drift - stack: {}'.format(stack)) logging.debug('region: {}'.format(region)) logging.debug('profile: {}'.format(profile)) tool = DriftTool( Stack=stack, ...
def drift(stack, region, profile): """ Produce a CloudFormation drift report for the given stack. """ logging.debug('finding drift - stack: {}'.format(stack)) logging.debug('region: {}'.format(region)) logging.debug('profile: {}'.format(profile)) tool = DriftTool( Stack=stack, ...
[ "Produce", "a", "CloudFormation", "drift", "report", "for", "the", "given", "stack", "." ]
muckamuck/stackility
python
https://github.com/muckamuck/stackility/blob/b1696f02661134d31b99b4dea7c0d21d09482d33/stackility/command.py#L134-L151
[ "def", "drift", "(", "stack", ",", "region", ",", "profile", ")", ":", "logging", ".", "debug", "(", "'finding drift - stack: {}'", ".", "format", "(", "stack", ")", ")", "logging", ".", "debug", "(", "'region: {}'", ".", "format", "(", "region", ")", ")...
b1696f02661134d31b99b4dea7c0d21d09482d33