partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
valid | SequentialRangeList.byte_offset | Maps `bytes` length to a sequence's offset. For example, if we do byte_offset(5) and our list of sequences is
[(0, 2), (10, 11), (40, 45)] then the returned value will be 42.
Note that `bytes` must be <= byte_length().
:returns: actual offset in one of the sequences in the range for request byte... | src/infi/instruct/buffer/range.py | def byte_offset(self, bytes):
"""
Maps `bytes` length to a sequence's offset. For example, if we do byte_offset(5) and our list of sequences is
[(0, 2), (10, 11), (40, 45)] then the returned value will be 42.
Note that `bytes` must be <= byte_length().
:returns: actual offset in ... | def byte_offset(self, bytes):
"""
Maps `bytes` length to a sequence's offset. For example, if we do byte_offset(5) and our list of sequences is
[(0, 2), (10, 11), (40, 45)] then the returned value will be 42.
Note that `bytes` must be <= byte_length().
:returns: actual offset in ... | [
"Maps",
"bytes",
"length",
"to",
"a",
"sequence",
"s",
"offset",
".",
"For",
"example",
"if",
"we",
"do",
"byte_offset",
"(",
"5",
")",
"and",
"our",
"list",
"of",
"sequences",
"is",
"[",
"(",
"0",
"2",
")",
"(",
"10",
"11",
")",
"(",
"40",
"45",... | Infinidat/infi.instruct | python | https://github.com/Infinidat/infi.instruct/blob/93b1ab725cfd8d13227960dbf9e3ca1e7f9eebe8/src/infi/instruct/buffer/range.py#L166-L180 | [
"def",
"byte_offset",
"(",
"self",
",",
"bytes",
")",
":",
"remaining_bytes",
"=",
"bytes",
"for",
"r",
"in",
"self",
":",
"if",
"r",
".",
"is_open",
"(",
")",
"or",
"r",
".",
"byte_length",
"(",
")",
">=",
"remaining_bytes",
":",
"return",
"r",
".",... | 93b1ab725cfd8d13227960dbf9e3ca1e7f9eebe8 |
valid | main | Parse command line argument and
output appropriate file type (csv or JSON) | clinvar_report.py | def main():
"""
Parse command line argument and
output appropriate file type (csv or JSON)
"""
parser = ArgumentParser()
parser.add_argument(
"-c", "--clinvarfile", dest="clinvarfile",
help="ClinVar VCF file (either this or -C must be specified)",
metavar="CLINVARFILE")
... | def main():
"""
Parse command line argument and
output appropriate file type (csv or JSON)
"""
parser = ArgumentParser()
parser.add_argument(
"-c", "--clinvarfile", dest="clinvarfile",
help="ClinVar VCF file (either this or -C must be specified)",
metavar="CLINVARFILE")
... | [
"Parse",
"command",
"line",
"argument",
"and",
"output",
"appropriate",
"file",
"type",
"(",
"csv",
"or",
"JSON",
")"
] | madprime/vcf2clinvar | python | https://github.com/madprime/vcf2clinvar/blob/d5bbf6df2902c6cabe9ef1894cfac527e90fa32a/clinvar_report.py#L78-L182 | [
"def",
"main",
"(",
")",
":",
"parser",
"=",
"ArgumentParser",
"(",
")",
"parser",
".",
"add_argument",
"(",
"\"-c\"",
",",
"\"--clinvarfile\"",
",",
"dest",
"=",
"\"clinvarfile\"",
",",
"help",
"=",
"\"ClinVar VCF file (either this or -C must be specified)\"",
",",... | d5bbf6df2902c6cabe9ef1894cfac527e90fa32a |
valid | nav_to_vcf_dir | Navigate an open ftplib.FTP to appropriate directory for ClinVar VCF files.
Args:
ftp: (type: ftplib.FTP) an open connection to ftp.ncbi.nlm.nih.gov
build: (type: string) genome build, either 'b37' or 'b38' | vcf2clinvar/clinvar_update.py | def nav_to_vcf_dir(ftp, build):
"""
Navigate an open ftplib.FTP to appropriate directory for ClinVar VCF files.
Args:
ftp: (type: ftplib.FTP) an open connection to ftp.ncbi.nlm.nih.gov
build: (type: string) genome build, either 'b37' or 'b38'
"""
if build == 'b37':
ftp.cwd... | def nav_to_vcf_dir(ftp, build):
"""
Navigate an open ftplib.FTP to appropriate directory for ClinVar VCF files.
Args:
ftp: (type: ftplib.FTP) an open connection to ftp.ncbi.nlm.nih.gov
build: (type: string) genome build, either 'b37' or 'b38'
"""
if build == 'b37':
ftp.cwd... | [
"Navigate",
"an",
"open",
"ftplib",
".",
"FTP",
"to",
"appropriate",
"directory",
"for",
"ClinVar",
"VCF",
"files",
"."
] | madprime/vcf2clinvar | python | https://github.com/madprime/vcf2clinvar/blob/d5bbf6df2902c6cabe9ef1894cfac527e90fa32a/vcf2clinvar/clinvar_update.py#L20-L33 | [
"def",
"nav_to_vcf_dir",
"(",
"ftp",
",",
"build",
")",
":",
"if",
"build",
"==",
"'b37'",
":",
"ftp",
".",
"cwd",
"(",
"DIR_CLINVAR_VCF_B37",
")",
"elif",
"build",
"==",
"'b38'",
":",
"ftp",
".",
"cwd",
"(",
"DIR_CLINVAR_VCF_B38",
")",
"else",
":",
"r... | d5bbf6df2902c6cabe9ef1894cfac527e90fa32a |
valid | ClinVarAllele.as_dict | Return ClinVarAllele data as dict object. | vcf2clinvar/clinvar.py | def as_dict(self, *args, **kwargs):
"""Return ClinVarAllele data as dict object."""
self_as_dict = super(ClinVarAllele, self).as_dict(*args, **kwargs)
self_as_dict['hgvs'] = self.hgvs
self_as_dict['clnalleleid'] = self.clnalleleid
self_as_dict['clnsig'] = self.clnsig
self... | def as_dict(self, *args, **kwargs):
"""Return ClinVarAllele data as dict object."""
self_as_dict = super(ClinVarAllele, self).as_dict(*args, **kwargs)
self_as_dict['hgvs'] = self.hgvs
self_as_dict['clnalleleid'] = self.clnalleleid
self_as_dict['clnsig'] = self.clnsig
self... | [
"Return",
"ClinVarAllele",
"data",
"as",
"dict",
"object",
"."
] | madprime/vcf2clinvar | python | https://github.com/madprime/vcf2clinvar/blob/d5bbf6df2902c6cabe9ef1894cfac527e90fa32a/vcf2clinvar/clinvar.py#L47-L56 | [
"def",
"as_dict",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self_as_dict",
"=",
"super",
"(",
"ClinVarAllele",
",",
"self",
")",
".",
"as_dict",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"self_as_dict",
"[",
"'hgvs'",
... | d5bbf6df2902c6cabe9ef1894cfac527e90fa32a |
valid | ClinVarVCFLine._parse_frequencies | Parse frequency data in ClinVar VCF | vcf2clinvar/clinvar.py | def _parse_frequencies(self):
"""Parse frequency data in ClinVar VCF"""
frequencies = OrderedDict([
('EXAC', 'Unknown'),
('ESP', 'Unknown'),
('TGP', 'Unknown')])
pref_freq = 'Unknown'
for source in frequencies.keys():
freq_key = 'AF_' + sou... | def _parse_frequencies(self):
"""Parse frequency data in ClinVar VCF"""
frequencies = OrderedDict([
('EXAC', 'Unknown'),
('ESP', 'Unknown'),
('TGP', 'Unknown')])
pref_freq = 'Unknown'
for source in frequencies.keys():
freq_key = 'AF_' + sou... | [
"Parse",
"frequency",
"data",
"in",
"ClinVar",
"VCF"
] | madprime/vcf2clinvar | python | https://github.com/madprime/vcf2clinvar/blob/d5bbf6df2902c6cabe9ef1894cfac527e90fa32a/vcf2clinvar/clinvar.py#L76-L89 | [
"def",
"_parse_frequencies",
"(",
"self",
")",
":",
"frequencies",
"=",
"OrderedDict",
"(",
"[",
"(",
"'EXAC'",
",",
"'Unknown'",
")",
",",
"(",
"'ESP'",
",",
"'Unknown'",
")",
",",
"(",
"'TGP'",
",",
"'Unknown'",
")",
"]",
")",
"pref_freq",
"=",
"'Unk... | d5bbf6df2902c6cabe9ef1894cfac527e90fa32a |
valid | ClinVarVCFLine._parse_allele_data | Parse alleles for ClinVar VCF, overrides parent method. | vcf2clinvar/clinvar.py | def _parse_allele_data(self):
"""Parse alleles for ClinVar VCF, overrides parent method."""
# Get allele frequencies if they exist.
pref_freq, frequencies = self._parse_frequencies()
info_clnvar_single_tags = ['ALLELEID', 'CLNSIG', 'CLNHGVS']
cln_data = {x.lower(): self.info[x]... | def _parse_allele_data(self):
"""Parse alleles for ClinVar VCF, overrides parent method."""
# Get allele frequencies if they exist.
pref_freq, frequencies = self._parse_frequencies()
info_clnvar_single_tags = ['ALLELEID', 'CLNSIG', 'CLNHGVS']
cln_data = {x.lower(): self.info[x]... | [
"Parse",
"alleles",
"for",
"ClinVar",
"VCF",
"overrides",
"parent",
"method",
"."
] | madprime/vcf2clinvar | python | https://github.com/madprime/vcf2clinvar/blob/d5bbf6df2902c6cabe9ef1894cfac527e90fa32a/vcf2clinvar/clinvar.py#L91-L122 | [
"def",
"_parse_allele_data",
"(",
"self",
")",
":",
"# Get allele frequencies if they exist.",
"pref_freq",
",",
"frequencies",
"=",
"self",
".",
"_parse_frequencies",
"(",
")",
"info_clnvar_single_tags",
"=",
"[",
"'ALLELEID'",
",",
"'CLNSIG'",
",",
"'CLNHGVS'",
"]",... | d5bbf6df2902c6cabe9ef1894cfac527e90fa32a |
valid | Factory.add | Returns back a class decorator that enables registering Blox to this factory | blox/builder.py | def add(self, *names):
'''Returns back a class decorator that enables registering Blox to this factory'''
def decorator(blok):
for name in names or (blok.__name__, ):
self[name] = blok
return blok
return decorator | def add(self, *names):
'''Returns back a class decorator that enables registering Blox to this factory'''
def decorator(blok):
for name in names or (blok.__name__, ):
self[name] = blok
return blok
return decorator | [
"Returns",
"back",
"a",
"class",
"decorator",
"that",
"enables",
"registering",
"Blox",
"to",
"this",
"factory"
] | timothycrosley/blox | python | https://github.com/timothycrosley/blox/blob/dc410783d2a2ecad918d1e19c6ee000d20e42d35/blox/builder.py#L37-L43 | [
"def",
"add",
"(",
"self",
",",
"*",
"names",
")",
":",
"def",
"decorator",
"(",
"blok",
")",
":",
"for",
"name",
"in",
"names",
"or",
"(",
"blok",
".",
"__name__",
",",
")",
":",
"self",
"[",
"name",
"]",
"=",
"blok",
"return",
"blok",
"return",... | dc410783d2a2ecad918d1e19c6ee000d20e42d35 |
valid | depricated_name | Decorator for warning user of depricated functions before use.
Args:
newmethod (str): Name of method to use instead. | gems/utils.py | def depricated_name(newmethod):
"""
Decorator for warning user of depricated functions before use.
Args:
newmethod (str): Name of method to use instead.
"""
def decorator(func):
@wraps(func)
def wrapper(*args, **kwargs):
warnings.simplefilter('always', Deprecatio... | def depricated_name(newmethod):
"""
Decorator for warning user of depricated functions before use.
Args:
newmethod (str): Name of method to use instead.
"""
def decorator(func):
@wraps(func)
def wrapper(*args, **kwargs):
warnings.simplefilter('always', Deprecatio... | [
"Decorator",
"for",
"warning",
"user",
"of",
"depricated",
"functions",
"before",
"use",
"."
] | bprinty/gems | python | https://github.com/bprinty/gems/blob/3ff76407af0e71621dada744cd964611e998699c/gems/utils.py#L17-L35 | [
"def",
"depricated_name",
"(",
"newmethod",
")",
":",
"def",
"decorator",
"(",
"func",
")",
":",
"@",
"wraps",
"(",
"func",
")",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"warnings",
".",
"simplefilter",
"(",
"'always'",
... | 3ff76407af0e71621dada744cd964611e998699c |
valid | setDefaultRedisConnectionParams | setDefaultRedisConnectionParams - Sets the default parameters used when connecting to Redis.
This should be the args to redis.Redis in dict (kwargs) form.
@param connectionParams <dict> - A dict of connection parameters.
Common keys are:
host <str> - hostname/ip of Redis server (default '127.0... | IndexedRedis/__init__.py | def setDefaultRedisConnectionParams( connectionParams ):
'''
setDefaultRedisConnectionParams - Sets the default parameters used when connecting to Redis.
This should be the args to redis.Redis in dict (kwargs) form.
@param connectionParams <dict> - A dict of connection parameters.
Common keys are:
... | def setDefaultRedisConnectionParams( connectionParams ):
'''
setDefaultRedisConnectionParams - Sets the default parameters used when connecting to Redis.
This should be the args to redis.Redis in dict (kwargs) form.
@param connectionParams <dict> - A dict of connection parameters.
Common keys are:
... | [
"setDefaultRedisConnectionParams",
"-",
"Sets",
"the",
"default",
"parameters",
"used",
"when",
"connecting",
"to",
"Redis",
"."
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L66-L106 | [
"def",
"setDefaultRedisConnectionParams",
"(",
"connectionParams",
")",
":",
"global",
"_defaultRedisConnectionParams",
"_defaultRedisConnectionParams",
".",
"clear",
"(",
")",
"for",
"key",
",",
"value",
"in",
"connectionParams",
".",
"items",
"(",
")",
":",
"_defaul... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | clearRedisPools | clearRedisPools - Disconnect all managed connection pools,
and clear the connectiobn_pool attribute on all stored managed connection pools.
A "managed" connection pool is one where REDIS_CONNECTION_PARAMS does not define the "connection_pool" attribute.
If you define your own pools, IndexedRedis will u... | IndexedRedis/__init__.py | def clearRedisPools():
'''
clearRedisPools - Disconnect all managed connection pools,
and clear the connectiobn_pool attribute on all stored managed connection pools.
A "managed" connection pool is one where REDIS_CONNECTION_PARAMS does not define the "connection_pool" attribute.
If you define your ... | def clearRedisPools():
'''
clearRedisPools - Disconnect all managed connection pools,
and clear the connectiobn_pool attribute on all stored managed connection pools.
A "managed" connection pool is one where REDIS_CONNECTION_PARAMS does not define the "connection_pool" attribute.
If you define your ... | [
"clearRedisPools",
"-",
"Disconnect",
"all",
"managed",
"connection",
"pools",
"and",
"clear",
"the",
"connectiobn_pool",
"attribute",
"on",
"all",
"stored",
"managed",
"connection",
"pools",
"."
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L119-L146 | [
"def",
"clearRedisPools",
"(",
")",
":",
"global",
"RedisPools",
"global",
"_redisManagedConnectionParams",
"for",
"pool",
"in",
"RedisPools",
".",
"values",
"(",
")",
":",
"try",
":",
"pool",
".",
"disconnect",
"(",
")",
"except",
":",
"pass",
"for",
"param... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | getRedisPool | getRedisPool - Returns and possibly also creates a Redis connection pool
based on the REDIS_CONNECTION_PARAMS passed in.
The goal of this method is to keep a small connection pool rolling
to each unique Redis instance, otherwise during network issues etc
python-redis will leak connections and in short-orde... | IndexedRedis/__init__.py | def getRedisPool(params):
'''
getRedisPool - Returns and possibly also creates a Redis connection pool
based on the REDIS_CONNECTION_PARAMS passed in.
The goal of this method is to keep a small connection pool rolling
to each unique Redis instance, otherwise during network issues etc
python-redis will l... | def getRedisPool(params):
'''
getRedisPool - Returns and possibly also creates a Redis connection pool
based on the REDIS_CONNECTION_PARAMS passed in.
The goal of this method is to keep a small connection pool rolling
to each unique Redis instance, otherwise during network issues etc
python-redis will l... | [
"getRedisPool",
"-",
"Returns",
"and",
"possibly",
"also",
"creates",
"a",
"Redis",
"connection",
"pool",
"based",
"on",
"the",
"REDIS_CONNECTION_PARAMS",
"passed",
"in",
"."
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L149-L245 | [
"def",
"getRedisPool",
"(",
"params",
")",
":",
"global",
"RedisPools",
"global",
"_defaultRedisConnectionParams",
"global",
"_redisManagedConnectionParams",
"if",
"not",
"params",
":",
"params",
"=",
"_defaultRedisConnectionParams",
"isDefaultParams",
"=",
"True",
"else"... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisModel.asDict | toDict / asDict - Get a dictionary representation of this model.
@param includeMeta - Include metadata in return. For now, this is only pk stored as "_id"
@param convertValueTypes <bool> - default True. If False, fields with fieldValue defined will be converted to that type.
Use True when saving, etc, as na... | IndexedRedis/__init__.py | def asDict(self, includeMeta=False, forStorage=False, strKeys=False):
'''
toDict / asDict - Get a dictionary representation of this model.
@param includeMeta - Include metadata in return. For now, this is only pk stored as "_id"
@param convertValueTypes <bool> - default True. If False, fields with fieldVal... | def asDict(self, includeMeta=False, forStorage=False, strKeys=False):
'''
toDict / asDict - Get a dictionary representation of this model.
@param includeMeta - Include metadata in return. For now, this is only pk stored as "_id"
@param convertValueTypes <bool> - default True. If False, fields with fieldVal... | [
"toDict",
"/",
"asDict",
"-",
"Get",
"a",
"dictionary",
"representation",
"of",
"this",
"model",
"."
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L472-L501 | [
"def",
"asDict",
"(",
"self",
",",
"includeMeta",
"=",
"False",
",",
"forStorage",
"=",
"False",
",",
"strKeys",
"=",
"False",
")",
":",
"ret",
"=",
"{",
"}",
"for",
"thisField",
"in",
"self",
".",
"FIELDS",
":",
"val",
"=",
"object",
".",
"__getattr... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisModel.pprint | pprint - Pretty-print a dict representation of this object.
@param stream <file/None> - Either a stream to output, or None to default to sys.stdout | IndexedRedis/__init__.py | def pprint(self, stream=None):
'''
pprint - Pretty-print a dict representation of this object.
@param stream <file/None> - Either a stream to output, or None to default to sys.stdout
'''
pprint.pprint(self.asDict(includeMeta=True, forStorage=False, strKeys=True), stream=stream) | def pprint(self, stream=None):
'''
pprint - Pretty-print a dict representation of this object.
@param stream <file/None> - Either a stream to output, or None to default to sys.stdout
'''
pprint.pprint(self.asDict(includeMeta=True, forStorage=False, strKeys=True), stream=stream) | [
"pprint",
"-",
"Pretty",
"-",
"print",
"a",
"dict",
"representation",
"of",
"this",
"object",
"."
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L506-L512 | [
"def",
"pprint",
"(",
"self",
",",
"stream",
"=",
"None",
")",
":",
"pprint",
".",
"pprint",
"(",
"self",
".",
"asDict",
"(",
"includeMeta",
"=",
"True",
",",
"forStorage",
"=",
"False",
",",
"strKeys",
"=",
"True",
")",
",",
"stream",
"=",
"stream",... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisModel.hasUnsavedChanges | hasUnsavedChanges - Check if any unsaved changes are present in this model, or if it has never been saved.
@param cascadeObjects <bool> default False, if True will check if any foreign linked objects themselves have unsaved changes (recursively).
Otherwise, will just check if the pk has changed.
@return <bo... | IndexedRedis/__init__.py | def hasUnsavedChanges(self, cascadeObjects=False):
'''
hasUnsavedChanges - Check if any unsaved changes are present in this model, or if it has never been saved.
@param cascadeObjects <bool> default False, if True will check if any foreign linked objects themselves have unsaved changes (recursively).
Other... | def hasUnsavedChanges(self, cascadeObjects=False):
'''
hasUnsavedChanges - Check if any unsaved changes are present in this model, or if it has never been saved.
@param cascadeObjects <bool> default False, if True will check if any foreign linked objects themselves have unsaved changes (recursively).
Other... | [
"hasUnsavedChanges",
"-",
"Check",
"if",
"any",
"unsaved",
"changes",
"are",
"present",
"in",
"this",
"model",
"or",
"if",
"it",
"has",
"never",
"been",
"saved",
"."
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L515-L536 | [
"def",
"hasUnsavedChanges",
"(",
"self",
",",
"cascadeObjects",
"=",
"False",
")",
":",
"if",
"not",
"self",
".",
"_id",
"or",
"not",
"self",
".",
"_origData",
":",
"return",
"True",
"for",
"thisField",
"in",
"self",
".",
"FIELDS",
":",
"thisVal",
"=",
... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisModel.getUpdatedFields | getUpdatedFields - See changed fields.
@param cascadeObjects <bool> default False, if True will check if any foreign linked objects themselves have unsaved changes (recursively).
Otherwise, will just check if the pk has changed.
@return - a dictionary of fieldName : tuple(old, new).
fieldName may be ... | IndexedRedis/__init__.py | def getUpdatedFields(self, cascadeObjects=False):
'''
getUpdatedFields - See changed fields.
@param cascadeObjects <bool> default False, if True will check if any foreign linked objects themselves have unsaved changes (recursively).
Otherwise, will just check if the pk has changed.
@return - a dicti... | def getUpdatedFields(self, cascadeObjects=False):
'''
getUpdatedFields - See changed fields.
@param cascadeObjects <bool> default False, if True will check if any foreign linked objects themselves have unsaved changes (recursively).
Otherwise, will just check if the pk has changed.
@return - a dicti... | [
"getUpdatedFields",
"-",
"See",
"changed",
"fields",
".",
"@param",
"cascadeObjects",
"<bool",
">",
"default",
"False",
"if",
"True",
"will",
"check",
"if",
"any",
"foreign",
"linked",
"objects",
"themselves",
"have",
"unsaved",
"changes",
"(",
"recursively",
")... | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L538-L558 | [
"def",
"getUpdatedFields",
"(",
"self",
",",
"cascadeObjects",
"=",
"False",
")",
":",
"updatedFields",
"=",
"{",
"}",
"for",
"thisField",
"in",
"self",
".",
"FIELDS",
":",
"thisVal",
"=",
"object",
".",
"__getattribute__",
"(",
"self",
",",
"thisField",
"... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisModel.diff | diff - Compare the field values on two IndexedRedisModels.
@param firstObj <IndexedRedisModel instance> - First object (or self)
@param otherObj <IndexedRedisModel instance> - Second object
@param includeMeta <bool> - If meta information (like pk) should be in the diff results.
@return <dict> - Dict of... | IndexedRedis/__init__.py | def diff(firstObj, otherObj, includeMeta=False):
'''
diff - Compare the field values on two IndexedRedisModels.
@param firstObj <IndexedRedisModel instance> - First object (or self)
@param otherObj <IndexedRedisModel instance> - Second object
@param includeMeta <bool> - If meta information (like pk) sh... | def diff(firstObj, otherObj, includeMeta=False):
'''
diff - Compare the field values on two IndexedRedisModels.
@param firstObj <IndexedRedisModel instance> - First object (or self)
@param otherObj <IndexedRedisModel instance> - Second object
@param includeMeta <bool> - If meta information (like pk) sh... | [
"diff",
"-",
"Compare",
"the",
"field",
"values",
"on",
"two",
"IndexedRedisModels",
"."
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L561-L615 | [
"def",
"diff",
"(",
"firstObj",
",",
"otherObj",
",",
"includeMeta",
"=",
"False",
")",
":",
"if",
"not",
"isIndexedRedisModel",
"(",
"firstObj",
")",
":",
"raise",
"ValueError",
"(",
"'Type < %s > does not extend IndexedRedisModel.'",
"%",
"(",
"type",
"(",
"fi... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisModel.save | save - Save this object.
Will perform an "insert" if this object had not been saved before,
otherwise will update JUST the fields changed on THIS INSTANCE of the model.
i.e. If you have two processes fetch the same object and change different fields, they will not overwrite
eachother, but only sa... | IndexedRedis/__init__.py | def save(self, cascadeSave=True):
'''
save - Save this object.
Will perform an "insert" if this object had not been saved before,
otherwise will update JUST the fields changed on THIS INSTANCE of the model.
i.e. If you have two processes fetch the same object and change different fields, they wil... | def save(self, cascadeSave=True):
'''
save - Save this object.
Will perform an "insert" if this object had not been saved before,
otherwise will update JUST the fields changed on THIS INSTANCE of the model.
i.e. If you have two processes fetch the same object and change different fields, they wil... | [
"save",
"-",
"Save",
"this",
"object",
".",
"Will",
"perform",
"an",
"insert",
"if",
"this",
"object",
"had",
"not",
"been",
"saved",
"before",
"otherwise",
"will",
"update",
"JUST",
"the",
"fields",
"changed",
"on",
"THIS",
"INSTANCE",
"of",
"the",
"model... | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L641-L664 | [
"def",
"save",
"(",
"self",
",",
"cascadeSave",
"=",
"True",
")",
":",
"saver",
"=",
"IndexedRedisSave",
"(",
"self",
".",
"__class__",
")",
"return",
"saver",
".",
"save",
"(",
"self",
",",
"cascadeSave",
"=",
"cascadeSave",
")"
] | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisModel.reset | reset - Remove all stored data associated with this model (i.e. all objects of this type),
and then save all the provided objects in #newObjs , all in one atomic transaction.
Use this method to move from one complete set of objects to another, where any querying applications
will only see the complete before... | IndexedRedis/__init__.py | def reset(cls, newObjs):
'''
reset - Remove all stored data associated with this model (i.e. all objects of this type),
and then save all the provided objects in #newObjs , all in one atomic transaction.
Use this method to move from one complete set of objects to another, where any querying applications
... | def reset(cls, newObjs):
'''
reset - Remove all stored data associated with this model (i.e. all objects of this type),
and then save all the provided objects in #newObjs , all in one atomic transaction.
Use this method to move from one complete set of objects to another, where any querying applications
... | [
"reset",
"-",
"Remove",
"all",
"stored",
"data",
"associated",
"with",
"this",
"model",
"(",
"i",
".",
"e",
".",
"all",
"objects",
"of",
"this",
"type",
")",
"and",
"then",
"save",
"all",
"the",
"provided",
"objects",
"in",
"#newObjs",
"all",
"in",
"on... | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L681-L717 | [
"def",
"reset",
"(",
"cls",
",",
"newObjs",
")",
":",
"conn",
"=",
"cls",
".",
"objects",
".",
"_get_new_connection",
"(",
")",
"transaction",
"=",
"conn",
".",
"pipeline",
"(",
")",
"transaction",
".",
"eval",
"(",
"\"\"\"\n\t\tlocal matchingKeys = redis.call... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisModel.hasSameValues | hasSameValues - Check if this and another model have the same fields and values.
This does NOT include id, so the models can have the same values but be different objects in the database.
@param other <IndexedRedisModel> - Another model
@param cascadeObject <bool> default True - If True, foreign link values... | IndexedRedis/__init__.py | def hasSameValues(self, other, cascadeObject=True):
'''
hasSameValues - Check if this and another model have the same fields and values.
This does NOT include id, so the models can have the same values but be different objects in the database.
@param other <IndexedRedisModel> - Another model
@param cas... | def hasSameValues(self, other, cascadeObject=True):
'''
hasSameValues - Check if this and another model have the same fields and values.
This does NOT include id, so the models can have the same values but be different objects in the database.
@param other <IndexedRedisModel> - Another model
@param cas... | [
"hasSameValues",
"-",
"Check",
"if",
"this",
"and",
"another",
"model",
"have",
"the",
"same",
"fields",
"and",
"values",
"."
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L720-L770 | [
"def",
"hasSameValues",
"(",
"self",
",",
"other",
",",
"cascadeObject",
"=",
"True",
")",
":",
"if",
"self",
".",
"FIELDS",
"!=",
"other",
".",
"FIELDS",
":",
"return",
"False",
"oga",
"=",
"object",
".",
"__getattribute__",
"for",
"field",
"in",
"self"... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisModel.copy | copy - Copies this object.
@param copyPrimaryKey <bool> default False - If True, any changes to the copy will save over-top the existing entry in Redis.
If False, only the data is copied, and nothing is saved.
@param copyValues <bool> default False - If True, every fi... | IndexedRedis/__init__.py | def copy(self, copyPrimaryKey=False, copyValues=False):
'''
copy - Copies this object.
@param copyPrimaryKey <bool> default False - If True, any changes to the copy will save over-top the existing entry in Redis.
If False, only the data is copied, and n... | def copy(self, copyPrimaryKey=False, copyValues=False):
'''
copy - Copies this object.
@param copyPrimaryKey <bool> default False - If True, any changes to the copy will save over-top the existing entry in Redis.
If False, only the data is copied, and n... | [
"copy",
"-",
"Copies",
"this",
"object",
"."
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L854-L874 | [
"def",
"copy",
"(",
"self",
",",
"copyPrimaryKey",
"=",
"False",
",",
"copyValues",
"=",
"False",
")",
":",
"cpy",
"=",
"self",
".",
"__class__",
"(",
"*",
"*",
"self",
".",
"asDict",
"(",
"copyPrimaryKey",
",",
"forStorage",
"=",
"False",
")",
")",
... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisModel.saveToExternal | saveToExternal - Saves this object to a different Redis than that specified by REDIS_CONNECTION_PARAMS on this model.
@param redisCon <dict/redis.Redis> - Either a dict of connection params, a la REDIS_CONNECTION_PARAMS, or an existing Redis connection.
If you are doing a lot of bulk copies, it is recommended t... | IndexedRedis/__init__.py | def saveToExternal(self, redisCon):
'''
saveToExternal - Saves this object to a different Redis than that specified by REDIS_CONNECTION_PARAMS on this model.
@param redisCon <dict/redis.Redis> - Either a dict of connection params, a la REDIS_CONNECTION_PARAMS, or an existing Redis connection.
If you are do... | def saveToExternal(self, redisCon):
'''
saveToExternal - Saves this object to a different Redis than that specified by REDIS_CONNECTION_PARAMS on this model.
@param redisCon <dict/redis.Redis> - Either a dict of connection params, a la REDIS_CONNECTION_PARAMS, or an existing Redis connection.
If you are do... | [
"saveToExternal",
"-",
"Saves",
"this",
"object",
"to",
"a",
"different",
"Redis",
"than",
"that",
"specified",
"by",
"REDIS_CONNECTION_PARAMS",
"on",
"this",
"model",
"."
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L909-L934 | [
"def",
"saveToExternal",
"(",
"self",
",",
"redisCon",
")",
":",
"if",
"type",
"(",
"redisCon",
")",
"==",
"dict",
":",
"conn",
"=",
"redis",
".",
"Redis",
"(",
"*",
"*",
"redisCon",
")",
"elif",
"hasattr",
"(",
"conn",
",",
"'__class__'",
")",
"and"... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisModel.reload | reload - Reload this object from the database, overriding any local changes and merging in any updates.
@param cascadeObjects <bool> Default True. If True, foreign-linked objects will be reloaded if their values have changed
since last save/fetch. If False, only if the pk changed will the foreign linked... | IndexedRedis/__init__.py | def reload(self, cascadeObjects=True):
'''
reload - Reload this object from the database, overriding any local changes and merging in any updates.
@param cascadeObjects <bool> Default True. If True, foreign-linked objects will be reloaded if their values have changed
since last save/fe... | def reload(self, cascadeObjects=True):
'''
reload - Reload this object from the database, overriding any local changes and merging in any updates.
@param cascadeObjects <bool> Default True. If True, foreign-linked objects will be reloaded if their values have changed
since last save/fe... | [
"reload",
"-",
"Reload",
"this",
"object",
"from",
"the",
"database",
"overriding",
"any",
"local",
"changes",
"and",
"merging",
"in",
"any",
"updates",
"."
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L936-L1003 | [
"def",
"reload",
"(",
"self",
",",
"cascadeObjects",
"=",
"True",
")",
":",
"_id",
"=",
"self",
".",
"_id",
"if",
"not",
"_id",
":",
"raise",
"KeyError",
"(",
"'Object has never been saved! Cannot reload.'",
")",
"currentData",
"=",
"self",
".",
"asDict",
"(... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisModel.copyModel | copyModel - Copy this model, and return that copy.
The copied model will have all the same data, but will have a fresh instance of the FIELDS array and all members,
and the INDEXED_FIELDS array.
This is useful for converting, like changing field types or whatever, where you can load from one mod... | IndexedRedis/__init__.py | def copyModel(mdl):
'''
copyModel - Copy this model, and return that copy.
The copied model will have all the same data, but will have a fresh instance of the FIELDS array and all members,
and the INDEXED_FIELDS array.
This is useful for converting, like changing field types or whatever, wh... | def copyModel(mdl):
'''
copyModel - Copy this model, and return that copy.
The copied model will have all the same data, but will have a fresh instance of the FIELDS array and all members,
and the INDEXED_FIELDS array.
This is useful for converting, like changing field types or whatever, wh... | [
"copyModel",
"-",
"Copy",
"this",
"model",
"and",
"return",
"that",
"copy",
"."
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1036-L1059 | [
"def",
"copyModel",
"(",
"mdl",
")",
":",
"copyNum",
"=",
"_modelCopyMap",
"[",
"mdl",
"]",
"_modelCopyMap",
"[",
"mdl",
"]",
"+=",
"1",
"mdlCopy",
"=",
"type",
"(",
"mdl",
".",
"__name__",
"+",
"'_Copy'",
"+",
"str",
"(",
"copyNum",
")",
",",
"mdl",... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisModel.validateModel | validateModel - Class method that validates a given model is implemented correctly. Will only be validated once, on first model instantiation.
@param model - Implicit of own class
@return - True
@raises - InvalidModelException if there is a problem with the model, and the message contains relevant informati... | IndexedRedis/__init__.py | def validateModel(model):
'''
validateModel - Class method that validates a given model is implemented correctly. Will only be validated once, on first model instantiation.
@param model - Implicit of own class
@return - True
@raises - InvalidModelException if there is a problem with the model, and the ... | def validateModel(model):
'''
validateModel - Class method that validates a given model is implemented correctly. Will only be validated once, on first model instantiation.
@param model - Implicit of own class
@return - True
@raises - InvalidModelException if there is a problem with the model, and the ... | [
"validateModel",
"-",
"Class",
"method",
"that",
"validates",
"a",
"given",
"model",
"is",
"implemented",
"correctly",
".",
"Will",
"only",
"be",
"validated",
"once",
"on",
"first",
"model",
"instantiation",
"."
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1063-L1159 | [
"def",
"validateModel",
"(",
"model",
")",
":",
"if",
"model",
"==",
"IndexedRedisModel",
":",
"import",
"re",
"if",
"re",
".",
"match",
"(",
"'.*pydoc(|[\\d]|[\\d][\\.][\\d])([\\.]py(|[co])){0,1}$'",
",",
"sys",
".",
"argv",
"[",
"0",
"]",
")",
":",
"return",... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisModel.connectAlt | connectAlt - Create a class of this model which will use an alternate connection than the one specified by REDIS_CONNECTION_PARAMS on this model.
@param redisConnectionParams <dict> - Dictionary of arguments to redis.Redis, same as REDIS_CONNECTION_PARAMS.
@return - A class that can be used in all the same ways... | IndexedRedis/__init__.py | def connectAlt(cls, redisConnectionParams):
'''
connectAlt - Create a class of this model which will use an alternate connection than the one specified by REDIS_CONNECTION_PARAMS on this model.
@param redisConnectionParams <dict> - Dictionary of arguments to redis.Redis, same as REDIS_CONNECTION_PARAMS.
@r... | def connectAlt(cls, redisConnectionParams):
'''
connectAlt - Create a class of this model which will use an alternate connection than the one specified by REDIS_CONNECTION_PARAMS on this model.
@param redisConnectionParams <dict> - Dictionary of arguments to redis.Redis, same as REDIS_CONNECTION_PARAMS.
@r... | [
"connectAlt",
"-",
"Create",
"a",
"class",
"of",
"this",
"model",
"which",
"will",
"use",
"an",
"alternate",
"connection",
"than",
"the",
"one",
"specified",
"by",
"REDIS_CONNECTION_PARAMS",
"on",
"this",
"model",
"."
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1175-L1195 | [
"def",
"connectAlt",
"(",
"cls",
",",
"redisConnectionParams",
")",
":",
"if",
"not",
"isinstance",
"(",
"redisConnectionParams",
",",
"dict",
")",
":",
"raise",
"ValueError",
"(",
"'redisConnectionParams must be a dictionary!'",
")",
"hashVal",
"=",
"hashDictOneLevel... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisHelper._get_new_connection | _get_new_connection - Get a new connection
internal | IndexedRedis/__init__.py | def _get_new_connection(self):
'''
_get_new_connection - Get a new connection
internal
'''
pool = getRedisPool(self.mdl.REDIS_CONNECTION_PARAMS)
return redis.Redis(connection_pool=pool) | def _get_new_connection(self):
'''
_get_new_connection - Get a new connection
internal
'''
pool = getRedisPool(self.mdl.REDIS_CONNECTION_PARAMS)
return redis.Redis(connection_pool=pool) | [
"_get_new_connection",
"-",
"Get",
"a",
"new",
"connection",
"internal"
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1227-L1233 | [
"def",
"_get_new_connection",
"(",
"self",
")",
":",
"pool",
"=",
"getRedisPool",
"(",
"self",
".",
"mdl",
".",
"REDIS_CONNECTION_PARAMS",
")",
"return",
"redis",
".",
"Redis",
"(",
"connection_pool",
"=",
"pool",
")"
] | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisHelper._get_connection | _get_connection - Maybe get a new connection, or reuse if passed in.
Will share a connection with a model
internal | IndexedRedis/__init__.py | def _get_connection(self):
'''
_get_connection - Maybe get a new connection, or reuse if passed in.
Will share a connection with a model
internal
'''
if self._connection is None:
self._connection = self._get_new_connection()
return self._connection | def _get_connection(self):
'''
_get_connection - Maybe get a new connection, or reuse if passed in.
Will share a connection with a model
internal
'''
if self._connection is None:
self._connection = self._get_new_connection()
return self._connection | [
"_get_connection",
"-",
"Maybe",
"get",
"a",
"new",
"connection",
"or",
"reuse",
"if",
"passed",
"in",
".",
"Will",
"share",
"a",
"connection",
"with",
"a",
"model",
"internal"
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1235-L1243 | [
"def",
"_get_connection",
"(",
"self",
")",
":",
"if",
"self",
".",
"_connection",
"is",
"None",
":",
"self",
".",
"_connection",
"=",
"self",
".",
"_get_new_connection",
"(",
")",
"return",
"self",
".",
"_connection"
] | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisHelper._add_id_to_keys | _add_id_to_keys - Adds primary key to table
internal | IndexedRedis/__init__.py | def _add_id_to_keys(self, pk, conn=None):
'''
_add_id_to_keys - Adds primary key to table
internal
'''
if conn is None:
conn = self._get_connection()
conn.sadd(self._get_ids_key(), pk) | def _add_id_to_keys(self, pk, conn=None):
'''
_add_id_to_keys - Adds primary key to table
internal
'''
if conn is None:
conn = self._get_connection()
conn.sadd(self._get_ids_key(), pk) | [
"_add_id_to_keys",
"-",
"Adds",
"primary",
"key",
"to",
"table",
"internal"
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1252-L1259 | [
"def",
"_add_id_to_keys",
"(",
"self",
",",
"pk",
",",
"conn",
"=",
"None",
")",
":",
"if",
"conn",
"is",
"None",
":",
"conn",
"=",
"self",
".",
"_get_connection",
"(",
")",
"conn",
".",
"sadd",
"(",
"self",
".",
"_get_ids_key",
"(",
")",
",",
"pk"... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisHelper._rem_id_from_keys | _rem_id_from_keys - Remove primary key from table
internal | IndexedRedis/__init__.py | def _rem_id_from_keys(self, pk, conn=None):
'''
_rem_id_from_keys - Remove primary key from table
internal
'''
if conn is None:
conn = self._get_connection()
conn.srem(self._get_ids_key(), pk) | def _rem_id_from_keys(self, pk, conn=None):
'''
_rem_id_from_keys - Remove primary key from table
internal
'''
if conn is None:
conn = self._get_connection()
conn.srem(self._get_ids_key(), pk) | [
"_rem_id_from_keys",
"-",
"Remove",
"primary",
"key",
"from",
"table",
"internal"
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1261-L1268 | [
"def",
"_rem_id_from_keys",
"(",
"self",
",",
"pk",
",",
"conn",
"=",
"None",
")",
":",
"if",
"conn",
"is",
"None",
":",
"conn",
"=",
"self",
".",
"_get_connection",
"(",
")",
"conn",
".",
"srem",
"(",
"self",
".",
"_get_ids_key",
"(",
")",
",",
"p... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisHelper._add_id_to_index | _add_id_to_index - Adds an id to an index
internal | IndexedRedis/__init__.py | def _add_id_to_index(self, indexedField, pk, val, conn=None):
'''
_add_id_to_index - Adds an id to an index
internal
'''
if conn is None:
conn = self._get_connection()
conn.sadd(self._get_key_for_index(indexedField, val), pk) | def _add_id_to_index(self, indexedField, pk, val, conn=None):
'''
_add_id_to_index - Adds an id to an index
internal
'''
if conn is None:
conn = self._get_connection()
conn.sadd(self._get_key_for_index(indexedField, val), pk) | [
"_add_id_to_index",
"-",
"Adds",
"an",
"id",
"to",
"an",
"index",
"internal"
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1270-L1277 | [
"def",
"_add_id_to_index",
"(",
"self",
",",
"indexedField",
",",
"pk",
",",
"val",
",",
"conn",
"=",
"None",
")",
":",
"if",
"conn",
"is",
"None",
":",
"conn",
"=",
"self",
".",
"_get_connection",
"(",
")",
"conn",
".",
"sadd",
"(",
"self",
".",
"... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisHelper._rem_id_from_index | _rem_id_from_index - Removes an id from an index
internal | IndexedRedis/__init__.py | def _rem_id_from_index(self, indexedField, pk, val, conn=None):
'''
_rem_id_from_index - Removes an id from an index
internal
'''
if conn is None:
conn = self._get_connection()
conn.srem(self._get_key_for_index(indexedField, val), pk) | def _rem_id_from_index(self, indexedField, pk, val, conn=None):
'''
_rem_id_from_index - Removes an id from an index
internal
'''
if conn is None:
conn = self._get_connection()
conn.srem(self._get_key_for_index(indexedField, val), pk) | [
"_rem_id_from_index",
"-",
"Removes",
"an",
"id",
"from",
"an",
"index",
"internal"
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1279-L1286 | [
"def",
"_rem_id_from_index",
"(",
"self",
",",
"indexedField",
",",
"pk",
",",
"val",
",",
"conn",
"=",
"None",
")",
":",
"if",
"conn",
"is",
"None",
":",
"conn",
"=",
"self",
".",
"_get_connection",
"(",
")",
"conn",
".",
"srem",
"(",
"self",
".",
... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisHelper._get_key_for_index | _get_key_for_index - Returns the key name that would hold the indexes on a value
Internal - does not validate that indexedFields is actually indexed. Trusts you. Don't let it down.
@param indexedField - string of field name
@param val - Value of field
@return - Key name string, potentially hashed. | IndexedRedis/__init__.py | def _get_key_for_index(self, indexedField, val):
'''
_get_key_for_index - Returns the key name that would hold the indexes on a value
Internal - does not validate that indexedFields is actually indexed. Trusts you. Don't let it down.
@param indexedField - string of field name
@param val - Value of field
... | def _get_key_for_index(self, indexedField, val):
'''
_get_key_for_index - Returns the key name that would hold the indexes on a value
Internal - does not validate that indexedFields is actually indexed. Trusts you. Don't let it down.
@param indexedField - string of field name
@param val - Value of field
... | [
"_get_key_for_index",
"-",
"Returns",
"the",
"key",
"name",
"that",
"would",
"hold",
"the",
"indexes",
"on",
"a",
"value",
"Internal",
"-",
"does",
"not",
"validate",
"that",
"indexedFields",
"is",
"actually",
"indexed",
".",
"Trusts",
"you",
".",
"Don",
"t"... | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1288-L1306 | [
"def",
"_get_key_for_index",
"(",
"self",
",",
"indexedField",
",",
"val",
")",
":",
"# If provided an IRField, use the toIndex from that (to support compat_ methods",
"if",
"hasattr",
"(",
"indexedField",
",",
"'toIndex'",
")",
":",
"val",
"=",
"indexedField",
".",
"to... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisHelper._compat_get_str_key_for_index | _compat_get_str_key_for_index - Return the key name as a string, even if it is a hashed index field.
This is used in converting unhashed fields to a hashed index (called by _compat_rem_str_id_from_index which is called by compat_convertHashedIndexes)
@param inde
@param indexedField - string of field name
... | IndexedRedis/__init__.py | def _compat_get_str_key_for_index(self, indexedField, val):
'''
_compat_get_str_key_for_index - Return the key name as a string, even if it is a hashed index field.
This is used in converting unhashed fields to a hashed index (called by _compat_rem_str_id_from_index which is called by compat_convertHashedInde... | def _compat_get_str_key_for_index(self, indexedField, val):
'''
_compat_get_str_key_for_index - Return the key name as a string, even if it is a hashed index field.
This is used in converting unhashed fields to a hashed index (called by _compat_rem_str_id_from_index which is called by compat_convertHashedInde... | [
"_compat_get_str_key_for_index",
"-",
"Return",
"the",
"key",
"name",
"as",
"a",
"string",
"even",
"if",
"it",
"is",
"a",
"hashed",
"index",
"field",
".",
"This",
"is",
"used",
"in",
"converting",
"unhashed",
"fields",
"to",
"a",
"hashed",
"index",
"(",
"c... | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1308-L1319 | [
"def",
"_compat_get_str_key_for_index",
"(",
"self",
",",
"indexedField",
",",
"val",
")",
":",
"return",
"''",
".",
"join",
"(",
"[",
"INDEXED_REDIS_PREFIX",
",",
"self",
".",
"keyName",
",",
"':idx:'",
",",
"indexedField",
",",
"':'",
",",
"getattr",
"(",
... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisHelper._compat_rem_str_id_from_index | _compat_rem_str_id_from_index - Used in compat_convertHashedIndexes to remove the old string repr of a field,
in order to later add the hashed value, | IndexedRedis/__init__.py | def _compat_rem_str_id_from_index(self, indexedField, pk, val, conn=None):
'''
_compat_rem_str_id_from_index - Used in compat_convertHashedIndexes to remove the old string repr of a field,
in order to later add the hashed value,
'''
if conn is None:
conn = self._get_connection()
conn.srem(self._compat... | def _compat_rem_str_id_from_index(self, indexedField, pk, val, conn=None):
'''
_compat_rem_str_id_from_index - Used in compat_convertHashedIndexes to remove the old string repr of a field,
in order to later add the hashed value,
'''
if conn is None:
conn = self._get_connection()
conn.srem(self._compat... | [
"_compat_rem_str_id_from_index",
"-",
"Used",
"in",
"compat_convertHashedIndexes",
"to",
"remove",
"the",
"old",
"string",
"repr",
"of",
"a",
"field",
"in",
"order",
"to",
"later",
"add",
"the",
"hashed",
"value"
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1322-L1329 | [
"def",
"_compat_rem_str_id_from_index",
"(",
"self",
",",
"indexedField",
",",
"pk",
",",
"val",
",",
"conn",
"=",
"None",
")",
":",
"if",
"conn",
"is",
"None",
":",
"conn",
"=",
"self",
".",
"_get_connection",
"(",
")",
"conn",
".",
"srem",
"(",
"self... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisHelper._peekNextID | _peekNextID - Look at, but don't increment the primary key for this model.
Internal.
@return int - next pk | IndexedRedis/__init__.py | def _peekNextID(self, conn=None):
'''
_peekNextID - Look at, but don't increment the primary key for this model.
Internal.
@return int - next pk
'''
if conn is None:
conn = self._get_connection()
return to_unicode(conn.get(self._get_next_id_key()) or 0) | def _peekNextID(self, conn=None):
'''
_peekNextID - Look at, but don't increment the primary key for this model.
Internal.
@return int - next pk
'''
if conn is None:
conn = self._get_connection()
return to_unicode(conn.get(self._get_next_id_key()) or 0) | [
"_peekNextID",
"-",
"Look",
"at",
"but",
"don",
"t",
"increment",
"the",
"primary",
"key",
"for",
"this",
"model",
".",
"Internal",
"."
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1352-L1361 | [
"def",
"_peekNextID",
"(",
"self",
",",
"conn",
"=",
"None",
")",
":",
"if",
"conn",
"is",
"None",
":",
"conn",
"=",
"self",
".",
"_get_connection",
"(",
")",
"return",
"to_unicode",
"(",
"conn",
".",
"get",
"(",
"self",
".",
"_get_next_id_key",
"(",
... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisHelper._getNextID | _getNextID - Get (and increment) the next primary key for this model.
If you don't want to increment, @see _peekNextID .
Internal.
This is done automatically on save. No need to call it.
@return int - next pk | IndexedRedis/__init__.py | def _getNextID(self, conn=None):
'''
_getNextID - Get (and increment) the next primary key for this model.
If you don't want to increment, @see _peekNextID .
Internal.
This is done automatically on save. No need to call it.
@return int - next pk
'''
if conn is None:
conn = self._get_connecti... | def _getNextID(self, conn=None):
'''
_getNextID - Get (and increment) the next primary key for this model.
If you don't want to increment, @see _peekNextID .
Internal.
This is done automatically on save. No need to call it.
@return int - next pk
'''
if conn is None:
conn = self._get_connecti... | [
"_getNextID",
"-",
"Get",
"(",
"and",
"increment",
")",
"the",
"next",
"primary",
"key",
"for",
"this",
"model",
".",
"If",
"you",
"don",
"t",
"want",
"to",
"increment",
"@see",
"_peekNextID",
".",
"Internal",
".",
"This",
"is",
"done",
"automatically",
... | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1363-L1374 | [
"def",
"_getNextID",
"(",
"self",
",",
"conn",
"=",
"None",
")",
":",
"if",
"conn",
"is",
"None",
":",
"conn",
"=",
"self",
".",
"_get_connection",
"(",
")",
"return",
"int",
"(",
"conn",
".",
"incr",
"(",
"self",
".",
"_get_next_id_key",
"(",
")",
... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisQuery.filter | filter - Add filters based on INDEXED_FIELDS having or not having a value.
Note, no objects are actually fetched until .all() is called
Use the field name [ model.objects.filter(some_field='value')] to filter on items containing that value.
Use the field name suffxed with '__ne' for a negation filter [ mo... | IndexedRedis/__init__.py | def filter(self, **kwargs):
'''
filter - Add filters based on INDEXED_FIELDS having or not having a value.
Note, no objects are actually fetched until .all() is called
Use the field name [ model.objects.filter(some_field='value')] to filter on items containing that value.
Use the field name suffxed w... | def filter(self, **kwargs):
'''
filter - Add filters based on INDEXED_FIELDS having or not having a value.
Note, no objects are actually fetched until .all() is called
Use the field name [ model.objects.filter(some_field='value')] to filter on items containing that value.
Use the field name suffxed w... | [
"filter",
"-",
"Add",
"filters",
"based",
"on",
"INDEXED_FIELDS",
"having",
"or",
"not",
"having",
"a",
"value",
".",
"Note",
"no",
"objects",
"are",
"actually",
"fetched",
"until",
".",
"all",
"()",
"is",
"called"
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1415-L1433 | [
"def",
"filter",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"selfCopy",
"=",
"self",
".",
"__copy__",
"(",
")",
"return",
"IndexedRedisQuery",
".",
"_filter",
"(",
"selfCopy",
",",
"*",
"*",
"kwargs",
")"
] | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisQuery._filter | Internal for handling filters; the guts of .filter and .filterInline | IndexedRedis/__init__.py | def _filter(filterObj, **kwargs):
'''
Internal for handling filters; the guts of .filter and .filterInline
'''
for key, value in kwargs.items():
if key.endswith('__ne'):
notFilter = True
key = key[:-4]
else:
notFilter = False
if key not in filterObj.indexedFields:
raise ValueError('Fie... | def _filter(filterObj, **kwargs):
'''
Internal for handling filters; the guts of .filter and .filterInline
'''
for key, value in kwargs.items():
if key.endswith('__ne'):
notFilter = True
key = key[:-4]
else:
notFilter = False
if key not in filterObj.indexedFields:
raise ValueError('Fie... | [
"Internal",
"for",
"handling",
"filters",
";",
"the",
"guts",
"of",
".",
"filter",
"and",
".",
"filterInline"
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1443-L1461 | [
"def",
"_filter",
"(",
"filterObj",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"key",
",",
"value",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"if",
"key",
".",
"endswith",
"(",
"'__ne'",
")",
":",
"notFilter",
"=",
"True",
"key",
"=",
"key",
"[... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisQuery.count | count - gets the number of records matching the filter criteria
Example:
theCount = Model.objects.filter(field1='value').count() | IndexedRedis/__init__.py | def count(self):
'''
count - gets the number of records matching the filter criteria
Example:
theCount = Model.objects.filter(field1='value').count()
'''
conn = self._get_connection()
numFilters = len(self.filters)
numNotFilters = len(self.notFilters)
if numFilters + numNotFilters == 0:
ret... | def count(self):
'''
count - gets the number of records matching the filter criteria
Example:
theCount = Model.objects.filter(field1='value').count()
'''
conn = self._get_connection()
numFilters = len(self.filters)
numNotFilters = len(self.notFilters)
if numFilters + numNotFilters == 0:
ret... | [
"count",
"-",
"gets",
"the",
"number",
"of",
"records",
"matching",
"the",
"filter",
"criteria"
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1465-L1500 | [
"def",
"count",
"(",
"self",
")",
":",
"conn",
"=",
"self",
".",
"_get_connection",
"(",
")",
"numFilters",
"=",
"len",
"(",
"self",
".",
"filters",
")",
"numNotFilters",
"=",
"len",
"(",
"self",
".",
"notFilters",
")",
"if",
"numFilters",
"+",
"numNot... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisQuery.exists | exists - Tests whether a record holding the given primary key exists.
@param pk - Primary key (see getPk method)
Example usage: Waiting for an object to be deleted without fetching the object or running a filter.
This is a very cheap operation.
@return <bool> - True if object with given pk exists, othe... | IndexedRedis/__init__.py | def exists(self, pk):
'''
exists - Tests whether a record holding the given primary key exists.
@param pk - Primary key (see getPk method)
Example usage: Waiting for an object to be deleted without fetching the object or running a filter.
This is a very cheap operation.
@return <bool> - True if ob... | def exists(self, pk):
'''
exists - Tests whether a record holding the given primary key exists.
@param pk - Primary key (see getPk method)
Example usage: Waiting for an object to be deleted without fetching the object or running a filter.
This is a very cheap operation.
@return <bool> - True if ob... | [
"exists",
"-",
"Tests",
"whether",
"a",
"record",
"holding",
"the",
"given",
"primary",
"key",
"exists",
"."
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1502-L1516 | [
"def",
"exists",
"(",
"self",
",",
"pk",
")",
":",
"conn",
"=",
"self",
".",
"_get_connection",
"(",
")",
"key",
"=",
"self",
".",
"_get_key_for_id",
"(",
"pk",
")",
"return",
"conn",
".",
"exists",
"(",
"key",
")"
] | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisQuery.getPrimaryKeys | getPrimaryKeys - Returns all primary keys matching current filterset.
@param sortByAge <bool> - If False, return will be a set and may not be ordered.
If True, return will be a list and is guarenteed to represent objects oldest->newest
@return <set> - A set of all primary keys associated with current filter... | IndexedRedis/__init__.py | def getPrimaryKeys(self, sortByAge=False):
'''
getPrimaryKeys - Returns all primary keys matching current filterset.
@param sortByAge <bool> - If False, return will be a set and may not be ordered.
If True, return will be a list and is guarenteed to represent objects oldest->newest
@return <set> - A se... | def getPrimaryKeys(self, sortByAge=False):
'''
getPrimaryKeys - Returns all primary keys matching current filterset.
@param sortByAge <bool> - If False, return will be a set and may not be ordered.
If True, return will be a list and is guarenteed to represent objects oldest->newest
@return <set> - A se... | [
"getPrimaryKeys",
"-",
"Returns",
"all",
"primary",
"keys",
"matching",
"current",
"filterset",
"."
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1519-L1575 | [
"def",
"getPrimaryKeys",
"(",
"self",
",",
"sortByAge",
"=",
"False",
")",
":",
"conn",
"=",
"self",
".",
"_get_connection",
"(",
")",
"# Apply filters, and return object",
"numFilters",
"=",
"len",
"(",
"self",
".",
"filters",
")",
"numNotFilters",
"=",
"len"... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisQuery.all | all - Get the underlying objects which match the filter criteria.
Example: objs = Model.objects.filter(field1='value', field2='value2').all()
@param cascadeFetch <bool> Default False, If True, all Foreign objects associated with this model
will be fetched immediately. If False, foreign objects will be f... | IndexedRedis/__init__.py | def all(self, cascadeFetch=False):
'''
all - Get the underlying objects which match the filter criteria.
Example: objs = Model.objects.filter(field1='value', field2='value2').all()
@param cascadeFetch <bool> Default False, If True, all Foreign objects associated with this model
will be fetched imme... | def all(self, cascadeFetch=False):
'''
all - Get the underlying objects which match the filter criteria.
Example: objs = Model.objects.filter(field1='value', field2='value2').all()
@param cascadeFetch <bool> Default False, If True, all Foreign objects associated with this model
will be fetched imme... | [
"all",
"-",
"Get",
"the",
"underlying",
"objects",
"which",
"match",
"the",
"filter",
"criteria",
"."
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1578-L1593 | [
"def",
"all",
"(",
"self",
",",
"cascadeFetch",
"=",
"False",
")",
":",
"matchedKeys",
"=",
"self",
".",
"getPrimaryKeys",
"(",
")",
"if",
"matchedKeys",
":",
"return",
"self",
".",
"getMultiple",
"(",
"matchedKeys",
",",
"cascadeFetch",
"=",
"cascadeFetch",... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisQuery.allByAge | allByAge - Get the underlying objects which match the filter criteria, ordered oldest -> newest
If you are doing a queue or just need the head/tail, consider .first() and .last() instead.
@param cascadeFetch <bool> Default False, If True, all Foreign objects associated with this model
will be fetched imm... | IndexedRedis/__init__.py | def allByAge(self, cascadeFetch=False):
'''
allByAge - Get the underlying objects which match the filter criteria, ordered oldest -> newest
If you are doing a queue or just need the head/tail, consider .first() and .last() instead.
@param cascadeFetch <bool> Default False, If True, all Foreign objects ass... | def allByAge(self, cascadeFetch=False):
'''
allByAge - Get the underlying objects which match the filter criteria, ordered oldest -> newest
If you are doing a queue or just need the head/tail, consider .first() and .last() instead.
@param cascadeFetch <bool> Default False, If True, all Foreign objects ass... | [
"allByAge",
"-",
"Get",
"the",
"underlying",
"objects",
"which",
"match",
"the",
"filter",
"criteria",
"ordered",
"oldest",
"-",
">",
"newest",
"If",
"you",
"are",
"doing",
"a",
"queue",
"or",
"just",
"need",
"the",
"head",
"/",
"tail",
"consider",
".",
... | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1595-L1610 | [
"def",
"allByAge",
"(",
"self",
",",
"cascadeFetch",
"=",
"False",
")",
":",
"matchedKeys",
"=",
"self",
".",
"getPrimaryKeys",
"(",
"sortByAge",
"=",
"True",
")",
"if",
"matchedKeys",
":",
"return",
"self",
".",
"getMultiple",
"(",
"matchedKeys",
",",
"ca... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisQuery.allOnlyFields | allOnlyFields - Get the objects which match the filter criteria, only fetching given fields.
@param fields - List of fields to fetch
@param cascadeFetch <bool> Default False, If True, all Foreign objects associated with this model
will be fetched immediately. If False, foreign objects will be fetched on-a... | IndexedRedis/__init__.py | def allOnlyFields(self, fields, cascadeFetch=False):
'''
allOnlyFields - Get the objects which match the filter criteria, only fetching given fields.
@param fields - List of fields to fetch
@param cascadeFetch <bool> Default False, If True, all Foreign objects associated with this model
will be fetch... | def allOnlyFields(self, fields, cascadeFetch=False):
'''
allOnlyFields - Get the objects which match the filter criteria, only fetching given fields.
@param fields - List of fields to fetch
@param cascadeFetch <bool> Default False, If True, all Foreign objects associated with this model
will be fetch... | [
"allOnlyFields",
"-",
"Get",
"the",
"objects",
"which",
"match",
"the",
"filter",
"criteria",
"only",
"fetching",
"given",
"fields",
"."
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1612-L1628 | [
"def",
"allOnlyFields",
"(",
"self",
",",
"fields",
",",
"cascadeFetch",
"=",
"False",
")",
":",
"matchedKeys",
"=",
"self",
".",
"getPrimaryKeys",
"(",
")",
"if",
"matchedKeys",
":",
"return",
"self",
".",
"getMultipleOnlyFields",
"(",
"matchedKeys",
",",
"... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisQuery.allOnlyIndexedFields | allOnlyIndexedFields - Get the objects which match the filter criteria, only fetching indexed fields.
@return - Partial objects with only the indexed fields fetched | IndexedRedis/__init__.py | def allOnlyIndexedFields(self):
'''
allOnlyIndexedFields - Get the objects which match the filter criteria, only fetching indexed fields.
@return - Partial objects with only the indexed fields fetched
'''
matchedKeys = self.getPrimaryKeys()
if matchedKeys:
return self.getMultipleOnlyIndexedFields(matc... | def allOnlyIndexedFields(self):
'''
allOnlyIndexedFields - Get the objects which match the filter criteria, only fetching indexed fields.
@return - Partial objects with only the indexed fields fetched
'''
matchedKeys = self.getPrimaryKeys()
if matchedKeys:
return self.getMultipleOnlyIndexedFields(matc... | [
"allOnlyIndexedFields",
"-",
"Get",
"the",
"objects",
"which",
"match",
"the",
"filter",
"criteria",
"only",
"fetching",
"indexed",
"fields",
"."
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1630-L1640 | [
"def",
"allOnlyIndexedFields",
"(",
"self",
")",
":",
"matchedKeys",
"=",
"self",
".",
"getPrimaryKeys",
"(",
")",
"if",
"matchedKeys",
":",
"return",
"self",
".",
"getMultipleOnlyIndexedFields",
"(",
"matchedKeys",
")",
"return",
"IRQueryableList",
"(",
"[",
"]... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisQuery.first | First - Returns the oldest record (lowerst primary key) with current filters.
This makes an efficient queue, as it only fetches a single object.
@param cascadeFetch <bool> Default False, If True, all Foreign objects associated with this model
will be fetched immediately. If False, foreign objects will ... | IndexedRedis/__init__.py | def first(self, cascadeFetch=False):
'''
First - Returns the oldest record (lowerst primary key) with current filters.
This makes an efficient queue, as it only fetches a single object.
@param cascadeFetch <bool> Default False, If True, all Foreign objects associated with this model
will be fetche... | def first(self, cascadeFetch=False):
'''
First - Returns the oldest record (lowerst primary key) with current filters.
This makes an efficient queue, as it only fetches a single object.
@param cascadeFetch <bool> Default False, If True, all Foreign objects associated with this model
will be fetche... | [
"First",
"-",
"Returns",
"the",
"oldest",
"record",
"(",
"lowerst",
"primary",
"key",
")",
"with",
"current",
"filters",
".",
"This",
"makes",
"an",
"efficient",
"queue",
"as",
"it",
"only",
"fetches",
"a",
"single",
"object",
"."
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1643-L1662 | [
"def",
"first",
"(",
"self",
",",
"cascadeFetch",
"=",
"False",
")",
":",
"obj",
"=",
"None",
"matchedKeys",
"=",
"self",
".",
"getPrimaryKeys",
"(",
"sortByAge",
"=",
"True",
")",
"if",
"matchedKeys",
":",
"# Loop so we don't return None when there are items, if ... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisQuery.random | Random - Returns a random record in current filterset.
@param cascadeFetch <bool> Default False, If True, all Foreign objects associated with this model
will be fetched immediately. If False, foreign objects will be fetched on-access.
@return - Instance of Model object, or None if no items math current f... | IndexedRedis/__init__.py | def random(self, cascadeFetch=False):
'''
Random - Returns a random record in current filterset.
@param cascadeFetch <bool> Default False, If True, all Foreign objects associated with this model
will be fetched immediately. If False, foreign objects will be fetched on-access.
@return - Instance of M... | def random(self, cascadeFetch=False):
'''
Random - Returns a random record in current filterset.
@param cascadeFetch <bool> Default False, If True, all Foreign objects associated with this model
will be fetched immediately. If False, foreign objects will be fetched on-access.
@return - Instance of M... | [
"Random",
"-",
"Returns",
"a",
"random",
"record",
"in",
"current",
"filterset",
"."
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1685-L1702 | [
"def",
"random",
"(",
"self",
",",
"cascadeFetch",
"=",
"False",
")",
":",
"matchedKeys",
"=",
"list",
"(",
"self",
".",
"getPrimaryKeys",
"(",
")",
")",
"obj",
"=",
"None",
"# Loop so we don't return None when there are items, if item is deleted between getting key and... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisQuery.delete | delete - Deletes all entries matching the filter criteria | IndexedRedis/__init__.py | def delete(self):
'''
delete - Deletes all entries matching the filter criteria
'''
if self.filters or self.notFilters:
return self.mdl.deleter.deleteMultiple(self.allOnlyIndexedFields())
return self.mdl.deleter.destroyModel() | def delete(self):
'''
delete - Deletes all entries matching the filter criteria
'''
if self.filters or self.notFilters:
return self.mdl.deleter.deleteMultiple(self.allOnlyIndexedFields())
return self.mdl.deleter.destroyModel() | [
"delete",
"-",
"Deletes",
"all",
"entries",
"matching",
"the",
"filter",
"criteria"
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1705-L1712 | [
"def",
"delete",
"(",
"self",
")",
":",
"if",
"self",
".",
"filters",
"or",
"self",
".",
"notFilters",
":",
"return",
"self",
".",
"mdl",
".",
"deleter",
".",
"deleteMultiple",
"(",
"self",
".",
"allOnlyIndexedFields",
"(",
")",
")",
"return",
"self",
... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisQuery.get | get - Get a single value with the internal primary key.
@param cascadeFetch <bool> Default False, If True, all Foreign objects associated with this model
will be fetched immediately. If False, foreign objects will be fetched on-access.
@param pk - internal primary key (can be found via .getPk() on an ite... | IndexedRedis/__init__.py | def get(self, pk, cascadeFetch=False):
'''
get - Get a single value with the internal primary key.
@param cascadeFetch <bool> Default False, If True, all Foreign objects associated with this model
will be fetched immediately. If False, foreign objects will be fetched on-access.
@param pk - internal ... | def get(self, pk, cascadeFetch=False):
'''
get - Get a single value with the internal primary key.
@param cascadeFetch <bool> Default False, If True, all Foreign objects associated with this model
will be fetched immediately. If False, foreign objects will be fetched on-access.
@param pk - internal ... | [
"get",
"-",
"Get",
"a",
"single",
"value",
"with",
"the",
"internal",
"primary",
"key",
"."
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1714-L1734 | [
"def",
"get",
"(",
"self",
",",
"pk",
",",
"cascadeFetch",
"=",
"False",
")",
":",
"conn",
"=",
"self",
".",
"_get_connection",
"(",
")",
"key",
"=",
"self",
".",
"_get_key_for_id",
"(",
"pk",
")",
"res",
"=",
"conn",
".",
"hgetall",
"(",
"key",
")... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisQuery._doCascadeFetch | _doCascadeFetch - Takes an object and performs a cascading fetch on all foreign links, and all theirs, and so on.
@param obj <IndexedRedisModel> - A fetched model | IndexedRedis/__init__.py | def _doCascadeFetch(obj):
'''
_doCascadeFetch - Takes an object and performs a cascading fetch on all foreign links, and all theirs, and so on.
@param obj <IndexedRedisModel> - A fetched model
'''
obj.validateModel()
if not obj.foreignFields:
return
# NOTE: Currently this fetches using one trans... | def _doCascadeFetch(obj):
'''
_doCascadeFetch - Takes an object and performs a cascading fetch on all foreign links, and all theirs, and so on.
@param obj <IndexedRedisModel> - A fetched model
'''
obj.validateModel()
if not obj.foreignFields:
return
# NOTE: Currently this fetches using one trans... | [
"_doCascadeFetch",
"-",
"Takes",
"an",
"object",
"and",
"performs",
"a",
"cascading",
"fetch",
"on",
"all",
"foreign",
"links",
"and",
"all",
"theirs",
"and",
"so",
"on",
"."
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1738-L1761 | [
"def",
"_doCascadeFetch",
"(",
"obj",
")",
":",
"obj",
".",
"validateModel",
"(",
")",
"if",
"not",
"obj",
".",
"foreignFields",
":",
"return",
"# NOTE: Currently this fetches using one transaction per object. Implementation for actual resolution is in",
"# IndexedRedisModel.... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisQuery.getMultiple | getMultiple - Gets multiple objects with a single atomic operation
@param cascadeFetch <bool> Default False, If True, all Foreign objects associated with this model
will be fetched immediately. If False, foreign objects will be fetched on-access.
@param pks - list of internal keys | IndexedRedis/__init__.py | def getMultiple(self, pks, cascadeFetch=False):
'''
getMultiple - Gets multiple objects with a single atomic operation
@param cascadeFetch <bool> Default False, If True, all Foreign objects associated with this model
will be fetched immediately. If False, foreign objects will be fetched on-access.
@... | def getMultiple(self, pks, cascadeFetch=False):
'''
getMultiple - Gets multiple objects with a single atomic operation
@param cascadeFetch <bool> Default False, If True, all Foreign objects associated with this model
will be fetched immediately. If False, foreign objects will be fetched on-access.
@... | [
"getMultiple",
"-",
"Gets",
"multiple",
"objects",
"with",
"a",
"single",
"atomic",
"operation"
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1763-L1808 | [
"def",
"getMultiple",
"(",
"self",
",",
"pks",
",",
"cascadeFetch",
"=",
"False",
")",
":",
"if",
"type",
"(",
"pks",
")",
"==",
"set",
":",
"pks",
"=",
"list",
"(",
"pks",
")",
"if",
"len",
"(",
"pks",
")",
"==",
"1",
":",
"# Optimization to not p... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisQuery.getOnlyFields | getOnlyFields - Gets only certain fields from a paticular primary key. For working on entire filter set, see allOnlyFields
@param pk <int> - Primary Key
@param fields list<str> - List of fields
@param cascadeFetch <bool> Default False, If True, all Foreign objects associated with this model
will be fe... | IndexedRedis/__init__.py | def getOnlyFields(self, pk, fields, cascadeFetch=False):
'''
getOnlyFields - Gets only certain fields from a paticular primary key. For working on entire filter set, see allOnlyFields
@param pk <int> - Primary Key
@param fields list<str> - List of fields
@param cascadeFetch <bool> Default False, If Tru... | def getOnlyFields(self, pk, fields, cascadeFetch=False):
'''
getOnlyFields - Gets only certain fields from a paticular primary key. For working on entire filter set, see allOnlyFields
@param pk <int> - Primary Key
@param fields list<str> - List of fields
@param cascadeFetch <bool> Default False, If Tru... | [
"getOnlyFields",
"-",
"Gets",
"only",
"certain",
"fields",
"from",
"a",
"paticular",
"primary",
"key",
".",
"For",
"working",
"on",
"entire",
"filter",
"set",
"see",
"allOnlyFields"
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1810-L1849 | [
"def",
"getOnlyFields",
"(",
"self",
",",
"pk",
",",
"fields",
",",
"cascadeFetch",
"=",
"False",
")",
":",
"conn",
"=",
"self",
".",
"_get_connection",
"(",
")",
"key",
"=",
"self",
".",
"_get_key_for_id",
"(",
"pk",
")",
"res",
"=",
"conn",
".",
"h... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisQuery.getMultipleOnlyFields | getMultipleOnlyFields - Gets only certain fields from a list of primary keys. For working on entire filter set, see allOnlyFields
@param pks list<str> - Primary Keys
@param fields list<str> - List of fields
@param cascadeFetch <bool> Default False, If True, all Foreign objects associated with this model
... | IndexedRedis/__init__.py | def getMultipleOnlyFields(self, pks, fields, cascadeFetch=False):
'''
getMultipleOnlyFields - Gets only certain fields from a list of primary keys. For working on entire filter set, see allOnlyFields
@param pks list<str> - Primary Keys
@param fields list<str> - List of fields
@param cascadeFetch <boo... | def getMultipleOnlyFields(self, pks, fields, cascadeFetch=False):
'''
getMultipleOnlyFields - Gets only certain fields from a list of primary keys. For working on entire filter set, see allOnlyFields
@param pks list<str> - Primary Keys
@param fields list<str> - List of fields
@param cascadeFetch <boo... | [
"getMultipleOnlyFields",
"-",
"Gets",
"only",
"certain",
"fields",
"from",
"a",
"list",
"of",
"primary",
"keys",
".",
"For",
"working",
"on",
"entire",
"filter",
"set",
"see",
"allOnlyFields"
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1851-L1913 | [
"def",
"getMultipleOnlyFields",
"(",
"self",
",",
"pks",
",",
"fields",
",",
"cascadeFetch",
"=",
"False",
")",
":",
"if",
"type",
"(",
"pks",
")",
"==",
"set",
":",
"pks",
"=",
"list",
"(",
"pks",
")",
"if",
"len",
"(",
"pks",
")",
"==",
"1",
":... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisQuery.reindex | reindex - Reindexes the objects matching current filterset. Use this if you add/remove a field to INDEXED_FIELDS.
NOTE - This will NOT remove entries from the old index if you change index type, or change decimalPlaces on a
IRFixedPointField. To correct these indexes, you'll need to run:
Model.... | IndexedRedis/__init__.py | def reindex(self):
'''
reindex - Reindexes the objects matching current filterset. Use this if you add/remove a field to INDEXED_FIELDS.
NOTE - This will NOT remove entries from the old index if you change index type, or change decimalPlaces on a
IRFixedPointField. To correct these indexes, you'll ne... | def reindex(self):
'''
reindex - Reindexes the objects matching current filterset. Use this if you add/remove a field to INDEXED_FIELDS.
NOTE - This will NOT remove entries from the old index if you change index type, or change decimalPlaces on a
IRFixedPointField. To correct these indexes, you'll ne... | [
"reindex",
"-",
"Reindexes",
"the",
"objects",
"matching",
"current",
"filterset",
".",
"Use",
"this",
"if",
"you",
"add",
"/",
"remove",
"a",
"field",
"to",
"INDEXED_FIELDS",
"."
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1936-L1949 | [
"def",
"reindex",
"(",
"self",
")",
":",
"objs",
"=",
"self",
".",
"all",
"(",
")",
"saver",
"=",
"IndexedRedisSave",
"(",
"self",
".",
"mdl",
")",
"saver",
".",
"reindex",
"(",
"objs",
")"
] | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisQuery.compat_convertHashedIndexes | compat_convertHashedIndexes - Reindex fields, used for when you change the propery "hashIndex" on one or more fields.
For each field, this will delete both the hash and unhashed keys to an object,
and then save a hashed or unhashed value, depending on that field's value for "hashIndex".
For an IndexedRedi... | IndexedRedis/__init__.py | def compat_convertHashedIndexes(self, fetchAll=True):
'''
compat_convertHashedIndexes - Reindex fields, used for when you change the propery "hashIndex" on one or more fields.
For each field, this will delete both the hash and unhashed keys to an object,
and then save a hashed or unhashed value, dependin... | def compat_convertHashedIndexes(self, fetchAll=True):
'''
compat_convertHashedIndexes - Reindex fields, used for when you change the propery "hashIndex" on one or more fields.
For each field, this will delete both the hash and unhashed keys to an object,
and then save a hashed or unhashed value, dependin... | [
"compat_convertHashedIndexes",
"-",
"Reindex",
"fields",
"used",
"for",
"when",
"you",
"change",
"the",
"propery",
"hashIndex",
"on",
"one",
"or",
"more",
"fields",
"."
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L1951-L1990 | [
"def",
"compat_convertHashedIndexes",
"(",
"self",
",",
"fetchAll",
"=",
"True",
")",
":",
"saver",
"=",
"IndexedRedisSave",
"(",
"self",
".",
"mdl",
")",
"if",
"fetchAll",
"is",
"True",
":",
"objs",
"=",
"self",
".",
"all",
"(",
")",
"saver",
".",
"co... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisSave.save | save - Save an object / objects associated with this model.
You probably want to just do object.save() instead of this, but to save multiple objects at once in a single transaction,
you can use:
MyModel.saver.save(myObjs)
@param obj <IndexedRedisModel or list<IndexedRedisModel> - The object ... | IndexedRedis/__init__.py | def save(self, obj, usePipeline=True, forceID=False, cascadeSave=True, conn=None):
'''
save - Save an object / objects associated with this model.
You probably want to just do object.save() instead of this, but to save multiple objects at once in a single transaction,
you can use:
MyModel.s... | def save(self, obj, usePipeline=True, forceID=False, cascadeSave=True, conn=None):
'''
save - Save an object / objects associated with this model.
You probably want to just do object.save() instead of this, but to save multiple objects at once in a single transaction,
you can use:
MyModel.s... | [
"save",
"-",
"Save",
"an",
"object",
"/",
"objects",
"associated",
"with",
"this",
"model",
".",
"You",
"probably",
"want",
"to",
"just",
"do",
"object",
".",
"save",
"()",
"instead",
"of",
"this",
"but",
"to",
"save",
"multiple",
"objects",
"at",
"once"... | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L2000-L2133 | [
"def",
"save",
"(",
"self",
",",
"obj",
",",
"usePipeline",
"=",
"True",
",",
"forceID",
"=",
"False",
",",
"cascadeSave",
"=",
"True",
",",
"conn",
"=",
"None",
")",
":",
"if",
"conn",
"is",
"None",
":",
"conn",
"=",
"self",
".",
"_get_connection",
... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisSave._doSave | _doSave - Internal function to save a single object. Don't call this directly.
Use "save" instead.
If a pipeline is provided, the operations (setting values, updating indexes, etc)
will be queued into that pipeline.
Otherwise, everything will be executed right away.
@param obj - ... | IndexedRedis/__init__.py | def _doSave(self, obj, isInsert, conn, pipeline=None):
'''
_doSave - Internal function to save a single object. Don't call this directly.
Use "save" instead.
If a pipeline is provided, the operations (setting values, updating indexes, etc)
will be queued into that pipeline.
Otherw... | def _doSave(self, obj, isInsert, conn, pipeline=None):
'''
_doSave - Internal function to save a single object. Don't call this directly.
Use "save" instead.
If a pipeline is provided, the operations (setting values, updating indexes, etc)
will be queued into that pipeline.
Otherw... | [
"_doSave",
"-",
"Internal",
"function",
"to",
"save",
"a",
"single",
"object",
".",
"Don",
"t",
"call",
"this",
"directly",
".",
"Use",
"save",
"instead",
"."
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L2145-L2198 | [
"def",
"_doSave",
"(",
"self",
",",
"obj",
",",
"isInsert",
",",
"conn",
",",
"pipeline",
"=",
"None",
")",
":",
"if",
"pipeline",
"is",
"None",
":",
"pipeline",
"=",
"conn",
"newDict",
"=",
"obj",
".",
"asDict",
"(",
"forStorage",
"=",
"True",
")",
... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisSave.reindex | reindex - Reindexes a given list of objects. Probably you want to do Model.objects.reindex() instead of this directly.
@param objs list<IndexedRedisModel> - List of objects to reindex
@param conn <redis.Redis or None> - Specific Redis connection or None to reuse | IndexedRedis/__init__.py | def reindex(self, objs, conn=None):
'''
reindex - Reindexes a given list of objects. Probably you want to do Model.objects.reindex() instead of this directly.
@param objs list<IndexedRedisModel> - List of objects to reindex
@param conn <redis.Redis or None> - Specific Redis connection or None to reuse
'''... | def reindex(self, objs, conn=None):
'''
reindex - Reindexes a given list of objects. Probably you want to do Model.objects.reindex() instead of this directly.
@param objs list<IndexedRedisModel> - List of objects to reindex
@param conn <redis.Redis or None> - Specific Redis connection or None to reuse
'''... | [
"reindex",
"-",
"Reindexes",
"a",
"given",
"list",
"of",
"objects",
".",
"Probably",
"you",
"want",
"to",
"do",
"Model",
".",
"objects",
".",
"reindex",
"()",
"instead",
"of",
"this",
"directly",
"."
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L2201-L2220 | [
"def",
"reindex",
"(",
"self",
",",
"objs",
",",
"conn",
"=",
"None",
")",
":",
"if",
"conn",
"is",
"None",
":",
"conn",
"=",
"self",
".",
"_get_connection",
"(",
")",
"pipeline",
"=",
"conn",
".",
"pipeline",
"(",
")",
"objDicts",
"=",
"[",
"obj",... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisSave.compat_convertHashedIndexes | compat_convertHashedIndexes - Reindex all fields for the provided objects, where the field value is hashed or not.
If the field is unhashable, do not allow.
NOTE: This works one object at a time. It is intended to be used while your application is offline,
as it doesn't make sense to be changing your model ... | IndexedRedis/__init__.py | def compat_convertHashedIndexes(self, objs, conn=None):
'''
compat_convertHashedIndexes - Reindex all fields for the provided objects, where the field value is hashed or not.
If the field is unhashable, do not allow.
NOTE: This works one object at a time. It is intended to be used while your application is ... | def compat_convertHashedIndexes(self, objs, conn=None):
'''
compat_convertHashedIndexes - Reindex all fields for the provided objects, where the field value is hashed or not.
If the field is unhashable, do not allow.
NOTE: This works one object at a time. It is intended to be used while your application is ... | [
"compat_convertHashedIndexes",
"-",
"Reindex",
"all",
"fields",
"for",
"the",
"provided",
"objects",
"where",
"the",
"field",
"value",
"is",
"hashed",
"or",
"not",
".",
"If",
"the",
"field",
"is",
"unhashable",
"do",
"not",
"allow",
"."
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L2222-L2284 | [
"def",
"compat_convertHashedIndexes",
"(",
"self",
",",
"objs",
",",
"conn",
"=",
"None",
")",
":",
"if",
"conn",
"is",
"None",
":",
"conn",
"=",
"self",
".",
"_get_connection",
"(",
")",
"# Do one pipeline per object.",
"# XXX: Maybe we should do the whole thing i... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisDelete.deleteOne | deleteOne - Delete one object
@param obj - object to delete
@param conn - Connection to reuse, or None
@return - number of items deleted (0 or 1) | IndexedRedis/__init__.py | def deleteOne(self, obj, conn=None):
'''
deleteOne - Delete one object
@param obj - object to delete
@param conn - Connection to reuse, or None
@return - number of items deleted (0 or 1)
'''
if not getattr(obj, '_id', None):
return 0
if conn is None:
conn = self._get_connection()
pipelin... | def deleteOne(self, obj, conn=None):
'''
deleteOne - Delete one object
@param obj - object to delete
@param conn - Connection to reuse, or None
@return - number of items deleted (0 or 1)
'''
if not getattr(obj, '_id', None):
return 0
if conn is None:
conn = self._get_connection()
pipelin... | [
"deleteOne",
"-",
"Delete",
"one",
"object"
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L2294-L2324 | [
"def",
"deleteOne",
"(",
"self",
",",
"obj",
",",
"conn",
"=",
"None",
")",
":",
"if",
"not",
"getattr",
"(",
"obj",
",",
"'_id'",
",",
"None",
")",
":",
"return",
"0",
"if",
"conn",
"is",
"None",
":",
"conn",
"=",
"self",
".",
"_get_connection",
... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisDelete.deleteByPk | deleteByPk - Delete object associated with given primary key | IndexedRedis/__init__.py | def deleteByPk(self, pk):
'''
deleteByPk - Delete object associated with given primary key
'''
obj = self.mdl.objects.getOnlyIndexedFields(pk)
if not obj:
return 0
return self.deleteOne(obj) | def deleteByPk(self, pk):
'''
deleteByPk - Delete object associated with given primary key
'''
obj = self.mdl.objects.getOnlyIndexedFields(pk)
if not obj:
return 0
return self.deleteOne(obj) | [
"deleteByPk",
"-",
"Delete",
"object",
"associated",
"with",
"given",
"primary",
"key"
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L2326-L2333 | [
"def",
"deleteByPk",
"(",
"self",
",",
"pk",
")",
":",
"obj",
"=",
"self",
".",
"mdl",
".",
"objects",
".",
"getOnlyIndexedFields",
"(",
"pk",
")",
"if",
"not",
"obj",
":",
"return",
"0",
"return",
"self",
".",
"deleteOne",
"(",
"obj",
")"
] | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisDelete.deleteMultiple | deleteMultiple - Delete multiple objects
@param objs - List of objects
@return - Number of objects deleted | IndexedRedis/__init__.py | def deleteMultiple(self, objs):
'''
deleteMultiple - Delete multiple objects
@param objs - List of objects
@return - Number of objects deleted
'''
conn = self._get_connection()
pipeline = conn.pipeline()
numDeleted = 0
for obj in objs:
numDeleted += self.deleteOne(obj, pipeline)
pipeline.... | def deleteMultiple(self, objs):
'''
deleteMultiple - Delete multiple objects
@param objs - List of objects
@return - Number of objects deleted
'''
conn = self._get_connection()
pipeline = conn.pipeline()
numDeleted = 0
for obj in objs:
numDeleted += self.deleteOne(obj, pipeline)
pipeline.... | [
"deleteMultiple",
"-",
"Delete",
"multiple",
"objects"
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L2335-L2353 | [
"def",
"deleteMultiple",
"(",
"self",
",",
"objs",
")",
":",
"conn",
"=",
"self",
".",
"_get_connection",
"(",
")",
"pipeline",
"=",
"conn",
".",
"pipeline",
"(",
")",
"numDeleted",
"=",
"0",
"for",
"obj",
"in",
"objs",
":",
"numDeleted",
"+=",
"self",... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisDelete.deleteMultipleByPks | deleteMultipleByPks - Delete multiple objects given their primary keys
@param pks - List of primary keys
@return - Number of objects deleted | IndexedRedis/__init__.py | def deleteMultipleByPks(self, pks):
'''
deleteMultipleByPks - Delete multiple objects given their primary keys
@param pks - List of primary keys
@return - Number of objects deleted
'''
if type(pks) == set:
pks = list(pks)
if len(pks) == 1:
return self.deleteByPk(pks[0])
objs = self.mdl.obje... | def deleteMultipleByPks(self, pks):
'''
deleteMultipleByPks - Delete multiple objects given their primary keys
@param pks - List of primary keys
@return - Number of objects deleted
'''
if type(pks) == set:
pks = list(pks)
if len(pks) == 1:
return self.deleteByPk(pks[0])
objs = self.mdl.obje... | [
"deleteMultipleByPks",
"-",
"Delete",
"multiple",
"objects",
"given",
"their",
"primary",
"keys"
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L2355-L2370 | [
"def",
"deleteMultipleByPks",
"(",
"self",
",",
"pks",
")",
":",
"if",
"type",
"(",
"pks",
")",
"==",
"set",
":",
"pks",
"=",
"list",
"(",
"pks",
")",
"if",
"len",
"(",
"pks",
")",
"==",
"1",
":",
"return",
"self",
".",
"deleteByPk",
"(",
"pks",
... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | IndexedRedisDelete.destroyModel | destroyModel - Destroy everything related to this model in one swoop.
Same effect as Model.reset([]) - Except slightly more efficient.
This function is called if you do Model.objects.delete() with no filters set.
@return - Number of keys deleted. Note, this is NOT number of models deleted, but total... | IndexedRedis/__init__.py | def destroyModel(self):
'''
destroyModel - Destroy everything related to this model in one swoop.
Same effect as Model.reset([]) - Except slightly more efficient.
This function is called if you do Model.objects.delete() with no filters set.
@return - Number of keys deleted. Note, this is NOT nu... | def destroyModel(self):
'''
destroyModel - Destroy everything related to this model in one swoop.
Same effect as Model.reset([]) - Except slightly more efficient.
This function is called if you do Model.objects.delete() with no filters set.
@return - Number of keys deleted. Note, this is NOT nu... | [
"destroyModel",
"-",
"Destroy",
"everything",
"related",
"to",
"this",
"model",
"in",
"one",
"swoop",
"."
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/__init__.py#L2372-L2393 | [
"def",
"destroyModel",
"(",
"self",
")",
":",
"conn",
"=",
"self",
".",
"_get_connection",
"(",
")",
"pipeline",
"=",
"conn",
".",
"pipeline",
"(",
")",
"pipeline",
".",
"eval",
"(",
"\"\"\"\n\t\tlocal matchingKeys = redis.call('KEYS', '%s*')\n\n\t\tfor _,key in ipair... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | string | Returns a blox template from an html string | blox/compile.py | def string(html, start_on=None, ignore=(), use_short=True, **queries):
'''Returns a blox template from an html string'''
if use_short:
html = grow_short(html)
return _to_template(fromstring(html), start_on=start_on,
ignore=ignore, **queries) | def string(html, start_on=None, ignore=(), use_short=True, **queries):
'''Returns a blox template from an html string'''
if use_short:
html = grow_short(html)
return _to_template(fromstring(html), start_on=start_on,
ignore=ignore, **queries) | [
"Returns",
"a",
"blox",
"template",
"from",
"an",
"html",
"string"
] | timothycrosley/blox | python | https://github.com/timothycrosley/blox/blob/dc410783d2a2ecad918d1e19c6ee000d20e42d35/blox/compile.py#L61-L66 | [
"def",
"string",
"(",
"html",
",",
"start_on",
"=",
"None",
",",
"ignore",
"=",
"(",
")",
",",
"use_short",
"=",
"True",
",",
"*",
"*",
"queries",
")",
":",
"if",
"use_short",
":",
"html",
"=",
"grow_short",
"(",
"html",
")",
"return",
"_to_template"... | dc410783d2a2ecad918d1e19c6ee000d20e42d35 |
valid | file | Returns a blox template from a file stream object | blox/compile.py | def file(file_object, start_on=None, ignore=(), use_short=True, **queries):
'''Returns a blox template from a file stream object'''
return string(file_object.read(), start_on=start_on, ignore=ignore, use_short=use_short, **queries) | def file(file_object, start_on=None, ignore=(), use_short=True, **queries):
'''Returns a blox template from a file stream object'''
return string(file_object.read(), start_on=start_on, ignore=ignore, use_short=use_short, **queries) | [
"Returns",
"a",
"blox",
"template",
"from",
"a",
"file",
"stream",
"object"
] | timothycrosley/blox | python | https://github.com/timothycrosley/blox/blob/dc410783d2a2ecad918d1e19c6ee000d20e42d35/blox/compile.py#L69-L71 | [
"def",
"file",
"(",
"file_object",
",",
"start_on",
"=",
"None",
",",
"ignore",
"=",
"(",
")",
",",
"use_short",
"=",
"True",
",",
"*",
"*",
"queries",
")",
":",
"return",
"string",
"(",
"file_object",
".",
"read",
"(",
")",
",",
"start_on",
"=",
"... | dc410783d2a2ecad918d1e19c6ee000d20e42d35 |
valid | filename | Returns a blox template from a valid file path | blox/compile.py | def filename(file_name, start_on=None, ignore=(), use_short=True, **queries):
'''Returns a blox template from a valid file path'''
with open(file_name) as template_file:
return file(template_file, start_on=start_on, ignore=ignore, use_short=use_short, **queries) | def filename(file_name, start_on=None, ignore=(), use_short=True, **queries):
'''Returns a blox template from a valid file path'''
with open(file_name) as template_file:
return file(template_file, start_on=start_on, ignore=ignore, use_short=use_short, **queries) | [
"Returns",
"a",
"blox",
"template",
"from",
"a",
"valid",
"file",
"path"
] | timothycrosley/blox | python | https://github.com/timothycrosley/blox/blob/dc410783d2a2ecad918d1e19c6ee000d20e42d35/blox/compile.py#L74-L77 | [
"def",
"filename",
"(",
"file_name",
",",
"start_on",
"=",
"None",
",",
"ignore",
"=",
"(",
")",
",",
"use_short",
"=",
"True",
",",
"*",
"*",
"queries",
")",
":",
"with",
"open",
"(",
"file_name",
")",
"as",
"template_file",
":",
"return",
"file",
"... | dc410783d2a2ecad918d1e19c6ee000d20e42d35 |
valid | Marshal.create_from_string | Deserializes a new instance from a string.
This is a convenience method that creates a StringIO object and calls create_instance_from_stream(). | src/infi/instruct/base.py | def create_from_string(self, string, context=EMPTY_CONTEXT, *args, **kwargs):
"""
Deserializes a new instance from a string.
This is a convenience method that creates a StringIO object and calls create_instance_from_stream().
"""
if not PY2 and not isinstance(string, bytes):
... | def create_from_string(self, string, context=EMPTY_CONTEXT, *args, **kwargs):
"""
Deserializes a new instance from a string.
This is a convenience method that creates a StringIO object and calls create_instance_from_stream().
"""
if not PY2 and not isinstance(string, bytes):
... | [
"Deserializes",
"a",
"new",
"instance",
"from",
"a",
"string",
".",
"This",
"is",
"a",
"convenience",
"method",
"that",
"creates",
"a",
"StringIO",
"object",
"and",
"calls",
"create_instance_from_stream",
"()",
"."
] | Infinidat/infi.instruct | python | https://github.com/Infinidat/infi.instruct/blob/93b1ab725cfd8d13227960dbf9e3ca1e7f9eebe8/src/infi/instruct/base.py#L124-L135 | [
"def",
"create_from_string",
"(",
"self",
",",
"string",
",",
"context",
"=",
"EMPTY_CONTEXT",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"PY2",
"and",
"not",
"isinstance",
"(",
"string",
",",
"bytes",
")",
":",
"raise",
"TypeErr... | 93b1ab725cfd8d13227960dbf9e3ca1e7f9eebe8 |
valid | require | Decorator for managing chained dependencies of different class
properties. The @require decorator allows developers to specify
that a function call must be operated on before another property
or function call is accessed, so that data and processing for an
entire class can be evaluated in a lazy way (i.... | gems/decorators.py | def require(method):
"""
Decorator for managing chained dependencies of different class
properties. The @require decorator allows developers to specify
that a function call must be operated on before another property
or function call is accessed, so that data and processing for an
entire class c... | def require(method):
"""
Decorator for managing chained dependencies of different class
properties. The @require decorator allows developers to specify
that a function call must be operated on before another property
or function call is accessed, so that data and processing for an
entire class c... | [
"Decorator",
"for",
"managing",
"chained",
"dependencies",
"of",
"different",
"class",
"properties",
".",
"The",
"@require",
"decorator",
"allows",
"developers",
"to",
"specify",
"that",
"a",
"function",
"call",
"must",
"be",
"operated",
"on",
"before",
"another",... | bprinty/gems | python | https://github.com/bprinty/gems/blob/3ff76407af0e71621dada744cd964611e998699c/gems/decorators.py#L19-L67 | [
"def",
"require",
"(",
"method",
")",
":",
"def",
"decorator",
"(",
"func",
")",
":",
"@",
"wraps",
"(",
"func",
")",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# throw exception if input class doesn't have requirement",
"if",
... | 3ff76407af0e71621dada744cd964611e998699c |
valid | exception | Wrap function/method with specific exception if any
exception occurs during function execution.
Args:
exception (Exception): Exception to re-cast error as.
Examples:
>>> from gems import exception
>>>
>>> class MyCustomException(Exception):
>>> pass
>>>... | gems/decorators.py | def exception(exception):
"""
Wrap function/method with specific exception if any
exception occurs during function execution.
Args:
exception (Exception): Exception to re-cast error as.
Examples:
>>> from gems import exception
>>>
>>> class MyCustomException(Except... | def exception(exception):
"""
Wrap function/method with specific exception if any
exception occurs during function execution.
Args:
exception (Exception): Exception to re-cast error as.
Examples:
>>> from gems import exception
>>>
>>> class MyCustomException(Except... | [
"Wrap",
"function",
"/",
"method",
"with",
"specific",
"exception",
"if",
"any",
"exception",
"occurs",
"during",
"function",
"execution",
".",
"Args",
":",
"exception",
"(",
"Exception",
")",
":",
"Exception",
"to",
"re",
"-",
"cast",
"error",
"as",
"."
] | bprinty/gems | python | https://github.com/bprinty/gems/blob/3ff76407af0e71621dada744cd964611e998699c/gems/decorators.py#L119-L153 | [
"def",
"exception",
"(",
"exception",
")",
":",
"def",
"decorator",
"(",
"func",
")",
":",
"@",
"wraps",
"(",
"func",
")",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"return",
"func",
"(",
"*",
"args",
",",... | 3ff76407af0e71621dada744cd964611e998699c |
valid | keywords | Accumulate all dictionary and named arguments as
keyword argument dictionary. This is generally useful for
functions that try to automatically resolve inputs.
Examples:
>>> @keywords
>>> def test(*args, **kwargs):
>>> return kwargs
>>>
>>> print test({'one': 1}, ... | gems/decorators.py | def keywords(func):
"""
Accumulate all dictionary and named arguments as
keyword argument dictionary. This is generally useful for
functions that try to automatically resolve inputs.
Examples:
>>> @keywords
>>> def test(*args, **kwargs):
>>> return kwargs
>>>
... | def keywords(func):
"""
Accumulate all dictionary and named arguments as
keyword argument dictionary. This is generally useful for
functions that try to automatically resolve inputs.
Examples:
>>> @keywords
>>> def test(*args, **kwargs):
>>> return kwargs
>>>
... | [
"Accumulate",
"all",
"dictionary",
"and",
"named",
"arguments",
"as",
"keyword",
"argument",
"dictionary",
".",
"This",
"is",
"generally",
"useful",
"for",
"functions",
"that",
"try",
"to",
"automatically",
"resolve",
"inputs",
"."
] | bprinty/gems | python | https://github.com/bprinty/gems/blob/3ff76407af0e71621dada744cd964611e998699c/gems/decorators.py#L158-L181 | [
"def",
"keywords",
"(",
"func",
")",
":",
"@",
"wraps",
"(",
"func",
")",
"def",
"decorator",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"idx",
"=",
"0",
"if",
"inspect",
".",
"ismethod",
"(",
"func",
")",
"else",
"1",
"if",
"len",
"(... | 3ff76407af0e71621dada744cd964611e998699c |
valid | IRCompressedField.getCompressMod | getCompressMod - Return the module used for compression on this field
@return <module> - The module for compression | IndexedRedis/fields/compressed.py | def getCompressMod(self):
'''
getCompressMod - Return the module used for compression on this field
@return <module> - The module for compression
'''
if self.compressMode == COMPRESS_MODE_ZLIB:
return zlib
if self.compressMode == COMPRESS_MODE_BZ2:
return bz2
if self.compressMode == COMPRESS_MODE... | def getCompressMod(self):
'''
getCompressMod - Return the module used for compression on this field
@return <module> - The module for compression
'''
if self.compressMode == COMPRESS_MODE_ZLIB:
return zlib
if self.compressMode == COMPRESS_MODE_BZ2:
return bz2
if self.compressMode == COMPRESS_MODE... | [
"getCompressMod",
"-",
"Return",
"the",
"module",
"used",
"for",
"compression",
"on",
"this",
"field"
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/fields/compressed.py#L103-L137 | [
"def",
"getCompressMod",
"(",
"self",
")",
":",
"if",
"self",
".",
"compressMode",
"==",
"COMPRESS_MODE_ZLIB",
":",
"return",
"zlib",
"if",
"self",
".",
"compressMode",
"==",
"COMPRESS_MODE_BZ2",
":",
"return",
"bz2",
"if",
"self",
".",
"compressMode",
"==",
... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | Text.output | Outputs the set text | blox/text.py | def output(self, to=None, *args, **kwargs):
'''Outputs the set text'''
to.write(str(self._value)) | def output(self, to=None, *args, **kwargs):
'''Outputs the set text'''
to.write(str(self._value)) | [
"Outputs",
"the",
"set",
"text"
] | timothycrosley/blox | python | https://github.com/timothycrosley/blox/blob/dc410783d2a2ecad918d1e19c6ee000d20e42d35/blox/text.py#L49-L51 | [
"def",
"output",
"(",
"self",
",",
"to",
"=",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"to",
".",
"write",
"(",
"str",
"(",
"self",
".",
"_value",
")",
")"
] | dc410783d2a2ecad918d1e19c6ee000d20e42d35 |
valid | IRUnicodeField.toBytes | toBytes - Convert a value to bytes using the encoding specified on this field
@param value <str> - The field to convert to bytes
@return <bytes> - The object encoded using the codec specified on this field.
NOTE: This method may go away. | IndexedRedis/fields/unicode_field.py | def toBytes(self, value):
'''
toBytes - Convert a value to bytes using the encoding specified on this field
@param value <str> - The field to convert to bytes
@return <bytes> - The object encoded using the codec specified on this field.
NOTE: This method may go away.
'''
if type(value) == bytes:
... | def toBytes(self, value):
'''
toBytes - Convert a value to bytes using the encoding specified on this field
@param value <str> - The field to convert to bytes
@return <bytes> - The object encoded using the codec specified on this field.
NOTE: This method may go away.
'''
if type(value) == bytes:
... | [
"toBytes",
"-",
"Convert",
"a",
"value",
"to",
"bytes",
"using",
"the",
"encoding",
"specified",
"on",
"this",
"field"
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/fields/unicode_field.py#L72-L84 | [
"def",
"toBytes",
"(",
"self",
",",
"value",
")",
":",
"if",
"type",
"(",
"value",
")",
"==",
"bytes",
":",
"return",
"value",
"return",
"value",
".",
"encode",
"(",
"self",
".",
"getEncoding",
"(",
")",
")"
] | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | deprecatedMessage | deprecatedMessage - Print a deprecated messsage (unless they are toggled off). Will print a message only once (based on "key")
@param msg <str> - Deprecated message to possibly print
@param key <anything> - A key that is specific to this message.
If None is provided (default), one will be generated from the... | IndexedRedis/deprecated.py | def deprecatedMessage(msg, key=None, printStack=False):
'''
deprecatedMessage - Print a deprecated messsage (unless they are toggled off). Will print a message only once (based on "key")
@param msg <str> - Deprecated message to possibly print
@param key <anything> - A key that is specific to this message.
... | def deprecatedMessage(msg, key=None, printStack=False):
'''
deprecatedMessage - Print a deprecated messsage (unless they are toggled off). Will print a message only once (based on "key")
@param msg <str> - Deprecated message to possibly print
@param key <anything> - A key that is specific to this message.
... | [
"deprecatedMessage",
"-",
"Print",
"a",
"deprecated",
"messsage",
"(",
"unless",
"they",
"are",
"toggled",
"off",
")",
".",
"Will",
"print",
"a",
"message",
"only",
"once",
"(",
"based",
"on",
"key",
")"
] | kata198/indexedredis | python | https://github.com/kata198/indexedredis/blob/f9c85adcf5218dac25acb06eedc63fc2950816fa/IndexedRedis/deprecated.py#L33-L62 | [
"def",
"deprecatedMessage",
"(",
"msg",
",",
"key",
"=",
"None",
",",
"printStack",
"=",
"False",
")",
":",
"if",
"__deprecatedMessagesEnabled",
"is",
"False",
":",
"return",
"if",
"not",
"_alreadyWarned",
":",
"# First warning, let them know how to disable. ",
"sys... | f9c85adcf5218dac25acb06eedc63fc2950816fa |
valid | ConstField | This macro can be used in several methods:
>>> ConstField("foo", 5, UBInt8)
This created a constant field called ``foo`` with a value of 5 and is serialized/deserialized using UBInt8.
>>> ConstField("foo", MyStruct(my_field=1, my_other_field=2))
This time ``foo`` is set with the ``MyStruct`` instanc... | src/infi/instruct/struct_macros.py | def ConstField(name, value, marshal=None):
"""
This macro can be used in several methods:
>>> ConstField("foo", 5, UBInt8)
This created a constant field called ``foo`` with a value of 5 and is serialized/deserialized using UBInt8.
>>> ConstField("foo", MyStruct(my_field=1, my_other_field=2))
... | def ConstField(name, value, marshal=None):
"""
This macro can be used in several methods:
>>> ConstField("foo", 5, UBInt8)
This created a constant field called ``foo`` with a value of 5 and is serialized/deserialized using UBInt8.
>>> ConstField("foo", MyStruct(my_field=1, my_other_field=2))
... | [
"This",
"macro",
"can",
"be",
"used",
"in",
"several",
"methods",
":"
] | Infinidat/infi.instruct | python | https://github.com/Infinidat/infi.instruct/blob/93b1ab725cfd8d13227960dbf9e3ca1e7f9eebe8/src/infi/instruct/struct_macros.py#L14-L39 | [
"def",
"ConstField",
"(",
"name",
",",
"value",
",",
"marshal",
"=",
"None",
")",
":",
"if",
"marshal",
"is",
"None",
":",
"marshal",
"=",
"value",
"if",
"isinstance",
"(",
"marshal",
",",
"Struct",
")",
":",
"marshal",
"=",
"type",
"(",
"marshal",
"... | 93b1ab725cfd8d13227960dbf9e3ca1e7f9eebe8 |
valid | keep_kwargs_partial | Like functools.partial but instead of using the new kwargs, keeps the old ones. | src/infi/instruct/utils/kwargs.py | def keep_kwargs_partial(func, *args, **keywords):
"""Like functools.partial but instead of using the new kwargs, keeps the old ones."""
def newfunc(*fargs, **fkeywords):
newkeywords = fkeywords.copy()
newkeywords.update(keywords)
return func(*(args + fargs), **newkeywords)
newfunc.fu... | def keep_kwargs_partial(func, *args, **keywords):
"""Like functools.partial but instead of using the new kwargs, keeps the old ones."""
def newfunc(*fargs, **fkeywords):
newkeywords = fkeywords.copy()
newkeywords.update(keywords)
return func(*(args + fargs), **newkeywords)
newfunc.fu... | [
"Like",
"functools",
".",
"partial",
"but",
"instead",
"of",
"using",
"the",
"new",
"kwargs",
"keeps",
"the",
"old",
"ones",
"."
] | Infinidat/infi.instruct | python | https://github.com/Infinidat/infi.instruct/blob/93b1ab725cfd8d13227960dbf9e3ca1e7f9eebe8/src/infi/instruct/utils/kwargs.py#L1-L10 | [
"def",
"keep_kwargs_partial",
"(",
"func",
",",
"*",
"args",
",",
"*",
"*",
"keywords",
")",
":",
"def",
"newfunc",
"(",
"*",
"fargs",
",",
"*",
"*",
"fkeywords",
")",
":",
"newkeywords",
"=",
"fkeywords",
".",
"copy",
"(",
")",
"newkeywords",
".",
"... | 93b1ab725cfd8d13227960dbf9e3ca1e7f9eebe8 |
valid | NoteItem.dump | Serializes this NoteItem to a byte-stream and writes it to the
file-like object `stream`. `contentType` and `version` must be one
of the supported content-types, and if not specified, will default
to ``text/plain``. | pysyncml/items/note.py | def dump(self, stream, contentType=None, version=None):
'''
Serializes this NoteItem to a byte-stream and writes it to the
file-like object `stream`. `contentType` and `version` must be one
of the supported content-types, and if not specified, will default
to ``text/plain``.
'''
if contentTy... | def dump(self, stream, contentType=None, version=None):
'''
Serializes this NoteItem to a byte-stream and writes it to the
file-like object `stream`. `contentType` and `version` must be one
of the supported content-types, and if not specified, will default
to ``text/plain``.
'''
if contentTy... | [
"Serializes",
"this",
"NoteItem",
"to",
"a",
"byte",
"-",
"stream",
"and",
"writes",
"it",
"to",
"the",
"file",
"-",
"like",
"object",
"stream",
".",
"contentType",
"and",
"version",
"must",
"be",
"one",
"of",
"the",
"supported",
"content",
"-",
"types",
... | metagriffin/pysyncml | python | https://github.com/metagriffin/pysyncml/blob/a583fe0dbffa8b24e5a3e151524f84868b2382bb/pysyncml/items/note.py#L66-L89 | [
"def",
"dump",
"(",
"self",
",",
"stream",
",",
"contentType",
"=",
"None",
",",
"version",
"=",
"None",
")",
":",
"if",
"contentType",
"is",
"None",
"or",
"contentType",
"==",
"constants",
".",
"TYPE_TEXT_PLAIN",
":",
"stream",
".",
"write",
"(",
"self"... | a583fe0dbffa8b24e5a3e151524f84868b2382bb |
valid | NoteItem.load | Reverses the effects of the :meth:`dump` method, creating a NoteItem
from the specified file-like `stream` object. | pysyncml/items/note.py | def load(cls, stream, contentType=None, version=None):
'''
Reverses the effects of the :meth:`dump` method, creating a NoteItem
from the specified file-like `stream` object.
'''
if contentType is None or contentType == constants.TYPE_TEXT_PLAIN:
data = stream.read()
name = data.split('\n... | def load(cls, stream, contentType=None, version=None):
'''
Reverses the effects of the :meth:`dump` method, creating a NoteItem
from the specified file-like `stream` object.
'''
if contentType is None or contentType == constants.TYPE_TEXT_PLAIN:
data = stream.read()
name = data.split('\n... | [
"Reverses",
"the",
"effects",
"of",
"the",
":",
"meth",
":",
"dump",
"method",
"creating",
"a",
"NoteItem",
"from",
"the",
"specified",
"file",
"-",
"like",
"stream",
"object",
"."
] | metagriffin/pysyncml | python | https://github.com/metagriffin/pysyncml/blob/a583fe0dbffa8b24e5a3e151524f84868b2382bb/pysyncml/items/note.py#L93-L112 | [
"def",
"load",
"(",
"cls",
",",
"stream",
",",
"contentType",
"=",
"None",
",",
"version",
"=",
"None",
")",
":",
"if",
"contentType",
"is",
"None",
"or",
"contentType",
"==",
"constants",
".",
"TYPE_TEXT_PLAIN",
":",
"data",
"=",
"stream",
".",
"read",
... | a583fe0dbffa8b24e5a3e151524f84868b2382bb |
valid | remote_jupyter_proxy_url | Callable to configure Bokeh's show method when a proxy must be
configured.
If port is None we're asking about the URL
for the origin header. | astropixie-widgets/astropixie_widgets/config.py | def remote_jupyter_proxy_url(port):
"""
Callable to configure Bokeh's show method when a proxy must be
configured.
If port is None we're asking about the URL
for the origin header.
"""
base_url = os.environ['EXTERNAL_URL']
host = urllib.parse.urlparse(base_url).netloc
# If port is ... | def remote_jupyter_proxy_url(port):
"""
Callable to configure Bokeh's show method when a proxy must be
configured.
If port is None we're asking about the URL
for the origin header.
"""
base_url = os.environ['EXTERNAL_URL']
host = urllib.parse.urlparse(base_url).netloc
# If port is ... | [
"Callable",
"to",
"configure",
"Bokeh",
"s",
"show",
"method",
"when",
"a",
"proxy",
"must",
"be",
"configured",
"."
] | lsst-epo/vela | python | https://github.com/lsst-epo/vela/blob/8e17ebec509be5c3cc2063f4645dfe9e26b49c18/astropixie-widgets/astropixie_widgets/config.py#L10-L31 | [
"def",
"remote_jupyter_proxy_url",
"(",
"port",
")",
":",
"base_url",
"=",
"os",
".",
"environ",
"[",
"'EXTERNAL_URL'",
"]",
"host",
"=",
"urllib",
".",
"parse",
".",
"urlparse",
"(",
"base_url",
")",
".",
"netloc",
"# If port is None we're asking for the URL orig... | 8e17ebec509be5c3cc2063f4645dfe9e26b49c18 |
valid | setup_notebook | Called at the start of notebook execution to setup the environment.
This will configure bokeh, and setup the logging library to be
reasonable. | astropixie-widgets/astropixie_widgets/config.py | def setup_notebook(debug=False):
"""Called at the start of notebook execution to setup the environment.
This will configure bokeh, and setup the logging library to be
reasonable."""
output_notebook(INLINE, hide_banner=True)
if debug:
_setup_logging(logging.DEBUG)
logging.debug('Runn... | def setup_notebook(debug=False):
"""Called at the start of notebook execution to setup the environment.
This will configure bokeh, and setup the logging library to be
reasonable."""
output_notebook(INLINE, hide_banner=True)
if debug:
_setup_logging(logging.DEBUG)
logging.debug('Runn... | [
"Called",
"at",
"the",
"start",
"of",
"notebook",
"execution",
"to",
"setup",
"the",
"environment",
"."
] | lsst-epo/vela | python | https://github.com/lsst-epo/vela/blob/8e17ebec509be5c3cc2063f4645dfe9e26b49c18/astropixie-widgets/astropixie_widgets/config.py#L73-L91 | [
"def",
"setup_notebook",
"(",
"debug",
"=",
"False",
")",
":",
"output_notebook",
"(",
"INLINE",
",",
"hide_banner",
"=",
"True",
")",
"if",
"debug",
":",
"_setup_logging",
"(",
"logging",
".",
"DEBUG",
")",
"logging",
".",
"debug",
"(",
"'Running notebook i... | 8e17ebec509be5c3cc2063f4645dfe9e26b49c18 |
valid | overview | Creates a overview of the hosts per range. | jackal/scripts/ranges.py | def overview():
"""
Creates a overview of the hosts per range.
"""
range_search = RangeSearch()
ranges = range_search.get_ranges()
if ranges:
formatted_ranges = []
tags_lookup = {}
for r in ranges:
formatted_ranges.append({'mask': r.range})
tag... | def overview():
"""
Creates a overview of the hosts per range.
"""
range_search = RangeSearch()
ranges = range_search.get_ranges()
if ranges:
formatted_ranges = []
tags_lookup = {}
for r in ranges:
formatted_ranges.append({'mask': r.range})
tag... | [
"Creates",
"a",
"overview",
"of",
"the",
"hosts",
"per",
"range",
"."
] | mwgielen/jackal | python | https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/ranges.py#L30-L51 | [
"def",
"overview",
"(",
")",
":",
"range_search",
"=",
"RangeSearch",
"(",
")",
"ranges",
"=",
"range_search",
".",
"get_ranges",
"(",
")",
"if",
"ranges",
":",
"formatted_ranges",
"=",
"[",
"]",
"tags_lookup",
"=",
"{",
"}",
"for",
"r",
"in",
"ranges",
... | 7fe62732eb5194b7246215d5277fb37c398097bf |
valid | resource_qualifier | Split a resource in (filename, directory) tuple with taking care of external resources
:param resource: A file path or a URI
:return: (Filename, Directory) for files, (URI, None) for URI | flask_nemo/common.py | def resource_qualifier(resource):
""" Split a resource in (filename, directory) tuple with taking care of external resources
:param resource: A file path or a URI
:return: (Filename, Directory) for files, (URI, None) for URI
"""
if resource.startswith("//") or resource.startswith("http"):
r... | def resource_qualifier(resource):
""" Split a resource in (filename, directory) tuple with taking care of external resources
:param resource: A file path or a URI
:return: (Filename, Directory) for files, (URI, None) for URI
"""
if resource.startswith("//") or resource.startswith("http"):
r... | [
"Split",
"a",
"resource",
"in",
"(",
"filename",
"directory",
")",
"tuple",
"with",
"taking",
"care",
"of",
"external",
"resources"
] | Capitains/flask-capitains-nemo | python | https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/common.py#L12-L21 | [
"def",
"resource_qualifier",
"(",
"resource",
")",
":",
"if",
"resource",
".",
"startswith",
"(",
"\"//\"",
")",
"or",
"resource",
".",
"startswith",
"(",
"\"http\"",
")",
":",
"return",
"resource",
",",
"None",
"else",
":",
"return",
"reversed",
"(",
"op"... | 8d91f2c05b925a6c8ea8c997baf698c87257bc58 |
valid | create_hierarchy | Create an OrderedDict
:param hierarchy: a dictionary
:param level: single key
:return: deeper dictionary | flask_nemo/common.py | def create_hierarchy(hierarchy, level):
"""Create an OrderedDict
:param hierarchy: a dictionary
:param level: single key
:return: deeper dictionary
"""
if level not in hierarchy:
hierarchy[level] = OrderedDict()
return hierarchy[level] | def create_hierarchy(hierarchy, level):
"""Create an OrderedDict
:param hierarchy: a dictionary
:param level: single key
:return: deeper dictionary
"""
if level not in hierarchy:
hierarchy[level] = OrderedDict()
return hierarchy[level] | [
"Create",
"an",
"OrderedDict"
] | Capitains/flask-capitains-nemo | python | https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/common.py#L56-L65 | [
"def",
"create_hierarchy",
"(",
"hierarchy",
",",
"level",
")",
":",
"if",
"level",
"not",
"in",
"hierarchy",
":",
"hierarchy",
"[",
"level",
"]",
"=",
"OrderedDict",
"(",
")",
"return",
"hierarchy",
"[",
"level",
"]"
] | 8d91f2c05b925a6c8ea8c997baf698c87257bc58 |
valid | default_chunker | This is the default chunker which will resolve the reference giving a callback (getreffs) and a text object with its metadata
:param text: Text Object representing either an edition or a translation
:type text: MyCapytains.resources.inventory.Text
:param getreffs: callback function which retrieves a list o... | flask_nemo/chunker.py | def default_chunker(text, getreffs):
""" This is the default chunker which will resolve the reference giving a callback (getreffs) and a text object with its metadata
:param text: Text Object representing either an edition or a translation
:type text: MyCapytains.resources.inventory.Text
:param getreff... | def default_chunker(text, getreffs):
""" This is the default chunker which will resolve the reference giving a callback (getreffs) and a text object with its metadata
:param text: Text Object representing either an edition or a translation
:type text: MyCapytains.resources.inventory.Text
:param getreff... | [
"This",
"is",
"the",
"default",
"chunker",
"which",
"will",
"resolve",
"the",
"reference",
"giving",
"a",
"callback",
"(",
"getreffs",
")",
"and",
"a",
"text",
"object",
"with",
"its",
"metadata"
] | Capitains/flask-capitains-nemo | python | https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/chunker.py#L5-L17 | [
"def",
"default_chunker",
"(",
"text",
",",
"getreffs",
")",
":",
"level",
"=",
"len",
"(",
"text",
".",
"citation",
")",
"return",
"[",
"tuple",
"(",
"[",
"reff",
".",
"split",
"(",
"\":\"",
")",
"[",
"-",
"1",
"]",
"]",
"*",
"2",
")",
"for",
... | 8d91f2c05b925a6c8ea8c997baf698c87257bc58 |
valid | scheme_chunker | This is the scheme chunker which will resolve the reference giving a callback (getreffs) and a text object with its metadata
:param text: Text Object representing either an edition or a translation
:type text: MyCapytains.resources.inventory.Text
:param getreffs: callback function which retrieves a list of... | flask_nemo/chunker.py | def scheme_chunker(text, getreffs):
""" This is the scheme chunker which will resolve the reference giving a callback (getreffs) and a text object with its metadata
:param text: Text Object representing either an edition or a translation
:type text: MyCapytains.resources.inventory.Text
:param getreffs:... | def scheme_chunker(text, getreffs):
""" This is the scheme chunker which will resolve the reference giving a callback (getreffs) and a text object with its metadata
:param text: Text Object representing either an edition or a translation
:type text: MyCapytains.resources.inventory.Text
:param getreffs:... | [
"This",
"is",
"the",
"scheme",
"chunker",
"which",
"will",
"resolve",
"the",
"reference",
"giving",
"a",
"callback",
"(",
"getreffs",
")",
"and",
"a",
"text",
"object",
"with",
"its",
"metadata"
] | Capitains/flask-capitains-nemo | python | https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/chunker.py#L20-L37 | [
"def",
"scheme_chunker",
"(",
"text",
",",
"getreffs",
")",
":",
"level",
"=",
"len",
"(",
"text",
".",
"citation",
")",
"types",
"=",
"[",
"citation",
".",
"name",
"for",
"citation",
"in",
"text",
".",
"citation",
"]",
"if",
"types",
"==",
"[",
"\"b... | 8d91f2c05b925a6c8ea8c997baf698c87257bc58 |
valid | line_chunker | Groups line reference together
:param text: Text object
:type text: MyCapytains.resources.text.api
:param getreffs: Callback function to retrieve text
:type getreffs: function(level)
:param lines: Number of lines to use by group
:type lines: int
:return: List of grouped urn references with ... | flask_nemo/chunker.py | def line_chunker(text, getreffs, lines=30):
""" Groups line reference together
:param text: Text object
:type text: MyCapytains.resources.text.api
:param getreffs: Callback function to retrieve text
:type getreffs: function(level)
:param lines: Number of lines to use by group
:type lines: i... | def line_chunker(text, getreffs, lines=30):
""" Groups line reference together
:param text: Text object
:type text: MyCapytains.resources.text.api
:param getreffs: Callback function to retrieve text
:type getreffs: function(level)
:param lines: Number of lines to use by group
:type lines: i... | [
"Groups",
"line",
"reference",
"together"
] | Capitains/flask-capitains-nemo | python | https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/chunker.py#L40-L61 | [
"def",
"line_chunker",
"(",
"text",
",",
"getreffs",
",",
"lines",
"=",
"30",
")",
":",
"level",
"=",
"len",
"(",
"text",
".",
"citation",
")",
"source_reffs",
"=",
"[",
"reff",
".",
"split",
"(",
"\":\"",
")",
"[",
"-",
"1",
"]",
"for",
"reff",
... | 8d91f2c05b925a6c8ea8c997baf698c87257bc58 |
valid | level_chunker | Chunk a text at the passage level
:param text: Text object
:type text: MyCapytains.resources.text.api
:param getreffs: Callback function to retrieve text
:type getreffs: function(level)
:return: List of urn references with their human readable version
:rtype: [(str, str)] | flask_nemo/chunker.py | def level_chunker(text, getreffs, level=1):
""" Chunk a text at the passage level
:param text: Text object
:type text: MyCapytains.resources.text.api
:param getreffs: Callback function to retrieve text
:type getreffs: function(level)
:return: List of urn references with their human readable ver... | def level_chunker(text, getreffs, level=1):
""" Chunk a text at the passage level
:param text: Text object
:type text: MyCapytains.resources.text.api
:param getreffs: Callback function to retrieve text
:type getreffs: function(level)
:return: List of urn references with their human readable ver... | [
"Chunk",
"a",
"text",
"at",
"the",
"passage",
"level"
] | Capitains/flask-capitains-nemo | python | https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/chunker.py#L64-L75 | [
"def",
"level_chunker",
"(",
"text",
",",
"getreffs",
",",
"level",
"=",
"1",
")",
":",
"references",
"=",
"getreffs",
"(",
"level",
"=",
"level",
")",
"return",
"[",
"(",
"ref",
".",
"split",
"(",
"\":\"",
")",
"[",
"-",
"1",
"]",
",",
"ref",
".... | 8d91f2c05b925a6c8ea8c997baf698c87257bc58 |
valid | level_grouper | Alternative to level_chunker: groups levels together at the latest level
:param text: Text object
:param getreffs: GetValidReff query callback
:param level: Level of citation to retrieve
:param groupby: Number of level to groupby
:return: Automatically curated references | flask_nemo/chunker.py | def level_grouper(text, getreffs, level=None, groupby=20):
""" Alternative to level_chunker: groups levels together at the latest level
:param text: Text object
:param getreffs: GetValidReff query callback
:param level: Level of citation to retrieve
:param groupby: Number of level to groupby
:r... | def level_grouper(text, getreffs, level=None, groupby=20):
""" Alternative to level_chunker: groups levels together at the latest level
:param text: Text object
:param getreffs: GetValidReff query callback
:param level: Level of citation to retrieve
:param groupby: Number of level to groupby
:r... | [
"Alternative",
"to",
"level_chunker",
":",
"groups",
"levels",
"together",
"at",
"the",
"latest",
"level"
] | Capitains/flask-capitains-nemo | python | https://github.com/Capitains/flask-capitains-nemo/blob/8d91f2c05b925a6c8ea8c997baf698c87257bc58/flask_nemo/chunker.py#L78-L110 | [
"def",
"level_grouper",
"(",
"text",
",",
"getreffs",
",",
"level",
"=",
"None",
",",
"groupby",
"=",
"20",
")",
":",
"if",
"level",
"is",
"None",
"or",
"level",
">",
"len",
"(",
"text",
".",
"citation",
")",
":",
"level",
"=",
"len",
"(",
"text",
... | 8d91f2c05b925a6c8ea8c997baf698c87257bc58 |
valid | teff | Calculate Teff for main sequence stars ranging from Teff 3500K - 8000K. Use
[Fe/H] of the cluster, if available.
Returns a list of Teff values. | astropixie-widgets/astropixie_widgets/science.py | def teff(cluster):
"""
Calculate Teff for main sequence stars ranging from Teff 3500K - 8000K. Use
[Fe/H] of the cluster, if available.
Returns a list of Teff values.
"""
b_vs, _ = cluster.stars()
teffs = []
for b_v in b_vs:
b_v -= cluster.eb_v
if b_v > -0.04:
... | def teff(cluster):
"""
Calculate Teff for main sequence stars ranging from Teff 3500K - 8000K. Use
[Fe/H] of the cluster, if available.
Returns a list of Teff values.
"""
b_vs, _ = cluster.stars()
teffs = []
for b_v in b_vs:
b_v -= cluster.eb_v
if b_v > -0.04:
... | [
"Calculate",
"Teff",
"for",
"main",
"sequence",
"stars",
"ranging",
"from",
"Teff",
"3500K",
"-",
"8000K",
".",
"Use",
"[",
"Fe",
"/",
"H",
"]",
"of",
"the",
"cluster",
"if",
"available",
"."
] | lsst-epo/vela | python | https://github.com/lsst-epo/vela/blob/8e17ebec509be5c3cc2063f4645dfe9e26b49c18/astropixie-widgets/astropixie_widgets/science.py#L24-L41 | [
"def",
"teff",
"(",
"cluster",
")",
":",
"b_vs",
",",
"_",
"=",
"cluster",
".",
"stars",
"(",
")",
"teffs",
"=",
"[",
"]",
"for",
"b_v",
"in",
"b_vs",
":",
"b_v",
"-=",
"cluster",
".",
"eb_v",
"if",
"b_v",
">",
"-",
"0.04",
":",
"x",
"=",
"("... | 8e17ebec509be5c3cc2063f4645dfe9e26b49c18 |
valid | color | Conventional color descriptions of stars.
Source: https://en.wikipedia.org/wiki/Stellar_classification | astropixie-widgets/astropixie_widgets/science.py | def color(teffs):
"""
Conventional color descriptions of stars.
Source: https://en.wikipedia.org/wiki/Stellar_classification
"""
colors = []
for t in teffs:
if t >= 7500:
colors.append('blue_white') # RGB:CAE1FF
elif t >= 6000:
colors.append('white') # R... | def color(teffs):
"""
Conventional color descriptions of stars.
Source: https://en.wikipedia.org/wiki/Stellar_classification
"""
colors = []
for t in teffs:
if t >= 7500:
colors.append('blue_white') # RGB:CAE1FF
elif t >= 6000:
colors.append('white') # R... | [
"Conventional",
"color",
"descriptions",
"of",
"stars",
".",
"Source",
":",
"https",
":",
"//",
"en",
".",
"wikipedia",
".",
"org",
"/",
"wiki",
"/",
"Stellar_classification"
] | lsst-epo/vela | python | https://github.com/lsst-epo/vela/blob/8e17ebec509be5c3cc2063f4645dfe9e26b49c18/astropixie-widgets/astropixie_widgets/science.py#L65-L82 | [
"def",
"color",
"(",
"teffs",
")",
":",
"colors",
"=",
"[",
"]",
"for",
"t",
"in",
"teffs",
":",
"if",
"t",
">=",
"7500",
":",
"colors",
".",
"append",
"(",
"'blue_white'",
")",
"# RGB:CAE1FF",
"elif",
"t",
">=",
"6000",
":",
"colors",
".",
"append... | 8e17ebec509be5c3cc2063f4645dfe9e26b49c18 |
valid | table | Create a numpy.ndarray with all observed fields and
computed teff and luminosity values. | astropixie-widgets/astropixie_widgets/science.py | def table(cluster):
"""
Create a numpy.ndarray with all observed fields and
computed teff and luminosity values.
"""
teffs = teff(cluster)
lums = luminosity(cluster)
arr = cluster.to_array()
i = 0
for row in arr:
row['lum'][0] = np.array([lums[i]], dtype='f')
row['tem... | def table(cluster):
"""
Create a numpy.ndarray with all observed fields and
computed teff and luminosity values.
"""
teffs = teff(cluster)
lums = luminosity(cluster)
arr = cluster.to_array()
i = 0
for row in arr:
row['lum'][0] = np.array([lums[i]], dtype='f')
row['tem... | [
"Create",
"a",
"numpy",
".",
"ndarray",
"with",
"all",
"observed",
"fields",
"and",
"computed",
"teff",
"and",
"luminosity",
"values",
"."
] | lsst-epo/vela | python | https://github.com/lsst-epo/vela/blob/8e17ebec509be5c3cc2063f4645dfe9e26b49c18/astropixie-widgets/astropixie_widgets/science.py#L85-L99 | [
"def",
"table",
"(",
"cluster",
")",
":",
"teffs",
"=",
"teff",
"(",
"cluster",
")",
"lums",
"=",
"luminosity",
"(",
"cluster",
")",
"arr",
"=",
"cluster",
".",
"to_array",
"(",
")",
"i",
"=",
"0",
"for",
"row",
"in",
"arr",
":",
"row",
"[",
"'lu... | 8e17ebec509be5c3cc2063f4645dfe9e26b49c18 |
valid | round_arr_teff_luminosity | Return the numpy array with rounded teff and luminosity columns. | astropixie-widgets/astropixie_widgets/science.py | def round_arr_teff_luminosity(arr):
"""
Return the numpy array with rounded teff and luminosity columns.
"""
arr['temp'] = np.around(arr['temp'], -1)
arr['lum'] = np.around(arr['lum'], 3)
return arr | def round_arr_teff_luminosity(arr):
"""
Return the numpy array with rounded teff and luminosity columns.
"""
arr['temp'] = np.around(arr['temp'], -1)
arr['lum'] = np.around(arr['lum'], 3)
return arr | [
"Return",
"the",
"numpy",
"array",
"with",
"rounded",
"teff",
"and",
"luminosity",
"columns",
"."
] | lsst-epo/vela | python | https://github.com/lsst-epo/vela/blob/8e17ebec509be5c3cc2063f4645dfe9e26b49c18/astropixie-widgets/astropixie_widgets/science.py#L102-L108 | [
"def",
"round_arr_teff_luminosity",
"(",
"arr",
")",
":",
"arr",
"[",
"'temp'",
"]",
"=",
"np",
".",
"around",
"(",
"arr",
"[",
"'temp'",
"]",
",",
"-",
"1",
")",
"arr",
"[",
"'lum'",
"]",
"=",
"np",
".",
"around",
"(",
"arr",
"[",
"'lum'",
"]",
... | 8e17ebec509be5c3cc2063f4645dfe9e26b49c18 |
valid | brutefore_passwords | Bruteforce function, will try all the credentials at the same time, splits the given credentials at a ':'. | jackal/scripts/tomcat_brute.py | def brutefore_passwords(ip, url, credentials, service):
"""
Bruteforce function, will try all the credentials at the same time, splits the given credentials at a ':'.
"""
auth_requests = []
for credential in credentials:
split = credential.strip().split(':')
username = split[0]
... | def brutefore_passwords(ip, url, credentials, service):
"""
Bruteforce function, will try all the credentials at the same time, splits the given credentials at a ':'.
"""
auth_requests = []
for credential in credentials:
split = credential.strip().split(':')
username = split[0]
... | [
"Bruteforce",
"function",
"will",
"try",
"all",
"the",
"credentials",
"at",
"the",
"same",
"time",
"splits",
"the",
"given",
"credentials",
"at",
"a",
":",
"."
] | mwgielen/jackal | python | https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/tomcat_brute.py#L11-L32 | [
"def",
"brutefore_passwords",
"(",
"ip",
",",
"url",
",",
"credentials",
",",
"service",
")",
":",
"auth_requests",
"=",
"[",
"]",
"for",
"credential",
"in",
"credentials",
":",
"split",
"=",
"credential",
".",
"strip",
"(",
")",
".",
"split",
"(",
"':'"... | 7fe62732eb5194b7246215d5277fb37c398097bf |
valid | main | Checks the arguments to brutefore and spawns greenlets to perform the bruteforcing. | jackal/scripts/tomcat_brute.py | def main():
"""
Checks the arguments to brutefore and spawns greenlets to perform the bruteforcing.
"""
services = ServiceSearch()
argparse = services.argparser
argparse.add_argument('-f', '--file', type=str, help="File")
arguments = argparse.parse_args()
if not arguments.file:
... | def main():
"""
Checks the arguments to brutefore and spawns greenlets to perform the bruteforcing.
"""
services = ServiceSearch()
argparse = services.argparser
argparse.add_argument('-f', '--file', type=str, help="File")
arguments = argparse.parse_args()
if not arguments.file:
... | [
"Checks",
"the",
"arguments",
"to",
"brutefore",
"and",
"spawns",
"greenlets",
"to",
"perform",
"the",
"bruteforcing",
"."
] | mwgielen/jackal | python | https://github.com/mwgielen/jackal/blob/7fe62732eb5194b7246215d5277fb37c398097bf/jackal/scripts/tomcat_brute.py#L35-L63 | [
"def",
"main",
"(",
")",
":",
"services",
"=",
"ServiceSearch",
"(",
")",
"argparse",
"=",
"services",
".",
"argparser",
"argparse",
".",
"add_argument",
"(",
"'-f'",
",",
"'--file'",
",",
"type",
"=",
"str",
",",
"help",
"=",
"\"File\"",
")",
"arguments... | 7fe62732eb5194b7246215d5277fb37c398097bf |
valid | _diagram | Use a :class:`~bokeh.plotting.figure.Figure` and x and y collections
to create an H-R diagram. | astropixie-widgets/astropixie_widgets/visual.py | def _diagram(plot_figure, source=None, color='black', line_color='#444444',
xaxis_label='B-V [mag]', yaxis_label='V [mag]', name=None):
"""Use a :class:`~bokeh.plotting.figure.Figure` and x and y collections
to create an H-R diagram.
"""
plot_figure.circle(x='x', y='y', source=source,
... | def _diagram(plot_figure, source=None, color='black', line_color='#444444',
xaxis_label='B-V [mag]', yaxis_label='V [mag]', name=None):
"""Use a :class:`~bokeh.plotting.figure.Figure` and x and y collections
to create an H-R diagram.
"""
plot_figure.circle(x='x', y='y', source=source,
... | [
"Use",
"a",
":",
"class",
":",
"~bokeh",
".",
"plotting",
".",
"figure",
".",
"Figure",
"and",
"x",
"and",
"y",
"collections",
"to",
"create",
"an",
"H",
"-",
"R",
"diagram",
"."
] | lsst-epo/vela | python | https://github.com/lsst-epo/vela/blob/8e17ebec509be5c3cc2063f4645dfe9e26b49c18/astropixie-widgets/astropixie_widgets/visual.py#L56-L66 | [
"def",
"_diagram",
"(",
"plot_figure",
",",
"source",
"=",
"None",
",",
"color",
"=",
"'black'",
",",
"line_color",
"=",
"'#444444'",
",",
"xaxis_label",
"=",
"'B-V [mag]'",
",",
"yaxis_label",
"=",
"'V [mag]'",
",",
"name",
"=",
"None",
")",
":",
"plot_fi... | 8e17ebec509be5c3cc2063f4645dfe9e26b49c18 |
valid | cc_diagram | Create a :class:`~bokeh.plotting.figure.Figure` to create an H-R
diagram using the cluster_name; then show it. | astropixie-widgets/astropixie_widgets/visual.py | def cc_diagram(cluster_name):
"""Create a :class:`~bokeh.plotting.figure.Figure` to create an H-R
diagram using the cluster_name; then show it.
"""
x, y = get_hr_data(cluster_name)
y_range = [max(y) + 0.5, min(y) - 0.25]
pf = figure(y_range=y_range, title=cluster_name)
_diagram(x, y, pf)
... | def cc_diagram(cluster_name):
"""Create a :class:`~bokeh.plotting.figure.Figure` to create an H-R
diagram using the cluster_name; then show it.
"""
x, y = get_hr_data(cluster_name)
y_range = [max(y) + 0.5, min(y) - 0.25]
pf = figure(y_range=y_range, title=cluster_name)
_diagram(x, y, pf)
... | [
"Create",
"a",
":",
"class",
":",
"~bokeh",
".",
"plotting",
".",
"figure",
".",
"Figure",
"to",
"create",
"an",
"H",
"-",
"R",
"diagram",
"using",
"the",
"cluster_name",
";",
"then",
"show",
"it",
"."
] | lsst-epo/vela | python | https://github.com/lsst-epo/vela/blob/8e17ebec509be5c3cc2063f4645dfe9e26b49c18/astropixie-widgets/astropixie_widgets/visual.py#L69-L77 | [
"def",
"cc_diagram",
"(",
"cluster_name",
")",
":",
"x",
",",
"y",
"=",
"get_hr_data",
"(",
"cluster_name",
")",
"y_range",
"=",
"[",
"max",
"(",
"y",
")",
"+",
"0.5",
",",
"min",
"(",
"y",
")",
"-",
"0.25",
"]",
"pf",
"=",
"figure",
"(",
"y_rang... | 8e17ebec509be5c3cc2063f4645dfe9e26b49c18 |
valid | hr_diagram | Create a :class:`~bokeh.plotting.figure.Figure` to create an H-R
diagram using the cluster_name; then show it.
Re | astropixie-widgets/astropixie_widgets/visual.py | def hr_diagram(cluster_name, output=None):
"""Create a :class:`~bokeh.plotting.figure.Figure` to create an H-R
diagram using the cluster_name; then show it.
Re
"""
cluster = get_hr_data(cluster_name)
pf = hr_diagram_figure(cluster)
show_with_bokeh_server(pf) | def hr_diagram(cluster_name, output=None):
"""Create a :class:`~bokeh.plotting.figure.Figure` to create an H-R
diagram using the cluster_name; then show it.
Re
"""
cluster = get_hr_data(cluster_name)
pf = hr_diagram_figure(cluster)
show_with_bokeh_server(pf) | [
"Create",
"a",
":",
"class",
":",
"~bokeh",
".",
"plotting",
".",
"figure",
".",
"Figure",
"to",
"create",
"an",
"H",
"-",
"R",
"diagram",
"using",
"the",
"cluster_name",
";",
"then",
"show",
"it",
"."
] | lsst-epo/vela | python | https://github.com/lsst-epo/vela/blob/8e17ebec509be5c3cc2063f4645dfe9e26b49c18/astropixie-widgets/astropixie_widgets/visual.py#L164-L172 | [
"def",
"hr_diagram",
"(",
"cluster_name",
",",
"output",
"=",
"None",
")",
":",
"cluster",
"=",
"get_hr_data",
"(",
"cluster_name",
")",
"pf",
"=",
"hr_diagram_figure",
"(",
"cluster",
")",
"show_with_bokeh_server",
"(",
"pf",
")"
] | 8e17ebec509be5c3cc2063f4645dfe9e26b49c18 |
valid | skyimage_figure | Given a cluster create a Bokeh plot figure using the
cluster's image. | astropixie-widgets/astropixie_widgets/visual.py | def skyimage_figure(cluster):
"""
Given a cluster create a Bokeh plot figure using the
cluster's image.
"""
pf_image = figure(x_range=(0, 1), y_range=(0, 1),
title='Image of {0}'.format(cluster.name))
pf_image.image_url(url=[cluster.image_path],
x=0, ... | def skyimage_figure(cluster):
"""
Given a cluster create a Bokeh plot figure using the
cluster's image.
"""
pf_image = figure(x_range=(0, 1), y_range=(0, 1),
title='Image of {0}'.format(cluster.name))
pf_image.image_url(url=[cluster.image_path],
x=0, ... | [
"Given",
"a",
"cluster",
"create",
"a",
"Bokeh",
"plot",
"figure",
"using",
"the",
"cluster",
"s",
"image",
"."
] | lsst-epo/vela | python | https://github.com/lsst-epo/vela/blob/8e17ebec509be5c3cc2063f4645dfe9e26b49c18/astropixie-widgets/astropixie_widgets/visual.py#L175-L186 | [
"def",
"skyimage_figure",
"(",
"cluster",
")",
":",
"pf_image",
"=",
"figure",
"(",
"x_range",
"=",
"(",
"0",
",",
"1",
")",
",",
"y_range",
"=",
"(",
"0",
",",
"1",
")",
",",
"title",
"=",
"'Image of {0}'",
".",
"format",
"(",
"cluster",
".",
"nam... | 8e17ebec509be5c3cc2063f4645dfe9e26b49c18 |
valid | round_teff_luminosity | Returns rounded teff and luminosity lists. | astropixie-widgets/astropixie_widgets/visual.py | def round_teff_luminosity(cluster):
"""
Returns rounded teff and luminosity lists.
"""
temps = [round(t, -1) for t in teff(cluster)]
lums = [round(l, 3) for l in luminosity(cluster)]
return temps, lums | def round_teff_luminosity(cluster):
"""
Returns rounded teff and luminosity lists.
"""
temps = [round(t, -1) for t in teff(cluster)]
lums = [round(l, 3) for l in luminosity(cluster)]
return temps, lums | [
"Returns",
"rounded",
"teff",
"and",
"luminosity",
"lists",
"."
] | lsst-epo/vela | python | https://github.com/lsst-epo/vela/blob/8e17ebec509be5c3cc2063f4645dfe9e26b49c18/astropixie-widgets/astropixie_widgets/visual.py#L189-L195 | [
"def",
"round_teff_luminosity",
"(",
"cluster",
")",
":",
"temps",
"=",
"[",
"round",
"(",
"t",
",",
"-",
"1",
")",
"for",
"t",
"in",
"teff",
"(",
"cluster",
")",
"]",
"lums",
"=",
"[",
"round",
"(",
"l",
",",
"3",
")",
"for",
"l",
"in",
"lumin... | 8e17ebec509be5c3cc2063f4645dfe9e26b49c18 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.