partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | PhysicalVolume.dev_size | Returns the device size in the given units. Default units are MiB.
*Args:*
* units (str): Unit label ('MiB', 'GiB', etc...). Default is MiB. | lvm2py/pv.py | def dev_size(self, units="MiB"):
"""
Returns the device size in the given units. Default units are MiB.
*Args:*
* units (str): Unit label ('MiB', 'GiB', etc...). Default is MiB.
"""
self.open()
size = lvm_pv_get_dev_size(self.handle)
self.close... | def dev_size(self, units="MiB"):
"""
Returns the device size in the given units. Default units are MiB.
*Args:*
* units (str): Unit label ('MiB', 'GiB', etc...). Default is MiB.
"""
self.open()
size = lvm_pv_get_dev_size(self.handle)
self.close... | [
"Returns",
"the",
"device",
"size",
"in",
"the",
"given",
"units",
".",
"Default",
"units",
"are",
"MiB",
"."
] | xzased/lvm2py | python | https://github.com/xzased/lvm2py/blob/34ce69304531a474c2fe4a4009ca445a8c103cd6/lvm2py/pv.py#L150-L161 | [
"def",
"dev_size",
"(",
"self",
",",
"units",
"=",
"\"MiB\"",
")",
":",
"self",
".",
"open",
"(",
")",
"size",
"=",
"lvm_pv_get_dev_size",
"(",
"self",
".",
"handle",
")",
"self",
".",
"close",
"(",
")",
"return",
"size_convert",
"(",
"size",
",",
"u... | 34ce69304531a474c2fe4a4009ca445a8c103cd6 |
train | PhysicalVolume.free | Returns the free size in the given units. Default units are MiB.
*Args:*
* units (str): Unit label ('MiB', 'GiB', etc...). Default is MiB. | lvm2py/pv.py | def free(self, units="MiB"):
"""
Returns the free size in the given units. Default units are MiB.
*Args:*
* units (str): Unit label ('MiB', 'GiB', etc...). Default is MiB.
"""
self.open()
size = lvm_pv_get_free(self.handle)
self.close()
... | def free(self, units="MiB"):
"""
Returns the free size in the given units. Default units are MiB.
*Args:*
* units (str): Unit label ('MiB', 'GiB', etc...). Default is MiB.
"""
self.open()
size = lvm_pv_get_free(self.handle)
self.close()
... | [
"Returns",
"the",
"free",
"size",
"in",
"the",
"given",
"units",
".",
"Default",
"units",
"are",
"MiB",
"."
] | xzased/lvm2py | python | https://github.com/xzased/lvm2py/blob/34ce69304531a474c2fe4a4009ca445a8c103cd6/lvm2py/pv.py#L163-L174 | [
"def",
"free",
"(",
"self",
",",
"units",
"=",
"\"MiB\"",
")",
":",
"self",
".",
"open",
"(",
")",
"size",
"=",
"lvm_pv_get_free",
"(",
"self",
".",
"handle",
")",
"self",
".",
"close",
"(",
")",
"return",
"size_convert",
"(",
"size",
",",
"units",
... | 34ce69304531a474c2fe4a4009ca445a8c103cd6 |
train | mongoengine_validate_wrapper | A wrapper function to validate formdata against mongoengine-field
validator and raise a proper django.forms ValidationError if there
are any problems. | mongoforms/utils.py | def mongoengine_validate_wrapper(old_clean, new_clean):
"""
A wrapper function to validate formdata against mongoengine-field
validator and raise a proper django.forms ValidationError if there
are any problems.
"""
def inner_validate(value):
value = old_clean(value)
try:
... | def mongoengine_validate_wrapper(old_clean, new_clean):
"""
A wrapper function to validate formdata against mongoengine-field
validator and raise a proper django.forms ValidationError if there
are any problems.
"""
def inner_validate(value):
value = old_clean(value)
try:
... | [
"A",
"wrapper",
"function",
"to",
"validate",
"formdata",
"against",
"mongoengine",
"-",
"field",
"validator",
"and",
"raise",
"a",
"proper",
"django",
".",
"forms",
"ValidationError",
"if",
"there",
"are",
"any",
"problems",
"."
] | stephrdev/django-mongoforms | python | https://github.com/stephrdev/django-mongoforms/blob/6fa46824c438555c703f293d682ca92710938985/mongoforms/utils.py#L5-L19 | [
"def",
"mongoengine_validate_wrapper",
"(",
"old_clean",
",",
"new_clean",
")",
":",
"def",
"inner_validate",
"(",
"value",
")",
":",
"value",
"=",
"old_clean",
"(",
"value",
")",
"try",
":",
"new_clean",
"(",
"value",
")",
"return",
"value",
"except",
"Vali... | 6fa46824c438555c703f293d682ca92710938985 |
train | iter_valid_fields | walk through the available valid fields.. | mongoforms/utils.py | def iter_valid_fields(meta):
"""walk through the available valid fields.."""
# fetch field configuration and always add the id_field as exclude
meta_fields = getattr(meta, 'fields', ())
meta_exclude = getattr(meta, 'exclude', ())
meta_exclude += (meta.document._meta.get('id_field'),)
# walk th... | def iter_valid_fields(meta):
"""walk through the available valid fields.."""
# fetch field configuration and always add the id_field as exclude
meta_fields = getattr(meta, 'fields', ())
meta_exclude = getattr(meta, 'exclude', ())
meta_exclude += (meta.document._meta.get('id_field'),)
# walk th... | [
"walk",
"through",
"the",
"available",
"valid",
"fields",
".."
] | stephrdev/django-mongoforms | python | https://github.com/stephrdev/django-mongoforms/blob/6fa46824c438555c703f293d682ca92710938985/mongoforms/utils.py#L22-L41 | [
"def",
"iter_valid_fields",
"(",
"meta",
")",
":",
"# fetch field configuration and always add the id_field as exclude",
"meta_fields",
"=",
"getattr",
"(",
"meta",
",",
"'fields'",
",",
"(",
")",
")",
"meta_exclude",
"=",
"getattr",
"(",
"meta",
",",
"'exclude'",
"... | 6fa46824c438555c703f293d682ca92710938985 |
train | dependsOn | This function behaves like L{axiom.attributes.reference} but with
an extra behaviour: when this item is installed (via
L{axiom.dependency.installOn} on a target item, the
type named here will be instantiated and installed on the target
as well.
For example::
class Foo(Item):
counte... | axiom/dependency.py | def dependsOn(itemType, itemCustomizer=None, doc='',
indexed=True, whenDeleted=reference.NULLIFY):
"""
This function behaves like L{axiom.attributes.reference} but with
an extra behaviour: when this item is installed (via
L{axiom.dependency.installOn} on a target item, the
type named h... | def dependsOn(itemType, itemCustomizer=None, doc='',
indexed=True, whenDeleted=reference.NULLIFY):
"""
This function behaves like L{axiom.attributes.reference} but with
an extra behaviour: when this item is installed (via
L{axiom.dependency.installOn} on a target item, the
type named h... | [
"This",
"function",
"behaves",
"like",
"L",
"{",
"axiom",
".",
"attributes",
".",
"reference",
"}",
"but",
"with",
"an",
"extra",
"behaviour",
":",
"when",
"this",
"item",
"is",
"installed",
"(",
"via",
"L",
"{",
"axiom",
".",
"dependency",
".",
"install... | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/dependency.py#L29-L64 | [
"def",
"dependsOn",
"(",
"itemType",
",",
"itemCustomizer",
"=",
"None",
",",
"doc",
"=",
"''",
",",
"indexed",
"=",
"True",
",",
"whenDeleted",
"=",
"reference",
".",
"NULLIFY",
")",
":",
"frame",
"=",
"sys",
".",
"_getframe",
"(",
"1",
")",
"locals",... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | uninstallFrom | Remove this object from the target, as well as any dependencies
that it automatically installed which were not explicitly
"pinned" by calling "install", and raising an exception if
anything still depends on this. | axiom/dependency.py | def uninstallFrom(self, target):
"""
Remove this object from the target, as well as any dependencies
that it automatically installed which were not explicitly
"pinned" by calling "install", and raising an exception if
anything still depends on this.
"""
#did this class powerup on any interf... | def uninstallFrom(self, target):
"""
Remove this object from the target, as well as any dependencies
that it automatically installed which were not explicitly
"pinned" by calling "install", and raising an exception if
anything still depends on this.
"""
#did this class powerup on any interf... | [
"Remove",
"this",
"object",
"from",
"the",
"target",
"as",
"well",
"as",
"any",
"dependencies",
"that",
"it",
"automatically",
"installed",
"which",
"were",
"not",
"explicitly",
"pinned",
"by",
"calling",
"install",
"and",
"raising",
"an",
"exception",
"if",
"... | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/dependency.py#L150-L172 | [
"def",
"uninstallFrom",
"(",
"self",
",",
"target",
")",
":",
"#did this class powerup on any interfaces? powerdown if so.",
"target",
".",
"powerDown",
"(",
"self",
")",
"for",
"dc",
"in",
"self",
".",
"store",
".",
"query",
"(",
"_DependencyConnector",
",",
"_De... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | installedOn | If this item is installed on another item, return the install
target. Otherwise return None. | axiom/dependency.py | def installedOn(self):
"""
If this item is installed on another item, return the install
target. Otherwise return None.
"""
try:
return self.store.findUnique(_DependencyConnector,
_DependencyConnector.installee == self
... | def installedOn(self):
"""
If this item is installed on another item, return the install
target. Otherwise return None.
"""
try:
return self.store.findUnique(_DependencyConnector,
_DependencyConnector.installee == self
... | [
"If",
"this",
"item",
"is",
"installed",
"on",
"another",
"item",
"return",
"the",
"install",
"target",
".",
"Otherwise",
"return",
"None",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/dependency.py#L174-L184 | [
"def",
"installedOn",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"store",
".",
"findUnique",
"(",
"_DependencyConnector",
",",
"_DependencyConnector",
".",
"installee",
"==",
"self",
")",
".",
"target",
"except",
"ItemNotFound",
":",
"return",
... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | installedDependents | Return an iterable of things installed on the target that
require this item. | axiom/dependency.py | def installedDependents(self, target):
"""
Return an iterable of things installed on the target that
require this item.
"""
for dc in self.store.query(_DependencyConnector,
_DependencyConnector.target == target):
depends = dependentsOf(dc.installee.__class__)
... | def installedDependents(self, target):
"""
Return an iterable of things installed on the target that
require this item.
"""
for dc in self.store.query(_DependencyConnector,
_DependencyConnector.target == target):
depends = dependentsOf(dc.installee.__class__)
... | [
"Return",
"an",
"iterable",
"of",
"things",
"installed",
"on",
"the",
"target",
"that",
"require",
"this",
"item",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/dependency.py#L187-L196 | [
"def",
"installedDependents",
"(",
"self",
",",
"target",
")",
":",
"for",
"dc",
"in",
"self",
".",
"store",
".",
"query",
"(",
"_DependencyConnector",
",",
"_DependencyConnector",
".",
"target",
"==",
"target",
")",
":",
"depends",
"=",
"dependentsOf",
"(",... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | installedUniqueRequirements | Return an iterable of things installed on the target that this item
requires and are not required by anything else. | axiom/dependency.py | def installedUniqueRequirements(self, target):
"""
Return an iterable of things installed on the target that this item
requires and are not required by anything else.
"""
myDepends = dependentsOf(self.__class__)
#XXX optimize?
for dc in self.store.query(_DependencyConnector,
... | def installedUniqueRequirements(self, target):
"""
Return an iterable of things installed on the target that this item
requires and are not required by anything else.
"""
myDepends = dependentsOf(self.__class__)
#XXX optimize?
for dc in self.store.query(_DependencyConnector,
... | [
"Return",
"an",
"iterable",
"of",
"things",
"installed",
"on",
"the",
"target",
"that",
"this",
"item",
"requires",
"and",
"are",
"not",
"required",
"by",
"anything",
"else",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/dependency.py#L198-L227 | [
"def",
"installedUniqueRequirements",
"(",
"self",
",",
"target",
")",
":",
"myDepends",
"=",
"dependentsOf",
"(",
"self",
".",
"__class__",
")",
"#XXX optimize?",
"for",
"dc",
"in",
"self",
".",
"store",
".",
"query",
"(",
"_DependencyConnector",
",",
"_Depen... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | installedRequirements | Return an iterable of things installed on the target that this
item requires. | axiom/dependency.py | def installedRequirements(self, target):
"""
Return an iterable of things installed on the target that this
item requires.
"""
myDepends = dependentsOf(self.__class__)
for dc in self.store.query(_DependencyConnector,
_DependencyConnector.target == target):
... | def installedRequirements(self, target):
"""
Return an iterable of things installed on the target that this
item requires.
"""
myDepends = dependentsOf(self.__class__)
for dc in self.store.query(_DependencyConnector,
_DependencyConnector.target == target):
... | [
"Return",
"an",
"iterable",
"of",
"things",
"installed",
"on",
"the",
"target",
"that",
"this",
"item",
"requires",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/dependency.py#L229-L238 | [
"def",
"installedRequirements",
"(",
"self",
",",
"target",
")",
":",
"myDepends",
"=",
"dependentsOf",
"(",
"self",
".",
"__class__",
")",
"for",
"dc",
"in",
"self",
".",
"store",
".",
"query",
"(",
"_DependencyConnector",
",",
"_DependencyConnector",
".",
... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | storeServiceSpecialCase | Adapt a store to L{IServiceCollection}.
@param st: The L{Store} to adapt.
@param pups: A list of L{IServiceCollection} powerups on C{st}.
@return: An L{IServiceCollection} which has all of C{pups} as children. | axiom/store.py | def storeServiceSpecialCase(st, pups):
"""
Adapt a store to L{IServiceCollection}.
@param st: The L{Store} to adapt.
@param pups: A list of L{IServiceCollection} powerups on C{st}.
@return: An L{IServiceCollection} which has all of C{pups} as children.
"""
if st.parent is not None:
... | def storeServiceSpecialCase(st, pups):
"""
Adapt a store to L{IServiceCollection}.
@param st: The L{Store} to adapt.
@param pups: A list of L{IServiceCollection} powerups on C{st}.
@return: An L{IServiceCollection} which has all of C{pups} as children.
"""
if st.parent is not None:
... | [
"Adapt",
"a",
"store",
"to",
"L",
"{",
"IServiceCollection",
"}",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L112-L148 | [
"def",
"storeServiceSpecialCase",
"(",
"st",
",",
"pups",
")",
":",
"if",
"st",
".",
"parent",
"is",
"not",
"None",
":",
"# If for some bizarre reason we're starting a substore's service, let's",
"# just assume that its parent is running its upgraders, rather than",
"# risk start... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | _schedulerServiceSpecialCase | This function creates (or returns a previously created) L{IScheduler}
powerup.
If L{IScheduler} powerups were found on C{empowered}, the first of those
is given priority. Otherwise, a site L{Store} or a user L{Store} will
have any pre-existing L{IScheduler} powerup associated with them (on the
hac... | axiom/store.py | def _schedulerServiceSpecialCase(empowered, pups):
"""
This function creates (or returns a previously created) L{IScheduler}
powerup.
If L{IScheduler} powerups were found on C{empowered}, the first of those
is given priority. Otherwise, a site L{Store} or a user L{Store} will
have any pre-exis... | def _schedulerServiceSpecialCase(empowered, pups):
"""
This function creates (or returns a previously created) L{IScheduler}
powerup.
If L{IScheduler} powerups were found on C{empowered}, the first of those
is given priority. Otherwise, a site L{Store} or a user L{Store} will
have any pre-exis... | [
"This",
"function",
"creates",
"(",
"or",
"returns",
"a",
"previously",
"created",
")",
"L",
"{",
"IScheduler",
"}",
"powerup",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L981-L1006 | [
"def",
"_schedulerServiceSpecialCase",
"(",
"empowered",
",",
"pups",
")",
":",
"from",
"axiom",
".",
"scheduler",
"import",
"_SiteScheduler",
",",
"_UserScheduler",
"# Give precedence to anything found in the store",
"for",
"pup",
"in",
"pups",
":",
"return",
"pup",
... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | _diffSchema | Format a schema mismatch for human consumption.
@param diskSchema: The on-disk schema.
@param memorySchema: The in-memory schema.
@rtype: L{bytes}
@return: A description of the schema differences. | axiom/store.py | def _diffSchema(diskSchema, memorySchema):
"""
Format a schema mismatch for human consumption.
@param diskSchema: The on-disk schema.
@param memorySchema: The in-memory schema.
@rtype: L{bytes}
@return: A description of the schema differences.
"""
diskSchema = set(diskSchema)
memo... | def _diffSchema(diskSchema, memorySchema):
"""
Format a schema mismatch for human consumption.
@param diskSchema: The on-disk schema.
@param memorySchema: The in-memory schema.
@rtype: L{bytes}
@return: A description of the schema differences.
"""
diskSchema = set(diskSchema)
memo... | [
"Format",
"a",
"schema",
"mismatch",
"for",
"human",
"consumption",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L1010-L1032 | [
"def",
"_diffSchema",
"(",
"diskSchema",
",",
"memorySchema",
")",
":",
"diskSchema",
"=",
"set",
"(",
"diskSchema",
")",
"memorySchema",
"=",
"set",
"(",
"memorySchema",
")",
"diskOnly",
"=",
"diskSchema",
"-",
"memorySchema",
"memoryOnly",
"=",
"memorySchema",... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | AtomicFile.close | Close this file and commit it to its permanent location.
@return: a Deferred which fires when the file has been moved (and
backed up to tertiary storage, if necessary). | axiom/store.py | def close(self):
"""
Close this file and commit it to its permanent location.
@return: a Deferred which fires when the file has been moved (and
backed up to tertiary storage, if necessary).
"""
now = time.time()
try:
file.close(self)
_mkdi... | def close(self):
"""
Close this file and commit it to its permanent location.
@return: a Deferred which fires when the file has been moved (and
backed up to tertiary storage, if necessary).
"""
now = time.time()
try:
file.close(self)
_mkdi... | [
"Close",
"this",
"file",
"and",
"commit",
"it",
"to",
"its",
"permanent",
"location",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L84-L100 | [
"def",
"close",
"(",
"self",
")",
":",
"now",
"=",
"time",
".",
"time",
"(",
")",
"try",
":",
"file",
".",
"close",
"(",
"self",
")",
"_mkdirIfNotExists",
"(",
"self",
".",
"_destpath",
".",
"dirname",
"(",
")",
")",
"self",
".",
"finalpath",
"=",
... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | BaseQuery.explain | A debugging API, exposing SQLite's I{EXPLAIN} statement.
While this is not a private method, you also probably don't have any
use for it unless you understand U{SQLite
opcodes<http://www.sqlite.org/opcode.html>} very well.
Once you do, it can be handy to call this interactively to get ... | axiom/store.py | def explain(self):
"""
A debugging API, exposing SQLite's I{EXPLAIN} statement.
While this is not a private method, you also probably don't have any
use for it unless you understand U{SQLite
opcodes<http://www.sqlite.org/opcode.html>} very well.
Once you do, it can be h... | def explain(self):
"""
A debugging API, exposing SQLite's I{EXPLAIN} statement.
While this is not a private method, you also probably don't have any
use for it unless you understand U{SQLite
opcodes<http://www.sqlite.org/opcode.html>} very well.
Once you do, it can be h... | [
"A",
"debugging",
"API",
"exposing",
"SQLite",
"s",
"I",
"{",
"EXPLAIN",
"}",
"statement",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L232-L248 | [
"def",
"explain",
"(",
"self",
")",
":",
"return",
"(",
"[",
"self",
".",
"_sqlAndArgs",
"(",
"'SELECT'",
",",
"self",
".",
"_queryTarget",
")",
"[",
"0",
"]",
"]",
"+",
"self",
".",
"_runQuery",
"(",
"'EXPLAIN SELECT'",
",",
"self",
".",
"_queryTarget... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | BaseQuery._computeFromClause | Generate the SQL string which follows the "FROM" string and before the
"WHERE" string in the final SQL statement. | axiom/store.py | def _computeFromClause(self, tables):
"""
Generate the SQL string which follows the "FROM" string and before the
"WHERE" string in the final SQL statement.
"""
tableAliases = []
self.fromClauseParts = []
for table in tables:
# The indirect calls to sto... | def _computeFromClause(self, tables):
"""
Generate the SQL string which follows the "FROM" string and before the
"WHERE" string in the final SQL statement.
"""
tableAliases = []
self.fromClauseParts = []
for table in tables:
# The indirect calls to sto... | [
"Generate",
"the",
"SQL",
"string",
"which",
"follows",
"the",
"FROM",
"string",
"and",
"before",
"the",
"WHERE",
"string",
"in",
"the",
"final",
"SQL",
"statement",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L271-L298 | [
"def",
"_computeFromClause",
"(",
"self",
",",
"tables",
")",
":",
"tableAliases",
"=",
"[",
"]",
"self",
".",
"fromClauseParts",
"=",
"[",
"]",
"for",
"table",
"in",
"tables",
":",
"# The indirect calls to store.getTableName() will create the tables",
"# if needed. (... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | BaseQuery._selectStuff | Return a generator which yields the massaged results of this query with
a particular SQL verb.
For an attribute query, massaged results are of the type of that
attribute. For an item query, they are items of the type the query is
supposed to return.
@param verb: a str containi... | axiom/store.py | def _selectStuff(self, verb='SELECT'):
"""
Return a generator which yields the massaged results of this query with
a particular SQL verb.
For an attribute query, massaged results are of the type of that
attribute. For an item query, they are items of the type the query is
... | def _selectStuff(self, verb='SELECT'):
"""
Return a generator which yields the massaged results of this query with
a particular SQL verb.
For an attribute query, massaged results are of the type of that
attribute. For an item query, they are items of the type the query is
... | [
"Return",
"a",
"generator",
"which",
"yields",
"the",
"massaged",
"results",
"of",
"this",
"query",
"with",
"a",
"particular",
"SQL",
"verb",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L360-L375 | [
"def",
"_selectStuff",
"(",
"self",
",",
"verb",
"=",
"'SELECT'",
")",
":",
"sqlResults",
"=",
"self",
".",
"_runQuery",
"(",
"verb",
",",
"self",
".",
"_queryTarget",
")",
"for",
"row",
"in",
"sqlResults",
":",
"yield",
"self",
".",
"_massageData",
"(",... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | BaseQuery.next | This method is deprecated, a holdover from when queries were iterators,
rather than iterables.
@return: one element of massaged data. | axiom/store.py | def next(self):
"""
This method is deprecated, a holdover from when queries were iterators,
rather than iterables.
@return: one element of massaged data.
"""
if self._selfiter is None:
warnings.warn(
"Calling 'next' directly on a query is depr... | def next(self):
"""
This method is deprecated, a holdover from when queries were iterators,
rather than iterables.
@return: one element of massaged data.
"""
if self._selfiter is None:
warnings.warn(
"Calling 'next' directly on a query is depr... | [
"This",
"method",
"is",
"deprecated",
"a",
"holdover",
"from",
"when",
"queries",
"were",
"iterators",
"rather",
"than",
"iterables",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L434-L448 | [
"def",
"next",
"(",
"self",
")",
":",
"if",
"self",
".",
"_selfiter",
"is",
"None",
":",
"warnings",
".",
"warn",
"(",
"\"Calling 'next' directly on a query is deprecated. \"",
"\"Perhaps you want to use iter(query).next(), or something \"",
"\"more expressive like store.findFi... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | ItemQuery.paginate | Split up the work of gathering a result set into multiple smaller
'pages', allowing very large queries to be iterated without blocking
for long periods of time.
While simply iterating C{paginate()} is very similar to iterating a
query directly, using this method allows the work to obtai... | axiom/store.py | def paginate(self, pagesize=20):
"""
Split up the work of gathering a result set into multiple smaller
'pages', allowing very large queries to be iterated without blocking
for long periods of time.
While simply iterating C{paginate()} is very similar to iterating a
query... | def paginate(self, pagesize=20):
"""
Split up the work of gathering a result set into multiple smaller
'pages', allowing very large queries to be iterated without blocking
for long periods of time.
While simply iterating C{paginate()} is very similar to iterating a
query... | [
"Split",
"up",
"the",
"work",
"of",
"gathering",
"a",
"result",
"set",
"into",
"multiple",
"smaller",
"pages",
"allowing",
"very",
"large",
"queries",
"to",
"be",
"iterated",
"without",
"blocking",
"for",
"long",
"periods",
"of",
"time",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L486-L572 | [
"def",
"paginate",
"(",
"self",
",",
"pagesize",
"=",
"20",
")",
":",
"sort",
"=",
"self",
".",
"sort",
"oc",
"=",
"list",
"(",
"sort",
".",
"orderColumns",
"(",
")",
")",
"if",
"not",
"oc",
":",
"# You can't have an unsorted pagination.",
"sort",
"=",
... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | ItemQuery._massageData | Convert a row into an Item instance by loading cached items or
creating new ones based on query results.
@param row: an n-tuple, where n is the number of columns specified by
my item type.
@return: an instance of the type specified by this query. | axiom/store.py | def _massageData(self, row):
"""
Convert a row into an Item instance by loading cached items or
creating new ones based on query results.
@param row: an n-tuple, where n is the number of columns specified by
my item type.
@return: an instance of the type specified by th... | def _massageData(self, row):
"""
Convert a row into an Item instance by loading cached items or
creating new ones based on query results.
@param row: an n-tuple, where n is the number of columns specified by
my item type.
@return: an instance of the type specified by th... | [
"Convert",
"a",
"row",
"into",
"an",
"Item",
"instance",
"by",
"loading",
"cached",
"items",
"or",
"creating",
"new",
"ones",
"based",
"on",
"query",
"results",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L574-L586 | [
"def",
"_massageData",
"(",
"self",
",",
"row",
")",
":",
"result",
"=",
"self",
".",
"store",
".",
"_loadedItem",
"(",
"self",
".",
"tableClass",
",",
"row",
"[",
"0",
"]",
",",
"row",
"[",
"1",
":",
"]",
")",
"assert",
"result",
".",
"store",
"... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | ItemQuery.getColumn | Get an L{iaxiom.IQuery} whose results will be values of a single
attribute rather than an Item.
@param attributeName: a L{str}, the name of a Python attribute, that
describes a column on the Item subclass that this query was specified
for.
@return: an L{AttributeQuery} for the ... | axiom/store.py | def getColumn(self, attributeName, raw=False):
"""
Get an L{iaxiom.IQuery} whose results will be values of a single
attribute rather than an Item.
@param attributeName: a L{str}, the name of a Python attribute, that
describes a column on the Item subclass that this query was spe... | def getColumn(self, attributeName, raw=False):
"""
Get an L{iaxiom.IQuery} whose results will be values of a single
attribute rather than an Item.
@param attributeName: a L{str}, the name of a Python attribute, that
describes a column on the Item subclass that this query was spe... | [
"Get",
"an",
"L",
"{",
"iaxiom",
".",
"IQuery",
"}",
"whose",
"results",
"will",
"be",
"values",
"of",
"a",
"single",
"attribute",
"rather",
"than",
"an",
"Item",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L589-L616 | [
"def",
"getColumn",
"(",
"self",
",",
"attributeName",
",",
"raw",
"=",
"False",
")",
":",
"# XXX: 'raw' is undocumented because I think it's completely unused,",
"# and it's definitely untested. It should probably be removed when",
"# someone has the time. -glyph",
"# Quotient POP3 s... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | ItemQuery.deleteFromStore | Delete all the Items which are found by this query. | axiom/store.py | def deleteFromStore(self):
"""
Delete all the Items which are found by this query.
"""
if (self.limit is None and
not isinstance(self.sort, attributes.UnspecifiedOrdering)):
# The ORDER BY is pointless here, and SQLite complains about it.
return self.c... | def deleteFromStore(self):
"""
Delete all the Items which are found by this query.
"""
if (self.limit is None and
not isinstance(self.sort, attributes.UnspecifiedOrdering)):
# The ORDER BY is pointless here, and SQLite complains about it.
return self.c... | [
"Delete",
"all",
"the",
"Items",
"which",
"are",
"found",
"by",
"this",
"query",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L628-L668 | [
"def",
"deleteFromStore",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"limit",
"is",
"None",
"and",
"not",
"isinstance",
"(",
"self",
".",
"sort",
",",
"attributes",
".",
"UnspecifiedOrdering",
")",
")",
":",
"# The ORDER BY is pointless here, and SQLite comp... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | MultipleItemQuery._involvedTables | Return a list of tables involved in this query,
first checking that no required tables (those in
the query target) have been omitted from the comparison. | axiom/store.py | def _involvedTables(self):
"""
Return a list of tables involved in this query,
first checking that no required tables (those in
the query target) have been omitted from the comparison.
"""
# SQL and arguments
if self.comparison is not None:
tables = se... | def _involvedTables(self):
"""
Return a list of tables involved in this query,
first checking that no required tables (those in
the query target) have been omitted from the comparison.
"""
# SQL and arguments
if self.comparison is not None:
tables = se... | [
"Return",
"a",
"list",
"of",
"tables",
"involved",
"in",
"this",
"query",
"first",
"checking",
"that",
"no",
"required",
"tables",
"(",
"those",
"in",
"the",
"query",
"target",
")",
"have",
"been",
"omitted",
"from",
"the",
"comparison",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L711-L731 | [
"def",
"_involvedTables",
"(",
"self",
")",
":",
"# SQL and arguments",
"if",
"self",
".",
"comparison",
"is",
"not",
"None",
":",
"tables",
"=",
"self",
".",
"comparison",
".",
"getInvolvedTables",
"(",
")",
"self",
".",
"args",
"=",
"self",
".",
"compari... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | MultipleItemQuery._massageData | Convert a row into a tuple of Item instances, by slicing it
according to the number of columns for each instance, and then
proceeding as for ItemQuery._massageData.
@param row: an n-tuple, where n is the total number of columns
specified by all the item types in this query.
@re... | axiom/store.py | def _massageData(self, row):
"""
Convert a row into a tuple of Item instances, by slicing it
according to the number of columns for each instance, and then
proceeding as for ItemQuery._massageData.
@param row: an n-tuple, where n is the total number of columns
specified... | def _massageData(self, row):
"""
Convert a row into a tuple of Item instances, by slicing it
according to the number of columns for each instance, and then
proceeding as for ItemQuery._massageData.
@param row: an n-tuple, where n is the total number of columns
specified... | [
"Convert",
"a",
"row",
"into",
"a",
"tuple",
"of",
"Item",
"instances",
"by",
"slicing",
"it",
"according",
"to",
"the",
"number",
"of",
"columns",
"for",
"each",
"instance",
"and",
"then",
"proceeding",
"as",
"for",
"ItemQuery",
".",
"_massageData",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L733-L759 | [
"def",
"_massageData",
"(",
"self",
",",
"row",
")",
":",
"offset",
"=",
"0",
"resultBits",
"=",
"[",
"]",
"for",
"i",
",",
"tableClass",
"in",
"enumerate",
"(",
"self",
".",
"tableClass",
")",
":",
"numAttrs",
"=",
"self",
".",
"schemaLengths",
"[",
... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | _DistinctQuery.cloneQuery | Clone the original query which this distinct query wraps, and return a new
wrapper around that clone. | axiom/store.py | def cloneQuery(self, limit=_noItem, sort=_noItem):
"""
Clone the original query which this distinct query wraps, and return a new
wrapper around that clone.
"""
newq = self.query.cloneQuery(limit=limit, sort=sort)
return self.__class__(newq) | def cloneQuery(self, limit=_noItem, sort=_noItem):
"""
Clone the original query which this distinct query wraps, and return a new
wrapper around that clone.
"""
newq = self.query.cloneQuery(limit=limit, sort=sort)
return self.__class__(newq) | [
"Clone",
"the",
"original",
"query",
"which",
"this",
"distinct",
"query",
"wraps",
"and",
"return",
"a",
"new",
"wrapper",
"around",
"that",
"clone",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L805-L811 | [
"def",
"cloneQuery",
"(",
"self",
",",
"limit",
"=",
"_noItem",
",",
"sort",
"=",
"_noItem",
")",
":",
"newq",
"=",
"self",
".",
"query",
".",
"cloneQuery",
"(",
"limit",
"=",
"limit",
",",
"sort",
"=",
"sort",
")",
"return",
"self",
".",
"__class__"... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | _MultipleItemDistinctQuery.count | Count the number of distinct results of the wrapped query.
@return: an L{int} representing the number of distinct results. | axiom/store.py | def count(self):
"""
Count the number of distinct results of the wrapped query.
@return: an L{int} representing the number of distinct results.
"""
if not self.query.store.autocommit:
self.query.store.checkpoint()
target = ', '.join([
tableClass.s... | def count(self):
"""
Count the number of distinct results of the wrapped query.
@return: an L{int} representing the number of distinct results.
"""
if not self.query.store.autocommit:
self.query.store.checkpoint()
target = ', '.join([
tableClass.s... | [
"Count",
"the",
"number",
"of",
"distinct",
"results",
"of",
"the",
"wrapped",
"query",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L846-L863 | [
"def",
"count",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"query",
".",
"store",
".",
"autocommit",
":",
"self",
".",
"query",
".",
"store",
".",
"checkpoint",
"(",
")",
"target",
"=",
"', '",
".",
"join",
"(",
"[",
"tableClass",
".",
"store... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | AttributeQuery._massageData | Convert a raw database row to the type described by an attribute. For
example, convert a database integer into an L{extime.Time} instance for
an L{attributes.timestamp} attribute.
@param row: a 1-tuple, containing the in-database value from my
attribute.
@return: a value of th... | axiom/store.py | def _massageData(self, row):
"""
Convert a raw database row to the type described by an attribute. For
example, convert a database integer into an L{extime.Time} instance for
an L{attributes.timestamp} attribute.
@param row: a 1-tuple, containing the in-database value from my
... | def _massageData(self, row):
"""
Convert a raw database row to the type described by an attribute. For
example, convert a database integer into an L{extime.Time} instance for
an L{attributes.timestamp} attribute.
@param row: a 1-tuple, containing the in-database value from my
... | [
"Convert",
"a",
"raw",
"database",
"row",
"to",
"the",
"type",
"described",
"by",
"an",
"attribute",
".",
"For",
"example",
"convert",
"a",
"database",
"integer",
"into",
"an",
"L",
"{",
"extime",
".",
"Time",
"}",
"instance",
"for",
"an",
"L",
"{",
"a... | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L892-L905 | [
"def",
"_massageData",
"(",
"self",
",",
"row",
")",
":",
"if",
"self",
".",
"raw",
":",
"return",
"row",
"[",
"0",
"]",
"return",
"self",
".",
"attribute",
".",
"outfilter",
"(",
"row",
"[",
"0",
"]",
",",
"_FakeItemForFilter",
"(",
"self",
".",
"... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | AttributeQuery.sum | Return the sum of all the values returned by this query. If no results
are specified, return None.
Note: for non-numeric column types the result of this method will be
nonsensical.
@return: a number or None. | axiom/store.py | def sum(self):
"""
Return the sum of all the values returned by this query. If no results
are specified, return None.
Note: for non-numeric column types the result of this method will be
nonsensical.
@return: a number or None.
"""
res = self._runQuery('... | def sum(self):
"""
Return the sum of all the values returned by this query. If no results
are specified, return None.
Note: for non-numeric column types the result of this method will be
nonsensical.
@return: a number or None.
"""
res = self._runQuery('... | [
"Return",
"the",
"sum",
"of",
"all",
"the",
"values",
"returned",
"by",
"this",
"query",
".",
"If",
"no",
"results",
"are",
"specified",
"return",
"None",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L918-L931 | [
"def",
"sum",
"(",
"self",
")",
":",
"res",
"=",
"self",
".",
"_runQuery",
"(",
"'SELECT'",
",",
"'SUM(%s)'",
"%",
"(",
"self",
".",
"_queryTarget",
",",
")",
")",
"or",
"[",
"(",
"0",
",",
")",
"]",
"assert",
"len",
"(",
"res",
")",
"==",
"1",... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | AttributeQuery.average | Return the average value (as defined by the AVG implementation in the
database) of the values specified by this query.
Note: for non-numeric column types the result of this method will be
nonsensical.
@return: a L{float} representing the 'average' value of this column. | axiom/store.py | def average(self):
"""
Return the average value (as defined by the AVG implementation in the
database) of the values specified by this query.
Note: for non-numeric column types the result of this method will be
nonsensical.
@return: a L{float} representing the 'average'... | def average(self):
"""
Return the average value (as defined by the AVG implementation in the
database) of the values specified by this query.
Note: for non-numeric column types the result of this method will be
nonsensical.
@return: a L{float} representing the 'average'... | [
"Return",
"the",
"average",
"value",
"(",
"as",
"defined",
"by",
"the",
"AVG",
"implementation",
"in",
"the",
"database",
")",
"of",
"the",
"values",
"specified",
"by",
"this",
"query",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L934-L946 | [
"def",
"average",
"(",
"self",
")",
":",
"rslt",
"=",
"self",
".",
"_runQuery",
"(",
"'SELECT'",
",",
"'AVG(%s)'",
"%",
"(",
"self",
".",
"_queryTarget",
",",
")",
")",
"or",
"[",
"(",
"0",
",",
")",
"]",
"assert",
"len",
"(",
"rslt",
")",
"==",
... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | Store._attachChild | attach a child database, returning an identifier for it | axiom/store.py | def _attachChild(self, child):
"attach a child database, returning an identifier for it"
self._childCounter += 1
databaseName = 'child_db_%d' % (self._childCounter,)
self._attachedChildren[databaseName] = child
# ATTACH DATABASE statements can't use bind paramaters, blech.
... | def _attachChild(self, child):
"attach a child database, returning an identifier for it"
self._childCounter += 1
databaseName = 'child_db_%d' % (self._childCounter,)
self._attachedChildren[databaseName] = child
# ATTACH DATABASE statements can't use bind paramaters, blech.
... | [
"attach",
"a",
"child",
"database",
"returning",
"an",
"identifier",
"for",
"it"
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L1266-L1275 | [
"def",
"_attachChild",
"(",
"self",
",",
"child",
")",
":",
"self",
".",
"_childCounter",
"+=",
"1",
"databaseName",
"=",
"'child_db_%d'",
"%",
"(",
"self",
".",
"_childCounter",
",",
")",
"self",
".",
"_attachedChildren",
"[",
"databaseName",
"]",
"=",
"c... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | Store._startup | Called during __init__. Check consistency of schema in database with
classes in memory. Load all Python modules for stored items, and load
version information for upgrader service to run later. | axiom/store.py | def _startup(self):
"""
Called during __init__. Check consistency of schema in database with
classes in memory. Load all Python modules for stored items, and load
version information for upgrader service to run later.
"""
typesToCheck = []
for oid, module, type... | def _startup(self):
"""
Called during __init__. Check consistency of schema in database with
classes in memory. Load all Python modules for stored items, and load
version information for upgrader service to run later.
"""
typesToCheck = []
for oid, module, type... | [
"Called",
"during",
"__init__",
".",
"Check",
"consistency",
"of",
"schema",
"in",
"database",
"with",
"classes",
"in",
"memory",
".",
"Load",
"all",
"Python",
"modules",
"for",
"stored",
"items",
"and",
"load",
"version",
"information",
"for",
"upgrader",
"se... | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L1302-L1347 | [
"def",
"_startup",
"(",
"self",
")",
":",
"typesToCheck",
"=",
"[",
"]",
"for",
"oid",
",",
"module",
",",
"typename",
",",
"version",
"in",
"self",
".",
"querySchemaSQL",
"(",
"_schema",
".",
"ALL_TYPES",
")",
":",
"if",
"self",
".",
"debug",
":",
"... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | Store.findOrCreate | Usage::
s.findOrCreate(userItemClass [, function] [, x=1, y=2, ...])
Example::
class YourItemType(Item):
a = integer()
b = text()
c = integer()
def f(x):
print x, \"-- it's new!\"
s.findOrCreate(Y... | axiom/store.py | def findOrCreate(self, userItemClass, __ifnew=None, **attrs):
"""
Usage::
s.findOrCreate(userItemClass [, function] [, x=1, y=2, ...])
Example::
class YourItemType(Item):
a = integer()
b = text()
c = integer()
... | def findOrCreate(self, userItemClass, __ifnew=None, **attrs):
"""
Usage::
s.findOrCreate(userItemClass [, function] [, x=1, y=2, ...])
Example::
class YourItemType(Item):
a = integer()
b = text()
c = integer()
... | [
"Usage",
"::"
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L1386-L1425 | [
"def",
"findOrCreate",
"(",
"self",
",",
"userItemClass",
",",
"__ifnew",
"=",
"None",
",",
"*",
"*",
"attrs",
")",
":",
"andargs",
"=",
"[",
"]",
"for",
"k",
",",
"v",
"in",
"attrs",
".",
"iteritems",
"(",
")",
":",
"col",
"=",
"getattr",
"(",
"... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | Store.newFile | Open a new file somewhere in this Store's file area.
@param path: a sequence of path segments.
@return: an L{AtomicFile}. | axiom/store.py | def newFile(self, *path):
"""
Open a new file somewhere in this Store's file area.
@param path: a sequence of path segments.
@return: an L{AtomicFile}.
"""
assert len(path) > 0, "newFile requires a nonzero number of segments"
if self.dbdir is None:
i... | def newFile(self, *path):
"""
Open a new file somewhere in this Store's file area.
@param path: a sequence of path segments.
@return: an L{AtomicFile}.
"""
assert len(path) > 0, "newFile requires a nonzero number of segments"
if self.dbdir is None:
i... | [
"Open",
"a",
"new",
"file",
"somewhere",
"in",
"this",
"Store",
"s",
"file",
"area",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L1439-L1456 | [
"def",
"newFile",
"(",
"self",
",",
"*",
"path",
")",
":",
"assert",
"len",
"(",
"path",
")",
">",
"0",
",",
"\"newFile requires a nonzero number of segments\"",
"if",
"self",
".",
"dbdir",
"is",
"None",
":",
"if",
"self",
".",
"filesdir",
"is",
"None",
... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | Store._loadTypeSchema | Load all of the stored schema information for all types known by this
store. It's important to load everything all at once (rather than
loading the schema for each type separately as it is needed) to keep
store opening fast. A single query with many results is much faster
than many que... | axiom/store.py | def _loadTypeSchema(self):
"""
Load all of the stored schema information for all types known by this
store. It's important to load everything all at once (rather than
loading the schema for each type separately as it is needed) to keep
store opening fast. A single query with ma... | def _loadTypeSchema(self):
"""
Load all of the stored schema information for all types known by this
store. It's important to load everything all at once (rather than
loading the schema for each type separately as it is needed) to keep
store opening fast. A single query with ma... | [
"Load",
"all",
"of",
"the",
"stored",
"schema",
"information",
"for",
"all",
"types",
"known",
"by",
"this",
"store",
".",
"It",
"s",
"important",
"to",
"load",
"everything",
"all",
"at",
"once",
"(",
"rather",
"than",
"loading",
"the",
"schema",
"for",
... | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L1465-L1516 | [
"def",
"_loadTypeSchema",
"(",
"self",
")",
":",
"# Oops, need an index going the other way. This only happens once per",
"# store open, and it's based on data queried from the store, so there",
"# doesn't seem to be any broader way to cache and re-use the result.",
"# However, if we keyed the re... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | Store._checkTypeSchemaConsistency | Called for all known types at database startup: make sure that what we
know (in memory) about this type agrees with what is stored about this
type in the database.
@param actualType: A L{MetaItem} instance which is associated with a
table in this store. The schema it defines in mem... | axiom/store.py | def _checkTypeSchemaConsistency(self, actualType, onDiskSchema):
"""
Called for all known types at database startup: make sure that what we
know (in memory) about this type agrees with what is stored about this
type in the database.
@param actualType: A L{MetaItem} instance whic... | def _checkTypeSchemaConsistency(self, actualType, onDiskSchema):
"""
Called for all known types at database startup: make sure that what we
know (in memory) about this type agrees with what is stored about this
type in the database.
@param actualType: A L{MetaItem} instance whic... | [
"Called",
"for",
"all",
"known",
"types",
"at",
"database",
"startup",
":",
"make",
"sure",
"that",
"what",
"we",
"know",
"(",
"in",
"memory",
")",
"about",
"this",
"type",
"agrees",
"with",
"what",
"is",
"stored",
"about",
"this",
"type",
"in",
"the",
... | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L1519-L1564 | [
"def",
"_checkTypeSchemaConsistency",
"(",
"self",
",",
"actualType",
",",
"onDiskSchema",
")",
":",
"# make sure that both the runtime and the database both know about this",
"# type; if they don't both know, we can't check that their views are",
"# consistent",
"try",
":",
"inMemoryS... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | Store._prepareOldVersionOf | Note that this database contains old versions of a particular type.
Create the appropriate dummy item subclass and queue the type to be
upgraded.
@param typename: The I{typeName} associated with the schema for which
to create a dummy item class.
@param version: The I{schema... | axiom/store.py | def _prepareOldVersionOf(self, typename, version, persistedSchema):
"""
Note that this database contains old versions of a particular type.
Create the appropriate dummy item subclass and queue the type to be
upgraded.
@param typename: The I{typeName} associated with the schema f... | def _prepareOldVersionOf(self, typename, version, persistedSchema):
"""
Note that this database contains old versions of a particular type.
Create the appropriate dummy item subclass and queue the type to be
upgraded.
@param typename: The I{typeName} associated with the schema f... | [
"Note",
"that",
"this",
"database",
"contains",
"old",
"versions",
"of",
"a",
"particular",
"type",
".",
"Create",
"the",
"appropriate",
"dummy",
"item",
"subclass",
"and",
"queue",
"the",
"type",
"to",
"be",
"upgraded",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L1568-L1595 | [
"def",
"_prepareOldVersionOf",
"(",
"self",
",",
"typename",
",",
"version",
",",
"persistedSchema",
")",
":",
"appropriateSchema",
"=",
"persistedSchema",
"[",
"typename",
",",
"version",
"]",
"# create actual attribute objects",
"dummyAttributes",
"=",
"{",
"}",
"... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | Store.findUnique | Find an Item in the database which should be unique. If it is found,
return it. If it is not found, return 'default' if it was passed,
otherwise raise L{errors.ItemNotFound}. If more than one item is
found, raise L{errors.DuplicateUniqueItem}.
@param comparison: implementor of L{iaxi... | axiom/store.py | def findUnique(self, tableClass, comparison=None, default=_noItem):
"""
Find an Item in the database which should be unique. If it is found,
return it. If it is not found, return 'default' if it was passed,
otherwise raise L{errors.ItemNotFound}. If more than one item is
found... | def findUnique(self, tableClass, comparison=None, default=_noItem):
"""
Find an Item in the database which should be unique. If it is found,
return it. If it is not found, return 'default' if it was passed,
otherwise raise L{errors.ItemNotFound}. If more than one item is
found... | [
"Find",
"an",
"Item",
"in",
"the",
"database",
"which",
"should",
"be",
"unique",
".",
"If",
"it",
"is",
"found",
"return",
"it",
".",
"If",
"it",
"is",
"not",
"found",
"return",
"default",
"if",
"it",
"was",
"passed",
"otherwise",
"raise",
"L",
"{",
... | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L1615-L1640 | [
"def",
"findUnique",
"(",
"self",
",",
"tableClass",
",",
"comparison",
"=",
"None",
",",
"default",
"=",
"_noItem",
")",
":",
"results",
"=",
"list",
"(",
"self",
".",
"query",
"(",
"tableClass",
",",
"comparison",
",",
"limit",
"=",
"2",
")",
")",
... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | Store.findFirst | Usage::
s.findFirst(tableClass [, query arguments except 'limit'])
Example::
class YourItemType(Item):
a = integer()
b = text()
c = integer()
...
it = s.findFirst(YourItemType,
AND(You... | axiom/store.py | def findFirst(self, tableClass, comparison=None,
offset=None, sort=None, default=None):
"""
Usage::
s.findFirst(tableClass [, query arguments except 'limit'])
Example::
class YourItemType(Item):
a = integer()
b = text()... | def findFirst(self, tableClass, comparison=None,
offset=None, sort=None, default=None):
"""
Usage::
s.findFirst(tableClass [, query arguments except 'limit'])
Example::
class YourItemType(Item):
a = integer()
b = text()... | [
"Usage",
"::"
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L1643-L1670 | [
"def",
"findFirst",
"(",
"self",
",",
"tableClass",
",",
"comparison",
"=",
"None",
",",
"offset",
"=",
"None",
",",
"sort",
"=",
"None",
",",
"default",
"=",
"None",
")",
":",
"limit",
"=",
"1",
"for",
"item",
"in",
"self",
".",
"query",
"(",
"tab... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | Store.query | Return a generator of instances of C{tableClass},
or tuples of instances if C{tableClass} is a
tuple of classes.
Examples::
fastCars = s.query(Vehicle,
axiom.attributes.AND(
Vehicle.wheels == 4,
Vehicle.maxKPH > 200),
... | axiom/store.py | def query(self, tableClass, comparison=None,
limit=None, offset=None, sort=None):
"""
Return a generator of instances of C{tableClass},
or tuples of instances if C{tableClass} is a
tuple of classes.
Examples::
fastCars = s.query(Vehicle,
... | def query(self, tableClass, comparison=None,
limit=None, offset=None, sort=None):
"""
Return a generator of instances of C{tableClass},
or tuples of instances if C{tableClass} is a
tuple of classes.
Examples::
fastCars = s.query(Vehicle,
... | [
"Return",
"a",
"generator",
"of",
"instances",
"of",
"C",
"{",
"tableClass",
"}",
"or",
"tuples",
"of",
"instances",
"if",
"C",
"{",
"tableClass",
"}",
"is",
"a",
"tuple",
"of",
"classes",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L1672-L1722 | [
"def",
"query",
"(",
"self",
",",
"tableClass",
",",
"comparison",
"=",
"None",
",",
"limit",
"=",
"None",
",",
"offset",
"=",
"None",
",",
"sort",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"tableClass",
",",
"tuple",
")",
":",
"queryClass",
"=... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | Store.batchInsert | Create multiple items in the store without loading
corresponding Python objects into memory.
the items' C{stored} callback will not be called.
Example::
myData = [(37, u"Fred", u"Wichita"),
(28, u"Jim", u"Fresno"),
(43, u"Betty", u"Du... | axiom/store.py | def batchInsert(self, itemType, itemAttributes, dataRows):
"""
Create multiple items in the store without loading
corresponding Python objects into memory.
the items' C{stored} callback will not be called.
Example::
myData = [(37, u"Fred", u"Wichita"),
... | def batchInsert(self, itemType, itemAttributes, dataRows):
"""
Create multiple items in the store without loading
corresponding Python objects into memory.
the items' C{stored} callback will not be called.
Example::
myData = [(37, u"Fred", u"Wichita"),
... | [
"Create",
"multiple",
"items",
"in",
"the",
"store",
"without",
"loading",
"corresponding",
"Python",
"objects",
"into",
"memory",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L1731-L1779 | [
"def",
"batchInsert",
"(",
"self",
",",
"itemType",
",",
"itemAttributes",
",",
"dataRows",
")",
":",
"class",
"FakeItem",
":",
"pass",
"_NEEDS_DEFAULT",
"=",
"object",
"(",
")",
"# token for lookup failure",
"fakeOSelf",
"=",
"FakeItem",
"(",
")",
"fakeOSelf",
... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | Store.changed | An item in this store was changed. Add it to the current transaction's
list of changed items, if a transaction is currently underway, or raise
an exception if this L{Store} is currently in a state which does not
allow changes. | axiom/store.py | def changed(self, item):
"""
An item in this store was changed. Add it to the current transaction's
list of changed items, if a transaction is currently underway, or raise
an exception if this L{Store} is currently in a state which does not
allow changes.
"""
if ... | def changed(self, item):
"""
An item in this store was changed. Add it to the current transaction's
list of changed items, if a transaction is currently underway, or raise
an exception if this L{Store} is currently in a state which does not
allow changes.
"""
if ... | [
"An",
"item",
"in",
"this",
"store",
"was",
"changed",
".",
"Add",
"it",
"to",
"the",
"current",
"transaction",
"s",
"list",
"of",
"changed",
"items",
"if",
"a",
"transaction",
"is",
"currently",
"underway",
"or",
"raise",
"an",
"exception",
"if",
"this",
... | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L1792-L1803 | [
"def",
"changed",
"(",
"self",
",",
"item",
")",
":",
"if",
"self",
".",
"_rejectChanges",
":",
"raise",
"errors",
".",
"ChangeRejected",
"(",
")",
"if",
"self",
".",
"transaction",
"is",
"not",
"None",
":",
"self",
".",
"transaction",
".",
"add",
"(",... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | Store.transact | Execute C{f(*a, **k)} in the context of a database transaction.
Any changes made to this L{Store} by C{f} will be committed when C{f}
returns. If C{f} raises an exception, those changes will be reverted
instead.
If a transaction is already in progress (in this thread - ie, if a
... | axiom/store.py | def transact(self, f, *a, **k):
"""
Execute C{f(*a, **k)} in the context of a database transaction.
Any changes made to this L{Store} by C{f} will be committed when C{f}
returns. If C{f} raises an exception, those changes will be reverted
instead.
If a transaction is a... | def transact(self, f, *a, **k):
"""
Execute C{f(*a, **k)} in the context of a database transaction.
Any changes made to this L{Store} by C{f} will be committed when C{f}
returns. If C{f} raises an exception, those changes will be reverted
instead.
If a transaction is a... | [
"Execute",
"C",
"{",
"f",
"(",
"*",
"a",
"**",
"k",
")",
"}",
"in",
"the",
"context",
"of",
"a",
"database",
"transaction",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L1821-L1860 | [
"def",
"transact",
"(",
"self",
",",
"f",
",",
"*",
"a",
",",
"*",
"*",
"k",
")",
":",
"if",
"self",
".",
"transaction",
"is",
"not",
"None",
":",
"return",
"f",
"(",
"*",
"a",
",",
"*",
"*",
"k",
")",
"if",
"self",
".",
"attachedToParent",
"... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | Store._indexNameOf | Return the unqualified (ie, no database name) name of the given
attribute of the given table.
@type tableClass: L{MetaItem}
@param tableClass: The Python class associated with a table in the
database.
@param attrname: A sequence of the names of the columns of the
... | axiom/store.py | def _indexNameOf(self, tableClass, attrname):
"""
Return the unqualified (ie, no database name) name of the given
attribute of the given table.
@type tableClass: L{MetaItem}
@param tableClass: The Python class associated with a table in the
database.
@param ... | def _indexNameOf(self, tableClass, attrname):
"""
Return the unqualified (ie, no database name) name of the given
attribute of the given table.
@type tableClass: L{MetaItem}
@param tableClass: The Python class associated with a table in the
database.
@param ... | [
"Return",
"the",
"unqualified",
"(",
"ie",
"no",
"database",
"name",
")",
"name",
"of",
"the",
"given",
"attribute",
"of",
"the",
"given",
"table",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L1972-L1989 | [
"def",
"_indexNameOf",
"(",
"self",
",",
"tableClass",
",",
"attrname",
")",
":",
"return",
"\"axiomidx_%s_v%d_%s\"",
"%",
"(",
"tableClass",
".",
"typeName",
",",
"tableClass",
".",
"schemaVersion",
",",
"'_'",
".",
"join",
"(",
"attrname",
")",
")"
] | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | Store.getTableName | Retrieve the fully qualified name of the table holding items
of a particular class in this store. If the table does not
exist in the database, it will be created as a side-effect.
@param tableClass: an Item subclass
@raises axiom.errors.ItemClassesOnly: if an object other than a
... | axiom/store.py | def getTableName(self, tableClass):
"""
Retrieve the fully qualified name of the table holding items
of a particular class in this store. If the table does not
exist in the database, it will be created as a side-effect.
@param tableClass: an Item subclass
@raises axiom... | def getTableName(self, tableClass):
"""
Retrieve the fully qualified name of the table holding items
of a particular class in this store. If the table does not
exist in the database, it will be created as a side-effect.
@param tableClass: an Item subclass
@raises axiom... | [
"Retrieve",
"the",
"fully",
"qualified",
"name",
"of",
"the",
"table",
"holding",
"items",
"of",
"a",
"particular",
"class",
"in",
"this",
"store",
".",
"If",
"the",
"table",
"does",
"not",
"exist",
"in",
"the",
"database",
"it",
"will",
"be",
"created",
... | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L2001-L2021 | [
"def",
"getTableName",
"(",
"self",
",",
"tableClass",
")",
":",
"if",
"not",
"(",
"isinstance",
"(",
"tableClass",
",",
"type",
")",
"and",
"issubclass",
"(",
"tableClass",
",",
"item",
".",
"Item",
")",
")",
":",
"raise",
"errors",
".",
"ItemClassesOnl... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | Store.getColumnName | Retreive the fully qualified column name for a particular
attribute in this store. The attribute must be bound to an
Item subclass (its type must be valid). If the underlying
table does not exist in the database, it will be created as a
side-effect.
@param tableClass: an Item s... | axiom/store.py | def getColumnName(self, attribute):
"""
Retreive the fully qualified column name for a particular
attribute in this store. The attribute must be bound to an
Item subclass (its type must be valid). If the underlying
table does not exist in the database, it will be created as a
... | def getColumnName(self, attribute):
"""
Retreive the fully qualified column name for a particular
attribute in this store. The attribute must be bound to an
Item subclass (its type must be valid). If the underlying
table does not exist in the database, it will be created as a
... | [
"Retreive",
"the",
"fully",
"qualified",
"column",
"name",
"for",
"a",
"particular",
"attribute",
"in",
"this",
"store",
".",
"The",
"attribute",
"must",
"be",
"bound",
"to",
"an",
"Item",
"subclass",
"(",
"its",
"type",
"must",
"be",
"valid",
")",
".",
... | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L2047-L2063 | [
"def",
"getColumnName",
"(",
"self",
",",
"attribute",
")",
":",
"if",
"attribute",
"not",
"in",
"self",
".",
"attrToColumnNameCache",
":",
"self",
".",
"attrToColumnNameCache",
"[",
"attribute",
"]",
"=",
"'.'",
".",
"join",
"(",
"(",
"self",
".",
"getTab... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | Store.getTypeID | Retrieve the typeID associated with a particular table in the
in-database schema for this Store. A typeID is an opaque integer
representing the Item subclass, and the associated table in this
Store's SQLite database.
@param tableClass: a subclass of Item
@return: an integer | axiom/store.py | def getTypeID(self, tableClass):
"""
Retrieve the typeID associated with a particular table in the
in-database schema for this Store. A typeID is an opaque integer
representing the Item subclass, and the associated table in this
Store's SQLite database.
@param tableClas... | def getTypeID(self, tableClass):
"""
Retrieve the typeID associated with a particular table in the
in-database schema for this Store. A typeID is an opaque integer
representing the Item subclass, and the associated table in this
Store's SQLite database.
@param tableClas... | [
"Retrieve",
"the",
"typeID",
"associated",
"with",
"a",
"particular",
"table",
"in",
"the",
"in",
"-",
"database",
"schema",
"for",
"this",
"Store",
".",
"A",
"typeID",
"is",
"an",
"opaque",
"integer",
"representing",
"the",
"Item",
"subclass",
"and",
"the",... | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L2066-L2081 | [
"def",
"getTypeID",
"(",
"self",
",",
"tableClass",
")",
":",
"key",
"=",
"(",
"tableClass",
".",
"typeName",
",",
"tableClass",
".",
"schemaVersion",
")",
"if",
"key",
"in",
"self",
".",
"typenameAndVersionToID",
":",
"return",
"self",
".",
"typenameAndVers... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | Store._justCreateTable | Execute the table creation DDL for an Item subclass.
Indexes are *not* created.
@type tableClass: type
@param tableClass: an Item subclass | axiom/store.py | def _justCreateTable(self, tableClass):
"""
Execute the table creation DDL for an Item subclass.
Indexes are *not* created.
@type tableClass: type
@param tableClass: an Item subclass
"""
sqlstr = []
sqlarg = []
# needs to be calculated including... | def _justCreateTable(self, tableClass):
"""
Execute the table creation DDL for an Item subclass.
Indexes are *not* created.
@type tableClass: type
@param tableClass: an Item subclass
"""
sqlstr = []
sqlarg = []
# needs to be calculated including... | [
"Execute",
"the",
"table",
"creation",
"DDL",
"for",
"an",
"Item",
"subclass",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L2084-L2111 | [
"def",
"_justCreateTable",
"(",
"self",
",",
"tableClass",
")",
":",
"sqlstr",
"=",
"[",
"]",
"sqlarg",
"=",
"[",
"]",
"# needs to be calculated including version",
"tableName",
"=",
"self",
".",
"_tableNameFor",
"(",
"tableClass",
".",
"typeName",
",",
"tableCl... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | Store._maybeCreateTable | A type ID has been requested for an Item subclass whose table was not
present when this Store was opened. Attempt to create the table, and
if that fails because another Store object (perhaps in another process)
has created the table, re-read the schema. When that's done, return
the typ... | axiom/store.py | def _maybeCreateTable(self, tableClass, key):
"""
A type ID has been requested for an Item subclass whose table was not
present when this Store was opened. Attempt to create the table, and
if that fails because another Store object (perhaps in another process)
has created the ta... | def _maybeCreateTable(self, tableClass, key):
"""
A type ID has been requested for an Item subclass whose table was not
present when this Store was opened. Attempt to create the table, and
if that fails because another Store object (perhaps in another process)
has created the ta... | [
"A",
"type",
"ID",
"has",
"been",
"requested",
"for",
"an",
"Item",
"subclass",
"whose",
"table",
"was",
"not",
"present",
"when",
"this",
"Store",
"was",
"opened",
".",
"Attempt",
"to",
"create",
"the",
"table",
"and",
"if",
"that",
"fails",
"because",
... | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L2114-L2176 | [
"def",
"_maybeCreateTable",
"(",
"self",
",",
"tableClass",
",",
"key",
")",
":",
"try",
":",
"self",
".",
"_justCreateTable",
"(",
"tableClass",
")",
"except",
"errors",
".",
"TableAlreadyExists",
":",
"# Although we don't have a memory of this table from the last time... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | Store._createIndexesFor | Create any indexes which don't exist and are required by the schema
defined by C{tableClass}.
@param tableClass: A L{MetaItem} instance which may define a schema
which includes indexes.
@param extantIndexes: A container (anything which can be the right-hand
argument to ... | axiom/store.py | def _createIndexesFor(self, tableClass, extantIndexes):
"""
Create any indexes which don't exist and are required by the schema
defined by C{tableClass}.
@param tableClass: A L{MetaItem} instance which may define a schema
which includes indexes.
@param extantIndexes... | def _createIndexesFor(self, tableClass, extantIndexes):
"""
Create any indexes which don't exist and are required by the schema
defined by C{tableClass}.
@param tableClass: A L{MetaItem} instance which may define a schema
which includes indexes.
@param extantIndexes... | [
"Create",
"any",
"indexes",
"which",
"don",
"t",
"exist",
"and",
"are",
"required",
"by",
"the",
"schema",
"defined",
"by",
"C",
"{",
"tableClass",
"}",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L2179-L2217 | [
"def",
"_createIndexesFor",
"(",
"self",
",",
"tableClass",
",",
"extantIndexes",
")",
":",
"try",
":",
"indexes",
"=",
"_requiredTableIndexes",
"[",
"tableClass",
"]",
"except",
"KeyError",
":",
"indexes",
"=",
"set",
"(",
")",
"for",
"nam",
",",
"atr",
"... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | Store.getItemByID | Retrieve an item by its storeID, and return it.
Note: most of the failure modes of this method are catastrophic and
should not be handled by application code. The only one that
application programmers should be concerned with is KeyError. They are
listed for educational purposes.
... | axiom/store.py | def getItemByID(self, storeID, default=_noItem, autoUpgrade=True):
"""
Retrieve an item by its storeID, and return it.
Note: most of the failure modes of this method are catastrophic and
should not be handled by application code. The only one that
application programmers should... | def getItemByID(self, storeID, default=_noItem, autoUpgrade=True):
"""
Retrieve an item by its storeID, and return it.
Note: most of the failure modes of this method are catastrophic and
should not be handled by application code. The only one that
application programmers should... | [
"Retrieve",
"an",
"item",
"by",
"its",
"storeID",
"and",
"return",
"it",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L2220-L2325 | [
"def",
"getItemByID",
"(",
"self",
",",
"storeID",
",",
"default",
"=",
"_noItem",
",",
"autoUpgrade",
"=",
"True",
")",
":",
"if",
"not",
"isinstance",
"(",
"storeID",
",",
"(",
"int",
",",
"long",
")",
")",
":",
"raise",
"TypeError",
"(",
"\"storeID ... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | Store.querySQL | For use with SELECT (or SELECT-like PRAGMA) statements. | axiom/store.py | def querySQL(self, sql, args=()):
"""For use with SELECT (or SELECT-like PRAGMA) statements.
"""
if self.debug:
result = timeinto(self.queryTimes, self._queryandfetch, sql, args)
else:
result = self._queryandfetch(sql, args)
return result | def querySQL(self, sql, args=()):
"""For use with SELECT (or SELECT-like PRAGMA) statements.
"""
if self.debug:
result = timeinto(self.queryTimes, self._queryandfetch, sql, args)
else:
result = self._queryandfetch(sql, args)
return result | [
"For",
"use",
"with",
"SELECT",
"(",
"or",
"SELECT",
"-",
"like",
"PRAGMA",
")",
"statements",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L2333-L2340 | [
"def",
"querySQL",
"(",
"self",
",",
"sql",
",",
"args",
"=",
"(",
")",
")",
":",
"if",
"self",
".",
"debug",
":",
"result",
"=",
"timeinto",
"(",
"self",
".",
"queryTimes",
",",
"self",
".",
"_queryandfetch",
",",
"sql",
",",
"args",
")",
"else",
... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | Store.createSQL | For use with auto-committing statements such as CREATE TABLE or CREATE
INDEX. | axiom/store.py | def createSQL(self, sql, args=()):
"""
For use with auto-committing statements such as CREATE TABLE or CREATE
INDEX.
"""
before = time.time()
self._execSQL(sql, args)
after = time.time()
if after - before > 2.0:
log.msg('Extremely long CREATE: ... | def createSQL(self, sql, args=()):
"""
For use with auto-committing statements such as CREATE TABLE or CREATE
INDEX.
"""
before = time.time()
self._execSQL(sql, args)
after = time.time()
if after - before > 2.0:
log.msg('Extremely long CREATE: ... | [
"For",
"use",
"with",
"auto",
"-",
"committing",
"statements",
"such",
"as",
"CREATE",
"TABLE",
"or",
"CREATE",
"INDEX",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L2360-L2370 | [
"def",
"createSQL",
"(",
"self",
",",
"sql",
",",
"args",
"=",
"(",
")",
")",
":",
"before",
"=",
"time",
".",
"time",
"(",
")",
"self",
".",
"_execSQL",
"(",
"sql",
",",
"args",
")",
"after",
"=",
"time",
".",
"time",
"(",
")",
"if",
"after",
... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | Store.executeSQL | For use with UPDATE or INSERT statements. | axiom/store.py | def executeSQL(self, sql, args=()):
"""
For use with UPDATE or INSERT statements.
"""
sql = self._execSQL(sql, args)
result = self.cursor.lastRowID()
if self.executedThisTransaction is not None:
self.executedThisTransaction.append((result, sql, args))
... | def executeSQL(self, sql, args=()):
"""
For use with UPDATE or INSERT statements.
"""
sql = self._execSQL(sql, args)
result = self.cursor.lastRowID()
if self.executedThisTransaction is not None:
self.executedThisTransaction.append((result, sql, args))
... | [
"For",
"use",
"with",
"UPDATE",
"or",
"INSERT",
"statements",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/store.py#L2388-L2396 | [
"def",
"executeSQL",
"(",
"self",
",",
"sql",
",",
"args",
"=",
"(",
")",
")",
":",
"sql",
"=",
"self",
".",
"_execSQL",
"(",
"sql",
",",
"args",
")",
"result",
"=",
"self",
".",
"cursor",
".",
"lastRowID",
"(",
")",
"if",
"self",
".",
"executedT... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | updateVersion | given a filename to a file containing a __counter__ variable,
open it, read the count, add one, rewrite the file.
This:
__counter__=123
Becomes:
__counter__=124 | scripts/update_version.py | def updateVersion(fname):
"""
given a filename to a file containing a __counter__ variable,
open it, read the count, add one, rewrite the file.
This:
__counter__=123
Becomes:
__counter__=124
"""
fname=os.path.abspath(fname)
if not os.path.exists(fname):
print("c... | def updateVersion(fname):
"""
given a filename to a file containing a __counter__ variable,
open it, read the count, add one, rewrite the file.
This:
__counter__=123
Becomes:
__counter__=124
"""
fname=os.path.abspath(fname)
if not os.path.exists(fname):
print("c... | [
"given",
"a",
"filename",
"to",
"a",
"file",
"containing",
"a",
"__counter__",
"variable",
"open",
"it",
"read",
"the",
"count",
"add",
"one",
"rewrite",
"the",
"file",
"."
] | swharden/PyOriginTools | python | https://github.com/swharden/PyOriginTools/blob/536fb8e11234ffdc27e26b1800e0358179ca7d26/scripts/update_version.py#L4-L32 | [
"def",
"updateVersion",
"(",
"fname",
")",
":",
"fname",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"fname",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"fname",
")",
":",
"print",
"(",
"\"can not update version! file doesn't exist:\\n\"",
"... | 536fb8e11234ffdc27e26b1800e0358179ca7d26 |
train | upgradeParentHook1to2 | Add the scheduler attribute to the given L{_SubSchedulerParentHook}. | axiom/scheduler.py | def upgradeParentHook1to2(oldHook):
"""
Add the scheduler attribute to the given L{_SubSchedulerParentHook}.
"""
newHook = oldHook.upgradeVersion(
oldHook.typeName, 1, 2,
loginAccount=oldHook.loginAccount,
scheduledAt=oldHook.scheduledAt,
scheduler=oldHook.store.findFirst... | def upgradeParentHook1to2(oldHook):
"""
Add the scheduler attribute to the given L{_SubSchedulerParentHook}.
"""
newHook = oldHook.upgradeVersion(
oldHook.typeName, 1, 2,
loginAccount=oldHook.loginAccount,
scheduledAt=oldHook.scheduledAt,
scheduler=oldHook.store.findFirst... | [
"Add",
"the",
"scheduler",
"attribute",
"to",
"the",
"given",
"L",
"{",
"_SubSchedulerParentHook",
"}",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/scheduler.py#L484-L493 | [
"def",
"upgradeParentHook1to2",
"(",
"oldHook",
")",
":",
"newHook",
"=",
"oldHook",
".",
"upgradeVersion",
"(",
"oldHook",
".",
"typeName",
",",
"1",
",",
"2",
",",
"loginAccount",
"=",
"oldHook",
".",
"loginAccount",
",",
"scheduledAt",
"=",
"oldHook",
"."... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | upgradeParentHook3to4 | Copy C{loginAccount} to C{subStore} and remove the installation marker. | axiom/scheduler.py | def upgradeParentHook3to4(old):
"""
Copy C{loginAccount} to C{subStore} and remove the installation marker.
"""
new = old.upgradeVersion(
old.typeName, 3, 4, subStore=old.loginAccount)
uninstallFrom(new, new.store)
return new | def upgradeParentHook3to4(old):
"""
Copy C{loginAccount} to C{subStore} and remove the installation marker.
"""
new = old.upgradeVersion(
old.typeName, 3, 4, subStore=old.loginAccount)
uninstallFrom(new, new.store)
return new | [
"Copy",
"C",
"{",
"loginAccount",
"}",
"to",
"C",
"{",
"subStore",
"}",
"and",
"remove",
"the",
"installation",
"marker",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/scheduler.py#L518-L525 | [
"def",
"upgradeParentHook3to4",
"(",
"old",
")",
":",
"new",
"=",
"old",
".",
"upgradeVersion",
"(",
"old",
".",
"typeName",
",",
"3",
",",
"4",
",",
"subStore",
"=",
"old",
".",
"loginAccount",
")",
"uninstallFrom",
"(",
"new",
",",
"new",
".",
"store... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | TimedEvent.invokeRunnable | Run my runnable, and reschedule or delete myself based on its result.
Must be run in a transaction. | axiom/scheduler.py | def invokeRunnable(self):
"""
Run my runnable, and reschedule or delete myself based on its result.
Must be run in a transaction.
"""
runnable = self.runnable
if runnable is None:
self.deleteFromStore()
else:
try:
self.runni... | def invokeRunnable(self):
"""
Run my runnable, and reschedule or delete myself based on its result.
Must be run in a transaction.
"""
runnable = self.runnable
if runnable is None:
self.deleteFromStore()
else:
try:
self.runni... | [
"Run",
"my",
"runnable",
"and",
"reschedule",
"or",
"delete",
"myself",
"based",
"on",
"its",
"result",
".",
"Must",
"be",
"run",
"in",
"a",
"transaction",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/scheduler.py#L84-L98 | [
"def",
"invokeRunnable",
"(",
"self",
")",
":",
"runnable",
"=",
"self",
".",
"runnable",
"if",
"runnable",
"is",
"None",
":",
"self",
".",
"deleteFromStore",
"(",
")",
"else",
":",
"try",
":",
"self",
".",
"running",
"=",
"True",
"newTime",
"=",
"runn... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | TimedEvent.handleError | An error occurred running my runnable. Check my runnable for an
error-handling method called 'timedEventErrorHandler' that will take
the given failure as an argument, and execute that if available:
otherwise, create a TimedEventFailureLog with information about what
happened to this eve... | axiom/scheduler.py | def handleError(self, now, failureObj):
""" An error occurred running my runnable. Check my runnable for an
error-handling method called 'timedEventErrorHandler' that will take
the given failure as an argument, and execute that if available:
otherwise, create a TimedEventFailureLog with... | def handleError(self, now, failureObj):
""" An error occurred running my runnable. Check my runnable for an
error-handling method called 'timedEventErrorHandler' that will take
the given failure as an argument, and execute that if available:
otherwise, create a TimedEventFailureLog with... | [
"An",
"error",
"occurred",
"running",
"my",
"runnable",
".",
"Check",
"my",
"runnable",
"for",
"an",
"error",
"-",
"handling",
"method",
"called",
"timedEventErrorHandler",
"that",
"will",
"take",
"the",
"given",
"failure",
"as",
"an",
"argument",
"and",
"exec... | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/scheduler.py#L101-L114 | [
"def",
"handleError",
"(",
"self",
",",
"now",
",",
"failureObj",
")",
":",
"errorHandler",
"=",
"getattr",
"(",
"self",
".",
"runnable",
",",
"'timedEventErrorHandler'",
",",
"None",
")",
"if",
"errorHandler",
"is",
"not",
"None",
":",
"self",
".",
"_resc... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | SchedulerMixin.unscheduleFirst | Remove from given item from the schedule.
If runnable is scheduled to run multiple times, only the temporally first
is removed. | axiom/scheduler.py | def unscheduleFirst(self, runnable):
"""
Remove from given item from the schedule.
If runnable is scheduled to run multiple times, only the temporally first
is removed.
"""
for evt in self.store.query(TimedEvent, TimedEvent.runnable == runnable, sort=TimedEvent.time.asce... | def unscheduleFirst(self, runnable):
"""
Remove from given item from the schedule.
If runnable is scheduled to run multiple times, only the temporally first
is removed.
"""
for evt in self.store.query(TimedEvent, TimedEvent.runnable == runnable, sort=TimedEvent.time.asce... | [
"Remove",
"from",
"given",
"item",
"from",
"the",
"schedule",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/scheduler.py#L200-L209 | [
"def",
"unscheduleFirst",
"(",
"self",
",",
"runnable",
")",
":",
"for",
"evt",
"in",
"self",
".",
"store",
".",
"query",
"(",
"TimedEvent",
",",
"TimedEvent",
".",
"runnable",
"==",
"runnable",
",",
"sort",
"=",
"TimedEvent",
".",
"time",
".",
"ascendin... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | SchedulerMixin.scheduledTimes | Return an iterable of the times at which the given item is scheduled to
run. | axiom/scheduler.py | def scheduledTimes(self, runnable):
"""
Return an iterable of the times at which the given item is scheduled to
run.
"""
events = self.store.query(
TimedEvent, TimedEvent.runnable == runnable)
return (event.time for event in events if not event.running) | def scheduledTimes(self, runnable):
"""
Return an iterable of the times at which the given item is scheduled to
run.
"""
events = self.store.query(
TimedEvent, TimedEvent.runnable == runnable)
return (event.time for event in events if not event.running) | [
"Return",
"an",
"iterable",
"of",
"the",
"times",
"at",
"which",
"the",
"given",
"item",
"is",
"scheduled",
"to",
"run",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/scheduler.py#L217-L224 | [
"def",
"scheduledTimes",
"(",
"self",
",",
"runnable",
")",
":",
"events",
"=",
"self",
".",
"store",
".",
"query",
"(",
"TimedEvent",
",",
"TimedEvent",
".",
"runnable",
"==",
"runnable",
")",
"return",
"(",
"event",
".",
"time",
"for",
"event",
"in",
... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | _SiteScheduler.startService | Start calling persistent timed events whose time has come. | axiom/scheduler.py | def startService(self):
"""
Start calling persistent timed events whose time has come.
"""
super(_SiteScheduler, self).startService()
self._transientSchedule(self.now(), self.now()) | def startService(self):
"""
Start calling persistent timed events whose time has come.
"""
super(_SiteScheduler, self).startService()
self._transientSchedule(self.now(), self.now()) | [
"Start",
"calling",
"persistent",
"timed",
"events",
"whose",
"time",
"has",
"come",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/scheduler.py#L245-L250 | [
"def",
"startService",
"(",
"self",
")",
":",
"super",
"(",
"_SiteScheduler",
",",
"self",
")",
".",
"startService",
"(",
")",
"self",
".",
"_transientSchedule",
"(",
"self",
".",
"now",
"(",
")",
",",
"self",
".",
"now",
"(",
")",
")"
] | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | _SiteScheduler.stopService | Stop calling persistent timed events. | axiom/scheduler.py | def stopService(self):
"""
Stop calling persistent timed events.
"""
super(_SiteScheduler, self).stopService()
if self.timer is not None:
self.timer.cancel()
self.timer = None | def stopService(self):
"""
Stop calling persistent timed events.
"""
super(_SiteScheduler, self).stopService()
if self.timer is not None:
self.timer.cancel()
self.timer = None | [
"Stop",
"calling",
"persistent",
"timed",
"events",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/scheduler.py#L253-L260 | [
"def",
"stopService",
"(",
"self",
")",
":",
"super",
"(",
"_SiteScheduler",
",",
"self",
")",
".",
"stopService",
"(",
")",
"if",
"self",
".",
"timer",
"is",
"not",
"None",
":",
"self",
".",
"timer",
".",
"cancel",
"(",
")",
"self",
".",
"timer",
... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | _SiteScheduler._transientSchedule | If the service is currently running, schedule a tick to happen no
later than C{when}.
@param when: The time at which to tick.
@type when: L{epsilon.extime.Time}
@param now: The current time.
@type now: L{epsilon.extime.Time} | axiom/scheduler.py | def _transientSchedule(self, when, now):
"""
If the service is currently running, schedule a tick to happen no
later than C{when}.
@param when: The time at which to tick.
@type when: L{epsilon.extime.Time}
@param now: The current time.
@type now: L{epsilon.extim... | def _transientSchedule(self, when, now):
"""
If the service is currently running, schedule a tick to happen no
later than C{when}.
@param when: The time at which to tick.
@type when: L{epsilon.extime.Time}
@param now: The current time.
@type now: L{epsilon.extim... | [
"If",
"the",
"service",
"is",
"currently",
"running",
"schedule",
"a",
"tick",
"to",
"happen",
"no",
"later",
"than",
"C",
"{",
"when",
"}",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/scheduler.py#L268-L293 | [
"def",
"_transientSchedule",
"(",
"self",
",",
"when",
",",
"now",
")",
":",
"if",
"not",
"self",
".",
"running",
":",
"return",
"if",
"self",
".",
"timer",
"is",
"not",
"None",
":",
"if",
"self",
".",
"timer",
".",
"getTime",
"(",
")",
"<",
"when"... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | _UserScheduler._transientSchedule | If this service's store is attached to its parent, ask the parent to
schedule this substore to tick at the given time.
@param when: The time at which to tick.
@type when: L{epsilon.extime.Time}
@param now: Present for signature compatibility with
L{_SiteScheduler._transient... | axiom/scheduler.py | def _transientSchedule(self, when, now):
"""
If this service's store is attached to its parent, ask the parent to
schedule this substore to tick at the given time.
@param when: The time at which to tick.
@type when: L{epsilon.extime.Time}
@param now: Present for signatu... | def _transientSchedule(self, when, now):
"""
If this service's store is attached to its parent, ask the parent to
schedule this substore to tick at the given time.
@param when: The time at which to tick.
@type when: L{epsilon.extime.Time}
@param now: Present for signatu... | [
"If",
"this",
"service",
"s",
"store",
"is",
"attached",
"to",
"its",
"parent",
"ask",
"the",
"parent",
"to",
"schedule",
"this",
"substore",
"to",
"tick",
"at",
"the",
"given",
"time",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/scheduler.py#L314-L330 | [
"def",
"_transientSchedule",
"(",
"self",
",",
"when",
",",
"now",
")",
":",
"if",
"self",
".",
"store",
".",
"parent",
"is",
"not",
"None",
":",
"subStore",
"=",
"self",
".",
"store",
".",
"parent",
".",
"getItemByID",
"(",
"self",
".",
"store",
"."... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | _UserScheduler.migrateDown | Remove the components in the site store for this SubScheduler. | axiom/scheduler.py | def migrateDown(self):
"""
Remove the components in the site store for this SubScheduler.
"""
subStore = self.store.parent.getItemByID(self.store.idInParent)
ssph = self.store.parent.findUnique(
_SubSchedulerParentHook,
_SubSchedulerParentHook.subStore == ... | def migrateDown(self):
"""
Remove the components in the site store for this SubScheduler.
"""
subStore = self.store.parent.getItemByID(self.store.idInParent)
ssph = self.store.parent.findUnique(
_SubSchedulerParentHook,
_SubSchedulerParentHook.subStore == ... | [
"Remove",
"the",
"components",
"in",
"the",
"site",
"store",
"for",
"this",
"SubScheduler",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/scheduler.py#L333-L348 | [
"def",
"migrateDown",
"(",
"self",
")",
":",
"subStore",
"=",
"self",
".",
"store",
".",
"parent",
".",
"getItemByID",
"(",
"self",
".",
"store",
".",
"idInParent",
")",
"ssph",
"=",
"self",
".",
"store",
".",
"parent",
".",
"findUnique",
"(",
"_SubSch... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | _UserScheduler.migrateUp | Recreate the hooks in the site store to trigger this SubScheduler. | axiom/scheduler.py | def migrateUp(self):
"""
Recreate the hooks in the site store to trigger this SubScheduler.
"""
te = self.store.findFirst(TimedEvent, sort=TimedEvent.time.descending)
if te is not None:
self._transientSchedule(te.time, None) | def migrateUp(self):
"""
Recreate the hooks in the site store to trigger this SubScheduler.
"""
te = self.store.findFirst(TimedEvent, sort=TimedEvent.time.descending)
if te is not None:
self._transientSchedule(te.time, None) | [
"Recreate",
"the",
"hooks",
"in",
"the",
"site",
"store",
"to",
"trigger",
"this",
"SubScheduler",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/scheduler.py#L351-L357 | [
"def",
"migrateUp",
"(",
"self",
")",
":",
"te",
"=",
"self",
".",
"store",
".",
"findFirst",
"(",
"TimedEvent",
",",
"sort",
"=",
"TimedEvent",
".",
"time",
".",
"descending",
")",
"if",
"te",
"is",
"not",
"None",
":",
"self",
".",
"_transientSchedule... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | _SchedulerCompatMixin.activate | Whenever L{Scheduler} or L{SubScheduler} is created, either newly or
when loaded from a database, emit a deprecation warning referring
people to L{IScheduler}. | axiom/scheduler.py | def activate(self):
"""
Whenever L{Scheduler} or L{SubScheduler} is created, either newly or
when loaded from a database, emit a deprecation warning referring
people to L{IScheduler}.
"""
# This is unfortunate. Perhaps it is the best thing which works (it is
# th... | def activate(self):
"""
Whenever L{Scheduler} or L{SubScheduler} is created, either newly or
when loaded from a database, emit a deprecation warning referring
people to L{IScheduler}.
"""
# This is unfortunate. Perhaps it is the best thing which works (it is
# th... | [
"Whenever",
"L",
"{",
"Scheduler",
"}",
"or",
"L",
"{",
"SubScheduler",
"}",
"is",
"created",
"either",
"newly",
"or",
"when",
"loaded",
"from",
"a",
"database",
"emit",
"a",
"deprecation",
"warning",
"referring",
"people",
"to",
"L",
"{",
"IScheduler",
"}... | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/scheduler.py#L391-L407 | [
"def",
"activate",
"(",
"self",
")",
":",
"# This is unfortunate. Perhaps it is the best thing which works (it is",
"# the first I found). -exarkun",
"if",
"'_axiom_memory_dummy'",
"in",
"vars",
"(",
"self",
")",
":",
"stacklevel",
"=",
"7",
"else",
":",
"stacklevel",
"=... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | _SubSchedulerParentHook._schedule | Ensure that this hook is scheduled to run at or before C{when}. | axiom/scheduler.py | def _schedule(self, when):
"""
Ensure that this hook is scheduled to run at or before C{when}.
"""
sched = IScheduler(self.store)
for scheduledAt in sched.scheduledTimes(self):
if when < scheduledAt:
sched.reschedule(self, scheduledAt, when)
... | def _schedule(self, when):
"""
Ensure that this hook is scheduled to run at or before C{when}.
"""
sched = IScheduler(self.store)
for scheduledAt in sched.scheduledTimes(self):
if when < scheduledAt:
sched.reschedule(self, scheduledAt, when)
... | [
"Ensure",
"that",
"this",
"hook",
"is",
"scheduled",
"to",
"run",
"at",
"or",
"before",
"C",
"{",
"when",
"}",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/scheduler.py#L471-L481 | [
"def",
"_schedule",
"(",
"self",
",",
"when",
")",
":",
"sched",
"=",
"IScheduler",
"(",
"self",
".",
"store",
")",
"for",
"scheduledAt",
"in",
"sched",
".",
"scheduledTimes",
"(",
"self",
")",
":",
"if",
"when",
"<",
"scheduledAt",
":",
"sched",
".",
... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | build_graph | Tokenize a text, index a term matrix, and build out a graph.
Args:
path (str): The file path.
term_depth (int): Consider the N most frequent terms.
skim_depth (int): Connect each word to the N closest siblings.
d_weights (bool): If true, give "close" nodes low weights.
Returns:... | textplot/helpers.py | def build_graph(path, term_depth=1000, skim_depth=10,
d_weights=False, **kwargs):
"""
Tokenize a text, index a term matrix, and build out a graph.
Args:
path (str): The file path.
term_depth (int): Consider the N most frequent terms.
skim_depth (int): Connect each w... | def build_graph(path, term_depth=1000, skim_depth=10,
d_weights=False, **kwargs):
"""
Tokenize a text, index a term matrix, and build out a graph.
Args:
path (str): The file path.
term_depth (int): Consider the N most frequent terms.
skim_depth (int): Connect each w... | [
"Tokenize",
"a",
"text",
"index",
"a",
"term",
"matrix",
"and",
"build",
"out",
"a",
"graph",
"."
] | davidmcclure/textplot | python | https://github.com/davidmcclure/textplot/blob/889b949a637d99097ecec44ed4bfee53b1964dee/textplot/helpers.py#L10-L43 | [
"def",
"build_graph",
"(",
"path",
",",
"term_depth",
"=",
"1000",
",",
"skim_depth",
"=",
"10",
",",
"d_weights",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"# Tokenize text.",
"click",
".",
"echo",
"(",
"'\\nTokenizing text...'",
")",
"t",
"=",
"... | 889b949a637d99097ecec44ed4bfee53b1964dee |
train | Graph.draw_spring | Render a spring layout. | textplot/graphs.py | def draw_spring(self, **kwargs):
"""
Render a spring layout.
"""
nx.draw_spring(
self.graph,
with_labels=True,
font_size=10,
edge_color='#dddddd',
node_size=0,
**kwargs
)
plt.show() | def draw_spring(self, **kwargs):
"""
Render a spring layout.
"""
nx.draw_spring(
self.graph,
with_labels=True,
font_size=10,
edge_color='#dddddd',
node_size=0,
**kwargs
)
plt.show() | [
"Render",
"a",
"spring",
"layout",
"."
] | davidmcclure/textplot | python | https://github.com/davidmcclure/textplot/blob/889b949a637d99097ecec44ed4bfee53b1964dee/textplot/graphs.py#L27-L42 | [
"def",
"draw_spring",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"nx",
".",
"draw_spring",
"(",
"self",
".",
"graph",
",",
"with_labels",
"=",
"True",
",",
"font_size",
"=",
"10",
",",
"edge_color",
"=",
"'#dddddd'",
",",
"node_size",
"=",
"0",
... | 889b949a637d99097ecec44ed4bfee53b1964dee |
train | Skimmer.build | 1. For each term in the passed matrix, score its KDE similarity with
all other indexed terms.
2. With the ordered stack of similarities in hand, skim off the top X
pairs and add them as edges.
Args:
text (Text): The source text instance.
matrix (Matrix): An inde... | textplot/graphs.py | def build(self, text, matrix, skim_depth=10, d_weights=False):
"""
1. For each term in the passed matrix, score its KDE similarity with
all other indexed terms.
2. With the ordered stack of similarities in hand, skim off the top X
pairs and add them as edges.
Args:
... | def build(self, text, matrix, skim_depth=10, d_weights=False):
"""
1. For each term in the passed matrix, score its KDE similarity with
all other indexed terms.
2. With the ordered stack of similarities in hand, skim off the top X
pairs and add them as edges.
Args:
... | [
"1",
".",
"For",
"each",
"term",
"in",
"the",
"passed",
"matrix",
"score",
"its",
"KDE",
"similarity",
"with",
"all",
"other",
"indexed",
"terms",
"."
] | davidmcclure/textplot | python | https://github.com/davidmcclure/textplot/blob/889b949a637d99097ecec44ed4bfee53b1964dee/textplot/graphs.py#L72-L104 | [
"def",
"build",
"(",
"self",
",",
"text",
",",
"matrix",
",",
"skim_depth",
"=",
"10",
",",
"d_weights",
"=",
"False",
")",
":",
"for",
"anchor",
"in",
"bar",
"(",
"matrix",
".",
"keys",
")",
":",
"n1",
"=",
"text",
".",
"unstem",
"(",
"anchor",
... | 889b949a637d99097ecec44ed4bfee53b1964dee |
train | Loader.get_settings | Gets a named section from the configuration source.
:param section: a :class:`str` representing the section you want to
retrieve from the configuration source. If ``None`` this will
fallback to the :attr:`plaster.PlasterURL.fragment`.
:param defaults: a :class:`dict` that will g... | src/plaster_pastedeploy/__init__.py | def get_settings(self, section=None, defaults=None):
"""
Gets a named section from the configuration source.
:param section: a :class:`str` representing the section you want to
retrieve from the configuration source. If ``None`` this will
fallback to the :attr:`plaster.P... | def get_settings(self, section=None, defaults=None):
"""
Gets a named section from the configuration source.
:param section: a :class:`str` representing the section you want to
retrieve from the configuration source. If ``None`` this will
fallback to the :attr:`plaster.P... | [
"Gets",
"a",
"named",
"section",
"from",
"the",
"configuration",
"source",
"."
] | Pylons/plaster_pastedeploy | python | https://github.com/Pylons/plaster_pastedeploy/blob/72a08f3fb6d11a0b039f381ade83f045668cfcb0/src/plaster_pastedeploy/__init__.py#L61-L107 | [
"def",
"get_settings",
"(",
"self",
",",
"section",
"=",
"None",
",",
"defaults",
"=",
"None",
")",
":",
"# This is a partial reimplementation of",
"# ``paste.deploy.loadwsgi.ConfigLoader:get_context`` which supports",
"# \"set\" and \"get\" options and filters out any other globals"... | 72a08f3fb6d11a0b039f381ade83f045668cfcb0 |
train | Loader.get_wsgi_app | Reads the configuration source and finds and loads a WSGI
application defined by the entry with name ``name`` per the
PasteDeploy configuration format and loading mechanism.
:param name: The named WSGI app to find, load and return. Defaults to
``None`` which becomes ``main`` inside
... | src/plaster_pastedeploy/__init__.py | def get_wsgi_app(self, name=None, defaults=None):
"""
Reads the configuration source and finds and loads a WSGI
application defined by the entry with name ``name`` per the
PasteDeploy configuration format and loading mechanism.
:param name: The named WSGI app to find, load and r... | def get_wsgi_app(self, name=None, defaults=None):
"""
Reads the configuration source and finds and loads a WSGI
application defined by the entry with name ``name`` per the
PasteDeploy configuration format and loading mechanism.
:param name: The named WSGI app to find, load and r... | [
"Reads",
"the",
"configuration",
"source",
"and",
"finds",
"and",
"loads",
"a",
"WSGI",
"application",
"defined",
"by",
"the",
"entry",
"with",
"name",
"name",
"per",
"the",
"PasteDeploy",
"configuration",
"format",
"and",
"loading",
"mechanism",
"."
] | Pylons/plaster_pastedeploy | python | https://github.com/Pylons/plaster_pastedeploy/blob/72a08f3fb6d11a0b039f381ade83f045668cfcb0/src/plaster_pastedeploy/__init__.py#L109-L130 | [
"def",
"get_wsgi_app",
"(",
"self",
",",
"name",
"=",
"None",
",",
"defaults",
"=",
"None",
")",
":",
"name",
"=",
"self",
".",
"_maybe_get_default_name",
"(",
"name",
")",
"defaults",
"=",
"self",
".",
"_get_defaults",
"(",
"defaults",
")",
"return",
"l... | 72a08f3fb6d11a0b039f381ade83f045668cfcb0 |
train | Loader.get_wsgi_server | Reads the configuration source and finds and loads a WSGI server
defined by the server entry with the name ``name`` per the PasteDeploy
configuration format and loading mechanism.
:param name: The named WSGI server to find, load and return. Defaults
to ``None`` which becomes ``main`... | src/plaster_pastedeploy/__init__.py | def get_wsgi_server(self, name=None, defaults=None):
"""
Reads the configuration source and finds and loads a WSGI server
defined by the server entry with the name ``name`` per the PasteDeploy
configuration format and loading mechanism.
:param name: The named WSGI server to find... | def get_wsgi_server(self, name=None, defaults=None):
"""
Reads the configuration source and finds and loads a WSGI server
defined by the server entry with the name ``name`` per the PasteDeploy
configuration format and loading mechanism.
:param name: The named WSGI server to find... | [
"Reads",
"the",
"configuration",
"source",
"and",
"finds",
"and",
"loads",
"a",
"WSGI",
"server",
"defined",
"by",
"the",
"server",
"entry",
"with",
"the",
"name",
"name",
"per",
"the",
"PasteDeploy",
"configuration",
"format",
"and",
"loading",
"mechanism",
"... | Pylons/plaster_pastedeploy | python | https://github.com/Pylons/plaster_pastedeploy/blob/72a08f3fb6d11a0b039f381ade83f045668cfcb0/src/plaster_pastedeploy/__init__.py#L132-L153 | [
"def",
"get_wsgi_server",
"(",
"self",
",",
"name",
"=",
"None",
",",
"defaults",
"=",
"None",
")",
":",
"name",
"=",
"self",
".",
"_maybe_get_default_name",
"(",
"name",
")",
"defaults",
"=",
"self",
".",
"_get_defaults",
"(",
"defaults",
")",
"return",
... | 72a08f3fb6d11a0b039f381ade83f045668cfcb0 |
train | Loader.get_wsgi_filter | Reads the configuration soruce and finds and loads a WSGI filter
defined by the filter entry with the name ``name`` per the PasteDeploy
configuration format and loading mechanism.
:param name: The named WSGI filter to find, load and return. Defaults
to ``None`` which becomes ``main`... | src/plaster_pastedeploy/__init__.py | def get_wsgi_filter(self, name=None, defaults=None):
"""Reads the configuration soruce and finds and loads a WSGI filter
defined by the filter entry with the name ``name`` per the PasteDeploy
configuration format and loading mechanism.
:param name: The named WSGI filter to find, load an... | def get_wsgi_filter(self, name=None, defaults=None):
"""Reads the configuration soruce and finds and loads a WSGI filter
defined by the filter entry with the name ``name`` per the PasteDeploy
configuration format and loading mechanism.
:param name: The named WSGI filter to find, load an... | [
"Reads",
"the",
"configuration",
"soruce",
"and",
"finds",
"and",
"loads",
"a",
"WSGI",
"filter",
"defined",
"by",
"the",
"filter",
"entry",
"with",
"the",
"name",
"name",
"per",
"the",
"PasteDeploy",
"configuration",
"format",
"and",
"loading",
"mechanism",
"... | Pylons/plaster_pastedeploy | python | https://github.com/Pylons/plaster_pastedeploy/blob/72a08f3fb6d11a0b039f381ade83f045668cfcb0/src/plaster_pastedeploy/__init__.py#L155-L174 | [
"def",
"get_wsgi_filter",
"(",
"self",
",",
"name",
"=",
"None",
",",
"defaults",
"=",
"None",
")",
":",
"name",
"=",
"self",
".",
"_maybe_get_default_name",
"(",
"name",
")",
"defaults",
"=",
"self",
".",
"_get_defaults",
"(",
"defaults",
")",
"return",
... | 72a08f3fb6d11a0b039f381ade83f045668cfcb0 |
train | Loader.get_wsgi_app_settings | Return an :class:`collections.OrderedDict` representing the
application config for a WSGI application named ``name`` in the
PasteDeploy config file specified by ``self.uri``.
``defaults``, if passed, should be a dictionary used as variable
assignments like ``{'http_port': 8080}``. This... | src/plaster_pastedeploy/__init__.py | def get_wsgi_app_settings(self, name=None, defaults=None):
"""
Return an :class:`collections.OrderedDict` representing the
application config for a WSGI application named ``name`` in the
PasteDeploy config file specified by ``self.uri``.
``defaults``, if passed, should be a dict... | def get_wsgi_app_settings(self, name=None, defaults=None):
"""
Return an :class:`collections.OrderedDict` representing the
application config for a WSGI application named ``name`` in the
PasteDeploy config file specified by ``self.uri``.
``defaults``, if passed, should be a dict... | [
"Return",
"an",
":",
"class",
":",
"collections",
".",
"OrderedDict",
"representing",
"the",
"application",
"config",
"for",
"a",
"WSGI",
"application",
"named",
"name",
"in",
"the",
"PasteDeploy",
"config",
"file",
"specified",
"by",
"self",
".",
"uri",
"."
] | Pylons/plaster_pastedeploy | python | https://github.com/Pylons/plaster_pastedeploy/blob/72a08f3fb6d11a0b039f381ade83f045668cfcb0/src/plaster_pastedeploy/__init__.py#L176-L206 | [
"def",
"get_wsgi_app_settings",
"(",
"self",
",",
"name",
"=",
"None",
",",
"defaults",
"=",
"None",
")",
":",
"name",
"=",
"self",
".",
"_maybe_get_default_name",
"(",
"name",
")",
"defaults",
"=",
"self",
".",
"_get_defaults",
"(",
"defaults",
")",
"conf... | 72a08f3fb6d11a0b039f381ade83f045668cfcb0 |
train | Loader.setup_logging | Set up logging via :func:`logging.config.fileConfig`.
Defaults are specified for the special ``__file__`` and ``here``
variables, similar to PasteDeploy config loading. Extra defaults can
optionally be specified as a dict in ``defaults``.
:param defaults: The defaults that will be used... | src/plaster_pastedeploy/__init__.py | def setup_logging(self, defaults=None):
"""
Set up logging via :func:`logging.config.fileConfig`.
Defaults are specified for the special ``__file__`` and ``here``
variables, similar to PasteDeploy config loading. Extra defaults can
optionally be specified as a dict in ``defaults... | def setup_logging(self, defaults=None):
"""
Set up logging via :func:`logging.config.fileConfig`.
Defaults are specified for the special ``__file__`` and ``here``
variables, similar to PasteDeploy config loading. Extra defaults can
optionally be specified as a dict in ``defaults... | [
"Set",
"up",
"logging",
"via",
":",
"func",
":",
"logging",
".",
"config",
".",
"fileConfig",
"."
] | Pylons/plaster_pastedeploy | python | https://github.com/Pylons/plaster_pastedeploy/blob/72a08f3fb6d11a0b039f381ade83f045668cfcb0/src/plaster_pastedeploy/__init__.py#L208-L226 | [
"def",
"setup_logging",
"(",
"self",
",",
"defaults",
"=",
"None",
")",
":",
"if",
"\"loggers\"",
"in",
"self",
".",
"get_sections",
"(",
")",
":",
"defaults",
"=",
"self",
".",
"_get_defaults",
"(",
"defaults",
")",
"fileConfig",
"(",
"self",
".",
"uri"... | 72a08f3fb6d11a0b039f381ade83f045668cfcb0 |
train | Loader._maybe_get_default_name | Checks a name and determines whether to use the default name.
:param name: The current name to check.
:return: Either None or a :class:`str` representing the name. | src/plaster_pastedeploy/__init__.py | def _maybe_get_default_name(self, name):
"""Checks a name and determines whether to use the default name.
:param name: The current name to check.
:return: Either None or a :class:`str` representing the name.
"""
if name is None and self.uri.fragment:
name = self.uri.... | def _maybe_get_default_name(self, name):
"""Checks a name and determines whether to use the default name.
:param name: The current name to check.
:return: Either None or a :class:`str` representing the name.
"""
if name is None and self.uri.fragment:
name = self.uri.... | [
"Checks",
"a",
"name",
"and",
"determines",
"whether",
"to",
"use",
"the",
"default",
"name",
"."
] | Pylons/plaster_pastedeploy | python | https://github.com/Pylons/plaster_pastedeploy/blob/72a08f3fb6d11a0b039f381ade83f045668cfcb0/src/plaster_pastedeploy/__init__.py#L245-L253 | [
"def",
"_maybe_get_default_name",
"(",
"self",
",",
"name",
")",
":",
"if",
"name",
"is",
"None",
"and",
"self",
".",
"uri",
".",
"fragment",
":",
"name",
"=",
"self",
".",
"uri",
".",
"fragment",
"return",
"name"
] | 72a08f3fb6d11a0b039f381ade83f045668cfcb0 |
train | GradientBar.set | Set cursor position on the color corresponding to the hue value. | tkcolorpicker/gradientbar.py | def set(self, hue):
"""Set cursor position on the color corresponding to the hue value."""
x = hue / 360. * self.winfo_width()
self.coords('cursor', x, 0, x, self.winfo_height())
self._variable.set(hue) | def set(self, hue):
"""Set cursor position on the color corresponding to the hue value."""
x = hue / 360. * self.winfo_width()
self.coords('cursor', x, 0, x, self.winfo_height())
self._variable.set(hue) | [
"Set",
"cursor",
"position",
"on",
"the",
"color",
"corresponding",
"to",
"the",
"hue",
"value",
"."
] | j4321/tkColorPicker | python | https://github.com/j4321/tkColorPicker/blob/ee2d583115e0c7ad7f29795763fc6b4ddc4e8c1d/tkcolorpicker/gradientbar.py#L115-L119 | [
"def",
"set",
"(",
"self",
",",
"hue",
")",
":",
"x",
"=",
"hue",
"/",
"360.",
"*",
"self",
".",
"winfo_width",
"(",
")",
"self",
".",
"coords",
"(",
"'cursor'",
",",
"x",
",",
"0",
",",
"x",
",",
"self",
".",
"winfo_height",
"(",
")",
")",
"... | ee2d583115e0c7ad7f29795763fc6b4ddc4e8c1d |
train | AxiomaticStart.makeService | Create an L{IService} for the database specified by the given
configuration. | twisted/plugins/axiom_plugins.py | def makeService(cls, options):
"""
Create an L{IService} for the database specified by the given
configuration.
"""
from axiom.store import Store
jm = options['journal-mode']
if jm is not None:
jm = jm.decode('ascii')
store = Store(options['dbd... | def makeService(cls, options):
"""
Create an L{IService} for the database specified by the given
configuration.
"""
from axiom.store import Store
jm = options['journal-mode']
if jm is not None:
jm = jm.decode('ascii')
store = Store(options['dbd... | [
"Create",
"an",
"L",
"{",
"IService",
"}",
"for",
"the",
"database",
"specified",
"by",
"the",
"given",
"configuration",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/twisted/plugins/axiom_plugins.py#L49-L61 | [
"def",
"makeService",
"(",
"cls",
",",
"options",
")",
":",
"from",
"axiom",
".",
"store",
"import",
"Store",
"jm",
"=",
"options",
"[",
"'journal-mode'",
"]",
"if",
"jm",
"is",
"not",
"None",
":",
"jm",
"=",
"jm",
".",
"decode",
"(",
"'ascii'",
")",... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | pageNames | Returns the names of everything (books, notes, graphs, etc.) in the project.
Args:
matching (str, optional): if given, only return names with this string in it
workbooks (bool): if True, return workbooks
graphs (bool): if True, return workbooks
Returns:
A list of the names of w... | PyOriginTools/highlevel.py | def pageNames(matching=False,workbooks=True,graphs=True):
"""
Returns the names of everything (books, notes, graphs, etc.) in the project.
Args:
matching (str, optional): if given, only return names with this string in it
workbooks (bool): if True, return workbooks
graphs (bool): if... | def pageNames(matching=False,workbooks=True,graphs=True):
"""
Returns the names of everything (books, notes, graphs, etc.) in the project.
Args:
matching (str, optional): if given, only return names with this string in it
workbooks (bool): if True, return workbooks
graphs (bool): if... | [
"Returns",
"the",
"names",
"of",
"everything",
"(",
"books",
"notes",
"graphs",
"etc",
".",
")",
"in",
"the",
"project",
"."
] | swharden/PyOriginTools | python | https://github.com/swharden/PyOriginTools/blob/536fb8e11234ffdc27e26b1800e0358179ca7d26/PyOriginTools/highlevel.py#L24-L49 | [
"def",
"pageNames",
"(",
"matching",
"=",
"False",
",",
"workbooks",
"=",
"True",
",",
"graphs",
"=",
"True",
")",
":",
"# first collect the pages we want",
"pages",
"=",
"[",
"]",
"if",
"workbooks",
":",
"pages",
".",
"extend",
"(",
"PyOrigin",
".",
"Work... | 536fb8e11234ffdc27e26b1800e0358179ca7d26 |
train | getPageType | Returns the type of the page with that name.
If that name doesn't exist, None is returned.
Args:
name (str): name of the page to get the folder from
number (bool): if True, return numbers (i.e., a graph will be 3)
if False, return words where appropriate (i.e, "graph")
Returns:... | PyOriginTools/highlevel.py | def getPageType(name,number=False):
"""Returns the type of the page with that name.
If that name doesn't exist, None is returned.
Args:
name (str): name of the page to get the folder from
number (bool): if True, return numbers (i.e., a graph will be 3)
if False, return words whe... | def getPageType(name,number=False):
"""Returns the type of the page with that name.
If that name doesn't exist, None is returned.
Args:
name (str): name of the page to get the folder from
number (bool): if True, return numbers (i.e., a graph will be 3)
if False, return words whe... | [
"Returns",
"the",
"type",
"of",
"the",
"page",
"with",
"that",
"name",
".",
"If",
"that",
"name",
"doesn",
"t",
"exist",
"None",
"is",
"returned",
"."
] | swharden/PyOriginTools | python | https://github.com/swharden/PyOriginTools/blob/536fb8e11234ffdc27e26b1800e0358179ca7d26/PyOriginTools/highlevel.py#L117-L143 | [
"def",
"getPageType",
"(",
"name",
",",
"number",
"=",
"False",
")",
":",
"if",
"not",
"name",
"in",
"pageNames",
"(",
")",
":",
"return",
"None",
"pageType",
"=",
"PyOrigin",
".",
"Pages",
"(",
"name",
")",
".",
"GetType",
"(",
")",
"if",
"number",
... | 536fb8e11234ffdc27e26b1800e0358179ca7d26 |
train | listEverything | Prints every page in the project to the console.
Args:
matching (str, optional): if given, only return names with this string in it | PyOriginTools/highlevel.py | def listEverything(matching=False):
"""Prints every page in the project to the console.
Args:
matching (str, optional): if given, only return names with this string in it
"""
pages=pageNames()
if matching:
pages=[x for x in pages if matching in x]
for i,page in enumerate(pages)... | def listEverything(matching=False):
"""Prints every page in the project to the console.
Args:
matching (str, optional): if given, only return names with this string in it
"""
pages=pageNames()
if matching:
pages=[x for x in pages if matching in x]
for i,page in enumerate(pages)... | [
"Prints",
"every",
"page",
"in",
"the",
"project",
"to",
"the",
"console",
"."
] | swharden/PyOriginTools | python | https://github.com/swharden/PyOriginTools/blob/536fb8e11234ffdc27e26b1800e0358179ca7d26/PyOriginTools/highlevel.py#L145-L157 | [
"def",
"listEverything",
"(",
"matching",
"=",
"False",
")",
":",
"pages",
"=",
"pageNames",
"(",
")",
"if",
"matching",
":",
"pages",
"=",
"[",
"x",
"for",
"x",
"in",
"pages",
"if",
"matching",
"in",
"x",
"]",
"for",
"i",
",",
"page",
"in",
"enume... | 536fb8e11234ffdc27e26b1800e0358179ca7d26 |
train | sheetNames | return sheet names of a book.
Args:
book (str, optional): If a book is given, pull names from
that book. Otherwise, try the active one
Returns:
list of sheet names (typical case).
None if book has no sheets.
False if book doesn't exlist. | PyOriginTools/highlevel.py | def sheetNames(book=None):
"""return sheet names of a book.
Args:
book (str, optional): If a book is given, pull names from
that book. Otherwise, try the active one
Returns:
list of sheet names (typical case).
None if book has no sheets.
False if book doesn't ex... | def sheetNames(book=None):
"""return sheet names of a book.
Args:
book (str, optional): If a book is given, pull names from
that book. Otherwise, try the active one
Returns:
list of sheet names (typical case).
None if book has no sheets.
False if book doesn't ex... | [
"return",
"sheet",
"names",
"of",
"a",
"book",
"."
] | swharden/PyOriginTools | python | https://github.com/swharden/PyOriginTools/blob/536fb8e11234ffdc27e26b1800e0358179ca7d26/PyOriginTools/highlevel.py#L202-L225 | [
"def",
"sheetNames",
"(",
"book",
"=",
"None",
")",
":",
"if",
"book",
":",
"if",
"not",
"book",
".",
"lower",
"(",
")",
"in",
"[",
"x",
".",
"lower",
"(",
")",
"for",
"x",
"in",
"bookNames",
"(",
")",
"]",
":",
"return",
"False",
"else",
":",
... | 536fb8e11234ffdc27e26b1800e0358179ca7d26 |
train | getSheet | returns the pyorigin object for a sheet. | PyOriginTools/highlevel.py | def getSheet(book=None,sheet=None):
"""returns the pyorigin object for a sheet."""
# figure out what book to use
if book and not book.lower() in [x.lower() for x in bookNames()]:
print("book %s doesn't exist"%book)
return
if book is None:
book=activeBook().lower()
if book is... | def getSheet(book=None,sheet=None):
"""returns the pyorigin object for a sheet."""
# figure out what book to use
if book and not book.lower() in [x.lower() for x in bookNames()]:
print("book %s doesn't exist"%book)
return
if book is None:
book=activeBook().lower()
if book is... | [
"returns",
"the",
"pyorigin",
"object",
"for",
"a",
"sheet",
"."
] | swharden/PyOriginTools | python | https://github.com/swharden/PyOriginTools/blob/536fb8e11234ffdc27e26b1800e0358179ca7d26/PyOriginTools/highlevel.py#L227-L254 | [
"def",
"getSheet",
"(",
"book",
"=",
"None",
",",
"sheet",
"=",
"None",
")",
":",
"# figure out what book to use",
"if",
"book",
"and",
"not",
"book",
".",
"lower",
"(",
")",
"in",
"[",
"x",
".",
"lower",
"(",
")",
"for",
"x",
"in",
"bookNames",
"(",... | 536fb8e11234ffdc27e26b1800e0358179ca7d26 |
train | sheetDelete | Delete a sheet from a book. If either isn't given, use the active one. | PyOriginTools/highlevel.py | def sheetDelete(book=None,sheet=None):
"""
Delete a sheet from a book. If either isn't given, use the active one.
"""
if book is None:
book=activeBook()
if sheet in sheetNames():
PyOrigin.WorksheetPages(book).Layers(sheetNames().index(sheet)).Destroy() | def sheetDelete(book=None,sheet=None):
"""
Delete a sheet from a book. If either isn't given, use the active one.
"""
if book is None:
book=activeBook()
if sheet in sheetNames():
PyOrigin.WorksheetPages(book).Layers(sheetNames().index(sheet)).Destroy() | [
"Delete",
"a",
"sheet",
"from",
"a",
"book",
".",
"If",
"either",
"isn",
"t",
"given",
"use",
"the",
"active",
"one",
"."
] | swharden/PyOriginTools | python | https://github.com/swharden/PyOriginTools/blob/536fb8e11234ffdc27e26b1800e0358179ca7d26/PyOriginTools/highlevel.py#L260-L267 | [
"def",
"sheetDelete",
"(",
"book",
"=",
"None",
",",
"sheet",
"=",
"None",
")",
":",
"if",
"book",
"is",
"None",
":",
"book",
"=",
"activeBook",
"(",
")",
"if",
"sheet",
"in",
"sheetNames",
"(",
")",
":",
"PyOrigin",
".",
"WorksheetPages",
"(",
"book... | 536fb8e11234ffdc27e26b1800e0358179ca7d26 |
train | sheetDeleteEmpty | Delete all sheets which contain no data | PyOriginTools/highlevel.py | def sheetDeleteEmpty(bookName=None):
"""Delete all sheets which contain no data"""
if bookName is None:
bookName = activeBook()
if not bookName.lower() in [x.lower() for x in bookNames()]:
print("can't clean up a book that doesn't exist:",bookName)
return
poBook=PyOrigin.Workshee... | def sheetDeleteEmpty(bookName=None):
"""Delete all sheets which contain no data"""
if bookName is None:
bookName = activeBook()
if not bookName.lower() in [x.lower() for x in bookNames()]:
print("can't clean up a book that doesn't exist:",bookName)
return
poBook=PyOrigin.Workshee... | [
"Delete",
"all",
"sheets",
"which",
"contain",
"no",
"data"
] | swharden/PyOriginTools | python | https://github.com/swharden/PyOriginTools/blob/536fb8e11234ffdc27e26b1800e0358179ca7d26/PyOriginTools/highlevel.py#L275-L290 | [
"def",
"sheetDeleteEmpty",
"(",
"bookName",
"=",
"None",
")",
":",
"if",
"bookName",
"is",
"None",
":",
"bookName",
"=",
"activeBook",
"(",
")",
"if",
"not",
"bookName",
".",
"lower",
"(",
")",
"in",
"[",
"x",
".",
"lower",
"(",
")",
"for",
"x",
"i... | 536fb8e11234ffdc27e26b1800e0358179ca7d26 |
train | pickle_load | return the contents of a pickle file | PyOriginTools/highlevel.py | def pickle_load(fname):
"""return the contents of a pickle file"""
assert type(fname) is str and os.path.exists(fname)
print("loaded",fname)
return pickle.load(open(fname,"rb")) | def pickle_load(fname):
"""return the contents of a pickle file"""
assert type(fname) is str and os.path.exists(fname)
print("loaded",fname)
return pickle.load(open(fname,"rb")) | [
"return",
"the",
"contents",
"of",
"a",
"pickle",
"file"
] | swharden/PyOriginTools | python | https://github.com/swharden/PyOriginTools/blob/536fb8e11234ffdc27e26b1800e0358179ca7d26/PyOriginTools/highlevel.py#L303-L307 | [
"def",
"pickle_load",
"(",
"fname",
")",
":",
"assert",
"type",
"(",
"fname",
")",
"is",
"str",
"and",
"os",
".",
"path",
".",
"exists",
"(",
"fname",
")",
"print",
"(",
"\"loaded\"",
",",
"fname",
")",
"return",
"pickle",
".",
"load",
"(",
"open",
... | 536fb8e11234ffdc27e26b1800e0358179ca7d26 |
train | pickle_save | save something to a pickle file | PyOriginTools/highlevel.py | def pickle_save(thing,fname=None):
"""save something to a pickle file"""
if fname is None:
fname=os.path.expanduser("~")+"/%d.pkl"%time.time()
assert type(fname) is str and os.path.isdir(os.path.dirname(fname))
pickle.dump(thing, open(fname,"wb"),pickle.HIGHEST_PROTOCOL)
print("saved",fname) | def pickle_save(thing,fname=None):
"""save something to a pickle file"""
if fname is None:
fname=os.path.expanduser("~")+"/%d.pkl"%time.time()
assert type(fname) is str and os.path.isdir(os.path.dirname(fname))
pickle.dump(thing, open(fname,"wb"),pickle.HIGHEST_PROTOCOL)
print("saved",fname) | [
"save",
"something",
"to",
"a",
"pickle",
"file"
] | swharden/PyOriginTools | python | https://github.com/swharden/PyOriginTools/blob/536fb8e11234ffdc27e26b1800e0358179ca7d26/PyOriginTools/highlevel.py#L309-L315 | [
"def",
"pickle_save",
"(",
"thing",
",",
"fname",
"=",
"None",
")",
":",
"if",
"fname",
"is",
"None",
":",
"fname",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"\"~\"",
")",
"+",
"\"/%d.pkl\"",
"%",
"time",
".",
"time",
"(",
")",
"assert",
"typ... | 536fb8e11234ffdc27e26b1800e0358179ca7d26 |
train | sheetToHTML | Put 2d numpy data into a temporary HTML file.
This is a hack, copy/pasted from an earlier version of this software.
It is very messy, but works great! Good enough for me. | PyOriginTools/highlevel.py | def sheetToHTML(sheet):
"""
Put 2d numpy data into a temporary HTML file.
This is a hack, copy/pasted from an earlier version of this software.
It is very messy, but works great! Good enough for me.
"""
assert "SHEET" in str(type(sheet))
#data,names=None,units=None,bookName=None,sheetName=N... | def sheetToHTML(sheet):
"""
Put 2d numpy data into a temporary HTML file.
This is a hack, copy/pasted from an earlier version of this software.
It is very messy, but works great! Good enough for me.
"""
assert "SHEET" in str(type(sheet))
#data,names=None,units=None,bookName=None,sheetName=N... | [
"Put",
"2d",
"numpy",
"data",
"into",
"a",
"temporary",
"HTML",
"file",
".",
"This",
"is",
"a",
"hack",
"copy",
"/",
"pasted",
"from",
"an",
"earlier",
"version",
"of",
"this",
"software",
".",
"It",
"is",
"very",
"messy",
"but",
"works",
"great!",
"Go... | swharden/PyOriginTools | python | https://github.com/swharden/PyOriginTools/blob/536fb8e11234ffdc27e26b1800e0358179ca7d26/PyOriginTools/highlevel.py#L318-L405 | [
"def",
"sheetToHTML",
"(",
"sheet",
")",
":",
"assert",
"\"SHEET\"",
"in",
"str",
"(",
"type",
"(",
"sheet",
")",
")",
"#data,names=None,units=None,bookName=None,sheetName=None,xCol=None",
"#sheet=OR.SHEET()",
"data",
"=",
"sheet",
".",
"data",
"names",
"=",
"sheet"... | 536fb8e11234ffdc27e26b1800e0358179ca7d26 |
train | getCodeBlocks | return a dict with the code for each function | documentation/PyOrigin-examples/convert_html.py | def getCodeBlocks():
"""return a dict with the code for each function"""
raw=open("examples.py").read()
d={}
for block in raw.split("if __name__")[0].split("\ndef "):
title=block.split("\n")[0].split("(")[0]
if not title.startswith("demo_"):
continue
code=[x[4:] for x... | def getCodeBlocks():
"""return a dict with the code for each function"""
raw=open("examples.py").read()
d={}
for block in raw.split("if __name__")[0].split("\ndef "):
title=block.split("\n")[0].split("(")[0]
if not title.startswith("demo_"):
continue
code=[x[4:] for x... | [
"return",
"a",
"dict",
"with",
"the",
"code",
"for",
"each",
"function"
] | swharden/PyOriginTools | python | https://github.com/swharden/PyOriginTools/blob/536fb8e11234ffdc27e26b1800e0358179ca7d26/documentation/PyOrigin-examples/convert_html.py#L15-L25 | [
"def",
"getCodeBlocks",
"(",
")",
":",
"raw",
"=",
"open",
"(",
"\"examples.py\"",
")",
".",
"read",
"(",
")",
"d",
"=",
"{",
"}",
"for",
"block",
"in",
"raw",
".",
"split",
"(",
"\"if __name__\"",
")",
"[",
"0",
"]",
".",
"split",
"(",
"\"\\ndef \... | 536fb8e11234ffdc27e26b1800e0358179ca7d26 |
train | getOutputBlocks | return a dict with the output of each function | documentation/PyOrigin-examples/convert_html.py | def getOutputBlocks():
"""return a dict with the output of each function"""
raw=open("output.txt").read()
d={}
for block in raw.split("\n####### ")[1:]:
title=block.split("\n")[0].split("(")[0]
block=block.split("\n",1)[1].strip()
d[title]=block.split("\nfinished in ")[0]
ret... | def getOutputBlocks():
"""return a dict with the output of each function"""
raw=open("output.txt").read()
d={}
for block in raw.split("\n####### ")[1:]:
title=block.split("\n")[0].split("(")[0]
block=block.split("\n",1)[1].strip()
d[title]=block.split("\nfinished in ")[0]
ret... | [
"return",
"a",
"dict",
"with",
"the",
"output",
"of",
"each",
"function"
] | swharden/PyOriginTools | python | https://github.com/swharden/PyOriginTools/blob/536fb8e11234ffdc27e26b1800e0358179ca7d26/documentation/PyOrigin-examples/convert_html.py#L27-L35 | [
"def",
"getOutputBlocks",
"(",
")",
":",
"raw",
"=",
"open",
"(",
"\"output.txt\"",
")",
".",
"read",
"(",
")",
"d",
"=",
"{",
"}",
"for",
"block",
"in",
"raw",
".",
"split",
"(",
"\"\\n####### \"",
")",
"[",
"1",
":",
"]",
":",
"title",
"=",
"bl... | 536fb8e11234ffdc27e26b1800e0358179ca7d26 |
train | AxiomaticSubCommandMixin.decodeCommandLine | Turn a byte string from the command line into a unicode string. | axiom/scripts/axiomatic.py | def decodeCommandLine(self, cmdline):
"""Turn a byte string from the command line into a unicode string.
"""
codec = getattr(sys.stdin, 'encoding', None) or sys.getdefaultencoding()
return unicode(cmdline, codec) | def decodeCommandLine(self, cmdline):
"""Turn a byte string from the command line into a unicode string.
"""
codec = getattr(sys.stdin, 'encoding', None) or sys.getdefaultencoding()
return unicode(cmdline, codec) | [
"Turn",
"a",
"byte",
"string",
"from",
"the",
"command",
"line",
"into",
"a",
"unicode",
"string",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/scripts/axiomatic.py#L20-L24 | [
"def",
"decodeCommandLine",
"(",
"self",
",",
"cmdline",
")",
":",
"codec",
"=",
"getattr",
"(",
"sys",
".",
"stdin",
",",
"'encoding'",
",",
"None",
")",
"or",
"sys",
".",
"getdefaultencoding",
"(",
")",
"return",
"unicode",
"(",
"cmdline",
",",
"codec"... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | tokenize | Yield tokens.
Args:
text (str): The original text.
Yields:
dict: The next token. | textplot/utils.py | def tokenize(text):
"""
Yield tokens.
Args:
text (str): The original text.
Yields:
dict: The next token.
"""
stem = PorterStemmer().stem
tokens = re.finditer('[a-z]+', text.lower())
for offset, match in enumerate(tokens):
# Get the raw token.
unstemm... | def tokenize(text):
"""
Yield tokens.
Args:
text (str): The original text.
Yields:
dict: The next token.
"""
stem = PorterStemmer().stem
tokens = re.finditer('[a-z]+', text.lower())
for offset, match in enumerate(tokens):
# Get the raw token.
unstemm... | [
"Yield",
"tokens",
"."
] | davidmcclure/textplot | python | https://github.com/davidmcclure/textplot/blob/889b949a637d99097ecec44ed4bfee53b1964dee/textplot/utils.py#L12-L36 | [
"def",
"tokenize",
"(",
"text",
")",
":",
"stem",
"=",
"PorterStemmer",
"(",
")",
".",
"stem",
"tokens",
"=",
"re",
".",
"finditer",
"(",
"'[a-z]+'",
",",
"text",
".",
"lower",
"(",
")",
")",
"for",
"offset",
",",
"match",
"in",
"enumerate",
"(",
"... | 889b949a637d99097ecec44ed4bfee53b1964dee |
train | sort_dict | Sort an ordered dictionary by value, descending.
Args:
d (OrderedDict): An ordered dictionary.
desc (bool): If true, sort desc.
Returns:
OrderedDict: The sorted dictionary. | textplot/utils.py | def sort_dict(d, desc=True):
"""
Sort an ordered dictionary by value, descending.
Args:
d (OrderedDict): An ordered dictionary.
desc (bool): If true, sort desc.
Returns:
OrderedDict: The sorted dictionary.
"""
sort = sorted(d.items(), key=lambda x: x[1], reverse=desc)... | def sort_dict(d, desc=True):
"""
Sort an ordered dictionary by value, descending.
Args:
d (OrderedDict): An ordered dictionary.
desc (bool): If true, sort desc.
Returns:
OrderedDict: The sorted dictionary.
"""
sort = sorted(d.items(), key=lambda x: x[1], reverse=desc)... | [
"Sort",
"an",
"ordered",
"dictionary",
"by",
"value",
"descending",
"."
] | davidmcclure/textplot | python | https://github.com/davidmcclure/textplot/blob/889b949a637d99097ecec44ed4bfee53b1964dee/textplot/utils.py#L39-L53 | [
"def",
"sort_dict",
"(",
"d",
",",
"desc",
"=",
"True",
")",
":",
"sort",
"=",
"sorted",
"(",
"d",
".",
"items",
"(",
")",
",",
"key",
"=",
"lambda",
"x",
":",
"x",
"[",
"1",
"]",
",",
"reverse",
"=",
"desc",
")",
"return",
"OrderedDict",
"(",
... | 889b949a637d99097ecec44ed4bfee53b1964dee |
train | window | Yield a sliding window over an iterable.
Args:
seq (iter): The sequence.
n (int): The window width.
Yields:
tuple: The next window. | textplot/utils.py | def window(seq, n=2):
"""
Yield a sliding window over an iterable.
Args:
seq (iter): The sequence.
n (int): The window width.
Yields:
tuple: The next window.
"""
it = iter(seq)
result = tuple(islice(it, n))
if len(result) == n:
yield result
for t... | def window(seq, n=2):
"""
Yield a sliding window over an iterable.
Args:
seq (iter): The sequence.
n (int): The window width.
Yields:
tuple: The next window.
"""
it = iter(seq)
result = tuple(islice(it, n))
if len(result) == n:
yield result
for t... | [
"Yield",
"a",
"sliding",
"window",
"over",
"an",
"iterable",
"."
] | davidmcclure/textplot | python | https://github.com/davidmcclure/textplot/blob/889b949a637d99097ecec44ed4bfee53b1964dee/textplot/utils.py#L56-L77 | [
"def",
"window",
"(",
"seq",
",",
"n",
"=",
"2",
")",
":",
"it",
"=",
"iter",
"(",
"seq",
")",
"result",
"=",
"tuple",
"(",
"islice",
"(",
"it",
",",
"n",
")",
")",
"if",
"len",
"(",
"result",
")",
"==",
"n",
":",
"yield",
"result",
"for",
... | 889b949a637d99097ecec44ed4bfee53b1964dee |
train | insertUserStore | Move the SubStore at the indicated location into the given site store's
directory and then hook it up to the site store's authentication database.
@type siteStore: C{Store}
@type userStorePath: C{FilePath} | axiom/userbase.py | def insertUserStore(siteStore, userStorePath):
"""
Move the SubStore at the indicated location into the given site store's
directory and then hook it up to the site store's authentication database.
@type siteStore: C{Store}
@type userStorePath: C{FilePath}
"""
# The following may, but does ... | def insertUserStore(siteStore, userStorePath):
"""
Move the SubStore at the indicated location into the given site store's
directory and then hook it up to the site store's authentication database.
@type siteStore: C{Store}
@type userStorePath: C{FilePath}
"""
# The following may, but does ... | [
"Move",
"the",
"SubStore",
"at",
"the",
"indicated",
"location",
"into",
"the",
"given",
"site",
"store",
"s",
"directory",
"and",
"then",
"hook",
"it",
"up",
"to",
"the",
"site",
"store",
"s",
"authentication",
"database",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/userbase.py#L306-L342 | [
"def",
"insertUserStore",
"(",
"siteStore",
",",
"userStorePath",
")",
":",
"# The following may, but does not need to be in a transaction, because it",
"# is merely an attempt to guess a reasonable filesystem name to use for",
"# this avatar. The user store being operated on is expected to be ... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | extractUserStore | Move the SubStore for the given user account out of the given site store
completely. Place the user store's database directory into the given
destination directory.
@type userAccount: C{LoginAccount}
@type extractionDestination: C{FilePath}
@type legacySiteAuthoritative: C{bool}
@param legac... | axiom/userbase.py | def extractUserStore(userAccount, extractionDestination, legacySiteAuthoritative=True):
"""
Move the SubStore for the given user account out of the given site store
completely. Place the user store's database directory into the given
destination directory.
@type userAccount: C{LoginAccount}
@t... | def extractUserStore(userAccount, extractionDestination, legacySiteAuthoritative=True):
"""
Move the SubStore for the given user account out of the given site store
completely. Place the user store's database directory into the given
destination directory.
@type userAccount: C{LoginAccount}
@t... | [
"Move",
"the",
"SubStore",
"for",
"the",
"given",
"user",
"account",
"out",
"of",
"the",
"given",
"site",
"store",
"completely",
".",
"Place",
"the",
"user",
"store",
"s",
"database",
"directory",
"into",
"the",
"given",
"destination",
"directory",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/userbase.py#L345-L397 | [
"def",
"extractUserStore",
"(",
"userAccount",
",",
"extractionDestination",
",",
"legacySiteAuthoritative",
"=",
"True",
")",
":",
"if",
"legacySiteAuthoritative",
":",
"# migrateDown() manages its own transactions, since it is copying items",
"# between two different stores.",
"u... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | getLoginMethods | Retrieve L{LoginMethod} items from store C{store}, optionally constraining
them by protocol | axiom/userbase.py | def getLoginMethods(store, protocol=None):
"""
Retrieve L{LoginMethod} items from store C{store}, optionally constraining
them by protocol
"""
if protocol is not None:
comp = OR(LoginMethod.protocol == u'*',
LoginMethod.protocol == protocol)
else:
comp = None
... | def getLoginMethods(store, protocol=None):
"""
Retrieve L{LoginMethod} items from store C{store}, optionally constraining
them by protocol
"""
if protocol is not None:
comp = OR(LoginMethod.protocol == u'*',
LoginMethod.protocol == protocol)
else:
comp = None
... | [
"Retrieve",
"L",
"{",
"LoginMethod",
"}",
"items",
"from",
"store",
"C",
"{",
"store",
"}",
"optionally",
"constraining",
"them",
"by",
"protocol"
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/userbase.py#L599-L609 | [
"def",
"getLoginMethods",
"(",
"store",
",",
"protocol",
"=",
"None",
")",
":",
"if",
"protocol",
"is",
"not",
"None",
":",
"comp",
"=",
"OR",
"(",
"LoginMethod",
".",
"protocol",
"==",
"u'*'",
",",
"LoginMethod",
".",
"protocol",
"==",
"protocol",
")",
... | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
train | getAccountNames | Retrieve account name information about the given database.
@param store: An Axiom Store representing a user account. It must
have been opened through the store which contains its account
information.
@return: A generator of two-tuples of (username, domain) which
refer to the given store. | axiom/userbase.py | def getAccountNames(store, protocol=None):
"""
Retrieve account name information about the given database.
@param store: An Axiom Store representing a user account. It must
have been opened through the store which contains its account
information.
@return: A generator of two-tuples of (userna... | def getAccountNames(store, protocol=None):
"""
Retrieve account name information about the given database.
@param store: An Axiom Store representing a user account. It must
have been opened through the store which contains its account
information.
@return: A generator of two-tuples of (userna... | [
"Retrieve",
"account",
"name",
"information",
"about",
"the",
"given",
"database",
"."
] | twisted/axiom | python | https://github.com/twisted/axiom/blob/7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68/axiom/userbase.py#L612-L624 | [
"def",
"getAccountNames",
"(",
"store",
",",
"protocol",
"=",
"None",
")",
":",
"return",
"(",
"(",
"meth",
".",
"localpart",
",",
"meth",
".",
"domain",
")",
"for",
"meth",
"in",
"getLoginMethods",
"(",
"store",
",",
"protocol",
")",
")"
] | 7de70bc8fe1bb81f9c2339fba8daec9eb2e92b68 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.