id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
250,900 | eeue56/PyChat.js | pychatjs/server/user_server.py | User.change_name | def change_name(self, username):
""" changes the username to given username, throws exception if username used """
self.release_name()
try:
self.server.register_name(username)
except UsernameInUseException:
logging.log(', '.join(self.server.registered_name... | python | def change_name(self, username):
""" changes the username to given username, throws exception if username used """
self.release_name()
try:
self.server.register_name(username)
except UsernameInUseException:
logging.log(', '.join(self.server.registered_name... | [
"def",
"change_name",
"(",
"self",
",",
"username",
")",
":",
"self",
".",
"release_name",
"(",
")",
"try",
":",
"self",
".",
"server",
".",
"register_name",
"(",
"username",
")",
"except",
"UsernameInUseException",
":",
"logging",
".",
"log",
"(",
"', '",... | changes the username to given username, throws exception if username used | [
"changes",
"the",
"username",
"to",
"given",
"username",
"throws",
"exception",
"if",
"username",
"used"
] | 45056de6f988350c90a6dbe674459a4affde8abc | https://github.com/eeue56/PyChat.js/blob/45056de6f988350c90a6dbe674459a4affde8abc/pychatjs/server/user_server.py#L28-L39 |
250,901 | eeue56/PyChat.js | pychatjs/server/user_server.py | UserServer.register_name | def register_name(self, username):
""" register a name """
if self.is_username_used(username):
raise UsernameInUseException('Username {username} already in use!'.format(username=username))
self.registered_names.append(username) | python | def register_name(self, username):
""" register a name """
if self.is_username_used(username):
raise UsernameInUseException('Username {username} already in use!'.format(username=username))
self.registered_names.append(username) | [
"def",
"register_name",
"(",
"self",
",",
"username",
")",
":",
"if",
"self",
".",
"is_username_used",
"(",
"username",
")",
":",
"raise",
"UsernameInUseException",
"(",
"'Username {username} already in use!'",
".",
"format",
"(",
"username",
"=",
"username",
")",... | register a name | [
"register",
"a",
"name"
] | 45056de6f988350c90a6dbe674459a4affde8abc | https://github.com/eeue56/PyChat.js/blob/45056de6f988350c90a6dbe674459a4affde8abc/pychatjs/server/user_server.py#L59-L63 |
250,902 | eeue56/PyChat.js | pychatjs/server/user_server.py | UserServer.release_name | def release_name(self, username):
""" release a name and add it to the temp list """
self.temp_names.append(username)
if self.is_username_used(username):
self.registered_names.remove(username) | python | def release_name(self, username):
""" release a name and add it to the temp list """
self.temp_names.append(username)
if self.is_username_used(username):
self.registered_names.remove(username) | [
"def",
"release_name",
"(",
"self",
",",
"username",
")",
":",
"self",
".",
"temp_names",
".",
"append",
"(",
"username",
")",
"if",
"self",
".",
"is_username_used",
"(",
"username",
")",
":",
"self",
".",
"registered_names",
".",
"remove",
"(",
"username"... | release a name and add it to the temp list | [
"release",
"a",
"name",
"and",
"add",
"it",
"to",
"the",
"temp",
"list"
] | 45056de6f988350c90a6dbe674459a4affde8abc | https://github.com/eeue56/PyChat.js/blob/45056de6f988350c90a6dbe674459a4affde8abc/pychatjs/server/user_server.py#L66-L70 |
250,903 | qzmfranklin/easyshell | easyshell/basic_shell.py | BasicShell._do_exit | def _do_exit(self, cmd, args):
"""\
Exit shell.
exit | C-D Exit to the parent shell.
exit root | end Exit to the root shell.
exit all Exit to the command line.
"""
if cmd == 'end':
if not args:
return... | python | def _do_exit(self, cmd, args):
"""\
Exit shell.
exit | C-D Exit to the parent shell.
exit root | end Exit to the root shell.
exit all Exit to the command line.
"""
if cmd == 'end':
if not args:
return... | [
"def",
"_do_exit",
"(",
"self",
",",
"cmd",
",",
"args",
")",
":",
"if",
"cmd",
"==",
"'end'",
":",
"if",
"not",
"args",
":",
"return",
"'root'",
"else",
":",
"self",
".",
"stderr",
".",
"write",
"(",
"textwrap",
".",
"dedent",
"(",
"'''\\\n ... | \
Exit shell.
exit | C-D Exit to the parent shell.
exit root | end Exit to the root shell.
exit all Exit to the command line. | [
"\\",
"Exit",
"shell",
".",
"exit",
"|",
"C",
"-",
"D",
"Exit",
"to",
"the",
"parent",
"shell",
".",
"exit",
"root",
"|",
"end",
"Exit",
"to",
"the",
"root",
"shell",
".",
"exit",
"all",
"Exit",
"to",
"the",
"command",
"line",
"."
] | 00c2e90e7767d32e7e127fc8c6875845aa308295 | https://github.com/qzmfranklin/easyshell/blob/00c2e90e7767d32e7e127fc8c6875845aa308295/easyshell/basic_shell.py#L27-L56 |
250,904 | qzmfranklin/easyshell | easyshell/basic_shell.py | BasicShell._complete_exit | def _complete_exit(self, cmd, args, text):
"""Find candidates for the 'exit' command."""
if args:
return
return [ x for x in { 'root', 'all', } \
if x.startswith(text) ] | python | def _complete_exit(self, cmd, args, text):
"""Find candidates for the 'exit' command."""
if args:
return
return [ x for x in { 'root', 'all', } \
if x.startswith(text) ] | [
"def",
"_complete_exit",
"(",
"self",
",",
"cmd",
",",
"args",
",",
"text",
")",
":",
"if",
"args",
":",
"return",
"return",
"[",
"x",
"for",
"x",
"in",
"{",
"'root'",
",",
"'all'",
",",
"}",
"if",
"x",
".",
"startswith",
"(",
"text",
")",
"]"
] | Find candidates for the 'exit' command. | [
"Find",
"candidates",
"for",
"the",
"exit",
"command",
"."
] | 00c2e90e7767d32e7e127fc8c6875845aa308295 | https://github.com/qzmfranklin/easyshell/blob/00c2e90e7767d32e7e127fc8c6875845aa308295/easyshell/basic_shell.py#L59-L64 |
250,905 | qzmfranklin/easyshell | easyshell/basic_shell.py | BasicShell._do_history | def _do_history(self, cmd, args):
"""\
Display history.
history Display history.
history clear Clear history.
history clearall Clear history for all shells.
"""
if args and args[0] == 'clear':
readline.clear_history()
... | python | def _do_history(self, cmd, args):
"""\
Display history.
history Display history.
history clear Clear history.
history clearall Clear history for all shells.
"""
if args and args[0] == 'clear':
readline.clear_history()
... | [
"def",
"_do_history",
"(",
"self",
",",
"cmd",
",",
"args",
")",
":",
"if",
"args",
"and",
"args",
"[",
"0",
"]",
"==",
"'clear'",
":",
"readline",
".",
"clear_history",
"(",
")",
"readline",
".",
"write_history_file",
"(",
"self",
".",
"history_fname",
... | \
Display history.
history Display history.
history clear Clear history.
history clearall Clear history for all shells. | [
"\\",
"Display",
"history",
".",
"history",
"Display",
"history",
".",
"history",
"clear",
"Clear",
"history",
".",
"history",
"clearall",
"Clear",
"history",
"for",
"all",
"shells",
"."
] | 00c2e90e7767d32e7e127fc8c6875845aa308295 | https://github.com/qzmfranklin/easyshell/blob/00c2e90e7767d32e7e127fc8c6875845aa308295/easyshell/basic_shell.py#L67-L84 |
250,906 | qzmfranklin/easyshell | easyshell/basic_shell.py | BasicShell._complete_history | def _complete_history(self, cmd, args, text):
"""Find candidates for the 'history' command."""
if args:
return
return [ x for x in { 'clear', 'clearall' } \
if x.startswith(text) ] | python | def _complete_history(self, cmd, args, text):
"""Find candidates for the 'history' command."""
if args:
return
return [ x for x in { 'clear', 'clearall' } \
if x.startswith(text) ] | [
"def",
"_complete_history",
"(",
"self",
",",
"cmd",
",",
"args",
",",
"text",
")",
":",
"if",
"args",
":",
"return",
"return",
"[",
"x",
"for",
"x",
"in",
"{",
"'clear'",
",",
"'clearall'",
"}",
"if",
"x",
".",
"startswith",
"(",
"text",
")",
"]"
... | Find candidates for the 'history' command. | [
"Find",
"candidates",
"for",
"the",
"history",
"command",
"."
] | 00c2e90e7767d32e7e127fc8c6875845aa308295 | https://github.com/qzmfranklin/easyshell/blob/00c2e90e7767d32e7e127fc8c6875845aa308295/easyshell/basic_shell.py#L87-L92 |
250,907 | qzmfranklin/easyshell | easyshell/basic_shell.py | BasicShell.__dump_stack | def __dump_stack(self):
"""Dump the shell stack in a human friendly way.
An example output is:
0 PlayBoy
1 βββ foo-prompt: foo@[]
2 βββ karPROMPT: kar@[]
3 βββ DEBUG: debug@['shell']
"""
maxdepth = l... | python | def __dump_stack(self):
"""Dump the shell stack in a human friendly way.
An example output is:
0 PlayBoy
1 βββ foo-prompt: foo@[]
2 βββ karPROMPT: kar@[]
3 βββ DEBUG: debug@['shell']
"""
maxdepth = l... | [
"def",
"__dump_stack",
"(",
"self",
")",
":",
"maxdepth",
"=",
"len",
"(",
"self",
".",
"_mode_stack",
")",
"maxdepth_strlen",
"=",
"len",
"(",
"str",
"(",
"maxdepth",
")",
")",
"index_width",
"=",
"4",
"-",
"(",
"-",
"maxdepth_strlen",
")",
"%",
"4",
... | Dump the shell stack in a human friendly way.
An example output is:
0 PlayBoy
1 βββ foo-prompt: foo@[]
2 βββ karPROMPT: kar@[]
3 βββ DEBUG: debug@['shell'] | [
"Dump",
"the",
"shell",
"stack",
"in",
"a",
"human",
"friendly",
"way",
"."
] | 00c2e90e7767d32e7e127fc8c6875845aa308295 | https://github.com/qzmfranklin/easyshell/blob/00c2e90e7767d32e7e127fc8c6875845aa308295/easyshell/basic_shell.py#L122-L148 |
250,908 | qzmfranklin/easyshell | easyshell/basic_shell.py | BasicShell._do_help | def _do_help(self, cmd, args):
"""Display doc strings of the shell and its commands.
"""
print(self.doc_string())
print()
# Create data of the commands table.
data_unsorted = []
cls = self.__class__
for name in dir(cls):
obj = getattr(cls, nam... | python | def _do_help(self, cmd, args):
"""Display doc strings of the shell and its commands.
"""
print(self.doc_string())
print()
# Create data of the commands table.
data_unsorted = []
cls = self.__class__
for name in dir(cls):
obj = getattr(cls, nam... | [
"def",
"_do_help",
"(",
"self",
",",
"cmd",
",",
"args",
")",
":",
"print",
"(",
"self",
".",
"doc_string",
"(",
")",
")",
"print",
"(",
")",
"# Create data of the commands table.",
"data_unsorted",
"=",
"[",
"]",
"cls",
"=",
"self",
".",
"__class__",
"f... | Display doc strings of the shell and its commands. | [
"Display",
"doc",
"strings",
"of",
"the",
"shell",
"and",
"its",
"commands",
"."
] | 00c2e90e7767d32e7e127fc8c6875845aa308295 | https://github.com/qzmfranklin/easyshell/blob/00c2e90e7767d32e7e127fc8c6875845aa308295/easyshell/basic_shell.py#L151-L178 |
250,909 | unixorn/haze | haze/cli/conductor.py | hazeDriver | def hazeDriver():
"""
Process the command line arguments and run the appropriate haze subcommand.
We want to be able to do git-style handoffs to subcommands where if we
do `haze aws foo bar` and the executable haze-aws-foo exists, we'll call
it with the argument bar.
We deliberately don't do anything with... | python | def hazeDriver():
"""
Process the command line arguments and run the appropriate haze subcommand.
We want to be able to do git-style handoffs to subcommands where if we
do `haze aws foo bar` and the executable haze-aws-foo exists, we'll call
it with the argument bar.
We deliberately don't do anything with... | [
"def",
"hazeDriver",
"(",
")",
":",
"try",
":",
"(",
"command",
",",
"args",
")",
"=",
"findSubCommand",
"(",
"sys",
".",
"argv",
")",
"# If we can't construct a subcommand from sys.argv, it'll still be able",
"# to find this haze driver script, and re-running ourself isn't u... | Process the command line arguments and run the appropriate haze subcommand.
We want to be able to do git-style handoffs to subcommands where if we
do `haze aws foo bar` and the executable haze-aws-foo exists, we'll call
it with the argument bar.
We deliberately don't do anything with the arguments other than ... | [
"Process",
"the",
"command",
"line",
"arguments",
"and",
"run",
"the",
"appropriate",
"haze",
"subcommand",
"."
] | 77692b18e6574ac356e3e16659b96505c733afff | https://github.com/unixorn/haze/blob/77692b18e6574ac356e3e16659b96505c733afff/haze/cli/conductor.py#L29-L52 |
250,910 | klmitch/aversion | aversion.py | quoted_split | def quoted_split(string, sep, quotes='"'):
"""
Split a string on the given separation character, but respecting
double-quoted sections of the string. Returns an iterator.
:param string: The string to split.
:param sep: The character separating sections of the string.
:param quotes: A string sp... | python | def quoted_split(string, sep, quotes='"'):
"""
Split a string on the given separation character, but respecting
double-quoted sections of the string. Returns an iterator.
:param string: The string to split.
:param sep: The character separating sections of the string.
:param quotes: A string sp... | [
"def",
"quoted_split",
"(",
"string",
",",
"sep",
",",
"quotes",
"=",
"'\"'",
")",
":",
"# Initialize the algorithm",
"start",
"=",
"None",
"escape",
"=",
"False",
"quote",
"=",
"False",
"# Walk through the string",
"for",
"i",
",",
"c",
"in",
"enumerate",
"... | Split a string on the given separation character, but respecting
double-quoted sections of the string. Returns an iterator.
:param string: The string to split.
:param sep: The character separating sections of the string.
:param quotes: A string specifying all legal quote characters.
:returns: An ... | [
"Split",
"a",
"string",
"on",
"the",
"given",
"separation",
"character",
"but",
"respecting",
"double",
"-",
"quoted",
"sections",
"of",
"the",
"string",
".",
"Returns",
"an",
"iterator",
"."
] | 90ca68e7d6426a77db8a926171f8d3bbeb00ee4c | https://github.com/klmitch/aversion/blob/90ca68e7d6426a77db8a926171f8d3bbeb00ee4c/aversion.py#L29-L75 |
250,911 | klmitch/aversion | aversion.py | parse_ctype | def parse_ctype(ctype):
"""
Parse a content type.
:param ctype: The content type, with corresponding parameters.
:returns: A tuple of the content type and a dictionary containing
the content type parameters. The content type will
additionally be available in the dictionary... | python | def parse_ctype(ctype):
"""
Parse a content type.
:param ctype: The content type, with corresponding parameters.
:returns: A tuple of the content type and a dictionary containing
the content type parameters. The content type will
additionally be available in the dictionary... | [
"def",
"parse_ctype",
"(",
"ctype",
")",
":",
"result_ctype",
"=",
"None",
"result",
"=",
"{",
"}",
"for",
"part",
"in",
"quoted_split",
"(",
"ctype",
",",
"';'",
")",
":",
"# Extract the content type first",
"if",
"result_ctype",
"is",
"None",
":",
"result_... | Parse a content type.
:param ctype: The content type, with corresponding parameters.
:returns: A tuple of the content type and a dictionary containing
the content type parameters. The content type will
additionally be available in the dictionary as the '_'
key. | [
"Parse",
"a",
"content",
"type",
"."
] | 90ca68e7d6426a77db8a926171f8d3bbeb00ee4c | https://github.com/klmitch/aversion/blob/90ca68e7d6426a77db8a926171f8d3bbeb00ee4c/aversion.py#L98-L134 |
250,912 | klmitch/aversion | aversion.py | _match_mask | def _match_mask(mask, ctype):
"""
Determine if a content type mask matches a given content type.
:param mask: The content type mask, taken from the Accept
header.
:param ctype: The content type to match to the mask.
"""
# Handle the simple cases first
if '*' not in mask:
... | python | def _match_mask(mask, ctype):
"""
Determine if a content type mask matches a given content type.
:param mask: The content type mask, taken from the Accept
header.
:param ctype: The content type to match to the mask.
"""
# Handle the simple cases first
if '*' not in mask:
... | [
"def",
"_match_mask",
"(",
"mask",
",",
"ctype",
")",
":",
"# Handle the simple cases first",
"if",
"'*'",
"not",
"in",
"mask",
":",
"return",
"ctype",
"==",
"mask",
"elif",
"mask",
"==",
"'*/*'",
":",
"return",
"True",
"elif",
"not",
"mask",
".",
"endswit... | Determine if a content type mask matches a given content type.
:param mask: The content type mask, taken from the Accept
header.
:param ctype: The content type to match to the mask. | [
"Determine",
"if",
"a",
"content",
"type",
"mask",
"matches",
"a",
"given",
"content",
"type",
"."
] | 90ca68e7d6426a77db8a926171f8d3bbeb00ee4c | https://github.com/klmitch/aversion/blob/90ca68e7d6426a77db8a926171f8d3bbeb00ee4c/aversion.py#L137-L156 |
250,913 | klmitch/aversion | aversion.py | best_match | def best_match(requested, allowed):
"""
Determine the best content type to use for the request.
:param ctypes: A list of the available content types.
:returns: A tuple of the best match content type and the
parameters for that content type.
"""
requested = [parse_ctype(ctype) fo... | python | def best_match(requested, allowed):
"""
Determine the best content type to use for the request.
:param ctypes: A list of the available content types.
:returns: A tuple of the best match content type and the
parameters for that content type.
"""
requested = [parse_ctype(ctype) fo... | [
"def",
"best_match",
"(",
"requested",
",",
"allowed",
")",
":",
"requested",
"=",
"[",
"parse_ctype",
"(",
"ctype",
")",
"for",
"ctype",
"in",
"quoted_split",
"(",
"requested",
",",
"','",
")",
"]",
"best_q",
"=",
"-",
"1",
"best_ctype",
"=",
"''",
"b... | Determine the best content type to use for the request.
:param ctypes: A list of the available content types.
:returns: A tuple of the best match content type and the
parameters for that content type. | [
"Determine",
"the",
"best",
"content",
"type",
"to",
"use",
"for",
"the",
"request",
"."
] | 90ca68e7d6426a77db8a926171f8d3bbeb00ee4c | https://github.com/klmitch/aversion/blob/90ca68e7d6426a77db8a926171f8d3bbeb00ee4c/aversion.py#L159-L202 |
250,914 | klmitch/aversion | aversion.py | _set_key | def _set_key(log_prefix, result_dict, key, value, desc="parameter"):
"""
Helper to set a key value in a dictionary. This function issues a
warning if the key has already been set, and issues a warning and
returns without setting the value if the value is not surrounded
by parentheses. This is used... | python | def _set_key(log_prefix, result_dict, key, value, desc="parameter"):
"""
Helper to set a key value in a dictionary. This function issues a
warning if the key has already been set, and issues a warning and
returns without setting the value if the value is not surrounded
by parentheses. This is used... | [
"def",
"_set_key",
"(",
"log_prefix",
",",
"result_dict",
",",
"key",
",",
"value",
",",
"desc",
"=",
"\"parameter\"",
")",
":",
"if",
"key",
"in",
"result_dict",
":",
"LOG",
".",
"warn",
"(",
"\"%s: Duplicate value for %s %r\"",
"%",
"(",
"log_prefix",
",",... | Helper to set a key value in a dictionary. This function issues a
warning if the key has already been set, and issues a warning and
returns without setting the value if the value is not surrounded
by parentheses. This is used to eliminate duplicated code from
the rule parsers below.
:param log_pr... | [
"Helper",
"to",
"set",
"a",
"key",
"value",
"in",
"a",
"dictionary",
".",
"This",
"function",
"issues",
"a",
"warning",
"if",
"the",
"key",
"has",
"already",
"been",
"set",
"and",
"issues",
"a",
"warning",
"and",
"returns",
"without",
"setting",
"the",
"... | 90ca68e7d6426a77db8a926171f8d3bbeb00ee4c | https://github.com/klmitch/aversion/blob/90ca68e7d6426a77db8a926171f8d3bbeb00ee4c/aversion.py#L309-L344 |
250,915 | klmitch/aversion | aversion.py | _parse_version_rule | def _parse_version_rule(loader, version, verspec):
"""
Parse a version rule. The first token is the name of the
application implementing that API version. The remaining tokens
are key="quoted value" pairs that specify parameters; these
parameters are ignored by AVersion, but may be used by the
... | python | def _parse_version_rule(loader, version, verspec):
"""
Parse a version rule. The first token is the name of the
application implementing that API version. The remaining tokens
are key="quoted value" pairs that specify parameters; these
parameters are ignored by AVersion, but may be used by the
... | [
"def",
"_parse_version_rule",
"(",
"loader",
",",
"version",
",",
"verspec",
")",
":",
"result",
"=",
"dict",
"(",
"name",
"=",
"version",
",",
"params",
"=",
"{",
"}",
")",
"for",
"token",
"in",
"quoted_split",
"(",
"verspec",
",",
"' '",
",",
"quotes... | Parse a version rule. The first token is the name of the
application implementing that API version. The remaining tokens
are key="quoted value" pairs that specify parameters; these
parameters are ignored by AVersion, but may be used by the
application.
:param loader: An object with a get_app() me... | [
"Parse",
"a",
"version",
"rule",
".",
"The",
"first",
"token",
"is",
"the",
"name",
"of",
"the",
"application",
"implementing",
"that",
"API",
"version",
".",
"The",
"remaining",
"tokens",
"are",
"key",
"=",
"quoted",
"value",
"pairs",
"that",
"specify",
"... | 90ca68e7d6426a77db8a926171f8d3bbeb00ee4c | https://github.com/klmitch/aversion/blob/90ca68e7d6426a77db8a926171f8d3bbeb00ee4c/aversion.py#L347-L385 |
250,916 | klmitch/aversion | aversion.py | _parse_alias_rule | def _parse_alias_rule(alias, alias_spec):
"""
Parse an alias rule. The first token is the canonical name of the
version. The remaining tokens are key="quoted value" pairs that
specify parameters; these parameters are ignored by AVersion, but
may be used by the application.
:param alias: The a... | python | def _parse_alias_rule(alias, alias_spec):
"""
Parse an alias rule. The first token is the canonical name of the
version. The remaining tokens are key="quoted value" pairs that
specify parameters; these parameters are ignored by AVersion, but
may be used by the application.
:param alias: The a... | [
"def",
"_parse_alias_rule",
"(",
"alias",
",",
"alias_spec",
")",
":",
"result",
"=",
"dict",
"(",
"alias",
"=",
"alias",
",",
"params",
"=",
"{",
"}",
")",
"for",
"token",
"in",
"quoted_split",
"(",
"alias_spec",
",",
"' '",
",",
"quotes",
"=",
"'\"\\... | Parse an alias rule. The first token is the canonical name of the
version. The remaining tokens are key="quoted value" pairs that
specify parameters; these parameters are ignored by AVersion, but
may be used by the application.
:param alias: The alias name.
:param alias_spec: The alias text, desc... | [
"Parse",
"an",
"alias",
"rule",
".",
"The",
"first",
"token",
"is",
"the",
"canonical",
"name",
"of",
"the",
"version",
".",
"The",
"remaining",
"tokens",
"are",
"key",
"=",
"quoted",
"value",
"pairs",
"that",
"specify",
"parameters",
";",
"these",
"parame... | 90ca68e7d6426a77db8a926171f8d3bbeb00ee4c | https://github.com/klmitch/aversion/blob/90ca68e7d6426a77db8a926171f8d3bbeb00ee4c/aversion.py#L388-L424 |
250,917 | klmitch/aversion | aversion.py | Result.set_ctype | def set_ctype(self, ctype, orig_ctype=None):
"""
Set the selected content type. Will not override the value of
the content type if that has already been determined.
:param ctype: The content type string to set.
:param orig_ctype: The original content type, as found in the
... | python | def set_ctype(self, ctype, orig_ctype=None):
"""
Set the selected content type. Will not override the value of
the content type if that has already been determined.
:param ctype: The content type string to set.
:param orig_ctype: The original content type, as found in the
... | [
"def",
"set_ctype",
"(",
"self",
",",
"ctype",
",",
"orig_ctype",
"=",
"None",
")",
":",
"if",
"self",
".",
"ctype",
"is",
"None",
":",
"self",
".",
"ctype",
"=",
"ctype",
"self",
".",
"orig_ctype",
"=",
"orig_ctype"
] | Set the selected content type. Will not override the value of
the content type if that has already been determined.
:param ctype: The content type string to set.
:param orig_ctype: The original content type, as found in the
configuration. | [
"Set",
"the",
"selected",
"content",
"type",
".",
"Will",
"not",
"override",
"the",
"value",
"of",
"the",
"content",
"type",
"if",
"that",
"has",
"already",
"been",
"determined",
"."
] | 90ca68e7d6426a77db8a926171f8d3bbeb00ee4c | https://github.com/klmitch/aversion/blob/90ca68e7d6426a77db8a926171f8d3bbeb00ee4c/aversion.py#L293-L306 |
250,918 | klmitch/aversion | aversion.py | AVersion._process | def _process(self, request, result=None):
"""
Process the rules for the request.
:param request: The Request object provided by WebOb.
:param result: The Result object to store the results in. If
None, one will be allocated.
:returns: A Result object, co... | python | def _process(self, request, result=None):
"""
Process the rules for the request.
:param request: The Request object provided by WebOb.
:param result: The Result object to store the results in. If
None, one will be allocated.
:returns: A Result object, co... | [
"def",
"_process",
"(",
"self",
",",
"request",
",",
"result",
"=",
"None",
")",
":",
"# Allocate a result and process all the rules",
"result",
"=",
"result",
"if",
"result",
"is",
"not",
"None",
"else",
"Result",
"(",
")",
"self",
".",
"_proc_uri",
"(",
"r... | Process the rules for the request.
:param request: The Request object provided by WebOb.
:param result: The Result object to store the results in. If
None, one will be allocated.
:returns: A Result object, containing the selected version and
content ty... | [
"Process",
"the",
"rules",
"for",
"the",
"request",
"."
] | 90ca68e7d6426a77db8a926171f8d3bbeb00ee4c | https://github.com/klmitch/aversion/blob/90ca68e7d6426a77db8a926171f8d3bbeb00ee4c/aversion.py#L640-L658 |
250,919 | klmitch/aversion | aversion.py | AVersion._proc_uri | def _proc_uri(self, request, result):
"""
Process the URI rules for the request. Both the desired API
version and desired content type can be determined from those
rules.
:param request: The Request object provided by WebOb.
:param result: The Result object to store the... | python | def _proc_uri(self, request, result):
"""
Process the URI rules for the request. Both the desired API
version and desired content type can be determined from those
rules.
:param request: The Request object provided by WebOb.
:param result: The Result object to store the... | [
"def",
"_proc_uri",
"(",
"self",
",",
"request",
",",
"result",
")",
":",
"if",
"result",
":",
"# Result has already been fully determined",
"return",
"# First, determine the version based on the URI prefix",
"for",
"prefix",
",",
"version",
"in",
"self",
".",
"uris",
... | Process the URI rules for the request. Both the desired API
version and desired content type can be determined from those
rules.
:param request: The Request object provided by WebOb.
:param result: The Result object to store the results in. | [
"Process",
"the",
"URI",
"rules",
"for",
"the",
"request",
".",
"Both",
"the",
"desired",
"API",
"version",
"and",
"desired",
"content",
"type",
"can",
"be",
"determined",
"from",
"those",
"rules",
"."
] | 90ca68e7d6426a77db8a926171f8d3bbeb00ee4c | https://github.com/klmitch/aversion/blob/90ca68e7d6426a77db8a926171f8d3bbeb00ee4c/aversion.py#L660-L694 |
250,920 | klmitch/aversion | aversion.py | AVersion._proc_ctype_header | def _proc_ctype_header(self, request, result):
"""
Process the Content-Type header rules for the request. Only
the desired API version can be determined from those rules.
:param request: The Request object provided by WebOb.
:param result: The Result object to store the results... | python | def _proc_ctype_header(self, request, result):
"""
Process the Content-Type header rules for the request. Only
the desired API version can be determined from those rules.
:param request: The Request object provided by WebOb.
:param result: The Result object to store the results... | [
"def",
"_proc_ctype_header",
"(",
"self",
",",
"request",
",",
"result",
")",
":",
"if",
"result",
":",
"# Result has already been fully determined",
"return",
"try",
":",
"ctype",
"=",
"request",
".",
"headers",
"[",
"'content-type'",
"]",
"except",
"KeyError",
... | Process the Content-Type header rules for the request. Only
the desired API version can be determined from those rules.
:param request: The Request object provided by WebOb.
:param result: The Result object to store the results in. | [
"Process",
"the",
"Content",
"-",
"Type",
"header",
"rules",
"for",
"the",
"request",
".",
"Only",
"the",
"desired",
"API",
"version",
"can",
"be",
"determined",
"from",
"those",
"rules",
"."
] | 90ca68e7d6426a77db8a926171f8d3bbeb00ee4c | https://github.com/klmitch/aversion/blob/90ca68e7d6426a77db8a926171f8d3bbeb00ee4c/aversion.py#L696-L734 |
250,921 | klmitch/aversion | aversion.py | AVersion._proc_accept_header | def _proc_accept_header(self, request, result):
"""
Process the Accept header rules for the request. Both the
desired API version and content type can be determined from
those rules.
:param request: The Request object provided by WebOb.
:param result: The Result object ... | python | def _proc_accept_header(self, request, result):
"""
Process the Accept header rules for the request. Both the
desired API version and content type can be determined from
those rules.
:param request: The Request object provided by WebOb.
:param result: The Result object ... | [
"def",
"_proc_accept_header",
"(",
"self",
",",
"request",
",",
"result",
")",
":",
"if",
"result",
":",
"# Result has already been fully determined",
"return",
"try",
":",
"accept",
"=",
"request",
".",
"headers",
"[",
"'accept'",
"]",
"except",
"KeyError",
":"... | Process the Accept header rules for the request. Both the
desired API version and content type can be determined from
those rules.
:param request: The Request object provided by WebOb.
:param result: The Result object to store the results in. | [
"Process",
"the",
"Accept",
"header",
"rules",
"for",
"the",
"request",
".",
"Both",
"the",
"desired",
"API",
"version",
"and",
"content",
"type",
"can",
"be",
"determined",
"from",
"those",
"rules",
"."
] | 90ca68e7d6426a77db8a926171f8d3bbeb00ee4c | https://github.com/klmitch/aversion/blob/90ca68e7d6426a77db8a926171f8d3bbeb00ee4c/aversion.py#L736-L770 |
250,922 | andrewjsledge/django-hash-filter | django_hash_filter/templatetags/__init__.py | get_available_hashes | def get_available_hashes():
"""
Returns a tuple of the available hashes
"""
if sys.version_info >= (3,2):
return hashlib.algorithms_available
elif sys.version_info >= (2,7) and sys.version_info < (3,0):
return hashlib.algorithms
else:
return 'md5', 'sha1', 'sha224', 'sha2... | python | def get_available_hashes():
"""
Returns a tuple of the available hashes
"""
if sys.version_info >= (3,2):
return hashlib.algorithms_available
elif sys.version_info >= (2,7) and sys.version_info < (3,0):
return hashlib.algorithms
else:
return 'md5', 'sha1', 'sha224', 'sha2... | [
"def",
"get_available_hashes",
"(",
")",
":",
"if",
"sys",
".",
"version_info",
">=",
"(",
"3",
",",
"2",
")",
":",
"return",
"hashlib",
".",
"algorithms_available",
"elif",
"sys",
".",
"version_info",
">=",
"(",
"2",
",",
"7",
")",
"and",
"sys",
".",
... | Returns a tuple of the available hashes | [
"Returns",
"a",
"tuple",
"of",
"the",
"available",
"hashes"
] | ea90b2903938e0733d3abfafed308a8d041d9fe7 | https://github.com/andrewjsledge/django-hash-filter/blob/ea90b2903938e0733d3abfafed308a8d041d9fe7/django_hash_filter/templatetags/__init__.py#L8-L17 |
250,923 | fedora-infra/fmn.lib | fmn/lib/defaults.py | create_defaults_for | def create_defaults_for(session, user, only_for=None, detail_values=None):
""" Create a sizable amount of defaults for a new user. """
detail_values = detail_values or {}
if not user.openid.endswith('.fedoraproject.org'):
log.warn("New user not from fedoraproject.org. No defaults set.")
r... | python | def create_defaults_for(session, user, only_for=None, detail_values=None):
""" Create a sizable amount of defaults for a new user. """
detail_values = detail_values or {}
if not user.openid.endswith('.fedoraproject.org'):
log.warn("New user not from fedoraproject.org. No defaults set.")
r... | [
"def",
"create_defaults_for",
"(",
"session",
",",
"user",
",",
"only_for",
"=",
"None",
",",
"detail_values",
"=",
"None",
")",
":",
"detail_values",
"=",
"detail_values",
"or",
"{",
"}",
"if",
"not",
"user",
".",
"openid",
".",
"endswith",
"(",
"'.fedora... | Create a sizable amount of defaults for a new user. | [
"Create",
"a",
"sizable",
"amount",
"of",
"defaults",
"for",
"a",
"new",
"user",
"."
] | 3120725556153d07c1809530f0fadcf250439110 | https://github.com/fedora-infra/fmn.lib/blob/3120725556153d07c1809530f0fadcf250439110/fmn/lib/defaults.py#L219-L317 |
250,924 | armstrong/armstrong.core.arm_sections | armstrong/core/arm_sections/models.py | SectionManager.get_queryset | def get_queryset(self): # DROP_WITH_DJANGO15
"""Use the same ordering as TreeManager"""
args = (self.model._mptt_meta.tree_id_attr,
self.model._mptt_meta.left_attr)
method = 'get_query_set' if django.VERSION < (1, 6) else 'get_queryset'
return getattr(super(SectionManag... | python | def get_queryset(self): # DROP_WITH_DJANGO15
"""Use the same ordering as TreeManager"""
args = (self.model._mptt_meta.tree_id_attr,
self.model._mptt_meta.left_attr)
method = 'get_query_set' if django.VERSION < (1, 6) else 'get_queryset'
return getattr(super(SectionManag... | [
"def",
"get_queryset",
"(",
"self",
")",
":",
"# DROP_WITH_DJANGO15",
"args",
"=",
"(",
"self",
".",
"model",
".",
"_mptt_meta",
".",
"tree_id_attr",
",",
"self",
".",
"model",
".",
"_mptt_meta",
".",
"left_attr",
")",
"method",
"=",
"'get_query_set'",
"if",... | Use the same ordering as TreeManager | [
"Use",
"the",
"same",
"ordering",
"as",
"TreeManager"
] | 39c999c93771da909359e53b35afefe4846f77cb | https://github.com/armstrong/armstrong.core.arm_sections/blob/39c999c93771da909359e53b35afefe4846f77cb/armstrong/core/arm_sections/models.py#L23-L29 |
250,925 | armstrong/armstrong.core.arm_sections | armstrong/core/arm_sections/models.py | BaseSection.item_related_name | def item_related_name(self):
"""
The ManyToMany field on the item class pointing to this class.
If there is more than one field, this value will be None.
"""
if not hasattr(self, '_item_related_name'):
many_to_many_rels = \
get_section_many_to_many_re... | python | def item_related_name(self):
"""
The ManyToMany field on the item class pointing to this class.
If there is more than one field, this value will be None.
"""
if not hasattr(self, '_item_related_name'):
many_to_many_rels = \
get_section_many_to_many_re... | [
"def",
"item_related_name",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_item_related_name'",
")",
":",
"many_to_many_rels",
"=",
"get_section_many_to_many_relations",
"(",
"self",
".",
"__class__",
")",
"if",
"len",
"(",
"many_to_many_rels"... | The ManyToMany field on the item class pointing to this class.
If there is more than one field, this value will be None. | [
"The",
"ManyToMany",
"field",
"on",
"the",
"item",
"class",
"pointing",
"to",
"this",
"class",
"."
] | 39c999c93771da909359e53b35afefe4846f77cb | https://github.com/armstrong/armstrong.core.arm_sections/blob/39c999c93771da909359e53b35afefe4846f77cb/armstrong/core/arm_sections/models.py#L92-L105 |
250,926 | armstrong/armstrong.core.arm_sections | armstrong/core/arm_sections/models.py | BaseSection.add_item | def add_item(self, item, field_name=None):
"""
Add the item to the specified section.
Intended for use with items of settings.ARMSTRONG_SECTION_ITEM_MODEL.
Behavior on other items is undefined.
"""
field_name = self._choose_field_name(field_name)
related_manager ... | python | def add_item(self, item, field_name=None):
"""
Add the item to the specified section.
Intended for use with items of settings.ARMSTRONG_SECTION_ITEM_MODEL.
Behavior on other items is undefined.
"""
field_name = self._choose_field_name(field_name)
related_manager ... | [
"def",
"add_item",
"(",
"self",
",",
"item",
",",
"field_name",
"=",
"None",
")",
":",
"field_name",
"=",
"self",
".",
"_choose_field_name",
"(",
"field_name",
")",
"related_manager",
"=",
"getattr",
"(",
"item",
",",
"field_name",
")",
"related_manager",
".... | Add the item to the specified section.
Intended for use with items of settings.ARMSTRONG_SECTION_ITEM_MODEL.
Behavior on other items is undefined. | [
"Add",
"the",
"item",
"to",
"the",
"specified",
"section",
"."
] | 39c999c93771da909359e53b35afefe4846f77cb | https://github.com/armstrong/armstrong.core.arm_sections/blob/39c999c93771da909359e53b35afefe4846f77cb/armstrong/core/arm_sections/models.py#L131-L140 |
250,927 | armstrong/armstrong.core.arm_sections | armstrong/core/arm_sections/models.py | BaseSection.remove_item | def remove_item(self, item, field_name=None):
"""
Remove the item from the specified section.
Intended for use with items of settings.ARMSTRONG_SECTION_ITEM_MODEL.
Behavior on other items is undefined.
"""
field_name = self._choose_field_name(field_name)
related_... | python | def remove_item(self, item, field_name=None):
"""
Remove the item from the specified section.
Intended for use with items of settings.ARMSTRONG_SECTION_ITEM_MODEL.
Behavior on other items is undefined.
"""
field_name = self._choose_field_name(field_name)
related_... | [
"def",
"remove_item",
"(",
"self",
",",
"item",
",",
"field_name",
"=",
"None",
")",
":",
"field_name",
"=",
"self",
".",
"_choose_field_name",
"(",
"field_name",
")",
"related_manager",
"=",
"getattr",
"(",
"item",
",",
"field_name",
")",
"related_manager",
... | Remove the item from the specified section.
Intended for use with items of settings.ARMSTRONG_SECTION_ITEM_MODEL.
Behavior on other items is undefined. | [
"Remove",
"the",
"item",
"from",
"the",
"specified",
"section",
"."
] | 39c999c93771da909359e53b35afefe4846f77cb | https://github.com/armstrong/armstrong.core.arm_sections/blob/39c999c93771da909359e53b35afefe4846f77cb/armstrong/core/arm_sections/models.py#L142-L151 |
250,928 | armstrong/armstrong.core.arm_sections | armstrong/core/arm_sections/models.py | BaseSection.toggle_item | def toggle_item(self, item, test_func, field_name=None):
"""
Toggles the section based on test_func.
test_func takes an item and returns a boolean. If it returns True, the
item will be added to the given section. It will be removed from the
section otherwise.
Intended f... | python | def toggle_item(self, item, test_func, field_name=None):
"""
Toggles the section based on test_func.
test_func takes an item and returns a boolean. If it returns True, the
item will be added to the given section. It will be removed from the
section otherwise.
Intended f... | [
"def",
"toggle_item",
"(",
"self",
",",
"item",
",",
"test_func",
",",
"field_name",
"=",
"None",
")",
":",
"if",
"test_func",
"(",
"item",
")",
":",
"self",
".",
"add_item",
"(",
"item",
",",
"field_name",
")",
"return",
"True",
"else",
":",
"self",
... | Toggles the section based on test_func.
test_func takes an item and returns a boolean. If it returns True, the
item will be added to the given section. It will be removed from the
section otherwise.
Intended for use with items of settings.ARMSTRONG_SECTION_ITEM_MODEL.
Behavior ... | [
"Toggles",
"the",
"section",
"based",
"on",
"test_func",
"."
] | 39c999c93771da909359e53b35afefe4846f77cb | https://github.com/armstrong/armstrong.core.arm_sections/blob/39c999c93771da909359e53b35afefe4846f77cb/armstrong/core/arm_sections/models.py#L153-L169 |
250,929 | samirelanduk/quickplots | quickplots/charts.py | determine_ticks | def determine_ticks(low, high):
"""The function used to auto-generate ticks for an axis, based on its
range of values.
:param Number low: The lower bound of the axis.
:param Number high: The upper bound of the axis.
:rtype: ``tuple``"""
range_ = high - low
tick_difference = 10 ** math.... | python | def determine_ticks(low, high):
"""The function used to auto-generate ticks for an axis, based on its
range of values.
:param Number low: The lower bound of the axis.
:param Number high: The upper bound of the axis.
:rtype: ``tuple``"""
range_ = high - low
tick_difference = 10 ** math.... | [
"def",
"determine_ticks",
"(",
"low",
",",
"high",
")",
":",
"range_",
"=",
"high",
"-",
"low",
"tick_difference",
"=",
"10",
"**",
"math",
".",
"floor",
"(",
"math",
".",
"log10",
"(",
"range_",
"/",
"1.25",
")",
")",
"low_tick",
"=",
"math",
".",
... | The function used to auto-generate ticks for an axis, based on its
range of values.
:param Number low: The lower bound of the axis.
:param Number high: The upper bound of the axis.
:rtype: ``tuple`` | [
"The",
"function",
"used",
"to",
"auto",
"-",
"generate",
"ticks",
"for",
"an",
"axis",
"based",
"on",
"its",
"range",
"of",
"values",
"."
] | 59f5e6ff367b2c1c24ba7cf1805d03552034c6d8 | https://github.com/samirelanduk/quickplots/blob/59f5e6ff367b2c1c24ba7cf1805d03552034c6d8/quickplots/charts.py#L694-L708 |
250,930 | samirelanduk/quickplots | quickplots/charts.py | AxisChart.x_ticks | def x_ticks(self, *ticks):
"""The points on the x-axis for which there are markers and grid lines.
There are default ticks, but you can pass values to this method to
override the defaults. Otherwise the method will return the ticks.
:param \*ticks: if given, these will be chart's x-tic... | python | def x_ticks(self, *ticks):
"""The points on the x-axis for which there are markers and grid lines.
There are default ticks, but you can pass values to this method to
override the defaults. Otherwise the method will return the ticks.
:param \*ticks: if given, these will be chart's x-tic... | [
"def",
"x_ticks",
"(",
"self",
",",
"*",
"ticks",
")",
":",
"if",
"ticks",
":",
"for",
"tick",
"in",
"ticks",
":",
"if",
"not",
"is_numeric",
"(",
"tick",
")",
":",
"raise",
"TypeError",
"(",
"\"'%s' is not a numeric tick\"",
"%",
"str",
"(",
"tick",
"... | The points on the x-axis for which there are markers and grid lines.
There are default ticks, but you can pass values to this method to
override the defaults. Otherwise the method will return the ticks.
:param \*ticks: if given, these will be chart's x-ticks.
:rtype: ``tuple`` | [
"The",
"points",
"on",
"the",
"x",
"-",
"axis",
"for",
"which",
"there",
"are",
"markers",
"and",
"grid",
"lines",
"."
] | 59f5e6ff367b2c1c24ba7cf1805d03552034c6d8 | https://github.com/samirelanduk/quickplots/blob/59f5e6ff367b2c1c24ba7cf1805d03552034c6d8/quickplots/charts.py#L495-L513 |
250,931 | samirelanduk/quickplots | quickplots/charts.py | AxisChart.y_ticks | def y_ticks(self, *ticks):
"""The points on the y-axis for which there are markers and grid lines.
There are default ticks, but you can pass values to this method to
override the defaults. Otherwise the method will return the ticks.
:param \*ticks: if given, these will be chart's x-tic... | python | def y_ticks(self, *ticks):
"""The points on the y-axis for which there are markers and grid lines.
There are default ticks, but you can pass values to this method to
override the defaults. Otherwise the method will return the ticks.
:param \*ticks: if given, these will be chart's x-tic... | [
"def",
"y_ticks",
"(",
"self",
",",
"*",
"ticks",
")",
":",
"if",
"ticks",
":",
"for",
"tick",
"in",
"ticks",
":",
"if",
"not",
"is_numeric",
"(",
"tick",
")",
":",
"raise",
"TypeError",
"(",
"\"'%s' is not a numeric tick\"",
"%",
"str",
"(",
"tick",
"... | The points on the y-axis for which there are markers and grid lines.
There are default ticks, but you can pass values to this method to
override the defaults. Otherwise the method will return the ticks.
:param \*ticks: if given, these will be chart's x-ticks.
:rtype: ``tuple`` | [
"The",
"points",
"on",
"the",
"y",
"-",
"axis",
"for",
"which",
"there",
"are",
"markers",
"and",
"grid",
"lines",
"."
] | 59f5e6ff367b2c1c24ba7cf1805d03552034c6d8 | https://github.com/samirelanduk/quickplots/blob/59f5e6ff367b2c1c24ba7cf1805d03552034c6d8/quickplots/charts.py#L516-L534 |
250,932 | samirelanduk/quickplots | quickplots/charts.py | AxisChart.x_grid | def x_grid(self, grid=None):
"""The horizontal lines that run accross the chart from the x-ticks.
If a boolean value is given, these gridlines will be turned on or off.
Otherwise, the method will return their current state.
:param bool grid: Turns the gridlines on or off.
:rtyp... | python | def x_grid(self, grid=None):
"""The horizontal lines that run accross the chart from the x-ticks.
If a boolean value is given, these gridlines will be turned on or off.
Otherwise, the method will return their current state.
:param bool grid: Turns the gridlines on or off.
:rtyp... | [
"def",
"x_grid",
"(",
"self",
",",
"grid",
"=",
"None",
")",
":",
"if",
"grid",
"is",
"None",
":",
"return",
"self",
".",
"_x_grid",
"else",
":",
"if",
"not",
"isinstance",
"(",
"grid",
",",
"bool",
")",
":",
"raise",
"TypeError",
"(",
"\"grid must b... | The horizontal lines that run accross the chart from the x-ticks.
If a boolean value is given, these gridlines will be turned on or off.
Otherwise, the method will return their current state.
:param bool grid: Turns the gridlines on or off.
:rtype: ``bool`` | [
"The",
"horizontal",
"lines",
"that",
"run",
"accross",
"the",
"chart",
"from",
"the",
"x",
"-",
"ticks",
"."
] | 59f5e6ff367b2c1c24ba7cf1805d03552034c6d8 | https://github.com/samirelanduk/quickplots/blob/59f5e6ff367b2c1c24ba7cf1805d03552034c6d8/quickplots/charts.py#L537-L551 |
250,933 | samirelanduk/quickplots | quickplots/charts.py | AxisChart.y_grid | def y_grid(self, grid=None):
"""The vertical lines that run accross the chart from the y-ticks.
If a boolean value is given, these gridlines will be turned on or off.
Otherwise, the method will return their current state.
:param bool grid: Turns the gridlines on or off.
:rtype:... | python | def y_grid(self, grid=None):
"""The vertical lines that run accross the chart from the y-ticks.
If a boolean value is given, these gridlines will be turned on or off.
Otherwise, the method will return their current state.
:param bool grid: Turns the gridlines on or off.
:rtype:... | [
"def",
"y_grid",
"(",
"self",
",",
"grid",
"=",
"None",
")",
":",
"if",
"grid",
"is",
"None",
":",
"return",
"self",
".",
"_y_grid",
"else",
":",
"if",
"not",
"isinstance",
"(",
"grid",
",",
"bool",
")",
":",
"raise",
"TypeError",
"(",
"\"grid must b... | The vertical lines that run accross the chart from the y-ticks.
If a boolean value is given, these gridlines will be turned on or off.
Otherwise, the method will return their current state.
:param bool grid: Turns the gridlines on or off.
:rtype: ``bool`` | [
"The",
"vertical",
"lines",
"that",
"run",
"accross",
"the",
"chart",
"from",
"the",
"y",
"-",
"ticks",
"."
] | 59f5e6ff367b2c1c24ba7cf1805d03552034c6d8 | https://github.com/samirelanduk/quickplots/blob/59f5e6ff367b2c1c24ba7cf1805d03552034c6d8/quickplots/charts.py#L554-L568 |
250,934 | samirelanduk/quickplots | quickplots/charts.py | AxisChart.grid | def grid(self, grid):
"""Turns all gridlines on or off
:param bool grid: turns the gridlines on if ``True``, off if ``False``"""
if not isinstance(grid, bool):
raise TypeError("grid must be boolean, not '%s'" % grid)
self._x_grid = self._y_grid = grid | python | def grid(self, grid):
"""Turns all gridlines on or off
:param bool grid: turns the gridlines on if ``True``, off if ``False``"""
if not isinstance(grid, bool):
raise TypeError("grid must be boolean, not '%s'" % grid)
self._x_grid = self._y_grid = grid | [
"def",
"grid",
"(",
"self",
",",
"grid",
")",
":",
"if",
"not",
"isinstance",
"(",
"grid",
",",
"bool",
")",
":",
"raise",
"TypeError",
"(",
"\"grid must be boolean, not '%s'\"",
"%",
"grid",
")",
"self",
".",
"_x_grid",
"=",
"self",
".",
"_y_grid",
"=",... | Turns all gridlines on or off
:param bool grid: turns the gridlines on if ``True``, off if ``False`` | [
"Turns",
"all",
"gridlines",
"on",
"or",
"off"
] | 59f5e6ff367b2c1c24ba7cf1805d03552034c6d8 | https://github.com/samirelanduk/quickplots/blob/59f5e6ff367b2c1c24ba7cf1805d03552034c6d8/quickplots/charts.py#L571-L578 |
250,935 | geertj/looping | lib/looping/events.py | DefaultEventLoopPolicy.get_event_loop | def get_event_loop(self):
"""Get the event loop.
This may be None or an instance of EventLoop.
"""
if (self._event_loop is None and
threading.current_thread().name == 'MainThread'):
self._event_loop = self.new_event_loop()
return self._event_loop | python | def get_event_loop(self):
"""Get the event loop.
This may be None or an instance of EventLoop.
"""
if (self._event_loop is None and
threading.current_thread().name == 'MainThread'):
self._event_loop = self.new_event_loop()
return self._event_loop | [
"def",
"get_event_loop",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"_event_loop",
"is",
"None",
"and",
"threading",
".",
"current_thread",
"(",
")",
".",
"name",
"==",
"'MainThread'",
")",
":",
"self",
".",
"_event_loop",
"=",
"self",
".",
"new_even... | Get the event loop.
This may be None or an instance of EventLoop. | [
"Get",
"the",
"event",
"loop",
"."
] | b60303714685aede18b37c0d80f8f55175ad7a65 | https://github.com/geertj/looping/blob/b60303714685aede18b37c0d80f8f55175ad7a65/lib/looping/events.py#L276-L284 |
250,936 | geertj/looping | lib/looping/events.py | DefaultEventLoopPolicy.set_event_loop | def set_event_loop(self, event_loop):
"""Set the event loop."""
assert event_loop is None or isinstance(event_loop, AbstractEventLoop)
self._event_loop = event_loop | python | def set_event_loop(self, event_loop):
"""Set the event loop."""
assert event_loop is None or isinstance(event_loop, AbstractEventLoop)
self._event_loop = event_loop | [
"def",
"set_event_loop",
"(",
"self",
",",
"event_loop",
")",
":",
"assert",
"event_loop",
"is",
"None",
"or",
"isinstance",
"(",
"event_loop",
",",
"AbstractEventLoop",
")",
"self",
".",
"_event_loop",
"=",
"event_loop"
] | Set the event loop. | [
"Set",
"the",
"event",
"loop",
"."
] | b60303714685aede18b37c0d80f8f55175ad7a65 | https://github.com/geertj/looping/blob/b60303714685aede18b37c0d80f8f55175ad7a65/lib/looping/events.py#L286-L289 |
250,937 | PyTables/datasette-connectors | datasette_connectors/monkey.py | patch_datasette | def patch_datasette():
"""
Monkey patching for original Datasette
"""
def inspect(self):
" Inspect the database and return a dictionary of table metadata "
if self._inspect:
return self._inspect
_inspect = {}
files = self.files
for filename in files... | python | def patch_datasette():
"""
Monkey patching for original Datasette
"""
def inspect(self):
" Inspect the database and return a dictionary of table metadata "
if self._inspect:
return self._inspect
_inspect = {}
files = self.files
for filename in files... | [
"def",
"patch_datasette",
"(",
")",
":",
"def",
"inspect",
"(",
"self",
")",
":",
"\" Inspect the database and return a dictionary of table metadata \"",
"if",
"self",
".",
"_inspect",
":",
"return",
"self",
".",
"_inspect",
"_inspect",
"=",
"{",
"}",
"files",
"="... | Monkey patching for original Datasette | [
"Monkey",
"patching",
"for",
"original",
"Datasette"
] | b0802bdb9d86cd65524d6ffa7afb66488d167b1e | https://github.com/PyTables/datasette-connectors/blob/b0802bdb9d86cd65524d6ffa7afb66488d167b1e/datasette_connectors/monkey.py#L12-L87 |
250,938 | fedora-infra/fmn.rules | fmn/rules/utils.py | get_fas | def get_fas(config):
""" Return a fedora.client.fas2.AccountSystem object if the provided
configuration contains a FAS username and password.
"""
global _FAS
if _FAS is not None:
return _FAS
# In some development environments, having fas_credentials around is a
# pain.. so, let thin... | python | def get_fas(config):
""" Return a fedora.client.fas2.AccountSystem object if the provided
configuration contains a FAS username and password.
"""
global _FAS
if _FAS is not None:
return _FAS
# In some development environments, having fas_credentials around is a
# pain.. so, let thin... | [
"def",
"get_fas",
"(",
"config",
")",
":",
"global",
"_FAS",
"if",
"_FAS",
"is",
"not",
"None",
":",
"return",
"_FAS",
"# In some development environments, having fas_credentials around is a",
"# pain.. so, let things proceed here, but emit a warning.",
"try",
":",
"creds",
... | Return a fedora.client.fas2.AccountSystem object if the provided
configuration contains a FAS username and password. | [
"Return",
"a",
"fedora",
".",
"client",
".",
"fas2",
".",
"AccountSystem",
"object",
"if",
"the",
"provided",
"configuration",
"contains",
"a",
"FAS",
"username",
"and",
"password",
"."
] | f9ec790619fcc8b41803077c4dec094e5127fc24 | https://github.com/fedora-infra/fmn.rules/blob/f9ec790619fcc8b41803077c4dec094e5127fc24/fmn/rules/utils.py#L40-L66 |
250,939 | fedora-infra/fmn.rules | fmn/rules/utils.py | get_packagers_of_package | def get_packagers_of_package(config, package):
""" Retrieve the list of users who have commit on a package.
:arg config: a dict containing the fedmsg config
:arg package: the package you are interested in.
:return: a set listing all the fas usernames that have some ACL on package.
"""
if not _... | python | def get_packagers_of_package(config, package):
""" Retrieve the list of users who have commit on a package.
:arg config: a dict containing the fedmsg config
:arg package: the package you are interested in.
:return: a set listing all the fas usernames that have some ACL on package.
"""
if not _... | [
"def",
"get_packagers_of_package",
"(",
"config",
",",
"package",
")",
":",
"if",
"not",
"_cache",
".",
"is_configured",
":",
"_cache",
".",
"configure",
"(",
"*",
"*",
"config",
"[",
"'fmn.rules.cache'",
"]",
")",
"key",
"=",
"cache_key_generator",
"(",
"ge... | Retrieve the list of users who have commit on a package.
:arg config: a dict containing the fedmsg config
:arg package: the package you are interested in.
:return: a set listing all the fas usernames that have some ACL on package. | [
"Retrieve",
"the",
"list",
"of",
"users",
"who",
"have",
"commit",
"on",
"a",
"package",
"."
] | f9ec790619fcc8b41803077c4dec094e5127fc24 | https://github.com/fedora-infra/fmn.rules/blob/f9ec790619fcc8b41803077c4dec094e5127fc24/fmn/rules/utils.py#L69-L82 |
250,940 | fedora-infra/fmn.rules | fmn/rules/utils.py | get_packages_of_user | def get_packages_of_user(config, username, flags):
""" Retrieve the list of packages where the specified user some acl.
:arg config: a dict containing the fedmsg config
:arg username: the fas username of the packager whose packages are of
interest.
:return: a set listing all the packages where ... | python | def get_packages_of_user(config, username, flags):
""" Retrieve the list of packages where the specified user some acl.
:arg config: a dict containing the fedmsg config
:arg username: the fas username of the packager whose packages are of
interest.
:return: a set listing all the packages where ... | [
"def",
"get_packages_of_user",
"(",
"config",
",",
"username",
",",
"flags",
")",
":",
"if",
"not",
"_cache",
".",
"is_configured",
":",
"_cache",
".",
"configure",
"(",
"*",
"*",
"config",
"[",
"'fmn.rules.cache'",
"]",
")",
"packages",
"=",
"[",
"]",
"... | Retrieve the list of packages where the specified user some acl.
:arg config: a dict containing the fedmsg config
:arg username: the fas username of the packager whose packages are of
interest.
:return: a set listing all the packages where the specified user has
some ACL. | [
"Retrieve",
"the",
"list",
"of",
"packages",
"where",
"the",
"specified",
"user",
"some",
"acl",
"."
] | f9ec790619fcc8b41803077c4dec094e5127fc24 | https://github.com/fedora-infra/fmn.rules/blob/f9ec790619fcc8b41803077c4dec094e5127fc24/fmn/rules/utils.py#L123-L148 |
250,941 | fedora-infra/fmn.rules | fmn/rules/utils.py | get_user_of_group | def get_user_of_group(config, fas, groupname):
''' Return the list of users in the specified group.
:arg config: a dict containing the fedmsg config
:arg fas: a fedora.client.fas2.AccountSystem object instanciated and loged
into FAS.
:arg groupname: the name of the group for which we want to re... | python | def get_user_of_group(config, fas, groupname):
''' Return the list of users in the specified group.
:arg config: a dict containing the fedmsg config
:arg fas: a fedora.client.fas2.AccountSystem object instanciated and loged
into FAS.
:arg groupname: the name of the group for which we want to re... | [
"def",
"get_user_of_group",
"(",
"config",
",",
"fas",
",",
"groupname",
")",
":",
"if",
"not",
"_cache",
".",
"is_configured",
":",
"_cache",
".",
"configure",
"(",
"*",
"*",
"config",
"[",
"'fmn.rules.cache'",
"]",
")",
"key",
"=",
"cache_key_generator",
... | Return the list of users in the specified group.
:arg config: a dict containing the fedmsg config
:arg fas: a fedora.client.fas2.AccountSystem object instanciated and loged
into FAS.
:arg groupname: the name of the group for which we want to retrieve the
members.
:return: a list of FAS ... | [
"Return",
"the",
"list",
"of",
"users",
"in",
"the",
"specified",
"group",
"."
] | f9ec790619fcc8b41803077c4dec094e5127fc24 | https://github.com/fedora-infra/fmn.rules/blob/f9ec790619fcc8b41803077c4dec094e5127fc24/fmn/rules/utils.py#L186-L205 |
250,942 | MakerReduxCorp/MARDS | MARDS/mards_library.py | delist | def delist(target):
''' for any "list" found, replace with a single entry if the list has exactly one entry '''
result = target
if type(target) is dict:
for key in target:
target[key] = delist(target[key])
if type(target) is list:
if len(target)==0:
result = None
... | python | def delist(target):
''' for any "list" found, replace with a single entry if the list has exactly one entry '''
result = target
if type(target) is dict:
for key in target:
target[key] = delist(target[key])
if type(target) is list:
if len(target)==0:
result = None
... | [
"def",
"delist",
"(",
"target",
")",
":",
"result",
"=",
"target",
"if",
"type",
"(",
"target",
")",
"is",
"dict",
":",
"for",
"key",
"in",
"target",
":",
"target",
"[",
"key",
"]",
"=",
"delist",
"(",
"target",
"[",
"key",
"]",
")",
"if",
"type"... | for any "list" found, replace with a single entry if the list has exactly one entry | [
"for",
"any",
"list",
"found",
"replace",
"with",
"a",
"single",
"entry",
"if",
"the",
"list",
"has",
"exactly",
"one",
"entry"
] | f8ddecc70f2ce1703984cb403c9d5417895170d6 | https://github.com/MakerReduxCorp/MARDS/blob/f8ddecc70f2ce1703984cb403c9d5417895170d6/MARDS/mards_library.py#L189-L202 |
250,943 | MakerReduxCorp/MARDS | MARDS/mards_library.py | check_schema_coverage | def check_schema_coverage(doc, schema):
'''
FORWARD CHECK OF DOCUMENT
This routine looks at each element in the doc, and makes sure there
is a matching 'name' in the schema at that level.
'''
error_list = []
to_delete = []
for entry in doc.list_tuples():
(name, value, index,... | python | def check_schema_coverage(doc, schema):
'''
FORWARD CHECK OF DOCUMENT
This routine looks at each element in the doc, and makes sure there
is a matching 'name' in the schema at that level.
'''
error_list = []
to_delete = []
for entry in doc.list_tuples():
(name, value, index,... | [
"def",
"check_schema_coverage",
"(",
"doc",
",",
"schema",
")",
":",
"error_list",
"=",
"[",
"]",
"to_delete",
"=",
"[",
"]",
"for",
"entry",
"in",
"doc",
".",
"list_tuples",
"(",
")",
":",
"(",
"name",
",",
"value",
",",
"index",
",",
"seq",
")",
... | FORWARD CHECK OF DOCUMENT
This routine looks at each element in the doc, and makes sure there
is a matching 'name' in the schema at that level. | [
"FORWARD",
"CHECK",
"OF",
"DOCUMENT",
"This",
"routine",
"looks",
"at",
"each",
"element",
"in",
"the",
"doc",
"and",
"makes",
"sure",
"there",
"is",
"a",
"matching",
"name",
"in",
"the",
"schema",
"at",
"that",
"level",
"."
] | f8ddecc70f2ce1703984cb403c9d5417895170d6 | https://github.com/MakerReduxCorp/MARDS/blob/f8ddecc70f2ce1703984cb403c9d5417895170d6/MARDS/mards_library.py#L622-L643 |
250,944 | MakerReduxCorp/MARDS | MARDS/mards_library.py | sub_schema_raises | def sub_schema_raises(doc, schema):
'''
Look for "raise_error", "raise_warning", and "raise_log"
'''
error_list = []
temp_schema = schema_match_up(doc, schema)
for msg in temp_schema.list_values("raise_error"):
error_list.append( ("[error]", "doc", doc.seq, "'{}'".format(msg)) )
... | python | def sub_schema_raises(doc, schema):
'''
Look for "raise_error", "raise_warning", and "raise_log"
'''
error_list = []
temp_schema = schema_match_up(doc, schema)
for msg in temp_schema.list_values("raise_error"):
error_list.append( ("[error]", "doc", doc.seq, "'{}'".format(msg)) )
... | [
"def",
"sub_schema_raises",
"(",
"doc",
",",
"schema",
")",
":",
"error_list",
"=",
"[",
"]",
"temp_schema",
"=",
"schema_match_up",
"(",
"doc",
",",
"schema",
")",
"for",
"msg",
"in",
"temp_schema",
".",
"list_values",
"(",
"\"raise_error\"",
")",
":",
"e... | Look for "raise_error", "raise_warning", and "raise_log" | [
"Look",
"for",
"raise_error",
"raise_warning",
"and",
"raise_log"
] | f8ddecc70f2ce1703984cb403c9d5417895170d6 | https://github.com/MakerReduxCorp/MARDS/blob/f8ddecc70f2ce1703984cb403c9d5417895170d6/MARDS/mards_library.py#L777-L794 |
250,945 | etscrivner/nose-perfdump | perfdump/models.py | BaseTimeModel.is_valid_row | def is_valid_row(cls, row):
"""Indicates whether or not the given row contains valid data."""
for k in row.keys():
if row[k] is None:
return False
return True | python | def is_valid_row(cls, row):
"""Indicates whether or not the given row contains valid data."""
for k in row.keys():
if row[k] is None:
return False
return True | [
"def",
"is_valid_row",
"(",
"cls",
",",
"row",
")",
":",
"for",
"k",
"in",
"row",
".",
"keys",
"(",
")",
":",
"if",
"row",
"[",
"k",
"]",
"is",
"None",
":",
"return",
"False",
"return",
"True"
] | Indicates whether or not the given row contains valid data. | [
"Indicates",
"whether",
"or",
"not",
"the",
"given",
"row",
"contains",
"valid",
"data",
"."
] | a203a68495d30346fab43fb903cb60cd29b17d49 | https://github.com/etscrivner/nose-perfdump/blob/a203a68495d30346fab43fb903cb60cd29b17d49/perfdump/models.py#L151-L156 |
250,946 | etscrivner/nose-perfdump | perfdump/models.py | BaseTimeModel.get_cursor | def get_cursor(cls):
"""Return a message list cursor that returns sqlite3.Row objects"""
db = SqliteConnection.get()
db.row_factory = sqlite3.Row
return db.cursor() | python | def get_cursor(cls):
"""Return a message list cursor that returns sqlite3.Row objects"""
db = SqliteConnection.get()
db.row_factory = sqlite3.Row
return db.cursor() | [
"def",
"get_cursor",
"(",
"cls",
")",
":",
"db",
"=",
"SqliteConnection",
".",
"get",
"(",
")",
"db",
".",
"row_factory",
"=",
"sqlite3",
".",
"Row",
"return",
"db",
".",
"cursor",
"(",
")"
] | Return a message list cursor that returns sqlite3.Row objects | [
"Return",
"a",
"message",
"list",
"cursor",
"that",
"returns",
"sqlite3",
".",
"Row",
"objects"
] | a203a68495d30346fab43fb903cb60cd29b17d49 | https://github.com/etscrivner/nose-perfdump/blob/a203a68495d30346fab43fb903cb60cd29b17d49/perfdump/models.py#L159-L163 |
250,947 | qbicsoftware/mtb-parser-lib | mtbparser/snv_parser.py | SnvParser._parse_header | def _parse_header(self, header_string):
"""
Parses the header and determines the column type
and its column index.
"""
header_content = header_string.strip().split('\t')
if len(header_content) != self._snv_enum.HEADER_LEN.value:
raise MTBParserException(
... | python | def _parse_header(self, header_string):
"""
Parses the header and determines the column type
and its column index.
"""
header_content = header_string.strip().split('\t')
if len(header_content) != self._snv_enum.HEADER_LEN.value:
raise MTBParserException(
... | [
"def",
"_parse_header",
"(",
"self",
",",
"header_string",
")",
":",
"header_content",
"=",
"header_string",
".",
"strip",
"(",
")",
".",
"split",
"(",
"'\\t'",
")",
"if",
"len",
"(",
"header_content",
")",
"!=",
"self",
".",
"_snv_enum",
".",
"HEADER_LEN"... | Parses the header and determines the column type
and its column index. | [
"Parses",
"the",
"header",
"and",
"determines",
"the",
"column",
"type",
"and",
"its",
"column",
"index",
"."
] | e8b96e34b27e457ea7def2927fe44017fa173ba7 | https://github.com/qbicsoftware/mtb-parser-lib/blob/e8b96e34b27e457ea7def2927fe44017fa173ba7/mtbparser/snv_parser.py#L26-L48 |
250,948 | qbicsoftware/mtb-parser-lib | mtbparser/snv_parser.py | SnvParser._parse_content | def _parse_content(self, snv_entries):
"""
Parses SNV entries to SNVItems, objects
representing the content for every entry, that
can be used for further processing.
"""
if len(snv_entries) == 1:
return
for line in snv_entries[1:]:
info_dic... | python | def _parse_content(self, snv_entries):
"""
Parses SNV entries to SNVItems, objects
representing the content for every entry, that
can be used for further processing.
"""
if len(snv_entries) == 1:
return
for line in snv_entries[1:]:
info_dic... | [
"def",
"_parse_content",
"(",
"self",
",",
"snv_entries",
")",
":",
"if",
"len",
"(",
"snv_entries",
")",
"==",
"1",
":",
"return",
"for",
"line",
"in",
"snv_entries",
"[",
"1",
":",
"]",
":",
"info_dict",
"=",
"self",
".",
"_map_info_to_col",
"(",
"li... | Parses SNV entries to SNVItems, objects
representing the content for every entry, that
can be used for further processing. | [
"Parses",
"SNV",
"entries",
"to",
"SNVItems",
"objects",
"representing",
"the",
"content",
"for",
"every",
"entry",
"that",
"can",
"be",
"used",
"for",
"further",
"processing",
"."
] | e8b96e34b27e457ea7def2927fe44017fa173ba7 | https://github.com/qbicsoftware/mtb-parser-lib/blob/e8b96e34b27e457ea7def2927fe44017fa173ba7/mtbparser/snv_parser.py#L50-L60 |
250,949 | alexhayes/django-toolkit | django_toolkit/templatetags/actions.py | actions | def actions(obj, **kwargs):
"""
Return actions available for an object
"""
if 'exclude' in kwargs:
kwargs['exclude'] = kwargs['exclude'].split(',')
actions = obj.get_actions(**kwargs)
if isinstance(actions, dict):
actions = actions.values()
buttons = "".join("%s" % action.ren... | python | def actions(obj, **kwargs):
"""
Return actions available for an object
"""
if 'exclude' in kwargs:
kwargs['exclude'] = kwargs['exclude'].split(',')
actions = obj.get_actions(**kwargs)
if isinstance(actions, dict):
actions = actions.values()
buttons = "".join("%s" % action.ren... | [
"def",
"actions",
"(",
"obj",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"'exclude'",
"in",
"kwargs",
":",
"kwargs",
"[",
"'exclude'",
"]",
"=",
"kwargs",
"[",
"'exclude'",
"]",
".",
"split",
"(",
"','",
")",
"actions",
"=",
"obj",
".",
"get_actions",
... | Return actions available for an object | [
"Return",
"actions",
"available",
"for",
"an",
"object"
] | b64106392fad596defc915b8235fe6e1d0013b5b | https://github.com/alexhayes/django-toolkit/blob/b64106392fad596defc915b8235fe6e1d0013b5b/django_toolkit/templatetags/actions.py#L8-L18 |
250,950 | heikomuller/sco-engine | scoengine/__init__.py | SCOEngine.list_models | def list_models(self, limit=-1, offset=-1):
"""Get a list of models in the registry.
Parameters
----------
limit : int
Limit number of items in the result set
offset : int
Set offset in list (order as defined by object store)
Returns
-------
li... | python | def list_models(self, limit=-1, offset=-1):
"""Get a list of models in the registry.
Parameters
----------
limit : int
Limit number of items in the result set
offset : int
Set offset in list (order as defined by object store)
Returns
-------
li... | [
"def",
"list_models",
"(",
"self",
",",
"limit",
"=",
"-",
"1",
",",
"offset",
"=",
"-",
"1",
")",
":",
"return",
"self",
".",
"registry",
".",
"list_models",
"(",
"limit",
"=",
"limit",
",",
"offset",
"=",
"offset",
")"
] | Get a list of models in the registry.
Parameters
----------
limit : int
Limit number of items in the result set
offset : int
Set offset in list (order as defined by object store)
Returns
-------
list(ModelHandle) | [
"Get",
"a",
"list",
"of",
"models",
"in",
"the",
"registry",
"."
] | 3e7782d059ec808d930f0992794b6f5a8fd73c2c | https://github.com/heikomuller/sco-engine/blob/3e7782d059ec808d930f0992794b6f5a8fd73c2c/scoengine/__init__.py#L94-L108 |
250,951 | heikomuller/sco-engine | scoengine/__init__.py | SCOEngine.register_model | def register_model(self, model_id, properties, parameters, outputs, connector):
"""Register a new model with the engine. Expects connection information
for RabbitMQ to submit model run requests to workers.
Raises ValueError if the given model identifier is not unique.
Parameters
... | python | def register_model(self, model_id, properties, parameters, outputs, connector):
"""Register a new model with the engine. Expects connection information
for RabbitMQ to submit model run requests to workers.
Raises ValueError if the given model identifier is not unique.
Parameters
... | [
"def",
"register_model",
"(",
"self",
",",
"model_id",
",",
"properties",
",",
"parameters",
",",
"outputs",
",",
"connector",
")",
":",
"# Validate the given connector information",
"self",
".",
"validate_connector",
"(",
"connector",
")",
"# Connector information is v... | Register a new model with the engine. Expects connection information
for RabbitMQ to submit model run requests to workers.
Raises ValueError if the given model identifier is not unique.
Parameters
----------
model_id : string
Unique model identifier
properti... | [
"Register",
"a",
"new",
"model",
"with",
"the",
"engine",
".",
"Expects",
"connection",
"information",
"for",
"RabbitMQ",
"to",
"submit",
"model",
"run",
"requests",
"to",
"workers",
"."
] | 3e7782d059ec808d930f0992794b6f5a8fd73c2c | https://github.com/heikomuller/sco-engine/blob/3e7782d059ec808d930f0992794b6f5a8fd73c2c/scoengine/__init__.py#L110-L148 |
250,952 | heikomuller/sco-engine | scoengine/__init__.py | SCOEngine.run_model | def run_model(self, model_run, run_url):
"""Execute the given model run.
Throws a ValueError if the given run specifies an unknown model or if
the model connector is invalid. An EngineException is thrown if running
the model (i.e., communication with the backend) fails.
Paramet... | python | def run_model(self, model_run, run_url):
"""Execute the given model run.
Throws a ValueError if the given run specifies an unknown model or if
the model connector is invalid. An EngineException is thrown if running
the model (i.e., communication with the backend) fails.
Paramet... | [
"def",
"run_model",
"(",
"self",
",",
"model_run",
",",
"run_url",
")",
":",
"# Get model to verify that it exists and to get connector information",
"model",
"=",
"self",
".",
"get_model",
"(",
"model_run",
".",
"model_id",
")",
"if",
"model",
"is",
"None",
":",
... | Execute the given model run.
Throws a ValueError if the given run specifies an unknown model or if
the model connector is invalid. An EngineException is thrown if running
the model (i.e., communication with the backend) fails.
Parameters
----------
model_run : ModelRunH... | [
"Execute",
"the",
"given",
"model",
"run",
"."
] | 3e7782d059ec808d930f0992794b6f5a8fd73c2c | https://github.com/heikomuller/sco-engine/blob/3e7782d059ec808d930f0992794b6f5a8fd73c2c/scoengine/__init__.py#L150-L170 |
250,953 | heikomuller/sco-engine | scoengine/__init__.py | SCOEngine.validate_connector | def validate_connector(self, connector):
"""Validate a given connector. Raises ValueError if the connector is not
valid.
Parameters
----------
connector : dict
Connection information
"""
if not 'connector' in connector:
raise ValueError('m... | python | def validate_connector(self, connector):
"""Validate a given connector. Raises ValueError if the connector is not
valid.
Parameters
----------
connector : dict
Connection information
"""
if not 'connector' in connector:
raise ValueError('m... | [
"def",
"validate_connector",
"(",
"self",
",",
"connector",
")",
":",
"if",
"not",
"'connector'",
"in",
"connector",
":",
"raise",
"ValueError",
"(",
"'missing connector name'",
")",
"elif",
"connector",
"[",
"'connector'",
"]",
"!=",
"CONNECTOR_RABBITMQ",
":",
... | Validate a given connector. Raises ValueError if the connector is not
valid.
Parameters
----------
connector : dict
Connection information | [
"Validate",
"a",
"given",
"connector",
".",
"Raises",
"ValueError",
"if",
"the",
"connector",
"is",
"not",
"valid",
"."
] | 3e7782d059ec808d930f0992794b6f5a8fd73c2c | https://github.com/heikomuller/sco-engine/blob/3e7782d059ec808d930f0992794b6f5a8fd73c2c/scoengine/__init__.py#L214-L229 |
250,954 | heikomuller/sco-engine | scoengine/__init__.py | RabbitMQConnector.run_model | def run_model(self, model_run, run_url):
"""Run model by sending message to RabbitMQ queue containing the
run end experiment identifier. Messages are persistent to ensure that
a worker will process process the run request at some point.
Throws a EngineException if communication with the... | python | def run_model(self, model_run, run_url):
"""Run model by sending message to RabbitMQ queue containing the
run end experiment identifier. Messages are persistent to ensure that
a worker will process process the run request at some point.
Throws a EngineException if communication with the... | [
"def",
"run_model",
"(",
"self",
",",
"model_run",
",",
"run_url",
")",
":",
"# Open connection to RabbitMQ server. Will raise an exception if the",
"# server is not running. In this case we raise an EngineException to",
"# allow caller to delete model run.",
"try",
":",
"credentials",... | Run model by sending message to RabbitMQ queue containing the
run end experiment identifier. Messages are persistent to ensure that
a worker will process process the run request at some point.
Throws a EngineException if communication with the server fails.
Parameters
---------... | [
"Run",
"model",
"by",
"sending",
"message",
"to",
"RabbitMQ",
"queue",
"containing",
"the",
"run",
"end",
"experiment",
"identifier",
".",
"Messages",
"are",
"persistent",
"to",
"ensure",
"that",
"a",
"worker",
"will",
"process",
"process",
"the",
"run",
"requ... | 3e7782d059ec808d930f0992794b6f5a8fd73c2c | https://github.com/heikomuller/sco-engine/blob/3e7782d059ec808d930f0992794b6f5a8fd73c2c/scoengine/__init__.py#L278-L323 |
250,955 | heikomuller/sco-engine | scoengine/__init__.py | BufferedConnector.run_model | def run_model(self, model_run, run_url):
"""Create entry in run request buffer.
Parameters
----------
model_run : ModelRunHandle
Handle to model run
run_url : string
URL for model run information
"""
# Create model run request
requ... | python | def run_model(self, model_run, run_url):
"""Create entry in run request buffer.
Parameters
----------
model_run : ModelRunHandle
Handle to model run
run_url : string
URL for model run information
"""
# Create model run request
requ... | [
"def",
"run_model",
"(",
"self",
",",
"model_run",
",",
"run_url",
")",
":",
"# Create model run request",
"request",
"=",
"RequestFactory",
"(",
")",
".",
"get_request",
"(",
"model_run",
",",
"run_url",
")",
"# Write request and connector information into buffer",
"... | Create entry in run request buffer.
Parameters
----------
model_run : ModelRunHandle
Handle to model run
run_url : string
URL for model run information | [
"Create",
"entry",
"in",
"run",
"request",
"buffer",
"."
] | 3e7782d059ec808d930f0992794b6f5a8fd73c2c | https://github.com/heikomuller/sco-engine/blob/3e7782d059ec808d930f0992794b6f5a8fd73c2c/scoengine/__init__.py#L357-L373 |
250,956 | heikomuller/sco-engine | scoengine/__init__.py | RequestFactory.get_request | def get_request(self, model_run, run_url):
"""Create request object to run model. Requests are handled by SCO
worker implementations.
Parameters
----------
model_run : ModelRunHandle
Handle to model run
run_url : string
URL for model run informati... | python | def get_request(self, model_run, run_url):
"""Create request object to run model. Requests are handled by SCO
worker implementations.
Parameters
----------
model_run : ModelRunHandle
Handle to model run
run_url : string
URL for model run informati... | [
"def",
"get_request",
"(",
"self",
",",
"model_run",
",",
"run_url",
")",
":",
"return",
"ModelRunRequest",
"(",
"model_run",
".",
"identifier",
",",
"model_run",
".",
"experiment_id",
",",
"run_url",
")"
] | Create request object to run model. Requests are handled by SCO
worker implementations.
Parameters
----------
model_run : ModelRunHandle
Handle to model run
run_url : string
URL for model run information
Returns
-------
ModelRunRe... | [
"Create",
"request",
"object",
"to",
"run",
"model",
".",
"Requests",
"are",
"handled",
"by",
"SCO",
"worker",
"implementations",
"."
] | 3e7782d059ec808d930f0992794b6f5a8fd73c2c | https://github.com/heikomuller/sco-engine/blob/3e7782d059ec808d930f0992794b6f5a8fd73c2c/scoengine/__init__.py#L383-L403 |
250,957 | thomasvandoren/bugzscout-py | bugzscout/ext/celery_app.py | submit_error | def submit_error(url, user, project, area, description,
extra=None, default_message=None):
"""Celery task for submitting errors asynchronously.
:param url: string URL for bugzscout
:param user: string fogbugz user to designate when submitting
via bugzscout
:param proje... | python | def submit_error(url, user, project, area, description,
extra=None, default_message=None):
"""Celery task for submitting errors asynchronously.
:param url: string URL for bugzscout
:param user: string fogbugz user to designate when submitting
via bugzscout
:param proje... | [
"def",
"submit_error",
"(",
"url",
",",
"user",
",",
"project",
",",
"area",
",",
"description",
",",
"extra",
"=",
"None",
",",
"default_message",
"=",
"None",
")",
":",
"LOG",
".",
"debug",
"(",
"'Creating new BugzScout instance.'",
")",
"client",
"=",
"... | Celery task for submitting errors asynchronously.
:param url: string URL for bugzscout
:param user: string fogbugz user to designate when submitting
via bugzscout
:param project: string fogbugz project to designate for cases
:param area: string fogbugz area to designate for cases
:... | [
"Celery",
"task",
"for",
"submitting",
"errors",
"asynchronously",
"."
] | 514528e958a97e0e7b36870037c5c69661511824 | https://github.com/thomasvandoren/bugzscout-py/blob/514528e958a97e0e7b36870037c5c69661511824/bugzscout/ext/celery_app.py#L30-L49 |
250,958 | wheeler-microfluidics/nested-structures | nested_structures/__init__.py | apply_depth_first | def apply_depth_first(nodes, func, depth=0, as_dict=False, parents=None):
'''
Given a structure such as the application menu layout described above, we
may want to apply an operation to each entry to create a transformed
version of the structure.
For example, let's convert all entries in the applic... | python | def apply_depth_first(nodes, func, depth=0, as_dict=False, parents=None):
'''
Given a structure such as the application menu layout described above, we
may want to apply an operation to each entry to create a transformed
version of the structure.
For example, let's convert all entries in the applic... | [
"def",
"apply_depth_first",
"(",
"nodes",
",",
"func",
",",
"depth",
"=",
"0",
",",
"as_dict",
"=",
"False",
",",
"parents",
"=",
"None",
")",
":",
"if",
"as_dict",
":",
"items",
"=",
"OrderedDict",
"(",
")",
"else",
":",
"items",
"=",
"[",
"]",
"i... | Given a structure such as the application menu layout described above, we
may want to apply an operation to each entry to create a transformed
version of the structure.
For example, let's convert all entries in the application menu layout from
above to upper-case:
>>> pprint(apply_depth_first(menu... | [
"Given",
"a",
"structure",
"such",
"as",
"the",
"application",
"menu",
"layout",
"described",
"above",
"we",
"may",
"want",
"to",
"apply",
"an",
"operation",
"to",
"each",
"entry",
"to",
"create",
"a",
"transformed",
"version",
"of",
"the",
"structure",
"."
... | e3586bcca01c59f18ae16b8240e6e49197b63ecb | https://github.com/wheeler-microfluidics/nested-structures/blob/e3586bcca01c59f18ae16b8240e6e49197b63ecb/nested_structures/__init__.py#L51-L146 |
250,959 | wheeler-microfluidics/nested-structures | nested_structures/__init__.py | apply_dict_depth_first | def apply_dict_depth_first(nodes, func, depth=0, as_dict=True, parents=None, pre=None, post=None):
'''
This function is similar to the `apply_depth_first` except that it operates
on the `OrderedDict`-based structure returned from `apply_depth_first` when
`as_dict=True`.
Note that if `as_dict` is `F... | python | def apply_dict_depth_first(nodes, func, depth=0, as_dict=True, parents=None, pre=None, post=None):
'''
This function is similar to the `apply_depth_first` except that it operates
on the `OrderedDict`-based structure returned from `apply_depth_first` when
`as_dict=True`.
Note that if `as_dict` is `F... | [
"def",
"apply_dict_depth_first",
"(",
"nodes",
",",
"func",
",",
"depth",
"=",
"0",
",",
"as_dict",
"=",
"True",
",",
"parents",
"=",
"None",
",",
"pre",
"=",
"None",
",",
"post",
"=",
"None",
")",
":",
"if",
"as_dict",
":",
"items",
"=",
"OrderedDic... | This function is similar to the `apply_depth_first` except that it operates
on the `OrderedDict`-based structure returned from `apply_depth_first` when
`as_dict=True`.
Note that if `as_dict` is `False`, the result of this function is given in
the entry/tuple form. | [
"This",
"function",
"is",
"similar",
"to",
"the",
"apply_depth_first",
"except",
"that",
"it",
"operates",
"on",
"the",
"OrderedDict",
"-",
"based",
"structure",
"returned",
"from",
"apply_depth_first",
"when",
"as_dict",
"=",
"True",
"."
] | e3586bcca01c59f18ae16b8240e6e49197b63ecb | https://github.com/wheeler-microfluidics/nested-structures/blob/e3586bcca01c59f18ae16b8240e6e49197b63ecb/nested_structures/__init__.py#L149-L190 |
250,960 | wheeler-microfluidics/nested-structures | nested_structures/__init__.py | collect | def collect(nested_nodes, transform=None):
'''
Return list containing the result of the `transform` function applied to
each item in the supplied list of nested nodes.
A custom transform function may be applied to each entry during the
flattening by specifying a function through the `transform` key... | python | def collect(nested_nodes, transform=None):
'''
Return list containing the result of the `transform` function applied to
each item in the supplied list of nested nodes.
A custom transform function may be applied to each entry during the
flattening by specifying a function through the `transform` key... | [
"def",
"collect",
"(",
"nested_nodes",
",",
"transform",
"=",
"None",
")",
":",
"items",
"=",
"[",
"]",
"if",
"transform",
"is",
"None",
":",
"transform",
"=",
"lambda",
"node",
",",
"parents",
",",
"nodes",
",",
"*",
"args",
":",
"node",
"def",
"__c... | Return list containing the result of the `transform` function applied to
each item in the supplied list of nested nodes.
A custom transform function may be applied to each entry during the
flattening by specifying a function through the `transform` keyword
argument. The `transform` function will be pa... | [
"Return",
"list",
"containing",
"the",
"result",
"of",
"the",
"transform",
"function",
"applied",
"to",
"each",
"item",
"in",
"the",
"supplied",
"list",
"of",
"nested",
"nodes",
"."
] | e3586bcca01c59f18ae16b8240e6e49197b63ecb | https://github.com/wheeler-microfluidics/nested-structures/blob/e3586bcca01c59f18ae16b8240e6e49197b63ecb/nested_structures/__init__.py#L193-L218 |
250,961 | ramrod-project/database-brain | schema/brain/binary/decorators.py | wrap_split_big_content | def wrap_split_big_content(func_, *args, **kwargs):
"""
chunk the content into smaller binary blobs before inserting
this function should chunk in such a way that this
is completely transparent to the user.
:param func_:
:param args:
:param kwargs:
:return: <dict> RethinkDB dict from i... | python | def wrap_split_big_content(func_, *args, **kwargs):
"""
chunk the content into smaller binary blobs before inserting
this function should chunk in such a way that this
is completely transparent to the user.
:param func_:
:param args:
:param kwargs:
:return: <dict> RethinkDB dict from i... | [
"def",
"wrap_split_big_content",
"(",
"func_",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"obj_dict",
"=",
"args",
"[",
"0",
"]",
"if",
"len",
"(",
"obj_dict",
"[",
"CONTENT_FIELD",
"]",
")",
"<",
"MAX_PUT",
":",
"obj_dict",
"[",
"PART_FIELD"... | chunk the content into smaller binary blobs before inserting
this function should chunk in such a way that this
is completely transparent to the user.
:param func_:
:param args:
:param kwargs:
:return: <dict> RethinkDB dict from insert | [
"chunk",
"the",
"content",
"into",
"smaller",
"binary",
"blobs",
"before",
"inserting"
] | b024cb44f34cabb9d80af38271ddb65c25767083 | https://github.com/ramrod-project/database-brain/blob/b024cb44f34cabb9d80af38271ddb65c25767083/schema/brain/binary/decorators.py#L35-L52 |
250,962 | ramrod-project/database-brain | schema/brain/binary/decorators.py | _only_if_file_not_exist | def _only_if_file_not_exist(func_, *args, **kwargs):
"""
horribly non-atomic
:param func_:
:param args:
:param kwargs:
:return:
"""
obj_dict = args[1]
conn = args[-1]
try:
RBF.get(obj_dict[PRIMARY_FIELD]).pluck(PRIMARY_FIELD).run(conn)
err_str = "Duplicate primar... | python | def _only_if_file_not_exist(func_, *args, **kwargs):
"""
horribly non-atomic
:param func_:
:param args:
:param kwargs:
:return:
"""
obj_dict = args[1]
conn = args[-1]
try:
RBF.get(obj_dict[PRIMARY_FIELD]).pluck(PRIMARY_FIELD).run(conn)
err_str = "Duplicate primar... | [
"def",
"_only_if_file_not_exist",
"(",
"func_",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"obj_dict",
"=",
"args",
"[",
"1",
"]",
"conn",
"=",
"args",
"[",
"-",
"1",
"]",
"try",
":",
"RBF",
".",
"get",
"(",
"obj_dict",
"[",
"PRIMARY_FIEL... | horribly non-atomic
:param func_:
:param args:
:param kwargs:
:return: | [
"horribly",
"non",
"-",
"atomic"
] | b024cb44f34cabb9d80af38271ddb65c25767083 | https://github.com/ramrod-project/database-brain/blob/b024cb44f34cabb9d80af38271ddb65c25767083/schema/brain/binary/decorators.py#L56-L74 |
250,963 | ramrod-project/database-brain | schema/brain/binary/decorators.py | _perform_chunking | def _perform_chunking(func_, *args, **kwargs):
"""
internal function alled only by
wrap_split_big_content
performs the actual chunking.
:param func_:
:param args:
:param kwargs:
:return: <dict> RethinkDB dict from insert
"""
obj_dict = args[0]
start_point = 0
file_count... | python | def _perform_chunking(func_, *args, **kwargs):
"""
internal function alled only by
wrap_split_big_content
performs the actual chunking.
:param func_:
:param args:
:param kwargs:
:return: <dict> RethinkDB dict from insert
"""
obj_dict = args[0]
start_point = 0
file_count... | [
"def",
"_perform_chunking",
"(",
"func_",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"obj_dict",
"=",
"args",
"[",
"0",
"]",
"start_point",
"=",
"0",
"file_count",
"=",
"0",
"new_dict",
"=",
"{",
"}",
"resp_dict",
"=",
"Counter",
"(",
"{",
... | internal function alled only by
wrap_split_big_content
performs the actual chunking.
:param func_:
:param args:
:param kwargs:
:return: <dict> RethinkDB dict from insert | [
"internal",
"function",
"alled",
"only",
"by",
"wrap_split_big_content"
] | b024cb44f34cabb9d80af38271ddb65c25767083 | https://github.com/ramrod-project/database-brain/blob/b024cb44f34cabb9d80af38271ddb65c25767083/schema/brain/binary/decorators.py#L78-L118 |
250,964 | henrysher/kotocore | kotocore/utils/import_utils.py | import_class | def import_class(import_path):
"""
Imports a class dynamically from a full import path.
"""
if not '.' in import_path:
raise IncorrectImportPath(
"Invalid Python-style import path provided: {0}.".format(
import_path
)
)
path_bits = import_path... | python | def import_class(import_path):
"""
Imports a class dynamically from a full import path.
"""
if not '.' in import_path:
raise IncorrectImportPath(
"Invalid Python-style import path provided: {0}.".format(
import_path
)
)
path_bits = import_path... | [
"def",
"import_class",
"(",
"import_path",
")",
":",
"if",
"not",
"'.'",
"in",
"import_path",
":",
"raise",
"IncorrectImportPath",
"(",
"\"Invalid Python-style import path provided: {0}.\"",
".",
"format",
"(",
"import_path",
")",
")",
"path_bits",
"=",
"import_path",... | Imports a class dynamically from a full import path. | [
"Imports",
"a",
"class",
"dynamically",
"from",
"a",
"full",
"import",
"path",
"."
] | c52d2f3878b924ceabca07f61c91abcb1b230ecc | https://github.com/henrysher/kotocore/blob/c52d2f3878b924ceabca07f61c91abcb1b230ecc/kotocore/utils/import_utils.py#L6-L38 |
250,965 | uw-it-aca/uw-restclients-hfs | uw_hfs/idcard.py | get_hfs_accounts | def get_hfs_accounts(netid):
"""
Return a restclients.models.hfs.HfsAccounts object on the given uwnetid
"""
url = ACCOUNTS_URL.format(uwnetid=netid)
response = get_resource(url)
return _object_from_json(response) | python | def get_hfs_accounts(netid):
"""
Return a restclients.models.hfs.HfsAccounts object on the given uwnetid
"""
url = ACCOUNTS_URL.format(uwnetid=netid)
response = get_resource(url)
return _object_from_json(response) | [
"def",
"get_hfs_accounts",
"(",
"netid",
")",
":",
"url",
"=",
"ACCOUNTS_URL",
".",
"format",
"(",
"uwnetid",
"=",
"netid",
")",
"response",
"=",
"get_resource",
"(",
"url",
")",
"return",
"_object_from_json",
"(",
"response",
")"
] | Return a restclients.models.hfs.HfsAccounts object on the given uwnetid | [
"Return",
"a",
"restclients",
".",
"models",
".",
"hfs",
".",
"HfsAccounts",
"object",
"on",
"the",
"given",
"uwnetid"
] | 685c3b16280d9e8b11b0d295c8852fa876f55ad0 | https://github.com/uw-it-aca/uw-restclients-hfs/blob/685c3b16280d9e8b11b0d295c8852fa876f55ad0/uw_hfs/idcard.py#L19-L25 |
250,966 | OldhamMade/PySO8601 | PySO8601/utility.py | _timedelta_from_elements | def _timedelta_from_elements(elements):
"""
Return a timedelta from a dict of date elements.
Accepts a dict containing any of the following:
- years
- months
- days
- hours
- minutes
- seconds
If years and/or months are provided, it will use a naive calcuation
o... | python | def _timedelta_from_elements(elements):
"""
Return a timedelta from a dict of date elements.
Accepts a dict containing any of the following:
- years
- months
- days
- hours
- minutes
- seconds
If years and/or months are provided, it will use a naive calcuation
o... | [
"def",
"_timedelta_from_elements",
"(",
"elements",
")",
":",
"days",
"=",
"sum",
"(",
"(",
"elements",
"[",
"'days'",
"]",
",",
"_months_to_days",
"(",
"elements",
".",
"get",
"(",
"'months'",
",",
"0",
")",
")",
",",
"_years_to_days",
"(",
"elements",
... | Return a timedelta from a dict of date elements.
Accepts a dict containing any of the following:
- years
- months
- days
- hours
- minutes
- seconds
If years and/or months are provided, it will use a naive calcuation
of 365 days in a year and 30 days in a month. | [
"Return",
"a",
"timedelta",
"from",
"a",
"dict",
"of",
"date",
"elements",
"."
] | b7d3b3cb3ed3e12eb2a21caa26a3abeab3c96fe4 | https://github.com/OldhamMade/PySO8601/blob/b7d3b3cb3ed3e12eb2a21caa26a3abeab3c96fe4/PySO8601/utility.py#L28-L52 |
250,967 | laysakura/relshell | relshell/batch.py | Batch.next | def next(self):
"""Return one of record in this batch in out-of-order.
:raises: `StopIteration` when no more record is in this batch
"""
if self._records_iter >= len(self._records):
raise StopIteration
self._records_iter += 1
return self._records[self._record... | python | def next(self):
"""Return one of record in this batch in out-of-order.
:raises: `StopIteration` when no more record is in this batch
"""
if self._records_iter >= len(self._records):
raise StopIteration
self._records_iter += 1
return self._records[self._record... | [
"def",
"next",
"(",
"self",
")",
":",
"if",
"self",
".",
"_records_iter",
">=",
"len",
"(",
"self",
".",
"_records",
")",
":",
"raise",
"StopIteration",
"self",
".",
"_records_iter",
"+=",
"1",
"return",
"self",
".",
"_records",
"[",
"self",
".",
"_rec... | Return one of record in this batch in out-of-order.
:raises: `StopIteration` when no more record is in this batch | [
"Return",
"one",
"of",
"record",
"in",
"this",
"batch",
"in",
"out",
"-",
"of",
"-",
"order",
"."
] | 9ca5c03a34c11cb763a4a75595f18bf4383aa8cc | https://github.com/laysakura/relshell/blob/9ca5c03a34c11cb763a4a75595f18bf4383aa8cc/relshell/batch.py#L39-L47 |
250,968 | laysakura/relshell | relshell/batch.py | Batch.formatted_str | def formatted_str(self, format):
"""Return formatted str.
:param format: one of 'json', 'csv' are supported
"""
assert(format in ('json', 'csv'))
ret_str_list = []
for rec in self._records:
if format == 'json':
ret_str_list.append('{')
... | python | def formatted_str(self, format):
"""Return formatted str.
:param format: one of 'json', 'csv' are supported
"""
assert(format in ('json', 'csv'))
ret_str_list = []
for rec in self._records:
if format == 'json':
ret_str_list.append('{')
... | [
"def",
"formatted_str",
"(",
"self",
",",
"format",
")",
":",
"assert",
"(",
"format",
"in",
"(",
"'json'",
",",
"'csv'",
")",
")",
"ret_str_list",
"=",
"[",
"]",
"for",
"rec",
"in",
"self",
".",
"_records",
":",
"if",
"format",
"==",
"'json'",
":",
... | Return formatted str.
:param format: one of 'json', 'csv' are supported | [
"Return",
"formatted",
"str",
"."
] | 9ca5c03a34c11cb763a4a75595f18bf4383aa8cc | https://github.com/laysakura/relshell/blob/9ca5c03a34c11cb763a4a75595f18bf4383aa8cc/relshell/batch.py#L52-L77 |
250,969 | rochacbruno/shiftpy | shiftpy/wsgi_utils.py | envify | def envify(app=None, add_repo_to_path=True):
"""
This will simply activate virtualenv on openshift ans returs the app
in a wsgi.py or app.py in your openshift python web app
- wsgi.py
from shiftpy.wsgi_utils import envify
from myproject import app
# wsgi expects an object named 'application... | python | def envify(app=None, add_repo_to_path=True):
"""
This will simply activate virtualenv on openshift ans returs the app
in a wsgi.py or app.py in your openshift python web app
- wsgi.py
from shiftpy.wsgi_utils import envify
from myproject import app
# wsgi expects an object named 'application... | [
"def",
"envify",
"(",
"app",
"=",
"None",
",",
"add_repo_to_path",
"=",
"True",
")",
":",
"if",
"getvar",
"(",
"'HOMEDIR'",
")",
":",
"if",
"add_repo_to_path",
":",
"sys",
".",
"path",
".",
"append",
"(",
"os",
".",
"path",
".",
"join",
"(",
"getvar"... | This will simply activate virtualenv on openshift ans returs the app
in a wsgi.py or app.py in your openshift python web app
- wsgi.py
from shiftpy.wsgi_utils import envify
from myproject import app
# wsgi expects an object named 'application'
application = envify(app) | [
"This",
"will",
"simply",
"activate",
"virtualenv",
"on",
"openshift",
"ans",
"returs",
"the",
"app"
] | 6bffccf511f24b7e53dcfee9807e0e3388aa823a | https://github.com/rochacbruno/shiftpy/blob/6bffccf511f24b7e53dcfee9807e0e3388aa823a/shiftpy/wsgi_utils.py#L7-L38 |
250,970 | pglass/nose-blacklist | noseblacklist/plugin.py | BlacklistPlugin._read_file | def _read_file(self, filename):
"""Return the lines from the given file, ignoring lines that start with
comments"""
result = []
with open(filename, 'r') as f:
lines = f.read().split('\n')
for line in lines:
nocomment = line.strip().split('#')[0].st... | python | def _read_file(self, filename):
"""Return the lines from the given file, ignoring lines that start with
comments"""
result = []
with open(filename, 'r') as f:
lines = f.read().split('\n')
for line in lines:
nocomment = line.strip().split('#')[0].st... | [
"def",
"_read_file",
"(",
"self",
",",
"filename",
")",
":",
"result",
"=",
"[",
"]",
"with",
"open",
"(",
"filename",
",",
"'r'",
")",
"as",
"f",
":",
"lines",
"=",
"f",
".",
"read",
"(",
")",
".",
"split",
"(",
"'\\n'",
")",
"for",
"line",
"i... | Return the lines from the given file, ignoring lines that start with
comments | [
"Return",
"the",
"lines",
"from",
"the",
"given",
"file",
"ignoring",
"lines",
"that",
"start",
"with",
"comments"
] | 68e340ecea45d98e3a5ebf8aa9bf7975146cc20d | https://github.com/pglass/nose-blacklist/blob/68e340ecea45d98e3a5ebf8aa9bf7975146cc20d/noseblacklist/plugin.py#L71-L81 |
250,971 | josegomezr/pqb | pqb/queries.py | Select.order_by | def order_by(self, field, orientation='ASC'):
"""
Indica los campos y el criterio de ordenamiento
"""
if isinstance(field, list):
self.raw_order_by.append(field)
else:
self.raw_order_by.append([field, orientation])
return self | python | def order_by(self, field, orientation='ASC'):
"""
Indica los campos y el criterio de ordenamiento
"""
if isinstance(field, list):
self.raw_order_by.append(field)
else:
self.raw_order_by.append([field, orientation])
return self | [
"def",
"order_by",
"(",
"self",
",",
"field",
",",
"orientation",
"=",
"'ASC'",
")",
":",
"if",
"isinstance",
"(",
"field",
",",
"list",
")",
":",
"self",
".",
"raw_order_by",
".",
"append",
"(",
"field",
")",
"else",
":",
"self",
".",
"raw_order_by",
... | Indica los campos y el criterio de ordenamiento | [
"Indica",
"los",
"campos",
"y",
"el",
"criterio",
"de",
"ordenamiento"
] | a600cc6e4e9acdaaf2cff171d13eb85c9ed1757c | https://github.com/josegomezr/pqb/blob/a600cc6e4e9acdaaf2cff171d13eb85c9ed1757c/pqb/queries.py#L108-L117 |
250,972 | vedarthk/exreporter | exreporter/stores/github.py | GithubStore.create_or_update_issue | def create_or_update_issue(self, title, body, culprit, labels, **kwargs):
'''Creates or comments on existing issue in the store.
:params title: title for the issue
:params body: body, the content of the issue
:params culprit: string used to identify the cause of the issue,
a... | python | def create_or_update_issue(self, title, body, culprit, labels, **kwargs):
'''Creates or comments on existing issue in the store.
:params title: title for the issue
:params body: body, the content of the issue
:params culprit: string used to identify the cause of the issue,
a... | [
"def",
"create_or_update_issue",
"(",
"self",
",",
"title",
",",
"body",
",",
"culprit",
",",
"labels",
",",
"*",
"*",
"kwargs",
")",
":",
"issues",
"=",
"self",
".",
"search",
"(",
"q",
"=",
"culprit",
",",
"labels",
"=",
"labels",
")",
"self",
".",... | Creates or comments on existing issue in the store.
:params title: title for the issue
:params body: body, the content of the issue
:params culprit: string used to identify the cause of the issue,
also used for aggregation
:params labels: (optional) list of labels attached t... | [
"Creates",
"or",
"comments",
"on",
"existing",
"issue",
"in",
"the",
"store",
"."
] | 8adf445477341d43a13d3baa2551e1c0f68229bb | https://github.com/vedarthk/exreporter/blob/8adf445477341d43a13d3baa2551e1c0f68229bb/exreporter/stores/github.py#L49-L70 |
250,973 | vedarthk/exreporter | exreporter/stores/github.py | GithubStore.search | def search(self, q, labels, state='open,closed', **kwargs):
"""Search for issues in Github.
:param q: query string to search
:param state: state of the issue
:returns: list of issue objects
:rtype: list
"""
search_result = self.github_request.search(q=q, state=s... | python | def search(self, q, labels, state='open,closed', **kwargs):
"""Search for issues in Github.
:param q: query string to search
:param state: state of the issue
:returns: list of issue objects
:rtype: list
"""
search_result = self.github_request.search(q=q, state=s... | [
"def",
"search",
"(",
"self",
",",
"q",
",",
"labels",
",",
"state",
"=",
"'open,closed'",
",",
"*",
"*",
"kwargs",
")",
":",
"search_result",
"=",
"self",
".",
"github_request",
".",
"search",
"(",
"q",
"=",
"q",
",",
"state",
"=",
"state",
",",
"... | Search for issues in Github.
:param q: query string to search
:param state: state of the issue
:returns: list of issue objects
:rtype: list | [
"Search",
"for",
"issues",
"in",
"Github",
"."
] | 8adf445477341d43a13d3baa2551e1c0f68229bb | https://github.com/vedarthk/exreporter/blob/8adf445477341d43a13d3baa2551e1c0f68229bb/exreporter/stores/github.py#L72-L87 |
250,974 | vedarthk/exreporter | exreporter/stores/github.py | GithubStore.handle_issue_comment | def handle_issue_comment(self, issue, title, body, **kwargs):
"""Decides whether to comment or create a new issue when trying to comment.
:param issue: issue on which the comment is to be added
:param title: title of the issue if new one is to be created
:param body: body of the issue/c... | python | def handle_issue_comment(self, issue, title, body, **kwargs):
"""Decides whether to comment or create a new issue when trying to comment.
:param issue: issue on which the comment is to be added
:param title: title of the issue if new one is to be created
:param body: body of the issue/c... | [
"def",
"handle_issue_comment",
"(",
"self",
",",
"issue",
",",
"title",
",",
"body",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_is_time_delta_valid",
"(",
"issue",
".",
"updated_time_delta",
")",
":",
"if",
"issue",
".",
"comments_count",
"<",... | Decides whether to comment or create a new issue when trying to comment.
:param issue: issue on which the comment is to be added
:param title: title of the issue if new one is to be created
:param body: body of the issue/comment to be created
:returns: newly created issue or the one on ... | [
"Decides",
"whether",
"to",
"comment",
"or",
"create",
"a",
"new",
"issue",
"when",
"trying",
"to",
"comment",
"."
] | 8adf445477341d43a13d3baa2551e1c0f68229bb | https://github.com/vedarthk/exreporter/blob/8adf445477341d43a13d3baa2551e1c0f68229bb/exreporter/stores/github.py#L89-L104 |
250,975 | vedarthk/exreporter | exreporter/stores/github.py | GithubStore.create_issue | def create_issue(self, title, body, labels=None):
"""Creates a new issue in Github.
:params title: title of the issue to be created
:params body: body of the issue to be created
:params labels: (optional) list of labels for the issue
:returns: newly created issue
:rtype:... | python | def create_issue(self, title, body, labels=None):
"""Creates a new issue in Github.
:params title: title of the issue to be created
:params body: body of the issue to be created
:params labels: (optional) list of labels for the issue
:returns: newly created issue
:rtype:... | [
"def",
"create_issue",
"(",
"self",
",",
"title",
",",
"body",
",",
"labels",
"=",
"None",
")",
":",
"kwargs",
"=",
"self",
".",
"github_request",
".",
"create",
"(",
"title",
"=",
"title",
",",
"body",
"=",
"body",
",",
"labels",
"=",
"labels",
")",... | Creates a new issue in Github.
:params title: title of the issue to be created
:params body: body of the issue to be created
:params labels: (optional) list of labels for the issue
:returns: newly created issue
:rtype: :class:`exreporter.stores.github.GithubIssue` | [
"Creates",
"a",
"new",
"issue",
"in",
"Github",
"."
] | 8adf445477341d43a13d3baa2551e1c0f68229bb | https://github.com/vedarthk/exreporter/blob/8adf445477341d43a13d3baa2551e1c0f68229bb/exreporter/stores/github.py#L109-L120 |
250,976 | vedarthk/exreporter | exreporter/stores/github.py | GithubIssue.updated_time_delta | def updated_time_delta(self):
"""Returns the number of seconds ago the issue was updated from current time.
"""
local_timezone = tzlocal()
update_at = datetime.datetime.strptime(self.updated_at, '%Y-%m-%dT%XZ')
update_at_utc = pytz.utc.localize(update_at)
update_at_local ... | python | def updated_time_delta(self):
"""Returns the number of seconds ago the issue was updated from current time.
"""
local_timezone = tzlocal()
update_at = datetime.datetime.strptime(self.updated_at, '%Y-%m-%dT%XZ')
update_at_utc = pytz.utc.localize(update_at)
update_at_local ... | [
"def",
"updated_time_delta",
"(",
"self",
")",
":",
"local_timezone",
"=",
"tzlocal",
"(",
")",
"update_at",
"=",
"datetime",
".",
"datetime",
".",
"strptime",
"(",
"self",
".",
"updated_at",
",",
"'%Y-%m-%dT%XZ'",
")",
"update_at_utc",
"=",
"pytz",
".",
"ut... | Returns the number of seconds ago the issue was updated from current time. | [
"Returns",
"the",
"number",
"of",
"seconds",
"ago",
"the",
"issue",
"was",
"updated",
"from",
"current",
"time",
"."
] | 8adf445477341d43a13d3baa2551e1c0f68229bb | https://github.com/vedarthk/exreporter/blob/8adf445477341d43a13d3baa2551e1c0f68229bb/exreporter/stores/github.py#L145-L153 |
250,977 | vedarthk/exreporter | exreporter/stores/github.py | GithubIssue.open_issue | def open_issue(self):
"""Changes the state of issue to 'open'.
"""
self.github_request.update(issue=self, state='open')
self.state = 'open' | python | def open_issue(self):
"""Changes the state of issue to 'open'.
"""
self.github_request.update(issue=self, state='open')
self.state = 'open' | [
"def",
"open_issue",
"(",
"self",
")",
":",
"self",
".",
"github_request",
".",
"update",
"(",
"issue",
"=",
"self",
",",
"state",
"=",
"'open'",
")",
"self",
".",
"state",
"=",
"'open'"
] | Changes the state of issue to 'open'. | [
"Changes",
"the",
"state",
"of",
"issue",
"to",
"open",
"."
] | 8adf445477341d43a13d3baa2551e1c0f68229bb | https://github.com/vedarthk/exreporter/blob/8adf445477341d43a13d3baa2551e1c0f68229bb/exreporter/stores/github.py#L155-L159 |
250,978 | vedarthk/exreporter | exreporter/stores/github.py | GithubIssue.comment | def comment(self, body):
"""Adds a comment to the issue.
:params body: body, content of the comment
:returns: issue object
:rtype: :class:`exreporter.stores.github.GithubIssue`
"""
self.github_request.comment(issue=self, body=body)
if self.state == 'closed':
... | python | def comment(self, body):
"""Adds a comment to the issue.
:params body: body, content of the comment
:returns: issue object
:rtype: :class:`exreporter.stores.github.GithubIssue`
"""
self.github_request.comment(issue=self, body=body)
if self.state == 'closed':
... | [
"def",
"comment",
"(",
"self",
",",
"body",
")",
":",
"self",
".",
"github_request",
".",
"comment",
"(",
"issue",
"=",
"self",
",",
"body",
"=",
"body",
")",
"if",
"self",
".",
"state",
"==",
"'closed'",
":",
"self",
".",
"open_issue",
"(",
")",
"... | Adds a comment to the issue.
:params body: body, content of the comment
:returns: issue object
:rtype: :class:`exreporter.stores.github.GithubIssue` | [
"Adds",
"a",
"comment",
"to",
"the",
"issue",
"."
] | 8adf445477341d43a13d3baa2551e1c0f68229bb | https://github.com/vedarthk/exreporter/blob/8adf445477341d43a13d3baa2551e1c0f68229bb/exreporter/stores/github.py#L161-L172 |
250,979 | jmgilman/Neolib | neolib/pyamf/alias.py | ClassAlias.createInstance | def createInstance(self, codec=None):
"""
Creates an instance of the klass.
@return: Instance of C{self.klass}.
"""
if type(self.klass) is type:
return self.klass.__new__(self.klass)
return self.klass() | python | def createInstance(self, codec=None):
"""
Creates an instance of the klass.
@return: Instance of C{self.klass}.
"""
if type(self.klass) is type:
return self.klass.__new__(self.klass)
return self.klass() | [
"def",
"createInstance",
"(",
"self",
",",
"codec",
"=",
"None",
")",
":",
"if",
"type",
"(",
"self",
".",
"klass",
")",
"is",
"type",
":",
"return",
"self",
".",
"klass",
".",
"__new__",
"(",
"self",
".",
"klass",
")",
"return",
"self",
".",
"klas... | Creates an instance of the klass.
@return: Instance of C{self.klass}. | [
"Creates",
"an",
"instance",
"of",
"the",
"klass",
"."
] | 228fafeaed0f3195676137732384a14820ae285c | https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/alias.py#L537-L546 |
250,980 | amadev/doan | doan/graph.py | plot_date | def plot_date(datasets, **kwargs):
"""Plot points with dates.
datasets can be Dataset object or list of Dataset.
"""
defaults = {
'grid': True,
'xlabel': '',
'ylabel': '',
'title': '',
'output': None,
'figsize': (8, 6),
}
plot_params = {
... | python | def plot_date(datasets, **kwargs):
"""Plot points with dates.
datasets can be Dataset object or list of Dataset.
"""
defaults = {
'grid': True,
'xlabel': '',
'ylabel': '',
'title': '',
'output': None,
'figsize': (8, 6),
}
plot_params = {
... | [
"def",
"plot_date",
"(",
"datasets",
",",
"*",
"*",
"kwargs",
")",
":",
"defaults",
"=",
"{",
"'grid'",
":",
"True",
",",
"'xlabel'",
":",
"''",
",",
"'ylabel'",
":",
"''",
",",
"'title'",
":",
"''",
",",
"'output'",
":",
"None",
",",
"'figsize'",
... | Plot points with dates.
datasets can be Dataset object or list of Dataset. | [
"Plot",
"points",
"with",
"dates",
"."
] | 5adfa983ac547007a688fe7517291a432919aa3e | https://github.com/amadev/doan/blob/5adfa983ac547007a688fe7517291a432919aa3e/doan/graph.py#L28-L85 |
250,981 | tbreitenfeldt/invisible_ui | invisible_ui/events/handler.py | Handler.call_actions | def call_actions(self, event, *args, **kwargs):
"""Call each function in self._actions after setting self._event."""
self._event = event
for func in self._actions:
func(event, *args, **kwargs) | python | def call_actions(self, event, *args, **kwargs):
"""Call each function in self._actions after setting self._event."""
self._event = event
for func in self._actions:
func(event, *args, **kwargs) | [
"def",
"call_actions",
"(",
"self",
",",
"event",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_event",
"=",
"event",
"for",
"func",
"in",
"self",
".",
"_actions",
":",
"func",
"(",
"event",
",",
"*",
"args",
",",
"*",
"*",
... | Call each function in self._actions after setting self._event. | [
"Call",
"each",
"function",
"in",
"self",
".",
"_actions",
"after",
"setting",
"self",
".",
"_event",
"."
] | 1a6907bfa61bded13fa9fb83ec7778c0df84487f | https://github.com/tbreitenfeldt/invisible_ui/blob/1a6907bfa61bded13fa9fb83ec7778c0df84487f/invisible_ui/events/handler.py#L53-L58 |
250,982 | KnowledgeLinks/rdfframework | rdfframework/sparql/__init__.py | read_query_notes | def read_query_notes(query_str, first_line=False):
"""
Returns the Comments from a query string that are in the header
"""
lines = query_str.split("\n")
started = False
parts = []
for line in lines:
line = line.strip()
if line.startswith("#"):
parts.append(line)
... | python | def read_query_notes(query_str, first_line=False):
"""
Returns the Comments from a query string that are in the header
"""
lines = query_str.split("\n")
started = False
parts = []
for line in lines:
line = line.strip()
if line.startswith("#"):
parts.append(line)
... | [
"def",
"read_query_notes",
"(",
"query_str",
",",
"first_line",
"=",
"False",
")",
":",
"lines",
"=",
"query_str",
".",
"split",
"(",
"\"\\n\"",
")",
"started",
"=",
"False",
"parts",
"=",
"[",
"]",
"for",
"line",
"in",
"lines",
":",
"line",
"=",
"line... | Returns the Comments from a query string that are in the header | [
"Returns",
"the",
"Comments",
"from",
"a",
"query",
"string",
"that",
"are",
"in",
"the",
"header"
] | 9ec32dcc4bed51650a4b392cc5c15100fef7923a | https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/sparql/__init__.py#L4-L20 |
250,983 | bluec0re/python-helperlib | helperlib/binary.py | hexdump | def hexdump(data, cols=8, folded=False, stream=False, offset=0, header=False):
"""
yields the rows of the hex dump
Arguments:
data -- data to dump
cols -- number of octets per row
folded -- fold long ranges of equal bytes
stream -- dont use len on data
>>> from string i... | python | def hexdump(data, cols=8, folded=False, stream=False, offset=0, header=False):
"""
yields the rows of the hex dump
Arguments:
data -- data to dump
cols -- number of octets per row
folded -- fold long ranges of equal bytes
stream -- dont use len on data
>>> from string i... | [
"def",
"hexdump",
"(",
"data",
",",
"cols",
"=",
"8",
",",
"folded",
"=",
"False",
",",
"stream",
"=",
"False",
",",
"offset",
"=",
"0",
",",
"header",
"=",
"False",
")",
":",
"last_byte",
"=",
"None",
"fold",
"=",
"False",
"# determine index width",
... | yields the rows of the hex dump
Arguments:
data -- data to dump
cols -- number of octets per row
folded -- fold long ranges of equal bytes
stream -- dont use len on data
>>> from string import ascii_uppercase
>>> print('\\n'.join(hexdump("".join(chr(i) for i in range(256)))... | [
"yields",
"the",
"rows",
"of",
"the",
"hex",
"dump"
] | a2ac429668a6b86d3dc5e686978965c938f07d2c | https://github.com/bluec0re/python-helperlib/blob/a2ac429668a6b86d3dc5e686978965c938f07d2c/helperlib/binary.py#L13-L176 |
250,984 | PSU-OIT-ARC/django-cloak | cloak/__init__.py | can_cloak_as | def can_cloak_as(user, other_user):
"""
Returns true if `user` can cloak as `other_user`
"""
# check to see if the user is allowed to do this
can_cloak = False
try:
can_cloak = user.can_cloak_as(other_user)
except AttributeError as e:
try:
can_cloak = user.is_staf... | python | def can_cloak_as(user, other_user):
"""
Returns true if `user` can cloak as `other_user`
"""
# check to see if the user is allowed to do this
can_cloak = False
try:
can_cloak = user.can_cloak_as(other_user)
except AttributeError as e:
try:
can_cloak = user.is_staf... | [
"def",
"can_cloak_as",
"(",
"user",
",",
"other_user",
")",
":",
"# check to see if the user is allowed to do this",
"can_cloak",
"=",
"False",
"try",
":",
"can_cloak",
"=",
"user",
".",
"can_cloak_as",
"(",
"other_user",
")",
"except",
"AttributeError",
"as",
"e",
... | Returns true if `user` can cloak as `other_user` | [
"Returns",
"true",
"if",
"user",
"can",
"cloak",
"as",
"other_user"
] | 3f09711837f4fe7b1813692daa064e536135ffa3 | https://github.com/PSU-OIT-ARC/django-cloak/blob/3f09711837f4fe7b1813692daa064e536135ffa3/cloak/__init__.py#L5-L19 |
250,985 | jmvrbanac/lplight | lplight/client.py | LaunchpadClient.get_project | def get_project(self, name):
""" Retrives project information by name
:param name: The formal project name in string form.
"""
uri = '{base}/{project}'.format(base=self.BASE_URI, project=name)
resp = self._client.get(uri, model=models.Project)
return resp | python | def get_project(self, name):
""" Retrives project information by name
:param name: The formal project name in string form.
"""
uri = '{base}/{project}'.format(base=self.BASE_URI, project=name)
resp = self._client.get(uri, model=models.Project)
return resp | [
"def",
"get_project",
"(",
"self",
",",
"name",
")",
":",
"uri",
"=",
"'{base}/{project}'",
".",
"format",
"(",
"base",
"=",
"self",
".",
"BASE_URI",
",",
"project",
"=",
"name",
")",
"resp",
"=",
"self",
".",
"_client",
".",
"get",
"(",
"uri",
",",
... | Retrives project information by name
:param name: The formal project name in string form. | [
"Retrives",
"project",
"information",
"by",
"name"
] | 4d58b45e49ad9ba9e95f8c106d5c49e1658a69a7 | https://github.com/jmvrbanac/lplight/blob/4d58b45e49ad9ba9e95f8c106d5c49e1658a69a7/lplight/client.py#L57-L65 |
250,986 | jmvrbanac/lplight | lplight/client.py | LaunchpadClient.get_bugs | def get_bugs(self, project, status=None):
""" Retrives a List of bugs for a given project.
By default, this will only return activate bugs. If you wish to
retrieve a non-active bug then specify the status through the
status parameter.
:param project: The formal project name.
... | python | def get_bugs(self, project, status=None):
""" Retrives a List of bugs for a given project.
By default, this will only return activate bugs. If you wish to
retrieve a non-active bug then specify the status through the
status parameter.
:param project: The formal project name.
... | [
"def",
"get_bugs",
"(",
"self",
",",
"project",
",",
"status",
"=",
"None",
")",
":",
"uri",
"=",
"'{base}/{project}'",
".",
"format",
"(",
"base",
"=",
"self",
".",
"BASE_URI",
",",
"project",
"=",
"project",
")",
"parameters",
"=",
"{",
"'ws.op'",
":... | Retrives a List of bugs for a given project.
By default, this will only return activate bugs. If you wish to
retrieve a non-active bug then specify the status through the
status parameter.
:param project: The formal project name.
:param status: Allows filtering of bugs by curren... | [
"Retrives",
"a",
"List",
"of",
"bugs",
"for",
"a",
"given",
"project",
".",
"By",
"default",
"this",
"will",
"only",
"return",
"activate",
"bugs",
".",
"If",
"you",
"wish",
"to",
"retrieve",
"a",
"non",
"-",
"active",
"bug",
"then",
"specify",
"the",
"... | 4d58b45e49ad9ba9e95f8c106d5c49e1658a69a7 | https://github.com/jmvrbanac/lplight/blob/4d58b45e49ad9ba9e95f8c106d5c49e1658a69a7/lplight/client.py#L67-L85 |
250,987 | jmvrbanac/lplight | lplight/client.py | LaunchpadClient.get_bug_by_id | def get_bug_by_id(self, bug_id):
""" Retrieves a single bug by it's Launchpad bug_id
:param bug_id: The Launchpad id for the bug.
"""
uri = '{base}/bugs/{bug_id}'.format(base=self.BASE_URI, bug_id=bug_id)
resp = self._client.get(uri, model=models.Bug)
return resp | python | def get_bug_by_id(self, bug_id):
""" Retrieves a single bug by it's Launchpad bug_id
:param bug_id: The Launchpad id for the bug.
"""
uri = '{base}/bugs/{bug_id}'.format(base=self.BASE_URI, bug_id=bug_id)
resp = self._client.get(uri, model=models.Bug)
return resp | [
"def",
"get_bug_by_id",
"(",
"self",
",",
"bug_id",
")",
":",
"uri",
"=",
"'{base}/bugs/{bug_id}'",
".",
"format",
"(",
"base",
"=",
"self",
".",
"BASE_URI",
",",
"bug_id",
"=",
"bug_id",
")",
"resp",
"=",
"self",
".",
"_client",
".",
"get",
"(",
"uri"... | Retrieves a single bug by it's Launchpad bug_id
:param bug_id: The Launchpad id for the bug. | [
"Retrieves",
"a",
"single",
"bug",
"by",
"it",
"s",
"Launchpad",
"bug_id"
] | 4d58b45e49ad9ba9e95f8c106d5c49e1658a69a7 | https://github.com/jmvrbanac/lplight/blob/4d58b45e49ad9ba9e95f8c106d5c49e1658a69a7/lplight/client.py#L87-L95 |
250,988 | ramrod-project/database-brain | schema/brain/jobs.py | transition | def transition(prior_state, next_state):
"""
Transitions to a non-standard state
Raises InvalidStateTransition if next_state is not allowed.
:param prior_state: <str>
:param next_state: <str>
:return: <str>
"""
if next_state not in STATES[prior_state][TRANSITION]:
acceptable = ... | python | def transition(prior_state, next_state):
"""
Transitions to a non-standard state
Raises InvalidStateTransition if next_state is not allowed.
:param prior_state: <str>
:param next_state: <str>
:return: <str>
"""
if next_state not in STATES[prior_state][TRANSITION]:
acceptable = ... | [
"def",
"transition",
"(",
"prior_state",
",",
"next_state",
")",
":",
"if",
"next_state",
"not",
"in",
"STATES",
"[",
"prior_state",
"]",
"[",
"TRANSITION",
"]",
":",
"acceptable",
"=",
"STATES",
"[",
"prior_state",
"]",
"[",
"TRANSITION",
"]",
"err",
"=",... | Transitions to a non-standard state
Raises InvalidStateTransition if next_state is not allowed.
:param prior_state: <str>
:param next_state: <str>
:return: <str> | [
"Transitions",
"to",
"a",
"non",
"-",
"standard",
"state"
] | b024cb44f34cabb9d80af38271ddb65c25767083 | https://github.com/ramrod-project/database-brain/blob/b024cb44f34cabb9d80af38271ddb65c25767083/schema/brain/jobs.py#L135-L152 |
250,989 | jabbas/pynapi | pynapi/services/napiprojekt.py | Napiprojekt.get | def get(self, filename):
""" returns subtitles as string """
params = {
"v": 'dreambox',
"kolejka": "false",
"nick": "",
"pass": "",
"napios": sys.platform,
"l": self.language.upper(),
"f": self.prepareHash(filename),... | python | def get(self, filename):
""" returns subtitles as string """
params = {
"v": 'dreambox',
"kolejka": "false",
"nick": "",
"pass": "",
"napios": sys.platform,
"l": self.language.upper(),
"f": self.prepareHash(filename),... | [
"def",
"get",
"(",
"self",
",",
"filename",
")",
":",
"params",
"=",
"{",
"\"v\"",
":",
"'dreambox'",
",",
"\"kolejka\"",
":",
"\"false\"",
",",
"\"nick\"",
":",
"\"\"",
",",
"\"pass\"",
":",
"\"\"",
",",
"\"napios\"",
":",
"sys",
".",
"platform",
",",... | returns subtitles as string | [
"returns",
"subtitles",
"as",
"string"
] | d9b3b4d9cd05501c14fe5cc5903b1c21e1905753 | https://github.com/jabbas/pynapi/blob/d9b3b4d9cd05501c14fe5cc5903b1c21e1905753/pynapi/services/napiprojekt.py#L21-L51 |
250,990 | jabbas/pynapi | pynapi/services/napiprojekt.py | Napiprojekt.discombobulate | def discombobulate(self, filehash):
""" prepare napiprojekt scrambled hash """
idx = [0xe, 0x3, 0x6, 0x8, 0x2]
mul = [2, 2, 5, 4, 3]
add = [0, 0xd, 0x10, 0xb, 0x5]
b = []
for i in xrange(len(idx)):
a = add[i]
m = mul[i]
i = idx[i]
... | python | def discombobulate(self, filehash):
""" prepare napiprojekt scrambled hash """
idx = [0xe, 0x3, 0x6, 0x8, 0x2]
mul = [2, 2, 5, 4, 3]
add = [0, 0xd, 0x10, 0xb, 0x5]
b = []
for i in xrange(len(idx)):
a = add[i]
m = mul[i]
i = idx[i]
... | [
"def",
"discombobulate",
"(",
"self",
",",
"filehash",
")",
":",
"idx",
"=",
"[",
"0xe",
",",
"0x3",
",",
"0x6",
",",
"0x8",
",",
"0x2",
"]",
"mul",
"=",
"[",
"2",
",",
"2",
",",
"5",
",",
"4",
",",
"3",
"]",
"add",
"=",
"[",
"0",
",",
"0... | prepare napiprojekt scrambled hash | [
"prepare",
"napiprojekt",
"scrambled",
"hash"
] | d9b3b4d9cd05501c14fe5cc5903b1c21e1905753 | https://github.com/jabbas/pynapi/blob/d9b3b4d9cd05501c14fe5cc5903b1c21e1905753/pynapi/services/napiprojekt.py#L53-L70 |
250,991 | ploneintranet/ploneintranet.workspace | src/ploneintranet/workspace/browser/forms.py | user_has_email | def user_has_email(username):
""" make sure, that given user has an email associated """
user = api.user.get(username=username)
if not user.getProperty("email"):
msg = _(
"This user doesn't have an email associated "
"with their account."
)
raise Invalid(msg)
... | python | def user_has_email(username):
""" make sure, that given user has an email associated """
user = api.user.get(username=username)
if not user.getProperty("email"):
msg = _(
"This user doesn't have an email associated "
"with their account."
)
raise Invalid(msg)
... | [
"def",
"user_has_email",
"(",
"username",
")",
":",
"user",
"=",
"api",
".",
"user",
".",
"get",
"(",
"username",
"=",
"username",
")",
"if",
"not",
"user",
".",
"getProperty",
"(",
"\"email\"",
")",
":",
"msg",
"=",
"_",
"(",
"\"This user doesn't have a... | make sure, that given user has an email associated | [
"make",
"sure",
"that",
"given",
"user",
"has",
"an",
"email",
"associated"
] | a4fc7a5c61f9c6d4d4ad25478ff5250f342ffbba | https://github.com/ploneintranet/ploneintranet.workspace/blob/a4fc7a5c61f9c6d4d4ad25478ff5250f342ffbba/src/ploneintranet/workspace/browser/forms.py#L19-L29 |
250,992 | ploneintranet/ploneintranet.workspace | src/ploneintranet/workspace/browser/forms.py | workspaces_provider | def workspaces_provider(context):
"""
create a vocab of all workspaces in this site
"""
catalog = api.portal.get_tool(name="portal_catalog")
workspaces = catalog(portal_type="ploneintranet.workspace.workspacefolder")
current = api.content.get_uuid(context)
terms = []
for ws in workspace... | python | def workspaces_provider(context):
"""
create a vocab of all workspaces in this site
"""
catalog = api.portal.get_tool(name="portal_catalog")
workspaces = catalog(portal_type="ploneintranet.workspace.workspacefolder")
current = api.content.get_uuid(context)
terms = []
for ws in workspace... | [
"def",
"workspaces_provider",
"(",
"context",
")",
":",
"catalog",
"=",
"api",
".",
"portal",
".",
"get_tool",
"(",
"name",
"=",
"\"portal_catalog\"",
")",
"workspaces",
"=",
"catalog",
"(",
"portal_type",
"=",
"\"ploneintranet.workspace.workspacefolder\"",
")",
"... | create a vocab of all workspaces in this site | [
"create",
"a",
"vocab",
"of",
"all",
"workspaces",
"in",
"this",
"site"
] | a4fc7a5c61f9c6d4d4ad25478ff5250f342ffbba | https://github.com/ploneintranet/ploneintranet.workspace/blob/a4fc7a5c61f9c6d4d4ad25478ff5250f342ffbba/src/ploneintranet/workspace/browser/forms.py#L32-L46 |
250,993 | Aslan11/wilos-cli | wilos/writers.py | Stdout.live_weather | def live_weather(self, live_weather):
"""Prints the live weather in a pretty format"""
summary = live_weather['currently']['summary']
self.summary(summary)
click.echo() | python | def live_weather(self, live_weather):
"""Prints the live weather in a pretty format"""
summary = live_weather['currently']['summary']
self.summary(summary)
click.echo() | [
"def",
"live_weather",
"(",
"self",
",",
"live_weather",
")",
":",
"summary",
"=",
"live_weather",
"[",
"'currently'",
"]",
"[",
"'summary'",
"]",
"self",
".",
"summary",
"(",
"summary",
")",
"click",
".",
"echo",
"(",
")"
] | Prints the live weather in a pretty format | [
"Prints",
"the",
"live",
"weather",
"in",
"a",
"pretty",
"format"
] | 2c3da3589f685e95b4f73237a1bfe56373ea4574 | https://github.com/Aslan11/wilos-cli/blob/2c3da3589f685e95b4f73237a1bfe56373ea4574/wilos/writers.py#L43-L47 |
250,994 | Aslan11/wilos-cli | wilos/writers.py | Stdout.title | def title(self, title):
"""Prints the title"""
title = " What's it like out side {0}? ".format(title)
click.secho("{:=^62}".format(title), fg=self.colors.WHITE)
click.echo() | python | def title(self, title):
"""Prints the title"""
title = " What's it like out side {0}? ".format(title)
click.secho("{:=^62}".format(title), fg=self.colors.WHITE)
click.echo() | [
"def",
"title",
"(",
"self",
",",
"title",
")",
":",
"title",
"=",
"\" What's it like out side {0}? \"",
".",
"format",
"(",
"title",
")",
"click",
".",
"secho",
"(",
"\"{:=^62}\"",
".",
"format",
"(",
"title",
")",
",",
"fg",
"=",
"self",
".",
"colors",... | Prints the title | [
"Prints",
"the",
"title"
] | 2c3da3589f685e95b4f73237a1bfe56373ea4574 | https://github.com/Aslan11/wilos-cli/blob/2c3da3589f685e95b4f73237a1bfe56373ea4574/wilos/writers.py#L49-L53 |
250,995 | henrysher/kotocore | kotocore/loader.py | ResourceJSONLoader.get_available_options | def get_available_options(self, service_name):
"""
Fetches a collection of all JSON files for a given service.
This checks user-created files (if present) as well as including the
default service files.
Example::
>>> loader.get_available_options('s3')
{... | python | def get_available_options(self, service_name):
"""
Fetches a collection of all JSON files for a given service.
This checks user-created files (if present) as well as including the
default service files.
Example::
>>> loader.get_available_options('s3')
{... | [
"def",
"get_available_options",
"(",
"self",
",",
"service_name",
")",
":",
"options",
"=",
"{",
"}",
"for",
"data_dir",
"in",
"self",
".",
"data_dirs",
":",
"# Traverse all the directories trying to find the best match.",
"service_glob",
"=",
"\"{0}-*.json\"",
".",
"... | Fetches a collection of all JSON files for a given service.
This checks user-created files (if present) as well as including the
default service files.
Example::
>>> loader.get_available_options('s3')
{
'2013-11-27': [
'~/.boto-overr... | [
"Fetches",
"a",
"collection",
"of",
"all",
"JSON",
"files",
"for",
"a",
"given",
"service",
"."
] | c52d2f3878b924ceabca07f61c91abcb1b230ecc | https://github.com/henrysher/kotocore/blob/c52d2f3878b924ceabca07f61c91abcb1b230ecc/kotocore/loader.py#L54-L104 |
250,996 | henrysher/kotocore | kotocore/loader.py | ResourceJSONLoader.get_best_match | def get_best_match(self, options, service_name, api_version=None):
"""
Given a collection of possible service options, selects the best match.
If no API version is provided, the path to the most recent API version
will be returned. If an API version is provided & there is an exact
... | python | def get_best_match(self, options, service_name, api_version=None):
"""
Given a collection of possible service options, selects the best match.
If no API version is provided, the path to the most recent API version
will be returned. If an API version is provided & there is an exact
... | [
"def",
"get_best_match",
"(",
"self",
",",
"options",
",",
"service_name",
",",
"api_version",
"=",
"None",
")",
":",
"if",
"not",
"options",
":",
"msg",
"=",
"\"No JSON files provided. Please check your \"",
"+",
"\"configuration/install.\"",
"raise",
"NoResourceJSON... | Given a collection of possible service options, selects the best match.
If no API version is provided, the path to the most recent API version
will be returned. If an API version is provided & there is an exact
match, the path to that version will be returned. If there is no exact
match... | [
"Given",
"a",
"collection",
"of",
"possible",
"service",
"options",
"selects",
"the",
"best",
"match",
"."
] | c52d2f3878b924ceabca07f61c91abcb1b230ecc | https://github.com/henrysher/kotocore/blob/c52d2f3878b924ceabca07f61c91abcb1b230ecc/kotocore/loader.py#L106-L158 |
250,997 | mbodenhamer/syn.utils | syn/utils/cmdargs/args.py | render_args | def render_args(arglst, argdct):
'''Render arguments for command-line invocation.
arglst: A list of Argument objects (specifies order)
argdct: A mapping of argument names to values (specifies rendered values)
'''
out = ''
for arg in arglst:
if arg.name in argdct:
render... | python | def render_args(arglst, argdct):
'''Render arguments for command-line invocation.
arglst: A list of Argument objects (specifies order)
argdct: A mapping of argument names to values (specifies rendered values)
'''
out = ''
for arg in arglst:
if arg.name in argdct:
render... | [
"def",
"render_args",
"(",
"arglst",
",",
"argdct",
")",
":",
"out",
"=",
"''",
"for",
"arg",
"in",
"arglst",
":",
"if",
"arg",
".",
"name",
"in",
"argdct",
":",
"rendered",
"=",
"arg",
".",
"render",
"(",
"argdct",
"[",
"arg",
".",
"name",
"]",
... | Render arguments for command-line invocation.
arglst: A list of Argument objects (specifies order)
argdct: A mapping of argument names to values (specifies rendered values) | [
"Render",
"arguments",
"for",
"command",
"-",
"line",
"invocation",
"."
] | 82b0dfa27d08858e802a166a44870db10a02a964 | https://github.com/mbodenhamer/syn.utils/blob/82b0dfa27d08858e802a166a44870db10a02a964/syn/utils/cmdargs/args.py#L155-L170 |
250,998 | jut-io/jut-python-tools | jut/api/integrations.py | get_webhook_url | def get_webhook_url(deployment_name,
space='default',
data_source='webhook',
token_manager=None,
app_url=defaults.APP_URL,
**fields):
"""
return the webhook URL for posting webhook data to
"""
import_ur... | python | def get_webhook_url(deployment_name,
space='default',
data_source='webhook',
token_manager=None,
app_url=defaults.APP_URL,
**fields):
"""
return the webhook URL for posting webhook data to
"""
import_ur... | [
"def",
"get_webhook_url",
"(",
"deployment_name",
",",
"space",
"=",
"'default'",
",",
"data_source",
"=",
"'webhook'",
",",
"token_manager",
"=",
"None",
",",
"app_url",
"=",
"defaults",
".",
"APP_URL",
",",
"*",
"*",
"fields",
")",
":",
"import_url",
"=",
... | return the webhook URL for posting webhook data to | [
"return",
"the",
"webhook",
"URL",
"for",
"posting",
"webhook",
"data",
"to"
] | 65574d23f51a7bbced9bb25010d02da5ca5d906f | https://github.com/jut-io/jut-python-tools/blob/65574d23f51a7bbced9bb25010d02da5ca5d906f/jut/api/integrations.py#L11-L33 |
250,999 | knagra/farnsworth | farnswiki/templatetags/truncatehtml.py | truncatehtml | def truncatehtml(string, length, ellipsis='...'):
"""Truncate HTML string, preserving tag structure and character entities."""
length = int(length)
output_length = 0
i = 0
pending_close_tags = {}
while output_length < length and i < len(string):
c = string[i]
if c == '<':
... | python | def truncatehtml(string, length, ellipsis='...'):
"""Truncate HTML string, preserving tag structure and character entities."""
length = int(length)
output_length = 0
i = 0
pending_close_tags = {}
while output_length < length and i < len(string):
c = string[i]
if c == '<':
... | [
"def",
"truncatehtml",
"(",
"string",
",",
"length",
",",
"ellipsis",
"=",
"'...'",
")",
":",
"length",
"=",
"int",
"(",
"length",
")",
"output_length",
"=",
"0",
"i",
"=",
"0",
"pending_close_tags",
"=",
"{",
"}",
"while",
"output_length",
"<",
"length"... | Truncate HTML string, preserving tag structure and character entities. | [
"Truncate",
"HTML",
"string",
"preserving",
"tag",
"structure",
"and",
"character",
"entities",
"."
] | 1b6589f0d9fea154f0a1e2231ed906764ed26d26 | https://github.com/knagra/farnsworth/blob/1b6589f0d9fea154f0a1e2231ed906764ed26d26/farnswiki/templatetags/truncatehtml.py#L12-L75 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.