repository_name stringlengths 7 55 | func_path_in_repository stringlengths 4 223 | func_name stringlengths 1 134 | whole_func_string stringlengths 75 104k | language stringclasses 1
value | func_code_string stringlengths 75 104k | func_code_tokens listlengths 19 28.4k | func_documentation_string stringlengths 1 46.9k | func_documentation_tokens listlengths 1 1.97k | split_name stringclasses 1
value | func_code_url stringlengths 87 315 |
|---|---|---|---|---|---|---|---|---|---|---|
sassoo/goldman | goldman/queryparams/filter.py | _validate_param | def _validate_param(param): # pylint: disable=too-many-branches
""" Ensure the filter cast properly according to the operator """
detail = None
if param.oper not in goldman.config.QUERY_FILTERS:
detail = 'The query filter {} is not a supported ' \
'operator. Please change {} & re... | python | def _validate_param(param): # pylint: disable=too-many-branches
""" Ensure the filter cast properly according to the operator """
detail = None
if param.oper not in goldman.config.QUERY_FILTERS:
detail = 'The query filter {} is not a supported ' \
'operator. Please change {} & re... | [
"def",
"_validate_param",
"(",
"param",
")",
":",
"# pylint: disable=too-many-branches",
"detail",
"=",
"None",
"if",
"param",
".",
"oper",
"not",
"in",
"goldman",
".",
"config",
".",
"QUERY_FILTERS",
":",
"detail",
"=",
"'The query filter {} is not a supported '",
... | Ensure the filter cast properly according to the operator | [
"Ensure",
"the",
"filter",
"cast",
"properly",
"according",
"to",
"the",
"operator"
] | train | https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/queryparams/filter.py#L215-L276 |
sassoo/goldman | goldman/queryparams/filter.py | init | def init(req, model):
""" Return an array of Filter objects. """
fields = model.all_fields
rels = model.relationships
params = []
for key, val in req.params.items():
try:
field, oper = _parse_param(key)
except (TypeError, ValueError):
continue
try:
... | python | def init(req, model):
""" Return an array of Filter objects. """
fields = model.all_fields
rels = model.relationships
params = []
for key, val in req.params.items():
try:
field, oper = _parse_param(key)
except (TypeError, ValueError):
continue
try:
... | [
"def",
"init",
"(",
"req",
",",
"model",
")",
":",
"fields",
"=",
"model",
".",
"all_fields",
"rels",
"=",
"model",
".",
"relationships",
"params",
"=",
"[",
"]",
"for",
"key",
",",
"val",
"in",
"req",
".",
"params",
".",
"items",
"(",
")",
":",
... | Return an array of Filter objects. | [
"Return",
"an",
"array",
"of",
"Filter",
"objects",
"."
] | train | https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/queryparams/filter.py#L279-L321 |
MinchinWeb/colourettu | make_release.py | other_dependancies | def other_dependancies(server, environment):
"""Installs things that need to be in place before installing the main package"""
server = server.lower()
# Pillow is not on TestPyPI
if server is "local":
pass
elif server in ["testpypi", "pypitest"]:
print(" **Install Pillow**")
... | python | def other_dependancies(server, environment):
"""Installs things that need to be in place before installing the main package"""
server = server.lower()
# Pillow is not on TestPyPI
if server is "local":
pass
elif server in ["testpypi", "pypitest"]:
print(" **Install Pillow**")
... | [
"def",
"other_dependancies",
"(",
"server",
",",
"environment",
")",
":",
"server",
"=",
"server",
".",
"lower",
"(",
")",
"# Pillow is not on TestPyPI",
"if",
"server",
"is",
"\"local\"",
":",
"pass",
"elif",
"server",
"in",
"[",
"\"testpypi\"",
",",
"\"pypit... | Installs things that need to be in place before installing the main package | [
"Installs",
"things",
"that",
"need",
"to",
"be",
"in",
"place",
"before",
"installing",
"the",
"main",
"package"
] | train | https://github.com/MinchinWeb/colourettu/blob/f0b2f6b1d44055f3ccee62ac2759829f1e16a252/make_release.py#L72-L84 |
MinchinWeb/colourettu | make_release.py | git_check | def git_check():
"""Check for uncomitted changes"""
git_status = subprocess.check_output(['git', 'status', '--porcelain'])
if len(git_status) is 0:
print(Fore.GREEN + 'All changes committed' + Style.RESET_ALL)
else:
exit(Fore.RED + 'Please commit all files to continue') | python | def git_check():
"""Check for uncomitted changes"""
git_status = subprocess.check_output(['git', 'status', '--porcelain'])
if len(git_status) is 0:
print(Fore.GREEN + 'All changes committed' + Style.RESET_ALL)
else:
exit(Fore.RED + 'Please commit all files to continue') | [
"def",
"git_check",
"(",
")",
":",
"git_status",
"=",
"subprocess",
".",
"check_output",
"(",
"[",
"'git'",
",",
"'status'",
",",
"'--porcelain'",
"]",
")",
"if",
"len",
"(",
"git_status",
")",
"is",
"0",
":",
"print",
"(",
"Fore",
".",
"GREEN",
"+",
... | Check for uncomitted changes | [
"Check",
"for",
"uncomitted",
"changes"
] | train | https://github.com/MinchinWeb/colourettu/blob/f0b2f6b1d44055f3ccee62ac2759829f1e16a252/make_release.py#L100-L106 |
MinchinWeb/colourettu | make_release.py | update_version_number | def update_version_number(update_level='patch'):
"""Update version number
Returns a semantic_version object"""
"""Find current version"""
temp_file = version_file().parent / ("~" + version_file().name)
with open(str(temp_file), 'w') as g:
with open(str(version_file()), 'r') as f:
... | python | def update_version_number(update_level='patch'):
"""Update version number
Returns a semantic_version object"""
"""Find current version"""
temp_file = version_file().parent / ("~" + version_file().name)
with open(str(temp_file), 'w') as g:
with open(str(version_file()), 'r') as f:
... | [
"def",
"update_version_number",
"(",
"update_level",
"=",
"'patch'",
")",
":",
"\"\"\"Find current version\"\"\"",
"temp_file",
"=",
"version_file",
"(",
")",
".",
"parent",
"/",
"(",
"\"~\"",
"+",
"version_file",
"(",
")",
".",
"name",
")",
"with",
"open",
"(... | Update version number
Returns a semantic_version object | [
"Update",
"version",
"number"
] | train | https://github.com/MinchinWeb/colourettu/blob/f0b2f6b1d44055f3ccee62ac2759829f1e16a252/make_release.py#L125-L168 |
MinchinWeb/colourettu | make_release.py | add_release_to_changelog | def add_release_to_changelog(version):
"""Add release line at the top of the first list it finds
Assumes your changelog in managed with `releases`"""
temp_file = changelog_file().parent / ("~" + changelog_file().name)
now = datetime.today()
release_added = False
with open(str(temp_file), 'w') a... | python | def add_release_to_changelog(version):
"""Add release line at the top of the first list it finds
Assumes your changelog in managed with `releases`"""
temp_file = changelog_file().parent / ("~" + changelog_file().name)
now = datetime.today()
release_added = False
with open(str(temp_file), 'w') a... | [
"def",
"add_release_to_changelog",
"(",
"version",
")",
":",
"temp_file",
"=",
"changelog_file",
"(",
")",
".",
"parent",
"/",
"(",
"\"~\"",
"+",
"changelog_file",
"(",
")",
".",
"name",
")",
"now",
"=",
"datetime",
".",
"today",
"(",
")",
"release_added",... | Add release line at the top of the first list it finds
Assumes your changelog in managed with `releases` | [
"Add",
"release",
"line",
"at",
"the",
"top",
"of",
"the",
"first",
"list",
"it",
"finds"
] | train | https://github.com/MinchinWeb/colourettu/blob/f0b2f6b1d44055f3ccee62ac2759829f1e16a252/make_release.py#L171-L196 |
MinchinWeb/colourettu | make_release.py | run_sphinx | def run_sphinx():
"""Runs Sphinx via it's `make html` command"""
old_dir = here_directory()
os.chdir(str(doc_directory()))
doc_status = subprocess.check_call(['make', 'html'], shell=True)
os.chdir(str(old_dir)) # go back to former working directory
if doc_status is not 0:
exit(Fore.RED ... | python | def run_sphinx():
"""Runs Sphinx via it's `make html` command"""
old_dir = here_directory()
os.chdir(str(doc_directory()))
doc_status = subprocess.check_call(['make', 'html'], shell=True)
os.chdir(str(old_dir)) # go back to former working directory
if doc_status is not 0:
exit(Fore.RED ... | [
"def",
"run_sphinx",
"(",
")",
":",
"old_dir",
"=",
"here_directory",
"(",
")",
"os",
".",
"chdir",
"(",
"str",
"(",
"doc_directory",
"(",
")",
")",
")",
"doc_status",
"=",
"subprocess",
".",
"check_call",
"(",
"[",
"'make'",
",",
"'html'",
"]",
",",
... | Runs Sphinx via it's `make html` command | [
"Runs",
"Sphinx",
"via",
"it",
"s",
"make",
"html",
"command"
] | train | https://github.com/MinchinWeb/colourettu/blob/f0b2f6b1d44055f3ccee62ac2759829f1e16a252/make_release.py#L199-L206 |
rosenbrockc/acorn | acorn/logging/database.py | list_tasks | def list_tasks(target=None):
"""Returns a list of all the projects and tasks available in the `acorn`
database directory.
Args:
target (str): directory to list the projects for. Defaults to the configured
database directory.
Returns:
dict: keys are project names; values a... | python | def list_tasks(target=None):
"""Returns a list of all the projects and tasks available in the `acorn`
database directory.
Args:
target (str): directory to list the projects for. Defaults to the configured
database directory.
Returns:
dict: keys are project names; values a... | [
"def",
"list_tasks",
"(",
"target",
"=",
"None",
")",
":",
"from",
"os",
"import",
"getcwd",
",",
"chdir",
"from",
"glob",
"import",
"glob",
"original",
"=",
"getcwd",
"(",
")",
"if",
"target",
"is",
"None",
":",
"# pragma: no cover",
"target",
"=",
"_db... | Returns a list of all the projects and tasks available in the `acorn`
database directory.
Args:
target (str): directory to list the projects for. Defaults to the configured
database directory.
Returns:
dict: keys are project names; values are lists of tasks associated with th... | [
"Returns",
"a",
"list",
"of",
"all",
"the",
"projects",
"and",
"tasks",
"available",
"in",
"the",
"acorn",
"database",
"directory",
"."
] | train | https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/logging/database.py#L48-L77 |
rosenbrockc/acorn | acorn/logging/database.py | set_task | def set_task(project_, task_):
"""Sets the active project and task. All subsequent logging will be saved to
the database with that project and task.
Args:
project_ (str): active project name; a project can have multiple tasks.
task_ (str): active task name. Logging is separated at the proje... | python | def set_task(project_, task_):
"""Sets the active project and task. All subsequent logging will be saved to
the database with that project and task.
Args:
project_ (str): active project name; a project can have multiple tasks.
task_ (str): active task name. Logging is separated at the proje... | [
"def",
"set_task",
"(",
"project_",
",",
"task_",
")",
":",
"global",
"project",
",",
"task",
"project",
"=",
"project_",
"task",
"=",
"task_",
"msg",
".",
"okay",
"(",
"\"Set project name to {}.{}\"",
".",
"format",
"(",
"project",
",",
"task",
")",
",",
... | Sets the active project and task. All subsequent logging will be saved to
the database with that project and task.
Args:
project_ (str): active project name; a project can have multiple tasks.
task_ (str): active task name. Logging is separated at the project and task
level. | [
"Sets",
"the",
"active",
"project",
"and",
"task",
".",
"All",
"subsequent",
"logging",
"will",
"be",
"saved",
"to",
"the",
"database",
"with",
"that",
"project",
"and",
"task",
"."
] | train | https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/logging/database.py#L79-L91 |
rosenbrockc/acorn | acorn/logging/database.py | cleanup | def cleanup():
"""Saves all the open databases to JSON so that the kernel can be shut down
without losing in-memory collections.
"""
failed = {}
success = []
for dbname, db in dbs.items():
try:
#Force the database save, even if the time hasn't elapsed yet.
db.save... | python | def cleanup():
"""Saves all the open databases to JSON so that the kernel can be shut down
without losing in-memory collections.
"""
failed = {}
success = []
for dbname, db in dbs.items():
try:
#Force the database save, even if the time hasn't elapsed yet.
db.save... | [
"def",
"cleanup",
"(",
")",
":",
"failed",
"=",
"{",
"}",
"success",
"=",
"[",
"]",
"for",
"dbname",
",",
"db",
"in",
"dbs",
".",
"items",
"(",
")",
":",
"try",
":",
"#Force the database save, even if the time hasn't elapsed yet.",
"db",
".",
"save",
"(",
... | Saves all the open databases to JSON so that the kernel can be shut down
without losing in-memory collections. | [
"Saves",
"all",
"the",
"open",
"databases",
"to",
"JSON",
"so",
"that",
"the",
"kernel",
"can",
"be",
"shut",
"down",
"without",
"losing",
"in",
"-",
"memory",
"collections",
"."
] | train | https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/logging/database.py#L106-L127 |
rosenbrockc/acorn | acorn/logging/database.py | tracker | def tracker(obj):
"""Returns the :class:`Instance` of the specified object if it is one that
we track by default.
Args:
obj (object): any python object passed as an argument to a method.
Returns:
Instance: if the object is trackable, the Instance instance of
that object; else... | python | def tracker(obj):
"""Returns the :class:`Instance` of the specified object if it is one that
we track by default.
Args:
obj (object): any python object passed as an argument to a method.
Returns:
Instance: if the object is trackable, the Instance instance of
that object; else... | [
"def",
"tracker",
"(",
"obj",
")",
":",
"import",
"types",
"as",
"typ",
"global",
"oids",
",",
"uuids",
"import",
"six",
"from",
"inspect",
"import",
"isclass",
"untracked",
"=",
"(",
"six",
".",
"string_types",
",",
"six",
".",
"integer_types",
",",
"fl... | Returns the :class:`Instance` of the specified object if it is one that
we track by default.
Args:
obj (object): any python object passed as an argument to a method.
Returns:
Instance: if the object is trackable, the Instance instance of
that object; else None. | [
"Returns",
"the",
":",
"class",
":",
"Instance",
"of",
"the",
"specified",
"object",
"if",
"it",
"is",
"one",
"that",
"we",
"track",
"by",
"default",
"."
] | train | https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/logging/database.py#L129-L210 |
rosenbrockc/acorn | acorn/logging/database.py | _dbdir | def _dbdir():
"""Returns the path to the directory where acorn DBs are stored.
"""
global dbdir
from os import mkdir, path, getcwd, chdir
if dbdir is None:
from acorn.config import settings
config = settings("acorn")
if (config.has_section("database") and
con... | python | def _dbdir():
"""Returns the path to the directory where acorn DBs are stored.
"""
global dbdir
from os import mkdir, path, getcwd, chdir
if dbdir is None:
from acorn.config import settings
config = settings("acorn")
if (config.has_section("database") and
con... | [
"def",
"_dbdir",
"(",
")",
":",
"global",
"dbdir",
"from",
"os",
"import",
"mkdir",
",",
"path",
",",
"getcwd",
",",
"chdir",
"if",
"dbdir",
"is",
"None",
":",
"from",
"acorn",
".",
"config",
"import",
"settings",
"config",
"=",
"settings",
"(",
"\"aco... | Returns the path to the directory where acorn DBs are stored. | [
"Returns",
"the",
"path",
"to",
"the",
"directory",
"where",
"acorn",
"DBs",
"are",
"stored",
"."
] | train | https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/logging/database.py#L212-L238 |
rosenbrockc/acorn | acorn/logging/database.py | _json_clean | def _json_clean(d):
"""Cleans the specified python `dict` by converting any tuple keys to
strings so that they can be serialized by JSON.
Args:
d (dict): python dictionary to clean up.
Returns:
dict: cleaned-up dictionary.
"""
result = {}
compkeys = {}
for k, v in d.ite... | python | def _json_clean(d):
"""Cleans the specified python `dict` by converting any tuple keys to
strings so that they can be serialized by JSON.
Args:
d (dict): python dictionary to clean up.
Returns:
dict: cleaned-up dictionary.
"""
result = {}
compkeys = {}
for k, v in d.ite... | [
"def",
"_json_clean",
"(",
"d",
")",
":",
"result",
"=",
"{",
"}",
"compkeys",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"d",
".",
"items",
"(",
")",
":",
"if",
"not",
"isinstance",
"(",
"k",
",",
"tuple",
")",
":",
"result",
"[",
"k",
"]",
... | Cleans the specified python `dict` by converting any tuple keys to
strings so that they can be serialized by JSON.
Args:
d (dict): python dictionary to clean up.
Returns:
dict: cleaned-up dictionary. | [
"Cleans",
"the",
"specified",
"python",
"dict",
"by",
"converting",
"any",
"tuple",
"keys",
"to",
"strings",
"so",
"that",
"they",
"can",
"be",
"serialized",
"by",
"JSON",
"."
] | train | https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/logging/database.py#L240-L263 |
rosenbrockc/acorn | acorn/logging/database.py | save_image | def save_image(byteio, imgfmt):
"""Saves the specified image to disk.
Args:
byteio (bytes): image bytes to save to disk.
imgfmt (str): used as the extension of the saved file.
Returns:
str: a uuid for the saved image that can be added to the database entry.
"""
from os impo... | python | def save_image(byteio, imgfmt):
"""Saves the specified image to disk.
Args:
byteio (bytes): image bytes to save to disk.
imgfmt (str): used as the extension of the saved file.
Returns:
str: a uuid for the saved image that can be added to the database entry.
"""
from os impo... | [
"def",
"save_image",
"(",
"byteio",
",",
"imgfmt",
")",
":",
"from",
"os",
"import",
"path",
",",
"mkdir",
"ptdir",
"=",
"\"{}.{}\"",
".",
"format",
"(",
"project",
",",
"task",
")",
"uuid",
"=",
"str",
"(",
"uuid4",
"(",
")",
")",
"#Save the image wit... | Saves the specified image to disk.
Args:
byteio (bytes): image bytes to save to disk.
imgfmt (str): used as the extension of the saved file.
Returns:
str: a uuid for the saved image that can be added to the database entry. | [
"Saves",
"the",
"specified",
"image",
"to",
"disk",
"."
] | train | https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/logging/database.py#L265-L288 |
rosenbrockc/acorn | acorn/logging/database.py | active_db | def active_db():
"""Returns the active :class:`TaskDB` for the current project and task.
"""
global dbs
# The task database is encapsulated in a class for easier serialization to
# JSON. Get the DB for the (project, task) combination.
dbkey = (project, task)
if dbkey in dbs:
taskdb =... | python | def active_db():
"""Returns the active :class:`TaskDB` for the current project and task.
"""
global dbs
# The task database is encapsulated in a class for easier serialization to
# JSON. Get the DB for the (project, task) combination.
dbkey = (project, task)
if dbkey in dbs:
taskdb =... | [
"def",
"active_db",
"(",
")",
":",
"global",
"dbs",
"# The task database is encapsulated in a class for easier serialization to",
"# JSON. Get the DB for the (project, task) combination.",
"dbkey",
"=",
"(",
"project",
",",
"task",
")",
"if",
"dbkey",
"in",
"dbs",
":",
"tas... | Returns the active :class:`TaskDB` for the current project and task. | [
"Returns",
"the",
"active",
":",
"class",
":",
"TaskDB",
"for",
"the",
"current",
"project",
"and",
"task",
"."
] | train | https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/logging/database.py#L290-L304 |
rosenbrockc/acorn | acorn/logging/database.py | record | def record(ekey, entry, diff=False):
"""Records the specified entry to the key-value store under the specified
entity key.
Args:
ekey (str): fqdn/uuid of the method/object to store the entry for.
entry (dict): attributes and values gleaned from the execution.
diff (bool): when True,... | python | def record(ekey, entry, diff=False):
"""Records the specified entry to the key-value store under the specified
entity key.
Args:
ekey (str): fqdn/uuid of the method/object to store the entry for.
entry (dict): attributes and values gleaned from the execution.
diff (bool): when True,... | [
"def",
"record",
"(",
"ekey",
",",
"entry",
",",
"diff",
"=",
"False",
")",
":",
"taskdb",
"=",
"active_db",
"(",
")",
"taskdb",
".",
"record",
"(",
"ekey",
",",
"entry",
",",
"diff",
")",
"# The task database save method makes sure that we only save as often as... | Records the specified entry to the key-value store under the specified
entity key.
Args:
ekey (str): fqdn/uuid of the method/object to store the entry for.
entry (dict): attributes and values gleaned from the execution.
diff (bool): when True, the "c" element of `entry` will be diffed
... | [
"Records",
"the",
"specified",
"entry",
"to",
"the",
"key",
"-",
"value",
"store",
"under",
"the",
"specified",
"entity",
"key",
"."
] | train | https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/logging/database.py#L306-L321 |
rosenbrockc/acorn | acorn/logging/database.py | TaskDB.log_uuid | def log_uuid(self, uuid):
"""Logs the object with the specified `uuid` to `self.uuids` if
possible.
Args:
uuid (str): string value of :meth:`uuid.uuid4` value for the
object.
"""
#We only need to try and describe an object once; if it is already in
... | python | def log_uuid(self, uuid):
"""Logs the object with the specified `uuid` to `self.uuids` if
possible.
Args:
uuid (str): string value of :meth:`uuid.uuid4` value for the
object.
"""
#We only need to try and describe an object once; if it is already in
... | [
"def",
"log_uuid",
"(",
"self",
",",
"uuid",
")",
":",
"#We only need to try and describe an object once; if it is already in",
"#our database, then just move along.",
"if",
"uuid",
"not",
"in",
"self",
".",
"uuids",
"and",
"uuid",
"in",
"uuids",
":",
"self",
".",
"uu... | Logs the object with the specified `uuid` to `self.uuids` if
possible.
Args:
uuid (str): string value of :meth:`uuid.uuid4` value for the
object. | [
"Logs",
"the",
"object",
"with",
"the",
"specified",
"uuid",
"to",
"self",
".",
"uuids",
"if",
"possible",
"."
] | train | https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/logging/database.py#L350-L361 |
rosenbrockc/acorn | acorn/logging/database.py | TaskDB.record | def record(self, ekey, entry, diff=False):
"""Records the specified entry to the key-value store under the specified
entity key.
Args:
ekey (str): fqdn/uuid of the method/object to store the entry for.
entry (dict): attributes and values gleaned from the execution.
... | python | def record(self, ekey, entry, diff=False):
"""Records the specified entry to the key-value store under the specified
entity key.
Args:
ekey (str): fqdn/uuid of the method/object to store the entry for.
entry (dict): attributes and values gleaned from the execution.
... | [
"def",
"record",
"(",
"self",
",",
"ekey",
",",
"entry",
",",
"diff",
"=",
"False",
")",
":",
"if",
"ekey",
"not",
"in",
"self",
".",
"entities",
":",
"self",
".",
"entities",
"[",
"ekey",
"]",
"=",
"[",
"]",
"#See if we need to diff the code to compress... | Records the specified entry to the key-value store under the specified
entity key.
Args:
ekey (str): fqdn/uuid of the method/object to store the entry for.
entry (dict): attributes and values gleaned from the execution.
diff (bool): when True, the "c" element of `ent... | [
"Records",
"the",
"specified",
"entry",
"to",
"the",
"key",
"-",
"value",
"store",
"under",
"the",
"specified",
"entity",
"key",
"."
] | train | https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/logging/database.py#L363-L436 |
rosenbrockc/acorn | acorn/logging/database.py | TaskDB.get_option | def get_option(option, default=None, cast=None):
"""Returns the option value for the specified acorn database option.
"""
from acorn.config import settings
config = settings("acorn")
if (config.has_section("database") and
config.has_option("database", option)):
... | python | def get_option(option, default=None, cast=None):
"""Returns the option value for the specified acorn database option.
"""
from acorn.config import settings
config = settings("acorn")
if (config.has_section("database") and
config.has_option("database", option)):
... | [
"def",
"get_option",
"(",
"option",
",",
"default",
"=",
"None",
",",
"cast",
"=",
"None",
")",
":",
"from",
"acorn",
".",
"config",
"import",
"settings",
"config",
"=",
"settings",
"(",
"\"acorn\"",
")",
"if",
"(",
"config",
".",
"has_section",
"(",
"... | Returns the option value for the specified acorn database option. | [
"Returns",
"the",
"option",
"value",
"for",
"the",
"specified",
"acorn",
"database",
"option",
"."
] | train | https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/logging/database.py#L439-L452 |
rosenbrockc/acorn | acorn/logging/database.py | TaskDB.load | def load(self):
"""Deserializes the database from disk.
"""
#We load the database even when it is not configured to be
#writable. After all, the user may decide part-way through a session to
#begin writing again, and then we would want a history up to that point
#to be va... | python | def load(self):
"""Deserializes the database from disk.
"""
#We load the database even when it is not configured to be
#writable. After all, the user may decide part-way through a session to
#begin writing again, and then we would want a history up to that point
#to be va... | [
"def",
"load",
"(",
"self",
")",
":",
"#We load the database even when it is not configured to be",
"#writable. After all, the user may decide part-way through a session to",
"#begin writing again, and then we would want a history up to that point",
"#to be valid.",
"from",
"os",
"import",
... | Deserializes the database from disk. | [
"Deserializes",
"the",
"database",
"from",
"disk",
"."
] | train | https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/logging/database.py#L454-L467 |
rosenbrockc/acorn | acorn/logging/database.py | TaskDB.save | def save(self, force=False):
"""Serializes the database file to disk.
Args:
force (bool): when True, the elapsed time since last save is ignored
and the database is saved anyway (subject to global
:data:`writeable` setting).
"""
from time impo... | python | def save(self, force=False):
"""Serializes the database file to disk.
Args:
force (bool): when True, the elapsed time since last save is ignored
and the database is saved anyway (subject to global
:data:`writeable` setting).
"""
from time impo... | [
"def",
"save",
"(",
"self",
",",
"force",
"=",
"False",
")",
":",
"from",
"time",
"import",
"time",
"# Since the DBs can get rather large, we don't want to save them every",
"# single time a method is called. Instead, we only save them at the",
"# frequency specified in the global se... | Serializes the database file to disk.
Args:
force (bool): when True, the elapsed time since last save is ignored
and the database is saved anyway (subject to global
:data:`writeable` setting). | [
"Serializes",
"the",
"database",
"file",
"to",
"disk",
"."
] | train | https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/logging/database.py#L469-L514 |
rosenbrockc/acorn | acorn/logging/database.py | Instance.describe | def describe(self):
"""Returns a dictionary describing the object based on its type.
"""
result = {}
#Because we created an Instance object, we already know that this object
#is not one of the regular built-in types (except, perhaps, for list,
#dict and set objects that c... | python | def describe(self):
"""Returns a dictionary describing the object based on its type.
"""
result = {}
#Because we created an Instance object, we already know that this object
#is not one of the regular built-in types (except, perhaps, for list,
#dict and set objects that c... | [
"def",
"describe",
"(",
"self",
")",
":",
"result",
"=",
"{",
"}",
"#Because we created an Instance object, we already know that this object",
"#is not one of the regular built-in types (except, perhaps, for list,",
"#dict and set objects that can have their tracking turned on).",
"#For ob... | Returns a dictionary describing the object based on its type. | [
"Returns",
"a",
"dictionary",
"describing",
"the",
"object",
"based",
"on",
"its",
"type",
"."
] | train | https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/logging/database.py#L533-L545 |
noirbizarre/minibench | minibench/_compat.py | load_module | def load_module(name, filename):
'''Load a module into name given its filename'''
if sys.version_info < (3, 5):
import imp
import warnings
with warnings.catch_warnings(): # Required for Python 2.7
warnings.simplefilter("ignore", RuntimeWarning)
return imp.load_so... | python | def load_module(name, filename):
'''Load a module into name given its filename'''
if sys.version_info < (3, 5):
import imp
import warnings
with warnings.catch_warnings(): # Required for Python 2.7
warnings.simplefilter("ignore", RuntimeWarning)
return imp.load_so... | [
"def",
"load_module",
"(",
"name",
",",
"filename",
")",
":",
"if",
"sys",
".",
"version_info",
"<",
"(",
"3",
",",
"5",
")",
":",
"import",
"imp",
"import",
"warnings",
"with",
"warnings",
".",
"catch_warnings",
"(",
")",
":",
"# Required for Python 2.7",... | Load a module into name given its filename | [
"Load",
"a",
"module",
"into",
"name",
"given",
"its",
"filename"
] | train | https://github.com/noirbizarre/minibench/blob/a1ac66dc075181c62bb3c0d3a26beb5c46d5f4ab/minibench/_compat.py#L11-L22 |
SeabornGames/Meta | seaborn_meta/calling_function.py | function_arguments | def function_arguments(func):
"""
This returns a list of all arguments
:param func: callable object
:return: list of str of the arguments for the function
"""
if getattr(inspect, 'signature', None) is None:
return list(inspect.getargspec(func).args)
else:
return list(inspect.... | python | def function_arguments(func):
"""
This returns a list of all arguments
:param func: callable object
:return: list of str of the arguments for the function
"""
if getattr(inspect, 'signature', None) is None:
return list(inspect.getargspec(func).args)
else:
return list(inspect.... | [
"def",
"function_arguments",
"(",
"func",
")",
":",
"if",
"getattr",
"(",
"inspect",
",",
"'signature'",
",",
"None",
")",
"is",
"None",
":",
"return",
"list",
"(",
"inspect",
".",
"getargspec",
"(",
"func",
")",
".",
"args",
")",
"else",
":",
"return"... | This returns a list of all arguments
:param func: callable object
:return: list of str of the arguments for the function | [
"This",
"returns",
"a",
"list",
"of",
"all",
"arguments",
":",
"param",
"func",
":",
"callable",
"object",
":",
"return",
":",
"list",
"of",
"str",
"of",
"the",
"arguments",
"for",
"the",
"function"
] | train | https://github.com/SeabornGames/Meta/blob/f2a38ad8bcc5ac177e537645853593225895df46/seaborn_meta/calling_function.py#L13-L22 |
SeabornGames/Meta | seaborn_meta/calling_function.py | function_defaults | def function_defaults(func):
"""
This returns a list of the default arguments
:param func: callable object
:return: list of obj of default parameters
"""
if getattr(inspect, 'signature',None) is None:
return inspect.getargspec(func)[-1] or []
else:
return [v.default for k... | python | def function_defaults(func):
"""
This returns a list of the default arguments
:param func: callable object
:return: list of obj of default parameters
"""
if getattr(inspect, 'signature',None) is None:
return inspect.getargspec(func)[-1] or []
else:
return [v.default for k... | [
"def",
"function_defaults",
"(",
"func",
")",
":",
"if",
"getattr",
"(",
"inspect",
",",
"'signature'",
",",
"None",
")",
"is",
"None",
":",
"return",
"inspect",
".",
"getargspec",
"(",
"func",
")",
"[",
"-",
"1",
"]",
"or",
"[",
"]",
"else",
":",
... | This returns a list of the default arguments
:param func: callable object
:return: list of obj of default parameters | [
"This",
"returns",
"a",
"list",
"of",
"the",
"default",
"arguments",
":",
"param",
"func",
":",
"callable",
"object",
":",
"return",
":",
"list",
"of",
"obj",
"of",
"default",
"parameters"
] | train | https://github.com/SeabornGames/Meta/blob/f2a38ad8bcc5ac177e537645853593225895df46/seaborn_meta/calling_function.py#L25-L36 |
SeabornGames/Meta | seaborn_meta/calling_function.py | function_doc | def function_doc(function_index=1, function_name=None):
"""
This will return the doc of the calling function
:param function_index: int of how many frames back the program should look
:param function_name: str of what function to look for
:return: str of the doc from the target function
"""
... | python | def function_doc(function_index=1, function_name=None):
"""
This will return the doc of the calling function
:param function_index: int of how many frames back the program should look
:param function_name: str of what function to look for
:return: str of the doc from the target function
"""
... | [
"def",
"function_doc",
"(",
"function_index",
"=",
"1",
",",
"function_name",
"=",
"None",
")",
":",
"frm",
"=",
"func_frame",
"(",
"function_index",
"+",
"1",
",",
"function_name",
")",
"try",
":",
"func",
"=",
"getattr",
"(",
"frm",
".",
"f_locals",
"[... | This will return the doc of the calling function
:param function_index: int of how many frames back the program should look
:param function_name: str of what function to look for
:return: str of the doc from the target function | [
"This",
"will",
"return",
"the",
"doc",
"of",
"the",
"calling",
"function",
":",
"param",
"function_index",
":",
"int",
"of",
"how",
"many",
"frames",
"back",
"the",
"program",
"should",
"look",
":",
"param",
"function_name",
":",
"str",
"of",
"what",
"fun... | train | https://github.com/SeabornGames/Meta/blob/f2a38ad8bcc5ac177e537645853593225895df46/seaborn_meta/calling_function.py#L39-L51 |
SeabornGames/Meta | seaborn_meta/calling_function.py | function_path | def function_path(func):
"""
This will return the path to the calling function
:param func:
:return:
"""
if getattr(func, 'func_code', None):
return func.__code__.co_filename.replace('\\', '/')
else:
return func.__code__.co_filename.replace('\\', '/') | python | def function_path(func):
"""
This will return the path to the calling function
:param func:
:return:
"""
if getattr(func, 'func_code', None):
return func.__code__.co_filename.replace('\\', '/')
else:
return func.__code__.co_filename.replace('\\', '/') | [
"def",
"function_path",
"(",
"func",
")",
":",
"if",
"getattr",
"(",
"func",
",",
"'func_code'",
",",
"None",
")",
":",
"return",
"func",
".",
"__code__",
".",
"co_filename",
".",
"replace",
"(",
"'\\\\'",
",",
"'/'",
")",
"else",
":",
"return",
"func"... | This will return the path to the calling function
:param func:
:return: | [
"This",
"will",
"return",
"the",
"path",
"to",
"the",
"calling",
"function",
":",
"param",
"func",
":",
":",
"return",
":"
] | train | https://github.com/SeabornGames/Meta/blob/f2a38ad8bcc5ac177e537645853593225895df46/seaborn_meta/calling_function.py#L54-L63 |
SeabornGames/Meta | seaborn_meta/calling_function.py | file_code | def file_code(function_index=1, function_name=None):
"""
This will return the code of the calling function
function_index of 2 will give the parent of the caller
function_name should not be used with function_index
:param function_index: int of how many frames back the program should look
:para... | python | def file_code(function_index=1, function_name=None):
"""
This will return the code of the calling function
function_index of 2 will give the parent of the caller
function_name should not be used with function_index
:param function_index: int of how many frames back the program should look
:para... | [
"def",
"file_code",
"(",
"function_index",
"=",
"1",
",",
"function_name",
"=",
"None",
")",
":",
"info",
"=",
"function_info",
"(",
"function_index",
"+",
"1",
",",
"function_name",
")",
"with",
"open",
"(",
"info",
"[",
"'file'",
"]",
",",
"'r'",
")",
... | This will return the code of the calling function
function_index of 2 will give the parent of the caller
function_name should not be used with function_index
:param function_index: int of how many frames back the program should look
:param function_name: str of what function to look for
:return: st... | [
"This",
"will",
"return",
"the",
"code",
"of",
"the",
"calling",
"function",
"function_index",
"of",
"2",
"will",
"give",
"the",
"parent",
"of",
"the",
"caller",
"function_name",
"should",
"not",
"be",
"used",
"with",
"function_index"
] | train | https://github.com/SeabornGames/Meta/blob/f2a38ad8bcc5ac177e537645853593225895df46/seaborn_meta/calling_function.py#L66-L78 |
SeabornGames/Meta | seaborn_meta/calling_function.py | relevant_kwargs | def relevant_kwargs(function, exclude_keys='self', exclude_values=None,
extra_values=None):
"""
This will return a dictionary of local variables that are parameters to the
function provided in the arg.
Example:
function(**relevant_kwargs(function))
:param function: f... | python | def relevant_kwargs(function, exclude_keys='self', exclude_values=None,
extra_values=None):
"""
This will return a dictionary of local variables that are parameters to the
function provided in the arg.
Example:
function(**relevant_kwargs(function))
:param function: f... | [
"def",
"relevant_kwargs",
"(",
"function",
",",
"exclude_keys",
"=",
"'self'",
",",
"exclude_values",
"=",
"None",
",",
"extra_values",
"=",
"None",
")",
":",
"args",
"=",
"function_args",
"(",
"function",
")",
"locals_values",
"=",
"function_kwargs",
"(",
"fu... | This will return a dictionary of local variables that are parameters to the
function provided in the arg.
Example:
function(**relevant_kwargs(function))
:param function: function to select parameters for
:param exclude_keys: str,list,func if not a function it will be converted
... | [
"This",
"will",
"return",
"a",
"dictionary",
"of",
"local",
"variables",
"that",
"are",
"parameters",
"to",
"the",
"function",
"provided",
"in",
"the",
"arg",
"."
] | train | https://github.com/SeabornGames/Meta/blob/f2a38ad8bcc5ac177e537645853593225895df46/seaborn_meta/calling_function.py#L81-L102 |
SeabornGames/Meta | seaborn_meta/calling_function.py | function_kwargs | def function_kwargs(function_index=1, function_name=None,
exclude_keys='self', exclude_values=None):
"""
This will return a dict of the keyword
arguments of the function that calls it
:param function_index: int of how many frames back the program
should l... | python | def function_kwargs(function_index=1, function_name=None,
exclude_keys='self', exclude_values=None):
"""
This will return a dict of the keyword
arguments of the function that calls it
:param function_index: int of how many frames back the program
should l... | [
"def",
"function_kwargs",
"(",
"function_index",
"=",
"1",
",",
"function_name",
"=",
"None",
",",
"exclude_keys",
"=",
"'self'",
",",
"exclude_values",
"=",
"None",
")",
":",
"if",
"not",
"hasattr",
"(",
"exclude_values",
",",
"'__call__'",
")",
":",
"_excl... | This will return a dict of the keyword
arguments of the function that calls it
:param function_index: int of how many frames back the program
should look (2 will give the parent of the caller)
:param function_name: str of the function name (should not
... | [
"This",
"will",
"return",
"a",
"dict",
"of",
"the",
"keyword",
"arguments",
"of",
"the",
"function",
"that",
"calls",
"it",
":",
"param",
"function_index",
":",
"int",
"of",
"how",
"many",
"frames",
"back",
"the",
"program",
"should",
"look",
"(",
"2",
"... | train | https://github.com/SeabornGames/Meta/blob/f2a38ad8bcc5ac177e537645853593225895df46/seaborn_meta/calling_function.py#L117-L147 |
SeabornGames/Meta | seaborn_meta/calling_function.py | function_info | def function_info(function_index=1, function_name=None, line_number=None):
"""
This will return the class_name and function_name of the
function traced back two functions.
:param function_index: int of how many frames back the program
should look (2 will give the parent of t... | python | def function_info(function_index=1, function_name=None, line_number=None):
"""
This will return the class_name and function_name of the
function traced back two functions.
:param function_index: int of how many frames back the program
should look (2 will give the parent of t... | [
"def",
"function_info",
"(",
"function_index",
"=",
"1",
",",
"function_name",
"=",
"None",
",",
"line_number",
"=",
"None",
")",
":",
"frm",
"=",
"func_frame",
"(",
"function_index",
"+",
"1",
",",
"function_name",
")",
"file_",
"=",
"os",
".",
"path",
... | This will return the class_name and function_name of the
function traced back two functions.
:param function_index: int of how many frames back the program
should look (2 will give the parent of the caller)
:param function_name: str of what function to look for (should
... | [
"This",
"will",
"return",
"the",
"class_name",
"and",
"function_name",
"of",
"the",
"function",
"traced",
"back",
"two",
"functions",
"."
] | train | https://github.com/SeabornGames/Meta/blob/f2a38ad8bcc5ac177e537645853593225895df46/seaborn_meta/calling_function.py#L163-L202 |
SeabornGames/Meta | seaborn_meta/calling_function.py | function_history | def function_history():
"""
This will return a list of all function calls going back to the beginning
:return: list of str of function name
"""
ret = []
frm = inspect.currentframe()
for i in range(100):
try:
if frm.f_code.co_name != 'run_code': # this is pycharm debugger... | python | def function_history():
"""
This will return a list of all function calls going back to the beginning
:return: list of str of function name
"""
ret = []
frm = inspect.currentframe()
for i in range(100):
try:
if frm.f_code.co_name != 'run_code': # this is pycharm debugger... | [
"def",
"function_history",
"(",
")",
":",
"ret",
"=",
"[",
"]",
"frm",
"=",
"inspect",
".",
"currentframe",
"(",
")",
"for",
"i",
"in",
"range",
"(",
"100",
")",
":",
"try",
":",
"if",
"frm",
".",
"f_code",
".",
"co_name",
"!=",
"'run_code'",
":",
... | This will return a list of all function calls going back to the beginning
:return: list of str of function name | [
"This",
"will",
"return",
"a",
"list",
"of",
"all",
"function",
"calls",
"going",
"back",
"to",
"the",
"beginning",
":",
"return",
":",
"list",
"of",
"str",
"of",
"function",
"name"
] | train | https://github.com/SeabornGames/Meta/blob/f2a38ad8bcc5ac177e537645853593225895df46/seaborn_meta/calling_function.py#L205-L220 |
SeabornGames/Meta | seaborn_meta/calling_function.py | func_frame | def func_frame(function_index, function_name=None):
"""
This will return the class_name and function_name of the
function traced back two functions.
:param function_index: int of how many frames back the program
should look (2 will give the parent of the caller)
:param f... | python | def func_frame(function_index, function_name=None):
"""
This will return the class_name and function_name of the
function traced back two functions.
:param function_index: int of how many frames back the program
should look (2 will give the parent of the caller)
:param f... | [
"def",
"func_frame",
"(",
"function_index",
",",
"function_name",
"=",
"None",
")",
":",
"frm",
"=",
"inspect",
".",
"currentframe",
"(",
")",
"if",
"function_name",
"is",
"not",
"None",
":",
"function_name",
"=",
"function_name",
".",
"split",
"(",
"'*'",
... | This will return the class_name and function_name of the
function traced back two functions.
:param function_index: int of how many frames back the program
should look (2 will give the parent of the caller)
:param function_name: str of what function to look for (should
... | [
"This",
"will",
"return",
"the",
"class_name",
"and",
"function_name",
"of",
"the",
"function",
"traced",
"back",
"two",
"functions",
"."
] | train | https://github.com/SeabornGames/Meta/blob/f2a38ad8bcc5ac177e537645853593225895df46/seaborn_meta/calling_function.py#L223-L249 |
SeabornGames/Meta | seaborn_meta/calling_function.py | function_linenumber | def function_linenumber(function_index=1, function_name=None, width=5):
"""
This will return the line number of the indicated function in the stack
:param width:
:param function_index: int of how many frames back the program
should look (2 will give the parent of the caller)
... | python | def function_linenumber(function_index=1, function_name=None, width=5):
"""
This will return the line number of the indicated function in the stack
:param width:
:param function_index: int of how many frames back the program
should look (2 will give the parent of the caller)
... | [
"def",
"function_linenumber",
"(",
"function_index",
"=",
"1",
",",
"function_name",
"=",
"None",
",",
"width",
"=",
"5",
")",
":",
"frm",
"=",
"func_frame",
"(",
"function_index",
"+",
"1",
",",
"function_name",
")",
"if",
"width",
"is",
"None",
":",
"r... | This will return the line number of the indicated function in the stack
:param width:
:param function_index: int of how many frames back the program
should look (2 will give the parent of the caller)
:param function_name: str of what function to look for (should
... | [
"This",
"will",
"return",
"the",
"line",
"number",
"of",
"the",
"indicated",
"function",
"in",
"the",
"stack",
":",
"param",
"width",
":",
":",
"param",
"function_index",
":",
"int",
"of",
"how",
"many",
"frames",
"back",
"the",
"program",
"should",
"look"... | train | https://github.com/SeabornGames/Meta/blob/f2a38ad8bcc5ac177e537645853593225895df46/seaborn_meta/calling_function.py#L252-L265 |
SeabornGames/Meta | seaborn_meta/calling_function.py | trace_error | def trace_error(function_index=2):
"""
This will return the line number and line text of the last error
:param function_index: int to tell what frame to look from
:return: int, str of the line number and line text
"""
info = function_info(function_index)
traces = traceback.format_stack(limit... | python | def trace_error(function_index=2):
"""
This will return the line number and line text of the last error
:param function_index: int to tell what frame to look from
:return: int, str of the line number and line text
"""
info = function_info(function_index)
traces = traceback.format_stack(limit... | [
"def",
"trace_error",
"(",
"function_index",
"=",
"2",
")",
":",
"info",
"=",
"function_info",
"(",
"function_index",
")",
"traces",
"=",
"traceback",
".",
"format_stack",
"(",
"limit",
"=",
"10",
")",
"for",
"trace",
"in",
"traces",
":",
"file_",
",",
"... | This will return the line number and line text of the last error
:param function_index: int to tell what frame to look from
:return: int, str of the line number and line text | [
"This",
"will",
"return",
"the",
"line",
"number",
"and",
"line",
"text",
"of",
"the",
"last",
"error",
":",
"param",
"function_index",
":",
"int",
"to",
"tell",
"what",
"frame",
"to",
"look",
"from",
":",
"return",
":",
"int",
"str",
"of",
"the",
"lin... | train | https://github.com/SeabornGames/Meta/blob/f2a38ad8bcc5ac177e537645853593225895df46/seaborn_meta/calling_function.py#L290-L303 |
dossier/dossier.models | dossier/models/dragnet.py | make_feature | def make_feature(fc):
'''Builds a new `StringCounter` from the many `StringCounters` in the
input `fc`. This StringCounter will define one of the targets for
the `MultinomialNB` classifier.
This crucial function decides the relative importance of features
extracted by the ETL pipeline. This is es... | python | def make_feature(fc):
'''Builds a new `StringCounter` from the many `StringCounters` in the
input `fc`. This StringCounter will define one of the targets for
the `MultinomialNB` classifier.
This crucial function decides the relative importance of features
extracted by the ETL pipeline. This is es... | [
"def",
"make_feature",
"(",
"fc",
")",
":",
"feat",
"=",
"StringCounter",
"(",
")",
"rejects",
"=",
"set",
"(",
")",
"keepers",
"=",
"set",
"(",
")",
"#keepers_keys = ['GPE', 'PERSON', 'ORGANIZATION', 'usernames']",
"keepers_keys",
"=",
"[",
"'phone'",
",",
"'em... | Builds a new `StringCounter` from the many `StringCounters` in the
input `fc`. This StringCounter will define one of the targets for
the `MultinomialNB` classifier.
This crucial function decides the relative importance of features
extracted by the ETL pipeline. This is essentially a form of
domai... | [
"Builds",
"a",
"new",
"StringCounter",
"from",
"the",
"many",
"StringCounters",
"in",
"the",
"input",
"fc",
".",
"This",
"StringCounter",
"will",
"define",
"one",
"of",
"the",
"targets",
"for",
"the",
"MultinomialNB",
"classifier",
"."
] | train | https://github.com/dossier/dossier.models/blob/c9e282f690eab72963926329efe1600709e48b13/dossier/models/dragnet.py#L46-L79 |
dossier/dossier.models | dossier/models/dragnet.py | worker | def worker(work_unit, max_sample=1000):
'''Expects a coordinate WorkUnit for DragNet and runs the following
steps:
1. scans all dossiers at the *folder* level and assembles feature
vectors for each folder -- see `make_feature`
2. trains a multinomial naive Bayes classifier that treats each
*fo... | python | def worker(work_unit, max_sample=1000):
'''Expects a coordinate WorkUnit for DragNet and runs the following
steps:
1. scans all dossiers at the *folder* level and assembles feature
vectors for each folder -- see `make_feature`
2. trains a multinomial naive Bayes classifier that treats each
*fo... | [
"def",
"worker",
"(",
"work_unit",
",",
"max_sample",
"=",
"1000",
")",
":",
"if",
"'config'",
"not",
"in",
"work_unit",
".",
"spec",
":",
"raise",
"coordinate",
".",
"exceptions",
".",
"ProgrammerError",
"(",
"'could not run dragnet without global config'",
")",
... | Expects a coordinate WorkUnit for DragNet and runs the following
steps:
1. scans all dossiers at the *folder* level and assembles feature
vectors for each folder -- see `make_feature`
2. trains a multinomial naive Bayes classifier that treats each
*folder* as a classifier target.
3. sample th... | [
"Expects",
"a",
"coordinate",
"WorkUnit",
"for",
"DragNet",
"and",
"runs",
"the",
"following",
"steps",
":"
] | train | https://github.com/dossier/dossier.models/blob/c9e282f690eab72963926329efe1600709e48b13/dossier/models/dragnet.py#L82-L215 |
fakedrake/overlay_parse | overlay_parse/util.py | rx_int_extra | def rx_int_extra(rxmatch):
"""
We didn't just match an int but the int is what we need.
"""
rxmatch = re.search("\d+", rxmatch.group(0))
return int(rxmatch.group(0)) | python | def rx_int_extra(rxmatch):
"""
We didn't just match an int but the int is what we need.
"""
rxmatch = re.search("\d+", rxmatch.group(0))
return int(rxmatch.group(0)) | [
"def",
"rx_int_extra",
"(",
"rxmatch",
")",
":",
"rxmatch",
"=",
"re",
".",
"search",
"(",
"\"\\d+\"",
",",
"rxmatch",
".",
"group",
"(",
"0",
")",
")",
"return",
"int",
"(",
"rxmatch",
".",
"group",
"(",
"0",
")",
")"
] | We didn't just match an int but the int is what we need. | [
"We",
"didn",
"t",
"just",
"match",
"an",
"int",
"but",
"the",
"int",
"is",
"what",
"we",
"need",
"."
] | train | https://github.com/fakedrake/overlay_parse/blob/9ac362d6aef1ea41aff7375af088c6ebef93d0cd/overlay_parse/util.py#L42-L48 |
collectiveacuity/labPack | labpack/encryption/cryptolab.py | encrypt | def encrypt(byte_data, secret_key=''):
'''
uses cryptography module to encrypt byte data
cipher: AES (128 bit block_size)
hash: sha512
key size: 256 bit (first 32 bytes of secret key hash)
vector size: 128 bit (next 16 bytes of secret key hash)
padding: PKCS7... | python | def encrypt(byte_data, secret_key=''):
'''
uses cryptography module to encrypt byte data
cipher: AES (128 bit block_size)
hash: sha512
key size: 256 bit (first 32 bytes of secret key hash)
vector size: 128 bit (next 16 bytes of secret key hash)
padding: PKCS7... | [
"def",
"encrypt",
"(",
"byte_data",
",",
"secret_key",
"=",
"''",
")",
":",
"# validate input\r",
"if",
"not",
"isinstance",
"(",
"byte_data",
",",
"bytes",
")",
":",
"raise",
"TypeError",
"(",
"'\\nbyte data input must be a byte datatype.'",
")",
"# validate secret... | uses cryptography module to encrypt byte data
cipher: AES (128 bit block_size)
hash: sha512
key size: 256 bit (first 32 bytes of secret key hash)
vector size: 128 bit (next 16 bytes of secret key hash)
padding: PKCS7
cipher mode: CBC
backend: openssl 1.0.2a... | [
"uses",
"cryptography",
"module",
"to",
"encrypt",
"byte",
"data",
"cipher",
":",
"AES",
"(",
"128",
"bit",
"block_size",
")",
"hash",
":",
"sha512",
"key",
"size",
":",
"256",
"bit",
"(",
"first",
"32",
"bytes",
"of",
"secret",
"key",
"hash",
")",
"ve... | train | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/encryption/cryptolab.py#L35-L88 |
collectiveacuity/labPack | labpack/encryption/cryptolab.py | decrypt | def decrypt(encrypted_data, secret_key):
'''
uses cryptography module to decrypt byte data
cipher: AES (128 bit block_size)
hash: sha512
key size: 256 bit (first 32 bytes of secret key hash)
vector size: 128 bit (next 16 bytes of secret key hash)
padding: PKC... | python | def decrypt(encrypted_data, secret_key):
'''
uses cryptography module to decrypt byte data
cipher: AES (128 bit block_size)
hash: sha512
key size: 256 bit (first 32 bytes of secret key hash)
vector size: 128 bit (next 16 bytes of secret key hash)
padding: PKC... | [
"def",
"decrypt",
"(",
"encrypted_data",
",",
"secret_key",
")",
":",
"# validate input\r",
"if",
"not",
"isinstance",
"(",
"encrypted_data",
",",
"bytes",
")",
":",
"raise",
"TypeError",
"(",
"'\\nbyte data input must be byte datatype.'",
")",
"elif",
"not",
"isins... | uses cryptography module to decrypt byte data
cipher: AES (128 bit block_size)
hash: sha512
key size: 256 bit (first 32 bytes of secret key hash)
vector size: 128 bit (next 16 bytes of secret key hash)
padding: PKCS7
cipher mode: CBC
backend: openssl 1.0.2a... | [
"uses",
"cryptography",
"module",
"to",
"decrypt",
"byte",
"data",
"cipher",
":",
"AES",
"(",
"128",
"bit",
"block_size",
")",
"hash",
":",
"sha512",
"key",
"size",
":",
"256",
"bit",
"(",
"first",
"32",
"bytes",
"of",
"secret",
"key",
"hash",
")",
"ve... | train | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/encryption/cryptolab.py#L90-L131 |
lambdalisue/django-roughpages | src/roughpages/backends/decorators.py | prepare_filename_decorator | def prepare_filename_decorator(fn):
"""
A decorator of `prepare_filename` method
1. It automatically assign `settings.ROUGHPAGES_INDEX_FILENAME` if the
`normalized_url` is ''.
2. It automatically assign file extensions to the output list.
"""
@wraps(fn)
def inner(self, normalized_url... | python | def prepare_filename_decorator(fn):
"""
A decorator of `prepare_filename` method
1. It automatically assign `settings.ROUGHPAGES_INDEX_FILENAME` if the
`normalized_url` is ''.
2. It automatically assign file extensions to the output list.
"""
@wraps(fn)
def inner(self, normalized_url... | [
"def",
"prepare_filename_decorator",
"(",
"fn",
")",
":",
"@",
"wraps",
"(",
"fn",
")",
"def",
"inner",
"(",
"self",
",",
"normalized_url",
",",
"request",
")",
":",
"ext",
"=",
"settings",
".",
"ROUGHPAGES_TEMPLATE_FILE_EXT",
"if",
"not",
"normalized_url",
... | A decorator of `prepare_filename` method
1. It automatically assign `settings.ROUGHPAGES_INDEX_FILENAME` if the
`normalized_url` is ''.
2. It automatically assign file extensions to the output list. | [
"A",
"decorator",
"of",
"prepare_filename",
"method"
] | train | https://github.com/lambdalisue/django-roughpages/blob/f6a2724ece729c5deced2c2546d172561ef785ec/src/roughpages/backends/decorators.py#L9-L25 |
praekelt/panya | panya/templatetags/panya_template_tags.py | smart_query_string | def smart_query_string(parser, token):
"""
Outputs current GET query string with additions appended.
Additions are provided in token pairs.
"""
args = token.split_contents()
additions = args[1:]
addition_pairs = []
while additions:
addition_pairs.append(additions[0:2])
... | python | def smart_query_string(parser, token):
"""
Outputs current GET query string with additions appended.
Additions are provided in token pairs.
"""
args = token.split_contents()
additions = args[1:]
addition_pairs = []
while additions:
addition_pairs.append(additions[0:2])
... | [
"def",
"smart_query_string",
"(",
"parser",
",",
"token",
")",
":",
"args",
"=",
"token",
".",
"split_contents",
"(",
")",
"additions",
"=",
"args",
"[",
"1",
":",
"]",
"addition_pairs",
"=",
"[",
"]",
"while",
"additions",
":",
"addition_pairs",
".",
"a... | Outputs current GET query string with additions appended.
Additions are provided in token pairs. | [
"Outputs",
"current",
"GET",
"query",
"string",
"with",
"additions",
"appended",
".",
"Additions",
"are",
"provided",
"in",
"token",
"pairs",
"."
] | train | https://github.com/praekelt/panya/blob/0fd621e15a7c11a2716a9554a2f820d6259818e5/panya/templatetags/panya_template_tags.py#L12-L25 |
Zaeb0s/max-threads | maxthreads/maxthreads.py | MaxThreads.add_task | def add_task(self, target, args=(), kwargs=None, priority=None):
"""
Args:
target: A callable object to be invoked
args: Arguments sent to the callable object upon invocation
kwargs: Keyword arguments sent to the callable object upon invocation
priority: D... | python | def add_task(self, target, args=(), kwargs=None, priority=None):
"""
Args:
target: A callable object to be invoked
args: Arguments sent to the callable object upon invocation
kwargs: Keyword arguments sent to the callable object upon invocation
priority: D... | [
"def",
"add_task",
"(",
"self",
",",
"target",
",",
"args",
"=",
"(",
")",
",",
"kwargs",
"=",
"None",
",",
"priority",
"=",
"None",
")",
":",
"if",
"self",
".",
"_stop",
":",
"raise",
"RuntimeError",
"(",
"\"Can't add new task, the MaxThreads object is in c... | Args:
target: A callable object to be invoked
args: Arguments sent to the callable object upon invocation
kwargs: Keyword arguments sent to the callable object upon invocation
priority: Determines where to put the callable object in the list of tasks, Can be any type of o... | [
"Args",
":",
"target",
":",
"A",
"callable",
"object",
"to",
"be",
"invoked",
"args",
":",
"Arguments",
"sent",
"to",
"the",
"callable",
"object",
"upon",
"invocation",
"kwargs",
":",
"Keyword",
"arguments",
"sent",
"to",
"the",
"callable",
"object",
"upon",... | train | https://github.com/Zaeb0s/max-threads/blob/dce4ae784aa1c07fdb910359c0099907047403f9/maxthreads/maxthreads.py#L107-L141 |
Zaeb0s/max-threads | maxthreads/maxthreads.py | MaxThreads.start_thread | def start_thread(self, target, args=(), kwargs=None, priority=0):
""" To make sure applications work with the old name
"""
return self.add_task(target, args, kwargs, priority) | python | def start_thread(self, target, args=(), kwargs=None, priority=0):
""" To make sure applications work with the old name
"""
return self.add_task(target, args, kwargs, priority) | [
"def",
"start_thread",
"(",
"self",
",",
"target",
",",
"args",
"=",
"(",
")",
",",
"kwargs",
"=",
"None",
",",
"priority",
"=",
"0",
")",
":",
"return",
"self",
".",
"add_task",
"(",
"target",
",",
"args",
",",
"kwargs",
",",
"priority",
")"
] | To make sure applications work with the old name | [
"To",
"make",
"sure",
"applications",
"work",
"with",
"the",
"old",
"name"
] | train | https://github.com/Zaeb0s/max-threads/blob/dce4ae784aa1c07fdb910359c0099907047403f9/maxthreads/maxthreads.py#L143-L146 |
Zaeb0s/max-threads | maxthreads/maxthreads.py | MaxThreads.stop | def stop(self, block=True):
""" Stops all active threads and rejects new tasks to be added
Args:
block (bool): If True, block until all threads are closed
"""
self._stop = True
# Removing tasks in queue
self.empty_queue()
# All active threads
... | python | def stop(self, block=True):
""" Stops all active threads and rejects new tasks to be added
Args:
block (bool): If True, block until all threads are closed
"""
self._stop = True
# Removing tasks in queue
self.empty_queue()
# All active threads
... | [
"def",
"stop",
"(",
"self",
",",
"block",
"=",
"True",
")",
":",
"self",
".",
"_stop",
"=",
"True",
"# Removing tasks in queue",
"self",
".",
"empty_queue",
"(",
")",
"# All active threads",
"# With the DoNothing function",
"# Because self._stop is True each thread will... | Stops all active threads and rejects new tasks to be added
Args:
block (bool): If True, block until all threads are closed | [
"Stops",
"all",
"active",
"threads",
"and",
"rejects",
"new",
"tasks",
"to",
"be",
"added",
"Args",
":",
"block",
"(",
"bool",
")",
":",
"If",
"True",
"block",
"until",
"all",
"threads",
"are",
"closed"
] | train | https://github.com/Zaeb0s/max-threads/blob/dce4ae784aa1c07fdb910359c0099907047403f9/maxthreads/maxthreads.py#L206-L228 |
dossier/dossier.models | dossier/models/query.py | list_projects | def list_projects(folders, folder = None, user = None):
'''List all folders or all subfolders of a folder.
If folder is provided, this method will output a list of subfolders
contained by it. Otherwise, a list of all top-level folders is produced.
:param folders: reference to folder.Folders instance
... | python | def list_projects(folders, folder = None, user = None):
'''List all folders or all subfolders of a folder.
If folder is provided, this method will output a list of subfolders
contained by it. Otherwise, a list of all top-level folders is produced.
:param folders: reference to folder.Folders instance
... | [
"def",
"list_projects",
"(",
"folders",
",",
"folder",
"=",
"None",
",",
"user",
"=",
"None",
")",
":",
"fid",
"=",
"None",
"if",
"folder",
"is",
"None",
"else",
"Folders",
".",
"name_to_id",
"(",
"folder",
")",
"# List all folders if none provided.",
"if",
... | List all folders or all subfolders of a folder.
If folder is provided, this method will output a list of subfolders
contained by it. Otherwise, a list of all top-level folders is produced.
:param folders: reference to folder.Folders instance
:param folder: folder name or None
:param user: optiona... | [
"List",
"all",
"folders",
"or",
"all",
"subfolders",
"of",
"a",
"folder",
"."
] | train | https://github.com/dossier/dossier.models/blob/c9e282f690eab72963926329efe1600709e48b13/dossier/models/query.py#L39-L64 |
slarse/clanimtk | clanimtk/util.py | get_supervisor | def get_supervisor(func: types.AnyFunction) -> types.Supervisor:
"""Get the appropriate supervisor to use and pre-apply the function.
Args:
func: A function.
"""
if not callable(func):
raise TypeError("func is not callable")
if asyncio.iscoroutinefunction(func):
supervisor =... | python | def get_supervisor(func: types.AnyFunction) -> types.Supervisor:
"""Get the appropriate supervisor to use and pre-apply the function.
Args:
func: A function.
"""
if not callable(func):
raise TypeError("func is not callable")
if asyncio.iscoroutinefunction(func):
supervisor =... | [
"def",
"get_supervisor",
"(",
"func",
":",
"types",
".",
"AnyFunction",
")",
"->",
"types",
".",
"Supervisor",
":",
"if",
"not",
"callable",
"(",
"func",
")",
":",
"raise",
"TypeError",
"(",
"\"func is not callable\"",
")",
"if",
"asyncio",
".",
"iscoroutine... | Get the appropriate supervisor to use and pre-apply the function.
Args:
func: A function. | [
"Get",
"the",
"appropriate",
"supervisor",
"to",
"use",
"and",
"pre",
"-",
"apply",
"the",
"function",
"."
] | train | https://github.com/slarse/clanimtk/blob/cb93d2e914c3ecc4e0007745ff4d546318cf3902/clanimtk/util.py#L23-L35 |
slarse/clanimtk | clanimtk/util.py | _async_supervisor | async def _async_supervisor(func, animation_, step, *args, **kwargs):
"""Supervisor for running an animation with an asynchronous function.
Args:
func: A function to be run alongside an animation.
animation_: An infinite generator that produces
strings for the animation.
step: S... | python | async def _async_supervisor(func, animation_, step, *args, **kwargs):
"""Supervisor for running an animation with an asynchronous function.
Args:
func: A function to be run alongside an animation.
animation_: An infinite generator that produces
strings for the animation.
step: S... | [
"async",
"def",
"_async_supervisor",
"(",
"func",
",",
"animation_",
",",
"step",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"with",
"ThreadPoolExecutor",
"(",
"max_workers",
"=",
"2",
")",
"as",
"pool",
":",
"with",
"_terminating_event",
"(",
... | Supervisor for running an animation with an asynchronous function.
Args:
func: A function to be run alongside an animation.
animation_: An infinite generator that produces
strings for the animation.
step: Seconds between each animation frame.
*args: Arguments for func.
... | [
"Supervisor",
"for",
"running",
"an",
"animation",
"with",
"an",
"asynchronous",
"function",
"."
] | train | https://github.com/slarse/clanimtk/blob/cb93d2e914c3ecc4e0007745ff4d546318cf3902/clanimtk/util.py#L52-L71 |
slarse/clanimtk | clanimtk/util.py | concatechain | def concatechain(*generators: types.FrameGenerator, separator: str = ''):
"""Return a generator that in each iteration takes one value from each of the
supplied generators, joins them together with the specified separator and
yields the result. Stops as soon as any iterator raises StopIteration and
retu... | python | def concatechain(*generators: types.FrameGenerator, separator: str = ''):
"""Return a generator that in each iteration takes one value from each of the
supplied generators, joins them together with the specified separator and
yields the result. Stops as soon as any iterator raises StopIteration and
retu... | [
"def",
"concatechain",
"(",
"*",
"generators",
":",
"types",
".",
"FrameGenerator",
",",
"separator",
":",
"str",
"=",
"''",
")",
":",
"while",
"True",
":",
"try",
":",
"next_",
"=",
"[",
"next",
"(",
"gen",
")",
"for",
"gen",
"in",
"generators",
"]"... | Return a generator that in each iteration takes one value from each of the
supplied generators, joins them together with the specified separator and
yields the result. Stops as soon as any iterator raises StopIteration and
returns the value contained in it.
Primarily created for chaining string generat... | [
"Return",
"a",
"generator",
"that",
"in",
"each",
"iteration",
"takes",
"one",
"value",
"from",
"each",
"of",
"the",
"supplied",
"generators",
"joins",
"them",
"together",
"with",
"the",
"specified",
"separator",
"and",
"yields",
"the",
"result",
".",
"Stops",... | train | https://github.com/slarse/clanimtk/blob/cb93d2e914c3ecc4e0007745ff4d546318cf3902/clanimtk/util.py#L94-L116 |
staticshock/scientist.py | scientist/experiment.py | Experiment.compare | def compare(self, control_result, experimental_result):
_compare = getattr(self, '_compare', lambda x, y: x == y)
"""
Return true if the results match.
"""
return (
# Mismatch if only one of the results returned an error, or if
# different types of errors ... | python | def compare(self, control_result, experimental_result):
_compare = getattr(self, '_compare', lambda x, y: x == y)
"""
Return true if the results match.
"""
return (
# Mismatch if only one of the results returned an error, or if
# different types of errors ... | [
"def",
"compare",
"(",
"self",
",",
"control_result",
",",
"experimental_result",
")",
":",
"_compare",
"=",
"getattr",
"(",
"self",
",",
"'_compare'",
",",
"lambda",
"x",
",",
"y",
":",
"x",
"==",
"y",
")",
"return",
"(",
"# Mismatch if only one of the resu... | Return true if the results match. | [
"Return",
"true",
"if",
"the",
"results",
"match",
"."
] | train | https://github.com/staticshock/scientist.py/blob/68ec0b57989d1f78614aa3b17ce196e2b53cfe25/scientist/experiment.py#L104-L114 |
colab/colab-superarchives-plugin | src/colab_superarchives/utils/mailman.py | send_create_list_email | def send_create_list_email(**kargs):
""" Send the notification mail
kargs' params:
user = User object
password = list's password
listname = list's name
"""
to = kargs.get('user', None)
if not to:
return
to = [to.email]
from_email = settings.COLAB_FROM_ADDRESS... | python | def send_create_list_email(**kargs):
""" Send the notification mail
kargs' params:
user = User object
password = list's password
listname = list's name
"""
to = kargs.get('user', None)
if not to:
return
to = [to.email]
from_email = settings.COLAB_FROM_ADDRESS... | [
"def",
"send_create_list_email",
"(",
"*",
"*",
"kargs",
")",
":",
"to",
"=",
"kargs",
".",
"get",
"(",
"'user'",
",",
"None",
")",
"if",
"not",
"to",
":",
"return",
"to",
"=",
"[",
"to",
".",
"email",
"]",
"from_email",
"=",
"settings",
".",
"COLA... | Send the notification mail
kargs' params:
user = User object
password = list's password
listname = list's name | [
"Send",
"the",
"notification",
"mail",
"kargs",
"params",
":",
"user",
"=",
"User",
"object",
"password",
"=",
"list",
"s",
"password",
"listname",
"=",
"list",
"s",
"name"
] | train | https://github.com/colab/colab-superarchives-plugin/blob/fe588a1d4fac874ccad2063ee19a857028a22721/src/colab_superarchives/utils/mailman.py#L43-L59 |
collectiveacuity/labPack | labpack/events/meetup.py | meetupClient.get_member_brief | def get_member_brief(self, member_id=0):
''' a method to retrieve member profile info
:param member_id: [optional] integer with member id from member profile
:return: dictionary with member profile inside [json] key
member_profile = self.objects.profile_brief.schema
''... | python | def get_member_brief(self, member_id=0):
''' a method to retrieve member profile info
:param member_id: [optional] integer with member id from member profile
:return: dictionary with member profile inside [json] key
member_profile = self.objects.profile_brief.schema
''... | [
"def",
"get_member_brief",
"(",
"self",
",",
"member_id",
"=",
"0",
")",
":",
"# https://www.meetup.com/meetup_api/docs/members/:member_id/#get\r",
"title",
"=",
"'%s.get_member_brief'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"# validate inputs\r",
"input_fields",
... | a method to retrieve member profile info
:param member_id: [optional] integer with member id from member profile
:return: dictionary with member profile inside [json] key
member_profile = self.objects.profile_brief.schema | [
"a",
"method",
"to",
"retrieve",
"member",
"profile",
"info",
":",
"param",
"member_id",
":",
"[",
"optional",
"]",
"integer",
"with",
"member",
"id",
"from",
"member",
"profile",
":",
"return",
":",
"dictionary",
"with",
"member",
"profile",
"inside",
"[",
... | train | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/events/meetup.py#L1082-L1134 |
collectiveacuity/labPack | labpack/events/meetup.py | meetupClient.get_member_profile | def get_member_profile(self, member_id):
''' a method to retrieve member profile details
:param member_id: integer with member id from member profile
:return: dictionary with member profile details inside [json] key
profile_details = self.objects.profile.schema
'''
... | python | def get_member_profile(self, member_id):
''' a method to retrieve member profile details
:param member_id: integer with member id from member profile
:return: dictionary with member profile details inside [json] key
profile_details = self.objects.profile.schema
'''
... | [
"def",
"get_member_profile",
"(",
"self",
",",
"member_id",
")",
":",
"# https://www.meetup.com/meetup_api/docs/members/:member_id/#get\r",
"title",
"=",
"'%s.get_member_profile'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"# validate inputs\r",
"input_fields",
"=",
"... | a method to retrieve member profile details
:param member_id: integer with member id from member profile
:return: dictionary with member profile details inside [json] key
profile_details = self.objects.profile.schema | [
"a",
"method",
"to",
"retrieve",
"member",
"profile",
"details",
":",
"param",
"member_id",
":",
"integer",
"with",
"member",
"id",
"from",
"member",
"profile",
":",
"return",
":",
"dictionary",
"with",
"member",
"profile",
"details",
"inside",
"[",
"json",
... | train | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/events/meetup.py#L1136-L1176 |
collectiveacuity/labPack | labpack/events/meetup.py | meetupClient.update_member_profile | def update_member_profile(self, brief_details, profile_details):
''' a method to update user profile details on meetup
:param brief_details: dictionary with member brief details with updated values
:param profile_details: dictionary with member profile details with updated values
... | python | def update_member_profile(self, brief_details, profile_details):
''' a method to update user profile details on meetup
:param brief_details: dictionary with member brief details with updated values
:param profile_details: dictionary with member profile details with updated values
... | [
"def",
"update_member_profile",
"(",
"self",
",",
"brief_details",
",",
"profile_details",
")",
":",
"# https://www.meetup.com/meetup_api/docs/members/:member_id/#edit\r",
"title",
"=",
"'%s.update_member_profile'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"# validate ... | a method to update user profile details on meetup
:param brief_details: dictionary with member brief details with updated values
:param profile_details: dictionary with member profile details with updated values
:return: dictionary with partial profile details inside [json] key | [
"a",
"method",
"to",
"update",
"user",
"profile",
"details",
"on",
"meetup",
":",
"param",
"brief_details",
":",
"dictionary",
"with",
"member",
"brief",
"details",
"with",
"updated",
"values",
":",
"param",
"profile_details",
":",
"dictionary",
"with",
"member"... | train | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/events/meetup.py#L1178-L1242 |
collectiveacuity/labPack | labpack/events/meetup.py | meetupClient.list_member_topics | def list_member_topics(self, member_id):
''' a method to retrieve a list of topics member follows
:param member_id: integer with meetup member id
:return: dictionary with list of topic details inside [json] key
topic_details = self.objects.topic.schema
'''
# htt... | python | def list_member_topics(self, member_id):
''' a method to retrieve a list of topics member follows
:param member_id: integer with meetup member id
:return: dictionary with list of topic details inside [json] key
topic_details = self.objects.topic.schema
'''
# htt... | [
"def",
"list_member_topics",
"(",
"self",
",",
"member_id",
")",
":",
"# https://www.meetup.com/meetup_api/docs/members/:member_id/#get\r",
"title",
"=",
"'%s.list_member_topics'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"# validate inputs\r",
"input_fields",
"=",
"... | a method to retrieve a list of topics member follows
:param member_id: integer with meetup member id
:return: dictionary with list of topic details inside [json] key
topic_details = self.objects.topic.schema | [
"a",
"method",
"to",
"retrieve",
"a",
"list",
"of",
"topics",
"member",
"follows",
":",
"param",
"member_id",
":",
"integer",
"with",
"meetup",
"member",
"id",
":",
"return",
":",
"dictionary",
"with",
"list",
"of",
"topic",
"details",
"inside",
"[",
"json... | train | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/events/meetup.py#L1244-L1294 |
collectiveacuity/labPack | labpack/events/meetup.py | meetupClient.list_member_groups | def list_member_groups(self, member_id):
''' a method to retrieve a list of meetup groups member belongs to
:param member_id: integer with meetup member id
:return: dictionary with list of group details in [json]
group_details = self.objects.group_profile.schema
'''
... | python | def list_member_groups(self, member_id):
''' a method to retrieve a list of meetup groups member belongs to
:param member_id: integer with meetup member id
:return: dictionary with list of group details in [json]
group_details = self.objects.group_profile.schema
'''
... | [
"def",
"list_member_groups",
"(",
"self",
",",
"member_id",
")",
":",
"# https://www.meetup.com/meetup_api/docs/members/:member_id/#get\r",
"title",
"=",
"'%s.list_member_groups'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"# validate inputs\r",
"input_fields",
"=",
"... | a method to retrieve a list of meetup groups member belongs to
:param member_id: integer with meetup member id
:return: dictionary with list of group details in [json]
group_details = self.objects.group_profile.schema | [
"a",
"method",
"to",
"retrieve",
"a",
"list",
"of",
"meetup",
"groups",
"member",
"belongs",
"to",
":",
"param",
"member_id",
":",
"integer",
"with",
"meetup",
"member",
"id",
":",
"return",
":",
"dictionary",
"with",
"list",
"of",
"group",
"details",
"in"... | train | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/events/meetup.py#L1296-L1346 |
collectiveacuity/labPack | labpack/events/meetup.py | meetupClient.list_member_events | def list_member_events(self, upcoming=True):
''' a method to retrieve a list of events member attended or will attend
:param upcoming: [optional] boolean to filter list to only future events
:return: dictionary with list of event details inside [json] key
event_details = self._... | python | def list_member_events(self, upcoming=True):
''' a method to retrieve a list of events member attended or will attend
:param upcoming: [optional] boolean to filter list to only future events
:return: dictionary with list of event details inside [json] key
event_details = self._... | [
"def",
"list_member_events",
"(",
"self",
",",
"upcoming",
"=",
"True",
")",
":",
"# https://www.meetup.com/meetup_api/docs/self/events/\r",
"# construct request fields\r",
"url",
"=",
"'%s/self/events'",
"%",
"self",
".",
"endpoint",
"params",
"=",
"{",
"'status'",
":"... | a method to retrieve a list of events member attended or will attend
:param upcoming: [optional] boolean to filter list to only future events
:return: dictionary with list of event details inside [json] key
event_details = self._reconstruct_event({}) | [
"a",
"method",
"to",
"retrieve",
"a",
"list",
"of",
"events",
"member",
"attended",
"or",
"will",
"attend",
":",
"param",
"upcoming",
":",
"[",
"optional",
"]",
"boolean",
"to",
"filter",
"list",
"to",
"only",
"future",
"events",
":",
"return",
":",
"dic... | train | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/events/meetup.py#L1348-L1382 |
collectiveacuity/labPack | labpack/events/meetup.py | meetupClient.get_member_calendar | def get_member_calendar(self, max_results=0):
''' a method to retrieve the upcoming events for all groups member belongs to
:param max_results: [optional] integer with number of events to include
:return: dictionary with list of event details inside [json] key
event_details = s... | python | def get_member_calendar(self, max_results=0):
''' a method to retrieve the upcoming events for all groups member belongs to
:param max_results: [optional] integer with number of events to include
:return: dictionary with list of event details inside [json] key
event_details = s... | [
"def",
"get_member_calendar",
"(",
"self",
",",
"max_results",
"=",
"0",
")",
":",
"# https://www.meetup.com/meetup_api/docs/self/calendar/#list\r",
"title",
"=",
"'%s.get_member_calendar'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"# validate inputs\r",
"input_field... | a method to retrieve the upcoming events for all groups member belongs to
:param max_results: [optional] integer with number of events to include
:return: dictionary with list of event details inside [json] key
event_details = self._reconstruct_event({}) | [
"a",
"method",
"to",
"retrieve",
"the",
"upcoming",
"events",
"for",
"all",
"groups",
"member",
"belongs",
"to",
":",
"param",
"max_results",
":",
"[",
"optional",
"]",
"integer",
"with",
"number",
"of",
"events",
"to",
"include",
":",
"return",
":",
"dict... | train | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/events/meetup.py#L1384-L1428 |
collectiveacuity/labPack | labpack/events/meetup.py | meetupClient.list_groups | def list_groups(self, topics=None, categories=None, text='', country_code='', latitude=0.0, longitude=0.0, location='', radius=0.0, zip_code='', max_results=0, member_groups=True):
''' a method to find meetup groups based upon a number of filters
:param topics: [optional] list of integer meetup id... | python | def list_groups(self, topics=None, categories=None, text='', country_code='', latitude=0.0, longitude=0.0, location='', radius=0.0, zip_code='', max_results=0, member_groups=True):
''' a method to find meetup groups based upon a number of filters
:param topics: [optional] list of integer meetup id... | [
"def",
"list_groups",
"(",
"self",
",",
"topics",
"=",
"None",
",",
"categories",
"=",
"None",
",",
"text",
"=",
"''",
",",
"country_code",
"=",
"''",
",",
"latitude",
"=",
"0.0",
",",
"longitude",
"=",
"0.0",
",",
"location",
"=",
"''",
",",
"radius... | a method to find meetup groups based upon a number of filters
:param topics: [optional] list of integer meetup ids for topics
:param text: [optional] string with words in groups to search
:param country_code: [optional] string with two character country code
:param latitude: [optio... | [
"a",
"method",
"to",
"find",
"meetup",
"groups",
"based",
"upon",
"a",
"number",
"of",
"filters",
":",
"param",
"topics",
":",
"[",
"optional",
"]",
"list",
"of",
"integer",
"meetup",
"ids",
"for",
"topics",
":",
"param",
"text",
":",
"[",
"optional",
... | train | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/events/meetup.py#L1430-L1513 |
collectiveacuity/labPack | labpack/events/meetup.py | meetupClient.get_group_details | def get_group_details(self, group_url='', group_id=0):
''' a method to retrieve details about a meetup group
:param group_url: string with meetup urlname of group
:param group_id: int with meetup id for group
:return: dictionary with group details inside [json] key
gro... | python | def get_group_details(self, group_url='', group_id=0):
''' a method to retrieve details about a meetup group
:param group_url: string with meetup urlname of group
:param group_id: int with meetup id for group
:return: dictionary with group details inside [json] key
gro... | [
"def",
"get_group_details",
"(",
"self",
",",
"group_url",
"=",
"''",
",",
"group_id",
"=",
"0",
")",
":",
"# https://www.meetup.com/meetup_api/docs/:urlname/#get\r",
"title",
"=",
"'%s.get_group_details'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"# validate i... | a method to retrieve details about a meetup group
:param group_url: string with meetup urlname of group
:param group_id: int with meetup id for group
:return: dictionary with group details inside [json] key
group_details = self._reconstruct_group(**{}) | [
"a",
"method",
"to",
"retrieve",
"details",
"about",
"a",
"meetup",
"group",
":",
"param",
"group_url",
":",
"string",
"with",
"meetup",
"urlname",
"of",
"group",
":",
"param",
"group_id",
":",
"int",
"with",
"meetup",
"id",
"for",
"group",
":",
"return",
... | train | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/events/meetup.py#L1515-L1559 |
collectiveacuity/labPack | labpack/events/meetup.py | meetupClient.list_group_events | def list_group_events(self, group_url, upcoming=True):
''' a method to retrieve a list of upcoming events hosted by group
:param group_url: string with meetup urlname field of group
:param upcoming: [optional] boolean to filter list to only future events
:return: dictionary with ... | python | def list_group_events(self, group_url, upcoming=True):
''' a method to retrieve a list of upcoming events hosted by group
:param group_url: string with meetup urlname field of group
:param upcoming: [optional] boolean to filter list to only future events
:return: dictionary with ... | [
"def",
"list_group_events",
"(",
"self",
",",
"group_url",
",",
"upcoming",
"=",
"True",
")",
":",
"# https://www.meetup.com/meetup_api/docs/:urlname/events/#list\r",
"title",
"=",
"'%s.list_group_events'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"# validate input... | a method to retrieve a list of upcoming events hosted by group
:param group_url: string with meetup urlname field of group
:param upcoming: [optional] boolean to filter list to only future events
:return: dictionary with list of event details inside [json] key
event_details = sel... | [
"a",
"method",
"to",
"retrieve",
"a",
"list",
"of",
"upcoming",
"events",
"hosted",
"by",
"group",
":",
"param",
"group_url",
":",
"string",
"with",
"meetup",
"urlname",
"field",
"of",
"group",
":",
"param",
"upcoming",
":",
"[",
"optional",
"]",
"boolean"... | train | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/events/meetup.py#L1561-L1607 |
collectiveacuity/labPack | labpack/events/meetup.py | meetupClient.list_group_members | def list_group_members(self, group_url, max_results=0):
''' a method to retrieve a list of members for a meetup group
:param group_url: string with meetup urlname for group
:param max_results: [optional] integer with number of members to include
:return: dictionary with list of m... | python | def list_group_members(self, group_url, max_results=0):
''' a method to retrieve a list of members for a meetup group
:param group_url: string with meetup urlname for group
:param max_results: [optional] integer with number of members to include
:return: dictionary with list of m... | [
"def",
"list_group_members",
"(",
"self",
",",
"group_url",
",",
"max_results",
"=",
"0",
")",
":",
"# https://www.meetup.com/meetup_api/docs/:urlname/members/#list\r",
"title",
"=",
"'%s.list_group_members'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"# validate in... | a method to retrieve a list of members for a meetup group
:param group_url: string with meetup urlname for group
:param max_results: [optional] integer with number of members to include
:return: dictionary with list of member details inside [json] key
member_details = self._recon... | [
"a",
"method",
"to",
"retrieve",
"a",
"list",
"of",
"members",
"for",
"a",
"meetup",
"group",
":",
"param",
"group_url",
":",
"string",
"with",
"meetup",
"urlname",
"for",
"group",
":",
"param",
"max_results",
":",
"[",
"optional",
"]",
"integer",
"with",
... | train | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/events/meetup.py#L1609-L1655 |
collectiveacuity/labPack | labpack/events/meetup.py | meetupClient.get_event_details | def get_event_details(self, group_url, event_id):
''' a method to retrieve details for an event
:param group_url: string with meetup urlname for host group
:param event_id: integer with meetup id for event
:return: dictionary with list of event details inside [json] key
... | python | def get_event_details(self, group_url, event_id):
''' a method to retrieve details for an event
:param group_url: string with meetup urlname for host group
:param event_id: integer with meetup id for event
:return: dictionary with list of event details inside [json] key
... | [
"def",
"get_event_details",
"(",
"self",
",",
"group_url",
",",
"event_id",
")",
":",
"# https://www.meetup.com/meetup_api/docs/:urlname/events/:id/#get\r",
"title",
"=",
"'%s.get_event_details'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"# validate inputs\r",
"input... | a method to retrieve details for an event
:param group_url: string with meetup urlname for host group
:param event_id: integer with meetup id for event
:return: dictionary with list of event details inside [json] key
event_details = self._reconstruct_event({}) | [
"a",
"method",
"to",
"retrieve",
"details",
"for",
"an",
"event",
":",
"param",
"group_url",
":",
"string",
"with",
"meetup",
"urlname",
"for",
"host",
"group",
":",
"param",
"event_id",
":",
"integer",
"with",
"meetup",
"id",
"for",
"event",
":",
"return"... | train | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/events/meetup.py#L1657-L1695 |
collectiveacuity/labPack | labpack/events/meetup.py | meetupClient.list_event_attendees | def list_event_attendees(self, group_url, event_id):
''' a method to retrieve attendee list for event from meetup api
:param group_url: string with meetup urlname for host group
:param event_id: integer with meetup id for event
:return: dictionary with list of attendee details in... | python | def list_event_attendees(self, group_url, event_id):
''' a method to retrieve attendee list for event from meetup api
:param group_url: string with meetup urlname for host group
:param event_id: integer with meetup id for event
:return: dictionary with list of attendee details in... | [
"def",
"list_event_attendees",
"(",
"self",
",",
"group_url",
",",
"event_id",
")",
":",
"# https://www.meetup.com/meetup_api/docs/:urlname/events/:event_id/rsvps/#list\r",
"title",
"=",
"'%s.list_event_attendees'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"# validate ... | a method to retrieve attendee list for event from meetup api
:param group_url: string with meetup urlname for host group
:param event_id: integer with meetup id for event
:return: dictionary with list of attendee details inside [json] key
attendee_details = self._reconstruct_atte... | [
"a",
"method",
"to",
"retrieve",
"attendee",
"list",
"for",
"event",
"from",
"meetup",
"api",
":",
"param",
"group_url",
":",
"string",
"with",
"meetup",
"urlname",
"for",
"host",
"group",
":",
"param",
"event_id",
":",
"integer",
"with",
"meetup",
"id",
"... | train | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/events/meetup.py#L1697-L1738 |
collectiveacuity/labPack | labpack/events/meetup.py | meetupClient.get_venue_details | def get_venue_details(self, venue_id):
''' a method to retrieve venue details from meetup api
:param venue_id: integer for meetup id for venue
:return: dictionary with venue details inside [json] key
venue_details = self.objects.venue.schema
'''
title = '%s.... | python | def get_venue_details(self, venue_id):
''' a method to retrieve venue details from meetup api
:param venue_id: integer for meetup id for venue
:return: dictionary with venue details inside [json] key
venue_details = self.objects.venue.schema
'''
title = '%s.... | [
"def",
"get_venue_details",
"(",
"self",
",",
"venue_id",
")",
":",
"title",
"=",
"'%s.get_venue_details'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"# validate inputs\r",
"input_fields",
"=",
"{",
"'venue_id'",
":",
"venue_id",
"}",
"for",
"key",
",",
... | a method to retrieve venue details from meetup api
:param venue_id: integer for meetup id for venue
:return: dictionary with venue details inside [json] key
venue_details = self.objects.venue.schema | [
"a",
"method",
"to",
"retrieve",
"venue",
"details",
"from",
"meetup",
"api",
":",
"param",
"venue_id",
":",
"integer",
"for",
"meetup",
"id",
"for",
"venue",
":",
"return",
":",
"dictionary",
"with",
"venue",
"details",
"inside",
"[",
"json",
"]",
"key",
... | train | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/events/meetup.py#L1740-L1777 |
collectiveacuity/labPack | labpack/events/meetup.py | meetupClient.list_locations | def list_locations(self, latitude=0.0, longitude=0.0, zip_code='', city_name='', max_results=0):
''' a method to retrieve location address details based upon search parameters
:param latitude: [optional] float with latitude coordinate at center of geo search
:param longitude: [optional] f... | python | def list_locations(self, latitude=0.0, longitude=0.0, zip_code='', city_name='', max_results=0):
''' a method to retrieve location address details based upon search parameters
:param latitude: [optional] float with latitude coordinate at center of geo search
:param longitude: [optional] f... | [
"def",
"list_locations",
"(",
"self",
",",
"latitude",
"=",
"0.0",
",",
"longitude",
"=",
"0.0",
",",
"zip_code",
"=",
"''",
",",
"city_name",
"=",
"''",
",",
"max_results",
"=",
"0",
")",
":",
"# https://www.meetup.com/meetup_api/docs/find/locations/\r",
"title... | a method to retrieve location address details based upon search parameters
:param latitude: [optional] float with latitude coordinate at center of geo search
:param longitude: [optional] float with longitude coordinate at center of geo search
:param city_name: [optional] string with name of... | [
"a",
"method",
"to",
"retrieve",
"location",
"address",
"details",
"based",
"upon",
"search",
"parameters",
":",
"param",
"latitude",
":",
"[",
"optional",
"]",
"float",
"with",
"latitude",
"coordinate",
"at",
"center",
"of",
"geo",
"search",
":",
"param",
"... | train | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/events/meetup.py#L1779-L1842 |
collectiveacuity/labPack | labpack/events/meetup.py | meetupClient.join_group | def join_group(self, group_url, membership_answers=None):
''' a method to add member to a meetup group
:param group_url: string with meetup urlname for group
:param membership_answers: list with question id and answer for group join questions
:return: dictionary with member profi... | python | def join_group(self, group_url, membership_answers=None):
''' a method to add member to a meetup group
:param group_url: string with meetup urlname for group
:param membership_answers: list with question id and answer for group join questions
:return: dictionary with member profi... | [
"def",
"join_group",
"(",
"self",
",",
"group_url",
",",
"membership_answers",
"=",
"None",
")",
":",
"# https://www.meetup.com/meetup_api/docs/:urlname/members/#create\r",
"title",
"=",
"'%s.join_group'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"# validate permis... | a method to add member to a meetup group
:param group_url: string with meetup urlname for group
:param membership_answers: list with question id and answer for group join questions
:return: dictionary with member profile details inside [json] key
profile_details = self._reconstru... | [
"a",
"method",
"to",
"add",
"member",
"to",
"a",
"meetup",
"group",
":",
"param",
"group_url",
":",
"string",
"with",
"meetup",
"urlname",
"for",
"group",
":",
"param",
"membership_answers",
":",
"list",
"with",
"question",
"id",
"and",
"answer",
"for",
"g... | train | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/events/meetup.py#L1844-L1888 |
collectiveacuity/labPack | labpack/events/meetup.py | meetupClient.leave_group | def leave_group(self, group_url, member_id, exit_comment=''):
''' a method to remove group from meetup member profile
:param group_url: string with meetup urlname for group
:param member_id: integer with member id from member profile
:param exit_comment: string with comment to le... | python | def leave_group(self, group_url, member_id, exit_comment=''):
''' a method to remove group from meetup member profile
:param group_url: string with meetup urlname for group
:param member_id: integer with member id from member profile
:param exit_comment: string with comment to le... | [
"def",
"leave_group",
"(",
"self",
",",
"group_url",
",",
"member_id",
",",
"exit_comment",
"=",
"''",
")",
":",
"# https://www.meetup.com/meetup_api/docs/:urlname/members/:member_id/#delete\r",
"title",
"=",
"'%s.leave_group'",
"%",
"self",
".",
"__class__",
".",
"__na... | a method to remove group from meetup member profile
:param group_url: string with meetup urlname for group
:param member_id: integer with member id from member profile
:param exit_comment: string with comment to leave with organizer
:return: dictionary with code 204 on success | [
"a",
"method",
"to",
"remove",
"group",
"from",
"meetup",
"member",
"profile",
":",
"param",
"group_url",
":",
"string",
"with",
"meetup",
"urlname",
"for",
"group",
":",
"param",
"member_id",
":",
"integer",
"with",
"member",
"id",
"from",
"member",
"profil... | train | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/events/meetup.py#L1890-L1928 |
collectiveacuity/labPack | labpack/events/meetup.py | meetupClient.join_topics | def join_topics(self, member_id, topics):
''' a method to add topics to member profile details on meetup
:param member_id: integer with member id from member profile
:param topics: list of integer meetup ids for topics
:return: dictionary with list of topic details inside [json] ... | python | def join_topics(self, member_id, topics):
''' a method to add topics to member profile details on meetup
:param member_id: integer with member id from member profile
:param topics: list of integer meetup ids for topics
:return: dictionary with list of topic details inside [json] ... | [
"def",
"join_topics",
"(",
"self",
",",
"member_id",
",",
"topics",
")",
":",
"# https://www.meetup.com/meetup_api/docs/members/:member_id/#edit\r",
"title",
"=",
"'%s.join_topics'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"# validate permissions\r",
"if",
"not",
... | a method to add topics to member profile details on meetup
:param member_id: integer with member id from member profile
:param topics: list of integer meetup ids for topics
:return: dictionary with list of topic details inside [json] key
topic_details = self.objects.topic.schema | [
"a",
"method",
"to",
"add",
"topics",
"to",
"member",
"profile",
"details",
"on",
"meetup",
":",
"param",
"member_id",
":",
"integer",
"with",
"member",
"id",
"from",
"member",
"profile",
":",
"param",
"topics",
":",
"list",
"of",
"integer",
"meetup",
"ids... | train | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/events/meetup.py#L1930-L1983 |
collectiveacuity/labPack | labpack/events/meetup.py | meetupClient.join_event | def join_event(self, group_url, event_id, additional_guests=0, attendance_answers=None, payment_service='', payment_code=''):
''' a method to create an rsvp for a meetup event
:param group_url: string with meetup urlname for group
:param event_id: integer with meetup id for event
... | python | def join_event(self, group_url, event_id, additional_guests=0, attendance_answers=None, payment_service='', payment_code=''):
''' a method to create an rsvp for a meetup event
:param group_url: string with meetup urlname for group
:param event_id: integer with meetup id for event
... | [
"def",
"join_event",
"(",
"self",
",",
"group_url",
",",
"event_id",
",",
"additional_guests",
"=",
"0",
",",
"attendance_answers",
"=",
"None",
",",
"payment_service",
"=",
"''",
",",
"payment_code",
"=",
"''",
")",
":",
"# https://www.meetup.com/meetup_api/docs/... | a method to create an rsvp for a meetup event
:param group_url: string with meetup urlname for group
:param event_id: integer with meetup id for event
:param additional_guests: [optional] integer with number of additional guests
:param attendance_answers: [optional] list with id & ... | [
"a",
"method",
"to",
"create",
"an",
"rsvp",
"for",
"a",
"meetup",
"event",
":",
"param",
"group_url",
":",
"string",
"with",
"meetup",
"urlname",
"for",
"group",
":",
"param",
"event_id",
":",
"integer",
"with",
"meetup",
"id",
"for",
"event",
":",
"par... | train | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/events/meetup.py#L2040-L2099 |
collectiveacuity/labPack | labpack/events/meetup.py | meetupClient.leave_event | def leave_event(self, group_url, event_id):
''' a method to rescind an rsvp to a meetup event
:param group_url: string with meetup urlname for group
:param event_id: integer with meetup id for event
:return: dictionary with attendee details inside [json] key
attendee_d... | python | def leave_event(self, group_url, event_id):
''' a method to rescind an rsvp to a meetup event
:param group_url: string with meetup urlname for group
:param event_id: integer with meetup id for event
:return: dictionary with attendee details inside [json] key
attendee_d... | [
"def",
"leave_event",
"(",
"self",
",",
"group_url",
",",
"event_id",
")",
":",
"# https://www.meetup.com/meetup_api/docs/:urlname/events/:event_id/rsvps/\r",
"title",
"=",
"'%s.leave_event'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"# validate permissions\r",
"if",... | a method to rescind an rsvp to a meetup event
:param group_url: string with meetup urlname for group
:param event_id: integer with meetup id for event
:return: dictionary with attendee details inside [json] key
attendee_details = self._reconstruct_attendee({}) | [
"a",
"method",
"to",
"rescind",
"an",
"rsvp",
"to",
"a",
"meetup",
"event",
":",
"param",
"group_url",
":",
"string",
"with",
"meetup",
"urlname",
"for",
"group",
":",
"param",
"event_id",
":",
"integer",
"with",
"meetup",
"id",
"for",
"event",
":",
"ret... | train | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/events/meetup.py#L2101-L2143 |
bwesterb/tkbd | src/ruuster.py | Ruuster.fetch_inst_id | def fetch_inst_id(self):
""" Fetches the institute id of the RU """
try:
for d in msgpack.unpack(urllib2.urlopen(
"%s/list/institutes?format=msgpack" % self.url)):
if d['name'] == 'Radboud Universiteit Nijmegen':
return d['id']
... | python | def fetch_inst_id(self):
""" Fetches the institute id of the RU """
try:
for d in msgpack.unpack(urllib2.urlopen(
"%s/list/institutes?format=msgpack" % self.url)):
if d['name'] == 'Radboud Universiteit Nijmegen':
return d['id']
... | [
"def",
"fetch_inst_id",
"(",
"self",
")",
":",
"try",
":",
"for",
"d",
"in",
"msgpack",
".",
"unpack",
"(",
"urllib2",
".",
"urlopen",
"(",
"\"%s/list/institutes?format=msgpack\"",
"%",
"self",
".",
"url",
")",
")",
":",
"if",
"d",
"[",
"'name'",
"]",
... | Fetches the institute id of the RU | [
"Fetches",
"the",
"institute",
"id",
"of",
"the",
"RU"
] | train | https://github.com/bwesterb/tkbd/blob/fcf16977d38a93fe9b7fa198513007ab9921b650/src/ruuster.py#L31-L40 |
bwesterb/tkbd | src/ruuster.py | Ruuster.fetch_room_ids | def fetch_room_ids(self, names):
""" Fetches the ids of the rooms with the given names """
ret = {}
names_set = set(names)
try:
for d in msgpack.unpack(urllib2.urlopen(
"%s/list/locations?format=msgpack" % self.url)):
name = d['name'].upper... | python | def fetch_room_ids(self, names):
""" Fetches the ids of the rooms with the given names """
ret = {}
names_set = set(names)
try:
for d in msgpack.unpack(urllib2.urlopen(
"%s/list/locations?format=msgpack" % self.url)):
name = d['name'].upper... | [
"def",
"fetch_room_ids",
"(",
"self",
",",
"names",
")",
":",
"ret",
"=",
"{",
"}",
"names_set",
"=",
"set",
"(",
"names",
")",
"try",
":",
"for",
"d",
"in",
"msgpack",
".",
"unpack",
"(",
"urllib2",
".",
"urlopen",
"(",
"\"%s/list/locations?format=msgpa... | Fetches the ids of the rooms with the given names | [
"Fetches",
"the",
"ids",
"of",
"the",
"rooms",
"with",
"the",
"given",
"names"
] | train | https://github.com/bwesterb/tkbd/blob/fcf16977d38a93fe9b7fa198513007ab9921b650/src/ruuster.py#L43-L55 |
bwesterb/tkbd | src/ruuster.py | Ruuster.fetch_todays_schedule | def fetch_todays_schedule(self, rooms):
""" Fetch the schedules for the given rooms. """
room_ids = self.fetch_room_ids(rooms)
inst_id = self.fetch_inst_id()
ret = {}
now = datetime.datetime.now()
day = DAYS[now.isoweekday() - 1]
for room_name in room_ids:
... | python | def fetch_todays_schedule(self, rooms):
""" Fetch the schedules for the given rooms. """
room_ids = self.fetch_room_ids(rooms)
inst_id = self.fetch_inst_id()
ret = {}
now = datetime.datetime.now()
day = DAYS[now.isoweekday() - 1]
for room_name in room_ids:
... | [
"def",
"fetch_todays_schedule",
"(",
"self",
",",
"rooms",
")",
":",
"room_ids",
"=",
"self",
".",
"fetch_room_ids",
"(",
"rooms",
")",
"inst_id",
"=",
"self",
".",
"fetch_inst_id",
"(",
")",
"ret",
"=",
"{",
"}",
"now",
"=",
"datetime",
".",
"datetime",... | Fetch the schedules for the given rooms. | [
"Fetch",
"the",
"schedules",
"for",
"the",
"given",
"rooms",
"."
] | train | https://github.com/bwesterb/tkbd/blob/fcf16977d38a93fe9b7fa198513007ab9921b650/src/ruuster.py#L58-L96 |
collectiveacuity/labPack | labpack/records/ip.py | get_ip | def get_ip(source='aws'):
''' a method to get current public ip address of machine '''
if source == 'aws':
source_url = 'http://checkip.amazonaws.com/'
else:
raise Exception('get_ip currently only supports queries to aws')
import requests
try:
response = reques... | python | def get_ip(source='aws'):
''' a method to get current public ip address of machine '''
if source == 'aws':
source_url = 'http://checkip.amazonaws.com/'
else:
raise Exception('get_ip currently only supports queries to aws')
import requests
try:
response = reques... | [
"def",
"get_ip",
"(",
"source",
"=",
"'aws'",
")",
":",
"if",
"source",
"==",
"'aws'",
":",
"source_url",
"=",
"'http://checkip.amazonaws.com/'",
"else",
":",
"raise",
"Exception",
"(",
"'get_ip currently only supports queries to aws'",
")",
"import",
"requests",
"t... | a method to get current public ip address of machine | [
"a",
"method",
"to",
"get",
"current",
"public",
"ip",
"address",
"of",
"machine"
] | train | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/records/ip.py#L5-L26 |
collectiveacuity/labPack | labpack/records/ip.py | describe_ip | def describe_ip(ip_address, source='whatismyip'):
''' a method to get the details associated with an ip address '''
# determine url
if source == 'nekudo':
source_url = 'https://geoip.nekudo.com/api/%s' % ip_address
elif source == 'geoip':
source_url = 'https://freegeoip.net/json/%s' % ... | python | def describe_ip(ip_address, source='whatismyip'):
''' a method to get the details associated with an ip address '''
# determine url
if source == 'nekudo':
source_url = 'https://geoip.nekudo.com/api/%s' % ip_address
elif source == 'geoip':
source_url = 'https://freegeoip.net/json/%s' % ... | [
"def",
"describe_ip",
"(",
"ip_address",
",",
"source",
"=",
"'whatismyip'",
")",
":",
"# determine url",
"if",
"source",
"==",
"'nekudo'",
":",
"source_url",
"=",
"'https://geoip.nekudo.com/api/%s'",
"%",
"ip_address",
"elif",
"source",
"==",
"'geoip'",
":",
"sou... | a method to get the details associated with an ip address | [
"a",
"method",
"to",
"get",
"the",
"details",
"associated",
"with",
"an",
"ip",
"address"
] | train | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/records/ip.py#L28-L130 |
rikrd/inspire | inspirespeech/htk.py | load_parameter | def load_parameter(input_filename, only_header=False):
"""Load HTK parameter/feature file.
:param input_filename:
:param only_header: only load the metadata
:return: a named tuple representing the HTK parmeter file
"""
with open(input_filename, 'rb') as f:
meta = _parse_parameter_meta(... | python | def load_parameter(input_filename, only_header=False):
"""Load HTK parameter/feature file.
:param input_filename:
:param only_header: only load the metadata
:return: a named tuple representing the HTK parmeter file
"""
with open(input_filename, 'rb') as f:
meta = _parse_parameter_meta(... | [
"def",
"load_parameter",
"(",
"input_filename",
",",
"only_header",
"=",
"False",
")",
":",
"with",
"open",
"(",
"input_filename",
",",
"'rb'",
")",
"as",
"f",
":",
"meta",
"=",
"_parse_parameter_meta",
"(",
"f",
")",
"if",
"only_header",
":",
"return",
"m... | Load HTK parameter/feature file.
:param input_filename:
:param only_header: only load the metadata
:return: a named tuple representing the HTK parmeter file | [
"Load",
"HTK",
"parameter",
"/",
"feature",
"file",
"."
] | train | https://github.com/rikrd/inspire/blob/e281c0266a9a9633f34ab70f9c3ad58036c19b59/inspirespeech/htk.py#L175-L188 |
rikrd/inspire | inspirespeech/htk.py | create_parameter | def create_parameter(samples, sample_period):
"""Create a HTK Parameter object from an array of samples and a samples period
:param samples (list of lists or array of floats): The samples to write into the file. Usually feature vectors.
:param sample_period (int): Sample period in 100ns units.
"""
... | python | def create_parameter(samples, sample_period):
"""Create a HTK Parameter object from an array of samples and a samples period
:param samples (list of lists or array of floats): The samples to write into the file. Usually feature vectors.
:param sample_period (int): Sample period in 100ns units.
"""
... | [
"def",
"create_parameter",
"(",
"samples",
",",
"sample_period",
")",
":",
"parm_kind_str",
"=",
"'USER'",
"parm_kind",
"=",
"_htk_str_to_param",
"(",
"parm_kind_str",
")",
"parm_kind_base",
",",
"parm_kind_opts",
"=",
"_htk_str_to_param",
"(",
"parm_kind_str",
")",
... | Create a HTK Parameter object from an array of samples and a samples period
:param samples (list of lists or array of floats): The samples to write into the file. Usually feature vectors.
:param sample_period (int): Sample period in 100ns units. | [
"Create",
"a",
"HTK",
"Parameter",
"object",
"from",
"an",
"array",
"of",
"samples",
"and",
"a",
"samples",
"period"
] | train | https://github.com/rikrd/inspire/blob/e281c0266a9a9633f34ab70f9c3ad58036c19b59/inspirespeech/htk.py#L201-L220 |
rikrd/inspire | inspirespeech/htk.py | load_mlf | def load_mlf(filename, utf8_normalization=None):
"""Load an HTK Master Label File.
:param filename: The filename of the MLF file.
:param utf8_normalization: None
"""
with codecs.open(filename, 'r', 'string_escape') as f:
data = f.read().decode('utf8')
if utf8_normalization:
... | python | def load_mlf(filename, utf8_normalization=None):
"""Load an HTK Master Label File.
:param filename: The filename of the MLF file.
:param utf8_normalization: None
"""
with codecs.open(filename, 'r', 'string_escape') as f:
data = f.read().decode('utf8')
if utf8_normalization:
... | [
"def",
"load_mlf",
"(",
"filename",
",",
"utf8_normalization",
"=",
"None",
")",
":",
"with",
"codecs",
".",
"open",
"(",
"filename",
",",
"'r'",
",",
"'string_escape'",
")",
"as",
"f",
":",
"data",
"=",
"f",
".",
"read",
"(",
")",
".",
"decode",
"("... | Load an HTK Master Label File.
:param filename: The filename of the MLF file.
:param utf8_normalization: None | [
"Load",
"an",
"HTK",
"Master",
"Label",
"File",
"."
] | train | https://github.com/rikrd/inspire/blob/e281c0266a9a9633f34ab70f9c3ad58036c19b59/inspirespeech/htk.py#L223-L242 |
rikrd/inspire | inspirespeech/htk.py | save_mlf | def save_mlf(mlf, output_filename):
"""Save an HTK Master Label File.
:param mlf: MLF dictionary containing a mapping from file to list of annotations.
:param output_filename: The file where to save the MLF
"""
with codecs.open(output_filename, 'w', 'utf-8') as f:
f.write(u'#!MLF!#\n')
... | python | def save_mlf(mlf, output_filename):
"""Save an HTK Master Label File.
:param mlf: MLF dictionary containing a mapping from file to list of annotations.
:param output_filename: The file where to save the MLF
"""
with codecs.open(output_filename, 'w', 'utf-8') as f:
f.write(u'#!MLF!#\n')
... | [
"def",
"save_mlf",
"(",
"mlf",
",",
"output_filename",
")",
":",
"with",
"codecs",
".",
"open",
"(",
"output_filename",
",",
"'w'",
",",
"'utf-8'",
")",
"as",
"f",
":",
"f",
".",
"write",
"(",
"u'#!MLF!#\\n'",
")",
"for",
"k",
",",
"v",
"in",
"mlf",
... | Save an HTK Master Label File.
:param mlf: MLF dictionary containing a mapping from file to list of annotations.
:param output_filename: The file where to save the MLF | [
"Save",
"an",
"HTK",
"Master",
"Label",
"File",
"."
] | train | https://github.com/rikrd/inspire/blob/e281c0266a9a9633f34ab70f9c3ad58036c19b59/inspirespeech/htk.py#L245-L265 |
rikrd/inspire | inspirespeech/htk.py | main | def main():
"""Test code called from commandline"""
model = load_model('../data/hmmdefs')
hmm = model.hmms['r-We']
for state_name in hmm.state_names:
print(state_name)
state = model.states[state_name]
print(state.means_)
print(model)
model2 = load_model('../data/prior.hmm... | python | def main():
"""Test code called from commandline"""
model = load_model('../data/hmmdefs')
hmm = model.hmms['r-We']
for state_name in hmm.state_names:
print(state_name)
state = model.states[state_name]
print(state.means_)
print(model)
model2 = load_model('../data/prior.hmm... | [
"def",
"main",
"(",
")",
":",
"model",
"=",
"load_model",
"(",
"'../data/hmmdefs'",
")",
"hmm",
"=",
"model",
".",
"hmms",
"[",
"'r-We'",
"]",
"for",
"state_name",
"in",
"hmm",
".",
"state_names",
":",
"print",
"(",
"state_name",
")",
"state",
"=",
"mo... | Test code called from commandline | [
"Test",
"code",
"called",
"from",
"commandline"
] | train | https://github.com/rikrd/inspire/blob/e281c0266a9a9633f34ab70f9c3ad58036c19b59/inspirespeech/htk.py#L283-L293 |
sassoo/goldman | goldman/models/base.py | Model.to_lower | def to_lower(cls): # NOQA
""" Return a list of all the fields that should be lowercased
This is done on fields with `lower=True`.
"""
email = cls.get_fields_by_class(EmailType)
lower = cls.get_fields_by_prop('lower', True) + email
return list(set(email + lower)) | python | def to_lower(cls): # NOQA
""" Return a list of all the fields that should be lowercased
This is done on fields with `lower=True`.
"""
email = cls.get_fields_by_class(EmailType)
lower = cls.get_fields_by_prop('lower', True) + email
return list(set(email + lower)) | [
"def",
"to_lower",
"(",
"cls",
")",
":",
"# NOQA",
"email",
"=",
"cls",
".",
"get_fields_by_class",
"(",
"EmailType",
")",
"lower",
"=",
"cls",
".",
"get_fields_by_prop",
"(",
"'lower'",
",",
"True",
")",
"+",
"email",
"return",
"list",
"(",
"set",
"(",
... | Return a list of all the fields that should be lowercased
This is done on fields with `lower=True`. | [
"Return",
"a",
"list",
"of",
"all",
"the",
"fields",
"that",
"should",
"be",
"lowercased"
] | train | https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/models/base.py#L84-L93 |
sassoo/goldman | goldman/models/base.py | Model.get_fields_by_class | def get_fields_by_class(cls, field_class):
""" Return a list of field names matching a field class
:param field_class: field class object
:return: list
"""
ret = []
for key, val in getattr(cls, '_fields').items():
if isinstance(val, field_class):
... | python | def get_fields_by_class(cls, field_class):
""" Return a list of field names matching a field class
:param field_class: field class object
:return: list
"""
ret = []
for key, val in getattr(cls, '_fields').items():
if isinstance(val, field_class):
... | [
"def",
"get_fields_by_class",
"(",
"cls",
",",
"field_class",
")",
":",
"ret",
"=",
"[",
"]",
"for",
"key",
",",
"val",
"in",
"getattr",
"(",
"cls",
",",
"'_fields'",
")",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
"val",
",",
"field_class... | Return a list of field names matching a field class
:param field_class: field class object
:return: list | [
"Return",
"a",
"list",
"of",
"field",
"names",
"matching",
"a",
"field",
"class"
] | train | https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/models/base.py#L108-L120 |
sassoo/goldman | goldman/models/base.py | Model.get_fields_by_prop | def get_fields_by_prop(cls, prop_key, prop_val):
""" Return a list of field names matching a prop key/val
:param prop_key: key name
:param prop_val: value
:return: list
"""
ret = []
for key, val in cls.get_fields_with_prop(prop_key):
if val == prop_... | python | def get_fields_by_prop(cls, prop_key, prop_val):
""" Return a list of field names matching a prop key/val
:param prop_key: key name
:param prop_val: value
:return: list
"""
ret = []
for key, val in cls.get_fields_with_prop(prop_key):
if val == prop_... | [
"def",
"get_fields_by_prop",
"(",
"cls",
",",
"prop_key",
",",
"prop_val",
")",
":",
"ret",
"=",
"[",
"]",
"for",
"key",
",",
"val",
"in",
"cls",
".",
"get_fields_with_prop",
"(",
"prop_key",
")",
":",
"if",
"val",
"==",
"prop_val",
":",
"ret",
".",
... | Return a list of field names matching a prop key/val
:param prop_key: key name
:param prop_val: value
:return: list | [
"Return",
"a",
"list",
"of",
"field",
"names",
"matching",
"a",
"prop",
"key",
"/",
"val"
] | train | https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/models/base.py#L123-L136 |
sassoo/goldman | goldman/models/base.py | Model.get_fields_with_prop | def get_fields_with_prop(cls, prop_key):
""" Return a list of fields with a prop key defined
Each list item will be a tuple of field name containing
the prop key & the value of that prop key.
:param prop_key: key name
:return: list of tuples
"""
ret = []
... | python | def get_fields_with_prop(cls, prop_key):
""" Return a list of fields with a prop key defined
Each list item will be a tuple of field name containing
the prop key & the value of that prop key.
:param prop_key: key name
:return: list of tuples
"""
ret = []
... | [
"def",
"get_fields_with_prop",
"(",
"cls",
",",
"prop_key",
")",
":",
"ret",
"=",
"[",
"]",
"for",
"key",
",",
"val",
"in",
"getattr",
"(",
"cls",
",",
"'_fields'",
")",
".",
"items",
"(",
")",
":",
"if",
"hasattr",
"(",
"val",
",",
"prop_key",
")"... | Return a list of fields with a prop key defined
Each list item will be a tuple of field name containing
the prop key & the value of that prop key.
:param prop_key: key name
:return: list of tuples | [
"Return",
"a",
"list",
"of",
"fields",
"with",
"a",
"prop",
"key",
"defined"
] | train | https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/models/base.py#L139-L154 |
sassoo/goldman | goldman/models/base.py | Model.to_exceptions | def to_exceptions(cls, errors):
""" Convert the validation errors into ValidationFailure exc's
Transform native schematics validation errors into a
goldman ValidationFailure exception.
:param errors:
dict of errors in schematics format
:return:
list of V... | python | def to_exceptions(cls, errors):
""" Convert the validation errors into ValidationFailure exc's
Transform native schematics validation errors into a
goldman ValidationFailure exception.
:param errors:
dict of errors in schematics format
:return:
list of V... | [
"def",
"to_exceptions",
"(",
"cls",
",",
"errors",
")",
":",
"ret",
"=",
"[",
"]",
"for",
"key",
",",
"val",
"in",
"errors",
".",
"items",
"(",
")",
":",
"if",
"key",
"in",
"cls",
".",
"relationships",
":",
"attr",
"=",
"'/data/relationships/%s'",
"%... | Convert the validation errors into ValidationFailure exc's
Transform native schematics validation errors into a
goldman ValidationFailure exception.
:param errors:
dict of errors in schematics format
:return:
list of ValidationFailure exception objects | [
"Convert",
"the",
"validation",
"errors",
"into",
"ValidationFailure",
"exc",
"s"
] | train | https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/models/base.py#L157-L180 |
sassoo/goldman | goldman/models/base.py | Model.dirty_fields | def dirty_fields(self):
""" Return an array of field names that are dirty
Dirty means if a model was hydrated first from the
store & then had field values changed they are now
considered dirty.
For new models all fields are considered dirty.
:return: list
"""
... | python | def dirty_fields(self):
""" Return an array of field names that are dirty
Dirty means if a model was hydrated first from the
store & then had field values changed they are now
considered dirty.
For new models all fields are considered dirty.
:return: list
"""
... | [
"def",
"dirty_fields",
"(",
"self",
")",
":",
"dirty_fields",
"=",
"[",
"]",
"for",
"field",
"in",
"self",
".",
"all_fields",
":",
"if",
"field",
"not",
"in",
"self",
".",
"_original",
":",
"dirty_fields",
".",
"append",
"(",
"field",
")",
"elif",
"sel... | Return an array of field names that are dirty
Dirty means if a model was hydrated first from the
store & then had field values changed they are now
considered dirty.
For new models all fields are considered dirty.
:return: list | [
"Return",
"an",
"array",
"of",
"field",
"names",
"that",
"are",
"dirty"
] | train | https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/models/base.py#L189-L208 |
sassoo/goldman | goldman/models/base.py | Model.merge | def merge(self, data, clean=False, validate=False):
""" Merge a dict with the model
This is needed because schematics doesn't auto cast
values when assigned. This method allows us to ensure
incoming data & existing data on a model are always
coerced properly.
We create ... | python | def merge(self, data, clean=False, validate=False):
""" Merge a dict with the model
This is needed because schematics doesn't auto cast
values when assigned. This method allows us to ensure
incoming data & existing data on a model are always
coerced properly.
We create ... | [
"def",
"merge",
"(",
"self",
",",
"data",
",",
"clean",
"=",
"False",
",",
"validate",
"=",
"False",
")",
":",
"try",
":",
"model",
"=",
"self",
".",
"__class__",
"(",
"data",
")",
"except",
"ConversionError",
"as",
"errors",
":",
"abort",
"(",
"self... | Merge a dict with the model
This is needed because schematics doesn't auto cast
values when assigned. This method allows us to ensure
incoming data & existing data on a model are always
coerced properly.
We create a temporary model instance with just the new
data so all... | [
"Merge",
"a",
"dict",
"with",
"the",
"model"
] | train | https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/models/base.py#L222-L266 |
sassoo/goldman | goldman/models/base.py | Model.to_primitive | def to_primitive(self, load_rels=None, sparse_fields=None, *args,
**kwargs):
""" Override the schematics native to_primitive method
:param loads_rels:
List of field names that are relationships that should
be loaded for the serialization process. This needs
... | python | def to_primitive(self, load_rels=None, sparse_fields=None, *args,
**kwargs):
""" Override the schematics native to_primitive method
:param loads_rels:
List of field names that are relationships that should
be loaded for the serialization process. This needs
... | [
"def",
"to_primitive",
"(",
"self",
",",
"load_rels",
"=",
"None",
",",
"sparse_fields",
"=",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"load_rels",
":",
"for",
"rel",
"in",
"load_rels",
":",
"getattr",
"(",
"self",
",",
"rel... | Override the schematics native to_primitive method
:param loads_rels:
List of field names that are relationships that should
be loaded for the serialization process. This needs
to be run before the native schematics to_primitive is
run so the proper data is seria... | [
"Override",
"the",
"schematics",
"native",
"to_primitive",
"method"
] | train | https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/models/base.py#L268-L295 |
rosenbrockc/acorn | acorn/analyze/sklearn.py | stash_split | def stash_split(fqdn, result, *argl, **argd):
"""Stashes the split between training and testing sets so that it can be
used later for automatic scoring of the models in the log.
"""
global _splits
if fqdn == "sklearn.cross_validation.train_test_split":
key = id(result[1])
_splits[key... | python | def stash_split(fqdn, result, *argl, **argd):
"""Stashes the split between training and testing sets so that it can be
used later for automatic scoring of the models in the log.
"""
global _splits
if fqdn == "sklearn.cross_validation.train_test_split":
key = id(result[1])
_splits[key... | [
"def",
"stash_split",
"(",
"fqdn",
",",
"result",
",",
"*",
"argl",
",",
"*",
"*",
"argd",
")",
":",
"global",
"_splits",
"if",
"fqdn",
"==",
"\"sklearn.cross_validation.train_test_split\"",
":",
"key",
"=",
"id",
"(",
"result",
"[",
"1",
"]",
")",
"_spl... | Stashes the split between training and testing sets so that it can be
used later for automatic scoring of the models in the log. | [
"Stashes",
"the",
"split",
"between",
"training",
"and",
"testing",
"sets",
"so",
"that",
"it",
"can",
"be",
"used",
"later",
"for",
"automatic",
"scoring",
"of",
"the",
"models",
"in",
"the",
"log",
"."
] | train | https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/analyze/sklearn.py#L57-L69 |
rosenbrockc/acorn | acorn/analyze/sklearn.py | _machine_fqdn | def _machine_fqdn(machine):
"""Returns the FQDN of the given learning machine.
"""
from acorn.logging.decoration import _fqdn
if hasattr(machine, "__class__"):
return _fqdn(machine.__class__, False)
else: # pragma: no cover
#See what FQDN can get out of the class instance.
re... | python | def _machine_fqdn(machine):
"""Returns the FQDN of the given learning machine.
"""
from acorn.logging.decoration import _fqdn
if hasattr(machine, "__class__"):
return _fqdn(machine.__class__, False)
else: # pragma: no cover
#See what FQDN can get out of the class instance.
re... | [
"def",
"_machine_fqdn",
"(",
"machine",
")",
":",
"from",
"acorn",
".",
"logging",
".",
"decoration",
"import",
"_fqdn",
"if",
"hasattr",
"(",
"machine",
",",
"\"__class__\"",
")",
":",
"return",
"_fqdn",
"(",
"machine",
".",
"__class__",
",",
"False",
")"... | Returns the FQDN of the given learning machine. | [
"Returns",
"the",
"FQDN",
"of",
"the",
"given",
"learning",
"machine",
"."
] | train | https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/analyze/sklearn.py#L71-L79 |
rosenbrockc/acorn | acorn/analyze/sklearn.py | fit | def fit(fqdn, result, *argl, **argd):
"""Analyzes the result of a generic fit operation performed by `sklearn`.
Args:
fqdn (str): full-qualified name of the method that was called.
result: result of calling the method with `fqdn`.
argl (tuple): positional arguments passed to the method ... | python | def fit(fqdn, result, *argl, **argd):
"""Analyzes the result of a generic fit operation performed by `sklearn`.
Args:
fqdn (str): full-qualified name of the method that was called.
result: result of calling the method with `fqdn`.
argl (tuple): positional arguments passed to the method ... | [
"def",
"fit",
"(",
"fqdn",
",",
"result",
",",
"*",
"argl",
",",
"*",
"*",
"argd",
")",
":",
"#Check the arguments to see what kind of data we are working with, then",
"#choose the appropriate function below to return the analysis dictionary.",
"#The first positional argument will ... | Analyzes the result of a generic fit operation performed by `sklearn`.
Args:
fqdn (str): full-qualified name of the method that was called.
result: result of calling the method with `fqdn`.
argl (tuple): positional arguments passed to the method call.
argd (dict): keyword arguments ... | [
"Analyzes",
"the",
"result",
"of",
"a",
"generic",
"fit",
"operation",
"performed",
"by",
"sklearn",
"."
] | train | https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/analyze/sklearn.py#L95-L122 |
rosenbrockc/acorn | acorn/analyze/sklearn.py | predict | def predict(fqdn, result, *argl, **argd):
"""Analyzes the result of a generic predict operation performed by
`sklearn`.
Args:
fqdn (str): full-qualified name of the method that was called.
result: result of calling the method with `fqdn`.
argl (tuple): positional arguments passed to... | python | def predict(fqdn, result, *argl, **argd):
"""Analyzes the result of a generic predict operation performed by
`sklearn`.
Args:
fqdn (str): full-qualified name of the method that was called.
result: result of calling the method with `fqdn`.
argl (tuple): positional arguments passed to... | [
"def",
"predict",
"(",
"fqdn",
",",
"result",
",",
"*",
"argl",
",",
"*",
"*",
"argd",
")",
":",
"#Check the arguments to see what kind of data we are working with, then",
"#choose the appropriate function below to return the analysis dictionary.",
"out",
"=",
"None",
"if",
... | Analyzes the result of a generic predict operation performed by
`sklearn`.
Args:
fqdn (str): full-qualified name of the method that was called.
result: result of calling the method with `fqdn`.
argl (tuple): positional arguments passed to the method call.
argd (dict): keyword ar... | [
"Analyzes",
"the",
"result",
"of",
"a",
"generic",
"predict",
"operation",
"performed",
"by",
"sklearn",
"."
] | train | https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/analyze/sklearn.py#L124-L143 |
rosenbrockc/acorn | acorn/analyze/sklearn.py | _do_auto_predict | def _do_auto_predict(machine, X, *args):
"""Performs an automatic prediction for the specified machine and returns
the predicted values.
"""
if auto_predict and hasattr(machine, "predict"):
return machine.predict(X) | python | def _do_auto_predict(machine, X, *args):
"""Performs an automatic prediction for the specified machine and returns
the predicted values.
"""
if auto_predict and hasattr(machine, "predict"):
return machine.predict(X) | [
"def",
"_do_auto_predict",
"(",
"machine",
",",
"X",
",",
"*",
"args",
")",
":",
"if",
"auto_predict",
"and",
"hasattr",
"(",
"machine",
",",
"\"predict\"",
")",
":",
"return",
"machine",
".",
"predict",
"(",
"X",
")"
] | Performs an automatic prediction for the specified machine and returns
the predicted values. | [
"Performs",
"an",
"automatic",
"prediction",
"for",
"the",
"specified",
"machine",
"and",
"returns",
"the",
"predicted",
"values",
"."
] | train | https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/analyze/sklearn.py#L145-L150 |
rosenbrockc/acorn | acorn/analyze/sklearn.py | _generic_fit | def _generic_fit(fqdn, result, scorer, yP=None, *argl, **argd):
"""Performs the generic fit tests that are common to both classifier and
regressor; uses `scorer` to score the predicted values given by the machine
when tested against its training set.
Args:
scorer (function): called on the result of... | python | def _generic_fit(fqdn, result, scorer, yP=None, *argl, **argd):
"""Performs the generic fit tests that are common to both classifier and
regressor; uses `scorer` to score the predicted values given by the machine
when tested against its training set.
Args:
scorer (function): called on the result of... | [
"def",
"_generic_fit",
"(",
"fqdn",
",",
"result",
",",
"scorer",
",",
"yP",
"=",
"None",
",",
"*",
"argl",
",",
"*",
"*",
"argd",
")",
":",
"out",
"=",
"None",
"if",
"len",
"(",
"argl",
")",
">",
"0",
":",
"machine",
"=",
"argl",
"[",
"0",
"... | Performs the generic fit tests that are common to both classifier and
regressor; uses `scorer` to score the predicted values given by the machine
when tested against its training set.
Args:
scorer (function): called on the result of `machine.predict(Xtrain,
ytrain)`. | [
"Performs",
"the",
"generic",
"fit",
"tests",
"that",
"are",
"common",
"to",
"both",
"classifier",
"and",
"regressor",
";",
"uses",
"scorer",
"to",
"score",
"the",
"predicted",
"values",
"given",
"by",
"the",
"machine",
"when",
"tested",
"against",
"its",
"t... | train | https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/analyze/sklearn.py#L152-L176 |
rosenbrockc/acorn | acorn/analyze/sklearn.py | classify_fit | def classify_fit(fqdn, result, *argl, **argd):
"""Analyzes the result of a classification algorithm's fitting. See also
:func:`fit` for explanation of arguments.
"""
if len(argl) > 2:
#Usually fit is called with fit(machine, Xtrain, ytrain).
yP = argl[2]
out = _generic_fit(fqdn, resu... | python | def classify_fit(fqdn, result, *argl, **argd):
"""Analyzes the result of a classification algorithm's fitting. See also
:func:`fit` for explanation of arguments.
"""
if len(argl) > 2:
#Usually fit is called with fit(machine, Xtrain, ytrain).
yP = argl[2]
out = _generic_fit(fqdn, resu... | [
"def",
"classify_fit",
"(",
"fqdn",
",",
"result",
",",
"*",
"argl",
",",
"*",
"*",
"argd",
")",
":",
"if",
"len",
"(",
"argl",
")",
">",
"2",
":",
"#Usually fit is called with fit(machine, Xtrain, ytrain).",
"yP",
"=",
"argl",
"[",
"2",
"]",
"out",
"=",... | Analyzes the result of a classification algorithm's fitting. See also
:func:`fit` for explanation of arguments. | [
"Analyzes",
"the",
"result",
"of",
"a",
"classification",
"algorithm",
"s",
"fitting",
".",
"See",
"also",
":",
"func",
":",
"fit",
"for",
"explanation",
"of",
"arguments",
"."
] | train | https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/analyze/sklearn.py#L178-L186 |
rosenbrockc/acorn | acorn/analyze/sklearn.py | _percent_match | def _percent_match(result, out, yP=None, *argl):
"""Returns the percent match for the specified prediction call; requires
that the data was split before using an analyzed method.
Args:
out (dict): output dictionary to save the result to.
"""
if len(argl) > 1:
if yP is None:
... | python | def _percent_match(result, out, yP=None, *argl):
"""Returns the percent match for the specified prediction call; requires
that the data was split before using an analyzed method.
Args:
out (dict): output dictionary to save the result to.
"""
if len(argl) > 1:
if yP is None:
... | [
"def",
"_percent_match",
"(",
"result",
",",
"out",
",",
"yP",
"=",
"None",
",",
"*",
"argl",
")",
":",
"if",
"len",
"(",
"argl",
")",
">",
"1",
":",
"if",
"yP",
"is",
"None",
":",
"Xt",
"=",
"argl",
"[",
"1",
"]",
"key",
"=",
"id",
"(",
"X... | Returns the percent match for the specified prediction call; requires
that the data was split before using an analyzed method.
Args:
out (dict): output dictionary to save the result to. | [
"Returns",
"the",
"percent",
"match",
"for",
"the",
"specified",
"prediction",
"call",
";",
"requires",
"that",
"the",
"data",
"was",
"split",
"before",
"using",
"an",
"analyzed",
"method",
"."
] | train | https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/analyze/sklearn.py#L188-L204 |
rosenbrockc/acorn | acorn/analyze/sklearn.py | classify_predict | def classify_predict(fqdn, result, yP=None, *argl, **argd):
"""Analyzes the result of a classification algorithm's prediction. See also
:func:`predict` for explanation of arguments.
.. todo: update the metric to be useful.
"""
#For now, just to make sure the machinery works correctly, let's return... | python | def classify_predict(fqdn, result, yP=None, *argl, **argd):
"""Analyzes the result of a classification algorithm's prediction. See also
:func:`predict` for explanation of arguments.
.. todo: update the metric to be useful.
"""
#For now, just to make sure the machinery works correctly, let's return... | [
"def",
"classify_predict",
"(",
"fqdn",
",",
"result",
",",
"yP",
"=",
"None",
",",
"*",
"argl",
",",
"*",
"*",
"argd",
")",
":",
"#For now, just to make sure the machinery works correctly, let's return the",
"#percentage correct. This is a terrible metric in practice.",
"o... | Analyzes the result of a classification algorithm's prediction. See also
:func:`predict` for explanation of arguments.
.. todo: update the metric to be useful. | [
"Analyzes",
"the",
"result",
"of",
"a",
"classification",
"algorithm",
"s",
"prediction",
".",
"See",
"also",
":",
"func",
":",
"predict",
"for",
"explanation",
"of",
"arguments",
"."
] | train | https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/analyze/sklearn.py#L206-L221 |
rosenbrockc/acorn | acorn/analyze/sklearn.py | regress_fit | def regress_fit(fqdn, result, *argl, **argd):
"""Analyzes the result of a regression algorithm's fitting. See also
:func:`fit` for explanation of arguments.
"""
if len(argl) > 2:
yP = argl[2]
out = _generic_fit(fqdn, result, regress_predict, yP, *argl, **argd)
return out | python | def regress_fit(fqdn, result, *argl, **argd):
"""Analyzes the result of a regression algorithm's fitting. See also
:func:`fit` for explanation of arguments.
"""
if len(argl) > 2:
yP = argl[2]
out = _generic_fit(fqdn, result, regress_predict, yP, *argl, **argd)
return out | [
"def",
"regress_fit",
"(",
"fqdn",
",",
"result",
",",
"*",
"argl",
",",
"*",
"*",
"argd",
")",
":",
"if",
"len",
"(",
"argl",
")",
">",
"2",
":",
"yP",
"=",
"argl",
"[",
"2",
"]",
"out",
"=",
"_generic_fit",
"(",
"fqdn",
",",
"result",
",",
... | Analyzes the result of a regression algorithm's fitting. See also
:func:`fit` for explanation of arguments. | [
"Analyzes",
"the",
"result",
"of",
"a",
"regression",
"algorithm",
"s",
"fitting",
".",
"See",
"also",
":",
"func",
":",
"fit",
"for",
"explanation",
"of",
"arguments",
"."
] | train | https://github.com/rosenbrockc/acorn/blob/9a44d1a1ad8bfc2c54a6b56d9efe54433a797820/acorn/analyze/sklearn.py#L223-L230 |
basvandenbroek/gcloud_taskqueue | gcloud_taskqueue/task.py | Task.path | def path(self):
"""Getter property for the URL path to this Task.
:rtype: string
:returns: The URL path to this task.
"""
if not self.id:
raise ValueError('Cannot determine path without a task id.')
return self.path_helper(self.taskqueue.path, self.id) | python | def path(self):
"""Getter property for the URL path to this Task.
:rtype: string
:returns: The URL path to this task.
"""
if not self.id:
raise ValueError('Cannot determine path without a task id.')
return self.path_helper(self.taskqueue.path, self.id) | [
"def",
"path",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"id",
":",
"raise",
"ValueError",
"(",
"'Cannot determine path without a task id.'",
")",
"return",
"self",
".",
"path_helper",
"(",
"self",
".",
"taskqueue",
".",
"path",
",",
"self",
".",
"i... | Getter property for the URL path to this Task.
:rtype: string
:returns: The URL path to this task. | [
"Getter",
"property",
"for",
"the",
"URL",
"path",
"to",
"this",
"Task",
"."
] | train | https://github.com/basvandenbroek/gcloud_taskqueue/blob/b147b57f7c0ad9e8030ee9797d6526a448aa5007/gcloud_taskqueue/task.py#L77-L86 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.