id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
55,000 | SmartTeleMax/iktomi | iktomi/templates/jinja2/__init__.py | TemplateEngine.render | def render(self, template_name, **kw):
'Interface method called from `Template.render`'
return self.env.get_template(template_name).render(**kw) | python | def render(self, template_name, **kw):
'Interface method called from `Template.render`'
return self.env.get_template(template_name).render(**kw) | [
"def",
"render",
"(",
"self",
",",
"template_name",
",",
"*",
"*",
"kw",
")",
":",
"return",
"self",
".",
"env",
".",
"get_template",
"(",
"template_name",
")",
".",
"render",
"(",
"*",
"*",
"kw",
")"
] | Interface method called from `Template.render` | [
"Interface",
"method",
"called",
"from",
"Template",
".",
"render"
] | 80bc0f1408d63efe7f5844367d1f6efba44b35f2 | https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/templates/jinja2/__init__.py#L36-L38 |
55,001 | CivicSpleen/ambry | ambry/library/__init__.py | Library.ctor_args | def ctor_args(self):
"""Return arguments for constructing a copy"""
return dict(
config=self._config,
search=self._search,
echo=self._echo,
read_only=self.read_only
) | python | def ctor_args(self):
"""Return arguments for constructing a copy"""
return dict(
config=self._config,
search=self._search,
echo=self._echo,
read_only=self.read_only
) | [
"def",
"ctor_args",
"(",
"self",
")",
":",
"return",
"dict",
"(",
"config",
"=",
"self",
".",
"_config",
",",
"search",
"=",
"self",
".",
"_search",
",",
"echo",
"=",
"self",
".",
"_echo",
",",
"read_only",
"=",
"self",
".",
"read_only",
")"
] | Return arguments for constructing a copy | [
"Return",
"arguments",
"for",
"constructing",
"a",
"copy"
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/__init__.py#L116-L124 |
55,002 | CivicSpleen/ambry | ambry/library/__init__.py | Library.sync_config | def sync_config(self, force=False):
"""Sync the file config into the library proxy data in the root dataset """
from ambry.library.config import LibraryConfigSyncProxy
lcsp = LibraryConfigSyncProxy(self)
lcsp.sync(force=force) | python | def sync_config(self, force=False):
"""Sync the file config into the library proxy data in the root dataset """
from ambry.library.config import LibraryConfigSyncProxy
lcsp = LibraryConfigSyncProxy(self)
lcsp.sync(force=force) | [
"def",
"sync_config",
"(",
"self",
",",
"force",
"=",
"False",
")",
":",
"from",
"ambry",
".",
"library",
".",
"config",
"import",
"LibraryConfigSyncProxy",
"lcsp",
"=",
"LibraryConfigSyncProxy",
"(",
"self",
")",
"lcsp",
".",
"sync",
"(",
"force",
"=",
"f... | Sync the file config into the library proxy data in the root dataset | [
"Sync",
"the",
"file",
"config",
"into",
"the",
"library",
"proxy",
"data",
"in",
"the",
"root",
"dataset"
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/__init__.py#L138-L142 |
55,003 | CivicSpleen/ambry | ambry/library/__init__.py | Library.init_debug | def init_debug(self):
"""Initialize debugging features, such as a handler for USR2 to print a trace"""
import signal
def debug_trace(sig, frame):
"""Interrupt running process, and provide a python prompt for interactive
debugging."""
self.log('Trace signal r... | python | def init_debug(self):
"""Initialize debugging features, such as a handler for USR2 to print a trace"""
import signal
def debug_trace(sig, frame):
"""Interrupt running process, and provide a python prompt for interactive
debugging."""
self.log('Trace signal r... | [
"def",
"init_debug",
"(",
"self",
")",
":",
"import",
"signal",
"def",
"debug_trace",
"(",
"sig",
",",
"frame",
")",
":",
"\"\"\"Interrupt running process, and provide a python prompt for interactive\n debugging.\"\"\"",
"self",
".",
"log",
"(",
"'Trace signal re... | Initialize debugging features, such as a handler for USR2 to print a trace | [
"Initialize",
"debugging",
"features",
"such",
"as",
"a",
"handler",
"for",
"USR2",
"to",
"print",
"a",
"trace"
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/__init__.py#L144-L155 |
55,004 | CivicSpleen/ambry | ambry/library/__init__.py | Library.resolve_object_number | def resolve_object_number(self, ref):
"""Resolve a variety of object numebrs to a dataset number"""
if not isinstance(ref, ObjectNumber):
on = ObjectNumber.parse(ref)
else:
on = ref
ds_on = on.as_dataset
return ds_on | python | def resolve_object_number(self, ref):
"""Resolve a variety of object numebrs to a dataset number"""
if not isinstance(ref, ObjectNumber):
on = ObjectNumber.parse(ref)
else:
on = ref
ds_on = on.as_dataset
return ds_on | [
"def",
"resolve_object_number",
"(",
"self",
",",
"ref",
")",
":",
"if",
"not",
"isinstance",
"(",
"ref",
",",
"ObjectNumber",
")",
":",
"on",
"=",
"ObjectNumber",
".",
"parse",
"(",
"ref",
")",
"else",
":",
"on",
"=",
"ref",
"ds_on",
"=",
"on",
".",... | Resolve a variety of object numebrs to a dataset number | [
"Resolve",
"a",
"variety",
"of",
"object",
"numebrs",
"to",
"a",
"dataset",
"number"
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/__init__.py#L157-L167 |
55,005 | CivicSpleen/ambry | ambry/library/__init__.py | Library.new_bundle | def new_bundle(self, assignment_class=None, **kwargs):
"""
Create a new bundle, with the same arguments as creating a new dataset
:param assignment_class: String. assignment class to use for fetching a number, if one
is not specified in kwargs
:param kwargs:
:return:
... | python | def new_bundle(self, assignment_class=None, **kwargs):
"""
Create a new bundle, with the same arguments as creating a new dataset
:param assignment_class: String. assignment class to use for fetching a number, if one
is not specified in kwargs
:param kwargs:
:return:
... | [
"def",
"new_bundle",
"(",
"self",
",",
"assignment_class",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"(",
"'id'",
"in",
"kwargs",
"and",
"bool",
"(",
"kwargs",
"[",
"'id'",
"]",
")",
")",
"or",
"assignment_class",
"is",
"not",
"Non... | Create a new bundle, with the same arguments as creating a new dataset
:param assignment_class: String. assignment class to use for fetching a number, if one
is not specified in kwargs
:param kwargs:
:return: | [
"Create",
"a",
"new",
"bundle",
"with",
"the",
"same",
"arguments",
"as",
"creating",
"a",
"new",
"dataset"
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/__init__.py#L239-L270 |
55,006 | CivicSpleen/ambry | ambry/library/__init__.py | Library.new_from_bundle_config | def new_from_bundle_config(self, config):
"""
Create a new bundle, or link to an existing one, based on the identity in config data.
:param config: A Dict form of a bundle.yaml file
:return:
"""
identity = Identity.from_dict(config['identity'])
ds = self._db.dat... | python | def new_from_bundle_config(self, config):
"""
Create a new bundle, or link to an existing one, based on the identity in config data.
:param config: A Dict form of a bundle.yaml file
:return:
"""
identity = Identity.from_dict(config['identity'])
ds = self._db.dat... | [
"def",
"new_from_bundle_config",
"(",
"self",
",",
"config",
")",
":",
"identity",
"=",
"Identity",
".",
"from_dict",
"(",
"config",
"[",
"'identity'",
"]",
")",
"ds",
"=",
"self",
".",
"_db",
".",
"dataset",
"(",
"identity",
".",
"vid",
",",
"exception"... | Create a new bundle, or link to an existing one, based on the identity in config data.
:param config: A Dict form of a bundle.yaml file
:return: | [
"Create",
"a",
"new",
"bundle",
"or",
"link",
"to",
"an",
"existing",
"one",
"based",
"on",
"the",
"identity",
"in",
"config",
"data",
"."
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/__init__.py#L272-L294 |
55,007 | CivicSpleen/ambry | ambry/library/__init__.py | Library.bundle | def bundle(self, ref, capture_exceptions=False):
"""Return a bundle build on a dataset, with the given vid or id reference"""
from ..orm.exc import NotFoundError
if isinstance(ref, Dataset):
ds = ref
else:
try:
ds = self._db.dataset(ref)
... | python | def bundle(self, ref, capture_exceptions=False):
"""Return a bundle build on a dataset, with the given vid or id reference"""
from ..orm.exc import NotFoundError
if isinstance(ref, Dataset):
ds = ref
else:
try:
ds = self._db.dataset(ref)
... | [
"def",
"bundle",
"(",
"self",
",",
"ref",
",",
"capture_exceptions",
"=",
"False",
")",
":",
"from",
".",
".",
"orm",
".",
"exc",
"import",
"NotFoundError",
"if",
"isinstance",
"(",
"ref",
",",
"Dataset",
")",
":",
"ds",
"=",
"ref",
"else",
":",
"try... | Return a bundle build on a dataset, with the given vid or id reference | [
"Return",
"a",
"bundle",
"build",
"on",
"a",
"dataset",
"with",
"the",
"given",
"vid",
"or",
"id",
"reference"
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/__init__.py#L296-L321 |
55,008 | CivicSpleen/ambry | ambry/library/__init__.py | Library.partition | def partition(self, ref, localize=False):
""" Finds partition by ref and converts to bundle partition.
:param ref: A partition reference
:param localize: If True, copy a remote partition to local filesystem. Defaults to False
:raises: NotFoundError: if partition with given ref not found... | python | def partition(self, ref, localize=False):
""" Finds partition by ref and converts to bundle partition.
:param ref: A partition reference
:param localize: If True, copy a remote partition to local filesystem. Defaults to False
:raises: NotFoundError: if partition with given ref not found... | [
"def",
"partition",
"(",
"self",
",",
"ref",
",",
"localize",
"=",
"False",
")",
":",
"if",
"not",
"ref",
":",
"raise",
"NotFoundError",
"(",
"\"No partition for empty ref\"",
")",
"try",
":",
"on",
"=",
"ObjectNumber",
".",
"parse",
"(",
"ref",
")",
"ds... | Finds partition by ref and converts to bundle partition.
:param ref: A partition reference
:param localize: If True, copy a remote partition to local filesystem. Defaults to False
:raises: NotFoundError: if partition with given ref not found.
:return: orm.Partition: found partition. | [
"Finds",
"partition",
"by",
"ref",
"and",
"converts",
"to",
"bundle",
"partition",
"."
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/__init__.py#L336-L377 |
55,009 | CivicSpleen/ambry | ambry/library/__init__.py | Library.table | def table(self, ref):
""" Finds table by ref and returns it.
Args:
ref (str): id, vid (versioned id) or name of the table
Raises:
NotFoundError: if table with given ref not found.
Returns:
orm.Table
"""
try:
obj_number ... | python | def table(self, ref):
""" Finds table by ref and returns it.
Args:
ref (str): id, vid (versioned id) or name of the table
Raises:
NotFoundError: if table with given ref not found.
Returns:
orm.Table
"""
try:
obj_number ... | [
"def",
"table",
"(",
"self",
",",
"ref",
")",
":",
"try",
":",
"obj_number",
"=",
"ObjectNumber",
".",
"parse",
"(",
"ref",
")",
"ds_obj_number",
"=",
"obj_number",
".",
"as_dataset",
"dataset",
"=",
"self",
".",
"_db",
".",
"dataset",
"(",
"ds_obj_numbe... | Finds table by ref and returns it.
Args:
ref (str): id, vid (versioned id) or name of the table
Raises:
NotFoundError: if table with given ref not found.
Returns:
orm.Table | [
"Finds",
"table",
"by",
"ref",
"and",
"returns",
"it",
"."
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/__init__.py#L379-L409 |
55,010 | CivicSpleen/ambry | ambry/library/__init__.py | Library.remove | def remove(self, bundle):
""" Removes a bundle from the library and deletes the configuration for
it from the library database."""
from six import string_types
if isinstance(bundle, string_types):
bundle = self.bundle(bundle)
self.database.remove_dataset(bundle.data... | python | def remove(self, bundle):
""" Removes a bundle from the library and deletes the configuration for
it from the library database."""
from six import string_types
if isinstance(bundle, string_types):
bundle = self.bundle(bundle)
self.database.remove_dataset(bundle.data... | [
"def",
"remove",
"(",
"self",
",",
"bundle",
")",
":",
"from",
"six",
"import",
"string_types",
"if",
"isinstance",
"(",
"bundle",
",",
"string_types",
")",
":",
"bundle",
"=",
"self",
".",
"bundle",
"(",
"bundle",
")",
"self",
".",
"database",
".",
"r... | Removes a bundle from the library and deletes the configuration for
it from the library database. | [
"Removes",
"a",
"bundle",
"from",
"the",
"library",
"and",
"deletes",
"the",
"configuration",
"for",
"it",
"from",
"the",
"library",
"database",
"."
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/__init__.py#L411-L419 |
55,011 | CivicSpleen/ambry | ambry/library/__init__.py | Library.duplicate | def duplicate(self, b):
"""Duplicate a bundle, with a higher version number.
This only copies the files, under the theory that the bundle can be rebuilt from them.
"""
on = b.identity.on
on.revision = on.revision + 1
try:
extant = self.bundle(str(on))
... | python | def duplicate(self, b):
"""Duplicate a bundle, with a higher version number.
This only copies the files, under the theory that the bundle can be rebuilt from them.
"""
on = b.identity.on
on.revision = on.revision + 1
try:
extant = self.bundle(str(on))
... | [
"def",
"duplicate",
"(",
"self",
",",
"b",
")",
":",
"on",
"=",
"b",
".",
"identity",
".",
"on",
"on",
".",
"revision",
"=",
"on",
".",
"revision",
"+",
"1",
"try",
":",
"extant",
"=",
"self",
".",
"bundle",
"(",
"str",
"(",
"on",
")",
")",
"... | Duplicate a bundle, with a higher version number.
This only copies the files, under the theory that the bundle can be rebuilt from them. | [
"Duplicate",
"a",
"bundle",
"with",
"a",
"higher",
"version",
"number",
"."
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/__init__.py#L442-L488 |
55,012 | CivicSpleen/ambry | ambry/library/__init__.py | Library.checkin_bundle | def checkin_bundle(self, db_path, replace=True, cb=None):
"""Add a bundle, as a Sqlite file, to this library"""
from ambry.orm.exc import NotFoundError
db = Database('sqlite:///{}'.format(db_path))
db.open()
if len(db.datasets) == 0:
raise NotFoundError("Did not get... | python | def checkin_bundle(self, db_path, replace=True, cb=None):
"""Add a bundle, as a Sqlite file, to this library"""
from ambry.orm.exc import NotFoundError
db = Database('sqlite:///{}'.format(db_path))
db.open()
if len(db.datasets) == 0:
raise NotFoundError("Did not get... | [
"def",
"checkin_bundle",
"(",
"self",
",",
"db_path",
",",
"replace",
"=",
"True",
",",
"cb",
"=",
"None",
")",
":",
"from",
"ambry",
".",
"orm",
".",
"exc",
"import",
"NotFoundError",
"db",
"=",
"Database",
"(",
"'sqlite:///{}'",
".",
"format",
"(",
"... | Add a bundle, as a Sqlite file, to this library | [
"Add",
"a",
"bundle",
"as",
"a",
"Sqlite",
"file",
"to",
"this",
"library"
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/__init__.py#L490-L528 |
55,013 | CivicSpleen/ambry | ambry/library/__init__.py | Library.checkin_remote_bundle | def checkin_remote_bundle(self, ref, remote=None):
""" Checkin a remote bundle to this library.
:param ref: Any bundle reference
:param remote: If specified, use this remote. If not, search for the reference
in cached directory listings
:param cb: A one argument progress cal... | python | def checkin_remote_bundle(self, ref, remote=None):
""" Checkin a remote bundle to this library.
:param ref: Any bundle reference
:param remote: If specified, use this remote. If not, search for the reference
in cached directory listings
:param cb: A one argument progress cal... | [
"def",
"checkin_remote_bundle",
"(",
"self",
",",
"ref",
",",
"remote",
"=",
"None",
")",
":",
"if",
"not",
"remote",
":",
"remote",
",",
"vname",
"=",
"self",
".",
"find_remote_bundle",
"(",
"ref",
")",
"if",
"vname",
":",
"ref",
"=",
"vname",
"else",... | Checkin a remote bundle to this library.
:param ref: Any bundle reference
:param remote: If specified, use this remote. If not, search for the reference
in cached directory listings
:param cb: A one argument progress callback
:return: | [
"Checkin",
"a",
"remote",
"bundle",
"to",
"this",
"library",
"."
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/__init__.py#L627-L653 |
55,014 | CivicSpleen/ambry | ambry/library/__init__.py | Library.remotes | def remotes(self):
"""Return the names and URLs of the remotes"""
from ambry.orm import Remote
for r in self.database.session.query(Remote).all():
if not r.short_name:
continue
yield self.remote(r.short_name) | python | def remotes(self):
"""Return the names and URLs of the remotes"""
from ambry.orm import Remote
for r in self.database.session.query(Remote).all():
if not r.short_name:
continue
yield self.remote(r.short_name) | [
"def",
"remotes",
"(",
"self",
")",
":",
"from",
"ambry",
".",
"orm",
"import",
"Remote",
"for",
"r",
"in",
"self",
".",
"database",
".",
"session",
".",
"query",
"(",
"Remote",
")",
".",
"all",
"(",
")",
":",
"if",
"not",
"r",
".",
"short_name",
... | Return the names and URLs of the remotes | [
"Return",
"the",
"names",
"and",
"URLs",
"of",
"the",
"remotes"
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/__init__.py#L715-L722 |
55,015 | CivicSpleen/ambry | ambry/library/__init__.py | Library._remote | def _remote(self, name):
"""Return a remote for which 'name' matches the short_name or url """
from ambry.orm import Remote
from sqlalchemy import or_
from ambry.orm.exc import NotFoundError
from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound
if not name.s... | python | def _remote(self, name):
"""Return a remote for which 'name' matches the short_name or url """
from ambry.orm import Remote
from sqlalchemy import or_
from ambry.orm.exc import NotFoundError
from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound
if not name.s... | [
"def",
"_remote",
"(",
"self",
",",
"name",
")",
":",
"from",
"ambry",
".",
"orm",
"import",
"Remote",
"from",
"sqlalchemy",
"import",
"or_",
"from",
"ambry",
".",
"orm",
".",
"exc",
"import",
"NotFoundError",
"from",
"sqlalchemy",
".",
"orm",
".",
"exc"... | Return a remote for which 'name' matches the short_name or url | [
"Return",
"a",
"remote",
"for",
"which",
"name",
"matches",
"the",
"short_name",
"or",
"url"
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/__init__.py#L724-L749 |
55,016 | CivicSpleen/ambry | ambry/library/__init__.py | Library.number | def number(self, assignment_class=None, namespace='d'):
"""
Return a new number.
:param assignment_class: Determines the length of the number. Possible values are 'authority' (3 characters) ,
'registered' (5) , 'unregistered' (7) and 'self' (9). Self assigned numbers are random and... | python | def number(self, assignment_class=None, namespace='d'):
"""
Return a new number.
:param assignment_class: Determines the length of the number. Possible values are 'authority' (3 characters) ,
'registered' (5) , 'unregistered' (7) and 'self' (9). Self assigned numbers are random and... | [
"def",
"number",
"(",
"self",
",",
"assignment_class",
"=",
"None",
",",
"namespace",
"=",
"'d'",
")",
":",
"if",
"assignment_class",
"==",
"'self'",
":",
"# When 'self' is explicit, don't look for number server config",
"return",
"str",
"(",
"DatasetNumber",
"(",
"... | Return a new number.
:param assignment_class: Determines the length of the number. Possible values are 'authority' (3 characters) ,
'registered' (5) , 'unregistered' (7) and 'self' (9). Self assigned numbers are random and acquired locally,
while the other assignment classes use the nu... | [
"Return",
"a",
"new",
"number",
"."
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/__init__.py#L995-L1060 |
55,017 | CivicSpleen/ambry | ambry/library/__init__.py | Library.edit_history | def edit_history(self):
"""Return config record information about the most recent bundle accesses and operations"""
ret = self._db.session\
.query(Config)\
.filter(Config.type == 'buildstate')\
.filter(Config.group == 'access')\
.filter(Config.key == 'las... | python | def edit_history(self):
"""Return config record information about the most recent bundle accesses and operations"""
ret = self._db.session\
.query(Config)\
.filter(Config.type == 'buildstate')\
.filter(Config.group == 'access')\
.filter(Config.key == 'las... | [
"def",
"edit_history",
"(",
"self",
")",
":",
"ret",
"=",
"self",
".",
"_db",
".",
"session",
".",
"query",
"(",
"Config",
")",
".",
"filter",
"(",
"Config",
".",
"type",
"==",
"'buildstate'",
")",
".",
"filter",
"(",
"Config",
".",
"group",
"==",
... | Return config record information about the most recent bundle accesses and operations | [
"Return",
"config",
"record",
"information",
"about",
"the",
"most",
"recent",
"bundle",
"accesses",
"and",
"operations"
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/__init__.py#L1062-L1072 |
55,018 | CivicSpleen/ambry | ambry/library/__init__.py | Library.import_bundles | def import_bundles(self, dir, detach=False, force=False):
"""
Import bundles from a directory
:param dir:
:return:
"""
import yaml
fs = fsopendir(dir)
bundles = []
for f in fs.walkfiles(wildcard='bundle.yaml'):
self.logger.info('V... | python | def import_bundles(self, dir, detach=False, force=False):
"""
Import bundles from a directory
:param dir:
:return:
"""
import yaml
fs = fsopendir(dir)
bundles = []
for f in fs.walkfiles(wildcard='bundle.yaml'):
self.logger.info('V... | [
"def",
"import_bundles",
"(",
"self",
",",
"dir",
",",
"detach",
"=",
"False",
",",
"force",
"=",
"False",
")",
":",
"import",
"yaml",
"fs",
"=",
"fsopendir",
"(",
"dir",
")",
"bundles",
"=",
"[",
"]",
"for",
"f",
"in",
"fs",
".",
"walkfiles",
"(",... | Import bundles from a directory
:param dir:
:return: | [
"Import",
"bundles",
"from",
"a",
"directory"
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/__init__.py#L1106-L1161 |
55,019 | CivicSpleen/ambry | ambry/library/__init__.py | Library.process_pool | def process_pool(self, limited_run=False):
"""Return a pool for multiprocess operations, sized either to the number of CPUS, or a configured value"""
from multiprocessing import cpu_count
from ambry.bundle.concurrent import Pool, init_library
if self.processes:
cpus = self.... | python | def process_pool(self, limited_run=False):
"""Return a pool for multiprocess operations, sized either to the number of CPUS, or a configured value"""
from multiprocessing import cpu_count
from ambry.bundle.concurrent import Pool, init_library
if self.processes:
cpus = self.... | [
"def",
"process_pool",
"(",
"self",
",",
"limited_run",
"=",
"False",
")",
":",
"from",
"multiprocessing",
"import",
"cpu_count",
"from",
"ambry",
".",
"bundle",
".",
"concurrent",
"import",
"Pool",
",",
"init_library",
"if",
"self",
".",
"processes",
":",
"... | Return a pool for multiprocess operations, sized either to the number of CPUS, or a configured value | [
"Return",
"a",
"pool",
"for",
"multiprocess",
"operations",
"sized",
"either",
"to",
"the",
"number",
"of",
"CPUS",
"or",
"a",
"configured",
"value"
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/__init__.py#L1163-L1177 |
55,020 | CivicSpleen/ambry | ambry/etl/codegen.py | file_loc | def file_loc():
"""Return file and line number"""
import sys
import inspect
try:
raise Exception
except:
file_ = '.../' + '/'.join((inspect.currentframe().f_code.co_filename.split('/'))[-3:])
line_ = sys.exc_info()[2].tb_frame.f_back.f_lineno
return "{}:{}".format(fil... | python | def file_loc():
"""Return file and line number"""
import sys
import inspect
try:
raise Exception
except:
file_ = '.../' + '/'.join((inspect.currentframe().f_code.co_filename.split('/'))[-3:])
line_ = sys.exc_info()[2].tb_frame.f_back.f_lineno
return "{}:{}".format(fil... | [
"def",
"file_loc",
"(",
")",
":",
"import",
"sys",
"import",
"inspect",
"try",
":",
"raise",
"Exception",
"except",
":",
"file_",
"=",
"'.../'",
"+",
"'/'",
".",
"join",
"(",
"(",
"inspect",
".",
"currentframe",
"(",
")",
".",
"f_code",
".",
"co_filena... | Return file and line number | [
"Return",
"file",
"and",
"line",
"number"
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/etl/codegen.py#L12-L21 |
55,021 | CivicSpleen/ambry | ambry/etl/codegen.py | calling_code | def calling_code(f, f_name=None, raise_for_missing=True):
"""Return the code string for calling a function. """
import inspect
from ambry.dbexceptions import ConfigurationError
if inspect.isclass(f):
try:
args = inspect.getargspec(f.__init__).args
except TypeError as e:
... | python | def calling_code(f, f_name=None, raise_for_missing=True):
"""Return the code string for calling a function. """
import inspect
from ambry.dbexceptions import ConfigurationError
if inspect.isclass(f):
try:
args = inspect.getargspec(f.__init__).args
except TypeError as e:
... | [
"def",
"calling_code",
"(",
"f",
",",
"f_name",
"=",
"None",
",",
"raise_for_missing",
"=",
"True",
")",
":",
"import",
"inspect",
"from",
"ambry",
".",
"dbexceptions",
"import",
"ConfigurationError",
"if",
"inspect",
".",
"isclass",
"(",
"f",
")",
":",
"t... | Return the code string for calling a function. | [
"Return",
"the",
"code",
"string",
"for",
"calling",
"a",
"function",
"."
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/etl/codegen.py#L204-L231 |
55,022 | flaviogrossi/sockjs-cyclone | sockjs/cyclone/utils.py | PriorityQueue.push | def push(self, el):
""" Put a new element in the queue. """
count = next(self.counter)
heapq.heappush(self._queue, (el, count)) | python | def push(self, el):
""" Put a new element in the queue. """
count = next(self.counter)
heapq.heappush(self._queue, (el, count)) | [
"def",
"push",
"(",
"self",
",",
"el",
")",
":",
"count",
"=",
"next",
"(",
"self",
".",
"counter",
")",
"heapq",
".",
"heappush",
"(",
"self",
".",
"_queue",
",",
"(",
"el",
",",
"count",
")",
")"
] | Put a new element in the queue. | [
"Put",
"a",
"new",
"element",
"in",
"the",
"queue",
"."
] | d3ca053ec1aa1e85f652347bff562c2319be37a2 | https://github.com/flaviogrossi/sockjs-cyclone/blob/d3ca053ec1aa1e85f652347bff562c2319be37a2/sockjs/cyclone/utils.py#L38-L41 |
55,023 | CivicSpleen/ambry | ambry/orm/partition.py | PartitionDisplay.geo_description | def geo_description(self):
"""Return a description of the geographic extents, using the largest scale
space and grain coverages"""
sc = self._p.space_coverage
gc = self._p.grain_coverage
if sc and gc:
if parse_to_gvid(gc[0]).level == 'state' and parse_to_gvid(sc[0])... | python | def geo_description(self):
"""Return a description of the geographic extents, using the largest scale
space and grain coverages"""
sc = self._p.space_coverage
gc = self._p.grain_coverage
if sc and gc:
if parse_to_gvid(gc[0]).level == 'state' and parse_to_gvid(sc[0])... | [
"def",
"geo_description",
"(",
"self",
")",
":",
"sc",
"=",
"self",
".",
"_p",
".",
"space_coverage",
"gc",
"=",
"self",
".",
"_p",
".",
"grain_coverage",
"if",
"sc",
"and",
"gc",
":",
"if",
"parse_to_gvid",
"(",
"gc",
"[",
"0",
"]",
")",
".",
"lev... | Return a description of the geographic extents, using the largest scale
space and grain coverages | [
"Return",
"a",
"description",
"of",
"the",
"geographic",
"extents",
"using",
"the",
"largest",
"scale",
"space",
"and",
"grain",
"coverages"
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/partition.py#L56-L75 |
55,024 | CivicSpleen/ambry | ambry/orm/partition.py | PartitionDisplay.time_description | def time_description(self):
"""String description of the year or year range"""
tc = [t for t in self._p.time_coverage if t]
if not tc:
return ''
mn = min(tc)
mx = max(tc)
if not mn and not mx:
return ''
elif mn == mx:
return... | python | def time_description(self):
"""String description of the year or year range"""
tc = [t for t in self._p.time_coverage if t]
if not tc:
return ''
mn = min(tc)
mx = max(tc)
if not mn and not mx:
return ''
elif mn == mx:
return... | [
"def",
"time_description",
"(",
"self",
")",
":",
"tc",
"=",
"[",
"t",
"for",
"t",
"in",
"self",
".",
"_p",
".",
"time_coverage",
"if",
"t",
"]",
"if",
"not",
"tc",
":",
"return",
"''",
"mn",
"=",
"min",
"(",
"tc",
")",
"mx",
"=",
"max",
"(",
... | String description of the year or year range | [
"String",
"description",
"of",
"the",
"year",
"or",
"year",
"range"
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/partition.py#L78-L94 |
55,025 | CivicSpleen/ambry | ambry/orm/partition.py | PartitionDisplay.sub_description | def sub_description(self):
"""Time and space dscription"""
gd = self.geo_description
td = self.time_description
if gd and td:
return '{}, {}. {} Rows.'.format(gd, td, self._p.count)
elif gd:
return '{}. {} Rows.'.format(gd, self._p.count)
elif td:... | python | def sub_description(self):
"""Time and space dscription"""
gd = self.geo_description
td = self.time_description
if gd and td:
return '{}, {}. {} Rows.'.format(gd, td, self._p.count)
elif gd:
return '{}. {} Rows.'.format(gd, self._p.count)
elif td:... | [
"def",
"sub_description",
"(",
"self",
")",
":",
"gd",
"=",
"self",
".",
"geo_description",
"td",
"=",
"self",
".",
"time_description",
"if",
"gd",
"and",
"td",
":",
"return",
"'{}, {}. {} Rows.'",
".",
"format",
"(",
"gd",
",",
"td",
",",
"self",
".",
... | Time and space dscription | [
"Time",
"and",
"space",
"dscription"
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/partition.py#L97-L109 |
55,026 | CivicSpleen/ambry | ambry/orm/partition.py | Partition.identity | def identity(self):
"""Return this partition information as a PartitionId."""
if self.dataset is None:
# The relationship will be null until the object is committed
s = object_session(self)
ds = s.query(Dataset).filter(Dataset.id_ == self.d_id).one()
else:
... | python | def identity(self):
"""Return this partition information as a PartitionId."""
if self.dataset is None:
# The relationship will be null until the object is committed
s = object_session(self)
ds = s.query(Dataset).filter(Dataset.id_ == self.d_id).one()
else:
... | [
"def",
"identity",
"(",
"self",
")",
":",
"if",
"self",
".",
"dataset",
"is",
"None",
":",
"# The relationship will be null until the object is committed",
"s",
"=",
"object_session",
"(",
"self",
")",
"ds",
"=",
"s",
".",
"query",
"(",
"Dataset",
")",
".",
... | Return this partition information as a PartitionId. | [
"Return",
"this",
"partition",
"information",
"as",
"a",
"PartitionId",
"."
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/partition.py#L202-L228 |
55,027 | CivicSpleen/ambry | ambry/orm/partition.py | Partition.detail_dict | def detail_dict(self):
"""A more detailed dict that includes the descriptions, sub descriptions, table
and columns."""
d = self.dict
def aug_col(c):
d = c.dict
d['stats'] = [s.dict for s in c.stats]
return d
d['table'] = self.table.dict
... | python | def detail_dict(self):
"""A more detailed dict that includes the descriptions, sub descriptions, table
and columns."""
d = self.dict
def aug_col(c):
d = c.dict
d['stats'] = [s.dict for s in c.stats]
return d
d['table'] = self.table.dict
... | [
"def",
"detail_dict",
"(",
"self",
")",
":",
"d",
"=",
"self",
".",
"dict",
"def",
"aug_col",
"(",
"c",
")",
":",
"d",
"=",
"c",
".",
"dict",
"d",
"[",
"'stats'",
"]",
"=",
"[",
"s",
".",
"dict",
"for",
"s",
"in",
"c",
".",
"stats",
"]",
"r... | A more detailed dict that includes the descriptions, sub descriptions, table
and columns. | [
"A",
"more",
"detailed",
"dict",
"that",
"includes",
"the",
"descriptions",
"sub",
"descriptions",
"table",
"and",
"columns",
"."
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/partition.py#L420-L434 |
55,028 | CivicSpleen/ambry | ambry/orm/partition.py | Partition.local_datafile | def local_datafile(self):
"""Return the datafile for this partition, from the build directory, the remote, or the warehouse"""
from ambry_sources import MPRowsFile
from fs.errors import ResourceNotFoundError
from ambry.orm.exc import NotFoundError
try:
return MPRowsF... | python | def local_datafile(self):
"""Return the datafile for this partition, from the build directory, the remote, or the warehouse"""
from ambry_sources import MPRowsFile
from fs.errors import ResourceNotFoundError
from ambry.orm.exc import NotFoundError
try:
return MPRowsF... | [
"def",
"local_datafile",
"(",
"self",
")",
":",
"from",
"ambry_sources",
"import",
"MPRowsFile",
"from",
"fs",
".",
"errors",
"import",
"ResourceNotFoundError",
"from",
"ambry",
".",
"orm",
".",
"exc",
"import",
"NotFoundError",
"try",
":",
"return",
"MPRowsFile... | Return the datafile for this partition, from the build directory, the remote, or the warehouse | [
"Return",
"the",
"datafile",
"for",
"this",
"partition",
"from",
"the",
"build",
"directory",
"the",
"remote",
"or",
"the",
"warehouse"
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/partition.py#L598-L609 |
55,029 | CivicSpleen/ambry | ambry/orm/partition.py | Partition.remote | def remote(self):
"""
Return the remote for this partition
:return:
"""
from ambry.exc import NotFoundError
ds = self.dataset
if 'remote_name' not in ds.data:
raise NotFoundError('Could not determine remote for partition: {}'.format(self.identity.f... | python | def remote(self):
"""
Return the remote for this partition
:return:
"""
from ambry.exc import NotFoundError
ds = self.dataset
if 'remote_name' not in ds.data:
raise NotFoundError('Could not determine remote for partition: {}'.format(self.identity.f... | [
"def",
"remote",
"(",
"self",
")",
":",
"from",
"ambry",
".",
"exc",
"import",
"NotFoundError",
"ds",
"=",
"self",
".",
"dataset",
"if",
"'remote_name'",
"not",
"in",
"ds",
".",
"data",
":",
"raise",
"NotFoundError",
"(",
"'Could not determine remote for parti... | Return the remote for this partition
:return: | [
"Return",
"the",
"remote",
"for",
"this",
"partition"
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/partition.py#L612-L626 |
55,030 | CivicSpleen/ambry | ambry/orm/partition.py | Partition.is_local | def is_local(self):
"""Return true is the partition file is local"""
from ambry.orm.exc import NotFoundError
try:
if self.local_datafile.exists:
return True
except NotFoundError:
pass
return False | python | def is_local(self):
"""Return true is the partition file is local"""
from ambry.orm.exc import NotFoundError
try:
if self.local_datafile.exists:
return True
except NotFoundError:
pass
return False | [
"def",
"is_local",
"(",
"self",
")",
":",
"from",
"ambry",
".",
"orm",
".",
"exc",
"import",
"NotFoundError",
"try",
":",
"if",
"self",
".",
"local_datafile",
".",
"exists",
":",
"return",
"True",
"except",
"NotFoundError",
":",
"pass",
"return",
"False"
] | Return true is the partition file is local | [
"Return",
"true",
"is",
"the",
"partition",
"file",
"is",
"local"
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/partition.py#L659-L668 |
55,031 | CivicSpleen/ambry | ambry/orm/partition.py | Partition.localize | def localize(self, ps=None):
"""Copy a non-local partition file to the local build directory"""
from filelock import FileLock
from ambry.util import ensure_dir_exists
from ambry_sources import MPRowsFile
from fs.errors import ResourceNotFoundError
if self.is_local:
... | python | def localize(self, ps=None):
"""Copy a non-local partition file to the local build directory"""
from filelock import FileLock
from ambry.util import ensure_dir_exists
from ambry_sources import MPRowsFile
from fs.errors import ResourceNotFoundError
if self.is_local:
... | [
"def",
"localize",
"(",
"self",
",",
"ps",
"=",
"None",
")",
":",
"from",
"filelock",
"import",
"FileLock",
"from",
"ambry",
".",
"util",
"import",
"ensure_dir_exists",
"from",
"ambry_sources",
"import",
"MPRowsFile",
"from",
"fs",
".",
"errors",
"import",
"... | Copy a non-local partition file to the local build directory | [
"Copy",
"a",
"non",
"-",
"local",
"partition",
"file",
"to",
"the",
"local",
"build",
"directory"
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/partition.py#L670-L742 |
55,032 | CivicSpleen/ambry | ambry/orm/partition.py | Partition.reader | def reader(self):
from ambry.orm.exc import NotFoundError
from fs.errors import ResourceNotFoundError
"""The reader for the datafile"""
try:
return self.datafile.reader
except ResourceNotFoundError:
raise NotFoundError("Failed to find partition file, '{}'... | python | def reader(self):
from ambry.orm.exc import NotFoundError
from fs.errors import ResourceNotFoundError
"""The reader for the datafile"""
try:
return self.datafile.reader
except ResourceNotFoundError:
raise NotFoundError("Failed to find partition file, '{}'... | [
"def",
"reader",
"(",
"self",
")",
":",
"from",
"ambry",
".",
"orm",
".",
"exc",
"import",
"NotFoundError",
"from",
"fs",
".",
"errors",
"import",
"ResourceNotFoundError",
"try",
":",
"return",
"self",
".",
"datafile",
".",
"reader",
"except",
"ResourceNotFo... | The reader for the datafile | [
"The",
"reader",
"for",
"the",
"datafile"
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/partition.py#L745-L754 |
55,033 | CivicSpleen/ambry | ambry/orm/partition.py | Partition.analysis | def analysis(self):
"""Return an AnalysisPartition proxy, which wraps this partition to provide acess to
dataframes, shapely shapes and other analysis services"""
if isinstance(self, PartitionProxy):
return AnalysisPartition(self._obj)
else:
return AnalysisPartiti... | python | def analysis(self):
"""Return an AnalysisPartition proxy, which wraps this partition to provide acess to
dataframes, shapely shapes and other analysis services"""
if isinstance(self, PartitionProxy):
return AnalysisPartition(self._obj)
else:
return AnalysisPartiti... | [
"def",
"analysis",
"(",
"self",
")",
":",
"if",
"isinstance",
"(",
"self",
",",
"PartitionProxy",
")",
":",
"return",
"AnalysisPartition",
"(",
"self",
".",
"_obj",
")",
"else",
":",
"return",
"AnalysisPartition",
"(",
"self",
")"
] | Return an AnalysisPartition proxy, which wraps this partition to provide acess to
dataframes, shapely shapes and other analysis services | [
"Return",
"an",
"AnalysisPartition",
"proxy",
"which",
"wraps",
"this",
"partition",
"to",
"provide",
"acess",
"to",
"dataframes",
"shapely",
"shapes",
"and",
"other",
"analysis",
"services"
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/partition.py#L790-L796 |
55,034 | CivicSpleen/ambry | ambry/orm/partition.py | Partition.measuredim | def measuredim(self):
"""Return a MeasureDimension proxy, which wraps the partition to provide access to
columns in terms of measures and dimensions"""
if isinstance(self, PartitionProxy):
return MeasureDimensionPartition(self._obj)
else:
return MeasureDimensionP... | python | def measuredim(self):
"""Return a MeasureDimension proxy, which wraps the partition to provide access to
columns in terms of measures and dimensions"""
if isinstance(self, PartitionProxy):
return MeasureDimensionPartition(self._obj)
else:
return MeasureDimensionP... | [
"def",
"measuredim",
"(",
"self",
")",
":",
"if",
"isinstance",
"(",
"self",
",",
"PartitionProxy",
")",
":",
"return",
"MeasureDimensionPartition",
"(",
"self",
".",
"_obj",
")",
"else",
":",
"return",
"MeasureDimensionPartition",
"(",
"self",
")"
] | Return a MeasureDimension proxy, which wraps the partition to provide access to
columns in terms of measures and dimensions | [
"Return",
"a",
"MeasureDimension",
"proxy",
"which",
"wraps",
"the",
"partition",
"to",
"provide",
"access",
"to",
"columns",
"in",
"terms",
"of",
"measures",
"and",
"dimensions"
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/partition.py#L799-L806 |
55,035 | CivicSpleen/ambry | ambry/orm/partition.py | Partition.update_id | def update_id(self, sequence_id=None):
"""Alter the sequence id, and all of the names and ids derived from it. This
often needs to be done after an IntegrityError in a multiprocessing run"""
if sequence_id:
self.sequence_id = sequence_id
self._set_ids(force=True)
i... | python | def update_id(self, sequence_id=None):
"""Alter the sequence id, and all of the names and ids derived from it. This
often needs to be done after an IntegrityError in a multiprocessing run"""
if sequence_id:
self.sequence_id = sequence_id
self._set_ids(force=True)
i... | [
"def",
"update_id",
"(",
"self",
",",
"sequence_id",
"=",
"None",
")",
":",
"if",
"sequence_id",
":",
"self",
".",
"sequence_id",
"=",
"sequence_id",
"self",
".",
"_set_ids",
"(",
"force",
"=",
"True",
")",
"if",
"self",
".",
"dataset",
":",
"self",
".... | Alter the sequence id, and all of the names and ids derived from it. This
often needs to be done after an IntegrityError in a multiprocessing run | [
"Alter",
"the",
"sequence",
"id",
"and",
"all",
"of",
"the",
"names",
"and",
"ids",
"derived",
"from",
"it",
".",
"This",
"often",
"needs",
"to",
"be",
"done",
"after",
"an",
"IntegrityError",
"in",
"a",
"multiprocessing",
"run"
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/partition.py#L810-L820 |
55,036 | CivicSpleen/ambry | ambry/orm/partition.py | Partition._update_names | def _update_names(self):
"""Update the derived names"""
d = dict(
table=self.table_name,
time=self.time,
space=self.space,
grain=self.grain,
variant=self.variant,
segment=self.segment
)
assert self.dataset
... | python | def _update_names(self):
"""Update the derived names"""
d = dict(
table=self.table_name,
time=self.time,
space=self.space,
grain=self.grain,
variant=self.variant,
segment=self.segment
)
assert self.dataset
... | [
"def",
"_update_names",
"(",
"self",
")",
":",
"d",
"=",
"dict",
"(",
"table",
"=",
"self",
".",
"table_name",
",",
"time",
"=",
"self",
".",
"time",
",",
"space",
"=",
"self",
".",
"space",
",",
"grain",
"=",
"self",
".",
"grain",
",",
"variant",
... | Update the derived names | [
"Update",
"the",
"derived",
"names"
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/partition.py#L841-L860 |
55,037 | CivicSpleen/ambry | ambry/orm/partition.py | AnalysisPartition.dataframe | def dataframe(self, predicate=None, filtered_columns=None, columns=None, df_class=None):
"""Return the partition as a Pandas dataframe
:param predicate: If defined, a callable that is called for each row, and if it returns true, the
row is included in the output.
:param filtered_column... | python | def dataframe(self, predicate=None, filtered_columns=None, columns=None, df_class=None):
"""Return the partition as a Pandas dataframe
:param predicate: If defined, a callable that is called for each row, and if it returns true, the
row is included in the output.
:param filtered_column... | [
"def",
"dataframe",
"(",
"self",
",",
"predicate",
"=",
"None",
",",
"filtered_columns",
"=",
"None",
",",
"columns",
"=",
"None",
",",
"df_class",
"=",
"None",
")",
":",
"from",
"operator",
"import",
"itemgetter",
"from",
"ambry",
".",
"pands",
"import",
... | Return the partition as a Pandas dataframe
:param predicate: If defined, a callable that is called for each row, and if it returns true, the
row is included in the output.
:param filtered_columns: If defined, the value is a dict of column names and
associated values. Only rows where al... | [
"Return",
"the",
"partition",
"as",
"a",
"Pandas",
"dataframe"
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/partition.py#L923-L985 |
55,038 | CivicSpleen/ambry | ambry/orm/partition.py | AnalysisPartition.patches | def patches(self, basemap, simplify=None, predicate=None, args_f=None, **kwargs):
"""
Return geodata as a list of Matplotlib patches
:param basemap: A mpl_toolkits.basemap.Basemap
:param simplify: Integer or None. Simplify the geometry to a tolerance, in the units of the geometry.
... | python | def patches(self, basemap, simplify=None, predicate=None, args_f=None, **kwargs):
"""
Return geodata as a list of Matplotlib patches
:param basemap: A mpl_toolkits.basemap.Basemap
:param simplify: Integer or None. Simplify the geometry to a tolerance, in the units of the geometry.
... | [
"def",
"patches",
"(",
"self",
",",
"basemap",
",",
"simplify",
"=",
"None",
",",
"predicate",
"=",
"None",
",",
"args_f",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"descartes",
"import",
"PolygonPatch",
"from",
"shapely",
".",
"wkt",
"im... | Return geodata as a list of Matplotlib patches
:param basemap: A mpl_toolkits.basemap.Basemap
:param simplify: Integer or None. Simplify the geometry to a tolerance, in the units of the geometry.
:param predicate: A single-argument function to select which records to include in the output.
... | [
"Return",
"geodata",
"as",
"a",
"list",
"of",
"Matplotlib",
"patches"
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/partition.py#L1042-L1087 |
55,039 | CivicSpleen/ambry | ambry/orm/partition.py | MeasureDimensionPartition.measures | def measures(self):
"""Iterate over all measures"""
from ambry.valuetype.core import ROLE
return [c for c in self.columns if c.role == ROLE.MEASURE] | python | def measures(self):
"""Iterate over all measures"""
from ambry.valuetype.core import ROLE
return [c for c in self.columns if c.role == ROLE.MEASURE] | [
"def",
"measures",
"(",
"self",
")",
":",
"from",
"ambry",
".",
"valuetype",
".",
"core",
"import",
"ROLE",
"return",
"[",
"c",
"for",
"c",
"in",
"self",
".",
"columns",
"if",
"c",
".",
"role",
"==",
"ROLE",
".",
"MEASURE",
"]"
] | Iterate over all measures | [
"Iterate",
"over",
"all",
"measures"
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/partition.py#L1133-L1137 |
55,040 | CivicSpleen/ambry | ambry/orm/partition.py | MeasureDimensionPartition.measure | def measure(self, vid):
"""Return a measure, given its vid or another reference"""
from ambry.orm import Column
if isinstance(vid, PartitionColumn):
return vid
elif isinstance(vid, Column):
return PartitionColumn(vid)
else:
return PartitionCo... | python | def measure(self, vid):
"""Return a measure, given its vid or another reference"""
from ambry.orm import Column
if isinstance(vid, PartitionColumn):
return vid
elif isinstance(vid, Column):
return PartitionColumn(vid)
else:
return PartitionCo... | [
"def",
"measure",
"(",
"self",
",",
"vid",
")",
":",
"from",
"ambry",
".",
"orm",
"import",
"Column",
"if",
"isinstance",
"(",
"vid",
",",
"PartitionColumn",
")",
":",
"return",
"vid",
"elif",
"isinstance",
"(",
"vid",
",",
"Column",
")",
":",
"return"... | Return a measure, given its vid or another reference | [
"Return",
"a",
"measure",
"given",
"its",
"vid",
"or",
"another",
"reference"
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/partition.py#L1139-L1149 |
55,041 | CivicSpleen/ambry | ambry/orm/partition.py | MeasureDimensionPartition.dimension_set | def dimension_set(self, p_dim, s_dim=None, dimensions=None, extant=set()):
"""
Return a dict that describes the combination of one or two dimensions, for a plot
:param p_dim:
:param s_dim:
:param dimensions:
:param extant:
:return:
"""
if not dim... | python | def dimension_set(self, p_dim, s_dim=None, dimensions=None, extant=set()):
"""
Return a dict that describes the combination of one or two dimensions, for a plot
:param p_dim:
:param s_dim:
:param dimensions:
:param extant:
:return:
"""
if not dim... | [
"def",
"dimension_set",
"(",
"self",
",",
"p_dim",
",",
"s_dim",
"=",
"None",
",",
"dimensions",
"=",
"None",
",",
"extant",
"=",
"set",
"(",
")",
")",
":",
"if",
"not",
"dimensions",
":",
"dimensions",
"=",
"self",
".",
"primary_dimensions",
"key",
"=... | Return a dict that describes the combination of one or two dimensions, for a plot
:param p_dim:
:param s_dim:
:param dimensions:
:param extant:
:return: | [
"Return",
"a",
"dict",
"that",
"describes",
"the",
"combination",
"of",
"one",
"or",
"two",
"dimensions",
"for",
"a",
"plot"
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/partition.py#L1330-L1385 |
55,042 | CivicSpleen/ambry | ambry/orm/partition.py | PartitionColumn.label | def label(self):
""""Return first child that of the column that is marked as a label"""
for c in self.table.columns:
if c.parent == self.name and 'label' in c.valuetype:
return PartitionColumn(c, self._partition) | python | def label(self):
""""Return first child that of the column that is marked as a label"""
for c in self.table.columns:
if c.parent == self.name and 'label' in c.valuetype:
return PartitionColumn(c, self._partition) | [
"def",
"label",
"(",
"self",
")",
":",
"for",
"c",
"in",
"self",
".",
"table",
".",
"columns",
":",
"if",
"c",
".",
"parent",
"==",
"self",
".",
"name",
"and",
"'label'",
"in",
"c",
".",
"valuetype",
":",
"return",
"PartitionColumn",
"(",
"c",
",",... | Return first child that of the column that is marked as a label | [
"Return",
"first",
"child",
"that",
"of",
"the",
"column",
"that",
"is",
"marked",
"as",
"a",
"label"
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/partition.py#L1440-L1444 |
55,043 | CivicSpleen/ambry | ambry/orm/partition.py | PartitionColumn.value_labels | def value_labels(self):
"""Return a map of column code values mapped to labels, for columns that have a label column
If the column is not assocaited with a label column, it returns an identity map.
WARNING! This reads the whole partition, so it is really slow
"""
from operato... | python | def value_labels(self):
"""Return a map of column code values mapped to labels, for columns that have a label column
If the column is not assocaited with a label column, it returns an identity map.
WARNING! This reads the whole partition, so it is really slow
"""
from operato... | [
"def",
"value_labels",
"(",
"self",
")",
":",
"from",
"operator",
"import",
"itemgetter",
"card",
"=",
"self",
".",
"pstats",
".",
"nuniques",
"if",
"self",
".",
"label",
":",
"ig",
"=",
"itemgetter",
"(",
"self",
".",
"name",
",",
"self",
".",
"label"... | Return a map of column code values mapped to labels, for columns that have a label column
If the column is not assocaited with a label column, it returns an identity map.
WARNING! This reads the whole partition, so it is really slow | [
"Return",
"a",
"map",
"of",
"column",
"code",
"values",
"mapped",
"to",
"labels",
"for",
"columns",
"that",
"have",
"a",
"label",
"column"
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/partition.py#L1447-L1478 |
55,044 | project-ncl/pnc-cli | pnc_cli/buildconfigurationsets.py | list_build_configuration_sets | def list_build_configuration_sets(page_size=200, page_index=0, sort="", q=""):
"""
List all build configuration sets
"""
data = list_build_configuration_sets_raw(page_size, page_index, sort, q)
if data:
return utils.format_json_list(data) | python | def list_build_configuration_sets(page_size=200, page_index=0, sort="", q=""):
"""
List all build configuration sets
"""
data = list_build_configuration_sets_raw(page_size, page_index, sort, q)
if data:
return utils.format_json_list(data) | [
"def",
"list_build_configuration_sets",
"(",
"page_size",
"=",
"200",
",",
"page_index",
"=",
"0",
",",
"sort",
"=",
"\"\"",
",",
"q",
"=",
"\"\"",
")",
":",
"data",
"=",
"list_build_configuration_sets_raw",
"(",
"page_size",
",",
"page_index",
",",
"sort",
... | List all build configuration sets | [
"List",
"all",
"build",
"configuration",
"sets"
] | 3dc149bf84928f60a8044ac50b58bbaddd451902 | https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/buildconfigurationsets.py#L35-L41 |
55,045 | project-ncl/pnc-cli | pnc_cli/buildconfigurationsets.py | create_build_configuration_set_raw | def create_build_configuration_set_raw(**kwargs):
"""
Create a new BuildConfigurationSet.
"""
config_set = _create_build_config_set_object(**kwargs)
response = utils.checked_api_call(pnc_api.build_group_configs, 'create_new', body=config_set)
if response:
return response.content | python | def create_build_configuration_set_raw(**kwargs):
"""
Create a new BuildConfigurationSet.
"""
config_set = _create_build_config_set_object(**kwargs)
response = utils.checked_api_call(pnc_api.build_group_configs, 'create_new', body=config_set)
if response:
return response.content | [
"def",
"create_build_configuration_set_raw",
"(",
"*",
"*",
"kwargs",
")",
":",
"config_set",
"=",
"_create_build_config_set_object",
"(",
"*",
"*",
"kwargs",
")",
"response",
"=",
"utils",
".",
"checked_api_call",
"(",
"pnc_api",
".",
"build_group_configs",
",",
... | Create a new BuildConfigurationSet. | [
"Create",
"a",
"new",
"BuildConfigurationSet",
"."
] | 3dc149bf84928f60a8044ac50b58bbaddd451902 | https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/buildconfigurationsets.py#L44-L51 |
55,046 | project-ncl/pnc-cli | pnc_cli/buildconfigurationsets.py | update_build_configuration_set | def update_build_configuration_set(id, **kwargs):
"""
Update a BuildConfigurationSet
"""
data = update_build_configuration_set_raw(id, **kwargs)
if data:
return utils.format_json(data) | python | def update_build_configuration_set(id, **kwargs):
"""
Update a BuildConfigurationSet
"""
data = update_build_configuration_set_raw(id, **kwargs)
if data:
return utils.format_json(data) | [
"def",
"update_build_configuration_set",
"(",
"id",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"update_build_configuration_set_raw",
"(",
"id",
",",
"*",
"*",
"kwargs",
")",
"if",
"data",
":",
"return",
"utils",
".",
"format_json",
"(",
"data",
")"
] | Update a BuildConfigurationSet | [
"Update",
"a",
"BuildConfigurationSet"
] | 3dc149bf84928f60a8044ac50b58bbaddd451902 | https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/buildconfigurationsets.py#L107-L113 |
55,047 | project-ncl/pnc-cli | pnc_cli/buildconfigurationsets.py | list_build_configurations_for_set | def list_build_configurations_for_set(id=None, name=None, page_size=200, page_index=0, sort="", q=""):
"""
List all build configurations in a given BuildConfigurationSet.
"""
content = list_build_configurations_for_set_raw(id, name, page_size, page_index, sort, q)
if content:
return utils.fo... | python | def list_build_configurations_for_set(id=None, name=None, page_size=200, page_index=0, sort="", q=""):
"""
List all build configurations in a given BuildConfigurationSet.
"""
content = list_build_configurations_for_set_raw(id, name, page_size, page_index, sort, q)
if content:
return utils.fo... | [
"def",
"list_build_configurations_for_set",
"(",
"id",
"=",
"None",
",",
"name",
"=",
"None",
",",
"page_size",
"=",
"200",
",",
"page_index",
"=",
"0",
",",
"sort",
"=",
"\"\"",
",",
"q",
"=",
"\"\"",
")",
":",
"content",
"=",
"list_build_configurations_f... | List all build configurations in a given BuildConfigurationSet. | [
"List",
"all",
"build",
"configurations",
"in",
"a",
"given",
"BuildConfigurationSet",
"."
] | 3dc149bf84928f60a8044ac50b58bbaddd451902 | https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/buildconfigurationsets.py#L206-L212 |
55,048 | project-ncl/pnc-cli | pnc_cli/buildconfigurationsets.py | add_build_configuration_to_set | def add_build_configuration_to_set(
set_id=None, set_name=None, config_id=None, config_name=None):
"""
Add a build configuration to an existing BuildConfigurationSet
"""
content = add_build_configuration_to_set_raw(set_id, set_name, config_id, config_name)
if content:
return utils.fo... | python | def add_build_configuration_to_set(
set_id=None, set_name=None, config_id=None, config_name=None):
"""
Add a build configuration to an existing BuildConfigurationSet
"""
content = add_build_configuration_to_set_raw(set_id, set_name, config_id, config_name)
if content:
return utils.fo... | [
"def",
"add_build_configuration_to_set",
"(",
"set_id",
"=",
"None",
",",
"set_name",
"=",
"None",
",",
"config_id",
"=",
"None",
",",
"config_name",
"=",
"None",
")",
":",
"content",
"=",
"add_build_configuration_to_set_raw",
"(",
"set_id",
",",
"set_name",
","... | Add a build configuration to an existing BuildConfigurationSet | [
"Add",
"a",
"build",
"configuration",
"to",
"an",
"existing",
"BuildConfigurationSet"
] | 3dc149bf84928f60a8044ac50b58bbaddd451902 | https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/buildconfigurationsets.py#L235-L242 |
55,049 | project-ncl/pnc-cli | pnc_cli/buildconfigurationsets.py | list_build_records_for_set | def list_build_records_for_set(id=None, name=None, page_size=200, page_index=0, sort="", q=""):
"""
List all build records for a BuildConfigurationSet
"""
content = list_build_records_for_set_raw(id, name, page_size, page_index, sort, q)
if content:
return utils.format_json_list(content) | python | def list_build_records_for_set(id=None, name=None, page_size=200, page_index=0, sort="", q=""):
"""
List all build records for a BuildConfigurationSet
"""
content = list_build_records_for_set_raw(id, name, page_size, page_index, sort, q)
if content:
return utils.format_json_list(content) | [
"def",
"list_build_records_for_set",
"(",
"id",
"=",
"None",
",",
"name",
"=",
"None",
",",
"page_size",
"=",
"200",
",",
"page_index",
"=",
"0",
",",
"sort",
"=",
"\"\"",
",",
"q",
"=",
"\"\"",
")",
":",
"content",
"=",
"list_build_records_for_set_raw",
... | List all build records for a BuildConfigurationSet | [
"List",
"all",
"build",
"records",
"for",
"a",
"BuildConfigurationSet"
] | 3dc149bf84928f60a8044ac50b58bbaddd451902 | https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/buildconfigurationsets.py#L282-L288 |
55,050 | project-ncl/pnc-cli | pnc_cli/buildconfigurationsets.py | list_build_set_records | def list_build_set_records(id=None, name=None, page_size=200, page_index=0, sort="", q=""):
"""
List all build set records for a BuildConfigurationSet
"""
content = list_build_set_records_raw(id, name, page_size, page_index, sort, q)
if content:
return utils.format_json_list(content) | python | def list_build_set_records(id=None, name=None, page_size=200, page_index=0, sort="", q=""):
"""
List all build set records for a BuildConfigurationSet
"""
content = list_build_set_records_raw(id, name, page_size, page_index, sort, q)
if content:
return utils.format_json_list(content) | [
"def",
"list_build_set_records",
"(",
"id",
"=",
"None",
",",
"name",
"=",
"None",
",",
"page_size",
"=",
"200",
",",
"page_index",
"=",
"0",
",",
"sort",
"=",
"\"\"",
",",
"q",
"=",
"\"\"",
")",
":",
"content",
"=",
"list_build_set_records_raw",
"(",
... | List all build set records for a BuildConfigurationSet | [
"List",
"all",
"build",
"set",
"records",
"for",
"a",
"BuildConfigurationSet"
] | 3dc149bf84928f60a8044ac50b58bbaddd451902 | https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/buildconfigurationsets.py#L304-L310 |
55,051 | edoburu/django-any-urlfield | any_urlfield/models/fields.py | AnyUrlField.register_model | def register_model(cls, ModelClass, form_field=None, widget=None, title=None, prefix=None):
"""
Register a model to use in the URL field.
This function needs to be called once for every model
that should be selectable in the URL field.
:param ModelClass: The model to register.
... | python | def register_model(cls, ModelClass, form_field=None, widget=None, title=None, prefix=None):
"""
Register a model to use in the URL field.
This function needs to be called once for every model
that should be selectable in the URL field.
:param ModelClass: The model to register.
... | [
"def",
"register_model",
"(",
"cls",
",",
"ModelClass",
",",
"form_field",
"=",
"None",
",",
"widget",
"=",
"None",
",",
"title",
"=",
"None",
",",
"prefix",
"=",
"None",
")",
":",
"cls",
".",
"_static_registry",
".",
"register",
"(",
"ModelClass",
",",
... | Register a model to use in the URL field.
This function needs to be called once for every model
that should be selectable in the URL field.
:param ModelClass: The model to register.
:param form_field: The form field class used to render the field. This can be a lambda for lazy evaluati... | [
"Register",
"a",
"model",
"to",
"use",
"in",
"the",
"URL",
"field",
"."
] | 8d7d36c8a1fc251930f6dbdcc8b5b5151d20e3ab | https://github.com/edoburu/django-any-urlfield/blob/8d7d36c8a1fc251930f6dbdcc8b5b5151d20e3ab/any_urlfield/models/fields.py#L59-L72 |
55,052 | edoburu/django-any-urlfield | any_urlfield/models/fields.py | AnyUrlField.resolve_objects | def resolve_objects(cls, objects, skip_cached_urls=False):
"""
Make sure all AnyUrlValue objects from a set of objects is resolved in bulk.
This avoids making a query per item.
:param objects: A list or queryset of models.
:param skip_cached_urls: Whether to avoid prefetching da... | python | def resolve_objects(cls, objects, skip_cached_urls=False):
"""
Make sure all AnyUrlValue objects from a set of objects is resolved in bulk.
This avoids making a query per item.
:param objects: A list or queryset of models.
:param skip_cached_urls: Whether to avoid prefetching da... | [
"def",
"resolve_objects",
"(",
"cls",
",",
"objects",
",",
"skip_cached_urls",
"=",
"False",
")",
":",
"# Allow the queryset or list to consist of multiple models.",
"# This supports querysets from django-polymorphic too.",
"queryset",
"=",
"list",
"(",
"objects",
")",
"any_u... | Make sure all AnyUrlValue objects from a set of objects is resolved in bulk.
This avoids making a query per item.
:param objects: A list or queryset of models.
:param skip_cached_urls: Whether to avoid prefetching data that has it's URL cached. | [
"Make",
"sure",
"all",
"AnyUrlValue",
"objects",
"from",
"a",
"set",
"of",
"objects",
"is",
"resolved",
"in",
"bulk",
".",
"This",
"avoids",
"making",
"a",
"query",
"per",
"item",
"."
] | 8d7d36c8a1fc251930f6dbdcc8b5b5151d20e3ab | https://github.com/edoburu/django-any-urlfield/blob/8d7d36c8a1fc251930f6dbdcc8b5b5151d20e3ab/any_urlfield/models/fields.py#L137-L157 |
55,053 | CivicSpleen/ambry | ambry/__init__.py | config | def config(path=None, root=None, db=None):
"""Return the default run_config object for this installation."""
import ambry.run
return ambry.run.load(path=path, root=root, db=db) | python | def config(path=None, root=None, db=None):
"""Return the default run_config object for this installation."""
import ambry.run
return ambry.run.load(path=path, root=root, db=db) | [
"def",
"config",
"(",
"path",
"=",
"None",
",",
"root",
"=",
"None",
",",
"db",
"=",
"None",
")",
":",
"import",
"ambry",
".",
"run",
"return",
"ambry",
".",
"run",
".",
"load",
"(",
"path",
"=",
"path",
",",
"root",
"=",
"root",
",",
"db",
"="... | Return the default run_config object for this installation. | [
"Return",
"the",
"default",
"run_config",
"object",
"for",
"this",
"installation",
"."
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/__init__.py#L27-L30 |
55,054 | CivicSpleen/ambry | ambry/__init__.py | get_library | def get_library(path=None, root=None, db=None):
import ambry.library as _l
"""Return the default library for this installation."""
rc = config(path=path, root=root, db=db )
return _l.new_library(rc) | python | def get_library(path=None, root=None, db=None):
import ambry.library as _l
"""Return the default library for this installation."""
rc = config(path=path, root=root, db=db )
return _l.new_library(rc) | [
"def",
"get_library",
"(",
"path",
"=",
"None",
",",
"root",
"=",
"None",
",",
"db",
"=",
"None",
")",
":",
"import",
"ambry",
".",
"library",
"as",
"_l",
"rc",
"=",
"config",
"(",
"path",
"=",
"path",
",",
"root",
"=",
"root",
",",
"db",
"=",
... | Return the default library for this installation. | [
"Return",
"the",
"default",
"library",
"for",
"this",
"installation",
"."
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/__init__.py#L34-L40 |
55,055 | CivicSpleen/ambry | ambry/cli/__init__.py | doc_parser | def doc_parser():
"""Utility function to allow getting the arguments for a single command, for Sphinx documentation"""
parser = argparse.ArgumentParser(
prog='ambry',
description='Ambry {}. Management interface for ambry, libraries '
'and repositories. '.format(ambry._meta._... | python | def doc_parser():
"""Utility function to allow getting the arguments for a single command, for Sphinx documentation"""
parser = argparse.ArgumentParser(
prog='ambry',
description='Ambry {}. Management interface for ambry, libraries '
'and repositories. '.format(ambry._meta._... | [
"def",
"doc_parser",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"prog",
"=",
"'ambry'",
",",
"description",
"=",
"'Ambry {}. Management interface for ambry, libraries '",
"'and repositories. '",
".",
"format",
"(",
"ambry",
".",
"_meta",
"... | Utility function to allow getting the arguments for a single command, for Sphinx documentation | [
"Utility",
"function",
"to",
"allow",
"getting",
"the",
"arguments",
"for",
"a",
"single",
"command",
"for",
"Sphinx",
"documentation"
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/cli/__init__.py#L95-L103 |
55,056 | CivicSpleen/ambry | ambry/cli/__init__.py | get_extra_commands | def get_extra_commands():
"""Use the configuration to discover additional CLI packages to load"""
from ambry.run import find_config_file
from ambry.dbexceptions import ConfigurationError
from ambry.util import yaml
try:
plugins_dir = find_config_file('cli.yaml')
except ConfigurationErro... | python | def get_extra_commands():
"""Use the configuration to discover additional CLI packages to load"""
from ambry.run import find_config_file
from ambry.dbexceptions import ConfigurationError
from ambry.util import yaml
try:
plugins_dir = find_config_file('cli.yaml')
except ConfigurationErro... | [
"def",
"get_extra_commands",
"(",
")",
":",
"from",
"ambry",
".",
"run",
"import",
"find_config_file",
"from",
"ambry",
".",
"dbexceptions",
"import",
"ConfigurationError",
"from",
"ambry",
".",
"util",
"import",
"yaml",
"try",
":",
"plugins_dir",
"=",
"find_con... | Use the configuration to discover additional CLI packages to load | [
"Use",
"the",
"configuration",
"to",
"discover",
"additional",
"CLI",
"packages",
"to",
"load"
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/cli/__init__.py#L109-L123 |
55,057 | cosven/feeluown-core | fuocore/netease/models.py | NSongModel.url | def url(self):
"""
We will always check if this song file exists in local library,
if true, we return the url of the local file.
.. note::
As netease song url will be expired after a period of time,
we can not use static url here. Currently, we assume that the
... | python | def url(self):
"""
We will always check if this song file exists in local library,
if true, we return the url of the local file.
.. note::
As netease song url will be expired after a period of time,
we can not use static url here. Currently, we assume that the
... | [
"def",
"url",
"(",
"self",
")",
":",
"local_path",
"=",
"self",
".",
"_find_in_local",
"(",
")",
"if",
"local_path",
":",
"return",
"local_path",
"if",
"not",
"self",
".",
"_url",
":",
"self",
".",
"_refresh_url",
"(",
")",
"elif",
"time",
".",
"time",... | We will always check if this song file exists in local library,
if true, we return the url of the local file.
.. note::
As netease song url will be expired after a period of time,
we can not use static url here. Currently, we assume that the
expiration time is 20 mi... | [
"We",
"will",
"always",
"check",
"if",
"this",
"song",
"file",
"exists",
"in",
"local",
"library",
"if",
"true",
"we",
"return",
"the",
"url",
"of",
"the",
"local",
"file",
"."
] | 62dc64638f62971b16be0a75c0b8c7ae2999869e | https://github.com/cosven/feeluown-core/blob/62dc64638f62971b16be0a75c0b8c7ae2999869e/fuocore/netease/models.py#L67-L88 |
55,058 | spotify/ulogger | ulogger/stackdriver.py | get_handler | def get_handler(progname, fmt=None, datefmt=None, project_id=None,
credentials=None, debug_thread_worker=False, **_):
"""Helper function to create a Stackdriver handler.
See `ulogger.stackdriver.CloudLoggingHandlerBuilder` for arguments
and supported keyword arguments.
Returns:
... | python | def get_handler(progname, fmt=None, datefmt=None, project_id=None,
credentials=None, debug_thread_worker=False, **_):
"""Helper function to create a Stackdriver handler.
See `ulogger.stackdriver.CloudLoggingHandlerBuilder` for arguments
and supported keyword arguments.
Returns:
... | [
"def",
"get_handler",
"(",
"progname",
",",
"fmt",
"=",
"None",
",",
"datefmt",
"=",
"None",
",",
"project_id",
"=",
"None",
",",
"credentials",
"=",
"None",
",",
"debug_thread_worker",
"=",
"False",
",",
"*",
"*",
"_",
")",
":",
"builder",
"=",
"Cloud... | Helper function to create a Stackdriver handler.
See `ulogger.stackdriver.CloudLoggingHandlerBuilder` for arguments
and supported keyword arguments.
Returns:
(obj): Instance of `google.cloud.logging.handlers.
CloudLoggingHandler` | [
"Helper",
"function",
"to",
"create",
"a",
"Stackdriver",
"handler",
"."
] | c59ced69e55b400e9c7a3688145fe3e8cb89db13 | https://github.com/spotify/ulogger/blob/c59ced69e55b400e9c7a3688145fe3e8cb89db13/ulogger/stackdriver.py#L197-L211 |
55,059 | spotify/ulogger | ulogger/stackdriver.py | CloudLoggingHandlerBuilder._create_gcl_resource | def _create_gcl_resource(self):
"""Create a configured Resource object.
The logging.resource.Resource object enables GCL to filter and
bucket incoming logs according to which resource (host) they're
coming from.
Returns:
(obj): Instance of `google.cloud.logging.reso... | python | def _create_gcl_resource(self):
"""Create a configured Resource object.
The logging.resource.Resource object enables GCL to filter and
bucket incoming logs according to which resource (host) they're
coming from.
Returns:
(obj): Instance of `google.cloud.logging.reso... | [
"def",
"_create_gcl_resource",
"(",
"self",
")",
":",
"return",
"gcl_resource",
".",
"Resource",
"(",
"'gce_instance'",
",",
"{",
"'project_id'",
":",
"self",
".",
"project_id",
",",
"'instance_id'",
":",
"self",
".",
"instance_id",
",",
"'zone'",
":",
"self",... | Create a configured Resource object.
The logging.resource.Resource object enables GCL to filter and
bucket incoming logs according to which resource (host) they're
coming from.
Returns:
(obj): Instance of `google.cloud.logging.resource.Resource` | [
"Create",
"a",
"configured",
"Resource",
"object",
"."
] | c59ced69e55b400e9c7a3688145fe3e8cb89db13 | https://github.com/spotify/ulogger/blob/c59ced69e55b400e9c7a3688145fe3e8cb89db13/ulogger/stackdriver.py#L129-L144 |
55,060 | spotify/ulogger | ulogger/stackdriver.py | CloudLoggingHandlerBuilder.get_formatter | def get_formatter(self):
"""Create a fully configured `logging.Formatter`
Example of formatted log message:
2017-08-27T20:19:24.424 cpm-example-gew1 progname (23123): hello
Returns:
(obj): Instance of `logging.Formatter`
"""
if not self.fmt:
self... | python | def get_formatter(self):
"""Create a fully configured `logging.Formatter`
Example of formatted log message:
2017-08-27T20:19:24.424 cpm-example-gew1 progname (23123): hello
Returns:
(obj): Instance of `logging.Formatter`
"""
if not self.fmt:
self... | [
"def",
"get_formatter",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"fmt",
":",
"self",
".",
"fmt",
"=",
"(",
"'%(asctime)s.%(msecs)03d {host} {progname} '",
"'(%(process)d): %(message)s'",
")",
".",
"format",
"(",
"host",
"=",
"self",
".",
"hostname",
",... | Create a fully configured `logging.Formatter`
Example of formatted log message:
2017-08-27T20:19:24.424 cpm-example-gew1 progname (23123): hello
Returns:
(obj): Instance of `logging.Formatter` | [
"Create",
"a",
"fully",
"configured",
"logging",
".",
"Formatter"
] | c59ced69e55b400e9c7a3688145fe3e8cb89db13 | https://github.com/spotify/ulogger/blob/c59ced69e55b400e9c7a3688145fe3e8cb89db13/ulogger/stackdriver.py#L146-L161 |
55,061 | spotify/ulogger | ulogger/stackdriver.py | CloudLoggingHandlerBuilder._set_worker_thread_level | def _set_worker_thread_level(self):
"""Sets logging level of the background logging thread to DEBUG or INFO
"""
bthread_logger = logging.getLogger(
'google.cloud.logging.handlers.transports.background_thread')
if self.debug_thread_worker:
bthread_logger.setLevel(l... | python | def _set_worker_thread_level(self):
"""Sets logging level of the background logging thread to DEBUG or INFO
"""
bthread_logger = logging.getLogger(
'google.cloud.logging.handlers.transports.background_thread')
if self.debug_thread_worker:
bthread_logger.setLevel(l... | [
"def",
"_set_worker_thread_level",
"(",
"self",
")",
":",
"bthread_logger",
"=",
"logging",
".",
"getLogger",
"(",
"'google.cloud.logging.handlers.transports.background_thread'",
")",
"if",
"self",
".",
"debug_thread_worker",
":",
"bthread_logger",
".",
"setLevel",
"(",
... | Sets logging level of the background logging thread to DEBUG or INFO | [
"Sets",
"logging",
"level",
"of",
"the",
"background",
"logging",
"thread",
"to",
"DEBUG",
"or",
"INFO"
] | c59ced69e55b400e9c7a3688145fe3e8cb89db13 | https://github.com/spotify/ulogger/blob/c59ced69e55b400e9c7a3688145fe3e8cb89db13/ulogger/stackdriver.py#L163-L171 |
55,062 | spotify/ulogger | ulogger/stackdriver.py | CloudLoggingHandlerBuilder.get_handler | def get_handler(self):
"""Create a fully configured CloudLoggingHandler.
Returns:
(obj): Instance of `google.cloud.logging.handlers.
CloudLoggingHandler`
"""
gcl_client = gcl_logging.Client(
project=self.project_id, credentials=se... | python | def get_handler(self):
"""Create a fully configured CloudLoggingHandler.
Returns:
(obj): Instance of `google.cloud.logging.handlers.
CloudLoggingHandler`
"""
gcl_client = gcl_logging.Client(
project=self.project_id, credentials=se... | [
"def",
"get_handler",
"(",
"self",
")",
":",
"gcl_client",
"=",
"gcl_logging",
".",
"Client",
"(",
"project",
"=",
"self",
".",
"project_id",
",",
"credentials",
"=",
"self",
".",
"credentials",
")",
"handler",
"=",
"gcl_handlers",
".",
"CloudLoggingHandler",
... | Create a fully configured CloudLoggingHandler.
Returns:
(obj): Instance of `google.cloud.logging.handlers.
CloudLoggingHandler` | [
"Create",
"a",
"fully",
"configured",
"CloudLoggingHandler",
"."
] | c59ced69e55b400e9c7a3688145fe3e8cb89db13 | https://github.com/spotify/ulogger/blob/c59ced69e55b400e9c7a3688145fe3e8cb89db13/ulogger/stackdriver.py#L173-L194 |
55,063 | CivicSpleen/ambry | ambry/library/search.py | Search.index_dataset | def index_dataset(self, dataset, force=False):
""" Adds given dataset to the index. """
self.backend.dataset_index.index_one(dataset, force=force) | python | def index_dataset(self, dataset, force=False):
""" Adds given dataset to the index. """
self.backend.dataset_index.index_one(dataset, force=force) | [
"def",
"index_dataset",
"(",
"self",
",",
"dataset",
",",
"force",
"=",
"False",
")",
":",
"self",
".",
"backend",
".",
"dataset_index",
".",
"index_one",
"(",
"dataset",
",",
"force",
"=",
"force",
")"
] | Adds given dataset to the index. | [
"Adds",
"given",
"dataset",
"to",
"the",
"index",
"."
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/search.py#L55-L57 |
55,064 | CivicSpleen/ambry | ambry/library/search.py | Search.index_partition | def index_partition(self, partition, force=False):
""" Adds given partition to the index. """
self.backend.partition_index.index_one(partition, force=force) | python | def index_partition(self, partition, force=False):
""" Adds given partition to the index. """
self.backend.partition_index.index_one(partition, force=force) | [
"def",
"index_partition",
"(",
"self",
",",
"partition",
",",
"force",
"=",
"False",
")",
":",
"self",
".",
"backend",
".",
"partition_index",
".",
"index_one",
"(",
"partition",
",",
"force",
"=",
"force",
")"
] | Adds given partition to the index. | [
"Adds",
"given",
"partition",
"to",
"the",
"index",
"."
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/search.py#L59-L61 |
55,065 | CivicSpleen/ambry | ambry/library/search.py | Search.index_library_datasets | def index_library_datasets(self, tick_f=None):
""" Indexes all datasets of the library.
Args:
tick_f (callable, optional): callable of one argument. Gets string with index state.
"""
dataset_n = 0
partition_n = 0
def tick(d, p):
if tick_f:
... | python | def index_library_datasets(self, tick_f=None):
""" Indexes all datasets of the library.
Args:
tick_f (callable, optional): callable of one argument. Gets string with index state.
"""
dataset_n = 0
partition_n = 0
def tick(d, p):
if tick_f:
... | [
"def",
"index_library_datasets",
"(",
"self",
",",
"tick_f",
"=",
"None",
")",
":",
"dataset_n",
"=",
"0",
"partition_n",
"=",
"0",
"def",
"tick",
"(",
"d",
",",
"p",
")",
":",
"if",
"tick_f",
":",
"tick_f",
"(",
"'datasets: {} partitions: {}'",
".",
"fo... | Indexes all datasets of the library.
Args:
tick_f (callable, optional): callable of one argument. Gets string with index state. | [
"Indexes",
"all",
"datasets",
"of",
"the",
"library",
"."
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/search.py#L79-L106 |
55,066 | CivicSpleen/ambry | ambry/library/search.py | Search.search_datasets | def search_datasets(self, search_phrase, limit=None):
""" Search for datasets. """
return self.backend.dataset_index.search(search_phrase, limit=limit) | python | def search_datasets(self, search_phrase, limit=None):
""" Search for datasets. """
return self.backend.dataset_index.search(search_phrase, limit=limit) | [
"def",
"search_datasets",
"(",
"self",
",",
"search_phrase",
",",
"limit",
"=",
"None",
")",
":",
"return",
"self",
".",
"backend",
".",
"dataset_index",
".",
"search",
"(",
"search_phrase",
",",
"limit",
"=",
"limit",
")"
] | Search for datasets. | [
"Search",
"for",
"datasets",
"."
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/search.py#L108-L110 |
55,067 | CivicSpleen/ambry | ambry/library/search.py | Search.search | def search(self, search_phrase, limit=None):
"""Search for datasets, and expand to database records"""
from ambry.identity import ObjectNumber
from ambry.orm.exc import NotFoundError
from ambry.library.search_backends.base import SearchTermParser
results = []
stp = Sear... | python | def search(self, search_phrase, limit=None):
"""Search for datasets, and expand to database records"""
from ambry.identity import ObjectNumber
from ambry.orm.exc import NotFoundError
from ambry.library.search_backends.base import SearchTermParser
results = []
stp = Sear... | [
"def",
"search",
"(",
"self",
",",
"search_phrase",
",",
"limit",
"=",
"None",
")",
":",
"from",
"ambry",
".",
"identity",
"import",
"ObjectNumber",
"from",
"ambry",
".",
"orm",
".",
"exc",
"import",
"NotFoundError",
"from",
"ambry",
".",
"library",
".",
... | Search for datasets, and expand to database records | [
"Search",
"for",
"datasets",
"and",
"expand",
"to",
"database",
"records"
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/search.py#L112-L140 |
55,068 | CivicSpleen/ambry | ambry/library/search.py | Search.get_parsed_query | def get_parsed_query(self):
""" Returns string with last query parsed. Assuming called after search_datasets."""
return '{} OR {}'.format(
self.backend.dataset_index.get_parsed_query()[0],
self.backend.partition_index.get_parsed_query()[0]) | python | def get_parsed_query(self):
""" Returns string with last query parsed. Assuming called after search_datasets."""
return '{} OR {}'.format(
self.backend.dataset_index.get_parsed_query()[0],
self.backend.partition_index.get_parsed_query()[0]) | [
"def",
"get_parsed_query",
"(",
"self",
")",
":",
"return",
"'{} OR {}'",
".",
"format",
"(",
"self",
".",
"backend",
".",
"dataset_index",
".",
"get_parsed_query",
"(",
")",
"[",
"0",
"]",
",",
"self",
".",
"backend",
".",
"partition_index",
".",
"get_par... | Returns string with last query parsed. Assuming called after search_datasets. | [
"Returns",
"string",
"with",
"last",
"query",
"parsed",
".",
"Assuming",
"called",
"after",
"search_datasets",
"."
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/search.py#L154-L158 |
55,069 | project-ncl/pnc-cli | pnc_cli/buildconfigsetrecords.py | list_build_configuration_set_records | def list_build_configuration_set_records(page_size=200, page_index=0, sort="", q=""):
"""
List all build configuration set records.
"""
data = list_build_configuration_set_records_raw(page_size, page_index, sort, q)
if data:
return utils.format_json_list(data) | python | def list_build_configuration_set_records(page_size=200, page_index=0, sort="", q=""):
"""
List all build configuration set records.
"""
data = list_build_configuration_set_records_raw(page_size, page_index, sort, q)
if data:
return utils.format_json_list(data) | [
"def",
"list_build_configuration_set_records",
"(",
"page_size",
"=",
"200",
",",
"page_index",
"=",
"0",
",",
"sort",
"=",
"\"\"",
",",
"q",
"=",
"\"\"",
")",
":",
"data",
"=",
"list_build_configuration_set_records_raw",
"(",
"page_size",
",",
"page_index",
","... | List all build configuration set records. | [
"List",
"all",
"build",
"configuration",
"set",
"records",
"."
] | 3dc149bf84928f60a8044ac50b58bbaddd451902 | https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/buildconfigsetrecords.py#L22-L28 |
55,070 | project-ncl/pnc-cli | pnc_cli/buildconfigsetrecords.py | list_records_for_build_config_set | def list_records_for_build_config_set(id, page_size=200, page_index=0, sort="", q=""):
"""
Get a list of BuildRecords for the given BuildConfigSetRecord
"""
data = list_records_for_build_config_set_raw(id, page_size, page_index, sort, q)
if data:
return utils.format_json_list(data) | python | def list_records_for_build_config_set(id, page_size=200, page_index=0, sort="", q=""):
"""
Get a list of BuildRecords for the given BuildConfigSetRecord
"""
data = list_records_for_build_config_set_raw(id, page_size, page_index, sort, q)
if data:
return utils.format_json_list(data) | [
"def",
"list_records_for_build_config_set",
"(",
"id",
",",
"page_size",
"=",
"200",
",",
"page_index",
"=",
"0",
",",
"sort",
"=",
"\"\"",
",",
"q",
"=",
"\"\"",
")",
":",
"data",
"=",
"list_records_for_build_config_set_raw",
"(",
"id",
",",
"page_size",
",... | Get a list of BuildRecords for the given BuildConfigSetRecord | [
"Get",
"a",
"list",
"of",
"BuildRecords",
"for",
"the",
"given",
"BuildConfigSetRecord"
] | 3dc149bf84928f60a8044ac50b58bbaddd451902 | https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/buildconfigsetrecords.py#L62-L68 |
55,071 | cosven/feeluown-core | fuocore/provider.py | AbstractProvider.auth_as | def auth_as(self, user):
"""auth as a user temporarily"""
old_user = self._user
self.auth(user)
try:
yield
finally:
self.auth(old_user) | python | def auth_as(self, user):
"""auth as a user temporarily"""
old_user = self._user
self.auth(user)
try:
yield
finally:
self.auth(old_user) | [
"def",
"auth_as",
"(",
"self",
",",
"user",
")",
":",
"old_user",
"=",
"self",
".",
"_user",
"self",
".",
"auth",
"(",
"user",
")",
"try",
":",
"yield",
"finally",
":",
"self",
".",
"auth",
"(",
"old_user",
")"
] | auth as a user temporarily | [
"auth",
"as",
"a",
"user",
"temporarily"
] | 62dc64638f62971b16be0a75c0b8c7ae2999869e | https://github.com/cosven/feeluown-core/blob/62dc64638f62971b16be0a75c0b8c7ae2999869e/fuocore/provider.py#L70-L77 |
55,072 | CivicSpleen/ambry | ambry/library/config.py | LibraryConfigSyncProxy.sync_accounts | def sync_accounts(self, accounts_data, clear = False, password=None, cb = None):
"""
Load all of the accounts from the account section of the config
into the database.
:param accounts_data:
:param password:
:return:
"""
# Map common values into the accou... | python | def sync_accounts(self, accounts_data, clear = False, password=None, cb = None):
"""
Load all of the accounts from the account section of the config
into the database.
:param accounts_data:
:param password:
:return:
"""
# Map common values into the accou... | [
"def",
"sync_accounts",
"(",
"self",
",",
"accounts_data",
",",
"clear",
"=",
"False",
",",
"password",
"=",
"None",
",",
"cb",
"=",
"None",
")",
":",
"# Map common values into the accounts records",
"all_accounts",
"=",
"self",
".",
"accounts",
"kmap",
"=",
"... | Load all of the accounts from the account section of the config
into the database.
:param accounts_data:
:param password:
:return: | [
"Load",
"all",
"of",
"the",
"accounts",
"from",
"the",
"account",
"section",
"of",
"the",
"config",
"into",
"the",
"database",
"."
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/config.py#L98-L143 |
55,073 | CivicSpleen/ambry | ambry/valuetype/core.py | robust_int | def robust_int(v):
"""Parse an int robustly, ignoring commas and other cruft. """
if isinstance(v, int):
return v
if isinstance(v, float):
return int(v)
v = str(v).replace(',', '')
if not v:
return None
return int(v) | python | def robust_int(v):
"""Parse an int robustly, ignoring commas and other cruft. """
if isinstance(v, int):
return v
if isinstance(v, float):
return int(v)
v = str(v).replace(',', '')
if not v:
return None
return int(v) | [
"def",
"robust_int",
"(",
"v",
")",
":",
"if",
"isinstance",
"(",
"v",
",",
"int",
")",
":",
"return",
"v",
"if",
"isinstance",
"(",
"v",
",",
"float",
")",
":",
"return",
"int",
"(",
"v",
")",
"v",
"=",
"str",
"(",
"v",
")",
".",
"replace",
... | Parse an int robustly, ignoring commas and other cruft. | [
"Parse",
"an",
"int",
"robustly",
"ignoring",
"commas",
"and",
"other",
"cruft",
"."
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/valuetype/core.py#L508-L522 |
55,074 | SmartTeleMax/iktomi | iktomi/templates/__init__.py | Template.render | def render(self, template_name, **kw):
'''
Given a template name and template vars.
Searches a template file based on engine set, and renders it
with corresponding engine.
Returns a string.
'''
logger.debug('Rendering template "%s"', template_name)
vars =... | python | def render(self, template_name, **kw):
'''
Given a template name and template vars.
Searches a template file based on engine set, and renders it
with corresponding engine.
Returns a string.
'''
logger.debug('Rendering template "%s"', template_name)
vars =... | [
"def",
"render",
"(",
"self",
",",
"template_name",
",",
"*",
"*",
"kw",
")",
":",
"logger",
".",
"debug",
"(",
"'Rendering template \"%s\"'",
",",
"template_name",
")",
"vars",
"=",
"self",
".",
"globs",
".",
"copy",
"(",
")",
"vars",
".",
"update",
"... | Given a template name and template vars.
Searches a template file based on engine set, and renders it
with corresponding engine.
Returns a string. | [
"Given",
"a",
"template",
"name",
"and",
"template",
"vars",
".",
"Searches",
"a",
"template",
"file",
"based",
"on",
"engine",
"set",
"and",
"renders",
"it",
"with",
"corresponding",
"engine",
".",
"Returns",
"a",
"string",
"."
] | 80bc0f1408d63efe7f5844367d1f6efba44b35f2 | https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/templates/__init__.py#L31-L42 |
55,075 | SmartTeleMax/iktomi | iktomi/templates/__init__.py | BoundTemplate.render | def render(self, template_name, __data=None, **kw):
'''Given a template name and template data.
Renders a template and returns as string'''
return self.template.render(template_name,
**self._vars(__data, **kw)) | python | def render(self, template_name, __data=None, **kw):
'''Given a template name and template data.
Renders a template and returns as string'''
return self.template.render(template_name,
**self._vars(__data, **kw)) | [
"def",
"render",
"(",
"self",
",",
"template_name",
",",
"__data",
"=",
"None",
",",
"*",
"*",
"kw",
")",
":",
"return",
"self",
".",
"template",
".",
"render",
"(",
"template_name",
",",
"*",
"*",
"self",
".",
"_vars",
"(",
"__data",
",",
"*",
"*"... | Given a template name and template data.
Renders a template and returns as string | [
"Given",
"a",
"template",
"name",
"and",
"template",
"data",
".",
"Renders",
"a",
"template",
"and",
"returns",
"as",
"string"
] | 80bc0f1408d63efe7f5844367d1f6efba44b35f2 | https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/templates/__init__.py#L100-L104 |
55,076 | SmartTeleMax/iktomi | iktomi/templates/__init__.py | BoundTemplate.render_to_response | def render_to_response(self, template_name, __data,
content_type="text/html"):
'''Given a template name and template data.
Renders a template and returns `webob.Response` object'''
resp = self.render(template_name, __data)
return Response(resp,
... | python | def render_to_response(self, template_name, __data,
content_type="text/html"):
'''Given a template name and template data.
Renders a template and returns `webob.Response` object'''
resp = self.render(template_name, __data)
return Response(resp,
... | [
"def",
"render_to_response",
"(",
"self",
",",
"template_name",
",",
"__data",
",",
"content_type",
"=",
"\"text/html\"",
")",
":",
"resp",
"=",
"self",
".",
"render",
"(",
"template_name",
",",
"__data",
")",
"return",
"Response",
"(",
"resp",
",",
"content... | Given a template name and template data.
Renders a template and returns `webob.Response` object | [
"Given",
"a",
"template",
"name",
"and",
"template",
"data",
".",
"Renders",
"a",
"template",
"and",
"returns",
"webob",
".",
"Response",
"object"
] | 80bc0f1408d63efe7f5844367d1f6efba44b35f2 | https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/templates/__init__.py#L106-L112 |
55,077 | SmartTeleMax/iktomi | iktomi/utils/paginator.py | Paginator.page | def page(self):
'''Current page.'''
page = self.request.GET.get(self.page_param)
if not page:
return 1
try:
page = int(page)
except ValueError:
self.invalid_page()
return 1
if page<1:
self.invalid_page()
... | python | def page(self):
'''Current page.'''
page = self.request.GET.get(self.page_param)
if not page:
return 1
try:
page = int(page)
except ValueError:
self.invalid_page()
return 1
if page<1:
self.invalid_page()
... | [
"def",
"page",
"(",
"self",
")",
":",
"page",
"=",
"self",
".",
"request",
".",
"GET",
".",
"get",
"(",
"self",
".",
"page_param",
")",
"if",
"not",
"page",
":",
"return",
"1",
"try",
":",
"page",
"=",
"int",
"(",
"page",
")",
"except",
"ValueErr... | Current page. | [
"Current",
"page",
"."
] | 80bc0f1408d63efe7f5844367d1f6efba44b35f2 | https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/utils/paginator.py#L160-L173 |
55,078 | SmartTeleMax/iktomi | iktomi/utils/paginator.py | Paginator.url | def url(self):
'''Current or base URL. Can be redefined via keyword argument on
initialization.
Returns `iktomi.web.URL object.
`'''
return URL.from_url(self.request.url, show_host=self.show_host) | python | def url(self):
'''Current or base URL. Can be redefined via keyword argument on
initialization.
Returns `iktomi.web.URL object.
`'''
return URL.from_url(self.request.url, show_host=self.show_host) | [
"def",
"url",
"(",
"self",
")",
":",
"return",
"URL",
".",
"from_url",
"(",
"self",
".",
"request",
".",
"url",
",",
"show_host",
"=",
"self",
".",
"show_host",
")"
] | Current or base URL. Can be redefined via keyword argument on
initialization.
Returns `iktomi.web.URL object.
` | [
"Current",
"or",
"base",
"URL",
".",
"Can",
"be",
"redefined",
"via",
"keyword",
"argument",
"on",
"initialization",
"."
] | 80bc0f1408d63efe7f5844367d1f6efba44b35f2 | https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/utils/paginator.py#L176-L182 |
55,079 | SmartTeleMax/iktomi | iktomi/utils/paginator.py | Paginator.page_url | def page_url(self, page):
'''
Returns URL for page, page is included as query parameter.
Can be redefined by keyword argument
'''
if page is not None and page != 1:
return self.url.qs_set(**{self.page_param: page})
elif page is not None:
return se... | python | def page_url(self, page):
'''
Returns URL for page, page is included as query parameter.
Can be redefined by keyword argument
'''
if page is not None and page != 1:
return self.url.qs_set(**{self.page_param: page})
elif page is not None:
return se... | [
"def",
"page_url",
"(",
"self",
",",
"page",
")",
":",
"if",
"page",
"is",
"not",
"None",
"and",
"page",
"!=",
"1",
":",
"return",
"self",
".",
"url",
".",
"qs_set",
"(",
"*",
"*",
"{",
"self",
".",
"page_param",
":",
"page",
"}",
")",
"elif",
... | Returns URL for page, page is included as query parameter.
Can be redefined by keyword argument | [
"Returns",
"URL",
"for",
"page",
"page",
"is",
"included",
"as",
"query",
"parameter",
"."
] | 80bc0f1408d63efe7f5844367d1f6efba44b35f2 | https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/utils/paginator.py#L184-L193 |
55,080 | SmartTeleMax/iktomi | iktomi/utils/paginator.py | Paginator.pages_count | def pages_count(self):
'''Number of pages.'''
if not self.limit or self.count<self.limit:
return 1
if self.count % self.limit <= self.orphans:
return self.count // self.limit
return int(math.ceil(float(self.count)/self.limit)) | python | def pages_count(self):
'''Number of pages.'''
if not self.limit or self.count<self.limit:
return 1
if self.count % self.limit <= self.orphans:
return self.count // self.limit
return int(math.ceil(float(self.count)/self.limit)) | [
"def",
"pages_count",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"limit",
"or",
"self",
".",
"count",
"<",
"self",
".",
"limit",
":",
"return",
"1",
"if",
"self",
".",
"count",
"%",
"self",
".",
"limit",
"<=",
"self",
".",
"orphans",
":",
"... | Number of pages. | [
"Number",
"of",
"pages",
"."
] | 80bc0f1408d63efe7f5844367d1f6efba44b35f2 | https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/utils/paginator.py#L199-L205 |
55,081 | SmartTeleMax/iktomi | iktomi/utils/paginator.py | Paginator.slice | def slice(self, items):
'''Slice the sequence of all items to obtain them for current page.'''
if self.limit:
if self.page>self.pages_count:
return []
if self.page == self.pages_count:
return items[self.limit*(self.page-1):]
return item... | python | def slice(self, items):
'''Slice the sequence of all items to obtain them for current page.'''
if self.limit:
if self.page>self.pages_count:
return []
if self.page == self.pages_count:
return items[self.limit*(self.page-1):]
return item... | [
"def",
"slice",
"(",
"self",
",",
"items",
")",
":",
"if",
"self",
".",
"limit",
":",
"if",
"self",
".",
"page",
">",
"self",
".",
"pages_count",
":",
"return",
"[",
"]",
"if",
"self",
".",
"page",
"==",
"self",
".",
"pages_count",
":",
"return",
... | Slice the sequence of all items to obtain them for current page. | [
"Slice",
"the",
"sequence",
"of",
"all",
"items",
"to",
"obtain",
"them",
"for",
"current",
"page",
"."
] | 80bc0f1408d63efe7f5844367d1f6efba44b35f2 | https://github.com/SmartTeleMax/iktomi/blob/80bc0f1408d63efe7f5844367d1f6efba44b35f2/iktomi/utils/paginator.py#L207-L216 |
55,082 | project-ncl/pnc-cli | pnc_cli/buildrecords.py | list_build_records | def list_build_records(page_size=200, page_index=0, sort="", q=""):
"""
List all BuildRecords
"""
data = list_build_records_raw(page_size, page_index, sort, q)
if data:
return utils.format_json_list(data) | python | def list_build_records(page_size=200, page_index=0, sort="", q=""):
"""
List all BuildRecords
"""
data = list_build_records_raw(page_size, page_index, sort, q)
if data:
return utils.format_json_list(data) | [
"def",
"list_build_records",
"(",
"page_size",
"=",
"200",
",",
"page_index",
"=",
"0",
",",
"sort",
"=",
"\"\"",
",",
"q",
"=",
"\"\"",
")",
":",
"data",
"=",
"list_build_records_raw",
"(",
"page_size",
",",
"page_index",
",",
"sort",
",",
"q",
")",
"... | List all BuildRecords | [
"List",
"all",
"BuildRecords"
] | 3dc149bf84928f60a8044ac50b58bbaddd451902 | https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/buildrecords.py#L13-L19 |
55,083 | project-ncl/pnc-cli | pnc_cli/buildrecords.py | list_records_for_build_configuration | def list_records_for_build_configuration(id=None, name=None, page_size=200, page_index=0, sort="", q=""):
"""
List all BuildRecords for a given BuildConfiguration
"""
data = list_records_for_build_configuration_raw(id, name, page_size, page_index, sort, q)
if data:
return utils.format_json_l... | python | def list_records_for_build_configuration(id=None, name=None, page_size=200, page_index=0, sort="", q=""):
"""
List all BuildRecords for a given BuildConfiguration
"""
data = list_records_for_build_configuration_raw(id, name, page_size, page_index, sort, q)
if data:
return utils.format_json_l... | [
"def",
"list_records_for_build_configuration",
"(",
"id",
"=",
"None",
",",
"name",
"=",
"None",
",",
"page_size",
"=",
"200",
",",
"page_index",
"=",
"0",
",",
"sort",
"=",
"\"\"",
",",
"q",
"=",
"\"\"",
")",
":",
"data",
"=",
"list_records_for_build_conf... | List all BuildRecords for a given BuildConfiguration | [
"List",
"all",
"BuildRecords",
"for",
"a",
"given",
"BuildConfiguration"
] | 3dc149bf84928f60a8044ac50b58bbaddd451902 | https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/buildrecords.py#L33-L39 |
55,084 | project-ncl/pnc-cli | pnc_cli/buildrecords.py | list_records_for_project | def list_records_for_project(id=None, name=None, page_size=200, page_index=0, sort="", q=""):
"""
List all BuildRecords for a given Project
"""
data = list_records_for_project_raw(id, name, page_size, page_index, sort, q)
if data:
return utils.format_json_list(data) | python | def list_records_for_project(id=None, name=None, page_size=200, page_index=0, sort="", q=""):
"""
List all BuildRecords for a given Project
"""
data = list_records_for_project_raw(id, name, page_size, page_index, sort, q)
if data:
return utils.format_json_list(data) | [
"def",
"list_records_for_project",
"(",
"id",
"=",
"None",
",",
"name",
"=",
"None",
",",
"page_size",
"=",
"200",
",",
"page_index",
"=",
"0",
",",
"sort",
"=",
"\"\"",
",",
"q",
"=",
"\"\"",
")",
":",
"data",
"=",
"list_records_for_project_raw",
"(",
... | List all BuildRecords for a given Project | [
"List",
"all",
"BuildRecords",
"for",
"a",
"given",
"Project"
] | 3dc149bf84928f60a8044ac50b58bbaddd451902 | https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/buildrecords.py#L55-L61 |
55,085 | project-ncl/pnc-cli | pnc_cli/buildrecords.py | list_built_artifacts | def list_built_artifacts(id, page_size=200, page_index=0, sort="", q=""):
"""
List Artifacts associated with a BuildRecord
"""
data = list_built_artifacts_raw(id, page_size, page_index, sort, q)
if data:
return utils.format_json_list(data) | python | def list_built_artifacts(id, page_size=200, page_index=0, sort="", q=""):
"""
List Artifacts associated with a BuildRecord
"""
data = list_built_artifacts_raw(id, page_size, page_index, sort, q)
if data:
return utils.format_json_list(data) | [
"def",
"list_built_artifacts",
"(",
"id",
",",
"page_size",
"=",
"200",
",",
"page_index",
"=",
"0",
",",
"sort",
"=",
"\"\"",
",",
"q",
"=",
"\"\"",
")",
":",
"data",
"=",
"list_built_artifacts_raw",
"(",
"id",
",",
"page_size",
",",
"page_index",
",",
... | List Artifacts associated with a BuildRecord | [
"List",
"Artifacts",
"associated",
"with",
"a",
"BuildRecord"
] | 3dc149bf84928f60a8044ac50b58bbaddd451902 | https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/buildrecords.py#L91-L97 |
55,086 | project-ncl/pnc-cli | pnc_cli/buildrecords.py | list_dependency_artifacts | def list_dependency_artifacts(id, page_size=200, page_index=0, sort="", q=""):
"""
List dependency artifacts associated with a BuildRecord
"""
data = list_dependency_artifacts_raw(id, page_size, page_index, sort, q)
if data:
return utils.format_json_list(data) | python | def list_dependency_artifacts(id, page_size=200, page_index=0, sort="", q=""):
"""
List dependency artifacts associated with a BuildRecord
"""
data = list_dependency_artifacts_raw(id, page_size, page_index, sort, q)
if data:
return utils.format_json_list(data) | [
"def",
"list_dependency_artifacts",
"(",
"id",
",",
"page_size",
"=",
"200",
",",
"page_index",
"=",
"0",
",",
"sort",
"=",
"\"\"",
",",
"q",
"=",
"\"\"",
")",
":",
"data",
"=",
"list_dependency_artifacts_raw",
"(",
"id",
",",
"page_size",
",",
"page_index... | List dependency artifacts associated with a BuildRecord | [
"List",
"dependency",
"artifacts",
"associated",
"with",
"a",
"BuildRecord"
] | 3dc149bf84928f60a8044ac50b58bbaddd451902 | https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/buildrecords.py#L111-L117 |
55,087 | paddycarey/mopidy-webhooks | mopidy_webhooks/reporters/status.py | StatusReporter.on_start | def on_start(self):
"""Runs when the actor is started and schedules a status update
"""
logger.info('StatusReporter started.')
# if configured not to report status then return immediately
if self.config['status_update_interval'] == 0:
logger.info('StatusReporter disab... | python | def on_start(self):
"""Runs when the actor is started and schedules a status update
"""
logger.info('StatusReporter started.')
# if configured not to report status then return immediately
if self.config['status_update_interval'] == 0:
logger.info('StatusReporter disab... | [
"def",
"on_start",
"(",
"self",
")",
":",
"logger",
".",
"info",
"(",
"'StatusReporter started.'",
")",
"# if configured not to report status then return immediately",
"if",
"self",
".",
"config",
"[",
"'status_update_interval'",
"]",
"==",
"0",
":",
"logger",
".",
... | Runs when the actor is started and schedules a status update | [
"Runs",
"when",
"the",
"actor",
"is",
"started",
"and",
"schedules",
"a",
"status",
"update"
] | 813b57333d96837a5ed91b00e389383815686908 | https://github.com/paddycarey/mopidy-webhooks/blob/813b57333d96837a5ed91b00e389383815686908/mopidy_webhooks/reporters/status.py#L30-L38 |
55,088 | paddycarey/mopidy-webhooks | mopidy_webhooks/reporters/status.py | StatusReporter.report_again | def report_again(self, current_status):
"""Computes a sleep interval, sleeps for the specified amount of time
then kicks off another status report.
"""
# calculate sleep interval based on current status and configured interval
_m = {'playing': 1, 'paused': 2, 'stopped': 5}[curren... | python | def report_again(self, current_status):
"""Computes a sleep interval, sleeps for the specified amount of time
then kicks off another status report.
"""
# calculate sleep interval based on current status and configured interval
_m = {'playing': 1, 'paused': 2, 'stopped': 5}[curren... | [
"def",
"report_again",
"(",
"self",
",",
"current_status",
")",
":",
"# calculate sleep interval based on current status and configured interval",
"_m",
"=",
"{",
"'playing'",
":",
"1",
",",
"'paused'",
":",
"2",
",",
"'stopped'",
":",
"5",
"}",
"[",
"current_status... | Computes a sleep interval, sleeps for the specified amount of time
then kicks off another status report. | [
"Computes",
"a",
"sleep",
"interval",
"sleeps",
"for",
"the",
"specified",
"amount",
"of",
"time",
"then",
"kicks",
"off",
"another",
"status",
"report",
"."
] | 813b57333d96837a5ed91b00e389383815686908 | https://github.com/paddycarey/mopidy-webhooks/blob/813b57333d96837a5ed91b00e389383815686908/mopidy_webhooks/reporters/status.py#L40-L49 |
55,089 | paddycarey/mopidy-webhooks | mopidy_webhooks/reporters/status.py | StatusReporter.report_status | def report_status(self):
"""Get status of player from mopidy core and send webhook.
"""
current_status = {
'current_track': self.core.playback.current_track.get(),
'state': self.core.playback.state.get(),
'time_position': self.core.playback.time_position.get()... | python | def report_status(self):
"""Get status of player from mopidy core and send webhook.
"""
current_status = {
'current_track': self.core.playback.current_track.get(),
'state': self.core.playback.state.get(),
'time_position': self.core.playback.time_position.get()... | [
"def",
"report_status",
"(",
"self",
")",
":",
"current_status",
"=",
"{",
"'current_track'",
":",
"self",
".",
"core",
".",
"playback",
".",
"current_track",
".",
"get",
"(",
")",
",",
"'state'",
":",
"self",
".",
"core",
".",
"playback",
".",
"state",
... | Get status of player from mopidy core and send webhook. | [
"Get",
"status",
"of",
"player",
"from",
"mopidy",
"core",
"and",
"send",
"webhook",
"."
] | 813b57333d96837a5ed91b00e389383815686908 | https://github.com/paddycarey/mopidy-webhooks/blob/813b57333d96837a5ed91b00e389383815686908/mopidy_webhooks/reporters/status.py#L51-L60 |
55,090 | edoburu/django-any-urlfield | any_urlfield/cache.py | get_urlfield_cache_key | def get_urlfield_cache_key(model, pk, language_code=None):
"""
The low-level function to get the cache key for a model.
"""
return 'anyurlfield.{0}.{1}.{2}.{3}'.format(model._meta.app_label, model.__name__, pk, language_code or get_language()) | python | def get_urlfield_cache_key(model, pk, language_code=None):
"""
The low-level function to get the cache key for a model.
"""
return 'anyurlfield.{0}.{1}.{2}.{3}'.format(model._meta.app_label, model.__name__, pk, language_code or get_language()) | [
"def",
"get_urlfield_cache_key",
"(",
"model",
",",
"pk",
",",
"language_code",
"=",
"None",
")",
":",
"return",
"'anyurlfield.{0}.{1}.{2}.{3}'",
".",
"format",
"(",
"model",
".",
"_meta",
".",
"app_label",
",",
"model",
".",
"__name__",
",",
"pk",
",",
"lan... | The low-level function to get the cache key for a model. | [
"The",
"low",
"-",
"level",
"function",
"to",
"get",
"the",
"cache",
"key",
"for",
"a",
"model",
"."
] | 8d7d36c8a1fc251930f6dbdcc8b5b5151d20e3ab | https://github.com/edoburu/django-any-urlfield/blob/8d7d36c8a1fc251930f6dbdcc8b5b5151d20e3ab/any_urlfield/cache.py#L7-L11 |
55,091 | flaviogrossi/sockjs-cyclone | sockjs/cyclone/stats.py | MovingAverage.flush | def flush(self):
""" Add accumulator to the moving average queue and reset it. For
example, called by the StatsCollector once per second to calculate
per-second average.
"""
n = self.accumulator
self.accumulator = 0
stream = self.stream
stream.append(n)
... | python | def flush(self):
""" Add accumulator to the moving average queue and reset it. For
example, called by the StatsCollector once per second to calculate
per-second average.
"""
n = self.accumulator
self.accumulator = 0
stream = self.stream
stream.append(n)
... | [
"def",
"flush",
"(",
"self",
")",
":",
"n",
"=",
"self",
".",
"accumulator",
"self",
".",
"accumulator",
"=",
"0",
"stream",
"=",
"self",
".",
"stream",
"stream",
".",
"append",
"(",
"n",
")",
"self",
".",
"sum",
"+=",
"n",
"streamlen",
"=",
"len",... | Add accumulator to the moving average queue and reset it. For
example, called by the StatsCollector once per second to calculate
per-second average. | [
"Add",
"accumulator",
"to",
"the",
"moving",
"average",
"queue",
"and",
"reset",
"it",
".",
"For",
"example",
"called",
"by",
"the",
"StatsCollector",
"once",
"per",
"second",
"to",
"calculate",
"per",
"-",
"second",
"average",
"."
] | d3ca053ec1aa1e85f652347bff562c2319be37a2 | https://github.com/flaviogrossi/sockjs-cyclone/blob/d3ca053ec1aa1e85f652347bff562c2319be37a2/sockjs/cyclone/stats.py#L29-L50 |
55,092 | paddycarey/mopidy-webhooks | mopidy_webhooks/utils.py | send_webhook | def send_webhook(config, payload):
"""Sends a HTTP request to the configured server.
All exceptions are suppressed but emit a warning message in the log.
"""
try:
response = requests.post(
config['webhook_url'],
data=json.dumps(payload, cls=ModelJSONEncoder),
... | python | def send_webhook(config, payload):
"""Sends a HTTP request to the configured server.
All exceptions are suppressed but emit a warning message in the log.
"""
try:
response = requests.post(
config['webhook_url'],
data=json.dumps(payload, cls=ModelJSONEncoder),
... | [
"def",
"send_webhook",
"(",
"config",
",",
"payload",
")",
":",
"try",
":",
"response",
"=",
"requests",
".",
"post",
"(",
"config",
"[",
"'webhook_url'",
"]",
",",
"data",
"=",
"json",
".",
"dumps",
"(",
"payload",
",",
"cls",
"=",
"ModelJSONEncoder",
... | Sends a HTTP request to the configured server.
All exceptions are suppressed but emit a warning message in the log. | [
"Sends",
"a",
"HTTP",
"request",
"to",
"the",
"configured",
"server",
"."
] | 813b57333d96837a5ed91b00e389383815686908 | https://github.com/paddycarey/mopidy-webhooks/blob/813b57333d96837a5ed91b00e389383815686908/mopidy_webhooks/utils.py#L16-L36 |
55,093 | CivicSpleen/ambry | ambry/library/warehouse.py | Warehouse.clean | def clean(self):
"""Remove all of the tables and data from the warehouse"""
connection = self._backend._get_connection()
self._backend.clean(connection) | python | def clean(self):
"""Remove all of the tables and data from the warehouse"""
connection = self._backend._get_connection()
self._backend.clean(connection) | [
"def",
"clean",
"(",
"self",
")",
":",
"connection",
"=",
"self",
".",
"_backend",
".",
"_get_connection",
"(",
")",
"self",
".",
"_backend",
".",
"clean",
"(",
"connection",
")"
] | Remove all of the tables and data from the warehouse | [
"Remove",
"all",
"of",
"the",
"tables",
"and",
"data",
"from",
"the",
"warehouse"
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/warehouse.py#L79-L82 |
55,094 | CivicSpleen/ambry | ambry/library/warehouse.py | Warehouse.list | def list(self):
"""List the tables in the database"""
connection = self._backend._get_connection()
return list(self._backend.list(connection)) | python | def list(self):
"""List the tables in the database"""
connection = self._backend._get_connection()
return list(self._backend.list(connection)) | [
"def",
"list",
"(",
"self",
")",
":",
"connection",
"=",
"self",
".",
"_backend",
".",
"_get_connection",
"(",
")",
"return",
"list",
"(",
"self",
".",
"_backend",
".",
"list",
"(",
"connection",
")",
")"
] | List the tables in the database | [
"List",
"the",
"tables",
"in",
"the",
"database"
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/warehouse.py#L84-L87 |
55,095 | CivicSpleen/ambry | ambry/library/warehouse.py | Warehouse.install | def install(self, ref, table_name=None, index_columns=None,logger=None):
""" Finds partition by reference and installs it to warehouse db.
Args:
ref (str): id, vid (versioned id), name or vname (versioned name) of the partition.
"""
try:
obj_number = ObjectNum... | python | def install(self, ref, table_name=None, index_columns=None,logger=None):
""" Finds partition by reference and installs it to warehouse db.
Args:
ref (str): id, vid (versioned id), name or vname (versioned name) of the partition.
"""
try:
obj_number = ObjectNum... | [
"def",
"install",
"(",
"self",
",",
"ref",
",",
"table_name",
"=",
"None",
",",
"index_columns",
"=",
"None",
",",
"logger",
"=",
"None",
")",
":",
"try",
":",
"obj_number",
"=",
"ObjectNumber",
".",
"parse",
"(",
"ref",
")",
"if",
"isinstance",
"(",
... | Finds partition by reference and installs it to warehouse db.
Args:
ref (str): id, vid (versioned id), name or vname (versioned name) of the partition. | [
"Finds",
"partition",
"by",
"reference",
"and",
"installs",
"it",
"to",
"warehouse",
"db",
"."
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/warehouse.py#L94-L120 |
55,096 | CivicSpleen/ambry | ambry/library/warehouse.py | Warehouse.materialize | def materialize(self, ref, table_name=None, index_columns=None, logger=None):
""" Creates materialized table for given partition reference.
Args:
ref (str): id, vid, name or vname of the partition.
Returns:
str: name of the partition table in the database.
"""
... | python | def materialize(self, ref, table_name=None, index_columns=None, logger=None):
""" Creates materialized table for given partition reference.
Args:
ref (str): id, vid, name or vname of the partition.
Returns:
str: name of the partition table in the database.
"""
... | [
"def",
"materialize",
"(",
"self",
",",
"ref",
",",
"table_name",
"=",
"None",
",",
"index_columns",
"=",
"None",
",",
"logger",
"=",
"None",
")",
":",
"from",
"ambry",
".",
"library",
"import",
"Library",
"assert",
"isinstance",
"(",
"self",
".",
"_libr... | Creates materialized table for given partition reference.
Args:
ref (str): id, vid, name or vname of the partition.
Returns:
str: name of the partition table in the database. | [
"Creates",
"materialized",
"table",
"for",
"given",
"partition",
"reference",
"."
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/warehouse.py#L122-L141 |
55,097 | CivicSpleen/ambry | ambry/library/warehouse.py | Warehouse.parse_sql | def parse_sql(self, asql):
""" Executes all sql statements from asql.
Args:
library (library.Library):
asql (str): ambry sql query - see https://github.com/CivicKnowledge/ambry/issues/140 for details.
"""
import sqlparse
statements = sqlparse.parse(sqlpa... | python | def parse_sql(self, asql):
""" Executes all sql statements from asql.
Args:
library (library.Library):
asql (str): ambry sql query - see https://github.com/CivicKnowledge/ambry/issues/140 for details.
"""
import sqlparse
statements = sqlparse.parse(sqlpa... | [
"def",
"parse_sql",
"(",
"self",
",",
"asql",
")",
":",
"import",
"sqlparse",
"statements",
"=",
"sqlparse",
".",
"parse",
"(",
"sqlparse",
".",
"format",
"(",
"asql",
",",
"strip_comments",
"=",
"True",
")",
")",
"parsed_statements",
"=",
"[",
"]",
"for... | Executes all sql statements from asql.
Args:
library (library.Library):
asql (str): ambry sql query - see https://github.com/CivicKnowledge/ambry/issues/140 for details. | [
"Executes",
"all",
"sql",
"statements",
"from",
"asql",
"."
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/warehouse.py#L165-L185 |
55,098 | CivicSpleen/ambry | ambry/library/warehouse.py | Warehouse.query | def query(self, asql, logger=None):
"""
Execute an ASQL file and return the result of the first SELECT statement.
:param asql:
:param logger:
:return:
"""
import sqlparse
from ambry.mprlib.exceptions import BadSQLError
from ambry.bundle.asql_parse... | python | def query(self, asql, logger=None):
"""
Execute an ASQL file and return the result of the first SELECT statement.
:param asql:
:param logger:
:return:
"""
import sqlparse
from ambry.mprlib.exceptions import BadSQLError
from ambry.bundle.asql_parse... | [
"def",
"query",
"(",
"self",
",",
"asql",
",",
"logger",
"=",
"None",
")",
":",
"import",
"sqlparse",
"from",
"ambry",
".",
"mprlib",
".",
"exceptions",
"import",
"BadSQLError",
"from",
"ambry",
".",
"bundle",
".",
"asql_parser",
"import",
"process_sql",
"... | Execute an ASQL file and return the result of the first SELECT statement.
:param asql:
:param logger:
:return: | [
"Execute",
"an",
"ASQL",
"file",
"and",
"return",
"the",
"result",
"of",
"the",
"first",
"SELECT",
"statement",
"."
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/warehouse.py#L187-L261 |
55,099 | CivicSpleen/ambry | ambry/library/warehouse.py | Warehouse.geoframe | def geoframe(self, sql, simplify=None, crs=None, epsg=4326):
"""
Return geopandas dataframe
:param simplify: Integer or None. Simplify the geometry to a tolerance, in the units of the geometry.
:param crs: Coordinate reference system information
:param epsg: Specifiy the CRS as ... | python | def geoframe(self, sql, simplify=None, crs=None, epsg=4326):
"""
Return geopandas dataframe
:param simplify: Integer or None. Simplify the geometry to a tolerance, in the units of the geometry.
:param crs: Coordinate reference system information
:param epsg: Specifiy the CRS as ... | [
"def",
"geoframe",
"(",
"self",
",",
"sql",
",",
"simplify",
"=",
"None",
",",
"crs",
"=",
"None",
",",
"epsg",
"=",
"4326",
")",
":",
"import",
"geopandas",
"from",
"shapely",
".",
"wkt",
"import",
"loads",
"from",
"fiona",
".",
"crs",
"import",
"fr... | Return geopandas dataframe
:param simplify: Integer or None. Simplify the geometry to a tolerance, in the units of the geometry.
:param crs: Coordinate reference system information
:param epsg: Specifiy the CRS as an EPGS number.
:return: A Geopandas GeoDataFrame | [
"Return",
"geopandas",
"dataframe"
] | d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42 | https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/library/warehouse.py#L289-L318 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.