partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | Structure.load_data | Load ``data`` from the :class:`stdnet.BackendDataServer`. | stdnet/odm/struct.py | def load_data(self, data, callback=None):
'''Load ``data`` from the :class:`stdnet.BackendDataServer`.'''
return self.backend.execute(
self.value_pickler.load_iterable(data, self.session), callback) | def load_data(self, data, callback=None):
'''Load ``data`` from the :class:`stdnet.BackendDataServer`.'''
return self.backend.execute(
self.value_pickler.load_iterable(data, self.session), callback) | [
"Load",
"data",
"from",
"the",
":",
"class",
":",
"stdnet",
".",
"BackendDataServer",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/struct.py#L305-L308 | [
"def",
"load_data",
"(",
"self",
",",
"data",
",",
"callback",
"=",
"None",
")",
":",
"return",
"self",
".",
"backend",
".",
"execute",
"(",
"self",
".",
"value_pickler",
".",
"load_iterable",
"(",
"data",
",",
"self",
".",
"session",
")",
",",
"callba... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | PairMixin.values | Iteratir over values of :class:`PairMixin`. | stdnet/odm/struct.py | def values(self):
'''Iteratir over values of :class:`PairMixin`.'''
if self.cache.cache is None:
backend = self.read_backend
return backend.execute(backend.structure(self).values(),
self.load_values)
else:
return self.... | def values(self):
'''Iteratir over values of :class:`PairMixin`.'''
if self.cache.cache is None:
backend = self.read_backend
return backend.execute(backend.structure(self).values(),
self.load_values)
else:
return self.... | [
"Iteratir",
"over",
"values",
"of",
":",
"class",
":",
"PairMixin",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/struct.py#L356-L363 | [
"def",
"values",
"(",
"self",
")",
":",
"if",
"self",
".",
"cache",
".",
"cache",
"is",
"None",
":",
"backend",
"=",
"self",
".",
"read_backend",
"return",
"backend",
".",
"execute",
"(",
"backend",
".",
"structure",
"(",
"self",
")",
".",
"values",
... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | PairMixin.pair | Add a *pair* to the structure. | stdnet/odm/struct.py | def pair(self, pair):
'''Add a *pair* to the structure.'''
if len(pair) == 1:
# if only one value is passed, the value must implement a
# score function which retrieve the first value of the pair
# (score in zset, timevalue in timeseries, field value in
... | def pair(self, pair):
'''Add a *pair* to the structure.'''
if len(pair) == 1:
# if only one value is passed, the value must implement a
# score function which retrieve the first value of the pair
# (score in zset, timevalue in timeseries, field value in
... | [
"Add",
"a",
"*",
"pair",
"*",
"to",
"the",
"structure",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/struct.py#L365-L377 | [
"def",
"pair",
"(",
"self",
",",
"pair",
")",
":",
"if",
"len",
"(",
"pair",
")",
"==",
"1",
":",
"# if only one value is passed, the value must implement a\r",
"# score function which retrieve the first value of the pair\r",
"# (score in zset, timevalue in timeseries, field valu... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | KeyValueMixin.remove | Remove *keys* from the key-value container. | stdnet/odm/struct.py | def remove(self, *keys):
'''Remove *keys* from the key-value container.'''
dumps = self.pickler.dumps
self.cache.remove([dumps(v) for v in keys]) | def remove(self, *keys):
'''Remove *keys* from the key-value container.'''
dumps = self.pickler.dumps
self.cache.remove([dumps(v) for v in keys]) | [
"Remove",
"*",
"keys",
"*",
"from",
"the",
"key",
"-",
"value",
"container",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/struct.py#L486-L489 | [
"def",
"remove",
"(",
"self",
",",
"*",
"keys",
")",
":",
"dumps",
"=",
"self",
".",
"pickler",
".",
"dumps",
"self",
".",
"cache",
".",
"remove",
"(",
"[",
"dumps",
"(",
"v",
")",
"for",
"v",
"in",
"keys",
"]",
")"
] | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | OrderedMixin.count | Count the number of elements bewteen *start* and *stop*. | stdnet/odm/struct.py | def count(self, start, stop):
'''Count the number of elements bewteen *start* and *stop*.'''
s1 = self.pickler.dumps(start)
s2 = self.pickler.dumps(stop)
return self.backend_structure().count(s1, s2) | def count(self, start, stop):
'''Count the number of elements bewteen *start* and *stop*.'''
s1 = self.pickler.dumps(start)
s2 = self.pickler.dumps(stop)
return self.backend_structure().count(s1, s2) | [
"Count",
"the",
"number",
"of",
"elements",
"bewteen",
"*",
"start",
"*",
"and",
"*",
"stop",
"*",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/struct.py#L520-L524 | [
"def",
"count",
"(",
"self",
",",
"start",
",",
"stop",
")",
":",
"s1",
"=",
"self",
".",
"pickler",
".",
"dumps",
"(",
"start",
")",
"s2",
"=",
"self",
".",
"pickler",
".",
"dumps",
"(",
"stop",
")",
"return",
"self",
".",
"backend_structure",
"("... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | OrderedMixin.irange | Return the range by rank between start and end. | stdnet/odm/struct.py | def irange(self, start=0, end=-1, callback=None, withscores=True,
**options):
'''Return the range by rank between start and end.'''
backend = self.read_backend
res = backend.structure(self).irange(start, end,
withscores=withscores,... | def irange(self, start=0, end=-1, callback=None, withscores=True,
**options):
'''Return the range by rank between start and end.'''
backend = self.read_backend
res = backend.structure(self).irange(start, end,
withscores=withscores,... | [
"Return",
"the",
"range",
"by",
"rank",
"between",
"start",
"and",
"end",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/struct.py#L537-L546 | [
"def",
"irange",
"(",
"self",
",",
"start",
"=",
"0",
",",
"end",
"=",
"-",
"1",
",",
"callback",
"=",
"None",
",",
"withscores",
"=",
"True",
",",
"*",
"*",
"options",
")",
":",
"backend",
"=",
"self",
".",
"read_backend",
"res",
"=",
"backend",
... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | OrderedMixin.pop_range | pop a range by score from the :class:`OrderedMixin` | stdnet/odm/struct.py | def pop_range(self, start, stop, callback=None, withscores=True):
'''pop a range by score from the :class:`OrderedMixin`'''
s1 = self.pickler.dumps(start)
s2 = self.pickler.dumps(stop)
backend = self.backend
res = backend.structure(self).pop_range(s1, s2, withscores=withscor... | def pop_range(self, start, stop, callback=None, withscores=True):
'''pop a range by score from the :class:`OrderedMixin`'''
s1 = self.pickler.dumps(start)
s2 = self.pickler.dumps(stop)
backend = self.backend
res = backend.structure(self).pop_range(s1, s2, withscores=withscor... | [
"pop",
"a",
"range",
"by",
"score",
"from",
"the",
":",
"class",
":",
"OrderedMixin"
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/struct.py#L548-L556 | [
"def",
"pop_range",
"(",
"self",
",",
"start",
",",
"stop",
",",
"callback",
"=",
"None",
",",
"withscores",
"=",
"True",
")",
":",
"s1",
"=",
"self",
".",
"pickler",
".",
"dumps",
"(",
"start",
")",
"s2",
"=",
"self",
".",
"pickler",
".",
"dumps",... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | OrderedMixin.ipop_range | pop a range from the :class:`OrderedMixin` | stdnet/odm/struct.py | def ipop_range(self, start=0, stop=-1, callback=None, withscores=True):
'''pop a range from the :class:`OrderedMixin`'''
backend = self.backend
res = backend.structure(self).ipop_range(start, stop,
withscores=withscores)
if not callba... | def ipop_range(self, start=0, stop=-1, callback=None, withscores=True):
'''pop a range from the :class:`OrderedMixin`'''
backend = self.backend
res = backend.structure(self).ipop_range(start, stop,
withscores=withscores)
if not callba... | [
"pop",
"a",
"range",
"from",
"the",
":",
"class",
":",
"OrderedMixin"
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/struct.py#L558-L565 | [
"def",
"ipop_range",
"(",
"self",
",",
"start",
"=",
"0",
",",
"stop",
"=",
"-",
"1",
",",
"callback",
"=",
"None",
",",
"withscores",
"=",
"True",
")",
":",
"backend",
"=",
"self",
".",
"backend",
"res",
"=",
"backend",
".",
"structure",
"(",
"sel... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Sequence.push_back | Appends a copy of *value* at the end of the :class:`Sequence`. | stdnet/odm/struct.py | def push_back(self, value):
'''Appends a copy of *value* at the end of the :class:`Sequence`.'''
self.cache.push_back(self.value_pickler.dumps(value))
return self | def push_back(self, value):
'''Appends a copy of *value* at the end of the :class:`Sequence`.'''
self.cache.push_back(self.value_pickler.dumps(value))
return self | [
"Appends",
"a",
"copy",
"of",
"*",
"value",
"*",
"at",
"the",
"end",
"of",
"the",
":",
"class",
":",
"Sequence",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/struct.py#L583-L586 | [
"def",
"push_back",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"cache",
".",
"push_back",
"(",
"self",
".",
"value_pickler",
".",
"dumps",
"(",
"value",
")",
")",
"return",
"self"
] | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Sequence.pop_back | Remove the last element from the :class:`Sequence`. | stdnet/odm/struct.py | def pop_back(self):
'''Remove the last element from the :class:`Sequence`.'''
backend = self.backend
return backend.execute(backend.structure(self).pop_back(),
self.value_pickler.loads) | def pop_back(self):
'''Remove the last element from the :class:`Sequence`.'''
backend = self.backend
return backend.execute(backend.structure(self).pop_back(),
self.value_pickler.loads) | [
"Remove",
"the",
"last",
"element",
"from",
"the",
":",
"class",
":",
"Sequence",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/struct.py#L588-L592 | [
"def",
"pop_back",
"(",
"self",
")",
":",
"backend",
"=",
"self",
".",
"backend",
"return",
"backend",
".",
"execute",
"(",
"backend",
".",
"structure",
"(",
"self",
")",
".",
"pop_back",
"(",
")",
",",
"self",
".",
"value_pickler",
".",
"loads",
")"
] | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Set.add | Add *value* to the set | stdnet/odm/struct.py | def add(self, value):
'''Add *value* to the set'''
return self.cache.update((self.value_pickler.dumps(value),)) | def add(self, value):
'''Add *value* to the set'''
return self.cache.update((self.value_pickler.dumps(value),)) | [
"Add",
"*",
"value",
"*",
"to",
"the",
"set"
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/struct.py#L613-L615 | [
"def",
"add",
"(",
"self",
",",
"value",
")",
":",
"return",
"self",
".",
"cache",
".",
"update",
"(",
"(",
"self",
".",
"value_pickler",
".",
"dumps",
"(",
"value",
")",
",",
")",
")"
] | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Set.update | Add iterable *values* to the set | stdnet/odm/struct.py | def update(self, values):
'''Add iterable *values* to the set'''
d = self.value_pickler.dumps
return self.cache.update(tuple((d(v) for v in values))) | def update(self, values):
'''Add iterable *values* to the set'''
d = self.value_pickler.dumps
return self.cache.update(tuple((d(v) for v in values))) | [
"Add",
"iterable",
"*",
"values",
"*",
"to",
"the",
"set"
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/struct.py#L618-L621 | [
"def",
"update",
"(",
"self",
",",
"values",
")",
":",
"d",
"=",
"self",
".",
"value_pickler",
".",
"dumps",
"return",
"self",
".",
"cache",
".",
"update",
"(",
"tuple",
"(",
"(",
"d",
"(",
"v",
")",
"for",
"v",
"in",
"values",
")",
")",
")"
] | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Set.discard | Remove an element *value* from a set if it is a member. | stdnet/odm/struct.py | def discard(self, value):
'''Remove an element *value* from a set if it is a member.'''
return self.cache.remove((self.value_pickler.dumps(value),)) | def discard(self, value):
'''Remove an element *value* from a set if it is a member.'''
return self.cache.remove((self.value_pickler.dumps(value),)) | [
"Remove",
"an",
"element",
"*",
"value",
"*",
"from",
"a",
"set",
"if",
"it",
"is",
"a",
"member",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/struct.py#L624-L626 | [
"def",
"discard",
"(",
"self",
",",
"value",
")",
":",
"return",
"self",
".",
"cache",
".",
"remove",
"(",
"(",
"self",
".",
"value_pickler",
".",
"dumps",
"(",
"value",
")",
",",
")",
")"
] | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Set.difference_update | Remove an iterable of *values* from the set. | stdnet/odm/struct.py | def difference_update(self, values):
'''Remove an iterable of *values* from the set.'''
d = self.value_pickler.dumps
return self.cache.remove(tuple((d(v) for v in values))) | def difference_update(self, values):
'''Remove an iterable of *values* from the set.'''
d = self.value_pickler.dumps
return self.cache.remove(tuple((d(v) for v in values))) | [
"Remove",
"an",
"iterable",
"of",
"*",
"values",
"*",
"from",
"the",
"set",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/struct.py#L630-L633 | [
"def",
"difference_update",
"(",
"self",
",",
"values",
")",
":",
"d",
"=",
"self",
".",
"value_pickler",
".",
"dumps",
"return",
"self",
".",
"cache",
".",
"remove",
"(",
"tuple",
"(",
"(",
"d",
"(",
"v",
")",
"for",
"v",
"in",
"values",
")",
")",... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | List.pop_front | Remove the first element from of the list. | stdnet/odm/struct.py | def pop_front(self):
'''Remove the first element from of the list.'''
backend = self.backend
return backend.execute(backend.structure(self).pop_front(),
self.value_pickler.loads) | def pop_front(self):
'''Remove the first element from of the list.'''
backend = self.backend
return backend.execute(backend.structure(self).pop_front(),
self.value_pickler.loads) | [
"Remove",
"the",
"first",
"element",
"from",
"of",
"the",
"list",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/struct.py#L640-L644 | [
"def",
"pop_front",
"(",
"self",
")",
":",
"backend",
"=",
"self",
".",
"backend",
"return",
"backend",
".",
"execute",
"(",
"backend",
".",
"structure",
"(",
"self",
")",
".",
"pop_front",
"(",
")",
",",
"self",
".",
"value_pickler",
".",
"loads",
")"... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | List.block_pop_back | Remove the last element from of the list. If no elements are
available, blocks for at least ``timeout`` seconds. | stdnet/odm/struct.py | def block_pop_back(self, timeout=10):
'''Remove the last element from of the list. If no elements are
available, blocks for at least ``timeout`` seconds.'''
value = yield self.backend_structure().block_pop_back(timeout)
if value is not None:
yield self.value_pickler.loads(value) | def block_pop_back(self, timeout=10):
'''Remove the last element from of the list. If no elements are
available, blocks for at least ``timeout`` seconds.'''
value = yield self.backend_structure().block_pop_back(timeout)
if value is not None:
yield self.value_pickler.loads(value) | [
"Remove",
"the",
"last",
"element",
"from",
"of",
"the",
"list",
".",
"If",
"no",
"elements",
"are",
"available",
"blocks",
"for",
"at",
"least",
"timeout",
"seconds",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/struct.py#L646-L651 | [
"def",
"block_pop_back",
"(",
"self",
",",
"timeout",
"=",
"10",
")",
":",
"value",
"=",
"yield",
"self",
".",
"backend_structure",
"(",
")",
".",
"block_pop_back",
"(",
"timeout",
")",
"if",
"value",
"is",
"not",
"None",
":",
"yield",
"self",
".",
"va... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | List.block_pop_front | Remove the first element from of the list. If no elements are
available, blocks for at least ``timeout`` seconds. | stdnet/odm/struct.py | def block_pop_front(self, timeout=10):
'''Remove the first element from of the list. If no elements are
available, blocks for at least ``timeout`` seconds.'''
value = yield self.backend_structure().block_pop_front(timeout)
if value is not None:
yield self.value_pickler.loads(val... | def block_pop_front(self, timeout=10):
'''Remove the first element from of the list. If no elements are
available, blocks for at least ``timeout`` seconds.'''
value = yield self.backend_structure().block_pop_front(timeout)
if value is not None:
yield self.value_pickler.loads(val... | [
"Remove",
"the",
"first",
"element",
"from",
"of",
"the",
"list",
".",
"If",
"no",
"elements",
"are",
"available",
"blocks",
"for",
"at",
"least",
"timeout",
"seconds",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/struct.py#L653-L658 | [
"def",
"block_pop_front",
"(",
"self",
",",
"timeout",
"=",
"10",
")",
":",
"value",
"=",
"yield",
"self",
".",
"backend_structure",
"(",
")",
".",
"block_pop_front",
"(",
"timeout",
")",
"if",
"value",
"is",
"not",
"None",
":",
"yield",
"self",
".",
"... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | List.push_front | Appends a copy of ``value`` to the beginning of the list. | stdnet/odm/struct.py | def push_front(self, value):
'''Appends a copy of ``value`` to the beginning of the list.'''
self.cache.push_front(self.value_pickler.dumps(value)) | def push_front(self, value):
'''Appends a copy of ``value`` to the beginning of the list.'''
self.cache.push_front(self.value_pickler.dumps(value)) | [
"Appends",
"a",
"copy",
"of",
"value",
"to",
"the",
"beginning",
"of",
"the",
"list",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/struct.py#L661-L663 | [
"def",
"push_front",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"cache",
".",
"push_front",
"(",
"self",
".",
"value_pickler",
".",
"dumps",
"(",
"value",
")",
")"
] | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Zset.rank | The rank of a given *value*. This is the position of *value*
in the :class:`OrderedMixin` container. | stdnet/odm/struct.py | def rank(self, value):
'''The rank of a given *value*. This is the position of *value*
in the :class:`OrderedMixin` container.'''
value = self.value_pickler.dumps(value)
return self.backend_structure().rank(value) | def rank(self, value):
'''The rank of a given *value*. This is the position of *value*
in the :class:`OrderedMixin` container.'''
value = self.value_pickler.dumps(value)
return self.backend_structure().rank(value) | [
"The",
"rank",
"of",
"a",
"given",
"*",
"value",
"*",
".",
"This",
"is",
"the",
"position",
"of",
"*",
"value",
"*",
"in",
"the",
":",
"class",
":",
"OrderedMixin",
"container",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/struct.py#L672-L676 | [
"def",
"rank",
"(",
"self",
",",
"value",
")",
":",
"value",
"=",
"self",
".",
"value_pickler",
".",
"dumps",
"(",
"value",
")",
"return",
"self",
".",
"backend_structure",
"(",
")",
".",
"rank",
"(",
"value",
")"
] | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | TS.rank | The rank of a given *dte* in the timeseries | stdnet/odm/struct.py | def rank(self, dte):
'''The rank of a given *dte* in the timeseries'''
timestamp = self.pickler.dumps(dte)
return self.backend_structure().rank(timestamp) | def rank(self, dte):
'''The rank of a given *dte* in the timeseries'''
timestamp = self.pickler.dumps(dte)
return self.backend_structure().rank(timestamp) | [
"The",
"rank",
"of",
"a",
"given",
"*",
"dte",
"*",
"in",
"the",
"timeseries"
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/struct.py#L708-L711 | [
"def",
"rank",
"(",
"self",
",",
"dte",
")",
":",
"timestamp",
"=",
"self",
".",
"pickler",
".",
"dumps",
"(",
"dte",
")",
"return",
"self",
".",
"backend_structure",
"(",
")",
".",
"rank",
"(",
"timestamp",
")"
] | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | TS.ipop | Pop a value at *index* from the :class:`TS`. Return ``None`` if
index is not out of bound. | stdnet/odm/struct.py | def ipop(self, index):
'''Pop a value at *index* from the :class:`TS`. Return ``None`` if
index is not out of bound.'''
backend = self.backend
res = backend.structure(self).ipop(index)
return backend.execute(res,
lambda r: self._load_get_data(r, index... | def ipop(self, index):
'''Pop a value at *index* from the :class:`TS`. Return ``None`` if
index is not out of bound.'''
backend = self.backend
res = backend.structure(self).ipop(index)
return backend.execute(res,
lambda r: self._load_get_data(r, index... | [
"Pop",
"a",
"value",
"at",
"*",
"index",
"*",
"from",
"the",
":",
"class",
":",
"TS",
".",
"Return",
"None",
"if",
"index",
"is",
"not",
"out",
"of",
"bound",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/struct.py#L713-L719 | [
"def",
"ipop",
"(",
"self",
",",
"index",
")",
":",
"backend",
"=",
"self",
".",
"backend",
"res",
"=",
"backend",
".",
"structure",
"(",
"self",
")",
".",
"ipop",
"(",
"index",
")",
"return",
"backend",
".",
"execute",
"(",
"res",
",",
"lambda",
"... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | TS.times | The times between times *start* and *stop*. | stdnet/odm/struct.py | def times(self, start, stop, callback=None, **kwargs):
'''The times between times *start* and *stop*.'''
s1 = self.pickler.dumps(start)
s2 = self.pickler.dumps(stop)
backend = self.read_backend
res = backend.structure(self).times(s1, s2, **kwargs)
return backend.exe... | def times(self, start, stop, callback=None, **kwargs):
'''The times between times *start* and *stop*.'''
s1 = self.pickler.dumps(start)
s2 = self.pickler.dumps(stop)
backend = self.read_backend
res = backend.structure(self).times(s1, s2, **kwargs)
return backend.exe... | [
"The",
"times",
"between",
"times",
"*",
"start",
"*",
"and",
"*",
"stop",
"*",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/struct.py#L721-L727 | [
"def",
"times",
"(",
"self",
",",
"start",
",",
"stop",
",",
"callback",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"s1",
"=",
"self",
".",
"pickler",
".",
"dumps",
"(",
"start",
")",
"s2",
"=",
"self",
".",
"pickler",
".",
"dumps",
"(",
"... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | TS.itimes | The times between rank *start* and *stop*. | stdnet/odm/struct.py | def itimes(self, start=0, stop=-1, callback=None, **kwargs):
'''The times between rank *start* and *stop*.'''
backend = self.read_backend
res = backend.structure(self).itimes(start, stop, **kwargs)
return backend.execute(res, callback or self.load_keys) | def itimes(self, start=0, stop=-1, callback=None, **kwargs):
'''The times between rank *start* and *stop*.'''
backend = self.read_backend
res = backend.structure(self).itimes(start, stop, **kwargs)
return backend.execute(res, callback or self.load_keys) | [
"The",
"times",
"between",
"rank",
"*",
"start",
"*",
"and",
"*",
"stop",
"*",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/struct.py#L729-L733 | [
"def",
"itimes",
"(",
"self",
",",
"start",
"=",
"0",
",",
"stop",
"=",
"-",
"1",
",",
"callback",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"backend",
"=",
"self",
".",
"read_backend",
"res",
"=",
"backend",
".",
"structure",
"(",
"self",
... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Q.get_field | A :class:`Q` performs a series of operations and ultimately
generate of set of matched elements ``ids``. If on the other hand, a
different field is required, it can be specified with the :meth:`get_field`
method. For example, lets say a model has a field called ``object_id``
which contains ids of another model, we ... | stdnet/odm/query.py | def get_field(self, field):
'''A :class:`Q` performs a series of operations and ultimately
generate of set of matched elements ``ids``. If on the other hand, a
different field is required, it can be specified with the :meth:`get_field`
method. For example, lets say a model has a field called ``object_id``
... | def get_field(self, field):
'''A :class:`Q` performs a series of operations and ultimately
generate of set of matched elements ``ids``. If on the other hand, a
different field is required, it can be specified with the :meth:`get_field`
method. For example, lets say a model has a field called ``object_id``
... | [
"A",
":",
"class",
":",
"Q",
"performs",
"a",
"series",
"of",
"operations",
"and",
"ultimately",
"generate",
"of",
"set",
"of",
"matched",
"elements",
"ids",
".",
"If",
"on",
"the",
"other",
"hand",
"a",
"different",
"field",
"is",
"required",
"it",
"can... | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/query.py#L103-L127 | [
"def",
"get_field",
"(",
"self",
",",
"field",
")",
":",
"if",
"field",
"!=",
"self",
".",
"_get_field",
":",
"if",
"field",
"not",
"in",
"self",
".",
"_meta",
".",
"dfields",
":",
"raise",
"QuerySetError",
"(",
"'Model \"{0}\" has no field \"{1}\".'",
".",
... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Query.filter | Create a new :class:`Query` with additional clauses corresponding to
``where`` or ``limit`` in a ``SQL SELECT`` statement.
:parameter kwargs: dictionary of limiting clauses.
:rtype: a new :class:`Query` instance.
For example::
qs = session.query(MyModel)
result = qs.filter(group = 'planet') | stdnet/odm/query.py | def filter(self, **kwargs):
'''Create a new :class:`Query` with additional clauses corresponding to
``where`` or ``limit`` in a ``SQL SELECT`` statement.
:parameter kwargs: dictionary of limiting clauses.
:rtype: a new :class:`Query` instance.
For example::
qs = session.query(MyModel)
resul... | def filter(self, **kwargs):
'''Create a new :class:`Query` with additional clauses corresponding to
``where`` or ``limit`` in a ``SQL SELECT`` statement.
:parameter kwargs: dictionary of limiting clauses.
:rtype: a new :class:`Query` instance.
For example::
qs = session.query(MyModel)
resul... | [
"Create",
"a",
"new",
":",
"class",
":",
"Query",
"with",
"additional",
"clauses",
"corresponding",
"to",
"where",
"or",
"limit",
"in",
"a",
"SQL",
"SELECT",
"statement",
".",
":",
"parameter",
"kwargs",
":",
"dictionary",
"of",
"limiting",
"clauses",
".",
... | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/query.py#L401-L420 | [
"def",
"filter",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"kwargs",
":",
"q",
"=",
"self",
".",
"_clone",
"(",
")",
"if",
"self",
".",
"fargs",
":",
"kwargs",
"=",
"update_dictionary",
"(",
"self",
".",
"fargs",
".",
"copy",
"(",
")"... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Query.exclude | Returns a new :class:`Query` with additional clauses corresponding
to ``EXCEPT`` in a ``SQL SELECT`` statement.
:parameter kwargs: dictionary of limiting clauses.
:rtype: a new :class:`Query` instance.
Using an equivalent example to the :meth:`filter` method::
qs = session.query(MyModel)
result1 = q... | stdnet/odm/query.py | def exclude(self, **kwargs):
'''Returns a new :class:`Query` with additional clauses corresponding
to ``EXCEPT`` in a ``SQL SELECT`` statement.
:parameter kwargs: dictionary of limiting clauses.
:rtype: a new :class:`Query` instance.
Using an equivalent example to the :meth:`filter` method::
qs ... | def exclude(self, **kwargs):
'''Returns a new :class:`Query` with additional clauses corresponding
to ``EXCEPT`` in a ``SQL SELECT`` statement.
:parameter kwargs: dictionary of limiting clauses.
:rtype: a new :class:`Query` instance.
Using an equivalent example to the :meth:`filter` method::
qs ... | [
"Returns",
"a",
"new",
":",
"class",
":",
"Query",
"with",
"additional",
"clauses",
"corresponding",
"to",
"EXCEPT",
"in",
"a",
"SQL",
"SELECT",
"statement",
".",
":",
"parameter",
"kwargs",
":",
"dictionary",
"of",
"limiting",
"clauses",
".",
":",
"rtype",
... | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/query.py#L422-L443 | [
"def",
"exclude",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"kwargs",
":",
"q",
"=",
"self",
".",
"_clone",
"(",
")",
"if",
"self",
".",
"eargs",
":",
"kwargs",
"=",
"update_dictionary",
"(",
"self",
".",
"eargs",
".",
"copy",
"(",
")... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Query.union | Return a new :class:`Query` obtained form the union of this
:class:`Query` with one or more *queries*.
For example, lets say we want to have the union
of two queries obtained from the :meth:`filter` method::
query = session.query(MyModel)
qs = query.filter(field1 = 'bla').union(query.filter(field2 = 'foo... | stdnet/odm/query.py | def union(self, *queries):
'''Return a new :class:`Query` obtained form the union of this
:class:`Query` with one or more *queries*.
For example, lets say we want to have the union
of two queries obtained from the :meth:`filter` method::
query = session.query(MyModel)
qs = query.filter(field1 = ... | def union(self, *queries):
'''Return a new :class:`Query` obtained form the union of this
:class:`Query` with one or more *queries*.
For example, lets say we want to have the union
of two queries obtained from the :meth:`filter` method::
query = session.query(MyModel)
qs = query.filter(field1 = ... | [
"Return",
"a",
"new",
":",
"class",
":",
"Query",
"obtained",
"form",
"the",
"union",
"of",
"this",
":",
"class",
":",
"Query",
"with",
"one",
"or",
"more",
"*",
"queries",
"*",
".",
"For",
"example",
"lets",
"say",
"we",
"want",
"to",
"have",
"the",... | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/query.py#L445-L456 | [
"def",
"union",
"(",
"self",
",",
"*",
"queries",
")",
":",
"q",
"=",
"self",
".",
"_clone",
"(",
")",
"q",
".",
"unions",
"+=",
"queries",
"return",
"q"
] | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Query.intersect | Return a new :class:`Query` obtained form the intersection of this
:class:`Query` with one or more *queries*. Workds the same way as
the :meth:`union` method. | stdnet/odm/query.py | def intersect(self, *queries):
'''Return a new :class:`Query` obtained form the intersection of this
:class:`Query` with one or more *queries*. Workds the same way as
the :meth:`union` method.'''
q = self._clone()
q.intersections += queries
return q | def intersect(self, *queries):
'''Return a new :class:`Query` obtained form the intersection of this
:class:`Query` with one or more *queries*. Workds the same way as
the :meth:`union` method.'''
q = self._clone()
q.intersections += queries
return q | [
"Return",
"a",
"new",
":",
"class",
":",
"Query",
"obtained",
"form",
"the",
"intersection",
"of",
"this",
":",
"class",
":",
"Query",
"with",
"one",
"or",
"more",
"*",
"queries",
"*",
".",
"Workds",
"the",
"same",
"way",
"as",
"the",
":",
"meth",
":... | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/query.py#L458-L464 | [
"def",
"intersect",
"(",
"self",
",",
"*",
"queries",
")",
":",
"q",
"=",
"self",
".",
"_clone",
"(",
")",
"q",
".",
"intersections",
"+=",
"queries",
"return",
"q"
] | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Query.sort_by | Sort the query by the given field
:parameter ordering: a string indicating the class:`Field` name to sort by.
If prefixed with ``-``, the sorting will be in descending order, otherwise
in ascending order.
:return type: a new :class:`Query` instance. | stdnet/odm/query.py | def sort_by(self, ordering):
'''Sort the query by the given field
:parameter ordering: a string indicating the class:`Field` name to sort by.
If prefixed with ``-``, the sorting will be in descending order, otherwise
in ascending order.
:return type: a new :class:`Query` instance.
'''
i... | def sort_by(self, ordering):
'''Sort the query by the given field
:parameter ordering: a string indicating the class:`Field` name to sort by.
If prefixed with ``-``, the sorting will be in descending order, otherwise
in ascending order.
:return type: a new :class:`Query` instance.
'''
i... | [
"Sort",
"the",
"query",
"by",
"the",
"given",
"field",
":",
"parameter",
"ordering",
":",
"a",
"string",
"indicating",
"the",
"class",
":",
"Field",
"name",
"to",
"sort",
"by",
".",
"If",
"prefixed",
"with",
"-",
"the",
"sorting",
"will",
"be",
"in",
"... | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/query.py#L466-L478 | [
"def",
"sort_by",
"(",
"self",
",",
"ordering",
")",
":",
"if",
"ordering",
":",
"ordering",
"=",
"self",
".",
"_meta",
".",
"get_sorting",
"(",
"ordering",
",",
"QuerySetError",
")",
"q",
"=",
"self",
".",
"_clone",
"(",
")",
"q",
".",
"data",
"[",
... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Query.search | Search *text* in model. A search engine needs to be installed
for this function to be available.
:parameter text: a string to search.
:return type: a new :class:`Query` instance. | stdnet/odm/query.py | def search(self, text, lookup=None):
'''Search *text* in model. A search engine needs to be installed
for this function to be available.
:parameter text: a string to search.
:return type: a new :class:`Query` instance.
'''
q = self._clone()
q.text = (text, lookup)
return q | def search(self, text, lookup=None):
'''Search *text* in model. A search engine needs to be installed
for this function to be available.
:parameter text: a string to search.
:return type: a new :class:`Query` instance.
'''
q = self._clone()
q.text = (text, lookup)
return q | [
"Search",
"*",
"text",
"*",
"in",
"model",
".",
"A",
"search",
"engine",
"needs",
"to",
"be",
"installed",
"for",
"this",
"function",
"to",
"be",
"available",
".",
":",
"parameter",
"text",
":",
"a",
"string",
"to",
"search",
".",
":",
"return",
"type"... | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/query.py#L480-L489 | [
"def",
"search",
"(",
"self",
",",
"text",
",",
"lookup",
"=",
"None",
")",
":",
"q",
"=",
"self",
".",
"_clone",
"(",
")",
"q",
".",
"text",
"=",
"(",
"text",
",",
"lookup",
")",
"return",
"q"
] | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Query.where | For :ref:`backend <db-index>` supporting scripting, it is possible
to construct complex queries which execute the scripting *code* against
each element in the query. The *coe* should reference an instance of
:attr:`model` by ``this`` keyword.
:parameter code: a valid expression in the scripting language of the da... | stdnet/odm/query.py | def where(self, code, load_only=None):
'''For :ref:`backend <db-index>` supporting scripting, it is possible
to construct complex queries which execute the scripting *code* against
each element in the query. The *coe* should reference an instance of
:attr:`model` by ``this`` keyword.
:parameter code: a v... | def where(self, code, load_only=None):
'''For :ref:`backend <db-index>` supporting scripting, it is possible
to construct complex queries which execute the scripting *code* against
each element in the query. The *coe* should reference an instance of
:attr:`model` by ``this`` keyword.
:parameter code: a v... | [
"For",
":",
"ref",
":",
"backend",
"<db",
"-",
"index",
">",
"supporting",
"scripting",
"it",
"is",
"possible",
"to",
"construct",
"complex",
"queries",
"which",
"execute",
"the",
"scripting",
"*",
"code",
"*",
"against",
"each",
"element",
"in",
"the",
"q... | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/query.py#L491-L510 | [
"def",
"where",
"(",
"self",
",",
"code",
",",
"load_only",
"=",
"None",
")",
":",
"if",
"code",
":",
"q",
"=",
"self",
".",
"_clone",
"(",
")",
"q",
".",
"data",
"[",
"'where'",
"]",
"=",
"(",
"code",
",",
"load_only",
")",
"return",
"q",
"els... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Query.search_queries | Return a new :class:`QueryElem` for *q* applying a text search. | stdnet/odm/query.py | def search_queries(self, q):
'''Return a new :class:`QueryElem` for *q* applying a text search.'''
if self.text:
searchengine = self.session.router.search_engine
if searchengine:
return searchengine.search_model(q, *self.text)
else:
... | def search_queries(self, q):
'''Return a new :class:`QueryElem` for *q* applying a text search.'''
if self.text:
searchengine = self.session.router.search_engine
if searchengine:
return searchengine.search_model(q, *self.text)
else:
... | [
"Return",
"a",
"new",
":",
"class",
":",
"QueryElem",
"for",
"*",
"q",
"*",
"applying",
"a",
"text",
"search",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/query.py#L512-L521 | [
"def",
"search_queries",
"(",
"self",
",",
"q",
")",
":",
"if",
"self",
".",
"text",
":",
"searchengine",
"=",
"self",
".",
"session",
".",
"router",
".",
"search_engine",
"if",
"searchengine",
":",
"return",
"searchengine",
".",
"search_model",
"(",
"q",
... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Query.load_related | It returns a new :class:`Query` that automatically
follows the foreign-key relationship ``related``.
:parameter related: A field name corresponding to a :class:`ForeignKey`
in :attr:`Query.model`.
:parameter related_fields: optional :class:`Field` names for the ``related``
model to load. If not provided,... | stdnet/odm/query.py | def load_related(self, related, *related_fields):
'''It returns a new :class:`Query` that automatically
follows the foreign-key relationship ``related``.
:parameter related: A field name corresponding to a :class:`ForeignKey`
in :attr:`Query.model`.
:parameter related_fields: optional :class:`Field` ... | def load_related(self, related, *related_fields):
'''It returns a new :class:`Query` that automatically
follows the foreign-key relationship ``related``.
:parameter related: A field name corresponding to a :class:`ForeignKey`
in :attr:`Query.model`.
:parameter related_fields: optional :class:`Field` ... | [
"It",
"returns",
"a",
"new",
":",
"class",
":",
"Query",
"that",
"automatically",
"follows",
"the",
"foreign",
"-",
"key",
"relationship",
"related",
".",
":",
"parameter",
"related",
":",
"A",
"field",
"name",
"corresponding",
"to",
"a",
":",
"class",
":"... | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/query.py#L523-L546 | [
"def",
"load_related",
"(",
"self",
",",
"related",
",",
"*",
"related_fields",
")",
":",
"field",
"=",
"self",
".",
"_get_related_field",
"(",
"related",
")",
"if",
"not",
"field",
":",
"raise",
"FieldError",
"(",
"'\"%s\" is not a related field for \"%s\"'",
"... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Query.load_only | This is provides a :ref:`performance boost <increase-performance>`
in cases when you need to load a subset of fields of your model. The boost
achieved is less than the one obtained when using
:meth:`Query.load_related`, since it does not reduce the number of requests
to the database. However, it can save you lots o... | stdnet/odm/query.py | def load_only(self, *fields):
'''This is provides a :ref:`performance boost <increase-performance>`
in cases when you need to load a subset of fields of your model. The boost
achieved is less than the one obtained when using
:meth:`Query.load_related`, since it does not reduce the number of requests
to the... | def load_only(self, *fields):
'''This is provides a :ref:`performance boost <increase-performance>`
in cases when you need to load a subset of fields of your model. The boost
achieved is less than the one obtained when using
:meth:`Query.load_related`, since it does not reduce the number of requests
to the... | [
"This",
"is",
"provides",
"a",
":",
"ref",
":",
"performance",
"boost",
"<increase",
"-",
"performance",
">",
"in",
"cases",
"when",
"you",
"need",
"to",
"load",
"a",
"subset",
"of",
"fields",
"of",
"your",
"model",
".",
"The",
"boost",
"achieved",
"is",... | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/query.py#L548-L573 | [
"def",
"load_only",
"(",
"self",
",",
"*",
"fields",
")",
":",
"q",
"=",
"self",
".",
"_clone",
"(",
")",
"new_fields",
"=",
"[",
"]",
"for",
"field",
"in",
"fields",
":",
"if",
"JSPLITTER",
"in",
"field",
":",
"bits",
"=",
"field",
".",
"split",
... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Query.dont_load | Works like :meth:`load_only` to provides a
:ref:`performance boost <increase-performance>` in cases when you need
to load all fields except a subset specified by *fields*. | stdnet/odm/query.py | def dont_load(self, *fields):
'''Works like :meth:`load_only` to provides a
:ref:`performance boost <increase-performance>` in cases when you need
to load all fields except a subset specified by *fields*.
'''
q = self._clone()
fs = unique_tuple(q.exclude_fields, fields)
q.exclude_... | def dont_load(self, *fields):
'''Works like :meth:`load_only` to provides a
:ref:`performance boost <increase-performance>` in cases when you need
to load all fields except a subset specified by *fields*.
'''
q = self._clone()
fs = unique_tuple(q.exclude_fields, fields)
q.exclude_... | [
"Works",
"like",
":",
"meth",
":",
"load_only",
"to",
"provides",
"a",
":",
"ref",
":",
"performance",
"boost",
"<increase",
"-",
"performance",
">",
"in",
"cases",
"when",
"you",
"need",
"to",
"load",
"all",
"fields",
"except",
"a",
"subset",
"specified",... | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/query.py#L575-L583 | [
"def",
"dont_load",
"(",
"self",
",",
"*",
"fields",
")",
":",
"q",
"=",
"self",
".",
"_clone",
"(",
")",
"fs",
"=",
"unique_tuple",
"(",
"q",
".",
"exclude_fields",
",",
"fields",
")",
"q",
".",
"exclude_fields",
"=",
"fs",
"if",
"fs",
"else",
"No... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Query.get | Return an instance of a model matching the query. A special case is
the query on ``id`` which provides a direct access to the :attr:`session`
instances. If the given primary key is present in the session, the object
is returned directly without performing any query. | stdnet/odm/query.py | def get(self, **kwargs):
'''Return an instance of a model matching the query. A special case is
the query on ``id`` which provides a direct access to the :attr:`session`
instances. If the given primary key is present in the session, the object
is returned directly without performing any query.'''
r... | def get(self, **kwargs):
'''Return an instance of a model matching the query. A special case is
the query on ``id`` which provides a direct access to the :attr:`session`
instances. If the given primary key is present in the session, the object
is returned directly without performing any query.'''
r... | [
"Return",
"an",
"instance",
"of",
"a",
"model",
"matching",
"the",
"query",
".",
"A",
"special",
"case",
"is",
"the",
"query",
"on",
"id",
"which",
"provides",
"a",
"direct",
"access",
"to",
"the",
":",
"attr",
":",
"session",
"instances",
".",
"If",
"... | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/query.py#L594-L600 | [
"def",
"get",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"filter",
"(",
"*",
"*",
"kwargs",
")",
".",
"items",
"(",
"callback",
"=",
"self",
".",
"model",
".",
"get_unique_instance",
")"
] | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Query.construct | Build the :class:`QueryElement` representing this query. | stdnet/odm/query.py | def construct(self):
'''Build the :class:`QueryElement` representing this query.'''
if self.__construct is None:
self.__construct = self._construct()
return self.__construct | def construct(self):
'''Build the :class:`QueryElement` representing this query.'''
if self.__construct is None:
self.__construct = self._construct()
return self.__construct | [
"Build",
"the",
":",
"class",
":",
"QueryElement",
"representing",
"this",
"query",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/query.py#L615-L619 | [
"def",
"construct",
"(",
"self",
")",
":",
"if",
"self",
".",
"__construct",
"is",
"None",
":",
"self",
".",
"__construct",
"=",
"self",
".",
"_construct",
"(",
")",
"return",
"self",
".",
"__construct"
] | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Query.backend_query | Build and return the :class:`stdnet.utils.async.BackendQuery`.
This is a lazy method in the sense that it is evaluated once only and its
result stored for future retrieval. | stdnet/odm/query.py | def backend_query(self, **kwargs):
'''Build and return the :class:`stdnet.utils.async.BackendQuery`.
This is a lazy method in the sense that it is evaluated once only and its
result stored for future retrieval.'''
q = self.construct()
return q if isinstance(q, EmptyQuery) else q.backend_que... | def backend_query(self, **kwargs):
'''Build and return the :class:`stdnet.utils.async.BackendQuery`.
This is a lazy method in the sense that it is evaluated once only and its
result stored for future retrieval.'''
q = self.construct()
return q if isinstance(q, EmptyQuery) else q.backend_que... | [
"Build",
"and",
"return",
"the",
":",
"class",
":",
"stdnet",
".",
"utils",
".",
"async",
".",
"BackendQuery",
".",
"This",
"is",
"a",
"lazy",
"method",
"in",
"the",
"sense",
"that",
"it",
"is",
"evaluated",
"once",
"only",
"and",
"its",
"result",
"sto... | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/query.py#L621-L626 | [
"def",
"backend_query",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"q",
"=",
"self",
".",
"construct",
"(",
")",
"return",
"q",
"if",
"isinstance",
"(",
"q",
",",
"EmptyQuery",
")",
"else",
"q",
".",
"backend_query",
"(",
"*",
"*",
"kwargs",
"... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Query.aggregate | Aggregate lookup parameters. | stdnet/odm/query.py | def aggregate(self, kwargs):
'''Aggregate lookup parameters.'''
meta = self._meta
fields = meta.dfields
field_lookups = {}
for name, value in iteritems(kwargs):
bits = name.split(JSPLITTER)
field_name = bits.pop(0)
if field_name not in ... | def aggregate(self, kwargs):
'''Aggregate lookup parameters.'''
meta = self._meta
fields = meta.dfields
field_lookups = {}
for name, value in iteritems(kwargs):
bits = name.split(JSPLITTER)
field_name = bits.pop(0)
if field_name not in ... | [
"Aggregate",
"lookup",
"parameters",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/query.py#L698-L742 | [
"def",
"aggregate",
"(",
"self",
",",
"kwargs",
")",
":",
"meta",
"=",
"self",
".",
"_meta",
"fields",
"=",
"meta",
".",
"dfields",
"field_lookups",
"=",
"{",
"}",
"for",
"name",
",",
"value",
"in",
"iteritems",
"(",
"kwargs",
")",
":",
"bits",
"=",
... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | models_from_model | Generator of all model in model. | stdnet/odm/mapper.py | def models_from_model(model, include_related=False, exclude=None):
'''Generator of all model in model.'''
if exclude is None:
exclude = set()
if model and model not in exclude:
exclude.add(model)
if isinstance(model, ModelType) and not model._meta.abstract:
yield model
... | def models_from_model(model, include_related=False, exclude=None):
'''Generator of all model in model.'''
if exclude is None:
exclude = set()
if model and model not in exclude:
exclude.add(model)
if isinstance(model, ModelType) and not model._meta.abstract:
yield model
... | [
"Generator",
"of",
"all",
"model",
"in",
"model",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/mapper.py#L281-L307 | [
"def",
"models_from_model",
"(",
"model",
",",
"include_related",
"=",
"False",
",",
"exclude",
"=",
"None",
")",
":",
"if",
"exclude",
"is",
"None",
":",
"exclude",
"=",
"set",
"(",
")",
"if",
"model",
"and",
"model",
"not",
"in",
"exclude",
":",
"exc... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | model_iterator | A generator of :class:`StdModel` classes found in *application*.
:parameter application: A python dotted path or an iterable over python
dotted-paths where models are defined.
Only models defined in these paths are considered.
For example::
from stdnet.odm import model_iterator
APPS = ('stdnet.contrib.... | stdnet/odm/mapper.py | def model_iterator(application, include_related=True, exclude=None):
'''A generator of :class:`StdModel` classes found in *application*.
:parameter application: A python dotted path or an iterable over python
dotted-paths where models are defined.
Only models defined in these paths are considered.
For exampl... | def model_iterator(application, include_related=True, exclude=None):
'''A generator of :class:`StdModel` classes found in *application*.
:parameter application: A python dotted path or an iterable over python
dotted-paths where models are defined.
Only models defined in these paths are considered.
For exampl... | [
"A",
"generator",
"of",
":",
"class",
":",
"StdModel",
"classes",
"found",
"in",
"*",
"application",
"*",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/mapper.py#L310-L363 | [
"def",
"model_iterator",
"(",
"application",
",",
"include_related",
"=",
"True",
",",
"exclude",
"=",
"None",
")",
":",
"if",
"exclude",
"is",
"None",
":",
"exclude",
"=",
"set",
"(",
")",
"application",
"=",
"native_str",
"(",
"application",
")",
"if",
... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Router.set_search_engine | Set the search ``engine`` for this :class:`Router`. | stdnet/odm/mapper.py | def set_search_engine(self, engine):
'''Set the search ``engine`` for this :class:`Router`.'''
self._search_engine = engine
self._search_engine.set_router(self) | def set_search_engine(self, engine):
'''Set the search ``engine`` for this :class:`Router`.'''
self._search_engine = engine
self._search_engine.set_router(self) | [
"Set",
"the",
"search",
"engine",
"for",
"this",
":",
"class",
":",
"Router",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/mapper.py#L112-L115 | [
"def",
"set_search_engine",
"(",
"self",
",",
"engine",
")",
":",
"self",
".",
"_search_engine",
"=",
"engine",
"self",
".",
"_search_engine",
".",
"set_router",
"(",
"self",
")"
] | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Router.register | Register a :class:`Model` with this :class:`Router`. If the
model was already registered it does nothing.
:param model: a :class:`Model` class.
:param backend: a :class:`stdnet.BackendDataServer` or a
:ref:`connection string <connection-string>`.
:param read_backend: Optional :class:`stdnet.BackendDataServer` for ... | stdnet/odm/mapper.py | def register(self, model, backend=None, read_backend=None,
include_related=True, **params):
'''Register a :class:`Model` with this :class:`Router`. If the
model was already registered it does nothing.
:param model: a :class:`Model` class.
:param backend: a :class:`stdnet.BackendDataServer` or ... | def register(self, model, backend=None, read_backend=None,
include_related=True, **params):
'''Register a :class:`Model` with this :class:`Router`. If the
model was already registered it does nothing.
:param model: a :class:`Model` class.
:param backend: a :class:`stdnet.BackendDataServer` or ... | [
"Register",
"a",
":",
"class",
":",
"Model",
"with",
"this",
":",
"class",
":",
"Router",
".",
"If",
"the",
"model",
"was",
"already",
"registered",
"it",
"does",
"nothing",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/mapper.py#L117-L160 | [
"def",
"register",
"(",
"self",
",",
"model",
",",
"backend",
"=",
"None",
",",
"read_backend",
"=",
"None",
",",
"include_related",
"=",
"True",
",",
"*",
"*",
"params",
")",
":",
"backend",
"=",
"backend",
"or",
"self",
".",
"_default_backend",
"backen... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Router.from_uuid | Retrieve a :class:`Model` from its universally unique identifier
``uuid``. If the ``uuid`` does not match any instance an exception will raise. | stdnet/odm/mapper.py | def from_uuid(self, uuid, session=None):
'''Retrieve a :class:`Model` from its universally unique identifier
``uuid``. If the ``uuid`` does not match any instance an exception will raise.
'''
elems = uuid.split('.')
if len(elems) == 2:
model = get_model_from_hash(elems[0])
... | def from_uuid(self, uuid, session=None):
'''Retrieve a :class:`Model` from its universally unique identifier
``uuid``. If the ``uuid`` does not match any instance an exception will raise.
'''
elems = uuid.split('.')
if len(elems) == 2:
model = get_model_from_hash(elems[0])
... | [
"Retrieve",
"a",
":",
"class",
":",
"Model",
"from",
"its",
"universally",
"unique",
"identifier",
"uuid",
".",
"If",
"the",
"uuid",
"does",
"not",
"match",
"any",
"instance",
"an",
"exception",
"will",
"raise",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/mapper.py#L162-L175 | [
"def",
"from_uuid",
"(",
"self",
",",
"uuid",
",",
"session",
"=",
"None",
")",
":",
"elems",
"=",
"uuid",
".",
"split",
"(",
"'.'",
")",
"if",
"len",
"(",
"elems",
")",
"==",
"2",
":",
"model",
"=",
"get_model_from_hash",
"(",
"elems",
"[",
"0",
... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Router.flush | Flush :attr:`registered_models`.
:param exclude: optional list of model names to exclude.
:param include: optional list of model names to include.
:param dryrun: Doesn't remove anything, simply collect managers
to flush.
:return: | stdnet/odm/mapper.py | def flush(self, exclude=None, include=None, dryrun=False):
'''Flush :attr:`registered_models`.
:param exclude: optional list of model names to exclude.
:param include: optional list of model names to include.
:param dryrun: Doesn't remove anything, simply collect managers
to... | def flush(self, exclude=None, include=None, dryrun=False):
'''Flush :attr:`registered_models`.
:param exclude: optional list of model names to exclude.
:param include: optional list of model names to include.
:param dryrun: Doesn't remove anything, simply collect managers
to... | [
"Flush",
":",
"attr",
":",
"registered_models",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/mapper.py#L177-L198 | [
"def",
"flush",
"(",
"self",
",",
"exclude",
"=",
"None",
",",
"include",
"=",
"None",
",",
"dryrun",
"=",
"False",
")",
":",
"exclude",
"=",
"exclude",
"or",
"[",
"]",
"results",
"=",
"[",
"]",
"for",
"manager",
"in",
"self",
".",
"_registered_model... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Router.unregister | Unregister a ``model`` if provided, otherwise it unregister all
registered models. Return a list of unregistered model managers or ``None``
if no managers were removed. | stdnet/odm/mapper.py | def unregister(self, model=None):
'''Unregister a ``model`` if provided, otherwise it unregister all
registered models. Return a list of unregistered model managers or ``None``
if no managers were removed.'''
if model is not None:
try:
manager = self._registered_models.pop(mo... | def unregister(self, model=None):
'''Unregister a ``model`` if provided, otherwise it unregister all
registered models. Return a list of unregistered model managers or ``None``
if no managers were removed.'''
if model is not None:
try:
manager = self._registered_models.pop(mo... | [
"Unregister",
"a",
"model",
"if",
"provided",
"otherwise",
"it",
"unregister",
"all",
"registered",
"models",
".",
"Return",
"a",
"list",
"of",
"unregistered",
"model",
"managers",
"or",
"None",
"if",
"no",
"managers",
"were",
"removed",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/mapper.py#L200-L215 | [
"def",
"unregister",
"(",
"self",
",",
"model",
"=",
"None",
")",
":",
"if",
"model",
"is",
"not",
"None",
":",
"try",
":",
"manager",
"=",
"self",
".",
"_registered_models",
".",
"pop",
"(",
"model",
")",
"except",
"KeyError",
":",
"return",
"if",
"... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Router.register_applications | A higher level registration functions for group of models located
on application modules.
It uses the :func:`model_iterator` function to iterate
through all :class:`Model` models available in ``applications``
and register them using the :func:`register` low level method.
:parameter applications: A String or a list of ... | stdnet/odm/mapper.py | def register_applications(self, applications, models=None, backends=None):
'''A higher level registration functions for group of models located
on application modules.
It uses the :func:`model_iterator` function to iterate
through all :class:`Model` models available in ``applications``
and register them using t... | def register_applications(self, applications, models=None, backends=None):
'''A higher level registration functions for group of models located
on application modules.
It uses the :func:`model_iterator` function to iterate
through all :class:`Model` models available in ``applications``
and register them using t... | [
"A",
"higher",
"level",
"registration",
"functions",
"for",
"group",
"of",
"models",
"located",
"on",
"application",
"modules",
".",
"It",
"uses",
"the",
":",
"func",
":",
"model_iterator",
"function",
"to",
"iterate",
"through",
"all",
":",
"class",
":",
"M... | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/mapper.py#L217-L242 | [
"def",
"register_applications",
"(",
"self",
",",
"applications",
",",
"models",
"=",
"None",
",",
"backends",
"=",
"None",
")",
":",
"return",
"list",
"(",
"self",
".",
"_register_applications",
"(",
"applications",
",",
"models",
",",
"backends",
")",
")"
... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Redis.execute_script | Execute a script.
makes sure all required scripts are loaded. | stdnet/backends/redisb/client/async.py | def execute_script(self, name, keys, *args, **options):
'''Execute a script.
makes sure all required scripts are loaded.
'''
script = get_script(name)
if not script:
raise redis.RedisError('No such script "%s"' % name)
address = self.address()
if addr... | def execute_script(self, name, keys, *args, **options):
'''Execute a script.
makes sure all required scripts are loaded.
'''
script = get_script(name)
if not script:
raise redis.RedisError('No such script "%s"' % name)
address = self.address()
if addr... | [
"Execute",
"a",
"script",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/backends/redisb/client/async.py#L40-L57 | [
"def",
"execute_script",
"(",
"self",
",",
"name",
",",
"keys",
",",
"*",
"args",
",",
"*",
"*",
"options",
")",
":",
"script",
"=",
"get_script",
"(",
"name",
")",
"if",
"not",
"script",
":",
"raise",
"redis",
".",
"RedisError",
"(",
"'No such script ... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | SearchEngine.register | Register a :class:`StdModel` with this search :class:`SearchEngine`.
When registering a model, every time an instance is created, it will be
indexed by the search engine.
:param model: a :class:`StdModel` class.
:param related: a list of related fields to include in the index. | stdnet/odm/search.py | def register(self, model, related=None):
'''Register a :class:`StdModel` with this search :class:`SearchEngine`.
When registering a model, every time an instance is created, it will be
indexed by the search engine.
:param model: a :class:`StdModel` class.
:param related: a list of related fields to inclu... | def register(self, model, related=None):
'''Register a :class:`StdModel` with this search :class:`SearchEngine`.
When registering a model, every time an instance is created, it will be
indexed by the search engine.
:param model: a :class:`StdModel` class.
:param related: a list of related fields to inclu... | [
"Register",
"a",
":",
"class",
":",
"StdModel",
"with",
"this",
"search",
":",
"class",
":",
"SearchEngine",
".",
"When",
"registering",
"a",
"model",
"every",
"time",
"an",
"instance",
"is",
"created",
"it",
"will",
"be",
"indexed",
"by",
"the",
"search",... | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/search.py#L67-L78 | [
"def",
"register",
"(",
"self",
",",
"model",
",",
"related",
"=",
"None",
")",
":",
"update_model",
"=",
"UpdateSE",
"(",
"self",
",",
"related",
")",
"self",
".",
"REGISTERED_MODELS",
"[",
"model",
"]",
"=",
"update_model",
"self",
".",
"router",
".",
... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | SearchEngine.words_from_text | Generator of indexable words in *text*.
This functions loop through the :attr:`word_middleware` attribute
to process the text.
:param text: string from which to extract words.
:param for_search: flag indicating if the the words will be used for search
or to index the database. This flug is used in conjunctio... | stdnet/odm/search.py | def words_from_text(self, text, for_search=False):
'''Generator of indexable words in *text*.
This functions loop through the :attr:`word_middleware` attribute
to process the text.
:param text: string from which to extract words.
:param for_search: flag indicating if the the words will be used for search... | def words_from_text(self, text, for_search=False):
'''Generator of indexable words in *text*.
This functions loop through the :attr:`word_middleware` attribute
to process the text.
:param text: string from which to extract words.
:param for_search: flag indicating if the the words will be used for search... | [
"Generator",
"of",
"indexable",
"words",
"in",
"*",
"text",
"*",
".",
"This",
"functions",
"loop",
"through",
"the",
":",
"attr",
":",
"word_middleware",
"attribute",
"to",
"process",
"the",
"text",
".",
":",
"param",
"text",
":",
"string",
"from",
"which"... | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/search.py#L86-L112 | [
"def",
"words_from_text",
"(",
"self",
",",
"text",
",",
"for_search",
"=",
"False",
")",
":",
"if",
"not",
"text",
":",
"return",
"[",
"]",
"word_gen",
"=",
"self",
".",
"split_text",
"(",
"text",
")",
"for",
"middleware",
",",
"fors",
"in",
"self",
... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | SearchEngine.add_word_middleware | Add a *middleware* function to the list of :attr:`word_middleware`,
for preprocessing words to be indexed.
:param middleware: a callable receving an iterable over words.
:param for_search: flag indicating if the *middleware* can be used for the
text to search. Default: ``True``. | stdnet/odm/search.py | def add_word_middleware(self, middleware, for_search=True):
'''Add a *middleware* function to the list of :attr:`word_middleware`,
for preprocessing words to be indexed.
:param middleware: a callable receving an iterable over words.
:param for_search: flag indicating if the *middleware* can be used for th... | def add_word_middleware(self, middleware, for_search=True):
'''Add a *middleware* function to the list of :attr:`word_middleware`,
for preprocessing words to be indexed.
:param middleware: a callable receving an iterable over words.
:param for_search: flag indicating if the *middleware* can be used for th... | [
"Add",
"a",
"*",
"middleware",
"*",
"function",
"to",
"the",
"list",
"of",
":",
"attr",
":",
"word_middleware",
"for",
"preprocessing",
"words",
"to",
"be",
"indexed",
".",
":",
"param",
"middleware",
":",
"a",
"callable",
"receving",
"an",
"iterable",
"ov... | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/search.py#L123-L132 | [
"def",
"add_word_middleware",
"(",
"self",
",",
"middleware",
",",
"for_search",
"=",
"True",
")",
":",
"if",
"hasattr",
"(",
"middleware",
",",
"'__call__'",
")",
":",
"self",
".",
"word_middleware",
".",
"append",
"(",
"(",
"middleware",
",",
"for_search",... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | SearchEngine.query | Return a query for ``model`` when it needs to be indexed. | stdnet/odm/search.py | def query(self, model):
'''Return a query for ``model`` when it needs to be indexed.
'''
session = self.router.session()
fields = tuple((f.name for f in model._meta.scalarfields
if f.type == 'text'))
qs = session.query(model).load_only(*fields)
... | def query(self, model):
'''Return a query for ``model`` when it needs to be indexed.
'''
session = self.router.session()
fields = tuple((f.name for f in model._meta.scalarfields
if f.type == 'text'))
qs = session.query(model).load_only(*fields)
... | [
"Return",
"a",
"query",
"for",
"model",
"when",
"it",
"needs",
"to",
"be",
"indexed",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/search.py#L142-L151 | [
"def",
"query",
"(",
"self",
",",
"model",
")",
":",
"session",
"=",
"self",
".",
"router",
".",
"session",
"(",
")",
"fields",
"=",
"tuple",
"(",
"(",
"f",
".",
"name",
"for",
"f",
"in",
"model",
".",
"_meta",
".",
"scalarfields",
"if",
"f",
"."... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | get_version | Returns a PEP 386-compliant version number from *version*. | stdnet/utils/version.py | def get_version(version):
"Returns a PEP 386-compliant version number from *version*."
assert len(version) == 5
assert version[3] in ('alpha', 'beta', 'rc', 'final')
parts = 2 if version[2] == 0 else 3
main = '.'.join(map(str, version[:parts]))
sub = ''
if version[3] == 'alpha' and ve... | def get_version(version):
"Returns a PEP 386-compliant version number from *version*."
assert len(version) == 5
assert version[3] in ('alpha', 'beta', 'rc', 'final')
parts = 2 if version[2] == 0 else 3
main = '.'.join(map(str, version[:parts]))
sub = ''
if version[3] == 'alpha' and ve... | [
"Returns",
"a",
"PEP",
"386",
"-",
"compliant",
"version",
"number",
"from",
"*",
"version",
"*",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/utils/version.py#L20-L34 | [
"def",
"get_version",
"(",
"version",
")",
":",
"assert",
"len",
"(",
"version",
")",
"==",
"5",
"assert",
"version",
"[",
"3",
"]",
"in",
"(",
"'alpha'",
",",
"'beta'",
",",
"'rc'",
",",
"'final'",
")",
"parts",
"=",
"2",
"if",
"version",
"[",
"2"... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Get_RpRs | Returns the value of the planet radius over the stellar radius
for a given depth :py:obj:`d`, given
the :py:class:`everest.pysyzygy` transit :py:obj:`kwargs`. | everest/transit.py | def Get_RpRs(d, **kwargs):
'''
Returns the value of the planet radius over the stellar radius
for a given depth :py:obj:`d`, given
the :py:class:`everest.pysyzygy` transit :py:obj:`kwargs`.
'''
if ps is None:
raise Exception("Unable to import `pysyzygy`.")
def Depth(RpRs, **kwa... | def Get_RpRs(d, **kwargs):
'''
Returns the value of the planet radius over the stellar radius
for a given depth :py:obj:`d`, given
the :py:class:`everest.pysyzygy` transit :py:obj:`kwargs`.
'''
if ps is None:
raise Exception("Unable to import `pysyzygy`.")
def Depth(RpRs, **kwa... | [
"Returns",
"the",
"value",
"of",
"the",
"planet",
"radius",
"over",
"the",
"stellar",
"radius",
"for",
"a",
"given",
"depth",
":",
"py",
":",
"obj",
":",
"d",
"given",
"the",
":",
"py",
":",
"class",
":",
"everest",
".",
"pysyzygy",
"transit",
":",
"... | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/transit.py#L118-L134 | [
"def",
"Get_RpRs",
"(",
"d",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"ps",
"is",
"None",
":",
"raise",
"Exception",
"(",
"\"Unable to import `pysyzygy`.\"",
")",
"def",
"Depth",
"(",
"RpRs",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"1",
"-",
"ps... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | Get_rhos | Returns the value of the stellar density for a given transit
duration :py:obj:`dur`, given
the :py:class:`everest.pysyzygy` transit :py:obj:`kwargs`. | everest/transit.py | def Get_rhos(dur, **kwargs):
'''
Returns the value of the stellar density for a given transit
duration :py:obj:`dur`, given
the :py:class:`everest.pysyzygy` transit :py:obj:`kwargs`.
'''
if ps is None:
raise Exception("Unable to import `pysyzygy`.")
assert dur >= 0.01 and dur <... | def Get_rhos(dur, **kwargs):
'''
Returns the value of the stellar density for a given transit
duration :py:obj:`dur`, given
the :py:class:`everest.pysyzygy` transit :py:obj:`kwargs`.
'''
if ps is None:
raise Exception("Unable to import `pysyzygy`.")
assert dur >= 0.01 and dur <... | [
"Returns",
"the",
"value",
"of",
"the",
"stellar",
"density",
"for",
"a",
"given",
"transit",
"duration",
":",
"py",
":",
"obj",
":",
"dur",
"given",
"the",
":",
"py",
":",
"class",
":",
"everest",
".",
"pysyzygy",
"transit",
":",
"py",
":",
"obj",
"... | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/transit.py#L137-L161 | [
"def",
"Get_rhos",
"(",
"dur",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"ps",
"is",
"None",
":",
"raise",
"Exception",
"(",
"\"Unable to import `pysyzygy`.\"",
")",
"assert",
"dur",
">=",
"0.01",
"and",
"dur",
"<=",
"0.5",
",",
"\"Invalid value for the durat... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | Transit | A `Mandel-Agol <http://adsabs.harvard.edu/abs/2002ApJ...580L.171M>`_
transit model, but with the depth and the duration as primary
input variables.
:param numpy.ndarray time: The time array
:param float t0: The time of first transit in units of \
:py:obj:`BJD` - 2454833.
:param float dur... | everest/transit.py | def Transit(time, t0=0., dur=0.1, per=3.56789, depth=0.001, **kwargs):
'''
A `Mandel-Agol <http://adsabs.harvard.edu/abs/2002ApJ...580L.171M>`_
transit model, but with the depth and the duration as primary
input variables.
:param numpy.ndarray time: The time array
:param float t0: The time of f... | def Transit(time, t0=0., dur=0.1, per=3.56789, depth=0.001, **kwargs):
'''
A `Mandel-Agol <http://adsabs.harvard.edu/abs/2002ApJ...580L.171M>`_
transit model, but with the depth and the duration as primary
input variables.
:param numpy.ndarray time: The time array
:param float t0: The time of f... | [
"A",
"Mandel",
"-",
"Agol",
"<http",
":",
"//",
"adsabs",
".",
"harvard",
".",
"edu",
"/",
"abs",
"/",
"2002ApJ",
"...",
"580L",
".",
"171M",
">",
"_",
"transit",
"model",
"but",
"with",
"the",
"depth",
"and",
"the",
"duration",
"as",
"primary",
"inp... | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/transit.py#L164-L191 | [
"def",
"Transit",
"(",
"time",
",",
"t0",
"=",
"0.",
",",
"dur",
"=",
"0.1",
",",
"per",
"=",
"3.56789",
",",
"depth",
"=",
"0.001",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"ps",
"is",
"None",
":",
"raise",
"Exception",
"(",
"\"Unable to import `p... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | TimeSeries.intervals | Given a ``startdate`` and an ``enddate`` dates, evaluate the
date intervals from which data is not available. It return a list
of two-dimensional tuples containing start and end date for the
interval. The list could contain 0, 1 or 2 tuples. | examples/tsmodels.py | def intervals(self, startdate, enddate, parseinterval=None):
'''Given a ``startdate`` and an ``enddate`` dates, evaluate the
date intervals from which data is not available. It return a list
of two-dimensional tuples containing start and end date for the
interval. The list could cont... | def intervals(self, startdate, enddate, parseinterval=None):
'''Given a ``startdate`` and an ``enddate`` dates, evaluate the
date intervals from which data is not available. It return a list
of two-dimensional tuples containing start and end date for the
interval. The list could cont... | [
"Given",
"a",
"startdate",
"and",
"an",
"enddate",
"dates",
"evaluate",
"the",
"date",
"intervals",
"from",
"which",
"data",
"is",
"not",
"available",
".",
"It",
"return",
"a",
"list",
"of",
"two",
"-",
"dimensional",
"tuples",
"containing",
"start",
"and",
... | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/examples/tsmodels.py#L35-L42 | [
"def",
"intervals",
"(",
"self",
",",
"startdate",
",",
"enddate",
",",
"parseinterval",
"=",
"None",
")",
":",
"return",
"missing_intervals",
"(",
"startdate",
",",
"enddate",
",",
"self",
".",
"data_start",
",",
"self",
".",
"data_end",
",",
"dateconverter... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | ColumnTS.front | Return the front pair of the structure | stdnet/apps/columnts/models.py | def front(self, *fields):
'''Return the front pair of the structure'''
v, f = tuple(self.irange(0, 0, fields=fields))
if v:
return (v[0], dict(((field, f[field][0]) for field in f))) | def front(self, *fields):
'''Return the front pair of the structure'''
v, f = tuple(self.irange(0, 0, fields=fields))
if v:
return (v[0], dict(((field, f[field][0]) for field in f))) | [
"Return",
"the",
"front",
"pair",
"of",
"the",
"structure"
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/apps/columnts/models.py#L52-L56 | [
"def",
"front",
"(",
"self",
",",
"*",
"fields",
")",
":",
"v",
",",
"f",
"=",
"tuple",
"(",
"self",
".",
"irange",
"(",
"0",
",",
"0",
",",
"fields",
"=",
"fields",
")",
")",
"if",
"v",
":",
"return",
"(",
"v",
"[",
"0",
"]",
",",
"dict",
... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | ColumnTS.istats | Perform a multivariate statistic calculation of this
:class:`ColumnTS` from *start* to *end*.
:param start: Optional index (rank) where to start the analysis.
:param end: Optional index (rank) where to end the analysis.
:param fields: Optional subset of :meth:`fields` to perform analysis on.
If not provided ... | stdnet/apps/columnts/models.py | def istats(self, start=0, end=-1, fields=None):
'''Perform a multivariate statistic calculation of this
:class:`ColumnTS` from *start* to *end*.
:param start: Optional index (rank) where to start the analysis.
:param end: Optional index (rank) where to end the analysis.
:param fields: Optional subset of ... | def istats(self, start=0, end=-1, fields=None):
'''Perform a multivariate statistic calculation of this
:class:`ColumnTS` from *start* to *end*.
:param start: Optional index (rank) where to start the analysis.
:param end: Optional index (rank) where to end the analysis.
:param fields: Optional subset of ... | [
"Perform",
"a",
"multivariate",
"statistic",
"calculation",
"of",
"this",
":",
"class",
":",
"ColumnTS",
"from",
"*",
"start",
"*",
"to",
"*",
"end",
"*",
".",
":",
"param",
"start",
":",
"Optional",
"index",
"(",
"rank",
")",
"where",
"to",
"start",
"... | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/apps/columnts/models.py#L102-L113 | [
"def",
"istats",
"(",
"self",
",",
"start",
"=",
"0",
",",
"end",
"=",
"-",
"1",
",",
"fields",
"=",
"None",
")",
":",
"backend",
"=",
"self",
".",
"read_backend",
"return",
"backend",
".",
"execute",
"(",
"backend",
".",
"structure",
"(",
"self",
... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | ColumnTS.stats | Perform a multivariate statistic calculation of this
:class:`ColumnTS` from a *start* date/datetime to an
*end* date/datetime.
:param start: Start date for analysis.
:param end: End date for analysis.
:param fields: Optional subset of :meth:`fields` to perform analysis on.
If not provided all fields are in... | stdnet/apps/columnts/models.py | def stats(self, start, end, fields=None):
'''Perform a multivariate statistic calculation of this
:class:`ColumnTS` from a *start* date/datetime to an
*end* date/datetime.
:param start: Start date for analysis.
:param end: End date for analysis.
:param fields: Optional subset of :meth:`fields` to perfo... | def stats(self, start, end, fields=None):
'''Perform a multivariate statistic calculation of this
:class:`ColumnTS` from a *start* date/datetime to an
*end* date/datetime.
:param start: Start date for analysis.
:param end: End date for analysis.
:param fields: Optional subset of :meth:`fields` to perfo... | [
"Perform",
"a",
"multivariate",
"statistic",
"calculation",
"of",
"this",
":",
"class",
":",
"ColumnTS",
"from",
"a",
"*",
"start",
"*",
"date",
"/",
"datetime",
"to",
"an",
"*",
"end",
"*",
"date",
"/",
"datetime",
".",
":",
"param",
"start",
":",
"St... | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/apps/columnts/models.py#L115-L129 | [
"def",
"stats",
"(",
"self",
",",
"start",
",",
"end",
",",
"fields",
"=",
"None",
")",
":",
"start",
"=",
"self",
".",
"pickler",
".",
"dumps",
"(",
"start",
")",
"end",
"=",
"self",
".",
"pickler",
".",
"dumps",
"(",
"end",
")",
"backend",
"=",... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | ColumnTS.imulti_stats | Perform cross multivariate statistics calculation of
this :class:`ColumnTS` and other optional *series* from *start*
to *end*.
:parameter start: the start rank.
:parameter start: the end rank
:parameter field: name of field to perform multivariate statistics.
:parameter series: a list of two elements tuple cont... | stdnet/apps/columnts/models.py | def imulti_stats(self, start=0, end=-1, series=None, fields=None,
stats=None):
'''Perform cross multivariate statistics calculation of
this :class:`ColumnTS` and other optional *series* from *start*
to *end*.
:parameter start: the start rank.
:parameter start: the end rank
:paramet... | def imulti_stats(self, start=0, end=-1, series=None, fields=None,
stats=None):
'''Perform cross multivariate statistics calculation of
this :class:`ColumnTS` and other optional *series* from *start*
to *end*.
:parameter start: the start rank.
:parameter start: the end rank
:paramet... | [
"Perform",
"cross",
"multivariate",
"statistics",
"calculation",
"of",
"this",
":",
"class",
":",
"ColumnTS",
"and",
"other",
"optional",
"*",
"series",
"*",
"from",
"*",
"start",
"*",
"to",
"*",
"end",
"*",
".",
":",
"parameter",
"start",
":",
"the",
"s... | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/apps/columnts/models.py#L131-L149 | [
"def",
"imulti_stats",
"(",
"self",
",",
"start",
"=",
"0",
",",
"end",
"=",
"-",
"1",
",",
"series",
"=",
"None",
",",
"fields",
"=",
"None",
",",
"stats",
"=",
"None",
")",
":",
"stats",
"=",
"stats",
"or",
"self",
".",
"default_multi_stats",
"ba... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | ColumnTS.merge | Merge this :class:`ColumnTS` with several other *series*.
:parameters series: a list of tuples where the nth element is a tuple
of the form::
(wight_n, ts_n1, ts_n2, ..., ts_nMn)
The result will be calculated using the formula::
ts = weight_1*ts_11*ts_12*...*ts_1M1 + weight_2*ts_21*ts_22*...*ts... | stdnet/apps/columnts/models.py | def merge(self, *series, **kwargs):
'''Merge this :class:`ColumnTS` with several other *series*.
:parameters series: a list of tuples where the nth element is a tuple
of the form::
(wight_n, ts_n1, ts_n2, ..., ts_nMn)
The result will be calculated using the formula::
ts = weight_1*ts_1... | def merge(self, *series, **kwargs):
'''Merge this :class:`ColumnTS` with several other *series*.
:parameters series: a list of tuples where the nth element is a tuple
of the form::
(wight_n, ts_n1, ts_n2, ..., ts_nMn)
The result will be calculated using the formula::
ts = weight_1*ts_1... | [
"Merge",
"this",
":",
"class",
":",
"ColumnTS",
"with",
"several",
"other",
"*",
"series",
"*",
".",
":",
"parameters",
"series",
":",
"a",
"list",
"of",
"tuples",
"where",
"the",
"nth",
"element",
"is",
"a",
"tuple",
"of",
"the",
"form",
"::",
"(",
... | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/apps/columnts/models.py#L171-L188 | [
"def",
"merge",
"(",
"self",
",",
"*",
"series",
",",
"*",
"*",
"kwargs",
")",
":",
"session",
"=",
"self",
".",
"session",
"if",
"not",
"session",
":",
"raise",
"SessionNotAvailable",
"(",
"'No session available'",
")",
"self",
".",
"check_router",
"(",
... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | ColumnTS.merged_series | Merge ``series`` and return the results without storing data
in the backend server. | stdnet/apps/columnts/models.py | def merged_series(cls, *series, **kwargs):
'''Merge ``series`` and return the results without storing data
in the backend server.'''
router, backend = cls.check_router(None, *series)
if backend:
target = router.register(cls(), backend)
router.session().add(target)
... | def merged_series(cls, *series, **kwargs):
'''Merge ``series`` and return the results without storing data
in the backend server.'''
router, backend = cls.check_router(None, *series)
if backend:
target = router.register(cls(), backend)
router.session().add(target)
... | [
"Merge",
"series",
"and",
"return",
"the",
"results",
"without",
"storing",
"data",
"in",
"the",
"backend",
"server",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/apps/columnts/models.py#L191-L202 | [
"def",
"merged_series",
"(",
"cls",
",",
"*",
"series",
",",
"*",
"*",
"kwargs",
")",
":",
"router",
",",
"backend",
"=",
"cls",
".",
"check_router",
"(",
"None",
",",
"*",
"series",
")",
"if",
"backend",
":",
"target",
"=",
"router",
".",
"register"... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | skiplist.rank | Return the 0-based index (rank) of ``score``. If the score is not
available it returns a negative integer which absolute score is the
left most closest index with score less than *score*. | stdnet/utils/skiplist.py | def rank(self, score):
'''Return the 0-based index (rank) of ``score``. If the score is not
available it returns a negative integer which absolute score is the
left most closest index with score less than *score*.'''
node = self.__head
rank = 0
for i in range(self.__level-1, -1, -1):
... | def rank(self, score):
'''Return the 0-based index (rank) of ``score``. If the score is not
available it returns a negative integer which absolute score is the
left most closest index with score less than *score*.'''
node = self.__head
rank = 0
for i in range(self.__level-1, -1, -1):
... | [
"Return",
"the",
"0",
"-",
"based",
"index",
"(",
"rank",
")",
"of",
"score",
".",
"If",
"the",
"score",
"is",
"not",
"available",
"it",
"returns",
"a",
"negative",
"integer",
"which",
"absolute",
"score",
"is",
"the",
"left",
"most",
"closest",
"index",... | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/utils/skiplist.py#L74-L87 | [
"def",
"rank",
"(",
"self",
",",
"score",
")",
":",
"node",
"=",
"self",
".",
"__head",
"rank",
"=",
"0",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"__level",
"-",
"1",
",",
"-",
"1",
",",
"-",
"1",
")",
":",
"while",
"node",
".",
"next",
... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | ModelMeta.make_object | Create a new instance of :attr:`model` from a *state* tuple. | stdnet/odm/base.py | def make_object(self, state=None, backend=None):
'''Create a new instance of :attr:`model` from a *state* tuple.'''
model = self.model
obj = model.__new__(model)
self.load_state(obj, state, backend)
return obj | def make_object(self, state=None, backend=None):
'''Create a new instance of :attr:`model` from a *state* tuple.'''
model = self.model
obj = model.__new__(model)
self.load_state(obj, state, backend)
return obj | [
"Create",
"a",
"new",
"instance",
"of",
":",
"attr",
":",
"model",
"from",
"a",
"*",
"state",
"*",
"tuple",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/base.py#L201-L206 | [
"def",
"make_object",
"(",
"self",
",",
"state",
"=",
"None",
",",
"backend",
"=",
"None",
")",
":",
"model",
"=",
"self",
".",
"model",
"obj",
"=",
"model",
".",
"__new__",
"(",
"model",
")",
"self",
".",
"load_state",
"(",
"obj",
",",
"state",
",... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | ModelMeta.is_valid | Perform validation for *instance* and stores serialized data,
indexes and errors into local cache.
Return ``True`` if the instance is ready to be saved to database. | stdnet/odm/base.py | def is_valid(self, instance):
'''Perform validation for *instance* and stores serialized data,
indexes and errors into local cache.
Return ``True`` if the instance is ready to be saved to database.'''
dbdata = instance.dbdata
data = dbdata['cleaned_data'] = {}
errors = dbdata['erro... | def is_valid(self, instance):
'''Perform validation for *instance* and stores serialized data,
indexes and errors into local cache.
Return ``True`` if the instance is ready to be saved to database.'''
dbdata = instance.dbdata
data = dbdata['cleaned_data'] = {}
errors = dbdata['erro... | [
"Perform",
"validation",
"for",
"*",
"instance",
"*",
"and",
"stores",
"serialized",
"data",
"indexes",
"and",
"errors",
"into",
"local",
"cache",
".",
"Return",
"True",
"if",
"the",
"instance",
"is",
"ready",
"to",
"be",
"saved",
"to",
"database",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/base.py#L239-L262 | [
"def",
"is_valid",
"(",
"self",
",",
"instance",
")",
":",
"dbdata",
"=",
"instance",
".",
"dbdata",
"data",
"=",
"dbdata",
"[",
"'cleaned_data'",
"]",
"=",
"{",
"}",
"errors",
"=",
"dbdata",
"[",
"'errors'",
"]",
"=",
"{",
"}",
"#Loop over scalar fields... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | ModelMeta.backend_fields | Return a two elements tuple containing a list
of fields names and a list of field attribute names. | stdnet/odm/base.py | def backend_fields(self, fields):
'''Return a two elements tuple containing a list
of fields names and a list of field attribute names.'''
dfields = self.dfields
processed = set()
names = []
atts = []
pkname = self.pkname()
for name in fields:
... | def backend_fields(self, fields):
'''Return a two elements tuple containing a list
of fields names and a list of field attribute names.'''
dfields = self.dfields
processed = set()
names = []
atts = []
pkname = self.pkname()
for name in fields:
... | [
"Return",
"a",
"two",
"elements",
"tuple",
"containing",
"a",
"list",
"of",
"fields",
"names",
"and",
"a",
"list",
"of",
"field",
"attribute",
"names",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/base.py#L292-L316 | [
"def",
"backend_fields",
"(",
"self",
",",
"fields",
")",
":",
"dfields",
"=",
"self",
".",
"dfields",
"processed",
"=",
"set",
"(",
")",
"names",
"=",
"[",
"]",
"atts",
"=",
"[",
"]",
"pkname",
"=",
"self",
".",
"pkname",
"(",
")",
"for",
"name",
... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | ModelMeta.as_dict | Model metadata in a dictionary | stdnet/odm/base.py | def as_dict(self):
'''Model metadata in a dictionary'''
pk = self.pk
id_type = 3
if pk.type == 'auto':
id_type = 1
return {'id_name': pk.name,
'id_type': id_type,
'sorted': bool(self.ordering),
'autoincr': self.... | def as_dict(self):
'''Model metadata in a dictionary'''
pk = self.pk
id_type = 3
if pk.type == 'auto':
id_type = 1
return {'id_name': pk.name,
'id_type': id_type,
'sorted': bool(self.ordering),
'autoincr': self.... | [
"Model",
"metadata",
"in",
"a",
"dictionary"
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/base.py#L318-L330 | [
"def",
"as_dict",
"(",
"self",
")",
":",
"pk",
"=",
"self",
".",
"pk",
"id_type",
"=",
"3",
"if",
"pk",
".",
"type",
"==",
"'auto'",
":",
"id_type",
"=",
"1",
"return",
"{",
"'id_name'",
":",
"pk",
".",
"name",
",",
"'id_type'",
":",
"id_type",
"... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Model.get_state | Return the current :class:`ModelState` for this :class:`Model`.
If ``kwargs`` parameters are passed a new :class:`ModelState` is created,
otherwise it returns the cached value. | stdnet/odm/base.py | def get_state(self, **kwargs):
'''Return the current :class:`ModelState` for this :class:`Model`.
If ``kwargs`` parameters are passed a new :class:`ModelState` is created,
otherwise it returns the cached value.'''
dbdata = self.dbdata
if 'state' not in dbdata or kwargs:
dbdata[... | def get_state(self, **kwargs):
'''Return the current :class:`ModelState` for this :class:`Model`.
If ``kwargs`` parameters are passed a new :class:`ModelState` is created,
otherwise it returns the cached value.'''
dbdata = self.dbdata
if 'state' not in dbdata or kwargs:
dbdata[... | [
"Return",
"the",
"current",
":",
"class",
":",
"ModelState",
"for",
"this",
":",
"class",
":",
"Model",
".",
"If",
"kwargs",
"parameters",
"are",
"passed",
"a",
"new",
":",
"class",
":",
"ModelState",
"is",
"created",
"otherwise",
"it",
"returns",
"the",
... | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/base.py#L475-L482 | [
"def",
"get_state",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"dbdata",
"=",
"self",
".",
"dbdata",
"if",
"'state'",
"not",
"in",
"dbdata",
"or",
"kwargs",
":",
"dbdata",
"[",
"'state'",
"]",
"=",
"ModelState",
"(",
"self",
",",
"*",
"*",
"kw... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Model.uuid | Universally unique identifier for an instance of a :class:`Model`. | stdnet/odm/base.py | def uuid(self):
'''Universally unique identifier for an instance of a :class:`Model`.
'''
pk = self.pkvalue()
if not pk:
raise self.DoesNotExist(
'Object not saved. Cannot obtain universally unique id')
return self.get_uuid(pk) | def uuid(self):
'''Universally unique identifier for an instance of a :class:`Model`.
'''
pk = self.pkvalue()
if not pk:
raise self.DoesNotExist(
'Object not saved. Cannot obtain universally unique id')
return self.get_uuid(pk) | [
"Universally",
"unique",
"identifier",
"for",
"an",
"instance",
"of",
"a",
":",
"class",
":",
"Model",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/base.py#L493-L500 | [
"def",
"uuid",
"(",
"self",
")",
":",
"pk",
"=",
"self",
".",
"pkvalue",
"(",
")",
"if",
"not",
"pk",
":",
"raise",
"self",
".",
"DoesNotExist",
"(",
"'Object not saved. Cannot obtain universally unique id'",
")",
"return",
"self",
".",
"get_uuid",
"(",
"pk"... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Model.backend | The :class:`stdnet.BackendDatServer` for this instance.
It can be ``None``. | stdnet/odm/base.py | def backend(self, client=None):
'''The :class:`stdnet.BackendDatServer` for this instance.
It can be ``None``.
'''
session = self.session
if session:
return session.model(self).backend | def backend(self, client=None):
'''The :class:`stdnet.BackendDatServer` for this instance.
It can be ``None``.
'''
session = self.session
if session:
return session.model(self).backend | [
"The",
":",
"class",
":",
"stdnet",
".",
"BackendDatServer",
"for",
"this",
"instance",
".",
"It",
"can",
"be",
"None",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/base.py#L517-L524 | [
"def",
"backend",
"(",
"self",
",",
"client",
"=",
"None",
")",
":",
"session",
"=",
"self",
".",
"session",
"if",
"session",
":",
"return",
"session",
".",
"model",
"(",
"self",
")",
".",
"backend"
] | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Model.read_backend | The read :class:`stdnet.BackendDatServer` for this instance.
It can be ``None``. | stdnet/odm/base.py | def read_backend(self, client=None):
'''The read :class:`stdnet.BackendDatServer` for this instance.
It can be ``None``.
'''
session = self.session
if session:
return session.model(self).read_backend | def read_backend(self, client=None):
'''The read :class:`stdnet.BackendDatServer` for this instance.
It can be ``None``.
'''
session = self.session
if session:
return session.model(self).read_backend | [
"The",
"read",
":",
"class",
":",
"stdnet",
".",
"BackendDatServer",
"for",
"this",
"instance",
".",
"It",
"can",
"be",
"None",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/base.py#L527-L534 | [
"def",
"read_backend",
"(",
"self",
",",
"client",
"=",
"None",
")",
":",
"session",
"=",
"self",
".",
"session",
"if",
"session",
":",
"return",
"session",
".",
"model",
"(",
"self",
")",
".",
"read_backend"
] | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | create_model | Create a :class:`Model` class for objects requiring
and interface similar to :class:`StdModel`. We refers to this type
of models as :ref:`local models <local-models>` since instances of such
models are not persistent on a :class:`stdnet.BackendDataServer`.
:param name: Name of the model class.
:param attributes: posit... | stdnet/odm/models.py | def create_model(name, *attributes, **params):
'''Create a :class:`Model` class for objects requiring
and interface similar to :class:`StdModel`. We refers to this type
of models as :ref:`local models <local-models>` since instances of such
models are not persistent on a :class:`stdnet.BackendDataServer`.
:param n... | def create_model(name, *attributes, **params):
'''Create a :class:`Model` class for objects requiring
and interface similar to :class:`StdModel`. We refers to this type
of models as :ref:`local models <local-models>` since instances of such
models are not persistent on a :class:`stdnet.BackendDataServer`.
:param n... | [
"Create",
"a",
":",
"class",
":",
"Model",
"class",
"for",
"objects",
"requiring",
"and",
"interface",
"similar",
"to",
":",
"class",
":",
"StdModel",
".",
"We",
"refers",
"to",
"this",
"type",
"of",
"models",
"as",
":",
"ref",
":",
"local",
"models",
... | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/models.py#L290-L307 | [
"def",
"create_model",
"(",
"name",
",",
"*",
"attributes",
",",
"*",
"*",
"params",
")",
":",
"params",
"[",
"'register'",
"]",
"=",
"False",
"params",
"[",
"'attributes'",
"]",
"=",
"attributes",
"kwargs",
"=",
"{",
"'manager_class'",
":",
"params",
".... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | StdModel.loadedfields | Generator of fields loaded from database | stdnet/odm/models.py | def loadedfields(self):
'''Generator of fields loaded from database'''
if self._loadedfields is None:
for field in self._meta.scalarfields:
yield field
else:
fields = self._meta.dfields
processed = set()
for name in self._loadedfiel... | def loadedfields(self):
'''Generator of fields loaded from database'''
if self._loadedfields is None:
for field in self._meta.scalarfields:
yield field
else:
fields = self._meta.dfields
processed = set()
for name in self._loadedfiel... | [
"Generator",
"of",
"fields",
"loaded",
"from",
"database"
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/models.py#L57-L77 | [
"def",
"loadedfields",
"(",
"self",
")",
":",
"if",
"self",
".",
"_loadedfields",
"is",
"None",
":",
"for",
"field",
"in",
"self",
".",
"_meta",
".",
"scalarfields",
":",
"yield",
"field",
"else",
":",
"fields",
"=",
"self",
".",
"_meta",
".",
"dfields... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | StdModel.fieldvalue_pairs | Generator of fields,values pairs. Fields correspond to
the ones which have been loaded (usually all of them) or
not loaded but modified.
Check the :ref:`load_only <performance-loadonly>` query function for more
details.
If *exclude_cache* evaluates to ``True``, fields with :attr:`Field.as_cache`
attribute set to ``Tru... | stdnet/odm/models.py | def fieldvalue_pairs(self, exclude_cache=False):
'''Generator of fields,values pairs. Fields correspond to
the ones which have been loaded (usually all of them) or
not loaded but modified.
Check the :ref:`load_only <performance-loadonly>` query function for more
details.
If *exclude_cache* evaluates to ``True`... | def fieldvalue_pairs(self, exclude_cache=False):
'''Generator of fields,values pairs. Fields correspond to
the ones which have been loaded (usually all of them) or
not loaded but modified.
Check the :ref:`load_only <performance-loadonly>` query function for more
details.
If *exclude_cache* evaluates to ``True`... | [
"Generator",
"of",
"fields",
"values",
"pairs",
".",
"Fields",
"correspond",
"to",
"the",
"ones",
"which",
"have",
"been",
"loaded",
"(",
"usually",
"all",
"of",
"them",
")",
"or",
"not",
"loaded",
"but",
"modified",
".",
"Check",
"the",
":",
"ref",
":",... | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/models.py#L79-L95 | [
"def",
"fieldvalue_pairs",
"(",
"self",
",",
"exclude_cache",
"=",
"False",
")",
":",
"for",
"field",
"in",
"self",
".",
"_meta",
".",
"scalarfields",
":",
"if",
"exclude_cache",
"and",
"field",
".",
"as_cache",
":",
"continue",
"name",
"=",
"field",
".",
... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | StdModel.clear_cache_fields | Set cache fields to ``None``. Check :attr:`Field.as_cache`
for information regarding fields which are considered cache. | stdnet/odm/models.py | def clear_cache_fields(self):
'''Set cache fields to ``None``. Check :attr:`Field.as_cache`
for information regarding fields which are considered cache.'''
for field in self._meta.scalarfields:
if field.as_cache:
setattr(self, field.name, None) | def clear_cache_fields(self):
'''Set cache fields to ``None``. Check :attr:`Field.as_cache`
for information regarding fields which are considered cache.'''
for field in self._meta.scalarfields:
if field.as_cache:
setattr(self, field.name, None) | [
"Set",
"cache",
"fields",
"to",
"None",
".",
"Check",
":",
"attr",
":",
"Field",
".",
"as_cache",
"for",
"information",
"regarding",
"fields",
"which",
"are",
"considered",
"cache",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/models.py#L97-L102 | [
"def",
"clear_cache_fields",
"(",
"self",
")",
":",
"for",
"field",
"in",
"self",
".",
"_meta",
".",
"scalarfields",
":",
"if",
"field",
".",
"as_cache",
":",
"setattr",
"(",
"self",
",",
"field",
".",
"name",
",",
"None",
")"
] | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | StdModel.get_attr_value | Retrieve the ``value`` for the attribute ``name``. The ``name``
can be nested following the :ref:`double underscore <tutorial-underscore>`
notation, for example ``group__name``. If the attribute is not available it
raises :class:`AttributeError`. | stdnet/odm/models.py | def get_attr_value(self, name):
'''Retrieve the ``value`` for the attribute ``name``. The ``name``
can be nested following the :ref:`double underscore <tutorial-underscore>`
notation, for example ``group__name``. If the attribute is not available it
raises :class:`AttributeError`.'''
if name in self._me... | def get_attr_value(self, name):
'''Retrieve the ``value`` for the attribute ``name``. The ``name``
can be nested following the :ref:`double underscore <tutorial-underscore>`
notation, for example ``group__name``. If the attribute is not available it
raises :class:`AttributeError`.'''
if name in self._me... | [
"Retrieve",
"the",
"value",
"for",
"the",
"attribute",
"name",
".",
"The",
"name",
"can",
"be",
"nested",
"following",
"the",
":",
"ref",
":",
"double",
"underscore",
"<tutorial",
"-",
"underscore",
">",
"notation",
"for",
"example",
"group__name",
".",
"If"... | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/models.py#L104-L119 | [
"def",
"get_attr_value",
"(",
"self",
",",
"name",
")",
":",
"if",
"name",
"in",
"self",
".",
"_meta",
".",
"dfields",
":",
"return",
"self",
".",
"_meta",
".",
"dfields",
"[",
"name",
"]",
".",
"get_value",
"(",
"self",
")",
"elif",
"not",
"name",
... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | StdModel.clone | Utility method for cloning the instance as a new object.
:parameter data: additional which override field data.
:rtype: a new instance of this class. | stdnet/odm/models.py | def clone(self, **data):
'''Utility method for cloning the instance as a new object.
:parameter data: additional which override field data.
:rtype: a new instance of this class.
'''
meta = self._meta
session = self.session
pkname = meta.pkname()
pkvalue = data.pop(pkname, None)
... | def clone(self, **data):
'''Utility method for cloning the instance as a new object.
:parameter data: additional which override field data.
:rtype: a new instance of this class.
'''
meta = self._meta
session = self.session
pkname = meta.pkname()
pkvalue = data.pop(pkname, None)
... | [
"Utility",
"method",
"for",
"cloning",
"the",
"instance",
"as",
"a",
"new",
"object",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/models.py#L121-L136 | [
"def",
"clone",
"(",
"self",
",",
"*",
"*",
"data",
")",
":",
"meta",
"=",
"self",
".",
"_meta",
"session",
"=",
"self",
".",
"session",
"pkname",
"=",
"meta",
".",
"pkname",
"(",
")",
"pkvalue",
"=",
"data",
".",
"pop",
"(",
"pkname",
",",
"None... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | StdModel.todict | Return a dictionary of serialised scalar field for pickling.
If the *exclude_cache* flag is ``True``, fields with :attr:`Field.as_cache`
attribute set to ``True`` will be excluded. | stdnet/odm/models.py | def todict(self, exclude_cache=False):
'''Return a dictionary of serialised scalar field for pickling.
If the *exclude_cache* flag is ``True``, fields with :attr:`Field.as_cache`
attribute set to ``True`` will be excluded.'''
odict = {}
for field, value in self.fieldvalue_pairs(exclude_cache=exc... | def todict(self, exclude_cache=False):
'''Return a dictionary of serialised scalar field for pickling.
If the *exclude_cache* flag is ``True``, fields with :attr:`Field.as_cache`
attribute set to ``True`` will be excluded.'''
odict = {}
for field, value in self.fieldvalue_pairs(exclude_cache=exc... | [
"Return",
"a",
"dictionary",
"of",
"serialised",
"scalar",
"field",
"for",
"pickling",
".",
"If",
"the",
"*",
"exclude_cache",
"*",
"flag",
"is",
"True",
"fields",
"with",
":",
"attr",
":",
"Field",
".",
"as_cache",
"attribute",
"set",
"to",
"True",
"will"... | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/models.py#L145-L156 | [
"def",
"todict",
"(",
"self",
",",
"exclude_cache",
"=",
"False",
")",
":",
"odict",
"=",
"{",
"}",
"for",
"field",
",",
"value",
"in",
"self",
".",
"fieldvalue_pairs",
"(",
"exclude_cache",
"=",
"exclude_cache",
")",
":",
"value",
"=",
"field",
".",
"... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | StdModel.load_fields | Load extra fields to this :class:`StdModel`. | stdnet/odm/models.py | def load_fields(self, *fields):
'''Load extra fields to this :class:`StdModel`.'''
if self._loadedfields is not None:
if self.session is None:
raise SessionNotAvailable('No session available')
meta = self._meta
kwargs = {meta.pkname(): self.pkvalue()}
... | def load_fields(self, *fields):
'''Load extra fields to this :class:`StdModel`.'''
if self._loadedfields is not None:
if self.session is None:
raise SessionNotAvailable('No session available')
meta = self._meta
kwargs = {meta.pkname(): self.pkvalue()}
... | [
"Load",
"extra",
"fields",
"to",
"this",
":",
"class",
":",
"StdModel",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/models.py#L172-L184 | [
"def",
"load_fields",
"(",
"self",
",",
"*",
"fields",
")",
":",
"if",
"self",
".",
"_loadedfields",
"is",
"not",
"None",
":",
"if",
"self",
".",
"session",
"is",
"None",
":",
"raise",
"SessionNotAvailable",
"(",
"'No session available'",
")",
"meta",
"=",... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | StdModel.load_related_model | Load a the :class:`ForeignKey` field ``name`` if this is part of the
fields of this model and if the related object is not already loaded.
It is used by the lazy loading mechanism of :ref:`one-to-many <one-to-many>`
relationships.
:parameter name: the :attr:`Field.name` of the :class:`ForeignKey` to load.
:parameter l... | stdnet/odm/models.py | def load_related_model(self, name, load_only=None, dont_load=None):
'''Load a the :class:`ForeignKey` field ``name`` if this is part of the
fields of this model and if the related object is not already loaded.
It is used by the lazy loading mechanism of :ref:`one-to-many <one-to-many>`
relationships.
:paramete... | def load_related_model(self, name, load_only=None, dont_load=None):
'''Load a the :class:`ForeignKey` field ``name`` if this is part of the
fields of this model and if the related object is not already loaded.
It is used by the lazy loading mechanism of :ref:`one-to-many <one-to-many>`
relationships.
:paramete... | [
"Load",
"a",
"the",
":",
"class",
":",
"ForeignKey",
"field",
"name",
"if",
"this",
"is",
"part",
"of",
"the",
"fields",
"of",
"this",
"model",
"and",
"if",
"the",
"related",
"object",
"is",
"not",
"already",
"loaded",
".",
"It",
"is",
"used",
"by",
... | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/models.py#L189-L205 | [
"def",
"load_related_model",
"(",
"self",
",",
"name",
",",
"load_only",
"=",
"None",
",",
"dont_load",
"=",
"None",
")",
":",
"field",
"=",
"self",
".",
"_meta",
".",
"dfields",
".",
"get",
"(",
"name",
")",
"if",
"not",
"field",
":",
"raise",
"Valu... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | StdModel.from_base64_data | Load a :class:`StdModel` from possibly base64encoded data.
This method is used to load models from data obtained from the :meth:`tojson`
method. | stdnet/odm/models.py | def from_base64_data(cls, **kwargs):
'''Load a :class:`StdModel` from possibly base64encoded data.
This method is used to load models from data obtained from the :meth:`tojson`
method.'''
o = cls()
meta = cls._meta
pkname = meta.pkname()
for name, value in iteritems(kwargs):
... | def from_base64_data(cls, **kwargs):
'''Load a :class:`StdModel` from possibly base64encoded data.
This method is used to load models from data obtained from the :meth:`tojson`
method.'''
o = cls()
meta = cls._meta
pkname = meta.pkname()
for name, value in iteritems(kwargs):
... | [
"Load",
"a",
":",
"class",
":",
"StdModel",
"from",
"possibly",
"base64encoded",
"data",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/models.py#L214-L231 | [
"def",
"from_base64_data",
"(",
"cls",
",",
"*",
"*",
"kwargs",
")",
":",
"o",
"=",
"cls",
"(",
")",
"meta",
"=",
"cls",
".",
"_meta",
"pkname",
"=",
"meta",
".",
"pkname",
"(",
")",
"for",
"name",
",",
"value",
"in",
"iteritems",
"(",
"kwargs",
... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | DetrendFITS | De-trend a K2 FITS file using :py:class:`everest.detrender.rPLD`.
:param str fitsfile: The full path to the FITS file
:param ndarray aperture: A 2D integer array corresponding to the \
desired photometric aperture (1 = in aperture, 0 = outside \
aperture). Default is to interactively sele... | everest/standalone.py | def DetrendFITS(fitsfile, raw=False, season=None, clobber=False, **kwargs):
"""
De-trend a K2 FITS file using :py:class:`everest.detrender.rPLD`.
:param str fitsfile: The full path to the FITS file
:param ndarray aperture: A 2D integer array corresponding to the \
desired photometric apertur... | def DetrendFITS(fitsfile, raw=False, season=None, clobber=False, **kwargs):
"""
De-trend a K2 FITS file using :py:class:`everest.detrender.rPLD`.
:param str fitsfile: The full path to the FITS file
:param ndarray aperture: A 2D integer array corresponding to the \
desired photometric apertur... | [
"De",
"-",
"trend",
"a",
"K2",
"FITS",
"file",
"using",
":",
"py",
":",
"class",
":",
"everest",
".",
"detrender",
".",
"rPLD",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/standalone.py#L42-L86 | [
"def",
"DetrendFITS",
"(",
"fitsfile",
",",
"raw",
"=",
"False",
",",
"season",
"=",
"None",
",",
"clobber",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"# Get info",
"EPIC",
"=",
"pyfits",
".",
"getheader",
"(",
"fitsfile",
",",
"0",
")",
"[",
... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | GetData | Returns a :py:obj:`DataContainer` instance with the
raw data for the target.
:param str fitsfile: The full raw target pixel file path
:param bool clobber: Overwrite existing files? Default :py:obj:`False`
:param float saturation_tolerance: Target is considered saturated \
if flux is within t... | everest/standalone.py | def GetData(fitsfile, EPIC, campaign, clobber=False,
saturation_tolerance=-0.1,
bad_bits=[1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17],
get_hires=False, get_nearby=False,
aperture=None, **kwargs):
'''
Returns a :py:obj:`DataContainer` instance with the
r... | def GetData(fitsfile, EPIC, campaign, clobber=False,
saturation_tolerance=-0.1,
bad_bits=[1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17],
get_hires=False, get_nearby=False,
aperture=None, **kwargs):
'''
Returns a :py:obj:`DataContainer` instance with the
r... | [
"Returns",
"a",
":",
"py",
":",
"obj",
":",
"DataContainer",
"instance",
"with",
"the",
"raw",
"data",
"for",
"the",
"target",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/standalone.py#L380-L651 | [
"def",
"GetData",
"(",
"fitsfile",
",",
"EPIC",
",",
"campaign",
",",
"clobber",
"=",
"False",
",",
"saturation_tolerance",
"=",
"-",
"0.1",
",",
"bad_bits",
"=",
"[",
"1",
",",
"2",
",",
"3",
",",
"4",
",",
"5",
",",
"6",
",",
"7",
",",
"8",
"... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | DVS.title | Returns the axis instance where the title will be printed | everest/dvs.py | def title(self):
'''
Returns the axis instance where the title will be printed
'''
return self.title_left(on=False), self.title_center(on=False), \
self.title_right(on=False) | def title(self):
'''
Returns the axis instance where the title will be printed
'''
return self.title_left(on=False), self.title_center(on=False), \
self.title_right(on=False) | [
"Returns",
"the",
"axis",
"instance",
"where",
"the",
"title",
"will",
"be",
"printed"
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/dvs.py#L132-L139 | [
"def",
"title",
"(",
"self",
")",
":",
"return",
"self",
".",
"title_left",
"(",
"on",
"=",
"False",
")",
",",
"self",
".",
"title_center",
"(",
"on",
"=",
"False",
")",
",",
"self",
".",
"title_right",
"(",
"on",
"=",
"False",
")"
] | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | DVS.footer | Returns the axis instance where the footer will be printed | everest/dvs.py | def footer(self):
'''
Returns the axis instance where the footer will be printed
'''
return self.footer_left(on=False), self.footer_center(on=False), \
self.footer_right(on=False) | def footer(self):
'''
Returns the axis instance where the footer will be printed
'''
return self.footer_left(on=False), self.footer_center(on=False), \
self.footer_right(on=False) | [
"Returns",
"the",
"axis",
"instance",
"where",
"the",
"footer",
"will",
"be",
"printed"
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/dvs.py#L141-L148 | [
"def",
"footer",
"(",
"self",
")",
":",
"return",
"self",
".",
"footer_left",
"(",
"on",
"=",
"False",
")",
",",
"self",
".",
"footer_center",
"(",
"on",
"=",
"False",
")",
",",
"self",
".",
"footer_right",
"(",
"on",
"=",
"False",
")"
] | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | DVS.top_right | Returns the axis instance at the top right of the page,
where the postage stamp and aperture is displayed | everest/dvs.py | def top_right(self):
'''
Returns the axis instance at the top right of the page,
where the postage stamp and aperture is displayed
'''
res = self.body_top_right[self.tcount]()
self.tcount += 1
return res | def top_right(self):
'''
Returns the axis instance at the top right of the page,
where the postage stamp and aperture is displayed
'''
res = self.body_top_right[self.tcount]()
self.tcount += 1
return res | [
"Returns",
"the",
"axis",
"instance",
"at",
"the",
"top",
"right",
"of",
"the",
"page",
"where",
"the",
"postage",
"stamp",
"and",
"aperture",
"is",
"displayed"
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/dvs.py#L150-L159 | [
"def",
"top_right",
"(",
"self",
")",
":",
"res",
"=",
"self",
".",
"body_top_right",
"[",
"self",
".",
"tcount",
"]",
"(",
")",
"self",
".",
"tcount",
"+=",
"1",
"return",
"res"
] | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | DVS.left | Returns the current axis instance on the left side of
the page where each successive light curve is displayed | everest/dvs.py | def left(self):
'''
Returns the current axis instance on the left side of
the page where each successive light curve is displayed
'''
res = self.body_left[self.lcount]()
self.lcount += 1
return res | def left(self):
'''
Returns the current axis instance on the left side of
the page where each successive light curve is displayed
'''
res = self.body_left[self.lcount]()
self.lcount += 1
return res | [
"Returns",
"the",
"current",
"axis",
"instance",
"on",
"the",
"left",
"side",
"of",
"the",
"page",
"where",
"each",
"successive",
"light",
"curve",
"is",
"displayed"
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/dvs.py#L170-L179 | [
"def",
"left",
"(",
"self",
")",
":",
"res",
"=",
"self",
".",
"body_left",
"[",
"self",
".",
"lcount",
"]",
"(",
")",
"self",
".",
"lcount",
"+=",
"1",
"return",
"res"
] | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | DVS.right | Returns the current axis instance on the right side of the
page, where cross-validation information is displayed | everest/dvs.py | def right(self):
'''
Returns the current axis instance on the right side of the
page, where cross-validation information is displayed
'''
res = self.body_right[self.rcount]()
self.rcount += 1
return res | def right(self):
'''
Returns the current axis instance on the right side of the
page, where cross-validation information is displayed
'''
res = self.body_right[self.rcount]()
self.rcount += 1
return res | [
"Returns",
"the",
"current",
"axis",
"instance",
"on",
"the",
"right",
"side",
"of",
"the",
"page",
"where",
"cross",
"-",
"validation",
"information",
"is",
"displayed"
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/dvs.py#L181-L190 | [
"def",
"right",
"(",
"self",
")",
":",
"res",
"=",
"self",
".",
"body_right",
"[",
"self",
".",
"rcount",
"]",
"(",
")",
"self",
".",
"rcount",
"+=",
"1",
"return",
"res"
] | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | CBV.body | Returns the axis instance where the light curves will be shown | everest/dvs.py | def body(self):
'''
Returns the axis instance where the light curves will be shown
'''
res = self._body[self.bcount]()
self.bcount += 1
return res | def body(self):
'''
Returns the axis instance where the light curves will be shown
'''
res = self._body[self.bcount]()
self.bcount += 1
return res | [
"Returns",
"the",
"axis",
"instance",
"where",
"the",
"light",
"curves",
"will",
"be",
"shown"
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/dvs.py#L230-L238 | [
"def",
"body",
"(",
"self",
")",
":",
"res",
"=",
"self",
".",
"_body",
"[",
"self",
".",
"bcount",
"]",
"(",
")",
"self",
".",
"bcount",
"+=",
"1",
"return",
"res"
] | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | hashmodel | Calculate the Hash id of metaclass ``meta`` | stdnet/odm/globals.py | def hashmodel(model, library=None):
'''Calculate the Hash id of metaclass ``meta``'''
library = library or 'python-stdnet'
meta = model._meta
sha = hashlib.sha1(to_bytes('{0}({1})'.format(library, meta)))
hash = sha.hexdigest()[:8]
meta.hash = hash
if hash in _model_dict:
rai... | def hashmodel(model, library=None):
'''Calculate the Hash id of metaclass ``meta``'''
library = library or 'python-stdnet'
meta = model._meta
sha = hashlib.sha1(to_bytes('{0}({1})'.format(library, meta)))
hash = sha.hexdigest()[:8]
meta.hash = hash
if hash in _model_dict:
rai... | [
"Calculate",
"the",
"Hash",
"id",
"of",
"metaclass",
"meta"
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/globals.py#L40-L50 | [
"def",
"hashmodel",
"(",
"model",
",",
"library",
"=",
"None",
")",
":",
"library",
"=",
"library",
"or",
"'python-stdnet'",
"meta",
"=",
"model",
".",
"_meta",
"sha",
"=",
"hashlib",
".",
"sha1",
"(",
"to_bytes",
"(",
"'{0}({1})'",
".",
"format",
"(",
... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Event.bind | Bind a ``callback`` for a given ``sender``. | stdnet/odm/globals.py | def bind(self, callback, sender=None):
'''Bind a ``callback`` for a given ``sender``.'''
key = (_make_id(callback), _make_id(sender))
self.callbacks.append((key, callback)) | def bind(self, callback, sender=None):
'''Bind a ``callback`` for a given ``sender``.'''
key = (_make_id(callback), _make_id(sender))
self.callbacks.append((key, callback)) | [
"Bind",
"a",
"callback",
"for",
"a",
"given",
"sender",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/globals.py#L64-L67 | [
"def",
"bind",
"(",
"self",
",",
"callback",
",",
"sender",
"=",
"None",
")",
":",
"key",
"=",
"(",
"_make_id",
"(",
"callback",
")",
",",
"_make_id",
"(",
"sender",
")",
")",
"self",
".",
"callbacks",
".",
"append",
"(",
"(",
"key",
",",
"callback... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | Event.fire | Fire callbacks from a ``sender``. | stdnet/odm/globals.py | def fire(self, sender=None, **params):
'''Fire callbacks from a ``sender``.'''
keys = (_make_id(None), _make_id(sender))
results = []
for (_, key), callback in self.callbacks:
if key in keys:
results.append(callback(self, sender, **params))
retu... | def fire(self, sender=None, **params):
'''Fire callbacks from a ``sender``.'''
keys = (_make_id(None), _make_id(sender))
results = []
for (_, key), callback in self.callbacks:
if key in keys:
results.append(callback(self, sender, **params))
retu... | [
"Fire",
"callbacks",
"from",
"a",
"sender",
"."
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/odm/globals.py#L69-L76 | [
"def",
"fire",
"(",
"self",
",",
"sender",
"=",
"None",
",",
"*",
"*",
"params",
")",
":",
"keys",
"=",
"(",
"_make_id",
"(",
"None",
")",
",",
"_make_id",
"(",
"sender",
")",
")",
"results",
"=",
"[",
"]",
"for",
"(",
"_",
",",
"key",
")",
"... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | PrefixedRedisMixin.execute_command | Execute a command and return a parsed response | stdnet/backends/redisb/client/prefixed.py | def execute_command(self, cmnd, *args, **options):
"Execute a command and return a parsed response"
args, options = self.preprocess_command(cmnd, *args, **options)
return self.client.execute_command(cmnd, *args, **options) | def execute_command(self, cmnd, *args, **options):
"Execute a command and return a parsed response"
args, options = self.preprocess_command(cmnd, *args, **options)
return self.client.execute_command(cmnd, *args, **options) | [
"Execute",
"a",
"command",
"and",
"return",
"a",
"parsed",
"response"
] | lsbardel/python-stdnet | python | https://github.com/lsbardel/python-stdnet/blob/78db5320bdedc3f28c5e4f38cda13a4469e35db7/stdnet/backends/redisb/client/prefixed.py#L122-L125 | [
"def",
"execute_command",
"(",
"self",
",",
"cmnd",
",",
"*",
"args",
",",
"*",
"*",
"options",
")",
":",
"args",
",",
"options",
"=",
"self",
".",
"preprocess_command",
"(",
"cmnd",
",",
"*",
"args",
",",
"*",
"*",
"options",
")",
"return",
"self",
... | 78db5320bdedc3f28c5e4f38cda13a4469e35db7 |
train | _range10_90 | Returns the 10th-90th percentile range of array :py:obj:`x`. | everest/missions/k2/utils.py | def _range10_90(x):
'''
Returns the 10th-90th percentile range of array :py:obj:`x`.
'''
x = np.delete(x, np.where(np.isnan(x)))
i = np.argsort(x)
a = int(0.1 * len(x))
b = int(0.9 * len(x))
return x[i][b] - x[i][a] | def _range10_90(x):
'''
Returns the 10th-90th percentile range of array :py:obj:`x`.
'''
x = np.delete(x, np.where(np.isnan(x)))
i = np.argsort(x)
a = int(0.1 * len(x))
b = int(0.9 * len(x))
return x[i][b] - x[i][a] | [
"Returns",
"the",
"10th",
"-",
"90th",
"percentile",
"range",
"of",
"array",
":",
"py",
":",
"obj",
":",
"x",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/missions/k2/utils.py#L45-L55 | [
"def",
"_range10_90",
"(",
"x",
")",
":",
"x",
"=",
"np",
".",
"delete",
"(",
"x",
",",
"np",
".",
"where",
"(",
"np",
".",
"isnan",
"(",
"x",
")",
")",
")",
"i",
"=",
"np",
".",
"argsort",
"(",
"x",
")",
"a",
"=",
"int",
"(",
"0.1",
"*",... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | Campaign | Returns the campaign number(s) for a given EPIC target. If target
is not found, returns :py:obj:`None`.
:param int EPIC: The EPIC number of the target. | everest/missions/k2/utils.py | def Campaign(EPIC, **kwargs):
'''
Returns the campaign number(s) for a given EPIC target. If target
is not found, returns :py:obj:`None`.
:param int EPIC: The EPIC number of the target.
'''
campaigns = []
for campaign, stars in GetK2Stars().items():
if EPIC in [s[0] for s in stars... | def Campaign(EPIC, **kwargs):
'''
Returns the campaign number(s) for a given EPIC target. If target
is not found, returns :py:obj:`None`.
:param int EPIC: The EPIC number of the target.
'''
campaigns = []
for campaign, stars in GetK2Stars().items():
if EPIC in [s[0] for s in stars... | [
"Returns",
"the",
"campaign",
"number",
"(",
"s",
")",
"for",
"a",
"given",
"EPIC",
"target",
".",
"If",
"target",
"is",
"not",
"found",
"returns",
":",
"py",
":",
"obj",
":",
"None",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/missions/k2/utils.py#L152-L170 | [
"def",
"Campaign",
"(",
"EPIC",
",",
"*",
"*",
"kwargs",
")",
":",
"campaigns",
"=",
"[",
"]",
"for",
"campaign",
",",
"stars",
"in",
"GetK2Stars",
"(",
")",
".",
"items",
"(",
")",
":",
"if",
"EPIC",
"in",
"[",
"s",
"[",
"0",
"]",
"for",
"s",
... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | GetK2Stars | Download and return a :py:obj:`dict` of all *K2* stars organized by
campaign. Saves each campaign to a `.stars` file in the
`everest/missions/k2/tables` directory.
:param bool clobber: If :py:obj:`True`, download and overwrite \
existing files. Default :py:obj:`False`
.. note:: The keys of ... | everest/missions/k2/utils.py | def GetK2Stars(clobber=False):
'''
Download and return a :py:obj:`dict` of all *K2* stars organized by
campaign. Saves each campaign to a `.stars` file in the
`everest/missions/k2/tables` directory.
:param bool clobber: If :py:obj:`True`, download and overwrite \
existing files. Default ... | def GetK2Stars(clobber=False):
'''
Download and return a :py:obj:`dict` of all *K2* stars organized by
campaign. Saves each campaign to a `.stars` file in the
`everest/missions/k2/tables` directory.
:param bool clobber: If :py:obj:`True`, download and overwrite \
existing files. Default ... | [
"Download",
"and",
"return",
"a",
":",
"py",
":",
"obj",
":",
"dict",
"of",
"all",
"*",
"K2",
"*",
"stars",
"organized",
"by",
"campaign",
".",
"Saves",
"each",
"campaign",
"to",
"a",
".",
"stars",
"file",
"in",
"the",
"everest",
"/",
"missions",
"/"... | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/missions/k2/utils.py#L173-L227 | [
"def",
"GetK2Stars",
"(",
"clobber",
"=",
"False",
")",
":",
"# Download",
"if",
"clobber",
":",
"print",
"(",
"\"Downloading K2 star list...\"",
")",
"stars",
"=",
"kplr_client",
".",
"k2_star_info",
"(",
")",
"print",
"(",
"\"Writing star list to disk...\"",
")"... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | GetK2Campaign | Return all stars in a given *K2* campaign.
:param campaign: The *K2* campaign number. If this is an :py:class:`int`, \
returns all targets in that campaign. If a :py:class:`float` in \
the form :py:obj:`X.Y`, runs the :py:obj:`Y^th` decile of campaign \
:py:obj:`X`.
:param bool... | everest/missions/k2/utils.py | def GetK2Campaign(campaign, clobber=False, split=False,
epics_only=False, cadence='lc'):
'''
Return all stars in a given *K2* campaign.
:param campaign: The *K2* campaign number. If this is an :py:class:`int`, \
returns all targets in that campaign. If a :py:class:`float` in \
... | def GetK2Campaign(campaign, clobber=False, split=False,
epics_only=False, cadence='lc'):
'''
Return all stars in a given *K2* campaign.
:param campaign: The *K2* campaign number. If this is an :py:class:`int`, \
returns all targets in that campaign. If a :py:class:`float` in \
... | [
"Return",
"all",
"stars",
"in",
"a",
"given",
"*",
"K2",
"*",
"campaign",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/missions/k2/utils.py#L230-L291 | [
"def",
"GetK2Campaign",
"(",
"campaign",
",",
"clobber",
"=",
"False",
",",
"split",
"=",
"False",
",",
"epics_only",
"=",
"False",
",",
"cadence",
"=",
"'lc'",
")",
":",
"all",
"=",
"GetK2Stars",
"(",
"clobber",
"=",
"clobber",
")",
"if",
"int",
"(",
... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | Channel | Returns the channel number for a given EPIC target. | everest/missions/k2/utils.py | def Channel(EPIC, campaign=None):
'''
Returns the channel number for a given EPIC target.
'''
if campaign is None:
campaign = Campaign(EPIC)
if hasattr(campaign, '__len__'):
raise AttributeError(
"Please choose a campaign/season for this target: %s." % campaign)
try... | def Channel(EPIC, campaign=None):
'''
Returns the channel number for a given EPIC target.
'''
if campaign is None:
campaign = Campaign(EPIC)
if hasattr(campaign, '__len__'):
raise AttributeError(
"Please choose a campaign/season for this target: %s." % campaign)
try... | [
"Returns",
"the",
"channel",
"number",
"for",
"a",
"given",
"EPIC",
"target",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/missions/k2/utils.py#L294-L312 | [
"def",
"Channel",
"(",
"EPIC",
",",
"campaign",
"=",
"None",
")",
":",
"if",
"campaign",
"is",
"None",
":",
"campaign",
"=",
"Campaign",
"(",
"EPIC",
")",
"if",
"hasattr",
"(",
"campaign",
",",
"'__len__'",
")",
":",
"raise",
"AttributeError",
"(",
"\"... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
train | Module | Returns the module number for a given EPIC target. | everest/missions/k2/utils.py | def Module(EPIC, campaign=None):
'''
Returns the module number for a given EPIC target.
'''
channel = Channel(EPIC, campaign=campaign)
nums = {2: 1, 3: 5, 4: 9, 6: 13, 7: 17, 8: 21, 9: 25,
10: 29, 11: 33, 12: 37, 13: 41, 14: 45, 15: 49,
16: 53, 17: 57, 18: 61, 19: 65, 20: 6... | def Module(EPIC, campaign=None):
'''
Returns the module number for a given EPIC target.
'''
channel = Channel(EPIC, campaign=campaign)
nums = {2: 1, 3: 5, 4: 9, 6: 13, 7: 17, 8: 21, 9: 25,
10: 29, 11: 33, 12: 37, 13: 41, 14: 45, 15: 49,
16: 53, 17: 57, 18: 61, 19: 65, 20: 6... | [
"Returns",
"the",
"module",
"number",
"for",
"a",
"given",
"EPIC",
"target",
"."
] | rodluger/everest | python | https://github.com/rodluger/everest/blob/6779591f9f8b3556847e2fbf761bdfac7520eaea/everest/missions/k2/utils.py#L315-L331 | [
"def",
"Module",
"(",
"EPIC",
",",
"campaign",
"=",
"None",
")",
":",
"channel",
"=",
"Channel",
"(",
"EPIC",
",",
"campaign",
"=",
"campaign",
")",
"nums",
"=",
"{",
"2",
":",
"1",
",",
"3",
":",
"5",
",",
"4",
":",
"9",
",",
"6",
":",
"13",... | 6779591f9f8b3556847e2fbf761bdfac7520eaea |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.