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
valid
dict_to_env
Convert a python dict to a dict containing valid environment variable values. :param d: Dict to convert to an env dict :param pathsep: Path separator used to join lists(default os.pathsep)
cpenv/utils.py
def dict_to_env(d, pathsep=os.pathsep): ''' Convert a python dict to a dict containing valid environment variable values. :param d: Dict to convert to an env dict :param pathsep: Path separator used to join lists(default os.pathsep) ''' out_env = {} for k, v in d.iteritems(): ...
def dict_to_env(d, pathsep=os.pathsep): ''' Convert a python dict to a dict containing valid environment variable values. :param d: Dict to convert to an env dict :param pathsep: Path separator used to join lists(default os.pathsep) ''' out_env = {} for k, v in d.iteritems(): ...
[ "Convert", "a", "python", "dict", "to", "a", "dict", "containing", "valid", "environment", "variable", "values", "." ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/utils.py#L282-L301
[ "def", "dict_to_env", "(", "d", ",", "pathsep", "=", "os", ".", "pathsep", ")", ":", "out_env", "=", "{", "}", "for", "k", ",", "v", "in", "d", ".", "iteritems", "(", ")", ":", "if", "isinstance", "(", "v", ",", "list", ")", ":", "out_env", "["...
afbb569ae04002743db041d3629a5be8c290bd89
valid
expand_envvars
Expand all environment variables in an environment dict :param env: Environment dict
cpenv/utils.py
def expand_envvars(env): ''' Expand all environment variables in an environment dict :param env: Environment dict ''' out_env = {} for k, v in env.iteritems(): out_env[k] = Template(v).safe_substitute(env) # Expand twice to make sure we expand everything we possibly can for k...
def expand_envvars(env): ''' Expand all environment variables in an environment dict :param env: Environment dict ''' out_env = {} for k, v in env.iteritems(): out_env[k] = Template(v).safe_substitute(env) # Expand twice to make sure we expand everything we possibly can for k...
[ "Expand", "all", "environment", "variables", "in", "an", "environment", "dict" ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/utils.py#L304-L320
[ "def", "expand_envvars", "(", "env", ")", ":", "out_env", "=", "{", "}", "for", "k", ",", "v", "in", "env", ".", "iteritems", "(", ")", ":", "out_env", "[", "k", "]", "=", "Template", "(", "v", ")", ".", "safe_substitute", "(", "env", ")", "# Exp...
afbb569ae04002743db041d3629a5be8c290bd89
valid
get_store_env_tmp
Returns an unused random filepath.
cpenv/utils.py
def get_store_env_tmp(): '''Returns an unused random filepath.''' tempdir = tempfile.gettempdir() temp_name = 'envstore{0:0>3d}' temp_path = unipath(tempdir, temp_name.format(random.getrandbits(9))) if not os.path.exists(temp_path): return temp_path else: return get_store_env_tm...
def get_store_env_tmp(): '''Returns an unused random filepath.''' tempdir = tempfile.gettempdir() temp_name = 'envstore{0:0>3d}' temp_path = unipath(tempdir, temp_name.format(random.getrandbits(9))) if not os.path.exists(temp_path): return temp_path else: return get_store_env_tm...
[ "Returns", "an", "unused", "random", "filepath", "." ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/utils.py#L323-L332
[ "def", "get_store_env_tmp", "(", ")", ":", "tempdir", "=", "tempfile", ".", "gettempdir", "(", ")", "temp_name", "=", "'envstore{0:0>3d}'", "temp_path", "=", "unipath", "(", "tempdir", ",", "temp_name", ".", "format", "(", "random", ".", "getrandbits", "(", ...
afbb569ae04002743db041d3629a5be8c290bd89
valid
store_env
Encode current environment as yaml and store in path or a temporary file. Return the path to the stored environment.
cpenv/utils.py
def store_env(path=None): '''Encode current environment as yaml and store in path or a temporary file. Return the path to the stored environment. ''' path = path or get_store_env_tmp() env_dict = yaml.safe_dump(os.environ.data, default_flow_style=False) with open(path, 'w') as f: f.wr...
def store_env(path=None): '''Encode current environment as yaml and store in path or a temporary file. Return the path to the stored environment. ''' path = path or get_store_env_tmp() env_dict = yaml.safe_dump(os.environ.data, default_flow_style=False) with open(path, 'w') as f: f.wr...
[ "Encode", "current", "environment", "as", "yaml", "and", "store", "in", "path", "or", "a", "temporary", "file", ".", "Return", "the", "path", "to", "the", "stored", "environment", "." ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/utils.py#L335-L347
[ "def", "store_env", "(", "path", "=", "None", ")", ":", "path", "=", "path", "or", "get_store_env_tmp", "(", ")", "env_dict", "=", "yaml", ".", "safe_dump", "(", "os", ".", "environ", ".", "data", ",", "default_flow_style", "=", "False", ")", "with", "...
afbb569ae04002743db041d3629a5be8c290bd89
valid
restore_env
Set environment variables in the current python process from a dict containing envvars and values.
cpenv/utils.py
def restore_env(env_dict): '''Set environment variables in the current python process from a dict containing envvars and values.''' if hasattr(sys, 'real_prefix'): sys.prefix = sys.real_prefix del(sys.real_prefix) replace_osenviron(expand_envvars(dict_to_env(env_dict)))
def restore_env(env_dict): '''Set environment variables in the current python process from a dict containing envvars and values.''' if hasattr(sys, 'real_prefix'): sys.prefix = sys.real_prefix del(sys.real_prefix) replace_osenviron(expand_envvars(dict_to_env(env_dict)))
[ "Set", "environment", "variables", "in", "the", "current", "python", "process", "from", "a", "dict", "containing", "envvars", "and", "values", "." ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/utils.py#L350-L358
[ "def", "restore_env", "(", "env_dict", ")", ":", "if", "hasattr", "(", "sys", ",", "'real_prefix'", ")", ":", "sys", ".", "prefix", "=", "sys", ".", "real_prefix", "del", "(", "sys", ".", "real_prefix", ")", "replace_osenviron", "(", "expand_envvars", "(",...
afbb569ae04002743db041d3629a5be8c290bd89
valid
restore_env_from_file
Restore the current environment from an environment stored in a yaml yaml file. :param env_file: Path to environment yaml file.
cpenv/utils.py
def restore_env_from_file(env_file): '''Restore the current environment from an environment stored in a yaml yaml file. :param env_file: Path to environment yaml file. ''' with open(env_file, 'r') as f: env_dict = yaml.load(f.read()) restore_env(env_dict)
def restore_env_from_file(env_file): '''Restore the current environment from an environment stored in a yaml yaml file. :param env_file: Path to environment yaml file. ''' with open(env_file, 'r') as f: env_dict = yaml.load(f.read()) restore_env(env_dict)
[ "Restore", "the", "current", "environment", "from", "an", "environment", "stored", "in", "a", "yaml", "yaml", "file", "." ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/utils.py#L361-L371
[ "def", "restore_env_from_file", "(", "env_file", ")", ":", "with", "open", "(", "env_file", ",", "'r'", ")", "as", "f", ":", "env_dict", "=", "yaml", ".", "load", "(", "f", ".", "read", "(", ")", ")", "restore_env", "(", "env_dict", ")" ]
afbb569ae04002743db041d3629a5be8c290bd89
valid
set_env
Set environment variables in the current python process from a dict containing envvars and values.
cpenv/utils.py
def set_env(*env_dicts): '''Set environment variables in the current python process from a dict containing envvars and values.''' old_env_dict = env_to_dict(os.environ.data) new_env_dict = join_dicts(old_env_dict, *env_dicts) new_env = dict_to_env(new_env_dict) replace_osenviron(expand_envvars(...
def set_env(*env_dicts): '''Set environment variables in the current python process from a dict containing envvars and values.''' old_env_dict = env_to_dict(os.environ.data) new_env_dict = join_dicts(old_env_dict, *env_dicts) new_env = dict_to_env(new_env_dict) replace_osenviron(expand_envvars(...
[ "Set", "environment", "variables", "in", "the", "current", "python", "process", "from", "a", "dict", "containing", "envvars", "and", "values", "." ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/utils.py#L374-L381
[ "def", "set_env", "(", "*", "env_dicts", ")", ":", "old_env_dict", "=", "env_to_dict", "(", "os", ".", "environ", ".", "data", ")", "new_env_dict", "=", "join_dicts", "(", "old_env_dict", ",", "*", "env_dicts", ")", "new_env", "=", "dict_to_env", "(", "new...
afbb569ae04002743db041d3629a5be8c290bd89
valid
set_env_from_file
Restore the current environment from an environment stored in a yaml yaml file. :param env_file: Path to environment yaml file.
cpenv/utils.py
def set_env_from_file(env_file): '''Restore the current environment from an environment stored in a yaml yaml file. :param env_file: Path to environment yaml file. ''' with open(env_file, 'r') as f: env_dict = yaml.load(f.read()) if 'environment' in env_dict: env_dict = env_di...
def set_env_from_file(env_file): '''Restore the current environment from an environment stored in a yaml yaml file. :param env_file: Path to environment yaml file. ''' with open(env_file, 'r') as f: env_dict = yaml.load(f.read()) if 'environment' in env_dict: env_dict = env_di...
[ "Restore", "the", "current", "environment", "from", "an", "environment", "stored", "in", "a", "yaml", "yaml", "file", "." ]
cpenv/cpenv
python
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/utils.py#L384-L397
[ "def", "set_env_from_file", "(", "env_file", ")", ":", "with", "open", "(", "env_file", ",", "'r'", ")", "as", "f", ":", "env_dict", "=", "yaml", ".", "load", "(", "f", ".", "read", "(", ")", ")", "if", "'environment'", "in", "env_dict", ":", "env_di...
afbb569ae04002743db041d3629a5be8c290bd89
valid
BaseHandler.upstream_url
Returns the URL to the upstream data source for the given URI based on configuration
httpcache.py
def upstream_url(self, uri): "Returns the URL to the upstream data source for the given URI based on configuration" return self.application.options.upstream + self.request.uri
def upstream_url(self, uri): "Returns the URL to the upstream data source for the given URI based on configuration" return self.application.options.upstream + self.request.uri
[ "Returns", "the", "URL", "to", "the", "upstream", "data", "source", "for", "the", "given", "URI", "based", "on", "configuration" ]
langloisjp/pysvccache
python
https://github.com/langloisjp/pysvccache/blob/c4b95f1982f3a99e1f63341d15173099361e549b/httpcache.py#L62-L64
[ "def", "upstream_url", "(", "self", ",", "uri", ")", ":", "return", "self", ".", "application", ".", "options", ".", "upstream", "+", "self", ".", "request", ".", "uri" ]
c4b95f1982f3a99e1f63341d15173099361e549b
valid
BaseHandler.cache_get
Returns (headers, body) from the cache or raise KeyError
httpcache.py
def cache_get(self): "Returns (headers, body) from the cache or raise KeyError" key = self.cache_key() (headers, body, expires_ts) = self.application._cache[key] if expires_ts < time.now(): # asset has expired, delete it del self.application._cache[key] ...
def cache_get(self): "Returns (headers, body) from the cache or raise KeyError" key = self.cache_key() (headers, body, expires_ts) = self.application._cache[key] if expires_ts < time.now(): # asset has expired, delete it del self.application._cache[key] ...
[ "Returns", "(", "headers", "body", ")", "from", "the", "cache", "or", "raise", "KeyError" ]
langloisjp/pysvccache
python
https://github.com/langloisjp/pysvccache/blob/c4b95f1982f3a99e1f63341d15173099361e549b/httpcache.py#L70-L79
[ "def", "cache_get", "(", "self", ")", ":", "key", "=", "self", ".", "cache_key", "(", ")", "(", "headers", ",", "body", ",", "expires_ts", ")", "=", "self", ".", "application", ".", "_cache", "[", "key", "]", "if", "expires_ts", "<", "time", ".", "...
c4b95f1982f3a99e1f63341d15173099361e549b
valid
ProxyHandler.make_upstream_request
Return request object for calling the upstream
httpcache.py
def make_upstream_request(self): "Return request object for calling the upstream" url = self.upstream_url(self.request.uri) return tornado.httpclient.HTTPRequest(url, method=self.request.method, headers=self.request.headers, body=self.request.body if self.requ...
def make_upstream_request(self): "Return request object for calling the upstream" url = self.upstream_url(self.request.uri) return tornado.httpclient.HTTPRequest(url, method=self.request.method, headers=self.request.headers, body=self.request.body if self.requ...
[ "Return", "request", "object", "for", "calling", "the", "upstream" ]
langloisjp/pysvccache
python
https://github.com/langloisjp/pysvccache/blob/c4b95f1982f3a99e1f63341d15173099361e549b/httpcache.py#L123-L129
[ "def", "make_upstream_request", "(", "self", ")", ":", "url", "=", "self", ".", "upstream_url", "(", "self", ".", "request", ".", "uri", ")", "return", "tornado", ".", "httpclient", ".", "HTTPRequest", "(", "url", ",", "method", "=", "self", ".", "reques...
c4b95f1982f3a99e1f63341d15173099361e549b
valid
ProxyHandler.ttl
Returns time to live in seconds. 0 means no caching. Criteria: - response code 200 - read-only method (GET, HEAD, OPTIONS) Plus http headers: - cache-control: option1, option2, ... where options are: private | public no-cache no-store ...
httpcache.py
def ttl(self, response): """Returns time to live in seconds. 0 means no caching. Criteria: - response code 200 - read-only method (GET, HEAD, OPTIONS) Plus http headers: - cache-control: option1, option2, ... where options are: private | public ...
def ttl(self, response): """Returns time to live in seconds. 0 means no caching. Criteria: - response code 200 - read-only method (GET, HEAD, OPTIONS) Plus http headers: - cache-control: option1, option2, ... where options are: private | public ...
[ "Returns", "time", "to", "live", "in", "seconds", ".", "0", "means", "no", "caching", "." ]
langloisjp/pysvccache
python
https://github.com/langloisjp/pysvccache/blob/c4b95f1982f3a99e1f63341d15173099361e549b/httpcache.py#L131-L197
[ "def", "ttl", "(", "self", ",", "response", ")", ":", "if", "response", ".", "code", "!=", "200", ":", "return", "0", "if", "not", "self", ".", "request", ".", "method", "in", "[", "'GET'", ",", "'HEAD'", ",", "'OPTIONS'", "]", ":", "return", "0", ...
c4b95f1982f3a99e1f63341d15173099361e549b
valid
hist2d
Creates a 2-D histogram of data *x*, *y* with *bins*, *labels* = :code:`[title, xlabel, ylabel]`, aspect ration *aspect*. Attempts to use axis *ax* first, then the current axis of *fig*, then the last axis, to use an already-created window. Plotting (*plot*) is on by default, setting false doesn't attempt to c...
scisalt/matplotlib/hist2d.py
def hist2d(x, y, bins=10, labels=None, aspect="auto", plot=True, fig=None, ax=None, interpolation='none', cbar=True, **kwargs): """ Creates a 2-D histogram of data *x*, *y* with *bins*, *labels* = :code:`[title, xlabel, ylabel]`, aspect ration *aspect*. Attempts to use axis *ax* first, then the current axis of ...
def hist2d(x, y, bins=10, labels=None, aspect="auto", plot=True, fig=None, ax=None, interpolation='none', cbar=True, **kwargs): """ Creates a 2-D histogram of data *x*, *y* with *bins*, *labels* = :code:`[title, xlabel, ylabel]`, aspect ration *aspect*. Attempts to use axis *ax* first, then the current axis of ...
[ "Creates", "a", "2", "-", "D", "histogram", "of", "data", "*", "x", "*", "*", "y", "*", "with", "*", "bins", "*", "*", "labels", "*", "=", ":", "code", ":", "[", "title", "xlabel", "ylabel", "]", "aspect", "ration", "*", "aspect", "*", ".", "At...
joelfrederico/SciSalt
python
https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/matplotlib/hist2d.py#L12-L44
[ "def", "hist2d", "(", "x", ",", "y", ",", "bins", "=", "10", ",", "labels", "=", "None", ",", "aspect", "=", "\"auto\"", ",", "plot", "=", "True", ",", "fig", "=", "None", ",", "ax", "=", "None", ",", "interpolation", "=", "'none'", ",", "cbar", ...
7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f
valid
Plasma.w_p
Plasma frequency :math:`\\omega_p` for given plasma density
scisalt/PWFA/plasma.py
def w_p(self): """ Plasma frequency :math:`\\omega_p` for given plasma density """ return _np.sqrt(self.n_p * _np.power(_spc.e, 2) / (_spc.m_e * _spc.epsilon_0))
def w_p(self): """ Plasma frequency :math:`\\omega_p` for given plasma density """ return _np.sqrt(self.n_p * _np.power(_spc.e, 2) / (_spc.m_e * _spc.epsilon_0))
[ "Plasma", "frequency", ":", "math", ":", "\\\\", "omega_p", "for", "given", "plasma", "density" ]
joelfrederico/SciSalt
python
https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/PWFA/plasma.py#L82-L86
[ "def", "w_p", "(", "self", ")", ":", "return", "_np", ".", "sqrt", "(", "self", ".", "n_p", "*", "_np", ".", "power", "(", "_spc", ".", "e", ",", "2", ")", "/", "(", "_spc", ".", "m_e", "*", "_spc", ".", "epsilon_0", ")", ")" ]
7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f
valid
Plasma.k_ion
Geometric focusing force due to ion column for given plasma density as a function of *E*
scisalt/PWFA/plasma.py
def k_ion(self, E): """ Geometric focusing force due to ion column for given plasma density as a function of *E* """ return self.n_p * _np.power(_spc.e, 2) / (2*_sltr.GeV2joule(E) * _spc.epsilon_0)
def k_ion(self, E): """ Geometric focusing force due to ion column for given plasma density as a function of *E* """ return self.n_p * _np.power(_spc.e, 2) / (2*_sltr.GeV2joule(E) * _spc.epsilon_0)
[ "Geometric", "focusing", "force", "due", "to", "ion", "column", "for", "given", "plasma", "density", "as", "a", "function", "of", "*", "E", "*" ]
joelfrederico/SciSalt
python
https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/PWFA/plasma.py#L88-L92
[ "def", "k_ion", "(", "self", ",", "E", ")", ":", "return", "self", ".", "n_p", "*", "_np", ".", "power", "(", "_spc", ".", "e", ",", "2", ")", "/", "(", "2", "*", "_sltr", ".", "GeV2joule", "(", "E", ")", "*", "_spc", ".", "epsilon_0", ")" ]
7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f
valid
manifest
Guarantee the existence of a basic MANIFEST.in. manifest doc: http://docs.python.org/distutils/sourcedist.html#manifest `options.paved.dist.manifest.include`: set of files (or globs) to include with the `include` directive. `options.paved.dist.manifest.recursive_include`: set of files (or globs) to inclu...
paved/dist.py
def manifest(): """Guarantee the existence of a basic MANIFEST.in. manifest doc: http://docs.python.org/distutils/sourcedist.html#manifest `options.paved.dist.manifest.include`: set of files (or globs) to include with the `include` directive. `options.paved.dist.manifest.recursive_include`: set of fi...
def manifest(): """Guarantee the existence of a basic MANIFEST.in. manifest doc: http://docs.python.org/distutils/sourcedist.html#manifest `options.paved.dist.manifest.include`: set of files (or globs) to include with the `include` directive. `options.paved.dist.manifest.recursive_include`: set of fi...
[ "Guarantee", "the", "existence", "of", "a", "basic", "MANIFEST", ".", "in", "." ]
eykd/paved
python
https://github.com/eykd/paved/blob/f04f8a4248c571f3d5ce882b325884a3e5d80203/paved/dist.py#L42-L77
[ "def", "manifest", "(", ")", ":", "prune", "=", "options", ".", "paved", ".", "dist", ".", "manifest", ".", "prune", "graft", "=", "set", "(", ")", "if", "options", ".", "paved", ".", "dist", ".", "manifest", ".", "include_sphinx_docroot", ":", "docroo...
f04f8a4248c571f3d5ce882b325884a3e5d80203
valid
accessor
This template tag is used to do complex nested attribute accessing of an object. The first parameter is the object being accessed, subsequent paramters are one of: * a variable in the template context * a literal in the template context * either of the above surrounded in square brackets For...
awl/templatetags/awltags.py
def accessor(parser, token): """This template tag is used to do complex nested attribute accessing of an object. The first parameter is the object being accessed, subsequent paramters are one of: * a variable in the template context * a literal in the template context * either of the above su...
def accessor(parser, token): """This template tag is used to do complex nested attribute accessing of an object. The first parameter is the object being accessed, subsequent paramters are one of: * a variable in the template context * a literal in the template context * either of the above su...
[ "This", "template", "tag", "is", "used", "to", "do", "complex", "nested", "attribute", "accessing", "of", "an", "object", ".", "The", "first", "parameter", "is", "the", "object", "being", "accessed", "subsequent", "paramters", "are", "one", "of", ":" ]
cltrudeau/django-awl
python
https://github.com/cltrudeau/django-awl/blob/70d469ef9a161c1170b53aa017cf02d7c15eb90c/awl/templatetags/awltags.py#L40-L84
[ "def", "accessor", "(", "parser", ",", "token", ")", ":", "contents", "=", "token", ".", "split_contents", "(", ")", "tag", "=", "contents", "[", "0", "]", "if", "len", "(", "contents", ")", "<", "3", ":", "raise", "template", ".", "TemplateSyntaxError...
70d469ef9a161c1170b53aa017cf02d7c15eb90c
valid
get_field_value_from_context
Helper to get field value from string path. String '<context>' is used to go up on context stack. It just can be used at the beginning of path: <context>.<context>.field_name_1 On the other hand, '<root>' is used to start lookup from first item on context.
dirty_validators/complex.py
def get_field_value_from_context(field_name, context_list): """ Helper to get field value from string path. String '<context>' is used to go up on context stack. It just can be used at the beginning of path: <context>.<context>.field_name_1 On the other hand, '<root>' is used to start lookup from fi...
def get_field_value_from_context(field_name, context_list): """ Helper to get field value from string path. String '<context>' is used to go up on context stack. It just can be used at the beginning of path: <context>.<context>.field_name_1 On the other hand, '<root>' is used to start lookup from fi...
[ "Helper", "to", "get", "field", "value", "from", "string", "path", ".", "String", "<context", ">", "is", "used", "to", "go", "up", "on", "context", "stack", ".", "It", "just", "can", "be", "used", "at", "the", "beginning", "of", "path", ":", "<context"...
alfred82santa/dirty-validators
python
https://github.com/alfred82santa/dirty-validators/blob/95af84fb8e6452c8a6d88af496cbdb31bca7a608/dirty_validators/complex.py#L214-L256
[ "def", "get_field_value_from_context", "(", "field_name", ",", "context_list", ")", ":", "field_path", "=", "field_name", ".", "split", "(", "'.'", ")", "if", "field_path", "[", "0", "]", "==", "'<root>'", ":", "context_index", "=", "0", "field_path", ".", "...
95af84fb8e6452c8a6d88af496cbdb31bca7a608
valid
create_threadpool_executed_func
Returns a function wrapper that defers function calls execute inside gevent's threadpool but keeps any exception or backtrace in the caller's context. :param original_func: function to wrap :returns: wrapper function
src/infi/gevent_utils/deferred.py
def create_threadpool_executed_func(original_func): """ Returns a function wrapper that defers function calls execute inside gevent's threadpool but keeps any exception or backtrace in the caller's context. :param original_func: function to wrap :returns: wrapper function """ def wrapped_fun...
def create_threadpool_executed_func(original_func): """ Returns a function wrapper that defers function calls execute inside gevent's threadpool but keeps any exception or backtrace in the caller's context. :param original_func: function to wrap :returns: wrapper function """ def wrapped_fun...
[ "Returns", "a", "function", "wrapper", "that", "defers", "function", "calls", "execute", "inside", "gevent", "s", "threadpool", "but", "keeps", "any", "exception", "or", "backtrace", "in", "the", "caller", "s", "context", ".", ":", "param", "original_func", ":...
Infinidat/infi.gevent_utils
python
https://github.com/Infinidat/infi.gevent_utils/blob/7eb3c1601b8f2c9aaa3a83154ee7dfce8e5e5a5a/src/infi/gevent_utils/deferred.py#L6-L28
[ "def", "create_threadpool_executed_func", "(", "original_func", ")", ":", "def", "wrapped_func", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "result", "=", "original_func", "(", "*", "args", ",", "*", "*", "kwargs", ")", "return", "T...
7eb3c1601b8f2c9aaa3a83154ee7dfce8e5e5a5a
valid
format_pathname
Format a pathname :param str pathname: Pathname to format :param int max_length: Maximum length of result pathname (> 3) :return: Formatted pathname :rtype: str :raises ValueError: If *max_length* is not larger than 3 This function formats a pathname so it is not longer than *max_length* c...
starling/flask/template_filter.py
def format_pathname( pathname, max_length): """ Format a pathname :param str pathname: Pathname to format :param int max_length: Maximum length of result pathname (> 3) :return: Formatted pathname :rtype: str :raises ValueError: If *max_length* is not larger than 3 This...
def format_pathname( pathname, max_length): """ Format a pathname :param str pathname: Pathname to format :param int max_length: Maximum length of result pathname (> 3) :return: Formatted pathname :rtype: str :raises ValueError: If *max_length* is not larger than 3 This...
[ "Format", "a", "pathname" ]
geoneric/starling
python
https://github.com/geoneric/starling/blob/a8e1324c4d6e8b063a0d353bcd03bb8e57edd888/starling/flask/template_filter.py#L9-L33
[ "def", "format_pathname", "(", "pathname", ",", "max_length", ")", ":", "if", "max_length", "<=", "3", ":", "raise", "ValueError", "(", "\"max length must be larger than 3\"", ")", "if", "len", "(", "pathname", ")", ">", "max_length", ":", "pathname", "=", "\"...
a8e1324c4d6e8b063a0d353bcd03bb8e57edd888
valid
format_time_point
:param str time_point_string: String representation of a time point to format :return: Formatted time point :rtype: str :raises ValueError: If *time_point_string* is not formatted by dateutil.parser.parse See :py:meth:`datetime.datetime.isoformat` function for supported formats.
starling/flask/template_filter.py
def format_time_point( time_point_string): """ :param str time_point_string: String representation of a time point to format :return: Formatted time point :rtype: str :raises ValueError: If *time_point_string* is not formatted by dateutil.parser.parse See :py:meth:`date...
def format_time_point( time_point_string): """ :param str time_point_string: String representation of a time point to format :return: Formatted time point :rtype: str :raises ValueError: If *time_point_string* is not formatted by dateutil.parser.parse See :py:meth:`date...
[ ":", "param", "str", "time_point_string", ":", "String", "representation", "of", "a", "time", "point", "to", "format", ":", "return", ":", "Formatted", "time", "point", ":", "rtype", ":", "str", ":", "raises", "ValueError", ":", "If", "*", "time_point_string...
geoneric/starling
python
https://github.com/geoneric/starling/blob/a8e1324c4d6e8b063a0d353bcd03bb8e57edd888/starling/flask/template_filter.py#L36-L56
[ "def", "format_time_point", "(", "time_point_string", ")", ":", "time_point", "=", "dateutil", ".", "parser", ".", "parse", "(", "time_point_string", ")", "if", "not", "is_aware", "(", "time_point", ")", ":", "time_point", "=", "make_aware", "(", "time_point", ...
a8e1324c4d6e8b063a0d353bcd03bb8e57edd888
valid
format_uuid
Format a UUID string :param str uuid: UUID to format :param int max_length: Maximum length of result string (> 3) :return: Formatted UUID :rtype: str :raises ValueError: If *max_length* is not larger than 3 This function formats a UUID so it is not longer than *max_length* characters. The ...
starling/flask/template_filter.py
def format_uuid( uuid, max_length=10): """ Format a UUID string :param str uuid: UUID to format :param int max_length: Maximum length of result string (> 3) :return: Formatted UUID :rtype: str :raises ValueError: If *max_length* is not larger than 3 This function format...
def format_uuid( uuid, max_length=10): """ Format a UUID string :param str uuid: UUID to format :param int max_length: Maximum length of result string (> 3) :return: Formatted UUID :rtype: str :raises ValueError: If *max_length* is not larger than 3 This function format...
[ "Format", "a", "UUID", "string" ]
geoneric/starling
python
https://github.com/geoneric/starling/blob/a8e1324c4d6e8b063a0d353bcd03bb8e57edd888/starling/flask/template_filter.py#L59-L87
[ "def", "format_uuid", "(", "uuid", ",", "max_length", "=", "10", ")", ":", "if", "max_length", "<=", "3", ":", "raise", "ValueError", "(", "\"max length must be larger than 3\"", ")", "if", "len", "(", "uuid", ")", ">", "max_length", ":", "uuid", "=", "\"{...
a8e1324c4d6e8b063a0d353bcd03bb8e57edd888
valid
chisquare
Finds the reduced chi square difference of *observe* and *expect* with a given *error* and *ddof* degrees of freedom. *verbose* flag determines if the reduced chi square is printed to the terminal.
scisalt/scipy/chisquare.py
def chisquare(observe, expect, error, ddof, verbose=True): """ Finds the reduced chi square difference of *observe* and *expect* with a given *error* and *ddof* degrees of freedom. *verbose* flag determines if the reduced chi square is printed to the terminal. """ chisq = 0 error = error.fla...
def chisquare(observe, expect, error, ddof, verbose=True): """ Finds the reduced chi square difference of *observe* and *expect* with a given *error* and *ddof* degrees of freedom. *verbose* flag determines if the reduced chi square is printed to the terminal. """ chisq = 0 error = error.fla...
[ "Finds", "the", "reduced", "chi", "square", "difference", "of", "*", "observe", "*", "and", "*", "expect", "*", "with", "a", "given", "*", "error", "*", "and", "*", "ddof", "*", "degrees", "of", "freedom", "." ]
joelfrederico/SciSalt
python
https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/scipy/chisquare.py#L7-L25
[ "def", "chisquare", "(", "observe", ",", "expect", ",", "error", ",", "ddof", ",", "verbose", "=", "True", ")", ":", "chisq", "=", "0", "error", "=", "error", ".", "flatten", "(", ")", "observe", "=", "observe", ".", "flatten", "(", ")", "expect", ...
7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f
valid
frexp10
Finds the mantissa and exponent of a number :math:`x` such that :math:`x = m 10^e`. Parameters ---------- x : float Number :math:`x` such that :math:`x = m 10^e`. Returns ------- mantissa : float Number :math:`m` such that :math:`x = m 10^e`. exponent : float Numb...
scisalt/numpy/frexp10.py
def frexp10(x): """ Finds the mantissa and exponent of a number :math:`x` such that :math:`x = m 10^e`. Parameters ---------- x : float Number :math:`x` such that :math:`x = m 10^e`. Returns ------- mantissa : float Number :math:`m` such that :math:`x = m 10^e`. e...
def frexp10(x): """ Finds the mantissa and exponent of a number :math:`x` such that :math:`x = m 10^e`. Parameters ---------- x : float Number :math:`x` such that :math:`x = m 10^e`. Returns ------- mantissa : float Number :math:`m` such that :math:`x = m 10^e`. e...
[ "Finds", "the", "mantissa", "and", "exponent", "of", "a", "number", ":", "math", ":", "x", "such", "that", ":", "math", ":", "x", "=", "m", "10^e", "." ]
joelfrederico/SciSalt
python
https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/numpy/frexp10.py#L7-L27
[ "def", "frexp10", "(", "x", ")", ":", "expon", "=", "_np", ".", "int", "(", "_np", ".", "floor", "(", "_np", ".", "log10", "(", "_np", ".", "abs", "(", "x", ")", ")", ")", ")", "mant", "=", "x", "/", "_np", ".", "power", "(", "10", ",", "...
7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f
valid
get_upcoming_events_count
Returns count of upcoming events for a given number of days, either featured or all Usage: {% get_upcoming_events_count DAYS as events_count %} with days being the number of days you want, or 5 by default
build/lib/happenings/templatetags/event_tags.py
def get_upcoming_events_count(days=14, featured=False): """ Returns count of upcoming events for a given number of days, either featured or all Usage: {% get_upcoming_events_count DAYS as events_count %} with days being the number of days you want, or 5 by default """ from happenings.models ...
def get_upcoming_events_count(days=14, featured=False): """ Returns count of upcoming events for a given number of days, either featured or all Usage: {% get_upcoming_events_count DAYS as events_count %} with days being the number of days you want, or 5 by default """ from happenings.models ...
[ "Returns", "count", "of", "upcoming", "events", "for", "a", "given", "number", "of", "days", "either", "featured", "or", "all", "Usage", ":", "{", "%", "get_upcoming_events_count", "DAYS", "as", "events_count", "%", "}", "with", "days", "being", "the", "numb...
tBaxter/tango-happenings
python
https://github.com/tBaxter/tango-happenings/blob/cb3c49ea39e0a6cef9c6ffb534c2fbf401139ba2/build/lib/happenings/templatetags/event_tags.py#L11-L27
[ "def", "get_upcoming_events_count", "(", "days", "=", "14", ",", "featured", "=", "False", ")", ":", "from", "happenings", ".", "models", "import", "Event", "start_period", "=", "today", "-", "datetime", ".", "timedelta", "(", "days", "=", "2", ")", "end_p...
cb3c49ea39e0a6cef9c6ffb534c2fbf401139ba2
valid
get_upcoming_events
Get upcoming events. Allows slicing to a given number, picking the number of days to hold them after they've started and whether they should be featured or not. Usage: {% get_upcoming_events 5 14 featured as events %} Would return no more than 5 Featured events, holding them for 14 days past...
build/lib/happenings/templatetags/event_tags.py
def get_upcoming_events(num, days, featured=False): """ Get upcoming events. Allows slicing to a given number, picking the number of days to hold them after they've started and whether they should be featured or not. Usage: {% get_upcoming_events 5 14 featured as events %} Would return n...
def get_upcoming_events(num, days, featured=False): """ Get upcoming events. Allows slicing to a given number, picking the number of days to hold them after they've started and whether they should be featured or not. Usage: {% get_upcoming_events 5 14 featured as events %} Would return n...
[ "Get", "upcoming", "events", ".", "Allows", "slicing", "to", "a", "given", "number", "picking", "the", "number", "of", "days", "to", "hold", "them", "after", "they", "ve", "started", "and", "whether", "they", "should", "be", "featured", "or", "not", ".", ...
tBaxter/tango-happenings
python
https://github.com/tBaxter/tango-happenings/blob/cb3c49ea39e0a6cef9c6ffb534c2fbf401139ba2/build/lib/happenings/templatetags/event_tags.py#L31-L49
[ "def", "get_upcoming_events", "(", "num", ",", "days", ",", "featured", "=", "False", ")", ":", "from", "happenings", ".", "models", "import", "Event", "start_date", "=", "today", "-", "datetime", ".", "timedelta", "(", "days", "=", "days", ")", "events", ...
cb3c49ea39e0a6cef9c6ffb534c2fbf401139ba2
valid
get_events_by_date_range
Get upcoming events for a given number of days (days out) Allows specifying number of days to hold events after they've started The max number to show (defaults to 5) and whether they should be featured or not. Usage: {% get_events_by_date_range 14 3 3 'featured' as events %} Would return no mor...
build/lib/happenings/templatetags/event_tags.py
def get_events_by_date_range(days_out, days_hold, max_num=5, featured=False): """ Get upcoming events for a given number of days (days out) Allows specifying number of days to hold events after they've started The max number to show (defaults to 5) and whether they should be featured or not. Usa...
def get_events_by_date_range(days_out, days_hold, max_num=5, featured=False): """ Get upcoming events for a given number of days (days out) Allows specifying number of days to hold events after they've started The max number to show (defaults to 5) and whether they should be featured or not. Usa...
[ "Get", "upcoming", "events", "for", "a", "given", "number", "of", "days", "(", "days", "out", ")", "Allows", "specifying", "number", "of", "days", "to", "hold", "events", "after", "they", "ve", "started", "The", "max", "number", "to", "show", "(", "defau...
tBaxter/tango-happenings
python
https://github.com/tBaxter/tango-happenings/blob/cb3c49ea39e0a6cef9c6ffb534c2fbf401139ba2/build/lib/happenings/templatetags/event_tags.py#L53-L75
[ "def", "get_events_by_date_range", "(", "days_out", ",", "days_hold", ",", "max_num", "=", "5", ",", "featured", "=", "False", ")", ":", "from", "happenings", ".", "models", "import", "Event", "range_start", "=", "today", "-", "datetime", ".", "timedelta", "...
cb3c49ea39e0a6cef9c6ffb534c2fbf401139ba2
valid
paginate_update
attempts to get next and previous on updates
build/lib/happenings/templatetags/event_tags.py
def paginate_update(update): """ attempts to get next and previous on updates """ from happenings.models import Update time = update.pub_time event = update.event try: next = Update.objects.filter( event=event, pub_time__gt=time ).order_by('pub_time')....
def paginate_update(update): """ attempts to get next and previous on updates """ from happenings.models import Update time = update.pub_time event = update.event try: next = Update.objects.filter( event=event, pub_time__gt=time ).order_by('pub_time')....
[ "attempts", "to", "get", "next", "and", "previous", "on", "updates" ]
tBaxter/tango-happenings
python
https://github.com/tBaxter/tango-happenings/blob/cb3c49ea39e0a6cef9c6ffb534c2fbf401139ba2/build/lib/happenings/templatetags/event_tags.py#L99-L120
[ "def", "paginate_update", "(", "update", ")", ":", "from", "happenings", ".", "models", "import", "Update", "time", "=", "update", ".", "pub_time", "event", "=", "update", ".", "event", "try", ":", "next", "=", "Update", ".", "objects", ".", "filter", "(...
cb3c49ea39e0a6cef9c6ffb534c2fbf401139ba2
valid
notify_client
Notify the client of the result of handling a request The payload contains two elements: - client_id - result The *client_id* is the id of the client to notify. It is assumed that the notifier service is able to identify the client by this id and that it can pass the *result* to it. The ...
starling/pika/decorator.py
def notify_client( notifier_uri, client_id, status_code, message=None): """ Notify the client of the result of handling a request The payload contains two elements: - client_id - result The *client_id* is the id of the client to notify. It is assumed that t...
def notify_client( notifier_uri, client_id, status_code, message=None): """ Notify the client of the result of handling a request The payload contains two elements: - client_id - result The *client_id* is the id of the client to notify. It is assumed that t...
[ "Notify", "the", "client", "of", "the", "result", "of", "handling", "a", "request" ]
geoneric/starling
python
https://github.com/geoneric/starling/blob/a8e1324c4d6e8b063a0d353bcd03bb8e57edd888/starling/pika/decorator.py#L7-L47
[ "def", "notify_client", "(", "notifier_uri", ",", "client_id", ",", "status_code", ",", "message", "=", "None", ")", ":", "payload", "=", "{", "\"client_id\"", ":", "client_id", ",", "\"result\"", ":", "{", "\"response\"", ":", "{", "\"status_code\"", ":", "...
a8e1324c4d6e8b063a0d353bcd03bb8e57edd888
valid
consume_message
Decorator for methods handling requests from RabbitMQ The goal of this decorator is to perform the tasks common to all methods handling requests: - Log the raw message to *stdout* - Decode the message into a Python dictionary - Log errors to *stderr* - Signal the broker that we're done handlin...
starling/pika/decorator.py
def consume_message( method): """ Decorator for methods handling requests from RabbitMQ The goal of this decorator is to perform the tasks common to all methods handling requests: - Log the raw message to *stdout* - Decode the message into a Python dictionary - Log errors to *stder...
def consume_message( method): """ Decorator for methods handling requests from RabbitMQ The goal of this decorator is to perform the tasks common to all methods handling requests: - Log the raw message to *stdout* - Decode the message into a Python dictionary - Log errors to *stder...
[ "Decorator", "for", "methods", "handling", "requests", "from", "RabbitMQ" ]
geoneric/starling
python
https://github.com/geoneric/starling/blob/a8e1324c4d6e8b063a0d353bcd03bb8e57edd888/starling/pika/decorator.py#L50-L96
[ "def", "consume_message", "(", "method", ")", ":", "def", "wrapper", "(", "self", ",", "channel", ",", "method_frame", ",", "header_frame", ",", "body", ")", ":", "# Log the message", "sys", ".", "stdout", ".", "write", "(", "\"received message: {}\\n\"", ".",...
a8e1324c4d6e8b063a0d353bcd03bb8e57edd888
valid
consume_message_with_notify
Decorator for methods handling requests from RabbitMQ This decorator builds on the :py:func:`consume_message` decorator. It extents it by logic for notifying a client of the result of handling the request. The *notifier_uri_getter* argument must be a callable which accepts *self* and returns the u...
starling/pika/decorator.py
def consume_message_with_notify( notifier_uri_getter): """ Decorator for methods handling requests from RabbitMQ This decorator builds on the :py:func:`consume_message` decorator. It extents it by logic for notifying a client of the result of handling the request. The *notifier_uri_get...
def consume_message_with_notify( notifier_uri_getter): """ Decorator for methods handling requests from RabbitMQ This decorator builds on the :py:func:`consume_message` decorator. It extents it by logic for notifying a client of the result of handling the request. The *notifier_uri_get...
[ "Decorator", "for", "methods", "handling", "requests", "from", "RabbitMQ" ]
geoneric/starling
python
https://github.com/geoneric/starling/blob/a8e1324c4d6e8b063a0d353bcd03bb8e57edd888/starling/pika/decorator.py#L99-L134
[ "def", "consume_message_with_notify", "(", "notifier_uri_getter", ")", ":", "def", "consume_message_with_notify_decorator", "(", "method", ")", ":", "@", "consume_message", "def", "wrapper", "(", "self", ",", "data", ")", ":", "notifier_uri", "=", "notifier_uri_getter...
a8e1324c4d6e8b063a0d353bcd03bb8e57edd888
valid
LRUCache.get
>>> c = LRUCache() >>> c.get('toto') Traceback (most recent call last): ... KeyError: 'toto' >>> c.stats()['misses'] 1 >>> c.put('toto', 'tata') >>> c.get('toto') 'tata' >>> c.stats()['hits'] 1
lrucache.py
def get(self, key): """ >>> c = LRUCache() >>> c.get('toto') Traceback (most recent call last): ... KeyError: 'toto' >>> c.stats()['misses'] 1 >>> c.put('toto', 'tata') >>> c.get('toto') 'tata' >>> c.stats()['hits'] ...
def get(self, key): """ >>> c = LRUCache() >>> c.get('toto') Traceback (most recent call last): ... KeyError: 'toto' >>> c.stats()['misses'] 1 >>> c.put('toto', 'tata') >>> c.get('toto') 'tata' >>> c.stats()['hits'] ...
[ ">>>", "c", "=", "LRUCache", "()", ">>>", "c", ".", "get", "(", "toto", ")", "Traceback", "(", "most", "recent", "call", "last", ")", ":", "...", "KeyError", ":", "toto", ">>>", "c", ".", "stats", "()", "[", "misses", "]", "1", ">>>", "c", ".", ...
langloisjp/pysvccache
python
https://github.com/langloisjp/pysvccache/blob/c4b95f1982f3a99e1f63341d15173099361e549b/lrucache.py#L35-L57
[ "def", "get", "(", "self", ",", "key", ")", ":", "try", ":", "value", "=", "self", ".", "_cache", "[", "key", "]", "self", ".", "_order", ".", "push", "(", "key", ")", "self", ".", "_hits", "+=", "1", "return", "value", "except", "KeyError", ",",...
c4b95f1982f3a99e1f63341d15173099361e549b
valid
LRUCache.put
>>> c = LRUCache() >>> c.put(1, 'one') >>> c.get(1) 'one' >>> c.size() 1 >>> c.put(2, 'two') >>> c.put(3, 'three') >>> c.put(4, 'four') >>> c.put(5, 'five') >>> c.get(5) 'five' >>> c.size() 5
lrucache.py
def put(self, key, value): """ >>> c = LRUCache() >>> c.put(1, 'one') >>> c.get(1) 'one' >>> c.size() 1 >>> c.put(2, 'two') >>> c.put(3, 'three') >>> c.put(4, 'four') >>> c.put(5, 'five') >>> c.get(5) 'five' ...
def put(self, key, value): """ >>> c = LRUCache() >>> c.put(1, 'one') >>> c.get(1) 'one' >>> c.size() 1 >>> c.put(2, 'two') >>> c.put(3, 'three') >>> c.put(4, 'four') >>> c.put(5, 'five') >>> c.get(5) 'five' ...
[ ">>>", "c", "=", "LRUCache", "()", ">>>", "c", ".", "put", "(", "1", "one", ")", ">>>", "c", ".", "get", "(", "1", ")", "one", ">>>", "c", ".", "size", "()", "1", ">>>", "c", ".", "put", "(", "2", "two", ")", ">>>", "c", ".", "put", "(", ...
langloisjp/pysvccache
python
https://github.com/langloisjp/pysvccache/blob/c4b95f1982f3a99e1f63341d15173099361e549b/lrucache.py#L59-L78
[ "def", "put", "(", "self", ",", "key", ",", "value", ")", ":", "self", ".", "_cache", "[", "key", "]", "=", "value", "self", ".", "_order", ".", "push", "(", "key", ")", "self", ".", "_size", "+=", "1" ]
c4b95f1982f3a99e1f63341d15173099361e549b
valid
LRUCache.delete
>>> c = LRUCache() >>> c.put(1, 'one') >>> c.get(1) 'one' >>> c.delete(1) >>> c.get(1) Traceback (most recent call last): ... KeyError: 1 >>> c.delete(1) Traceback (most recent call last): ... KeyError: 1
lrucache.py
def delete(self, key): """ >>> c = LRUCache() >>> c.put(1, 'one') >>> c.get(1) 'one' >>> c.delete(1) >>> c.get(1) Traceback (most recent call last): ... KeyError: 1 >>> c.delete(1) Traceback (most recent call last): ...
def delete(self, key): """ >>> c = LRUCache() >>> c.put(1, 'one') >>> c.get(1) 'one' >>> c.delete(1) >>> c.get(1) Traceback (most recent call last): ... KeyError: 1 >>> c.delete(1) Traceback (most recent call last): ...
[ ">>>", "c", "=", "LRUCache", "()", ">>>", "c", ".", "put", "(", "1", "one", ")", ">>>", "c", ".", "get", "(", "1", ")", "one", ">>>", "c", ".", "delete", "(", "1", ")", ">>>", "c", ".", "get", "(", "1", ")", "Traceback", "(", "most", "recen...
langloisjp/pysvccache
python
https://github.com/langloisjp/pysvccache/blob/c4b95f1982f3a99e1f63341d15173099361e549b/lrucache.py#L80-L98
[ "def", "delete", "(", "self", ",", "key", ")", ":", "del", "self", ".", "_cache", "[", "key", "]", "self", ".", "_order", ".", "delete", "(", "key", ")", "self", ".", "_size", "-=", "1" ]
c4b95f1982f3a99e1f63341d15173099361e549b
valid
MemSizeLRUCache.put
>>> c = MemSizeLRUCache(maxmem=24*4) >>> c.put(1, 1) >>> c.mem() # 24-bytes per integer 24 >>> c.put(2, 2) >>> c.put(3, 3) >>> c.put(4, 4) >>> c.get(1) 1 >>> c.mem() 96 >>> c.size() 4 >>> c.put(5, 5) >>> c.si...
lrucache.py
def put(self, key, value): """ >>> c = MemSizeLRUCache(maxmem=24*4) >>> c.put(1, 1) >>> c.mem() # 24-bytes per integer 24 >>> c.put(2, 2) >>> c.put(3, 3) >>> c.put(4, 4) >>> c.get(1) 1 >>> c.mem() 96 >>> c.size() ...
def put(self, key, value): """ >>> c = MemSizeLRUCache(maxmem=24*4) >>> c.put(1, 1) >>> c.mem() # 24-bytes per integer 24 >>> c.put(2, 2) >>> c.put(3, 3) >>> c.put(4, 4) >>> c.get(1) 1 >>> c.mem() 96 >>> c.size() ...
[ ">>>", "c", "=", "MemSizeLRUCache", "(", "maxmem", "=", "24", "*", "4", ")", ">>>", "c", ".", "put", "(", "1", "1", ")", ">>>", "c", ".", "mem", "()", "#", "24", "-", "bytes", "per", "integer", "24", ">>>", "c", ".", "put", "(", "2", "2", "...
langloisjp/pysvccache
python
https://github.com/langloisjp/pysvccache/blob/c4b95f1982f3a99e1f63341d15173099361e549b/lrucache.py#L162-L189
[ "def", "put", "(", "self", ",", "key", ",", "value", ")", ":", "mem", "=", "sys", ".", "getsizeof", "(", "value", ")", "if", "self", ".", "_mem", "+", "mem", ">", "self", ".", "_maxmem", ":", "self", ".", "delete", "(", "self", ".", "last", "("...
c4b95f1982f3a99e1f63341d15173099361e549b
valid
MemSizeLRUCache.delete
>>> c = MemSizeLRUCache() >>> c.put(1, 1) >>> c.mem() 24 >>> c.delete(1) >>> c.mem() 0
lrucache.py
def delete(self, key): """ >>> c = MemSizeLRUCache() >>> c.put(1, 1) >>> c.mem() 24 >>> c.delete(1) >>> c.mem() 0 """ (_value, mem) = LRUCache.get(self, key) self._mem -= mem LRUCache.delete(self, key)
def delete(self, key): """ >>> c = MemSizeLRUCache() >>> c.put(1, 1) >>> c.mem() 24 >>> c.delete(1) >>> c.mem() 0 """ (_value, mem) = LRUCache.get(self, key) self._mem -= mem LRUCache.delete(self, key)
[ ">>>", "c", "=", "MemSizeLRUCache", "()", ">>>", "c", ".", "put", "(", "1", "1", ")", ">>>", "c", ".", "mem", "()", "24", ">>>", "c", ".", "delete", "(", "1", ")", ">>>", "c", ".", "mem", "()", "0" ]
langloisjp/pysvccache
python
https://github.com/langloisjp/pysvccache/blob/c4b95f1982f3a99e1f63341d15173099361e549b/lrucache.py#L195-L207
[ "def", "delete", "(", "self", ",", "key", ")", ":", "(", "_value", ",", "mem", ")", "=", "LRUCache", ".", "get", "(", "self", ",", "key", ")", "self", ".", "_mem", "-=", "mem", "LRUCache", ".", "delete", "(", "self", ",", "key", ")" ]
c4b95f1982f3a99e1f63341d15173099361e549b
valid
FixedSizeLRUCache.put
>>> c = FixedSizeLRUCache(maxsize=5) >>> c.put(1, 'one') >>> c.get(1) 'one' >>> c.size() 1 >>> c.put(2, 'two') >>> c.put(3, 'three') >>> c.put(4, 'four') >>> c.put(5, 'five') >>> c.get(5) 'five' >>> c.size() 5 ...
lrucache.py
def put(self, key, value): """ >>> c = FixedSizeLRUCache(maxsize=5) >>> c.put(1, 'one') >>> c.get(1) 'one' >>> c.size() 1 >>> c.put(2, 'two') >>> c.put(3, 'three') >>> c.put(4, 'four') >>> c.put(5, 'five') >>> c.get(5) ...
def put(self, key, value): """ >>> c = FixedSizeLRUCache(maxsize=5) >>> c.put(1, 'one') >>> c.get(1) 'one' >>> c.size() 1 >>> c.put(2, 'two') >>> c.put(3, 'three') >>> c.put(4, 'four') >>> c.put(5, 'five') >>> c.get(5) ...
[ ">>>", "c", "=", "FixedSizeLRUCache", "(", "maxsize", "=", "5", ")", ">>>", "c", ".", "put", "(", "1", "one", ")", ">>>", "c", ".", "get", "(", "1", ")", "one", ">>>", "c", ".", "size", "()", "1", ">>>", "c", ".", "put", "(", "2", "two", ")...
langloisjp/pysvccache
python
https://github.com/langloisjp/pysvccache/blob/c4b95f1982f3a99e1f63341d15173099361e549b/lrucache.py#L216-L253
[ "def", "put", "(", "self", ",", "key", ",", "value", ")", ":", "# check if we're maxed out first", "if", "self", ".", "size", "(", ")", "==", "self", ".", "_maxsize", ":", "# need to kick something out...", "self", ".", "delete", "(", "self", ".", "last", ...
c4b95f1982f3a99e1f63341d15173099361e549b
valid
Plugin.setting
Retrieves the setting value whose name is indicated by name_hyphen. Values starting with $ are assumed to reference environment variables, and the value stored in environment variables is retrieved. It's an error if thes corresponding environment variable it not set.
cashew/plugin.py
def setting(self, name_hyphen): """ Retrieves the setting value whose name is indicated by name_hyphen. Values starting with $ are assumed to reference environment variables, and the value stored in environment variables is retrieved. It's an error if thes corresponding environm...
def setting(self, name_hyphen): """ Retrieves the setting value whose name is indicated by name_hyphen. Values starting with $ are assumed to reference environment variables, and the value stored in environment variables is retrieved. It's an error if thes corresponding environm...
[ "Retrieves", "the", "setting", "value", "whose", "name", "is", "indicated", "by", "name_hyphen", "." ]
dexy/cashew
python
https://github.com/dexy/cashew/blob/39890a6e1e4e4e514e98cdb18368e29cc6710e52/cashew/plugin.py#L79-L105
[ "def", "setting", "(", "self", ",", "name_hyphen", ")", ":", "if", "name_hyphen", "in", "self", ".", "_instance_settings", ":", "value", "=", "self", ".", "_instance_settings", "[", "name_hyphen", "]", "[", "1", "]", "else", ":", "msg", "=", "\"No setting ...
39890a6e1e4e4e514e98cdb18368e29cc6710e52
valid
Plugin.setting_values
Returns dict of all setting values (removes the helpstrings).
cashew/plugin.py
def setting_values(self, skip=None): """ Returns dict of all setting values (removes the helpstrings). """ if not skip: skip = [] return dict( (k, v[1]) for k, v in six.iteritems(self._instance_settings) if not k in ski...
def setting_values(self, skip=None): """ Returns dict of all setting values (removes the helpstrings). """ if not skip: skip = [] return dict( (k, v[1]) for k, v in six.iteritems(self._instance_settings) if not k in ski...
[ "Returns", "dict", "of", "all", "setting", "values", "(", "removes", "the", "helpstrings", ")", "." ]
dexy/cashew
python
https://github.com/dexy/cashew/blob/39890a6e1e4e4e514e98cdb18368e29cc6710e52/cashew/plugin.py#L107-L117
[ "def", "setting_values", "(", "self", ",", "skip", "=", "None", ")", ":", "if", "not", "skip", ":", "skip", "=", "[", "]", "return", "dict", "(", "(", "k", ",", "v", "[", "1", "]", ")", "for", "k", ",", "v", "in", "six", ".", "iteritems", "("...
39890a6e1e4e4e514e98cdb18368e29cc6710e52
valid
Plugin._update_settings
This method does the work of updating settings. Can be passed with enforce_helpstring = False which you may want if allowing end users to add arbitrary metadata via the settings system. Preferable to use update_settings (without leading _) in code to do the right thing and always have d...
cashew/plugin.py
def _update_settings(self, new_settings, enforce_helpstring=True): """ This method does the work of updating settings. Can be passed with enforce_helpstring = False which you may want if allowing end users to add arbitrary metadata via the settings system. Preferable to use upda...
def _update_settings(self, new_settings, enforce_helpstring=True): """ This method does the work of updating settings. Can be passed with enforce_helpstring = False which you may want if allowing end users to add arbitrary metadata via the settings system. Preferable to use upda...
[ "This", "method", "does", "the", "work", "of", "updating", "settings", ".", "Can", "be", "passed", "with", "enforce_helpstring", "=", "False", "which", "you", "may", "want", "if", "allowing", "end", "users", "to", "add", "arbitrary", "metadata", "via", "the"...
dexy/cashew
python
https://github.com/dexy/cashew/blob/39890a6e1e4e4e514e98cdb18368e29cc6710e52/cashew/plugin.py#L128-L160
[ "def", "_update_settings", "(", "self", ",", "new_settings", ",", "enforce_helpstring", "=", "True", ")", ":", "for", "raw_setting_name", ",", "value", "in", "six", ".", "iteritems", "(", "new_settings", ")", ":", "setting_name", "=", "raw_setting_name", ".", ...
39890a6e1e4e4e514e98cdb18368e29cc6710e52
valid
Plugin.settings_and_attributes
Return a combined dictionary of setting values and attribute values.
cashew/plugin.py
def settings_and_attributes(self): """Return a combined dictionary of setting values and attribute values.""" attrs = self.setting_values() attrs.update(self.__dict__) skip = ["_instance_settings", "aliases"] for a in skip: del attrs[a] return attrs
def settings_and_attributes(self): """Return a combined dictionary of setting values and attribute values.""" attrs = self.setting_values() attrs.update(self.__dict__) skip = ["_instance_settings", "aliases"] for a in skip: del attrs[a] return attrs
[ "Return", "a", "combined", "dictionary", "of", "setting", "values", "and", "attribute", "values", "." ]
dexy/cashew
python
https://github.com/dexy/cashew/blob/39890a6e1e4e4e514e98cdb18368e29cc6710e52/cashew/plugin.py#L162-L169
[ "def", "settings_and_attributes", "(", "self", ")", ":", "attrs", "=", "self", ".", "setting_values", "(", ")", "attrs", ".", "update", "(", "self", ".", "__dict__", ")", "skip", "=", "[", "\"_instance_settings\"", ",", "\"aliases\"", "]", "for", "a", "in"...
39890a6e1e4e4e514e98cdb18368e29cc6710e52
valid
PluginMeta.get_reference_to_class
Detect if we get a class or a name, convert a name to a class.
cashew/plugin.py
def get_reference_to_class(cls, class_or_class_name): """ Detect if we get a class or a name, convert a name to a class. """ if isinstance(class_or_class_name, type): return class_or_class_name elif isinstance(class_or_class_name, string_types): if ":" in...
def get_reference_to_class(cls, class_or_class_name): """ Detect if we get a class or a name, convert a name to a class. """ if isinstance(class_or_class_name, type): return class_or_class_name elif isinstance(class_or_class_name, string_types): if ":" in...
[ "Detect", "if", "we", "get", "a", "class", "or", "a", "name", "convert", "a", "name", "to", "a", "class", "." ]
dexy/cashew
python
https://github.com/dexy/cashew/blob/39890a6e1e4e4e514e98cdb18368e29cc6710e52/cashew/plugin.py#L230-L252
[ "def", "get_reference_to_class", "(", "cls", ",", "class_or_class_name", ")", ":", "if", "isinstance", "(", "class_or_class_name", ",", "type", ")", ":", "return", "class_or_class_name", "elif", "isinstance", "(", "class_or_class_name", ",", "string_types", ")", ":"...
39890a6e1e4e4e514e98cdb18368e29cc6710e52
valid
PluginMeta.check_docstring
Asserts that the class has a docstring, returning it if successful.
cashew/plugin.py
def check_docstring(cls): """ Asserts that the class has a docstring, returning it if successful. """ docstring = inspect.getdoc(cls) if not docstring: breadcrumbs = " -> ".join(t.__name__ for t in inspect.getmro(cls)[:-1][::-1]) msg = "docstring required ...
def check_docstring(cls): """ Asserts that the class has a docstring, returning it if successful. """ docstring = inspect.getdoc(cls) if not docstring: breadcrumbs = " -> ".join(t.__name__ for t in inspect.getmro(cls)[:-1][::-1]) msg = "docstring required ...
[ "Asserts", "that", "the", "class", "has", "a", "docstring", "returning", "it", "if", "successful", "." ]
dexy/cashew
python
https://github.com/dexy/cashew/blob/39890a6e1e4e4e514e98cdb18368e29cc6710e52/cashew/plugin.py#L257-L276
[ "def", "check_docstring", "(", "cls", ")", ":", "docstring", "=", "inspect", ".", "getdoc", "(", "cls", ")", "if", "not", "docstring", ":", "breadcrumbs", "=", "\" -> \"", ".", "join", "(", "t", ".", "__name__", "for", "t", "in", "inspect", ".", "getmr...
39890a6e1e4e4e514e98cdb18368e29cc6710e52
valid
logbookForm.resourcePath
Get absolute path to resource, works for dev and for PyInstaller
scisalt/facettools/logbookForm.py
def resourcePath(self, relative_path): """ Get absolute path to resource, works for dev and for PyInstaller """ from os import path import sys try: # PyInstaller creates a temp folder and stores path in _MEIPASS base_path = sys._MEIPASS except Exc...
def resourcePath(self, relative_path): """ Get absolute path to resource, works for dev and for PyInstaller """ from os import path import sys try: # PyInstaller creates a temp folder and stores path in _MEIPASS base_path = sys._MEIPASS except Exc...
[ "Get", "absolute", "path", "to", "resource", "works", "for", "dev", "and", "for", "PyInstaller" ]
joelfrederico/SciSalt
python
https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/facettools/logbookForm.py#L63-L73
[ "def", "resourcePath", "(", "self", ",", "relative_path", ")", ":", "from", "os", "import", "path", "import", "sys", "try", ":", "# PyInstaller creates a temp folder and stores path in _MEIPASS", "base_path", "=", "sys", ".", "_MEIPASS", "except", "Exception", ":", ...
7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f
valid
logbookForm.addLogbook
Add new block of logbook selection windows. Only 5 allowed.
scisalt/facettools/logbookForm.py
def addLogbook(self, physDef= "LCLS", mccDef="MCC", initialInstance=False): '''Add new block of logbook selection windows. Only 5 allowed.''' if self.logMenuCount < 5: self.logMenus.append(LogSelectMenu(self.logui.multiLogLayout, initialInstance)) self.logMenus[-1].addLogbooks(se...
def addLogbook(self, physDef= "LCLS", mccDef="MCC", initialInstance=False): '''Add new block of logbook selection windows. Only 5 allowed.''' if self.logMenuCount < 5: self.logMenus.append(LogSelectMenu(self.logui.multiLogLayout, initialInstance)) self.logMenus[-1].addLogbooks(se...
[ "Add", "new", "block", "of", "logbook", "selection", "windows", ".", "Only", "5", "allowed", "." ]
joelfrederico/SciSalt
python
https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/facettools/logbookForm.py#L143-L156
[ "def", "addLogbook", "(", "self", ",", "physDef", "=", "\"LCLS\"", ",", "mccDef", "=", "\"MCC\"", ",", "initialInstance", "=", "False", ")", ":", "if", "self", ".", "logMenuCount", "<", "5", ":", "self", ".", "logMenus", ".", "append", "(", "LogSelectMen...
7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f
valid
logbookForm.removeLogbook
Remove logbook menu set.
scisalt/facettools/logbookForm.py
def removeLogbook(self, menu=None): '''Remove logbook menu set.''' if self.logMenuCount > 1 and menu is not None: menu.removeMenu() self.logMenus.remove(menu) self.logMenuCount -= 1
def removeLogbook(self, menu=None): '''Remove logbook menu set.''' if self.logMenuCount > 1 and menu is not None: menu.removeMenu() self.logMenus.remove(menu) self.logMenuCount -= 1
[ "Remove", "logbook", "menu", "set", "." ]
joelfrederico/SciSalt
python
https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/facettools/logbookForm.py#L158-L163
[ "def", "removeLogbook", "(", "self", ",", "menu", "=", "None", ")", ":", "if", "self", ".", "logMenuCount", ">", "1", "and", "menu", "is", "not", "None", ":", "menu", ".", "removeMenu", "(", ")", "self", ".", "logMenus", ".", "remove", "(", "menu", ...
7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f
valid
logbookForm.selectedLogs
Return selected log books by type.
scisalt/facettools/logbookForm.py
def selectedLogs(self): '''Return selected log books by type.''' mcclogs = [] physlogs = [] for i in range(len(self.logMenus)): logType = self.logMenus[i].selectedType() log = self.logMenus[i].selectedProgram() if logType == "MCC": if l...
def selectedLogs(self): '''Return selected log books by type.''' mcclogs = [] physlogs = [] for i in range(len(self.logMenus)): logType = self.logMenus[i].selectedType() log = self.logMenus[i].selectedProgram() if logType == "MCC": if l...
[ "Return", "selected", "log", "books", "by", "type", "." ]
joelfrederico/SciSalt
python
https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/facettools/logbookForm.py#L165-L178
[ "def", "selectedLogs", "(", "self", ")", ":", "mcclogs", "=", "[", "]", "physlogs", "=", "[", "]", "for", "i", "in", "range", "(", "len", "(", "self", ".", "logMenus", ")", ")", ":", "logType", "=", "self", ".", "logMenus", "[", "i", "]", ".", ...
7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f
valid
logbookForm.acceptedUser
Verify enetered user name is on accepted MCC logbook list.
scisalt/facettools/logbookForm.py
def acceptedUser(self, logType): '''Verify enetered user name is on accepted MCC logbook list.''' from urllib2 import urlopen, URLError, HTTPError import json isApproved = False userName = str(self.logui.userName.text()) if userName == "": re...
def acceptedUser(self, logType): '''Verify enetered user name is on accepted MCC logbook list.''' from urllib2 import urlopen, URLError, HTTPError import json isApproved = False userName = str(self.logui.userName.text()) if userName == "": re...
[ "Verify", "enetered", "user", "name", "is", "on", "accepted", "MCC", "logbook", "list", "." ]
joelfrederico/SciSalt
python
https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/facettools/logbookForm.py#L180-L219
[ "def", "acceptedUser", "(", "self", ",", "logType", ")", ":", "from", "urllib2", "import", "urlopen", ",", "URLError", ",", "HTTPError", "import", "json", "isApproved", "=", "False", "userName", "=", "str", "(", "self", ".", "logui", ".", "userName", ".", ...
7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f
valid
logbookForm.xmlSetup
Create xml file with fields from logbook form.
scisalt/facettools/logbookForm.py
def xmlSetup(self, logType, logList): """Create xml file with fields from logbook form.""" from xml.etree.ElementTree import Element, SubElement, ElementTree from datetime import datetime curr_time = datetime.now() if logType == "MCC": # Set up xml t...
def xmlSetup(self, logType, logList): """Create xml file with fields from logbook form.""" from xml.etree.ElementTree import Element, SubElement, ElementTree from datetime import datetime curr_time = datetime.now() if logType == "MCC": # Set up xml t...
[ "Create", "xml", "file", "with", "fields", "from", "logbook", "form", "." ]
joelfrederico/SciSalt
python
https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/facettools/logbookForm.py#L221-L326
[ "def", "xmlSetup", "(", "self", ",", "logType", ",", "logList", ")", ":", "from", "xml", ".", "etree", ".", "ElementTree", "import", "Element", ",", "SubElement", ",", "ElementTree", "from", "datetime", "import", "datetime", "curr_time", "=", "datetime", "."...
7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f
valid
logbookForm.prettify
Parse xml elements for pretty printing
scisalt/facettools/logbookForm.py
def prettify(self, elem): """Parse xml elements for pretty printing""" from xml.etree import ElementTree from re import sub rawString = ElementTree.tostring(elem, 'utf-8') parsedString = sub(r'(?=<[^/].*>)', '\n', rawString) # Adds newline after each closing ta...
def prettify(self, elem): """Parse xml elements for pretty printing""" from xml.etree import ElementTree from re import sub rawString = ElementTree.tostring(elem, 'utf-8') parsedString = sub(r'(?=<[^/].*>)', '\n', rawString) # Adds newline after each closing ta...
[ "Parse", "xml", "elements", "for", "pretty", "printing" ]
joelfrederico/SciSalt
python
https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/facettools/logbookForm.py#L328-L337
[ "def", "prettify", "(", "self", ",", "elem", ")", ":", "from", "xml", ".", "etree", "import", "ElementTree", "from", "re", "import", "sub", "rawString", "=", "ElementTree", ".", "tostring", "(", "elem", ",", "'utf-8'", ")", "parsedString", "=", "sub", "(...
7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f
valid
logbookForm.prepareImages
Convert supplied QPixmap object to image file.
scisalt/facettools/logbookForm.py
def prepareImages(self, fileName, logType): """Convert supplied QPixmap object to image file.""" import subprocess if self.imageType == "png": self.imagePixmap.save(fileName + ".png", "PNG", -1) if logType == "Physics": makePostScript = "convert "...
def prepareImages(self, fileName, logType): """Convert supplied QPixmap object to image file.""" import subprocess if self.imageType == "png": self.imagePixmap.save(fileName + ".png", "PNG", -1) if logType == "Physics": makePostScript = "convert "...
[ "Convert", "supplied", "QPixmap", "object", "to", "image", "file", "." ]
joelfrederico/SciSalt
python
https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/facettools/logbookForm.py#L339-L357
[ "def", "prepareImages", "(", "self", ",", "fileName", ",", "logType", ")", ":", "import", "subprocess", "if", "self", ".", "imageType", "==", "\"png\"", ":", "self", ".", "imagePixmap", ".", "save", "(", "fileName", "+", "\".png\"", ",", "\"PNG\"", ",", ...
7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f
valid
logbookForm.submitEntry
Process user inputs and subit logbook entry when user clicks Submit button
scisalt/facettools/logbookForm.py
def submitEntry(self): """Process user inputs and subit logbook entry when user clicks Submit button""" # logType = self.logui.logType.currentText() mcclogs, physlogs = self.selectedLogs() success = True if mcclogs != []: if not self.acceptedUser("MC...
def submitEntry(self): """Process user inputs and subit logbook entry when user clicks Submit button""" # logType = self.logui.logType.currentText() mcclogs, physlogs = self.selectedLogs() success = True if mcclogs != []: if not self.acceptedUser("MC...
[ "Process", "user", "inputs", "and", "subit", "logbook", "entry", "when", "user", "clicks", "Submit", "button" ]
joelfrederico/SciSalt
python
https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/facettools/logbookForm.py#L359-L390
[ "def", "submitEntry", "(", "self", ")", ":", "# logType = self.logui.logType.currentText()", "mcclogs", ",", "physlogs", "=", "self", ".", "selectedLogs", "(", ")", "success", "=", "True", "if", "mcclogs", "!=", "[", "]", ":", "if", "not", "self", ".", "acce...
7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f
valid
logbookForm.sendToLogbook
Process log information and push to selected logbooks.
scisalt/facettools/logbookForm.py
def sendToLogbook(self, fileName, logType, location=None): '''Process log information and push to selected logbooks.''' import subprocess success = True if logType == "MCC": fileString = "" if not self.imagePixmap.isNull(): fileString = fi...
def sendToLogbook(self, fileName, logType, location=None): '''Process log information and push to selected logbooks.''' import subprocess success = True if logType == "MCC": fileString = "" if not self.imagePixmap.isNull(): fileString = fi...
[ "Process", "log", "information", "and", "push", "to", "selected", "logbooks", "." ]
joelfrederico/SciSalt
python
https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/facettools/logbookForm.py#L392-L427
[ "def", "sendToLogbook", "(", "self", ",", "fileName", ",", "logType", ",", "location", "=", "None", ")", ":", "import", "subprocess", "success", "=", "True", "if", "logType", "==", "\"MCC\"", ":", "fileString", "=", "\"\"", "if", "not", "self", ".", "ima...
7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f
valid
logbookForm.clearForm
Clear all form fields (except author).
scisalt/facettools/logbookForm.py
def clearForm(self): """Clear all form fields (except author).""" self.logui.titleEntry.clear() self.logui.textEntry.clear() # Remove all log selection menus except the first while self.logMenuCount > 1: self.removeLogbook(self.logMenus[-1])
def clearForm(self): """Clear all form fields (except author).""" self.logui.titleEntry.clear() self.logui.textEntry.clear() # Remove all log selection menus except the first while self.logMenuCount > 1: self.removeLogbook(self.logMenus[-1])
[ "Clear", "all", "form", "fields", "(", "except", "author", ")", "." ]
joelfrederico/SciSalt
python
https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/facettools/logbookForm.py#L429-L437
[ "def", "clearForm", "(", "self", ")", ":", "self", ".", "logui", ".", "titleEntry", ".", "clear", "(", ")", "self", ".", "logui", ".", "textEntry", ".", "clear", "(", ")", "# Remove all log selection menus except the first", "while", "self", ".", "logMenuCount...
7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f
valid
LogSelectMenu.setupUI
Create graphical objects for menus.
scisalt/facettools/logbookForm.py
def setupUI(self): '''Create graphical objects for menus.''' labelSizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) labelSizePolicy.setHorizontalStretch(0) labelSizePolicy.setVerticalStretch(0) menuSizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy....
def setupUI(self): '''Create graphical objects for menus.''' labelSizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) labelSizePolicy.setHorizontalStretch(0) labelSizePolicy.setVerticalStretch(0) menuSizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy....
[ "Create", "graphical", "objects", "for", "menus", "." ]
joelfrederico/SciSalt
python
https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/facettools/logbookForm.py#L454-L519
[ "def", "setupUI", "(", "self", ")", ":", "labelSizePolicy", "=", "QSizePolicy", "(", "QSizePolicy", ".", "Fixed", ",", "QSizePolicy", ".", "Fixed", ")", "labelSizePolicy", ".", "setHorizontalStretch", "(", "0", ")", "labelSizePolicy", ".", "setVerticalStretch", ...
7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f
valid
LogSelectMenu.show
Display menus and connect even signals.
scisalt/facettools/logbookForm.py
def show(self): '''Display menus and connect even signals.''' self.parent.addLayout(self._logSelectLayout) self.menuCount += 1 self._connectSlots()
def show(self): '''Display menus and connect even signals.''' self.parent.addLayout(self._logSelectLayout) self.menuCount += 1 self._connectSlots()
[ "Display", "menus", "and", "connect", "even", "signals", "." ]
joelfrederico/SciSalt
python
https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/facettools/logbookForm.py#L526-L530
[ "def", "show", "(", "self", ")", ":", "self", ".", "parent", ".", "addLayout", "(", "self", ".", "_logSelectLayout", ")", "self", ".", "menuCount", "+=", "1", "self", ".", "_connectSlots", "(", ")" ]
7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f
valid
LogSelectMenu.addLogbooks
Add or change list of logbooks.
scisalt/facettools/logbookForm.py
def addLogbooks(self, type=None, logs=[], default=""): '''Add or change list of logbooks.''' if type is not None and len(logs) != 0: if type in self.logList: for logbook in logs: if logbook not in self.logList.get(type)[0]: # print(...
def addLogbooks(self, type=None, logs=[], default=""): '''Add or change list of logbooks.''' if type is not None and len(logs) != 0: if type in self.logList: for logbook in logs: if logbook not in self.logList.get(type)[0]: # print(...
[ "Add", "or", "change", "list", "of", "logbooks", "." ]
joelfrederico/SciSalt
python
https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/facettools/logbookForm.py#L538-L559
[ "def", "addLogbooks", "(", "self", ",", "type", "=", "None", ",", "logs", "=", "[", "]", ",", "default", "=", "\"\"", ")", ":", "if", "type", "is", "not", "None", "and", "len", "(", "logs", ")", "!=", "0", ":", "if", "type", "in", "self", ".", ...
7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f
valid
LogSelectMenu.removeLogbooks
Remove unwanted logbooks from list.
scisalt/facettools/logbookForm.py
def removeLogbooks(self, type=None, logs=[]): '''Remove unwanted logbooks from list.''' if type is not None and type in self.logList: if len(logs) == 0 or logs == "All": del self.logList[type] else: for logbook in logs: if logbo...
def removeLogbooks(self, type=None, logs=[]): '''Remove unwanted logbooks from list.''' if type is not None and type in self.logList: if len(logs) == 0 or logs == "All": del self.logList[type] else: for logbook in logs: if logbo...
[ "Remove", "unwanted", "logbooks", "from", "list", "." ]
joelfrederico/SciSalt
python
https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/facettools/logbookForm.py#L561-L571
[ "def", "removeLogbooks", "(", "self", ",", "type", "=", "None", ",", "logs", "=", "[", "]", ")", ":", "if", "type", "is", "not", "None", "and", "type", "in", "self", ".", "logList", ":", "if", "len", "(", "logs", ")", "==", "0", "or", "logs", "...
7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f
valid
LogSelectMenu.changeLogType
Populate log program list to correspond with log type selection.
scisalt/facettools/logbookForm.py
def changeLogType(self): '''Populate log program list to correspond with log type selection.''' logType = self.selectedType() programs = self.logList.get(logType)[0] default = self.logList.get(logType)[1] if logType in self.logList: self.programName.clear() ...
def changeLogType(self): '''Populate log program list to correspond with log type selection.''' logType = self.selectedType() programs = self.logList.get(logType)[0] default = self.logList.get(logType)[1] if logType in self.logList: self.programName.clear() ...
[ "Populate", "log", "program", "list", "to", "correspond", "with", "log", "type", "selection", "." ]
joelfrederico/SciSalt
python
https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/facettools/logbookForm.py#L573-L581
[ "def", "changeLogType", "(", "self", ")", ":", "logType", "=", "self", ".", "selectedType", "(", ")", "programs", "=", "self", ".", "logList", ".", "get", "(", "logType", ")", "[", "0", "]", "default", "=", "self", ".", "logList", ".", "get", "(", ...
7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f
valid
LogSelectMenu.addMenu
Add menus to parent gui.
scisalt/facettools/logbookForm.py
def addMenu(self): '''Add menus to parent gui.''' self.parent.multiLogLayout.addLayout(self.logSelectLayout) self.getPrograms(logType, programName)
def addMenu(self): '''Add menus to parent gui.''' self.parent.multiLogLayout.addLayout(self.logSelectLayout) self.getPrograms(logType, programName)
[ "Add", "menus", "to", "parent", "gui", "." ]
joelfrederico/SciSalt
python
https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/facettools/logbookForm.py#L583-L586
[ "def", "addMenu", "(", "self", ")", ":", "self", ".", "parent", ".", "multiLogLayout", ".", "addLayout", "(", "self", ".", "logSelectLayout", ")", "self", ".", "getPrograms", "(", "logType", ",", "programName", ")" ]
7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f
valid
LogSelectMenu.removeLayout
Iteratively remove graphical objects from layout.
scisalt/facettools/logbookForm.py
def removeLayout(self, layout): '''Iteratively remove graphical objects from layout.''' for cnt in reversed(range(layout.count())): item = layout.takeAt(cnt) widget = item.widget() if widget is not None: widget.deleteLater() else: ...
def removeLayout(self, layout): '''Iteratively remove graphical objects from layout.''' for cnt in reversed(range(layout.count())): item = layout.takeAt(cnt) widget = item.widget() if widget is not None: widget.deleteLater() else: ...
[ "Iteratively", "remove", "graphical", "objects", "from", "layout", "." ]
joelfrederico/SciSalt
python
https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/facettools/logbookForm.py#L588-L597
[ "def", "removeLayout", "(", "self", ",", "layout", ")", ":", "for", "cnt", "in", "reversed", "(", "range", "(", "layout", ".", "count", "(", ")", ")", ")", ":", "item", "=", "layout", ".", "takeAt", "(", "cnt", ")", "widget", "=", "item", ".", "w...
7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f
valid
addlabel
Adds labels to a plot.
scisalt/matplotlib/addlabel.py
def addlabel(ax=None, toplabel=None, xlabel=None, ylabel=None, zlabel=None, clabel=None, cb=None, windowlabel=None, fig=None, axes=None): """Adds labels to a plot.""" if (axes is None) and (ax is not None): axes = ax if (windowlabel is not None) and (fig is not None): fig.canvas.set_window...
def addlabel(ax=None, toplabel=None, xlabel=None, ylabel=None, zlabel=None, clabel=None, cb=None, windowlabel=None, fig=None, axes=None): """Adds labels to a plot.""" if (axes is None) and (ax is not None): axes = ax if (windowlabel is not None) and (fig is not None): fig.canvas.set_window...
[ "Adds", "labels", "to", "a", "plot", "." ]
joelfrederico/SciSalt
python
https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/matplotlib/addlabel.py#L9-L43
[ "def", "addlabel", "(", "ax", "=", "None", ",", "toplabel", "=", "None", ",", "xlabel", "=", "None", ",", "ylabel", "=", "None", ",", "zlabel", "=", "None", ",", "clabel", "=", "None", ",", "cb", "=", "None", ",", "windowlabel", "=", "None", ",", ...
7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f
valid
linkcode_resolve
Determine the URL corresponding to Python object
docs/conf.py
def linkcode_resolve(domain, info): """ Determine the URL corresponding to Python object """ if domain != 'py': return None modname = info['module'] fullname = info['fullname'] submod = sys.modules.get(modname) if submod is None: return None obj = submod for pa...
def linkcode_resolve(domain, info): """ Determine the URL corresponding to Python object """ if domain != 'py': return None modname = info['module'] fullname = info['fullname'] submod = sys.modules.get(modname) if submod is None: return None obj = submod for pa...
[ "Determine", "the", "URL", "corresponding", "to", "Python", "object" ]
joelfrederico/SciSalt
python
https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/docs/conf.py#L358-L403
[ "def", "linkcode_resolve", "(", "domain", ",", "info", ")", ":", "if", "domain", "!=", "'py'", ":", "return", "None", "modname", "=", "info", "[", "'module'", "]", "fullname", "=", "info", "[", "'fullname'", "]", "submod", "=", "sys", ".", "modules", "...
7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f
valid
call_manage
Utility function to run commands against Django's `django-admin.py`/`manage.py`. `options.paved.django.project`: the path to the django project files (where `settings.py` typically resides). Will fall back to a DJANGO_SETTINGS_MODULE environment variable. `options.paved.django.manage_py`: the ...
paved/django.py
def call_manage(cmd, capture=False, ignore_error=False): """Utility function to run commands against Django's `django-admin.py`/`manage.py`. `options.paved.django.project`: the path to the django project files (where `settings.py` typically resides). Will fall back to a DJANGO_SETTINGS_MODULE e...
def call_manage(cmd, capture=False, ignore_error=False): """Utility function to run commands against Django's `django-admin.py`/`manage.py`. `options.paved.django.project`: the path to the django project files (where `settings.py` typically resides). Will fall back to a DJANGO_SETTINGS_MODULE e...
[ "Utility", "function", "to", "run", "commands", "against", "Django", "s", "django", "-", "admin", ".", "py", "/", "manage", ".", "py", "." ]
eykd/paved
python
https://github.com/eykd/paved/blob/f04f8a4248c571f3d5ce882b325884a3e5d80203/paved/django.py#L52-L72
[ "def", "call_manage", "(", "cmd", ",", "capture", "=", "False", ",", "ignore_error", "=", "False", ")", ":", "settings", "=", "(", "options", ".", "paved", ".", "django", ".", "settings", "or", "os", ".", "environ", ".", "get", "(", "'DJANGO_SETTINGS_MOD...
f04f8a4248c571f3d5ce882b325884a3e5d80203
valid
syncdb
Update the database with model schema. Shorthand for `paver manage syncdb`.
paved/django.py
def syncdb(args): """Update the database with model schema. Shorthand for `paver manage syncdb`. """ cmd = args and 'syncdb %s' % ' '.join(options.args) or 'syncdb --noinput' call_manage(cmd) for fixture in options.paved.django.syncdb.fixtures: call_manage("loaddata %s" % fixture)
def syncdb(args): """Update the database with model schema. Shorthand for `paver manage syncdb`. """ cmd = args and 'syncdb %s' % ' '.join(options.args) or 'syncdb --noinput' call_manage(cmd) for fixture in options.paved.django.syncdb.fixtures: call_manage("loaddata %s" % fixture)
[ "Update", "the", "database", "with", "model", "schema", ".", "Shorthand", "for", "paver", "manage", "syncdb", "." ]
eykd/paved
python
https://github.com/eykd/paved/blob/f04f8a4248c571f3d5ce882b325884a3e5d80203/paved/django.py#L88-L94
[ "def", "syncdb", "(", "args", ")", ":", "cmd", "=", "args", "and", "'syncdb %s'", "%", "' '", ".", "join", "(", "options", ".", "args", ")", "or", "'syncdb --noinput'", "call_manage", "(", "cmd", ")", "for", "fixture", "in", "options", ".", "paved", "....
f04f8a4248c571f3d5ce882b325884a3e5d80203
valid
start
Run the dev server. Uses `django_extensions <http://pypi.python.org/pypi/django-extensions/0.5>`, if available, to provide `runserver_plus`. Set the command to use with `options.paved.django.runserver` Set the port to use with `options.paved.django.runserver_port`
paved/django.py
def start(info): """Run the dev server. Uses `django_extensions <http://pypi.python.org/pypi/django-extensions/0.5>`, if available, to provide `runserver_plus`. Set the command to use with `options.paved.django.runserver` Set the port to use with `options.paved.django.runserver_port` """ c...
def start(info): """Run the dev server. Uses `django_extensions <http://pypi.python.org/pypi/django-extensions/0.5>`, if available, to provide `runserver_plus`. Set the command to use with `options.paved.django.runserver` Set the port to use with `options.paved.django.runserver_port` """ c...
[ "Run", "the", "dev", "server", "." ]
eykd/paved
python
https://github.com/eykd/paved/blob/f04f8a4248c571f3d5ce882b325884a3e5d80203/paved/django.py#L116-L138
[ "def", "start", "(", "info", ")", ":", "cmd", "=", "options", ".", "paved", ".", "django", ".", "runserver", "if", "cmd", "==", "'runserver_plus'", ":", "try", ":", "import", "django_extensions", "except", "ImportError", ":", "info", "(", "\"Could not import...
f04f8a4248c571f3d5ce882b325884a3e5d80203
valid
schema
Run South's schemamigration command.
paved/django.py
def schema(args): """Run South's schemamigration command. """ try: import south cmd = args and 'schemamigration %s' % ' '.join(options.args) or 'schemamigration' call_manage(cmd) except ImportError: error('Could not import south.')
def schema(args): """Run South's schemamigration command. """ try: import south cmd = args and 'schemamigration %s' % ' '.join(options.args) or 'schemamigration' call_manage(cmd) except ImportError: error('Could not import south.')
[ "Run", "South", "s", "schemamigration", "command", "." ]
eykd/paved
python
https://github.com/eykd/paved/blob/f04f8a4248c571f3d5ce882b325884a3e5d80203/paved/django.py#L143-L151
[ "def", "schema", "(", "args", ")", ":", "try", ":", "import", "south", "cmd", "=", "args", "and", "'schemamigration %s'", "%", "' '", ".", "join", "(", "options", ".", "args", ")", "or", "'schemamigration'", "call_manage", "(", "cmd", ")", "except", "Imp...
f04f8a4248c571f3d5ce882b325884a3e5d80203
valid
MapperDefinition.validate
This static method validates a BioMapMapper definition. It returns None on success and throws an exception otherwise.
biomap/core/mapper.py
def validate(cls, definition): ''' This static method validates a BioMapMapper definition. It returns None on success and throws an exception otherwise. ''' schema_path = os.path.join(os.path.dirname(__file__), '../../schema/mapper_definition_sc...
def validate(cls, definition): ''' This static method validates a BioMapMapper definition. It returns None on success and throws an exception otherwise. ''' schema_path = os.path.join(os.path.dirname(__file__), '../../schema/mapper_definition_sc...
[ "This", "static", "method", "validates", "a", "BioMapMapper", "definition", ".", "It", "returns", "None", "on", "success", "and", "throws", "an", "exception", "otherwise", "." ]
BioMapOrg/biomap-core
python
https://github.com/BioMapOrg/biomap-core/blob/63f6468ae224c663da26e2bb0aca3faab84626c3/biomap/core/mapper.py#L29-L48
[ "def", "validate", "(", "cls", ",", "definition", ")", ":", "schema_path", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ",", "'../../schema/mapper_definition_schema.json'", ")", "with", "open", "(", "sc...
63f6468ae224c663da26e2bb0aca3faab84626c3
valid
Mapper.map
The main method of this class and the essence of the package. It allows to "map" stuff. Args: ID_s: Nested lists with strings as leafs (plain strings also possible) FROM (str): Origin key for the mapping (default: main key) TO (str): Destination key for the mapping ...
biomap/core/mapper.py
def map(self, ID_s, FROM=None, TO=None, target_as_set=False, no_match_sub=None): ''' The main method of this class and the essence of the package. It allows to "map" stuff. Args: ID_s: Nested lists with...
def map(self, ID_s, FROM=None, TO=None, target_as_set=False, no_match_sub=None): ''' The main method of this class and the essence of the package. It allows to "map" stuff. Args: ID_s: Nested lists with...
[ "The", "main", "method", "of", "this", "class", "and", "the", "essence", "of", "the", "package", ".", "It", "allows", "to", "map", "stuff", "." ]
BioMapOrg/biomap-core
python
https://github.com/BioMapOrg/biomap-core/blob/63f6468ae224c663da26e2bb0aca3faab84626c3/biomap/core/mapper.py#L180-L229
[ "def", "map", "(", "self", ",", "ID_s", ",", "FROM", "=", "None", ",", "TO", "=", "None", ",", "target_as_set", "=", "False", ",", "no_match_sub", "=", "None", ")", ":", "def", "io_mode", "(", "ID_s", ")", ":", "'''\n Handles the input/output mo...
63f6468ae224c663da26e2bb0aca3faab84626c3
valid
Mapper.get_all
Returns all data entries for a particular key. Default is the main key. Args: key (str): key whose values to return (default: main key) Returns: List of all data entries for the key
biomap/core/mapper.py
def get_all(self, key=None): ''' Returns all data entries for a particular key. Default is the main key. Args: key (str): key whose values to return (default: main key) Returns: List of all data entries for the key ''' key = self.definition.mai...
def get_all(self, key=None): ''' Returns all data entries for a particular key. Default is the main key. Args: key (str): key whose values to return (default: main key) Returns: List of all data entries for the key ''' key = self.definition.mai...
[ "Returns", "all", "data", "entries", "for", "a", "particular", "key", ".", "Default", "is", "the", "main", "key", "." ]
BioMapOrg/biomap-core
python
https://github.com/BioMapOrg/biomap-core/blob/63f6468ae224c663da26e2bb0aca3faab84626c3/biomap/core/mapper.py#L286-L303
[ "def", "get_all", "(", "self", ",", "key", "=", "None", ")", ":", "key", "=", "self", ".", "definition", ".", "main_key", "if", "key", "is", "None", "else", "key", "key", "=", "self", ".", "definition", ".", "key_synonyms", ".", "get", "(", "key", ...
63f6468ae224c663da26e2bb0aca3faab84626c3
valid
Requests.get_requests
List requests http://dev.wheniwork.com/#listing-requests
uw_wheniwork/requests.py
def get_requests(self, params={}): """ List requests http://dev.wheniwork.com/#listing-requests """ if "status" in params: params['status'] = ','.join(map(str, params['status'])) requests = [] users = {} messages = {} params['page'] =...
def get_requests(self, params={}): """ List requests http://dev.wheniwork.com/#listing-requests """ if "status" in params: params['status'] = ','.join(map(str, params['status'])) requests = [] users = {} messages = {} params['page'] =...
[ "List", "requests" ]
uw-it-cte/uw-restclients-wheniwork
python
https://github.com/uw-it-cte/uw-restclients-wheniwork/blob/0d3ca09d5bbe808fec12e5f943596570d33a1731/uw_wheniwork/requests.py#L11-L50
[ "def", "get_requests", "(", "self", ",", "params", "=", "{", "}", ")", ":", "if", "\"status\"", "in", "params", ":", "params", "[", "'status'", "]", "=", "','", ".", "join", "(", "map", "(", "str", ",", "params", "[", "'status'", "]", ")", ")", "...
0d3ca09d5bbe808fec12e5f943596570d33a1731
valid
GameController.guess
Make a guess, comparing the hidden object to a set of provided digits. The digits should be passed as a set of arguments, e.g: * for a normal game: 0, 1, 2, 3 * for a hex game: 0xA, 0xB, 5, 4 * alternate for hex game: 'A', 'b', 5, 4 :param args: An iterable of digits (int or st...
python_cowbull_game/GameController.py
def guess(self, *args): """ Make a guess, comparing the hidden object to a set of provided digits. The digits should be passed as a set of arguments, e.g: * for a normal game: 0, 1, 2, 3 * for a hex game: 0xA, 0xB, 5, 4 * alternate for hex game: 'A', 'b', 5, 4 :...
def guess(self, *args): """ Make a guess, comparing the hidden object to a set of provided digits. The digits should be passed as a set of arguments, e.g: * for a normal game: 0, 1, 2, 3 * for a hex game: 0xA, 0xB, 5, 4 * alternate for hex game: 'A', 'b', 5, 4 :...
[ "Make", "a", "guess", "comparing", "the", "hidden", "object", "to", "a", "set", "of", "provided", "digits", ".", "The", "digits", "should", "be", "passed", "as", "a", "set", "of", "arguments", "e", ".", "g", ":" ]
dsandersAzure/python_cowbull_game
python
https://github.com/dsandersAzure/python_cowbull_game/blob/82a0d8ee127869123d4fad51a8cd1707879e368f/python_cowbull_game/GameController.py#L56-L116
[ "def", "guess", "(", "self", ",", "*", "args", ")", ":", "if", "self", ".", "game", "is", "None", ":", "raise", "ValueError", "(", "\"The Game is unexpectedly undefined!\"", ")", "response_object", "=", "{", "\"bulls\"", ":", "None", ",", "\"cows\"", ":", ...
82a0d8ee127869123d4fad51a8cd1707879e368f
valid
GameController.load
Load a game from a serialized JSON representation. The game expects a well defined structure as follows (Note JSON string format): '{ "guesses_made": int, "key": "str:a 4 word", "status": "str: one of playing, won, lost", "mode": { "digits...
python_cowbull_game/GameController.py
def load(self, game_json=None, mode=None): """ Load a game from a serialized JSON representation. The game expects a well defined structure as follows (Note JSON string format): '{ "guesses_made": int, "key": "str:a 4 word", "status": "str: one of pla...
def load(self, game_json=None, mode=None): """ Load a game from a serialized JSON representation. The game expects a well defined structure as follows (Note JSON string format): '{ "guesses_made": int, "key": "str:a 4 word", "status": "str: one of pla...
[ "Load", "a", "game", "from", "a", "serialized", "JSON", "representation", ".", "The", "game", "expects", "a", "well", "defined", "structure", "as", "follows", "(", "Note", "JSON", "string", "format", ")", ":" ]
dsandersAzure/python_cowbull_game
python
https://github.com/dsandersAzure/python_cowbull_game/blob/82a0d8ee127869123d4fad51a8cd1707879e368f/python_cowbull_game/GameController.py#L118-L171
[ "def", "load", "(", "self", ",", "game_json", "=", "None", ",", "mode", "=", "None", ")", ":", "if", "game_json", "is", "None", ":", "# New game_json", "if", "mode", "is", "not", "None", ":", "if", "isinstance", "(", "mode", ",", "str", ")", ":", "...
82a0d8ee127869123d4fad51a8cd1707879e368f
valid
GameController.load_modes
Loads modes (GameMode objects) to be supported by the game object. Four default modes are provided (normal, easy, hard, and hex) but others could be provided either by calling load_modes directly or passing a list of GameMode objects to the instantiation call. :param input_modes: A list...
python_cowbull_game/GameController.py
def load_modes(self, input_modes=None): """ Loads modes (GameMode objects) to be supported by the game object. Four default modes are provided (normal, easy, hard, and hex) but others could be provided either by calling load_modes directly or passing a list of GameMode objects to ...
def load_modes(self, input_modes=None): """ Loads modes (GameMode objects) to be supported by the game object. Four default modes are provided (normal, easy, hard, and hex) but others could be provided either by calling load_modes directly or passing a list of GameMode objects to ...
[ "Loads", "modes", "(", "GameMode", "objects", ")", "to", "be", "supported", "by", "the", "game", "object", ".", "Four", "default", "modes", "are", "provided", "(", "normal", "easy", "hard", "and", "hex", ")", "but", "others", "could", "be", "provided", "...
dsandersAzure/python_cowbull_game
python
https://github.com/dsandersAzure/python_cowbull_game/blob/82a0d8ee127869123d4fad51a8cd1707879e368f/python_cowbull_game/GameController.py#L182-L221
[ "def", "load_modes", "(", "self", ",", "input_modes", "=", "None", ")", ":", "# Set default game modes", "_modes", "=", "[", "GameMode", "(", "mode", "=", "\"normal\"", ",", "priority", "=", "2", ",", "digits", "=", "4", ",", "digit_type", "=", "DigitWord"...
82a0d8ee127869123d4fad51a8cd1707879e368f
valid
GameController._start_again_message
Simple method to form a start again message and give the answer in readable form.
python_cowbull_game/GameController.py
def _start_again_message(self, message=None): """Simple method to form a start again message and give the answer in readable form.""" logging.debug("Start again message delivered: {}".format(message)) the_answer = ', '.join( [str(d) for d in self.game.answer][:-1] ) + ', and ...
def _start_again_message(self, message=None): """Simple method to form a start again message and give the answer in readable form.""" logging.debug("Start again message delivered: {}".format(message)) the_answer = ', '.join( [str(d) for d in self.game.answer][:-1] ) + ', and ...
[ "Simple", "method", "to", "form", "a", "start", "again", "message", "and", "give", "the", "answer", "in", "readable", "form", "." ]
dsandersAzure/python_cowbull_game
python
https://github.com/dsandersAzure/python_cowbull_game/blob/82a0d8ee127869123d4fad51a8cd1707879e368f/python_cowbull_game/GameController.py#L237-L248
[ "def", "_start_again_message", "(", "self", ",", "message", "=", "None", ")", ":", "logging", ".", "debug", "(", "\"Start again message delivered: {}\"", ".", "format", "(", "message", ")", ")", "the_answer", "=", "', '", ".", "join", "(", "[", "str", "(", ...
82a0d8ee127869123d4fad51a8cd1707879e368f
valid
FieldCutter.line
Returns list of strings split by input delimeter Argument: line - Input line to cut
cuts/fields.py
def line(self, line): """Returns list of strings split by input delimeter Argument: line - Input line to cut """ # Remove empty strings in case of multiple instances of delimiter return [x for x in re.split(self.delimiter, line.rstrip()) if x != '']
def line(self, line): """Returns list of strings split by input delimeter Argument: line - Input line to cut """ # Remove empty strings in case of multiple instances of delimiter return [x for x in re.split(self.delimiter, line.rstrip()) if x != '']
[ "Returns", "list", "of", "strings", "split", "by", "input", "delimeter" ]
jpweiser/cuts
python
https://github.com/jpweiser/cuts/blob/5baf7f2e145045942ee8dcaccbc47f8f821fcb56/cuts/fields.py#L25-L32
[ "def", "line", "(", "self", ",", "line", ")", ":", "# Remove empty strings in case of multiple instances of delimiter", "return", "[", "x", "for", "x", "in", "re", ".", "split", "(", "self", ".", "delimiter", ",", "line", ".", "rstrip", "(", ")", ")", "if", ...
5baf7f2e145045942ee8dcaccbc47f8f821fcb56
valid
Messages.get_message
Get Existing Message http://dev.wheniwork.com/#get-existing-message
uw_wheniwork/messages.py
def get_message(self, message_id): """ Get Existing Message http://dev.wheniwork.com/#get-existing-message """ url = "/2/messages/%s" % message_id return self.message_from_json(self._get_resource(url)["message"])
def get_message(self, message_id): """ Get Existing Message http://dev.wheniwork.com/#get-existing-message """ url = "/2/messages/%s" % message_id return self.message_from_json(self._get_resource(url)["message"])
[ "Get", "Existing", "Message" ]
uw-it-cte/uw-restclients-wheniwork
python
https://github.com/uw-it-cte/uw-restclients-wheniwork/blob/0d3ca09d5bbe808fec12e5f943596570d33a1731/uw_wheniwork/messages.py#L9-L17
[ "def", "get_message", "(", "self", ",", "message_id", ")", ":", "url", "=", "\"/2/messages/%s\"", "%", "message_id", "return", "self", ".", "message_from_json", "(", "self", ".", "_get_resource", "(", "url", ")", "[", "\"message\"", "]", ")" ]
0d3ca09d5bbe808fec12e5f943596570d33a1731
valid
Messages.get_messages
List messages http://dev.wheniwork.com/#listing-messages
uw_wheniwork/messages.py
def get_messages(self, params={}): """ List messages http://dev.wheniwork.com/#listing-messages """ param_list = [(k, params[k]) for k in sorted(params)] url = "/2/messages/?%s" % urlencode(param_list) data = self._get_resource(url) messages = [] ...
def get_messages(self, params={}): """ List messages http://dev.wheniwork.com/#listing-messages """ param_list = [(k, params[k]) for k in sorted(params)] url = "/2/messages/?%s" % urlencode(param_list) data = self._get_resource(url) messages = [] ...
[ "List", "messages" ]
uw-it-cte/uw-restclients-wheniwork
python
https://github.com/uw-it-cte/uw-restclients-wheniwork/blob/0d3ca09d5bbe808fec12e5f943596570d33a1731/uw_wheniwork/messages.py#L19-L33
[ "def", "get_messages", "(", "self", ",", "params", "=", "{", "}", ")", ":", "param_list", "=", "[", "(", "k", ",", "params", "[", "k", "]", ")", "for", "k", "in", "sorted", "(", "params", ")", "]", "url", "=", "\"/2/messages/?%s\"", "%", "urlencode...
0d3ca09d5bbe808fec12e5f943596570d33a1731
valid
Messages.create_message
Creates a message http://dev.wheniwork.com/#create/update-message
uw_wheniwork/messages.py
def create_message(self, params={}): """ Creates a message http://dev.wheniwork.com/#create/update-message """ url = "/2/messages/" body = params data = self._post_resource(url, body) return self.message_from_json(data["message"])
def create_message(self, params={}): """ Creates a message http://dev.wheniwork.com/#create/update-message """ url = "/2/messages/" body = params data = self._post_resource(url, body) return self.message_from_json(data["message"])
[ "Creates", "a", "message" ]
uw-it-cte/uw-restclients-wheniwork
python
https://github.com/uw-it-cte/uw-restclients-wheniwork/blob/0d3ca09d5bbe808fec12e5f943596570d33a1731/uw_wheniwork/messages.py#L35-L45
[ "def", "create_message", "(", "self", ",", "params", "=", "{", "}", ")", ":", "url", "=", "\"/2/messages/\"", "body", "=", "params", "data", "=", "self", ".", "_post_resource", "(", "url", ",", "body", ")", "return", "self", ".", "message_from_json", "("...
0d3ca09d5bbe808fec12e5f943596570d33a1731
valid
Messages.update_message
Modify an existing message. http://dev.wheniwork.com/#create/update-message
uw_wheniwork/messages.py
def update_message(self, message): """ Modify an existing message. http://dev.wheniwork.com/#create/update-message """ url = "/2/messages/%s" % message.message_id data = self._put_resource(url, message.json_data()) return self.message_from_json(data)
def update_message(self, message): """ Modify an existing message. http://dev.wheniwork.com/#create/update-message """ url = "/2/messages/%s" % message.message_id data = self._put_resource(url, message.json_data()) return self.message_from_json(data)
[ "Modify", "an", "existing", "message", "." ]
uw-it-cte/uw-restclients-wheniwork
python
https://github.com/uw-it-cte/uw-restclients-wheniwork/blob/0d3ca09d5bbe808fec12e5f943596570d33a1731/uw_wheniwork/messages.py#L47-L56
[ "def", "update_message", "(", "self", ",", "message", ")", ":", "url", "=", "\"/2/messages/%s\"", "%", "message", ".", "message_id", "data", "=", "self", ".", "_put_resource", "(", "url", ",", "message", ".", "json_data", "(", ")", ")", "return", "self", ...
0d3ca09d5bbe808fec12e5f943596570d33a1731
valid
Messages.delete_messages
Delete existing messages. http://dev.wheniwork.com/#delete-existing-message
uw_wheniwork/messages.py
def delete_messages(self, messages): """ Delete existing messages. http://dev.wheniwork.com/#delete-existing-message """ url = "/2/messages/?%s" % urlencode([('ids', ",".join(messages))]) data = self._delete_resource(url) return data
def delete_messages(self, messages): """ Delete existing messages. http://dev.wheniwork.com/#delete-existing-message """ url = "/2/messages/?%s" % urlencode([('ids', ",".join(messages))]) data = self._delete_resource(url) return data
[ "Delete", "existing", "messages", "." ]
uw-it-cte/uw-restclients-wheniwork
python
https://github.com/uw-it-cte/uw-restclients-wheniwork/blob/0d3ca09d5bbe808fec12e5f943596570d33a1731/uw_wheniwork/messages.py#L58-L67
[ "def", "delete_messages", "(", "self", ",", "messages", ")", ":", "url", "=", "\"/2/messages/?%s\"", "%", "urlencode", "(", "[", "(", "'ids'", ",", "\",\"", ".", "join", "(", "messages", ")", ")", "]", ")", "data", "=", "self", ".", "_delete_resource", ...
0d3ca09d5bbe808fec12e5f943596570d33a1731
valid
Sites.get_site
Returns site data. http://dev.wheniwork.com/#get-existing-site
uw_wheniwork/sites.py
def get_site(self, site_id): """ Returns site data. http://dev.wheniwork.com/#get-existing-site """ url = "/2/sites/%s" % site_id return self.site_from_json(self._get_resource(url)["site"])
def get_site(self, site_id): """ Returns site data. http://dev.wheniwork.com/#get-existing-site """ url = "/2/sites/%s" % site_id return self.site_from_json(self._get_resource(url)["site"])
[ "Returns", "site", "data", "." ]
uw-it-cte/uw-restclients-wheniwork
python
https://github.com/uw-it-cte/uw-restclients-wheniwork/blob/0d3ca09d5bbe808fec12e5f943596570d33a1731/uw_wheniwork/sites.py#L6-L14
[ "def", "get_site", "(", "self", ",", "site_id", ")", ":", "url", "=", "\"/2/sites/%s\"", "%", "site_id", "return", "self", ".", "site_from_json", "(", "self", ".", "_get_resource", "(", "url", ")", "[", "\"site\"", "]", ")" ]
0d3ca09d5bbe808fec12e5f943596570d33a1731
valid
Sites.get_sites
Returns a list of sites. http://dev.wheniwork.com/#listing-sites
uw_wheniwork/sites.py
def get_sites(self): """ Returns a list of sites. http://dev.wheniwork.com/#listing-sites """ url = "/2/sites" data = self._get_resource(url) sites = [] for entry in data['sites']: sites.append(self.site_from_json(entry)) return site...
def get_sites(self): """ Returns a list of sites. http://dev.wheniwork.com/#listing-sites """ url = "/2/sites" data = self._get_resource(url) sites = [] for entry in data['sites']: sites.append(self.site_from_json(entry)) return site...
[ "Returns", "a", "list", "of", "sites", "." ]
uw-it-cte/uw-restclients-wheniwork
python
https://github.com/uw-it-cte/uw-restclients-wheniwork/blob/0d3ca09d5bbe808fec12e5f943596570d33a1731/uw_wheniwork/sites.py#L16-L29
[ "def", "get_sites", "(", "self", ")", ":", "url", "=", "\"/2/sites\"", "data", "=", "self", ".", "_get_resource", "(", "url", ")", "sites", "=", "[", "]", "for", "entry", "in", "data", "[", "'sites'", "]", ":", "sites", ".", "append", "(", "self", ...
0d3ca09d5bbe808fec12e5f943596570d33a1731
valid
Sites.create_site
Creates a site http://dev.wheniwork.com/#create-update-site
uw_wheniwork/sites.py
def create_site(self, params={}): """ Creates a site http://dev.wheniwork.com/#create-update-site """ url = "/2/sites/" body = params data = self._post_resource(url, body) return self.site_from_json(data["site"])
def create_site(self, params={}): """ Creates a site http://dev.wheniwork.com/#create-update-site """ url = "/2/sites/" body = params data = self._post_resource(url, body) return self.site_from_json(data["site"])
[ "Creates", "a", "site" ]
uw-it-cte/uw-restclients-wheniwork
python
https://github.com/uw-it-cte/uw-restclients-wheniwork/blob/0d3ca09d5bbe808fec12e5f943596570d33a1731/uw_wheniwork/sites.py#L31-L41
[ "def", "create_site", "(", "self", ",", "params", "=", "{", "}", ")", ":", "url", "=", "\"/2/sites/\"", "body", "=", "params", "data", "=", "self", ".", "_post_resource", "(", "url", ",", "body", ")", "return", "self", ".", "site_from_json", "(", "data...
0d3ca09d5bbe808fec12e5f943596570d33a1731
valid
admin_link_move_up
Returns a link to a view that moves the passed in object up in rank. :param obj: Object to move :param link_text: Text to display in the link. Defaults to "up" :returns: HTML link code to view for moving the object
awl/rankedmodel/admintools.py
def admin_link_move_up(obj, link_text='up'): """Returns a link to a view that moves the passed in object up in rank. :param obj: Object to move :param link_text: Text to display in the link. Defaults to "up" :returns: HTML link code to view for moving the object """ if ...
def admin_link_move_up(obj, link_text='up'): """Returns a link to a view that moves the passed in object up in rank. :param obj: Object to move :param link_text: Text to display in the link. Defaults to "up" :returns: HTML link code to view for moving the object """ if ...
[ "Returns", "a", "link", "to", "a", "view", "that", "moves", "the", "passed", "in", "object", "up", "in", "rank", "." ]
cltrudeau/django-awl
python
https://github.com/cltrudeau/django-awl/blob/70d469ef9a161c1170b53aa017cf02d7c15eb90c/awl/rankedmodel/admintools.py#L10-L27
[ "def", "admin_link_move_up", "(", "obj", ",", "link_text", "=", "'up'", ")", ":", "if", "obj", ".", "rank", "==", "1", ":", "return", "''", "content_type", "=", "ContentType", ".", "objects", ".", "get_for_model", "(", "obj", ")", "link", "=", "reverse",...
70d469ef9a161c1170b53aa017cf02d7c15eb90c
valid
admin_link_move_down
Returns a link to a view that moves the passed in object down in rank. :param obj: Object to move :param link_text: Text to display in the link. Defaults to "down" :returns: HTML link code to view for moving the object
awl/rankedmodel/admintools.py
def admin_link_move_down(obj, link_text='down'): """Returns a link to a view that moves the passed in object down in rank. :param obj: Object to move :param link_text: Text to display in the link. Defaults to "down" :returns: HTML link code to view for moving the object """...
def admin_link_move_down(obj, link_text='down'): """Returns a link to a view that moves the passed in object down in rank. :param obj: Object to move :param link_text: Text to display in the link. Defaults to "down" :returns: HTML link code to view for moving the object """...
[ "Returns", "a", "link", "to", "a", "view", "that", "moves", "the", "passed", "in", "object", "down", "in", "rank", "." ]
cltrudeau/django-awl
python
https://github.com/cltrudeau/django-awl/blob/70d469ef9a161c1170b53aa017cf02d7c15eb90c/awl/rankedmodel/admintools.py#L30-L47
[ "def", "admin_link_move_down", "(", "obj", ",", "link_text", "=", "'down'", ")", ":", "if", "obj", ".", "rank", "==", "obj", ".", "grouped_filter", "(", ")", ".", "count", "(", ")", ":", "return", "''", "content_type", "=", "ContentType", ".", "objects",...
70d469ef9a161c1170b53aa017cf02d7c15eb90c
valid
showfig
Shows a figure with a typical orientation so that x and y axes are set up as expected.
scisalt/matplotlib/showfig.py
def showfig(fig, aspect="auto"): """ Shows a figure with a typical orientation so that x and y axes are set up as expected. """ ax = fig.gca() # Swap y axis if needed alim = list(ax.axis()) if alim[3] < alim[2]: temp = alim[2] alim[2] = alim[3] alim[3] = temp ...
def showfig(fig, aspect="auto"): """ Shows a figure with a typical orientation so that x and y axes are set up as expected. """ ax = fig.gca() # Swap y axis if needed alim = list(ax.axis()) if alim[3] < alim[2]: temp = alim[2] alim[2] = alim[3] alim[3] = temp ...
[ "Shows", "a", "figure", "with", "a", "typical", "orientation", "so", "that", "x", "and", "y", "axes", "are", "set", "up", "as", "expected", "." ]
joelfrederico/SciSalt
python
https://github.com/joelfrederico/SciSalt/blob/7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f/scisalt/matplotlib/showfig.py#L1-L17
[ "def", "showfig", "(", "fig", ",", "aspect", "=", "\"auto\"", ")", ":", "ax", "=", "fig", ".", "gca", "(", ")", "# Swap y axis if needed", "alim", "=", "list", "(", "ax", ".", "axis", "(", ")", ")", "if", "alim", "[", "3", "]", "<", "alim", "[", ...
7bf57c49c7dde0a8b0aa337fbd2fbd527ce7a67f
valid
_setup_index
Shifts indicies as needed to account for one based indexing Positive indicies need to be reduced by one to match with zero based indexing. Zero is not a valid input, and as such will throw a value error. Arguments: index - index to shift
cuts/cutter.py
def _setup_index(index): """Shifts indicies as needed to account for one based indexing Positive indicies need to be reduced by one to match with zero based indexing. Zero is not a valid input, and as such will throw a value error. Arguments: index - index to shift """ index =...
def _setup_index(index): """Shifts indicies as needed to account for one based indexing Positive indicies need to be reduced by one to match with zero based indexing. Zero is not a valid input, and as such will throw a value error. Arguments: index - index to shift """ index =...
[ "Shifts", "indicies", "as", "needed", "to", "account", "for", "one", "based", "indexing" ]
jpweiser/cuts
python
https://github.com/jpweiser/cuts/blob/5baf7f2e145045942ee8dcaccbc47f8f821fcb56/cuts/cutter.py#L21-L38
[ "def", "_setup_index", "(", "index", ")", ":", "index", "=", "int", "(", "index", ")", "if", "index", ">", "0", ":", "index", "-=", "1", "elif", "index", "==", "0", ":", "# Zero indicies should not be allowed by default.", "raise", "ValueError", "return", "i...
5baf7f2e145045942ee8dcaccbc47f8f821fcb56
valid
Cutter.cut
Returns selected positions from cut input source in desired arrangement. Argument: line - input to cut
cuts/cutter.py
def cut(self, line): """Returns selected positions from cut input source in desired arrangement. Argument: line - input to cut """ result = [] line = self.line(line) for i, field in enumerate(self.positions): try: ind...
def cut(self, line): """Returns selected positions from cut input source in desired arrangement. Argument: line - input to cut """ result = [] line = self.line(line) for i, field in enumerate(self.positions): try: ind...
[ "Returns", "selected", "positions", "from", "cut", "input", "source", "in", "desired", "arrangement", "." ]
jpweiser/cuts
python
https://github.com/jpweiser/cuts/blob/5baf7f2e145045942ee8dcaccbc47f8f821fcb56/cuts/cutter.py#L60-L82
[ "def", "cut", "(", "self", ",", "line", ")", ":", "result", "=", "[", "]", "line", "=", "self", ".", "line", "(", "line", ")", "for", "i", ",", "field", "in", "enumerate", "(", "self", ".", "positions", ")", ":", "try", ":", "index", "=", "_set...
5baf7f2e145045942ee8dcaccbc47f8f821fcb56
valid
Cutter._setup_positions
Processes positions to account for ranges Arguments: positions - list of positions and/or ranges to process
cuts/cutter.py
def _setup_positions(self, positions): """Processes positions to account for ranges Arguments: positions - list of positions and/or ranges to process """ updated_positions = [] for i, position in enumerate(positions): ranger = re.search(r'(?P<start>-...
def _setup_positions(self, positions): """Processes positions to account for ranges Arguments: positions - list of positions and/or ranges to process """ updated_positions = [] for i, position in enumerate(positions): ranger = re.search(r'(?P<start>-...
[ "Processes", "positions", "to", "account", "for", "ranges" ]
jpweiser/cuts
python
https://github.com/jpweiser/cuts/blob/5baf7f2e145045942ee8dcaccbc47f8f821fcb56/cuts/cutter.py#L84-L118
[ "def", "_setup_positions", "(", "self", ",", "positions", ")", ":", "updated_positions", "=", "[", "]", "for", "i", ",", "position", "in", "enumerate", "(", "positions", ")", ":", "ranger", "=", "re", ".", "search", "(", "r'(?P<start>-?\\d*):(?P<end>\\d*)'", ...
5baf7f2e145045942ee8dcaccbc47f8f821fcb56
valid
Cutter._cut_range
Performs cut for range from start position to end Arguments: line - input to cut start - start of range current_position - current position in main cut function
cuts/cutter.py
def _cut_range(self, line, start, current_position): """Performs cut for range from start position to end Arguments: line - input to cut start - start of range current_position - current position in main cut function """ resu...
def _cut_range(self, line, start, current_position): """Performs cut for range from start position to end Arguments: line - input to cut start - start of range current_position - current position in main cut function """ resu...
[ "Performs", "cut", "for", "range", "from", "start", "position", "to", "end" ]
jpweiser/cuts
python
https://github.com/jpweiser/cuts/blob/5baf7f2e145045942ee8dcaccbc47f8f821fcb56/cuts/cutter.py#L121-L149
[ "def", "_cut_range", "(", "self", ",", "line", ",", "start", ",", "current_position", ")", ":", "result", "=", "[", "]", "try", ":", "for", "j", "in", "range", "(", "start", ",", "len", "(", "line", ")", ")", ":", "index", "=", "_setup_index", "(",...
5baf7f2e145045942ee8dcaccbc47f8f821fcb56
valid
Cutter._extendrange
Creates list of values in a range with output delimiters. Arguments: start - range start end - range end
cuts/cutter.py
def _extendrange(self, start, end): """Creates list of values in a range with output delimiters. Arguments: start - range start end - range end """ range_positions = [] for i in range(start, end): if i != 0: range_pos...
def _extendrange(self, start, end): """Creates list of values in a range with output delimiters. Arguments: start - range start end - range end """ range_positions = [] for i in range(start, end): if i != 0: range_pos...
[ "Creates", "list", "of", "values", "in", "a", "range", "with", "output", "delimiters", "." ]
jpweiser/cuts
python
https://github.com/jpweiser/cuts/blob/5baf7f2e145045942ee8dcaccbc47f8f821fcb56/cuts/cutter.py#L153-L166
[ "def", "_extendrange", "(", "self", ",", "start", ",", "end", ")", ":", "range_positions", "=", "[", "]", "for", "i", "in", "range", "(", "start", ",", "end", ")", ":", "if", "i", "!=", "0", ":", "range_positions", ".", "append", "(", "str", "(", ...
5baf7f2e145045942ee8dcaccbc47f8f821fcb56
valid
lock_file
Locks the file by writing a '.lock' file. Returns True when the file is locked and False when the file was locked already
lrcloud/__main__.py
def lock_file(filename): """Locks the file by writing a '.lock' file. Returns True when the file is locked and False when the file was locked already""" lockfile = "%s.lock"%filename if isfile(lockfile): return False else: with open(lockfile, "w"): pass ret...
def lock_file(filename): """Locks the file by writing a '.lock' file. Returns True when the file is locked and False when the file was locked already""" lockfile = "%s.lock"%filename if isfile(lockfile): return False else: with open(lockfile, "w"): pass ret...
[ "Locks", "the", "file", "by", "writing", "a", ".", "lock", "file", ".", "Returns", "True", "when", "the", "file", "is", "locked", "and", "False", "when", "the", "file", "was", "locked", "already" ]
madsbk/lrcloud
python
https://github.com/madsbk/lrcloud/blob/8d99be3e1abdf941642e9a1c86b7d775dc373c0b/lrcloud/__main__.py#L30-L41
[ "def", "lock_file", "(", "filename", ")", ":", "lockfile", "=", "\"%s.lock\"", "%", "filename", "if", "isfile", "(", "lockfile", ")", ":", "return", "False", "else", ":", "with", "open", "(", "lockfile", ",", "\"w\"", ")", ":", "pass", "return", "True" ]
8d99be3e1abdf941642e9a1c86b7d775dc373c0b
valid
unlock_file
Unlocks the file by remove a '.lock' file. Returns True when the file is unlocked and False when the file was unlocked already
lrcloud/__main__.py
def unlock_file(filename): """Unlocks the file by remove a '.lock' file. Returns True when the file is unlocked and False when the file was unlocked already""" lockfile = "%s.lock"%filename if isfile(lockfile): os.remove(lockfile) return True else: return False
def unlock_file(filename): """Unlocks the file by remove a '.lock' file. Returns True when the file is unlocked and False when the file was unlocked already""" lockfile = "%s.lock"%filename if isfile(lockfile): os.remove(lockfile) return True else: return False
[ "Unlocks", "the", "file", "by", "remove", "a", ".", "lock", "file", ".", "Returns", "True", "when", "the", "file", "is", "unlocked", "and", "False", "when", "the", "file", "was", "unlocked", "already" ]
madsbk/lrcloud
python
https://github.com/madsbk/lrcloud/blob/8d99be3e1abdf941642e9a1c86b7d775dc373c0b/lrcloud/__main__.py#L44-L54
[ "def", "unlock_file", "(", "filename", ")", ":", "lockfile", "=", "\"%s.lock\"", "%", "filename", "if", "isfile", "(", "lockfile", ")", ":", "os", ".", "remove", "(", "lockfile", ")", "return", "True", "else", ":", "return", "False" ]
8d99be3e1abdf941642e9a1c86b7d775dc373c0b
valid
copy_smart_previews
Copy Smart Previews from local to cloud or vica versa when 'local2cloud==False' NB: nothing happens if source dir doesn't exist
lrcloud/__main__.py
def copy_smart_previews(local_catalog, cloud_catalog, local2cloud=True): """Copy Smart Previews from local to cloud or vica versa when 'local2cloud==False' NB: nothing happens if source dir doesn't exist""" lcat_noext = local_catalog[0:local_catalog.rfind(".lrcat")] ccat_noext = cloud_catalog...
def copy_smart_previews(local_catalog, cloud_catalog, local2cloud=True): """Copy Smart Previews from local to cloud or vica versa when 'local2cloud==False' NB: nothing happens if source dir doesn't exist""" lcat_noext = local_catalog[0:local_catalog.rfind(".lrcat")] ccat_noext = cloud_catalog...
[ "Copy", "Smart", "Previews", "from", "local", "to", "cloud", "or", "vica", "versa", "when", "local2cloud", "==", "False", "NB", ":", "nothing", "happens", "if", "source", "dir", "doesn", "t", "exist" ]
madsbk/lrcloud
python
https://github.com/madsbk/lrcloud/blob/8d99be3e1abdf941642e9a1c86b7d775dc373c0b/lrcloud/__main__.py#L57-L71
[ "def", "copy_smart_previews", "(", "local_catalog", ",", "cloud_catalog", ",", "local2cloud", "=", "True", ")", ":", "lcat_noext", "=", "local_catalog", "[", "0", ":", "local_catalog", ".", "rfind", "(", "\".lrcat\"", ")", "]", "ccat_noext", "=", "cloud_catalog"...
8d99be3e1abdf941642e9a1c86b7d775dc373c0b
valid
hashsum
Return a hash of the file From <http://stackoverflow.com/a/7829658>
lrcloud/__main__.py
def hashsum(filename): """Return a hash of the file From <http://stackoverflow.com/a/7829658>""" with open(filename, mode='rb') as f: d = hashlib.sha1() for buf in iter(partial(f.read, 2**20), b''): d.update(buf) return d.hexdigest()
def hashsum(filename): """Return a hash of the file From <http://stackoverflow.com/a/7829658>""" with open(filename, mode='rb') as f: d = hashlib.sha1() for buf in iter(partial(f.read, 2**20), b''): d.update(buf) return d.hexdigest()
[ "Return", "a", "hash", "of", "the", "file", "From", "<http", ":", "//", "stackoverflow", ".", "com", "/", "a", "/", "7829658", ">" ]
madsbk/lrcloud
python
https://github.com/madsbk/lrcloud/blob/8d99be3e1abdf941642e9a1c86b7d775dc373c0b/lrcloud/__main__.py#L74-L81
[ "def", "hashsum", "(", "filename", ")", ":", "with", "open", "(", "filename", ",", "mode", "=", "'rb'", ")", "as", "f", ":", "d", "=", "hashlib", ".", "sha1", "(", ")", "for", "buf", "in", "iter", "(", "partial", "(", "f", ".", "read", ",", "2"...
8d99be3e1abdf941642e9a1c86b7d775dc373c0b
valid
cmd_init_push_to_cloud
Initiate the local catalog and push it the cloud
lrcloud/__main__.py
def cmd_init_push_to_cloud(args): """Initiate the local catalog and push it the cloud""" (lcat, ccat) = (args.local_catalog, args.cloud_catalog) logging.info("[init-push-to-cloud]: %s => %s"%(lcat, ccat)) if not isfile(lcat): args.error("[init-push-to-cloud] The local catalog does not exist: %...
def cmd_init_push_to_cloud(args): """Initiate the local catalog and push it the cloud""" (lcat, ccat) = (args.local_catalog, args.cloud_catalog) logging.info("[init-push-to-cloud]: %s => %s"%(lcat, ccat)) if not isfile(lcat): args.error("[init-push-to-cloud] The local catalog does not exist: %...
[ "Initiate", "the", "local", "catalog", "and", "push", "it", "the", "cloud" ]
madsbk/lrcloud
python
https://github.com/madsbk/lrcloud/blob/8d99be3e1abdf941642e9a1c86b7d775dc373c0b/lrcloud/__main__.py#L166-L216
[ "def", "cmd_init_push_to_cloud", "(", "args", ")", ":", "(", "lcat", ",", "ccat", ")", "=", "(", "args", ".", "local_catalog", ",", "args", ".", "cloud_catalog", ")", "logging", ".", "info", "(", "\"[init-push-to-cloud]: %s => %s\"", "%", "(", "lcat", ",", ...
8d99be3e1abdf941642e9a1c86b7d775dc373c0b
valid
cmd_init_pull_from_cloud
Initiate the local catalog by downloading the cloud catalog
lrcloud/__main__.py
def cmd_init_pull_from_cloud(args): """Initiate the local catalog by downloading the cloud catalog""" (lcat, ccat) = (args.local_catalog, args.cloud_catalog) logging.info("[init-pull-from-cloud]: %s => %s"%(ccat, lcat)) if isfile(lcat): args.error("[init-pull-from-cloud] The local catalog alre...
def cmd_init_pull_from_cloud(args): """Initiate the local catalog by downloading the cloud catalog""" (lcat, ccat) = (args.local_catalog, args.cloud_catalog) logging.info("[init-pull-from-cloud]: %s => %s"%(ccat, lcat)) if isfile(lcat): args.error("[init-pull-from-cloud] The local catalog alre...
[ "Initiate", "the", "local", "catalog", "by", "downloading", "the", "cloud", "catalog" ]
madsbk/lrcloud
python
https://github.com/madsbk/lrcloud/blob/8d99be3e1abdf941642e9a1c86b7d775dc373c0b/lrcloud/__main__.py#L219-L268
[ "def", "cmd_init_pull_from_cloud", "(", "args", ")", ":", "(", "lcat", ",", "ccat", ")", "=", "(", "args", ".", "local_catalog", ",", "args", ".", "cloud_catalog", ")", "logging", ".", "info", "(", "\"[init-pull-from-cloud]: %s => %s\"", "%", "(", "ccat", ",...
8d99be3e1abdf941642e9a1c86b7d775dc373c0b
valid
cmd_normal
Normal procedure: * Pull from cloud (if necessary) * Run Lightroom * Push to cloud
lrcloud/__main__.py
def cmd_normal(args): """Normal procedure: * Pull from cloud (if necessary) * Run Lightroom * Push to cloud """ logging.info("cmd_normal") (lcat, ccat) = (args.local_catalog, args.cloud_catalog) (lmeta, cmeta) = ("%s.lrcloud"%lcat, "%s.lrcloud"%ccat) if not isfile(lcat)...
def cmd_normal(args): """Normal procedure: * Pull from cloud (if necessary) * Run Lightroom * Push to cloud """ logging.info("cmd_normal") (lcat, ccat) = (args.local_catalog, args.cloud_catalog) (lmeta, cmeta) = ("%s.lrcloud"%lcat, "%s.lrcloud"%ccat) if not isfile(lcat)...
[ "Normal", "procedure", ":", "*", "Pull", "from", "cloud", "(", "if", "necessary", ")", "*", "Run", "Lightroom", "*", "Push", "to", "cloud" ]
madsbk/lrcloud
python
https://github.com/madsbk/lrcloud/blob/8d99be3e1abdf941642e9a1c86b7d775dc373c0b/lrcloud/__main__.py#L271-L369
[ "def", "cmd_normal", "(", "args", ")", ":", "logging", ".", "info", "(", "\"cmd_normal\"", ")", "(", "lcat", ",", "ccat", ")", "=", "(", "args", ".", "local_catalog", ",", "args", ".", "cloud_catalog", ")", "(", "lmeta", ",", "cmeta", ")", "=", "(", ...
8d99be3e1abdf941642e9a1c86b7d775dc373c0b
valid
parse_arguments
Return arguments
lrcloud/__main__.py
def parse_arguments(argv=None): """Return arguments""" def default_config_path(): """Returns the platform specific default location of the configure file""" if os.name == "nt": return join(os.getenv('APPDATA'), "lrcloud.ini") else: return join(os.path.expanduser...
def parse_arguments(argv=None): """Return arguments""" def default_config_path(): """Returns the platform specific default location of the configure file""" if os.name == "nt": return join(os.getenv('APPDATA'), "lrcloud.ini") else: return join(os.path.expanduser...
[ "Return", "arguments" ]
madsbk/lrcloud
python
https://github.com/madsbk/lrcloud/blob/8d99be3e1abdf941642e9a1c86b7d775dc373c0b/lrcloud/__main__.py#L372-L468
[ "def", "parse_arguments", "(", "argv", "=", "None", ")", ":", "def", "default_config_path", "(", ")", ":", "\"\"\"Returns the platform specific default location of the configure file\"\"\"", "if", "os", ".", "name", "==", "\"nt\"", ":", "return", "join", "(", "os", ...
8d99be3e1abdf941642e9a1c86b7d775dc373c0b