repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
danielfrg/datasciencebox | datasciencebox/core/cloud/cluster.py | Cluster.from_list | def from_list(cls, values, settings):
"""
From a list of dicts (each dict is an `Instance.to_dict`)
"""
logger.debug('Creating Cluster from list')
self = cls()
self.settings = settings
self.instances = []
for instance in values:
uid, ip, port ... | python | def from_list(cls, values, settings):
"""
From a list of dicts (each dict is an `Instance.to_dict`)
"""
logger.debug('Creating Cluster from list')
self = cls()
self.settings = settings
self.instances = []
for instance in values:
uid, ip, port ... | [
"def",
"from_list",
"(",
"cls",
",",
"values",
",",
"settings",
")",
":",
"logger",
".",
"debug",
"(",
"'Creating Cluster from list'",
")",
"self",
"=",
"cls",
"(",
")",
"self",
".",
"settings",
"=",
"settings",
"self",
".",
"instances",
"=",
"[",
"]",
... | From a list of dicts (each dict is an `Instance.to_dict`) | [
"From",
"a",
"list",
"of",
"dicts",
"(",
"each",
"dict",
"is",
"an",
"Instance",
".",
"to_dict",
")"
] | train | https://github.com/danielfrg/datasciencebox/blob/6b7aa642c6616a46547035fcb815acc1de605a6f/datasciencebox/core/cloud/cluster.py#L16-L29 |
danielfrg/datasciencebox | datasciencebox/core/cloud/cluster.py | Cluster.to_list | def to_list(self):
"""
To a list of dicts (each dict is an instances)
"""
ret = []
for instance in self.instances:
ret.append(instance.to_dict())
return ret | python | def to_list(self):
"""
To a list of dicts (each dict is an instances)
"""
ret = []
for instance in self.instances:
ret.append(instance.to_dict())
return ret | [
"def",
"to_list",
"(",
"self",
")",
":",
"ret",
"=",
"[",
"]",
"for",
"instance",
"in",
"self",
".",
"instances",
":",
"ret",
".",
"append",
"(",
"instance",
".",
"to_dict",
"(",
")",
")",
"return",
"ret"
] | To a list of dicts (each dict is an instances) | [
"To",
"a",
"list",
"of",
"dicts",
"(",
"each",
"dict",
"is",
"an",
"instances",
")"
] | train | https://github.com/danielfrg/datasciencebox/blob/6b7aa642c6616a46547035fcb815acc1de605a6f/datasciencebox/core/cloud/cluster.py#L31-L38 |
danielfrg/datasciencebox | datasciencebox/core/cloud/cluster.py | Cluster.create_bare | def create_bare(self):
"""
Create instances for the Bare provider
"""
self.instances = []
for ip in self.settings['NODES']:
new_instance = Instance.new(settings=self.settings, cluster=self)
new_instance.ip = ip
self.instances.append(new_instanc... | python | def create_bare(self):
"""
Create instances for the Bare provider
"""
self.instances = []
for ip in self.settings['NODES']:
new_instance = Instance.new(settings=self.settings, cluster=self)
new_instance.ip = ip
self.instances.append(new_instanc... | [
"def",
"create_bare",
"(",
"self",
")",
":",
"self",
".",
"instances",
"=",
"[",
"]",
"for",
"ip",
"in",
"self",
".",
"settings",
"[",
"'NODES'",
"]",
":",
"new_instance",
"=",
"Instance",
".",
"new",
"(",
"settings",
"=",
"self",
".",
"settings",
",... | Create instances for the Bare provider | [
"Create",
"instances",
"for",
"the",
"Bare",
"provider"
] | train | https://github.com/danielfrg/datasciencebox/blob/6b7aa642c6616a46547035fcb815acc1de605a6f/datasciencebox/core/cloud/cluster.py#L63-L71 |
danielfrg/datasciencebox | datasciencebox/core/cloud/cluster.py | Cluster.create_cloud | def create_cloud(self):
"""
Create instances for the cloud providers
"""
instances = []
for i in range(self.settings['NUMBER_NODES']):
new_instance = Instance.new(settings=self.settings, cluster=self)
instances.append(new_instance)
create_nodes = ... | python | def create_cloud(self):
"""
Create instances for the cloud providers
"""
instances = []
for i in range(self.settings['NUMBER_NODES']):
new_instance = Instance.new(settings=self.settings, cluster=self)
instances.append(new_instance)
create_nodes = ... | [
"def",
"create_cloud",
"(",
"self",
")",
":",
"instances",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"settings",
"[",
"'NUMBER_NODES'",
"]",
")",
":",
"new_instance",
"=",
"Instance",
".",
"new",
"(",
"settings",
"=",
"self",
".",
"... | Create instances for the cloud providers | [
"Create",
"instances",
"for",
"the",
"cloud",
"providers"
] | train | https://github.com/danielfrg/datasciencebox/blob/6b7aa642c6616a46547035fcb815acc1de605a6f/datasciencebox/core/cloud/cluster.py#L73-L92 |
publysher/rdflib-django | src/rdflib_django/fields.py | deserialize_uri | def deserialize_uri(value):
"""
Deserialize a representation of a BNode or URIRef.
"""
if isinstance(value, BNode):
return value
if isinstance(value, URIRef):
return value
if not value:
return None
if not isinstance(value, basestring):
raise ValueError("Cannot... | python | def deserialize_uri(value):
"""
Deserialize a representation of a BNode or URIRef.
"""
if isinstance(value, BNode):
return value
if isinstance(value, URIRef):
return value
if not value:
return None
if not isinstance(value, basestring):
raise ValueError("Cannot... | [
"def",
"deserialize_uri",
"(",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"BNode",
")",
":",
"return",
"value",
"if",
"isinstance",
"(",
"value",
",",
"URIRef",
")",
":",
"return",
"value",
"if",
"not",
"value",
":",
"return",
"None",
"i... | Deserialize a representation of a BNode or URIRef. | [
"Deserialize",
"a",
"representation",
"of",
"a",
"BNode",
"or",
"URIRef",
"."
] | train | https://github.com/publysher/rdflib-django/blob/e26992af75f96ef27a6ceaf820574e3bca645953/src/rdflib_django/fields.py#L42-L56 |
publysher/rdflib-django | src/rdflib_django/fields.py | serialize_uri | def serialize_uri(value):
"""
Serialize a BNode or URIRef.
"""
if isinstance(value, BNode):
return value.n3()
if isinstance(value, URIRef):
return unicode(value)
raise ValueError("Cannot get prepvalue for {0} of type {1}".format(value, value.__class__)) | python | def serialize_uri(value):
"""
Serialize a BNode or URIRef.
"""
if isinstance(value, BNode):
return value.n3()
if isinstance(value, URIRef):
return unicode(value)
raise ValueError("Cannot get prepvalue for {0} of type {1}".format(value, value.__class__)) | [
"def",
"serialize_uri",
"(",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"BNode",
")",
":",
"return",
"value",
".",
"n3",
"(",
")",
"if",
"isinstance",
"(",
"value",
",",
"URIRef",
")",
":",
"return",
"unicode",
"(",
"value",
")",
"rais... | Serialize a BNode or URIRef. | [
"Serialize",
"a",
"BNode",
"or",
"URIRef",
"."
] | train | https://github.com/publysher/rdflib-django/blob/e26992af75f96ef27a6ceaf820574e3bca645953/src/rdflib_django/fields.py#L59-L67 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | crab_gateway_request | def crab_gateway_request(client, method, *args):
'''
Utility function that helps making requests to the CRAB service.
This is a specialised version of :func:`crabpy.client.crab_request` that
allows adding extra functionality for the calls made by the gateway.
:param client: A :class:`suds.client.C... | python | def crab_gateway_request(client, method, *args):
'''
Utility function that helps making requests to the CRAB service.
This is a specialised version of :func:`crabpy.client.crab_request` that
allows adding extra functionality for the calls made by the gateway.
:param client: A :class:`suds.client.C... | [
"def",
"crab_gateway_request",
"(",
"client",
",",
"method",
",",
"*",
"args",
")",
":",
"try",
":",
"return",
"crab_request",
"(",
"client",
",",
"method",
",",
"*",
"args",
")",
"except",
"WebFault",
"as",
"wf",
":",
"err",
"=",
"GatewayRuntimeException"... | Utility function that helps making requests to the CRAB service.
This is a specialised version of :func:`crabpy.client.crab_request` that
allows adding extra functionality for the calls made by the gateway.
:param client: A :class:`suds.client.Client` for the CRAB service.
:param string action: Which ... | [
"Utility",
"function",
"that",
"helps",
"making",
"requests",
"to",
"the",
"CRAB",
"service",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L38-L56 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | check_lazy_load_gewest | def check_lazy_load_gewest(f):
'''
Decorator function to lazy load a :class:`Gewest`.
'''
def wrapper(self):
gewest = self
attribute = 'namen' if f.__name__ == 'naam' else f.__name__
if (getattr(gewest, '_%s' % attribute, None) is None):
log.debug('Lazy loading Gewest... | python | def check_lazy_load_gewest(f):
'''
Decorator function to lazy load a :class:`Gewest`.
'''
def wrapper(self):
gewest = self
attribute = 'namen' if f.__name__ == 'naam' else f.__name__
if (getattr(gewest, '_%s' % attribute, None) is None):
log.debug('Lazy loading Gewest... | [
"def",
"check_lazy_load_gewest",
"(",
"f",
")",
":",
"def",
"wrapper",
"(",
"self",
")",
":",
"gewest",
"=",
"self",
"attribute",
"=",
"'namen'",
"if",
"f",
".",
"__name__",
"==",
"'naam'",
"else",
"f",
".",
"__name__",
"if",
"(",
"getattr",
"(",
"gewe... | Decorator function to lazy load a :class:`Gewest`. | [
"Decorator",
"function",
"to",
"lazy",
"load",
"a",
":",
"class",
":",
"Gewest",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L1584-L1599 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | check_lazy_load_gemeente | def check_lazy_load_gemeente(f):
'''
Decorator function to lazy load a :class:`Gemeente`.
'''
def wrapper(*args):
gemeente = args[0]
if (
gemeente._centroid is None or gemeente._bounding_box is None
or gemeente._taal_id is None or gemeente._metadata is None
... | python | def check_lazy_load_gemeente(f):
'''
Decorator function to lazy load a :class:`Gemeente`.
'''
def wrapper(*args):
gemeente = args[0]
if (
gemeente._centroid is None or gemeente._bounding_box is None
or gemeente._taal_id is None or gemeente._metadata is None
... | [
"def",
"check_lazy_load_gemeente",
"(",
"f",
")",
":",
"def",
"wrapper",
"(",
"*",
"args",
")",
":",
"gemeente",
"=",
"args",
"[",
"0",
"]",
"if",
"(",
"gemeente",
".",
"_centroid",
"is",
"None",
"or",
"gemeente",
".",
"_bounding_box",
"is",
"None",
"o... | Decorator function to lazy load a :class:`Gemeente`. | [
"Decorator",
"function",
"to",
"lazy",
"load",
"a",
":",
"class",
":",
"Gemeente",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L1695-L1713 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | check_lazy_load_straat | def check_lazy_load_straat(f):
'''
Decorator function to lazy load a :class:`Straat`.
'''
def wrapper(*args):
straat = args[0]
if (
straat._namen is None or straat._metadata is None
):
log.debug('Lazy loading Straat %d', straat.id)
straat.check... | python | def check_lazy_load_straat(f):
'''
Decorator function to lazy load a :class:`Straat`.
'''
def wrapper(*args):
straat = args[0]
if (
straat._namen is None or straat._metadata is None
):
log.debug('Lazy loading Straat %d', straat.id)
straat.check... | [
"def",
"check_lazy_load_straat",
"(",
"f",
")",
":",
"def",
"wrapper",
"(",
"*",
"args",
")",
":",
"straat",
"=",
"args",
"[",
"0",
"]",
"if",
"(",
"straat",
".",
"_namen",
"is",
"None",
"or",
"straat",
".",
"_metadata",
"is",
"None",
")",
":",
"lo... | Decorator function to lazy load a :class:`Straat`. | [
"Decorator",
"function",
"to",
"lazy",
"load",
"a",
":",
"class",
":",
"Straat",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L1981-L1996 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | check_lazy_load_huisnummer | def check_lazy_load_huisnummer(f):
'''
Decorator function to lazy load a :class:`Huisnummer`.
'''
def wrapper(*args):
huisnummer = args[0]
if (
huisnummer._metadata is None
):
log.debug('Lazy loading Huisnummer %d', huisnummer.id)
huisnummer.ch... | python | def check_lazy_load_huisnummer(f):
'''
Decorator function to lazy load a :class:`Huisnummer`.
'''
def wrapper(*args):
huisnummer = args[0]
if (
huisnummer._metadata is None
):
log.debug('Lazy loading Huisnummer %d', huisnummer.id)
huisnummer.ch... | [
"def",
"check_lazy_load_huisnummer",
"(",
"f",
")",
":",
"def",
"wrapper",
"(",
"*",
"args",
")",
":",
"huisnummer",
"=",
"args",
"[",
"0",
"]",
"if",
"(",
"huisnummer",
".",
"_metadata",
"is",
"None",
")",
":",
"log",
".",
"debug",
"(",
"'Lazy loading... | Decorator function to lazy load a :class:`Huisnummer`. | [
"Decorator",
"function",
"to",
"lazy",
"load",
"a",
":",
"class",
":",
"Huisnummer",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L2090-L2104 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | check_lazy_load_wegobject | def check_lazy_load_wegobject(f):
'''
Decorator function to lazy load a :class:`Wegobject`.
'''
def wrapper(*args):
wegobject = args[0]
if (
wegobject._centroid is None or
wegobject._bounding_box is None or
wegobject._metadata is None
):
... | python | def check_lazy_load_wegobject(f):
'''
Decorator function to lazy load a :class:`Wegobject`.
'''
def wrapper(*args):
wegobject = args[0]
if (
wegobject._centroid is None or
wegobject._bounding_box is None or
wegobject._metadata is None
):
... | [
"def",
"check_lazy_load_wegobject",
"(",
"f",
")",
":",
"def",
"wrapper",
"(",
"*",
"args",
")",
":",
"wegobject",
"=",
"args",
"[",
"0",
"]",
"if",
"(",
"wegobject",
".",
"_centroid",
"is",
"None",
"or",
"wegobject",
".",
"_bounding_box",
"is",
"None",
... | Decorator function to lazy load a :class:`Wegobject`. | [
"Decorator",
"function",
"to",
"lazy",
"load",
"a",
":",
"class",
":",
"Wegobject",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L2214-L2232 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | check_lazy_load_wegsegment | def check_lazy_load_wegsegment(f):
'''
Decorator function to lazy load a :class:`Wegsegment`.
'''
def wrapper(*args):
wegsegment = args[0]
if (
wegsegment._methode_id is None or
wegsegment._geometrie is None or
wegsegment._metadata is None
):
... | python | def check_lazy_load_wegsegment(f):
'''
Decorator function to lazy load a :class:`Wegsegment`.
'''
def wrapper(*args):
wegsegment = args[0]
if (
wegsegment._methode_id is None or
wegsegment._geometrie is None or
wegsegment._metadata is None
):
... | [
"def",
"check_lazy_load_wegsegment",
"(",
"f",
")",
":",
"def",
"wrapper",
"(",
"*",
"args",
")",
":",
"wegsegment",
"=",
"args",
"[",
"0",
"]",
"if",
"(",
"wegsegment",
".",
"_methode_id",
"is",
"None",
"or",
"wegsegment",
".",
"_geometrie",
"is",
"None... | Decorator function to lazy load a :class:`Wegsegment`. | [
"Decorator",
"function",
"to",
"lazy",
"load",
"a",
":",
"class",
":",
"Wegsegment",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L2283-L2301 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | check_lazy_load_terreinobject | def check_lazy_load_terreinobject(f):
'''
Decorator function to lazy load a :class:`Terreinobject`.
'''
def wrapper(*args):
terreinobject = args[0]
if (
terreinobject._centroid is None or
terreinobject._bounding_box is None or
terreinobject._metadata i... | python | def check_lazy_load_terreinobject(f):
'''
Decorator function to lazy load a :class:`Terreinobject`.
'''
def wrapper(*args):
terreinobject = args[0]
if (
terreinobject._centroid is None or
terreinobject._bounding_box is None or
terreinobject._metadata i... | [
"def",
"check_lazy_load_terreinobject",
"(",
"f",
")",
":",
"def",
"wrapper",
"(",
"*",
"args",
")",
":",
"terreinobject",
"=",
"args",
"[",
"0",
"]",
"if",
"(",
"terreinobject",
".",
"_centroid",
"is",
"None",
"or",
"terreinobject",
".",
"_bounding_box",
... | Decorator function to lazy load a :class:`Terreinobject`. | [
"Decorator",
"function",
"to",
"lazy",
"load",
"a",
":",
"class",
":",
"Terreinobject",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L2362-L2380 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | check_lazy_load_perceel | def check_lazy_load_perceel(f):
'''
Decorator function to lazy load a :class:`Perceel`.
'''
def wrapper(*args):
perceel = args[0]
if perceel._centroid is None or perceel._metadata is None:
log.debug('Lazy loading Perceel %s', perceel.id)
perceel.check_gateway()
... | python | def check_lazy_load_perceel(f):
'''
Decorator function to lazy load a :class:`Perceel`.
'''
def wrapper(*args):
perceel = args[0]
if perceel._centroid is None or perceel._metadata is None:
log.debug('Lazy loading Perceel %s', perceel.id)
perceel.check_gateway()
... | [
"def",
"check_lazy_load_perceel",
"(",
"f",
")",
":",
"def",
"wrapper",
"(",
"*",
"args",
")",
":",
"perceel",
"=",
"args",
"[",
"0",
"]",
"if",
"perceel",
".",
"_centroid",
"is",
"None",
"or",
"perceel",
".",
"_metadata",
"is",
"None",
":",
"log",
"... | Decorator function to lazy load a :class:`Perceel`. | [
"Decorator",
"function",
"to",
"lazy",
"load",
"a",
":",
"class",
":",
"Perceel",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L2439-L2452 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | check_lazy_load_gebouw | def check_lazy_load_gebouw(f):
'''
Decorator function to lazy load a :class:`Gebouw`.
'''
def wrapper(*args):
gebouw = args[0]
if (
gebouw._methode_id is None or gebouw._geometrie is None or
gebouw._metadata is None
):
log.debug('Lazy loading G... | python | def check_lazy_load_gebouw(f):
'''
Decorator function to lazy load a :class:`Gebouw`.
'''
def wrapper(*args):
gebouw = args[0]
if (
gebouw._methode_id is None or gebouw._geometrie is None or
gebouw._metadata is None
):
log.debug('Lazy loading G... | [
"def",
"check_lazy_load_gebouw",
"(",
"f",
")",
":",
"def",
"wrapper",
"(",
"*",
"args",
")",
":",
"gebouw",
"=",
"args",
"[",
"0",
"]",
"if",
"(",
"gebouw",
".",
"_methode_id",
"is",
"None",
"or",
"gebouw",
".",
"_geometrie",
"is",
"None",
"or",
"ge... | Decorator function to lazy load a :class:`Gebouw`. | [
"Decorator",
"function",
"to",
"lazy",
"load",
"a",
":",
"class",
":",
"Gebouw",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L2512-L2529 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | check_lazy_load_subadres | def check_lazy_load_subadres(f):
'''
Decorator function to lazy load a :class:`Subadres`.
'''
def wrapper(*args):
subadres = args[0]
if (
subadres._metadata is None or
subadres.aard_id is None or
subadres.huisnummer_id is None
):
lo... | python | def check_lazy_load_subadres(f):
'''
Decorator function to lazy load a :class:`Subadres`.
'''
def wrapper(*args):
subadres = args[0]
if (
subadres._metadata is None or
subadres.aard_id is None or
subadres.huisnummer_id is None
):
lo... | [
"def",
"check_lazy_load_subadres",
"(",
"f",
")",
":",
"def",
"wrapper",
"(",
"*",
"args",
")",
":",
"subadres",
"=",
"args",
"[",
"0",
"]",
"if",
"(",
"subadres",
".",
"_metadata",
"is",
"None",
"or",
"subadres",
".",
"aard_id",
"is",
"None",
"or",
... | Decorator function to lazy load a :class:`Subadres`. | [
"Decorator",
"function",
"to",
"lazy",
"load",
"a",
":",
"class",
":",
"Subadres",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L2610-L2628 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | check_lazy_load_adrespositie | def check_lazy_load_adrespositie(f):
'''
Decorator function to lazy load a :class:`Adrespositie`.
'''
def wrapper(*args):
adrespositie = args[0]
if (
adrespositie._geometrie is None or
adrespositie._aard is None or
adrespositie._metadata is None
... | python | def check_lazy_load_adrespositie(f):
'''
Decorator function to lazy load a :class:`Adrespositie`.
'''
def wrapper(*args):
adrespositie = args[0]
if (
adrespositie._geometrie is None or
adrespositie._aard is None or
adrespositie._metadata is None
... | [
"def",
"check_lazy_load_adrespositie",
"(",
"f",
")",
":",
"def",
"wrapper",
"(",
"*",
"args",
")",
":",
"adrespositie",
"=",
"args",
"[",
"0",
"]",
"if",
"(",
"adrespositie",
".",
"_geometrie",
"is",
"None",
"or",
"adrespositie",
".",
"_aard",
"is",
"No... | Decorator function to lazy load a :class:`Adrespositie`. | [
"Decorator",
"function",
"to",
"lazy",
"load",
"a",
":",
"class",
":",
"Adrespositie",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L2705-L2723 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | CrabGateway.list_gewesten | def list_gewesten(self, sort=1):
'''
List all `gewesten` in Belgium.
:param integer sort: What field to sort on.
:rtype: A :class`list` of class: `Gewest`.
'''
def creator():
res = crab_gateway_request(self.client, 'ListGewesten', sort)
tmp = {}
... | python | def list_gewesten(self, sort=1):
'''
List all `gewesten` in Belgium.
:param integer sort: What field to sort on.
:rtype: A :class`list` of class: `Gewest`.
'''
def creator():
res = crab_gateway_request(self.client, 'ListGewesten', sort)
tmp = {}
... | [
"def",
"list_gewesten",
"(",
"self",
",",
"sort",
"=",
"1",
")",
":",
"def",
"creator",
"(",
")",
":",
"res",
"=",
"crab_gateway_request",
"(",
"self",
".",
"client",
",",
"'ListGewesten'",
",",
"sort",
")",
"tmp",
"=",
"{",
"}",
"for",
"r",
"in",
... | List all `gewesten` in Belgium.
:param integer sort: What field to sort on.
:rtype: A :class`list` of class: `Gewest`. | [
"List",
"all",
"gewesten",
"in",
"Belgium",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L99-L126 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | CrabGateway.get_gewest_by_id | def get_gewest_by_id(self, id):
'''
Get a `gewest` by id.
:param integer id: The id of a `gewest`.
:rtype: A :class:`Gewest`.
'''
def creator():
nl = crab_gateway_request(
self.client, 'GetGewestByGewestIdAndTaalCode', id, 'nl'
)
... | python | def get_gewest_by_id(self, id):
'''
Get a `gewest` by id.
:param integer id: The id of a `gewest`.
:rtype: A :class:`Gewest`.
'''
def creator():
nl = crab_gateway_request(
self.client, 'GetGewestByGewestIdAndTaalCode', id, 'nl'
)
... | [
"def",
"get_gewest_by_id",
"(",
"self",
",",
"id",
")",
":",
"def",
"creator",
"(",
")",
":",
"nl",
"=",
"crab_gateway_request",
"(",
"self",
".",
"client",
",",
"'GetGewestByGewestIdAndTaalCode'",
",",
"id",
",",
"'nl'",
")",
"fr",
"=",
"crab_gateway_reques... | Get a `gewest` by id.
:param integer id: The id of a `gewest`.
:rtype: A :class:`Gewest`. | [
"Get",
"a",
"gewest",
"by",
"id",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L128-L163 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | CrabGateway.list_provincies | def list_provincies(self, gewest=2):
'''
List all `provincies` in a `gewest`.
:param gewest: The :class:`Gewest` for which the \
`provincies` are wanted.
:param integer sort: What field to sort on.
:rtype: A :class:`list` of :class:`Provincie`.
'''
tr... | python | def list_provincies(self, gewest=2):
'''
List all `provincies` in a `gewest`.
:param gewest: The :class:`Gewest` for which the \
`provincies` are wanted.
:param integer sort: What field to sort on.
:rtype: A :class:`list` of :class:`Provincie`.
'''
tr... | [
"def",
"list_provincies",
"(",
"self",
",",
"gewest",
"=",
"2",
")",
":",
"try",
":",
"gewest_id",
"=",
"gewest",
".",
"id",
"except",
"AttributeError",
":",
"gewest_id",
"=",
"gewest",
"def",
"creator",
"(",
")",
":",
"return",
"[",
"Provincie",
"(",
... | List all `provincies` in a `gewest`.
:param gewest: The :class:`Gewest` for which the \
`provincies` are wanted.
:param integer sort: What field to sort on.
:rtype: A :class:`list` of :class:`Provincie`. | [
"List",
"all",
"provincies",
"in",
"a",
"gewest",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L165-L189 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | CrabGateway.get_provincie_by_id | def get_provincie_by_id(self, niscode):
'''
Retrieve a `provincie` by the niscode.
:param integer niscode: The niscode of the provincie.
:rtype: :class:`Provincie`
'''
def creator():
for p in self.provincies:
if p[0] == niscode:
... | python | def get_provincie_by_id(self, niscode):
'''
Retrieve a `provincie` by the niscode.
:param integer niscode: The niscode of the provincie.
:rtype: :class:`Provincie`
'''
def creator():
for p in self.provincies:
if p[0] == niscode:
... | [
"def",
"get_provincie_by_id",
"(",
"self",
",",
"niscode",
")",
":",
"def",
"creator",
"(",
")",
":",
"for",
"p",
"in",
"self",
".",
"provincies",
":",
"if",
"p",
"[",
"0",
"]",
"==",
"niscode",
":",
"return",
"Provincie",
"(",
"p",
"[",
"0",
"]",
... | Retrieve a `provincie` by the niscode.
:param integer niscode: The niscode of the provincie.
:rtype: :class:`Provincie` | [
"Retrieve",
"a",
"provincie",
"by",
"the",
"niscode",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L191-L211 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | CrabGateway.list_gemeenten_by_provincie | def list_gemeenten_by_provincie(self, provincie):
'''
List all `gemeenten` in a `provincie`.
:param provincie: The :class:`Provincie` for which the \
`gemeenten` are wanted.
:rtype: A :class:`list` of :class:`Gemeente`.
'''
try:
gewest = provincie... | python | def list_gemeenten_by_provincie(self, provincie):
'''
List all `gemeenten` in a `provincie`.
:param provincie: The :class:`Provincie` for which the \
`gemeenten` are wanted.
:rtype: A :class:`list` of :class:`Gemeente`.
'''
try:
gewest = provincie... | [
"def",
"list_gemeenten_by_provincie",
"(",
"self",
",",
"provincie",
")",
":",
"try",
":",
"gewest",
"=",
"provincie",
".",
"gewest",
"prov",
"=",
"provincie",
"except",
"AttributeError",
":",
"prov",
"=",
"self",
".",
"get_provincie_by_id",
"(",
"provincie",
... | List all `gemeenten` in a `provincie`.
:param provincie: The :class:`Provincie` for which the \
`gemeenten` are wanted.
:rtype: A :class:`list` of :class:`Gemeente`. | [
"List",
"all",
"gemeenten",
"in",
"a",
"provincie",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L213-L247 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | CrabGateway.list_gemeenten | def list_gemeenten(self, gewest=2, sort=1):
'''
List all `gemeenten` in a `gewest`.
:param gewest: The :class:`Gewest` for which the \
`gemeenten` are wanted.
:param integer sort: What field to sort on.
:rtype: A :class:`list` of :class:`Gemeente`.
'''
... | python | def list_gemeenten(self, gewest=2, sort=1):
'''
List all `gemeenten` in a `gewest`.
:param gewest: The :class:`Gewest` for which the \
`gemeenten` are wanted.
:param integer sort: What field to sort on.
:rtype: A :class:`list` of :class:`Gemeente`.
'''
... | [
"def",
"list_gemeenten",
"(",
"self",
",",
"gewest",
"=",
"2",
",",
"sort",
"=",
"1",
")",
":",
"try",
":",
"gewest_id",
"=",
"gewest",
".",
"id",
"except",
"AttributeError",
":",
"gewest_id",
"=",
"gewest",
"gewest",
"=",
"self",
".",
"get_gewest_by_id"... | List all `gemeenten` in a `gewest`.
:param gewest: The :class:`Gewest` for which the \
`gemeenten` are wanted.
:param integer sort: What field to sort on.
:rtype: A :class:`list` of :class:`Gemeente`. | [
"List",
"all",
"gemeenten",
"in",
"a",
"gewest",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L249-L284 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | CrabGateway.get_gemeente_by_id | def get_gemeente_by_id(self, id):
'''
Retrieve a `gemeente` by the crab id.
:param integer id: The CRAB id of the gemeente.
:rtype: :class:`Gemeente`
'''
def creator():
res = crab_gateway_request(
self.client, 'GetGemeenteByGemeenteId', id
... | python | def get_gemeente_by_id(self, id):
'''
Retrieve a `gemeente` by the crab id.
:param integer id: The CRAB id of the gemeente.
:rtype: :class:`Gemeente`
'''
def creator():
res = crab_gateway_request(
self.client, 'GetGemeenteByGemeenteId', id
... | [
"def",
"get_gemeente_by_id",
"(",
"self",
",",
"id",
")",
":",
"def",
"creator",
"(",
")",
":",
"res",
"=",
"crab_gateway_request",
"(",
"self",
".",
"client",
",",
"'GetGemeenteByGemeenteId'",
",",
"id",
")",
"if",
"res",
"==",
"None",
":",
"raise",
"Ga... | Retrieve a `gemeente` by the crab id.
:param integer id: The CRAB id of the gemeente.
:rtype: :class:`Gemeente` | [
"Retrieve",
"a",
"gemeente",
"by",
"the",
"crab",
"id",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L286-L320 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | CrabGateway.list_deelgemeenten | def list_deelgemeenten(self, gewest=2):
'''
List all `deelgemeenten` in a `gewest`.
:param gewest: The :class:`Gewest` for which the \
`deelgemeenten` are wanted. Currently only Flanders is supported.
:rtype: A :class:`list` of :class:`Deelgemeente`.
'''
try:... | python | def list_deelgemeenten(self, gewest=2):
'''
List all `deelgemeenten` in a `gewest`.
:param gewest: The :class:`Gewest` for which the \
`deelgemeenten` are wanted. Currently only Flanders is supported.
:rtype: A :class:`list` of :class:`Deelgemeente`.
'''
try:... | [
"def",
"list_deelgemeenten",
"(",
"self",
",",
"gewest",
"=",
"2",
")",
":",
"try",
":",
"gewest_id",
"=",
"gewest",
".",
"id",
"except",
"AttributeError",
":",
"gewest_id",
"=",
"gewest",
"if",
"gewest_id",
"!=",
"2",
":",
"raise",
"ValueError",
"(",
"'... | List all `deelgemeenten` in a `gewest`.
:param gewest: The :class:`Gewest` for which the \
`deelgemeenten` are wanted. Currently only Flanders is supported.
:rtype: A :class:`list` of :class:`Deelgemeente`. | [
"List",
"all",
"deelgemeenten",
"in",
"a",
"gewest",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L359-L385 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | CrabGateway.list_deelgemeenten_by_gemeente | def list_deelgemeenten_by_gemeente(self, gemeente):
'''
List all `deelgemeenten` in a `gemeente`.
:param gemeente: The :class:`Gemeente` for which the \
`deelgemeenten` are wanted. Currently only Flanders is supported.
:rtype: A :class:`list` of :class:`Deelgemeente`.
... | python | def list_deelgemeenten_by_gemeente(self, gemeente):
'''
List all `deelgemeenten` in a `gemeente`.
:param gemeente: The :class:`Gemeente` for which the \
`deelgemeenten` are wanted. Currently only Flanders is supported.
:rtype: A :class:`list` of :class:`Deelgemeente`.
... | [
"def",
"list_deelgemeenten_by_gemeente",
"(",
"self",
",",
"gemeente",
")",
":",
"try",
":",
"niscode",
"=",
"gemeente",
".",
"niscode",
"except",
"AttributeError",
":",
"niscode",
"=",
"gemeente",
"def",
"creator",
"(",
")",
":",
"return",
"[",
"Deelgemeente"... | List all `deelgemeenten` in a `gemeente`.
:param gemeente: The :class:`Gemeente` for which the \
`deelgemeenten` are wanted. Currently only Flanders is supported.
:rtype: A :class:`list` of :class:`Deelgemeente`. | [
"List",
"all",
"deelgemeenten",
"in",
"a",
"gemeente",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L387-L413 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | CrabGateway.get_deelgemeente_by_id | def get_deelgemeente_by_id(self, id):
'''
Retrieve a `deelgemeente` by the id.
:param string id: The id of the deelgemeente.
:rtype: :class:`Deelgemeente`
'''
def creator():
if id in self.deelgemeenten:
dg = self.deelgemeenten[id]
... | python | def get_deelgemeente_by_id(self, id):
'''
Retrieve a `deelgemeente` by the id.
:param string id: The id of the deelgemeente.
:rtype: :class:`Deelgemeente`
'''
def creator():
if id in self.deelgemeenten:
dg = self.deelgemeenten[id]
... | [
"def",
"get_deelgemeente_by_id",
"(",
"self",
",",
"id",
")",
":",
"def",
"creator",
"(",
")",
":",
"if",
"id",
"in",
"self",
".",
"deelgemeenten",
":",
"dg",
"=",
"self",
".",
"deelgemeenten",
"[",
"id",
"]",
"return",
"Deelgemeente",
"(",
"dg",
"[",
... | Retrieve a `deelgemeente` by the id.
:param string id: The id of the deelgemeente.
:rtype: :class:`Deelgemeente` | [
"Retrieve",
"a",
"deelgemeente",
"by",
"the",
"id",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L415-L437 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | CrabGateway.list_straten | def list_straten(self, gemeente, sort=1):
'''
List all `straten` in a `Gemeente`.
:param gemeente: The :class:`Gemeente` for which the \
`straten` are wanted.
:rtype: A :class:`list` of :class:`Straat`
'''
try:
id = gemeente.id
except Attr... | python | def list_straten(self, gemeente, sort=1):
'''
List all `straten` in a `Gemeente`.
:param gemeente: The :class:`Gemeente` for which the \
`straten` are wanted.
:rtype: A :class:`list` of :class:`Straat`
'''
try:
id = gemeente.id
except Attr... | [
"def",
"list_straten",
"(",
"self",
",",
"gemeente",
",",
"sort",
"=",
"1",
")",
":",
"try",
":",
"id",
"=",
"gemeente",
".",
"id",
"except",
"AttributeError",
":",
"id",
"=",
"gemeente",
"def",
"creator",
"(",
")",
":",
"res",
"=",
"crab_gateway_reque... | List all `straten` in a `Gemeente`.
:param gemeente: The :class:`Gemeente` for which the \
`straten` are wanted.
:rtype: A :class:`list` of :class:`Straat` | [
"List",
"all",
"straten",
"in",
"a",
"Gemeente",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L614-L650 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | CrabGateway.get_straat_by_id | def get_straat_by_id(self, id):
'''
Retrieve a `straat` by the Id.
:param integer id: The id of the `straat`.
:rtype: :class:`Straat`
'''
def creator():
res = crab_gateway_request(
self.client, 'GetStraatnaamWithStatusByStraatnaamId', id
... | python | def get_straat_by_id(self, id):
'''
Retrieve a `straat` by the Id.
:param integer id: The id of the `straat`.
:rtype: :class:`Straat`
'''
def creator():
res = crab_gateway_request(
self.client, 'GetStraatnaamWithStatusByStraatnaamId', id
... | [
"def",
"get_straat_by_id",
"(",
"self",
",",
"id",
")",
":",
"def",
"creator",
"(",
")",
":",
"res",
"=",
"crab_gateway_request",
"(",
"self",
".",
"client",
",",
"'GetStraatnaamWithStatusByStraatnaamId'",
",",
"id",
")",
"if",
"res",
"==",
"None",
":",
"r... | Retrieve a `straat` by the Id.
:param integer id: The id of the `straat`.
:rtype: :class:`Straat` | [
"Retrieve",
"a",
"straat",
"by",
"the",
"Id",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L652-L688 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | CrabGateway.list_huisnummers_by_straat | def list_huisnummers_by_straat(self, straat, sort=1):
'''
List all `huisnummers` in a `Straat`.
:param straat: The :class:`Straat` for which the \
`huisnummers` are wanted.
:rtype: A :class: `list` of :class:`Huisnummer`
'''
try:
id = straat.id
... | python | def list_huisnummers_by_straat(self, straat, sort=1):
'''
List all `huisnummers` in a `Straat`.
:param straat: The :class:`Straat` for which the \
`huisnummers` are wanted.
:rtype: A :class: `list` of :class:`Huisnummer`
'''
try:
id = straat.id
... | [
"def",
"list_huisnummers_by_straat",
"(",
"self",
",",
"straat",
",",
"sort",
"=",
"1",
")",
":",
"try",
":",
"id",
"=",
"straat",
".",
"id",
"except",
"AttributeError",
":",
"id",
"=",
"straat",
"def",
"creator",
"(",
")",
":",
"res",
"=",
"crab_gatew... | List all `huisnummers` in a `Straat`.
:param straat: The :class:`Straat` for which the \
`huisnummers` are wanted.
:rtype: A :class: `list` of :class:`Huisnummer` | [
"List",
"all",
"huisnummers",
"in",
"a",
"Straat",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L690-L726 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | CrabGateway.list_huisnummers_by_perceel | def list_huisnummers_by_perceel(self, perceel, sort=1):
'''
List all `huisnummers` on a `Pereel`.
Generally there will only be one, but multiples are possible.
:param perceel: The :class:`Perceel` for which the \
`huisnummers` are wanted.
:rtype: A :class: `list` of... | python | def list_huisnummers_by_perceel(self, perceel, sort=1):
'''
List all `huisnummers` on a `Pereel`.
Generally there will only be one, but multiples are possible.
:param perceel: The :class:`Perceel` for which the \
`huisnummers` are wanted.
:rtype: A :class: `list` of... | [
"def",
"list_huisnummers_by_perceel",
"(",
"self",
",",
"perceel",
",",
"sort",
"=",
"1",
")",
":",
"try",
":",
"id",
"=",
"perceel",
".",
"id",
"except",
"AttributeError",
":",
"id",
"=",
"perceel",
"def",
"creator",
"(",
")",
":",
"res",
"=",
"crab_g... | List all `huisnummers` on a `Pereel`.
Generally there will only be one, but multiples are possible.
:param perceel: The :class:`Perceel` for which the \
`huisnummers` are wanted.
:rtype: A :class: `list` of :class:`Huisnummer` | [
"List",
"all",
"huisnummers",
"on",
"a",
"Pereel",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L728-L764 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | CrabGateway.get_huisnummer_by_id | def get_huisnummer_by_id(self, id):
'''
Retrieve a `huisnummer` by the Id.
:param integer id: the Id of the `huisnummer`
:rtype: :class:`Huisnummer`
'''
def creator():
res = crab_gateway_request(
self.client, 'GetHuisnummerWithStatusByHuisnumm... | python | def get_huisnummer_by_id(self, id):
'''
Retrieve a `huisnummer` by the Id.
:param integer id: the Id of the `huisnummer`
:rtype: :class:`Huisnummer`
'''
def creator():
res = crab_gateway_request(
self.client, 'GetHuisnummerWithStatusByHuisnumm... | [
"def",
"get_huisnummer_by_id",
"(",
"self",
",",
"id",
")",
":",
"def",
"creator",
"(",
")",
":",
"res",
"=",
"crab_gateway_request",
"(",
"self",
".",
"client",
",",
"'GetHuisnummerWithStatusByHuisnummerId'",
",",
"id",
")",
"if",
"res",
"==",
"None",
":",
... | Retrieve a `huisnummer` by the Id.
:param integer id: the Id of the `huisnummer`
:rtype: :class:`Huisnummer` | [
"Retrieve",
"a",
"huisnummer",
"by",
"the",
"Id",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L766-L797 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | CrabGateway.list_postkantons_by_gemeente | def list_postkantons_by_gemeente(self, gemeente):
'''
List all `postkantons` in a :class:`Gemeente`
:param gemeente: The :class:`Gemeente` for which the \
`potkantons` are wanted.
:rtype: A :class:`list` of :class:`Postkanton`
'''
try:
id = gemeen... | python | def list_postkantons_by_gemeente(self, gemeente):
'''
List all `postkantons` in a :class:`Gemeente`
:param gemeente: The :class:`Gemeente` for which the \
`potkantons` are wanted.
:rtype: A :class:`list` of :class:`Postkanton`
'''
try:
id = gemeen... | [
"def",
"list_postkantons_by_gemeente",
"(",
"self",
",",
"gemeente",
")",
":",
"try",
":",
"id",
"=",
"gemeente",
".",
"id",
"except",
"AttributeError",
":",
"id",
"=",
"gemeente",
"def",
"creator",
"(",
")",
":",
"res",
"=",
"crab_gateway_request",
"(",
"... | List all `postkantons` in a :class:`Gemeente`
:param gemeente: The :class:`Gemeente` for which the \
`potkantons` are wanted.
:rtype: A :class:`list` of :class:`Postkanton` | [
"List",
"all",
"postkantons",
"in",
"a",
":",
"class",
":",
"Gemeente"
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L840-L872 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | CrabGateway.get_postkanton_by_huisnummer | def get_postkanton_by_huisnummer(self, huisnummer):
'''
Retrieve a `postkanton` by the Huisnummer.
:param huisnummer: The :class:`Huisnummer` for which the `postkanton` \
is wanted.
:rtype: :class:`Postkanton`
'''
try:
id = huisnummer.id
... | python | def get_postkanton_by_huisnummer(self, huisnummer):
'''
Retrieve a `postkanton` by the Huisnummer.
:param huisnummer: The :class:`Huisnummer` for which the `postkanton` \
is wanted.
:rtype: :class:`Postkanton`
'''
try:
id = huisnummer.id
... | [
"def",
"get_postkanton_by_huisnummer",
"(",
"self",
",",
"huisnummer",
")",
":",
"try",
":",
"id",
"=",
"huisnummer",
".",
"id",
"except",
"AttributeError",
":",
"id",
"=",
"huisnummer",
"def",
"creator",
"(",
")",
":",
"res",
"=",
"crab_gateway_request",
"(... | Retrieve a `postkanton` by the Huisnummer.
:param huisnummer: The :class:`Huisnummer` for which the `postkanton` \
is wanted.
:rtype: :class:`Postkanton` | [
"Retrieve",
"a",
"postkanton",
"by",
"the",
"Huisnummer",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L874-L902 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | CrabGateway.get_wegobject_by_id | def get_wegobject_by_id(self, id):
'''
Retrieve a `Wegobject` by the Id.
:param integer id: the Id of the `Wegobject`
:rtype: :class:`Wegobject`
'''
def creator():
res = crab_gateway_request(
self.client, 'GetWegobjectByIdentificatorWegobject'... | python | def get_wegobject_by_id(self, id):
'''
Retrieve a `Wegobject` by the Id.
:param integer id: the Id of the `Wegobject`
:rtype: :class:`Wegobject`
'''
def creator():
res = crab_gateway_request(
self.client, 'GetWegobjectByIdentificatorWegobject'... | [
"def",
"get_wegobject_by_id",
"(",
"self",
",",
"id",
")",
":",
"def",
"creator",
"(",
")",
":",
"res",
"=",
"crab_gateway_request",
"(",
"self",
".",
"client",
",",
"'GetWegobjectByIdentificatorWegobject'",
",",
"id",
")",
"if",
"res",
"==",
"None",
":",
... | Retrieve a `Wegobject` by the Id.
:param integer id: the Id of the `Wegobject`
:rtype: :class:`Wegobject` | [
"Retrieve",
"a",
"Wegobject",
"by",
"the",
"Id",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L904-L935 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | CrabGateway.list_wegobjecten_by_straat | def list_wegobjecten_by_straat(self, straat):
'''
List all `wegobjecten` in a :class:`Straat`
:param straat: The :class:`Straat` for which the `wegobjecten` \
are wanted.
:rtype: A :class:`list` of :class:`Wegobject`
'''
try:
id = straat.id
... | python | def list_wegobjecten_by_straat(self, straat):
'''
List all `wegobjecten` in a :class:`Straat`
:param straat: The :class:`Straat` for which the `wegobjecten` \
are wanted.
:rtype: A :class:`list` of :class:`Wegobject`
'''
try:
id = straat.id
... | [
"def",
"list_wegobjecten_by_straat",
"(",
"self",
",",
"straat",
")",
":",
"try",
":",
"id",
"=",
"straat",
".",
"id",
"except",
"AttributeError",
":",
"id",
"=",
"straat",
"def",
"creator",
"(",
")",
":",
"res",
"=",
"crab_gateway_request",
"(",
"self",
... | List all `wegobjecten` in a :class:`Straat`
:param straat: The :class:`Straat` for which the `wegobjecten` \
are wanted.
:rtype: A :class:`list` of :class:`Wegobject` | [
"List",
"all",
"wegobjecten",
"in",
"a",
":",
"class",
":",
"Straat"
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L937-L970 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | CrabGateway.get_wegsegment_by_id | def get_wegsegment_by_id(self, id):
'''
Retrieve a `wegsegment` by the Id.
:param integer id: the Id of the `wegsegment`
:rtype: :class:`Wegsegment`
'''
def creator():
res = crab_gateway_request(
self.client,
'GetWegsegmentById... | python | def get_wegsegment_by_id(self, id):
'''
Retrieve a `wegsegment` by the Id.
:param integer id: the Id of the `wegsegment`
:rtype: :class:`Wegsegment`
'''
def creator():
res = crab_gateway_request(
self.client,
'GetWegsegmentById... | [
"def",
"get_wegsegment_by_id",
"(",
"self",
",",
"id",
")",
":",
"def",
"creator",
"(",
")",
":",
"res",
"=",
"crab_gateway_request",
"(",
"self",
".",
"client",
",",
"'GetWegsegmentByIdentificatorWegsegment'",
",",
"id",
")",
"if",
"res",
"==",
"None",
":",... | Retrieve a `wegsegment` by the Id.
:param integer id: the Id of the `wegsegment`
:rtype: :class:`Wegsegment` | [
"Retrieve",
"a",
"wegsegment",
"by",
"the",
"Id",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L972-L1004 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | CrabGateway.list_wegsegmenten_by_straat | def list_wegsegmenten_by_straat(self, straat):
'''
List all `wegsegmenten` in a :class:`Straat`
:param straat: The :class:`Straat` for which the `wegsegmenten` \
are wanted.
:rtype: A :class:`list` of :class:`Wegsegment`
'''
try:
id = straat.i... | python | def list_wegsegmenten_by_straat(self, straat):
'''
List all `wegsegmenten` in a :class:`Straat`
:param straat: The :class:`Straat` for which the `wegsegmenten` \
are wanted.
:rtype: A :class:`list` of :class:`Wegsegment`
'''
try:
id = straat.i... | [
"def",
"list_wegsegmenten_by_straat",
"(",
"self",
",",
"straat",
")",
":",
"try",
":",
"id",
"=",
"straat",
".",
"id",
"except",
"AttributeError",
":",
"id",
"=",
"straat",
"def",
"creator",
"(",
")",
":",
"res",
"=",
"crab_gateway_request",
"(",
"self",
... | List all `wegsegmenten` in a :class:`Straat`
:param straat: The :class:`Straat` for which the `wegsegmenten` \
are wanted.
:rtype: A :class:`list` of :class:`Wegsegment` | [
"List",
"all",
"wegsegmenten",
"in",
"a",
":",
"class",
":",
"Straat"
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L1006-L1039 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | CrabGateway.list_terreinobjecten_by_huisnummer | def list_terreinobjecten_by_huisnummer(self, huisnummer):
'''
List all `terreinobjecten` for a :class:`Huisnummer`
:param huisnummer: The :class:`Huisnummer` for which the \
`terreinobjecten` are wanted.
:rtype: A :class:`list` of :class:`Terreinobject`
'''
t... | python | def list_terreinobjecten_by_huisnummer(self, huisnummer):
'''
List all `terreinobjecten` for a :class:`Huisnummer`
:param huisnummer: The :class:`Huisnummer` for which the \
`terreinobjecten` are wanted.
:rtype: A :class:`list` of :class:`Terreinobject`
'''
t... | [
"def",
"list_terreinobjecten_by_huisnummer",
"(",
"self",
",",
"huisnummer",
")",
":",
"try",
":",
"id",
"=",
"huisnummer",
".",
"id",
"except",
"AttributeError",
":",
"id",
"=",
"huisnummer",
"def",
"creator",
"(",
")",
":",
"res",
"=",
"crab_gateway_request"... | List all `terreinobjecten` for a :class:`Huisnummer`
:param huisnummer: The :class:`Huisnummer` for which the \
`terreinobjecten` are wanted.
:rtype: A :class:`list` of :class:`Terreinobject` | [
"List",
"all",
"terreinobjecten",
"for",
"a",
":",
"class",
":",
"Huisnummer"
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L1041-L1074 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | CrabGateway.get_terreinobject_by_id | def get_terreinobject_by_id(self, id):
'''
Retrieve a `Terreinobject` by the Id.
:param integer id: the Id of the `Terreinobject`
:rtype: :class:`Terreinobject`
'''
def creator():
res = crab_gateway_request(
self.client,
'GetTe... | python | def get_terreinobject_by_id(self, id):
'''
Retrieve a `Terreinobject` by the Id.
:param integer id: the Id of the `Terreinobject`
:rtype: :class:`Terreinobject`
'''
def creator():
res = crab_gateway_request(
self.client,
'GetTe... | [
"def",
"get_terreinobject_by_id",
"(",
"self",
",",
"id",
")",
":",
"def",
"creator",
"(",
")",
":",
"res",
"=",
"crab_gateway_request",
"(",
"self",
".",
"client",
",",
"'GetTerreinobjectByIdentificatorTerreinobject'",
",",
"id",
")",
"if",
"res",
"==",
"None... | Retrieve a `Terreinobject` by the Id.
:param integer id: the Id of the `Terreinobject`
:rtype: :class:`Terreinobject` | [
"Retrieve",
"a",
"Terreinobject",
"by",
"the",
"Id",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L1076-L1108 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | CrabGateway.list_percelen_by_huisnummer | def list_percelen_by_huisnummer(self, huisnummer):
'''
List all `percelen` for a :class:`Huisnummer`
:param huisnummer: The :class:`Huisnummer` for which the \
`percelen` are wanted.
:rtype: A :class:`list` of :class:`Perceel`
'''
try:
id = huisnu... | python | def list_percelen_by_huisnummer(self, huisnummer):
'''
List all `percelen` for a :class:`Huisnummer`
:param huisnummer: The :class:`Huisnummer` for which the \
`percelen` are wanted.
:rtype: A :class:`list` of :class:`Perceel`
'''
try:
id = huisnu... | [
"def",
"list_percelen_by_huisnummer",
"(",
"self",
",",
"huisnummer",
")",
":",
"try",
":",
"id",
"=",
"huisnummer",
".",
"id",
"except",
"AttributeError",
":",
"id",
"=",
"huisnummer",
"def",
"creator",
"(",
")",
":",
"res",
"=",
"crab_gateway_request",
"("... | List all `percelen` for a :class:`Huisnummer`
:param huisnummer: The :class:`Huisnummer` for which the \
`percelen` are wanted.
:rtype: A :class:`list` of :class:`Perceel` | [
"List",
"all",
"percelen",
"for",
"a",
":",
"class",
":",
"Huisnummer"
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L1110-L1142 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | CrabGateway.get_perceel_by_id | def get_perceel_by_id(self, id):
'''
Retrieve a `Perceel` by the Id.
:param string id: the Id of the `Perceel`
:rtype: :class:`Perceel`
'''
def creator():
res = crab_gateway_request(
self.client, 'GetPerceelByIdentificatorPerceel', id
... | python | def get_perceel_by_id(self, id):
'''
Retrieve a `Perceel` by the Id.
:param string id: the Id of the `Perceel`
:rtype: :class:`Perceel`
'''
def creator():
res = crab_gateway_request(
self.client, 'GetPerceelByIdentificatorPerceel', id
... | [
"def",
"get_perceel_by_id",
"(",
"self",
",",
"id",
")",
":",
"def",
"creator",
"(",
")",
":",
"res",
"=",
"crab_gateway_request",
"(",
"self",
".",
"client",
",",
"'GetPerceelByIdentificatorPerceel'",
",",
"id",
")",
"if",
"res",
"==",
"None",
":",
"raise... | Retrieve a `Perceel` by the Id.
:param string id: the Id of the `Perceel`
:rtype: :class:`Perceel` | [
"Retrieve",
"a",
"Perceel",
"by",
"the",
"Id",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L1144-L1173 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | CrabGateway.list_gebouwen_by_huisnummer | def list_gebouwen_by_huisnummer(self, huisnummer):
'''
List all `gebouwen` for a :class:`Huisnummer`.
:param huisnummer: The :class:`Huisnummer` for which the \
`gebouwen` are wanted.
:rtype: A :class:`list` of :class:`Gebouw`
'''
try:
id = huisnu... | python | def list_gebouwen_by_huisnummer(self, huisnummer):
'''
List all `gebouwen` for a :class:`Huisnummer`.
:param huisnummer: The :class:`Huisnummer` for which the \
`gebouwen` are wanted.
:rtype: A :class:`list` of :class:`Gebouw`
'''
try:
id = huisnu... | [
"def",
"list_gebouwen_by_huisnummer",
"(",
"self",
",",
"huisnummer",
")",
":",
"try",
":",
"id",
"=",
"huisnummer",
".",
"id",
"except",
"AttributeError",
":",
"id",
"=",
"huisnummer",
"def",
"creator",
"(",
")",
":",
"res",
"=",
"crab_gateway_request",
"("... | List all `gebouwen` for a :class:`Huisnummer`.
:param huisnummer: The :class:`Huisnummer` for which the \
`gebouwen` are wanted.
:rtype: A :class:`list` of :class:`Gebouw` | [
"List",
"all",
"gebouwen",
"for",
"a",
":",
"class",
":",
"Huisnummer",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L1175-L1209 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | CrabGateway.get_gebouw_by_id | def get_gebouw_by_id(self, id):
'''
Retrieve a `Gebouw` by the Id.
:param integer id: the Id of the `Gebouw`
:rtype: :class:`Gebouw`
'''
def creator():
res = crab_gateway_request(
self.client, 'GetGebouwByIdentificatorGebouw', id
)... | python | def get_gebouw_by_id(self, id):
'''
Retrieve a `Gebouw` by the Id.
:param integer id: the Id of the `Gebouw`
:rtype: :class:`Gebouw`
'''
def creator():
res = crab_gateway_request(
self.client, 'GetGebouwByIdentificatorGebouw', id
)... | [
"def",
"get_gebouw_by_id",
"(",
"self",
",",
"id",
")",
":",
"def",
"creator",
"(",
")",
":",
"res",
"=",
"crab_gateway_request",
"(",
"self",
".",
"client",
",",
"'GetGebouwByIdentificatorGebouw'",
",",
"id",
")",
"if",
"res",
"==",
"None",
":",
"raise",
... | Retrieve a `Gebouw` by the Id.
:param integer id: the Id of the `Gebouw`
:rtype: :class:`Gebouw` | [
"Retrieve",
"a",
"Gebouw",
"by",
"the",
"Id",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L1211-L1243 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | CrabGateway.list_subadressen_by_huisnummer | def list_subadressen_by_huisnummer(self, huisnummer):
'''
List all `subadressen` for a :class:`Huisnummer`.
:param huisnummer: The :class:`Huisnummer` for which the \
`subadressen` are wanted. OR A huisnummer id.
:rtype: A :class:`list` of :class:`Gebouw`
'''
... | python | def list_subadressen_by_huisnummer(self, huisnummer):
'''
List all `subadressen` for a :class:`Huisnummer`.
:param huisnummer: The :class:`Huisnummer` for which the \
`subadressen` are wanted. OR A huisnummer id.
:rtype: A :class:`list` of :class:`Gebouw`
'''
... | [
"def",
"list_subadressen_by_huisnummer",
"(",
"self",
",",
"huisnummer",
")",
":",
"try",
":",
"id",
"=",
"huisnummer",
".",
"id",
"except",
"AttributeError",
":",
"id",
"=",
"huisnummer",
"def",
"creator",
"(",
")",
":",
"res",
"=",
"crab_gateway_request",
... | List all `subadressen` for a :class:`Huisnummer`.
:param huisnummer: The :class:`Huisnummer` for which the \
`subadressen` are wanted. OR A huisnummer id.
:rtype: A :class:`list` of :class:`Gebouw` | [
"List",
"all",
"subadressen",
"for",
"a",
":",
"class",
":",
"Huisnummer",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L1257-L1289 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | CrabGateway.get_subadres_by_id | def get_subadres_by_id(self, id):
'''
Retrieve a `Subadres` by the Id.
:param integer id: the Id of the `Subadres`
:rtype: :class:`Subadres`
'''
def creator():
res = crab_gateway_request(
self.client, 'GetSubadresWithStatusBySubadresId', id
... | python | def get_subadres_by_id(self, id):
'''
Retrieve a `Subadres` by the Id.
:param integer id: the Id of the `Subadres`
:rtype: :class:`Subadres`
'''
def creator():
res = crab_gateway_request(
self.client, 'GetSubadresWithStatusBySubadresId', id
... | [
"def",
"get_subadres_by_id",
"(",
"self",
",",
"id",
")",
":",
"def",
"creator",
"(",
")",
":",
"res",
"=",
"crab_gateway_request",
"(",
"self",
".",
"client",
",",
"'GetSubadresWithStatusBySubadresId'",
",",
"id",
")",
"if",
"res",
"==",
"None",
":",
"rai... | Retrieve a `Subadres` by the Id.
:param integer id: the Id of the `Subadres`
:rtype: :class:`Subadres` | [
"Retrieve",
"a",
"Subadres",
"by",
"the",
"Id",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L1291-L1323 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | CrabGateway.list_adresposities_by_nummer_and_straat | def list_adresposities_by_nummer_and_straat(self, nummer, straat):
'''
List all `adresposities` for a huisnummer and a :class:`Straat`.
:param nummer: A string representing a certain huisnummer.
:param straat: The :class:`Straat` for which the \
`adresposities` are wanted. O... | python | def list_adresposities_by_nummer_and_straat(self, nummer, straat):
'''
List all `adresposities` for a huisnummer and a :class:`Straat`.
:param nummer: A string representing a certain huisnummer.
:param straat: The :class:`Straat` for which the \
`adresposities` are wanted. O... | [
"def",
"list_adresposities_by_nummer_and_straat",
"(",
"self",
",",
"nummer",
",",
"straat",
")",
":",
"try",
":",
"sid",
"=",
"straat",
".",
"id",
"except",
"AttributeError",
":",
"sid",
"=",
"straat",
"def",
"creator",
"(",
")",
":",
"res",
"=",
"crab_ga... | List all `adresposities` for a huisnummer and a :class:`Straat`.
:param nummer: A string representing a certain huisnummer.
:param straat: The :class:`Straat` for which the \
`adresposities` are wanted. OR A straat id.
:rtype: A :class:`list` of :class:`Adrespositie` | [
"List",
"all",
"adresposities",
"for",
"a",
"huisnummer",
"and",
"a",
":",
"class",
":",
"Straat",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L1357-L1388 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | CrabGateway.list_adresposities_by_subadres_and_huisnummer | def list_adresposities_by_subadres_and_huisnummer(self, subadres, huisnummer):
'''
List all `adresposities` for a subadres and a :class:`Huisnummer`.
:param subadres: A string representing a certain subadres.
:param huisnummer: The :class:`Huisnummer` for which the \
`adresp... | python | def list_adresposities_by_subadres_and_huisnummer(self, subadres, huisnummer):
'''
List all `adresposities` for a subadres and a :class:`Huisnummer`.
:param subadres: A string representing a certain subadres.
:param huisnummer: The :class:`Huisnummer` for which the \
`adresp... | [
"def",
"list_adresposities_by_subadres_and_huisnummer",
"(",
"self",
",",
"subadres",
",",
"huisnummer",
")",
":",
"try",
":",
"hid",
"=",
"huisnummer",
".",
"id",
"except",
"AttributeError",
":",
"hid",
"=",
"huisnummer",
"def",
"creator",
"(",
")",
":",
"res... | List all `adresposities` for a subadres and a :class:`Huisnummer`.
:param subadres: A string representing a certain subadres.
:param huisnummer: The :class:`Huisnummer` for which the \
`adresposities` are wanted. OR A huisnummer id.
:rtype: A :class:`list` of :class:`Adrespositie` | [
"List",
"all",
"adresposities",
"for",
"a",
"subadres",
"and",
"a",
":",
"class",
":",
"Huisnummer",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L1422-L1453 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | CrabGateway.get_adrespositie_by_id | def get_adrespositie_by_id(self, id):
'''
Retrieve a `Adrespositie` by the Id.
:param integer id: the Id of the `Adrespositie`
:rtype: :class:`Adrespositie`
'''
def creator():
res = crab_gateway_request(
self.client, 'GetAdrespositieByAdrespos... | python | def get_adrespositie_by_id(self, id):
'''
Retrieve a `Adrespositie` by the Id.
:param integer id: the Id of the `Adrespositie`
:rtype: :class:`Adrespositie`
'''
def creator():
res = crab_gateway_request(
self.client, 'GetAdrespositieByAdrespos... | [
"def",
"get_adrespositie_by_id",
"(",
"self",
",",
"id",
")",
":",
"def",
"creator",
"(",
")",
":",
"res",
"=",
"crab_gateway_request",
"(",
"self",
".",
"client",
",",
"'GetAdrespositieByAdrespositieId'",
",",
"id",
")",
"if",
"res",
"==",
"None",
":",
"r... | Retrieve a `Adrespositie` by the Id.
:param integer id: the Id of the `Adrespositie`
:rtype: :class:`Adrespositie` | [
"Retrieve",
"a",
"Adrespositie",
"by",
"the",
"Id",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L1455-L1486 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | CrabGateway.get_postadres_by_huisnummer | def get_postadres_by_huisnummer(self, huisnummer):
'''
Get the `postadres` for a :class:`Huisnummer`.
:param huisnummer: The :class:`Huisnummer` for which the \
`postadres` is wanted. OR A huisnummer id.
:rtype: A :class:`str`.
'''
try:
id = huisn... | python | def get_postadres_by_huisnummer(self, huisnummer):
'''
Get the `postadres` for a :class:`Huisnummer`.
:param huisnummer: The :class:`Huisnummer` for which the \
`postadres` is wanted. OR A huisnummer id.
:rtype: A :class:`str`.
'''
try:
id = huisn... | [
"def",
"get_postadres_by_huisnummer",
"(",
"self",
",",
"huisnummer",
")",
":",
"try",
":",
"id",
"=",
"huisnummer",
".",
"id",
"except",
"AttributeError",
":",
"id",
"=",
"huisnummer",
"def",
"creator",
"(",
")",
":",
"res",
"=",
"crab_gateway_request",
"("... | Get the `postadres` for a :class:`Huisnummer`.
:param huisnummer: The :class:`Huisnummer` for which the \
`postadres` is wanted. OR A huisnummer id.
:rtype: A :class:`str`. | [
"Get",
"the",
"postadres",
"for",
"a",
":",
"class",
":",
"Huisnummer",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L1488-L1512 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | CrabGateway.get_postadres_by_subadres | def get_postadres_by_subadres(self, subadres):
'''
Get the `postadres` for a :class:`Subadres`.
:param subadres: The :class:`Subadres` for which the \
`postadres` is wanted. OR A subadres id.
:rtype: A :class:`str`.
'''
try:
id = subadres.id
... | python | def get_postadres_by_subadres(self, subadres):
'''
Get the `postadres` for a :class:`Subadres`.
:param subadres: The :class:`Subadres` for which the \
`postadres` is wanted. OR A subadres id.
:rtype: A :class:`str`.
'''
try:
id = subadres.id
... | [
"def",
"get_postadres_by_subadres",
"(",
"self",
",",
"subadres",
")",
":",
"try",
":",
"id",
"=",
"subadres",
".",
"id",
"except",
"AttributeError",
":",
"id",
"=",
"subadres",
"def",
"creator",
"(",
")",
":",
"res",
"=",
"crab_gateway_request",
"(",
"sel... | Get the `postadres` for a :class:`Subadres`.
:param subadres: The :class:`Subadres` for which the \
`postadres` is wanted. OR A subadres id.
:rtype: A :class:`str`. | [
"Get",
"the",
"postadres",
"for",
"a",
":",
"class",
":",
"Subadres",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L1514-L1538 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | Provincie.set_gateway | def set_gateway(self, gateway):
'''
:param crabpy.gateway.crab.CrabGateway gateway: Gateway to use.
'''
self.gateway = gateway
self.gewest.gateway = gateway | python | def set_gateway(self, gateway):
'''
:param crabpy.gateway.crab.CrabGateway gateway: Gateway to use.
'''
self.gateway = gateway
self.gewest.gateway = gateway | [
"def",
"set_gateway",
"(",
"self",
",",
"gateway",
")",
":",
"self",
".",
"gateway",
"=",
"gateway",
"self",
".",
"gewest",
".",
"gateway",
"=",
"gateway"
] | :param crabpy.gateway.crab.CrabGateway gateway: Gateway to use. | [
":",
"param",
"crabpy",
".",
"gateway",
".",
"crab",
".",
"CrabGateway",
"gateway",
":",
"Gateway",
"to",
"use",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L1669-L1674 |
OnroerendErfgoed/crabpy | crabpy/gateway/crab.py | Perceel.postadressen | def postadressen(self):
'''
Returns the postadressen for this Perceel.
Will only take the huisnummers with status `inGebruik` into account.
:rtype: list
'''
return [h.postadres for h in self.huisnummers if h.status.id == '3'] | python | def postadressen(self):
'''
Returns the postadressen for this Perceel.
Will only take the huisnummers with status `inGebruik` into account.
:rtype: list
'''
return [h.postadres for h in self.huisnummers if h.status.id == '3'] | [
"def",
"postadressen",
"(",
"self",
")",
":",
"return",
"[",
"h",
".",
"postadres",
"for",
"h",
"in",
"self",
".",
"huisnummers",
"if",
"h",
".",
"status",
".",
"id",
"==",
"'3'",
"]"
] | Returns the postadressen for this Perceel.
Will only take the huisnummers with status `inGebruik` into account.
:rtype: list | [
"Returns",
"the",
"postadressen",
"for",
"this",
"Perceel",
"."
] | train | https://github.com/OnroerendErfgoed/crabpy/blob/3a6fd8bc5aca37c2a173e3ea94e4e468b8aa79c1/crabpy/gateway/crab.py#L2495-L2503 |
danielfrg/datasciencebox | datasciencebox/core/salt.py | generate_salt_cmd | def generate_salt_cmd(target, module, args=None, kwargs=None):
"""
Generates a command (the arguments) for the `salt` or `salt-ssh` CLI
"""
args = args or []
kwargs = kwargs or {}
target = target or '*'
target = '"%s"' % target
cmd = [target, module]
for arg in args:
cmd.appe... | python | def generate_salt_cmd(target, module, args=None, kwargs=None):
"""
Generates a command (the arguments) for the `salt` or `salt-ssh` CLI
"""
args = args or []
kwargs = kwargs or {}
target = target or '*'
target = '"%s"' % target
cmd = [target, module]
for arg in args:
cmd.appe... | [
"def",
"generate_salt_cmd",
"(",
"target",
",",
"module",
",",
"args",
"=",
"None",
",",
"kwargs",
"=",
"None",
")",
":",
"args",
"=",
"args",
"or",
"[",
"]",
"kwargs",
"=",
"kwargs",
"or",
"{",
"}",
"target",
"=",
"target",
"or",
"'*'",
"target",
... | Generates a command (the arguments) for the `salt` or `salt-ssh` CLI | [
"Generates",
"a",
"command",
"(",
"the",
"arguments",
")",
"for",
"the",
"salt",
"or",
"salt",
"-",
"ssh",
"CLI"
] | train | https://github.com/danielfrg/datasciencebox/blob/6b7aa642c6616a46547035fcb815acc1de605a6f/datasciencebox/core/salt.py#L54-L67 |
danielfrg/datasciencebox | datasciencebox/core/salt.py | salt_ssh | def salt_ssh(project, target, module, args=None, kwargs=None):
"""
Execute a `salt-ssh` command
"""
cmd = ['salt-ssh']
cmd.extend(generate_salt_cmd(target, module, args, kwargs))
cmd.append('--state-output=mixed')
cmd.append('--roster-file=%s' % project.roster_path)
cmd.append('--config-... | python | def salt_ssh(project, target, module, args=None, kwargs=None):
"""
Execute a `salt-ssh` command
"""
cmd = ['salt-ssh']
cmd.extend(generate_salt_cmd(target, module, args, kwargs))
cmd.append('--state-output=mixed')
cmd.append('--roster-file=%s' % project.roster_path)
cmd.append('--config-... | [
"def",
"salt_ssh",
"(",
"project",
",",
"target",
",",
"module",
",",
"args",
"=",
"None",
",",
"kwargs",
"=",
"None",
")",
":",
"cmd",
"=",
"[",
"'salt-ssh'",
"]",
"cmd",
".",
"extend",
"(",
"generate_salt_cmd",
"(",
"target",
",",
"module",
",",
"a... | Execute a `salt-ssh` command | [
"Execute",
"a",
"salt",
"-",
"ssh",
"command"
] | train | https://github.com/danielfrg/datasciencebox/blob/6b7aa642c6616a46547035fcb815acc1de605a6f/datasciencebox/core/salt.py#L103-L121 |
danielfrg/datasciencebox | datasciencebox/core/salt.py | salt_master | def salt_master(project, target, module, args=None, kwargs=None):
"""
Execute a `salt` command in the head node
"""
client = project.cluster.head.ssh_client
cmd = ['salt']
cmd.extend(generate_salt_cmd(target, module, args, kwargs))
cmd.append('--timeout=300')
cmd.append('--state-output=... | python | def salt_master(project, target, module, args=None, kwargs=None):
"""
Execute a `salt` command in the head node
"""
client = project.cluster.head.ssh_client
cmd = ['salt']
cmd.extend(generate_salt_cmd(target, module, args, kwargs))
cmd.append('--timeout=300')
cmd.append('--state-output=... | [
"def",
"salt_master",
"(",
"project",
",",
"target",
",",
"module",
",",
"args",
"=",
"None",
",",
"kwargs",
"=",
"None",
")",
":",
"client",
"=",
"project",
".",
"cluster",
".",
"head",
".",
"ssh_client",
"cmd",
"=",
"[",
"'salt'",
"]",
"cmd",
".",
... | Execute a `salt` command in the head node | [
"Execute",
"a",
"salt",
"command",
"in",
"the",
"head",
"node"
] | train | https://github.com/danielfrg/datasciencebox/blob/6b7aa642c6616a46547035fcb815acc1de605a6f/datasciencebox/core/salt.py#L124-L140 |
Va1/smart-getenv | smart_getenv.py | getenv | def getenv(name, **kwargs):
"""
Retrieves environment variable by name and casts the value to desired type.
If desired type is list or tuple - uses separator to split the value.
"""
default_value = kwargs.pop('default', None)
desired_type = kwargs.pop('type', str)
list_separator = kwargs.pop... | python | def getenv(name, **kwargs):
"""
Retrieves environment variable by name and casts the value to desired type.
If desired type is list or tuple - uses separator to split the value.
"""
default_value = kwargs.pop('default', None)
desired_type = kwargs.pop('type', str)
list_separator = kwargs.pop... | [
"def",
"getenv",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"default_value",
"=",
"kwargs",
".",
"pop",
"(",
"'default'",
",",
"None",
")",
"desired_type",
"=",
"kwargs",
".",
"pop",
"(",
"'type'",
",",
"str",
")",
"list_separator",
"=",
"kwargs",... | Retrieves environment variable by name and casts the value to desired type.
If desired type is list or tuple - uses separator to split the value. | [
"Retrieves",
"environment",
"variable",
"by",
"name",
"and",
"casts",
"the",
"value",
"to",
"desired",
"type",
".",
"If",
"desired",
"type",
"is",
"list",
"or",
"tuple",
"-",
"uses",
"separator",
"to",
"split",
"the",
"value",
"."
] | train | https://github.com/Va1/smart-getenv/blob/180c3552505f113d5384dc97243ff9d52c472f3d/smart_getenv.py#L8-L38 |
plotly/octogrid | octogrid/generator/generator.py | generate_network | def generate_network(user=None, reset=False):
"""
Assemble the network connections for a given user
"""
token = collect_token()
try:
gh = login(token=token)
root_user = gh.user(user)
except Exception, e:
# Failed to login using the token, github3.models.GitHubError
... | python | def generate_network(user=None, reset=False):
"""
Assemble the network connections for a given user
"""
token = collect_token()
try:
gh = login(token=token)
root_user = gh.user(user)
except Exception, e:
# Failed to login using the token, github3.models.GitHubError
... | [
"def",
"generate_network",
"(",
"user",
"=",
"None",
",",
"reset",
"=",
"False",
")",
":",
"token",
"=",
"collect_token",
"(",
")",
"try",
":",
"gh",
"=",
"login",
"(",
"token",
"=",
"token",
")",
"root_user",
"=",
"gh",
".",
"user",
"(",
"user",
"... | Assemble the network connections for a given user | [
"Assemble",
"the",
"network",
"connections",
"for",
"a",
"given",
"user"
] | train | https://github.com/plotly/octogrid/blob/46237a72c79765fe5a48af7065049c692e6457a7/octogrid/generator/generator.py#L29-L69 |
rodynnz/xccdf | src/xccdf/models/element.py | Element.import_element | def import_element(self, xml_element):
"""
Imports the element from an lxml element and loads its content.
:param lxml.etree._Element xml_element: XML element to import.
"""
self.xml_element = xml_element
uri, tag = Element.get_namespace_and_tag(self.xml_element.tag)
... | python | def import_element(self, xml_element):
"""
Imports the element from an lxml element and loads its content.
:param lxml.etree._Element xml_element: XML element to import.
"""
self.xml_element = xml_element
uri, tag = Element.get_namespace_and_tag(self.xml_element.tag)
... | [
"def",
"import_element",
"(",
"self",
",",
"xml_element",
")",
":",
"self",
".",
"xml_element",
"=",
"xml_element",
"uri",
",",
"tag",
"=",
"Element",
".",
"get_namespace_and_tag",
"(",
"self",
".",
"xml_element",
".",
"tag",
")",
"self",
".",
"namespace",
... | Imports the element from an lxml element and loads its content.
:param lxml.etree._Element xml_element: XML element to import. | [
"Imports",
"the",
"element",
"from",
"an",
"lxml",
"element",
"and",
"loads",
"its",
"content",
"."
] | train | https://github.com/rodynnz/xccdf/blob/1b9dc2f06b5cce8db2a54c5f95a8f6bcf5cb6981/src/xccdf/models/element.py#L51-L69 |
rodynnz/xccdf | src/xccdf/models/element.py | Element.as_dict | def as_dict(self):
"""
Serializes the object necessary data in a dictionary.
:returns: Serialized data in a dictionary.
:rtype: dict
"""
element_dict = dict()
if hasattr(self, 'namespace'):
element_dict['namespace'] = self.namespace
if hasatt... | python | def as_dict(self):
"""
Serializes the object necessary data in a dictionary.
:returns: Serialized data in a dictionary.
:rtype: dict
"""
element_dict = dict()
if hasattr(self, 'namespace'):
element_dict['namespace'] = self.namespace
if hasatt... | [
"def",
"as_dict",
"(",
"self",
")",
":",
"element_dict",
"=",
"dict",
"(",
")",
"if",
"hasattr",
"(",
"self",
",",
"'namespace'",
")",
":",
"element_dict",
"[",
"'namespace'",
"]",
"=",
"self",
".",
"namespace",
"if",
"hasattr",
"(",
"self",
",",
"'nam... | Serializes the object necessary data in a dictionary.
:returns: Serialized data in a dictionary.
:rtype: dict | [
"Serializes",
"the",
"object",
"necessary",
"data",
"in",
"a",
"dictionary",
"."
] | train | https://github.com/rodynnz/xccdf/blob/1b9dc2f06b5cce8db2a54c5f95a8f6bcf5cb6981/src/xccdf/models/element.py#L71-L93 |
rodynnz/xccdf | src/xccdf/models/element.py | Element.load_xml_attrs | def load_xml_attrs(self):
"""
Load XML attributes as object attributes.
:returns: List of parsed attributes.
:rtype: list
"""
attrs_list = list()
if hasattr(self, 'xml_element'):
xml_attrs = self.xml_element.attrib
for variable, value i... | python | def load_xml_attrs(self):
"""
Load XML attributes as object attributes.
:returns: List of parsed attributes.
:rtype: list
"""
attrs_list = list()
if hasattr(self, 'xml_element'):
xml_attrs = self.xml_element.attrib
for variable, value i... | [
"def",
"load_xml_attrs",
"(",
"self",
")",
":",
"attrs_list",
"=",
"list",
"(",
")",
"if",
"hasattr",
"(",
"self",
",",
"'xml_element'",
")",
":",
"xml_attrs",
"=",
"self",
".",
"xml_element",
".",
"attrib",
"for",
"variable",
",",
"value",
"in",
"iter",... | Load XML attributes as object attributes.
:returns: List of parsed attributes.
:rtype: list | [
"Load",
"XML",
"attributes",
"as",
"object",
"attributes",
"."
] | train | https://github.com/rodynnz/xccdf/blob/1b9dc2f06b5cce8db2a54c5f95a8f6bcf5cb6981/src/xccdf/models/element.py#L95-L116 |
rodynnz/xccdf | src/xccdf/models/element.py | Element.get_namespace_and_tag | def get_namespace_and_tag(name):
"""
Separates the namespace and tag from an element.
:param str name: Tag.
:returns: Namespace URI and Tag namespace.
:rtype: tuple
"""
if isinstance(name, str):
if name[0] == "{":
uri, ignore, tag = n... | python | def get_namespace_and_tag(name):
"""
Separates the namespace and tag from an element.
:param str name: Tag.
:returns: Namespace URI and Tag namespace.
:rtype: tuple
"""
if isinstance(name, str):
if name[0] == "{":
uri, ignore, tag = n... | [
"def",
"get_namespace_and_tag",
"(",
"name",
")",
":",
"if",
"isinstance",
"(",
"name",
",",
"str",
")",
":",
"if",
"name",
"[",
"0",
"]",
"==",
"\"{\"",
":",
"uri",
",",
"ignore",
",",
"tag",
"=",
"name",
"[",
"1",
":",
"]",
".",
"partition",
"(... | Separates the namespace and tag from an element.
:param str name: Tag.
:returns: Namespace URI and Tag namespace.
:rtype: tuple | [
"Separates",
"the",
"namespace",
"and",
"tag",
"from",
"an",
"element",
"."
] | train | https://github.com/rodynnz/xccdf/blob/1b9dc2f06b5cce8db2a54c5f95a8f6bcf5cb6981/src/xccdf/models/element.py#L119-L137 |
ereOn/azmq | azmq/mechanisms/base.py | Mechanism.write_command | def write_command(cls, writer, name, buffers=()):
"""
Write a command to the specified writer.
:param writer: The writer to use.
:param name: The command name.
:param buffers: The buffers to writer.
"""
assert len(name) < 256
body_len = len(name) + 1 + s... | python | def write_command(cls, writer, name, buffers=()):
"""
Write a command to the specified writer.
:param writer: The writer to use.
:param name: The command name.
:param buffers: The buffers to writer.
"""
assert len(name) < 256
body_len = len(name) + 1 + s... | [
"def",
"write_command",
"(",
"cls",
",",
"writer",
",",
"name",
",",
"buffers",
"=",
"(",
")",
")",
":",
"assert",
"len",
"(",
"name",
")",
"<",
"256",
"body_len",
"=",
"len",
"(",
"name",
")",
"+",
"1",
"+",
"sum",
"(",
"len",
"(",
"buffer",
"... | Write a command to the specified writer.
:param writer: The writer to use.
:param name: The command name.
:param buffers: The buffers to writer. | [
"Write",
"a",
"command",
"to",
"the",
"specified",
"writer",
"."
] | train | https://github.com/ereOn/azmq/blob/9f40d6d721eea7f7659ec6cc668811976db59854/azmq/mechanisms/base.py#L34-L54 |
ereOn/azmq | azmq/mechanisms/base.py | Mechanism._expect_command | async def _expect_command(cls, reader, name):
"""
Expect a command.
:param reader: The reader to use.
:returns: The command data.
"""
size_type = struct.unpack('B', await reader.readexactly(1))[0]
if size_type == 0x04:
size = struct.unpack('!B', awai... | python | async def _expect_command(cls, reader, name):
"""
Expect a command.
:param reader: The reader to use.
:returns: The command data.
"""
size_type = struct.unpack('B', await reader.readexactly(1))[0]
if size_type == 0x04:
size = struct.unpack('!B', awai... | [
"async",
"def",
"_expect_command",
"(",
"cls",
",",
"reader",
",",
"name",
")",
":",
"size_type",
"=",
"struct",
".",
"unpack",
"(",
"'B'",
",",
"await",
"reader",
".",
"readexactly",
"(",
"1",
")",
")",
"[",
"0",
"]",
"if",
"size_type",
"==",
"0x04"... | Expect a command.
:param reader: The reader to use.
:returns: The command data. | [
"Expect",
"a",
"command",
"."
] | train | https://github.com/ereOn/azmq/blob/9f40d6d721eea7f7659ec6cc668811976db59854/azmq/mechanisms/base.py#L57-L95 |
astroswego/plotypus | src/plotypus/preprocessing.py | Fourier.fit | def fit(self, X, y=None):
"""
Sets *self.degree* according to :func:`baart_criteria` if *degree_range*
is not None, otherwise does nothing.
**Parameters**
X : array-like, shape = [n_samples, 1]
Column vector of phases.
y : array-like or None, shape = [n_samp... | python | def fit(self, X, y=None):
"""
Sets *self.degree* according to :func:`baart_criteria` if *degree_range*
is not None, otherwise does nothing.
**Parameters**
X : array-like, shape = [n_samples, 1]
Column vector of phases.
y : array-like or None, shape = [n_samp... | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
")",
":",
"if",
"self",
".",
"degree_range",
"is",
"not",
"None",
":",
"self",
".",
"degree",
"=",
"self",
".",
"baart_criteria",
"(",
"X",
",",
"y",
")",
"return",
"self"
] | Sets *self.degree* according to :func:`baart_criteria` if *degree_range*
is not None, otherwise does nothing.
**Parameters**
X : array-like, shape = [n_samples, 1]
Column vector of phases.
y : array-like or None, shape = [n_samples], optional
Row vector of magni... | [
"Sets",
"*",
"self",
".",
"degree",
"*",
"according",
"to",
":",
"func",
":",
"baart_criteria",
"if",
"*",
"degree_range",
"*",
"is",
"not",
"None",
"otherwise",
"does",
"nothing",
"."
] | train | https://github.com/astroswego/plotypus/blob/b1162194ca1d4f6c00e79afe3e6fb40f0eaffcb9/src/plotypus/preprocessing.py#L76-L94 |
astroswego/plotypus | src/plotypus/preprocessing.py | Fourier.transform | def transform(self, X, y=None, **params):
"""
Transforms *X* from phase-space to Fourier-space, returning the design
matrix produced by :func:`Fourier.design_matrix` for input to a
regressor.
**Parameters**
X : array-like, shape = [n_samples, 1]
Column vecto... | python | def transform(self, X, y=None, **params):
"""
Transforms *X* from phase-space to Fourier-space, returning the design
matrix produced by :func:`Fourier.design_matrix` for input to a
regressor.
**Parameters**
X : array-like, shape = [n_samples, 1]
Column vecto... | [
"def",
"transform",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
",",
"*",
"*",
"params",
")",
":",
"data",
"=",
"numpy",
".",
"dstack",
"(",
"(",
"numpy",
".",
"array",
"(",
"X",
")",
".",
"T",
"[",
"0",
"]",
",",
"range",
"(",
"len",
"("... | Transforms *X* from phase-space to Fourier-space, returning the design
matrix produced by :func:`Fourier.design_matrix` for input to a
regressor.
**Parameters**
X : array-like, shape = [n_samples, 1]
Column vector of phases.
y : None, optional
Unused arg... | [
"Transforms",
"*",
"X",
"*",
"from",
"phase",
"-",
"space",
"to",
"Fourier",
"-",
"space",
"returning",
"the",
"design",
"matrix",
"produced",
"by",
":",
"func",
":",
"Fourier",
".",
"design_matrix",
"for",
"input",
"to",
"a",
"regressor",
"."
] | train | https://github.com/astroswego/plotypus/blob/b1162194ca1d4f6c00e79afe3e6fb40f0eaffcb9/src/plotypus/preprocessing.py#L96-L117 |
astroswego/plotypus | src/plotypus/preprocessing.py | Fourier.baart_criteria | def baart_criteria(self, X, y):
"""
Returns the optimal Fourier series degree as determined by
`Baart's Criteria <http://articles.adsabs.harvard.edu/cgi-bin/nph-iarticle_query?1986A%26A...170...59P&data_type=PDF_HIGH&whole_paper=YES&type=PRINTER&filetype=.pdf>`_ [JOP]_.
... | python | def baart_criteria(self, X, y):
"""
Returns the optimal Fourier series degree as determined by
`Baart's Criteria <http://articles.adsabs.harvard.edu/cgi-bin/nph-iarticle_query?1986A%26A...170...59P&data_type=PDF_HIGH&whole_paper=YES&type=PRINTER&filetype=.pdf>`_ [JOP]_.
... | [
"def",
"baart_criteria",
"(",
"self",
",",
"X",
",",
"y",
")",
":",
"try",
":",
"min_degree",
",",
"max_degree",
"=",
"self",
".",
"degree_range",
"except",
"ValueError",
":",
"raise",
"ValueError",
"(",
"\"Degree range must be a length two sequence\"",
")",
"cu... | Returns the optimal Fourier series degree as determined by
`Baart's Criteria <http://articles.adsabs.harvard.edu/cgi-bin/nph-iarticle_query?1986A%26A...170...59P&data_type=PDF_HIGH&whole_paper=YES&type=PRINTER&filetype=.pdf>`_ [JOP]_.
**Citations**
.. [JOP] J. O. Petersen, 1986... | [
"Returns",
"the",
"optimal",
"Fourier",
"series",
"degree",
"as",
"determined",
"by",
"Baart",
"s",
"Criteria",
"<http",
":",
"//",
"articles",
".",
"adsabs",
".",
"harvard",
".",
"edu",
"/",
"cgi",
"-",
"bin",
"/",
"nph",
"-",
"iarticle_query?1986A%26A",
... | train | https://github.com/astroswego/plotypus/blob/b1162194ca1d4f6c00e79afe3e6fb40f0eaffcb9/src/plotypus/preprocessing.py#L148-L179 |
astroswego/plotypus | src/plotypus/preprocessing.py | Fourier.design_matrix | def design_matrix(phases, degree):
r"""
Constructs an :math:`N \times 2n+1` matrix of the form:
.. math::
\begin{bmatrix}
1
& \sin(1 \cdot 2\pi \cdot \phi_0)
& \cos(1 \cdot 2\pi \cdot \phi_0)
& \ldots
& \sin(n \cdot 2\pi... | python | def design_matrix(phases, degree):
r"""
Constructs an :math:`N \times 2n+1` matrix of the form:
.. math::
\begin{bmatrix}
1
& \sin(1 \cdot 2\pi \cdot \phi_0)
& \cos(1 \cdot 2\pi \cdot \phi_0)
& \ldots
& \sin(n \cdot 2\pi... | [
"def",
"design_matrix",
"(",
"phases",
",",
"degree",
")",
":",
"n_samples",
"=",
"phases",
".",
"size",
"# initialize coefficient matrix",
"M",
"=",
"numpy",
".",
"empty",
"(",
"(",
"n_samples",
",",
"2",
"*",
"degree",
"+",
"1",
")",
")",
"# indices",
... | r"""
Constructs an :math:`N \times 2n+1` matrix of the form:
.. math::
\begin{bmatrix}
1
& \sin(1 \cdot 2\pi \cdot \phi_0)
& \cos(1 \cdot 2\pi \cdot \phi_0)
& \ldots
& \sin(n \cdot 2\pi \cdot \phi_0)
& \cos(n \cdot 2... | [
"r",
"Constructs",
"an",
":",
"math",
":",
"N",
"\\",
"times",
"2n",
"+",
"1",
"matrix",
"of",
"the",
"form",
":"
] | train | https://github.com/astroswego/plotypus/blob/b1162194ca1d4f6c00e79afe3e6fb40f0eaffcb9/src/plotypus/preprocessing.py#L204-L260 |
astroswego/plotypus | src/plotypus/preprocessing.py | Fourier.phase_shifted_coefficients | def phase_shifted_coefficients(amplitude_coefficients, form='cos',
shift=0.0):
r"""
Converts Fourier coefficients from the amplitude form to the
phase-shifted form, as either a sine or cosine series.
Amplitude form:
.. math::
m(t) ... | python | def phase_shifted_coefficients(amplitude_coefficients, form='cos',
shift=0.0):
r"""
Converts Fourier coefficients from the amplitude form to the
phase-shifted form, as either a sine or cosine series.
Amplitude form:
.. math::
m(t) ... | [
"def",
"phase_shifted_coefficients",
"(",
"amplitude_coefficients",
",",
"form",
"=",
"'cos'",
",",
"shift",
"=",
"0.0",
")",
":",
"if",
"form",
"!=",
"'sin'",
"and",
"form",
"!=",
"'cos'",
":",
"raise",
"NotImplementedError",
"(",
"'Fourier series must have form ... | r"""
Converts Fourier coefficients from the amplitude form to the
phase-shifted form, as either a sine or cosine series.
Amplitude form:
.. math::
m(t) = A_0 + \sum_{k=1}^n (a_k \sin(k \omega t)
+ b_k \cos(k \omega t))
Sine form... | [
"r",
"Converts",
"Fourier",
"coefficients",
"from",
"the",
"amplitude",
"form",
"to",
"the",
"phase",
"-",
"shifted",
"form",
"as",
"either",
"a",
"sine",
"or",
"cosine",
"series",
"."
] | train | https://github.com/astroswego/plotypus/blob/b1162194ca1d4f6c00e79afe3e6fb40f0eaffcb9/src/plotypus/preprocessing.py#L263-L347 |
astroswego/plotypus | src/plotypus/preprocessing.py | Fourier.fourier_ratios | def fourier_ratios(phase_shifted_coeffs):
r"""
Returns the :math:`R_{j1}` and :math:`\phi_{j1}` values for the given
phase-shifted coefficients.
.. math::
R_{j1} = A_j / A_1
.. math::
\phi_{j1} = \phi_j - j \phi_1
**Parameters**
phase... | python | def fourier_ratios(phase_shifted_coeffs):
r"""
Returns the :math:`R_{j1}` and :math:`\phi_{j1}` values for the given
phase-shifted coefficients.
.. math::
R_{j1} = A_j / A_1
.. math::
\phi_{j1} = \phi_j - j \phi_1
**Parameters**
phase... | [
"def",
"fourier_ratios",
"(",
"phase_shifted_coeffs",
")",
":",
"n_coeff",
"=",
"phase_shifted_coeffs",
".",
"size",
"# n_coeff = 2*degree + 1 => degree = (n_coeff-1)/2",
"degree",
"=",
"(",
"n_coeff",
"-",
"1",
")",
"/",
"2",
"amplitudes",
"=",
"phase_shifted_coeffs",
... | r"""
Returns the :math:`R_{j1}` and :math:`\phi_{j1}` values for the given
phase-shifted coefficients.
.. math::
R_{j1} = A_j / A_1
.. math::
\phi_{j1} = \phi_j - j \phi_1
**Parameters**
phase_shifted_coeffs : array-like, shape = [:math:`2n+1... | [
"r",
"Returns",
"the",
":",
"math",
":",
"R_",
"{",
"j1",
"}",
"and",
":",
"math",
":",
"\\",
"phi_",
"{",
"j1",
"}",
"values",
"for",
"the",
"given",
"phase",
"-",
"shifted",
"coefficients",
"."
] | train | https://github.com/astroswego/plotypus/blob/b1162194ca1d4f6c00e79afe3e6fb40f0eaffcb9/src/plotypus/preprocessing.py#L350-L402 |
ton/stash | stash/repository.py | Repository._execute | def _execute(self, command, stdin=None, stdout=subprocess.PIPE):
"""Executes the specified command relative to the repository root.
Returns a tuple containing the return code and the process output.
"""
process = subprocess.Popen(command, shell=True, cwd=self.root_path, stdin=stdin, stdo... | python | def _execute(self, command, stdin=None, stdout=subprocess.PIPE):
"""Executes the specified command relative to the repository root.
Returns a tuple containing the return code and the process output.
"""
process = subprocess.Popen(command, shell=True, cwd=self.root_path, stdin=stdin, stdo... | [
"def",
"_execute",
"(",
"self",
",",
"command",
",",
"stdin",
"=",
"None",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
")",
":",
"process",
"=",
"subprocess",
".",
"Popen",
"(",
"command",
",",
"shell",
"=",
"True",
",",
"cwd",
"=",
"self",
".",
... | Executes the specified command relative to the repository root.
Returns a tuple containing the return code and the process output. | [
"Executes",
"the",
"specified",
"command",
"relative",
"to",
"the",
"repository",
"root",
".",
"Returns",
"a",
"tuple",
"containing",
"the",
"return",
"code",
"and",
"the",
"process",
"output",
"."
] | train | https://github.com/ton/stash/blob/31cd8269aa8e051f094eccb094946eda6f6d428e/stash/repository.py#L70-L75 |
ton/stash | stash/repository.py | Repository.apply_patch | def apply_patch(self, patch_path):
"""Applies the patch located at *patch_path*. Returns the return code of
the patch command.
"""
# Do not create .orig backup files, and merge files in place.
return self._execute('patch -p1 --no-backup-if-mismatch --merge', stdout=open(os.devnul... | python | def apply_patch(self, patch_path):
"""Applies the patch located at *patch_path*. Returns the return code of
the patch command.
"""
# Do not create .orig backup files, and merge files in place.
return self._execute('patch -p1 --no-backup-if-mismatch --merge', stdout=open(os.devnul... | [
"def",
"apply_patch",
"(",
"self",
",",
"patch_path",
")",
":",
"# Do not create .orig backup files, and merge files in place.",
"return",
"self",
".",
"_execute",
"(",
"'patch -p1 --no-backup-if-mismatch --merge'",
",",
"stdout",
"=",
"open",
"(",
"os",
".",
"devnull",
... | Applies the patch located at *patch_path*. Returns the return code of
the patch command. | [
"Applies",
"the",
"patch",
"located",
"at",
"*",
"patch_path",
"*",
".",
"Returns",
"the",
"return",
"code",
"of",
"the",
"patch",
"command",
"."
] | train | https://github.com/ton/stash/blob/31cd8269aa8e051f094eccb094946eda6f6d428e/stash/repository.py#L82-L87 |
ton/stash | stash/repository.py | SubversionRepository.get_root_path | def get_root_path(self, path):
"""See :py:meth:`~stash.repository.Repository.get_root_path`."""
# Look at the directories present in the current working directory. In
# case a .svn directory is present, we know we are in the root directory
# of a Subversion repository (for Subversion 1.7... | python | def get_root_path(self, path):
"""See :py:meth:`~stash.repository.Repository.get_root_path`."""
# Look at the directories present in the current working directory. In
# case a .svn directory is present, we know we are in the root directory
# of a Subversion repository (for Subversion 1.7... | [
"def",
"get_root_path",
"(",
"self",
",",
"path",
")",
":",
"# Look at the directories present in the current working directory. In",
"# case a .svn directory is present, we know we are in the root directory",
"# of a Subversion repository (for Subversion 1.7.x). In case no",
"# repository spe... | See :py:meth:`~stash.repository.Repository.get_root_path`. | [
"See",
":",
"py",
":",
"meth",
":",
"~stash",
".",
"repository",
".",
"Repository",
".",
"get_root_path",
"."
] | train | https://github.com/ton/stash/blob/31cd8269aa8e051f094eccb094946eda6f6d428e/stash/repository.py#L217-L231 |
ton/stash | stash/repository.py | SubversionRepository.status | def status(self):
"""See :py:meth:`~stash.repository.Repository.status`."""
result = set()
for line in self._execute('svn stat')[1].splitlines():
if line[0] == '?':
result.add((FileStatus.Added, line[2:].strip()))
elif line[0] == '!':
resul... | python | def status(self):
"""See :py:meth:`~stash.repository.Repository.status`."""
result = set()
for line in self._execute('svn stat')[1].splitlines():
if line[0] == '?':
result.add((FileStatus.Added, line[2:].strip()))
elif line[0] == '!':
resul... | [
"def",
"status",
"(",
"self",
")",
":",
"result",
"=",
"set",
"(",
")",
"for",
"line",
"in",
"self",
".",
"_execute",
"(",
"'svn stat'",
")",
"[",
"1",
"]",
".",
"splitlines",
"(",
")",
":",
"if",
"line",
"[",
"0",
"]",
"==",
"'?'",
":",
"resul... | See :py:meth:`~stash.repository.Repository.status`. | [
"See",
":",
"py",
":",
"meth",
":",
"~stash",
".",
"repository",
".",
"Repository",
".",
"status",
"."
] | train | https://github.com/ton/stash/blob/31cd8269aa8e051f094eccb094946eda6f6d428e/stash/repository.py#L233-L241 |
dhilipsiva/orm-choices | orm_choices/core.py | choices | def choices(klass):
"""
Decorator to set `CHOICES` and other attributes
"""
_choices = []
for attr in user_attributes(klass.Meta):
val = getattr(klass.Meta, attr)
setattr(klass, attr, val[0])
_choices.append((val[0], val[1]))
setattr(klass, 'CHOICES', tuple(_choices))
... | python | def choices(klass):
"""
Decorator to set `CHOICES` and other attributes
"""
_choices = []
for attr in user_attributes(klass.Meta):
val = getattr(klass.Meta, attr)
setattr(klass, attr, val[0])
_choices.append((val[0], val[1]))
setattr(klass, 'CHOICES', tuple(_choices))
... | [
"def",
"choices",
"(",
"klass",
")",
":",
"_choices",
"=",
"[",
"]",
"for",
"attr",
"in",
"user_attributes",
"(",
"klass",
".",
"Meta",
")",
":",
"val",
"=",
"getattr",
"(",
"klass",
".",
"Meta",
",",
"attr",
")",
"setattr",
"(",
"klass",
",",
"att... | Decorator to set `CHOICES` and other attributes | [
"Decorator",
"to",
"set",
"CHOICES",
"and",
"other",
"attributes"
] | train | https://github.com/dhilipsiva/orm-choices/blob/e76391722bb761fa81402dcf0668eb0b93b486b3/orm_choices/core.py#L26-L36 |
klen/makesite | makesite/modules/flask/base/core/script.py | create_db | def create_db():
" Create database. "
from ..ext import db
db.create_all()
# Evolution support
from flask import current_app
from flaskext.evolution import db as evolution_db
evolution_db.init_app(current_app)
evolution_db.create_all()
print "Database created successfuly" | python | def create_db():
" Create database. "
from ..ext import db
db.create_all()
# Evolution support
from flask import current_app
from flaskext.evolution import db as evolution_db
evolution_db.init_app(current_app)
evolution_db.create_all()
print "Database created successfuly" | [
"def",
"create_db",
"(",
")",
":",
"from",
".",
".",
"ext",
"import",
"db",
"db",
".",
"create_all",
"(",
")",
"# Evolution support",
"from",
"flask",
"import",
"current_app",
"from",
"flaskext",
".",
"evolution",
"import",
"db",
"as",
"evolution_db",
"evolu... | Create database. | [
"Create",
"database",
"."
] | train | https://github.com/klen/makesite/blob/f6f77a43a04a256189e8fffbeac1ffd63f35a10c/makesite/modules/flask/base/core/script.py#L7-L19 |
klen/makesite | makesite/modules/flask/base/core/script.py | drop_db | def drop_db():
" Drop all tables. "
from ..ext import db
if prompt_bool("Are you sure? You will lose all your data!"):
db.drop_all()
# Evolution support
from flask import current_app
from flaskext.evolution import db as evolution_db
evolution_db.init_app(current_ap... | python | def drop_db():
" Drop all tables. "
from ..ext import db
if prompt_bool("Are you sure? You will lose all your data!"):
db.drop_all()
# Evolution support
from flask import current_app
from flaskext.evolution import db as evolution_db
evolution_db.init_app(current_ap... | [
"def",
"drop_db",
"(",
")",
":",
"from",
".",
".",
"ext",
"import",
"db",
"if",
"prompt_bool",
"(",
"\"Are you sure? You will lose all your data!\"",
")",
":",
"db",
".",
"drop_all",
"(",
")",
"# Evolution support",
"from",
"flask",
"import",
"current_app",
"fro... | Drop all tables. | [
"Drop",
"all",
"tables",
"."
] | train | https://github.com/klen/makesite/blob/f6f77a43a04a256189e8fffbeac1ffd63f35a10c/makesite/modules/flask/base/core/script.py#L23-L37 |
publysher/rdflib-django | src/rdflib_django/forms.py | NamespaceForm.clean_prefix | def clean_prefix(self):
"""
Validates the prefix
"""
if self.instance.fixed:
return self.instance.prefix
prefix = self.cleaned_data['prefix']
if not namespace.is_ncname(prefix):
raise forms.ValidationError("This is an invalid prefix")
ret... | python | def clean_prefix(self):
"""
Validates the prefix
"""
if self.instance.fixed:
return self.instance.prefix
prefix = self.cleaned_data['prefix']
if not namespace.is_ncname(prefix):
raise forms.ValidationError("This is an invalid prefix")
ret... | [
"def",
"clean_prefix",
"(",
"self",
")",
":",
"if",
"self",
".",
"instance",
".",
"fixed",
":",
"return",
"self",
".",
"instance",
".",
"prefix",
"prefix",
"=",
"self",
".",
"cleaned_data",
"[",
"'prefix'",
"]",
"if",
"not",
"namespace",
".",
"is_ncname"... | Validates the prefix | [
"Validates",
"the",
"prefix"
] | train | https://github.com/publysher/rdflib-django/blob/e26992af75f96ef27a6ceaf820574e3bca645953/src/rdflib_django/forms.py#L26-L37 |
publysher/rdflib-django | src/rdflib_django/forms.py | NamespaceForm.clean_uri | def clean_uri(self):
"""
Validates the URI
"""
if self.instance.fixed:
return self.instance.uri
uri = self.cleaned_data['uri']
# todo: URI validation
return uri | python | def clean_uri(self):
"""
Validates the URI
"""
if self.instance.fixed:
return self.instance.uri
uri = self.cleaned_data['uri']
# todo: URI validation
return uri | [
"def",
"clean_uri",
"(",
"self",
")",
":",
"if",
"self",
".",
"instance",
".",
"fixed",
":",
"return",
"self",
".",
"instance",
".",
"uri",
"uri",
"=",
"self",
".",
"cleaned_data",
"[",
"'uri'",
"]",
"# todo: URI validation",
"return",
"uri"
] | Validates the URI | [
"Validates",
"the",
"URI"
] | train | https://github.com/publysher/rdflib-django/blob/e26992af75f96ef27a6ceaf820574e3bca645953/src/rdflib_django/forms.py#L39-L48 |
klen/makesite | makesite/modules/flask/base/core/models.py | BaseMixin.history | def history(self):
"""Returns an SQLAlchemy query of the object's history (previous
versions). If the class does not support history/versioning,
returns None.
"""
history = self.history_class
if history:
return self.session.query(history).filter(history.id == ... | python | def history(self):
"""Returns an SQLAlchemy query of the object's history (previous
versions). If the class does not support history/versioning,
returns None.
"""
history = self.history_class
if history:
return self.session.query(history).filter(history.id == ... | [
"def",
"history",
"(",
"self",
")",
":",
"history",
"=",
"self",
".",
"history_class",
"if",
"history",
":",
"return",
"self",
".",
"session",
".",
"query",
"(",
"history",
")",
".",
"filter",
"(",
"history",
".",
"id",
"==",
"self",
".",
"id",
")",
... | Returns an SQLAlchemy query of the object's history (previous
versions). If the class does not support history/versioning,
returns None. | [
"Returns",
"an",
"SQLAlchemy",
"query",
"of",
"the",
"object",
"s",
"history",
"(",
"previous",
"versions",
")",
".",
"If",
"the",
"class",
"does",
"not",
"support",
"history",
"/",
"versioning",
"returns",
"None",
"."
] | train | https://github.com/klen/makesite/blob/f6f77a43a04a256189e8fffbeac1ffd63f35a10c/makesite/modules/flask/base/core/models.py#L71-L80 |
klen/makesite | makesite/modules/flask/base/core/models.py | BaseMixin.generate_appstruct | def generate_appstruct(self):
"""Returns a Deform compatible appstruct of the object and it's
properties. Does not recurse into SQLAlchemy relationships.
An example using the :class:`~drinks.models.User` class (that
inherits from BaseMixin):
.. code-block:: python
>... | python | def generate_appstruct(self):
"""Returns a Deform compatible appstruct of the object and it's
properties. Does not recurse into SQLAlchemy relationships.
An example using the :class:`~drinks.models.User` class (that
inherits from BaseMixin):
.. code-block:: python
>... | [
"def",
"generate_appstruct",
"(",
"self",
")",
":",
"mapper",
"=",
"object_mapper",
"(",
"self",
")",
"return",
"dict",
"(",
"[",
"(",
"p",
".",
"key",
",",
"self",
".",
"__getattribute__",
"(",
"p",
".",
"key",
")",
")",
"for",
"p",
"in",
"mapper",
... | Returns a Deform compatible appstruct of the object and it's
properties. Does not recurse into SQLAlchemy relationships.
An example using the :class:`~drinks.models.User` class (that
inherits from BaseMixin):
.. code-block:: python
>>> user = User(username='mcuserpants', di... | [
"Returns",
"a",
"Deform",
"compatible",
"appstruct",
"of",
"the",
"object",
"and",
"it",
"s",
"properties",
".",
"Does",
"not",
"recurse",
"into",
"SQLAlchemy",
"relationships",
".",
"An",
"example",
"using",
"the",
":",
"class",
":",
"~drinks",
".",
"models... | train | https://github.com/klen/makesite/blob/f6f77a43a04a256189e8fffbeac1ffd63f35a10c/makesite/modules/flask/base/core/models.py#L82-L98 |
ton/stash | stash/stash.py | Stash._get_patch_path | def _get_patch_path(cls, patch_name):
"""Returns the absolute path for patch *patch_name*."""
return os.path.join(cls.STASH_PATH, patch_name) if patch_name else None | python | def _get_patch_path(cls, patch_name):
"""Returns the absolute path for patch *patch_name*."""
return os.path.join(cls.STASH_PATH, patch_name) if patch_name else None | [
"def",
"_get_patch_path",
"(",
"cls",
",",
"patch_name",
")",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"cls",
".",
"STASH_PATH",
",",
"patch_name",
")",
"if",
"patch_name",
"else",
"None"
] | Returns the absolute path for patch *patch_name*. | [
"Returns",
"the",
"absolute",
"path",
"for",
"patch",
"*",
"patch_name",
"*",
"."
] | train | https://github.com/ton/stash/blob/31cd8269aa8e051f094eccb094946eda6f6d428e/stash/stash.py#L29-L31 |
ton/stash | stash/stash.py | Stash.remove_patch | def remove_patch(cls, patch_name):
"""Removes patch *patch_name* from the stash (in case it exists).
:raises: :py:exc:`~stash.exception.StashException` in case *patch_name* does not exist.
"""
try:
os.unlink(cls._get_patch_path(patch_name))
except:
raise ... | python | def remove_patch(cls, patch_name):
"""Removes patch *patch_name* from the stash (in case it exists).
:raises: :py:exc:`~stash.exception.StashException` in case *patch_name* does not exist.
"""
try:
os.unlink(cls._get_patch_path(patch_name))
except:
raise ... | [
"def",
"remove_patch",
"(",
"cls",
",",
"patch_name",
")",
":",
"try",
":",
"os",
".",
"unlink",
"(",
"cls",
".",
"_get_patch_path",
"(",
"patch_name",
")",
")",
"except",
":",
"raise",
"StashException",
"(",
"\"patch '%s' does not exist\"",
"%",
"patch_name",... | Removes patch *patch_name* from the stash (in case it exists).
:raises: :py:exc:`~stash.exception.StashException` in case *patch_name* does not exist. | [
"Removes",
"patch",
"*",
"patch_name",
"*",
"from",
"the",
"stash",
"(",
"in",
"case",
"it",
"exists",
")",
"."
] | train | https://github.com/ton/stash/blob/31cd8269aa8e051f094eccb094946eda6f6d428e/stash/stash.py#L39-L47 |
ton/stash | stash/stash.py | Stash.get_patch | def get_patch(cls, patch_name):
"""Returns the contents of the specified patch *patch_name*.
:raises: :py:exc:`~stash.exception.StashException` in case *patch_name* does not exist.
"""
try:
return open(cls._get_patch_path(patch_name), 'r').read()
except:
... | python | def get_patch(cls, patch_name):
"""Returns the contents of the specified patch *patch_name*.
:raises: :py:exc:`~stash.exception.StashException` in case *patch_name* does not exist.
"""
try:
return open(cls._get_patch_path(patch_name), 'r').read()
except:
... | [
"def",
"get_patch",
"(",
"cls",
",",
"patch_name",
")",
":",
"try",
":",
"return",
"open",
"(",
"cls",
".",
"_get_patch_path",
"(",
"patch_name",
")",
",",
"'r'",
")",
".",
"read",
"(",
")",
"except",
":",
"raise",
"StashException",
"(",
"\"patch '%s' do... | Returns the contents of the specified patch *patch_name*.
:raises: :py:exc:`~stash.exception.StashException` in case *patch_name* does not exist. | [
"Returns",
"the",
"contents",
"of",
"the",
"specified",
"patch",
"*",
"patch_name",
"*",
"."
] | train | https://github.com/ton/stash/blob/31cd8269aa8e051f094eccb094946eda6f6d428e/stash/stash.py#L50-L58 |
ton/stash | stash/stash.py | Stash.apply_patch | def apply_patch(self, patch_name):
"""Applies the patch *patch_name* on to the current working directory in
case the patch exists. In case applying the patch was successful, the
patch is automatically removed from the stash. Returns ``True`` in case
applying the patch was successful, oth... | python | def apply_patch(self, patch_name):
"""Applies the patch *patch_name* on to the current working directory in
case the patch exists. In case applying the patch was successful, the
patch is automatically removed from the stash. Returns ``True`` in case
applying the patch was successful, oth... | [
"def",
"apply_patch",
"(",
"self",
",",
"patch_name",
")",
":",
"if",
"patch_name",
"in",
"self",
".",
"get_patches",
"(",
")",
":",
"patch_path",
"=",
"self",
".",
"_get_patch_path",
"(",
"patch_name",
")",
"# Apply the patch, and determine the files that have been... | Applies the patch *patch_name* on to the current working directory in
case the patch exists. In case applying the patch was successful, the
patch is automatically removed from the stash. Returns ``True`` in case
applying the patch was successful, otherwise ``False`` is returned.
:raises... | [
"Applies",
"the",
"patch",
"*",
"patch_name",
"*",
"on",
"to",
"the",
"current",
"working",
"directory",
"in",
"case",
"the",
"patch",
"exists",
".",
"In",
"case",
"applying",
"the",
"patch",
"was",
"successful",
"the",
"patch",
"is",
"automatically",
"remov... | train | https://github.com/ton/stash/blob/31cd8269aa8e051f094eccb094946eda6f6d428e/stash/stash.py#L60-L90 |
ton/stash | stash/stash.py | Stash.create_patch | def create_patch(self, patch_name):
"""Creates a patch based on the changes in the current repository. In
case the specified patch *patch_name* already exists, ask the user to
overwrite the patch. In case creating the patch was successful, all
changes in the current repository are revert... | python | def create_patch(self, patch_name):
"""Creates a patch based on the changes in the current repository. In
case the specified patch *patch_name* already exists, ask the user to
overwrite the patch. In case creating the patch was successful, all
changes in the current repository are revert... | [
"def",
"create_patch",
"(",
"self",
",",
"patch_name",
")",
":",
"# Raise an exception in case the specified patch already exists.",
"patch_path",
"=",
"self",
".",
"_get_patch_path",
"(",
"patch_name",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"patch_path",
... | Creates a patch based on the changes in the current repository. In
case the specified patch *patch_name* already exists, ask the user to
overwrite the patch. In case creating the patch was successful, all
changes in the current repository are reverted. Returns ``True`` in case
a patch wa... | [
"Creates",
"a",
"patch",
"based",
"on",
"the",
"changes",
"in",
"the",
"current",
"repository",
".",
"In",
"case",
"the",
"specified",
"patch",
"*",
"patch_name",
"*",
"already",
"exists",
"ask",
"the",
"user",
"to",
"overwrite",
"the",
"patch",
".",
"In",... | train | https://github.com/ton/stash/blob/31cd8269aa8e051f094eccb094946eda6f6d428e/stash/stash.py#L92-L128 |
klen/makesite | makesite/settings.py | MakesiteParser.as_dict | def as_dict(self, section='Main', **kwargs):
"""Return template context from configs.
"""
items = super(MakesiteParser, self).items(section, **kwargs)
return dict(items) | python | def as_dict(self, section='Main', **kwargs):
"""Return template context from configs.
"""
items = super(MakesiteParser, self).items(section, **kwargs)
return dict(items) | [
"def",
"as_dict",
"(",
"self",
",",
"section",
"=",
"'Main'",
",",
"*",
"*",
"kwargs",
")",
":",
"items",
"=",
"super",
"(",
"MakesiteParser",
",",
"self",
")",
".",
"items",
"(",
"section",
",",
"*",
"*",
"kwargs",
")",
"return",
"dict",
"(",
"ite... | Return template context from configs. | [
"Return",
"template",
"context",
"from",
"configs",
"."
] | train | https://github.com/klen/makesite/blob/f6f77a43a04a256189e8fffbeac1ffd63f35a10c/makesite/settings.py#L49-L54 |
klen/makesite | makesite/modules/flask/base/auth/oauth.py | config_oauth | def config_oauth(app):
" Configure oauth support. "
for name in PROVIDERS:
config = app.config.get('OAUTH_%s' % name.upper())
if not config:
continue
if not name in oauth.remote_apps:
remote_app = oauth.remote_app(name, **config)
else:
remo... | python | def config_oauth(app):
" Configure oauth support. "
for name in PROVIDERS:
config = app.config.get('OAUTH_%s' % name.upper())
if not config:
continue
if not name in oauth.remote_apps:
remote_app = oauth.remote_app(name, **config)
else:
remo... | [
"def",
"config_oauth",
"(",
"app",
")",
":",
"for",
"name",
"in",
"PROVIDERS",
":",
"config",
"=",
"app",
".",
"config",
".",
"get",
"(",
"'OAUTH_%s'",
"%",
"name",
".",
"upper",
"(",
")",
")",
"if",
"not",
"config",
":",
"continue",
"if",
"not",
"... | Configure oauth support. | [
"Configure",
"oauth",
"support",
"."
] | train | https://github.com/klen/makesite/blob/f6f77a43a04a256189e8fffbeac1ffd63f35a10c/makesite/modules/flask/base/auth/oauth.py#L20-L36 |
klen/makesite | makesite/modules/django/main/utils/cache.py | cached_instance | def cached_instance(model, timeout=None, **filters):
""" Auto cached model instance.
"""
if isinstance(model, basestring):
model = _str_to_model(model)
cache_key = generate_cache_key(model, **filters)
return get_cached(cache_key, model.objects.select_related().get, kwargs=filters) | python | def cached_instance(model, timeout=None, **filters):
""" Auto cached model instance.
"""
if isinstance(model, basestring):
model = _str_to_model(model)
cache_key = generate_cache_key(model, **filters)
return get_cached(cache_key, model.objects.select_related().get, kwargs=filters) | [
"def",
"cached_instance",
"(",
"model",
",",
"timeout",
"=",
"None",
",",
"*",
"*",
"filters",
")",
":",
"if",
"isinstance",
"(",
"model",
",",
"basestring",
")",
":",
"model",
"=",
"_str_to_model",
"(",
"model",
")",
"cache_key",
"=",
"generate_cache_key"... | Auto cached model instance. | [
"Auto",
"cached",
"model",
"instance",
"."
] | train | https://github.com/klen/makesite/blob/f6f77a43a04a256189e8fffbeac1ffd63f35a10c/makesite/modules/django/main/utils/cache.py#L15-L22 |
klen/makesite | makesite/modules/django/main/utils/cache.py | cached_query | def cached_query(qs, timeout=None):
""" Auto cached queryset and generate results.
"""
cache_key = generate_cache_key(qs)
return get_cached(cache_key, list, args=(qs,), timeout=None) | python | def cached_query(qs, timeout=None):
""" Auto cached queryset and generate results.
"""
cache_key = generate_cache_key(qs)
return get_cached(cache_key, list, args=(qs,), timeout=None) | [
"def",
"cached_query",
"(",
"qs",
",",
"timeout",
"=",
"None",
")",
":",
"cache_key",
"=",
"generate_cache_key",
"(",
"qs",
")",
"return",
"get_cached",
"(",
"cache_key",
",",
"list",
",",
"args",
"=",
"(",
"qs",
",",
")",
",",
"timeout",
"=",
"None",
... | Auto cached queryset and generate results. | [
"Auto",
"cached",
"queryset",
"and",
"generate",
"results",
"."
] | train | https://github.com/klen/makesite/blob/f6f77a43a04a256189e8fffbeac1ffd63f35a10c/makesite/modules/django/main/utils/cache.py#L25-L29 |
klen/makesite | makesite/modules/django/main/utils/cache.py | clean_cache | def clean_cache(cached, **kwargs):
" Generate cache key and clean cached value. "
if isinstance(cached, basestring):
cached = _str_to_model(cached)
cache_key = generate_cache_key(cached, **kwargs)
cache.delete(cache_key) | python | def clean_cache(cached, **kwargs):
" Generate cache key and clean cached value. "
if isinstance(cached, basestring):
cached = _str_to_model(cached)
cache_key = generate_cache_key(cached, **kwargs)
cache.delete(cache_key) | [
"def",
"clean_cache",
"(",
"cached",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"cached",
",",
"basestring",
")",
":",
"cached",
"=",
"_str_to_model",
"(",
"cached",
")",
"cache_key",
"=",
"generate_cache_key",
"(",
"cached",
",",
"*",
"... | Generate cache key and clean cached value. | [
"Generate",
"cache",
"key",
"and",
"clean",
"cached",
"value",
"."
] | train | https://github.com/klen/makesite/blob/f6f77a43a04a256189e8fffbeac1ffd63f35a10c/makesite/modules/django/main/utils/cache.py#L32-L39 |
klen/makesite | makesite/modules/django/main/utils/cache.py | generate_cache_key | def generate_cache_key(cached, **kwargs):
""" Auto generate cache key for model or queryset
"""
if isinstance(cached, QuerySet):
key = str(cached.query)
elif isinstance(cached, (Model, ModelBase)):
key = '%s.%s:%s' % (cached._meta.app_label,
cached._meta.mod... | python | def generate_cache_key(cached, **kwargs):
""" Auto generate cache key for model or queryset
"""
if isinstance(cached, QuerySet):
key = str(cached.query)
elif isinstance(cached, (Model, ModelBase)):
key = '%s.%s:%s' % (cached._meta.app_label,
cached._meta.mod... | [
"def",
"generate_cache_key",
"(",
"cached",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"cached",
",",
"QuerySet",
")",
":",
"key",
"=",
"str",
"(",
"cached",
".",
"query",
")",
"elif",
"isinstance",
"(",
"cached",
",",
"(",
"Model",
... | Auto generate cache key for model or queryset | [
"Auto",
"generate",
"cache",
"key",
"for",
"model",
"or",
"queryset"
] | train | https://github.com/klen/makesite/blob/f6f77a43a04a256189e8fffbeac1ffd63f35a10c/makesite/modules/django/main/utils/cache.py#L42-L61 |
klen/makesite | makesite/modules/django/main/utils/cache.py | clean_cache_key | def clean_cache_key(key):
""" Replace spaces with '-' and hash if length is greater than 250.
"""
cache_key = re.sub(r'\s+', '-', key)
cache_key = smart_str(cache_key)
if len(cache_key) > 200:
cache_key = cache_key[:150] + '-' + hashlib.md5(cache_key).hexdigest()
return cache_key | python | def clean_cache_key(key):
""" Replace spaces with '-' and hash if length is greater than 250.
"""
cache_key = re.sub(r'\s+', '-', key)
cache_key = smart_str(cache_key)
if len(cache_key) > 200:
cache_key = cache_key[:150] + '-' + hashlib.md5(cache_key).hexdigest()
return cache_key | [
"def",
"clean_cache_key",
"(",
"key",
")",
":",
"cache_key",
"=",
"re",
".",
"sub",
"(",
"r'\\s+'",
",",
"'-'",
",",
"key",
")",
"cache_key",
"=",
"smart_str",
"(",
"cache_key",
")",
"if",
"len",
"(",
"cache_key",
")",
">",
"200",
":",
"cache_key",
"... | Replace spaces with '-' and hash if length is greater than 250. | [
"Replace",
"spaces",
"with",
"-",
"and",
"hash",
"if",
"length",
"is",
"greater",
"than",
"250",
"."
] | train | https://github.com/klen/makesite/blob/f6f77a43a04a256189e8fffbeac1ffd63f35a10c/makesite/modules/django/main/utils/cache.py#L64-L73 |
dcramer/django-static-compiler | src/static_compiler/management/commands/compilestatic.py | collect_static_files | def collect_static_files(src_map, dst):
"""
Collect all static files and move them into a temporary location.
This is very similar to the ``collectstatic`` command.
"""
for rel_src, abs_src in src_map.iteritems():
abs_dst = os.path.join(dst, rel_src)
copy_file(abs_src, abs_dst) | python | def collect_static_files(src_map, dst):
"""
Collect all static files and move them into a temporary location.
This is very similar to the ``collectstatic`` command.
"""
for rel_src, abs_src in src_map.iteritems():
abs_dst = os.path.join(dst, rel_src)
copy_file(abs_src, abs_dst) | [
"def",
"collect_static_files",
"(",
"src_map",
",",
"dst",
")",
":",
"for",
"rel_src",
",",
"abs_src",
"in",
"src_map",
".",
"iteritems",
"(",
")",
":",
"abs_dst",
"=",
"os",
".",
"path",
".",
"join",
"(",
"dst",
",",
"rel_src",
")",
"copy_file",
"(",
... | Collect all static files and move them into a temporary location.
This is very similar to the ``collectstatic`` command. | [
"Collect",
"all",
"static",
"files",
"and",
"move",
"them",
"into",
"a",
"temporary",
"location",
"."
] | train | https://github.com/dcramer/django-static-compiler/blob/7218d30e1b4eb88b7a8683ae5748f6a71c502b81/src/static_compiler/management/commands/compilestatic.py#L46-L54 |
dcramer/django-static-compiler | src/static_compiler/management/commands/compilestatic.py | run_command | def run_command(cmd, root, dst, input, params):
"""
Execute a command, and if successful write it's stdout to ``root``/``dst``.
"""
use_stdout = '{output}' not in cmd
if not use_stdout:
params['output'] = dst
parsed_cmd = parse_command(cmd, input=input, params=params)
ensure_dirs(os... | python | def run_command(cmd, root, dst, input, params):
"""
Execute a command, and if successful write it's stdout to ``root``/``dst``.
"""
use_stdout = '{output}' not in cmd
if not use_stdout:
params['output'] = dst
parsed_cmd = parse_command(cmd, input=input, params=params)
ensure_dirs(os... | [
"def",
"run_command",
"(",
"cmd",
",",
"root",
",",
"dst",
",",
"input",
",",
"params",
")",
":",
"use_stdout",
"=",
"'{output}'",
"not",
"in",
"cmd",
"if",
"not",
"use_stdout",
":",
"params",
"[",
"'output'",
"]",
"=",
"dst",
"parsed_cmd",
"=",
"parse... | Execute a command, and if successful write it's stdout to ``root``/``dst``. | [
"Execute",
"a",
"command",
"and",
"if",
"successful",
"write",
"it",
"s",
"stdout",
"to",
"root",
"/",
"dst",
"."
] | train | https://github.com/dcramer/django-static-compiler/blob/7218d30e1b4eb88b7a8683ae5748f6a71c502b81/src/static_compiler/management/commands/compilestatic.py#L90-L117 |
dcramer/django-static-compiler | src/static_compiler/management/commands/compilestatic.py | apply_preprocessors | def apply_preprocessors(root, src, dst, processors):
"""
Preprocessors operate based on the source filename, and apply to each
file individually.
"""
matches = [(pattern, cmds) for pattern, cmds in processors.iteritems() if fnmatch(src, pattern)]
if not matches:
return False
params ... | python | def apply_preprocessors(root, src, dst, processors):
"""
Preprocessors operate based on the source filename, and apply to each
file individually.
"""
matches = [(pattern, cmds) for pattern, cmds in processors.iteritems() if fnmatch(src, pattern)]
if not matches:
return False
params ... | [
"def",
"apply_preprocessors",
"(",
"root",
",",
"src",
",",
"dst",
",",
"processors",
")",
":",
"matches",
"=",
"[",
"(",
"pattern",
",",
"cmds",
")",
"for",
"pattern",
",",
"cmds",
"in",
"processors",
".",
"iteritems",
"(",
")",
"if",
"fnmatch",
"(",
... | Preprocessors operate based on the source filename, and apply to each
file individually. | [
"Preprocessors",
"operate",
"based",
"on",
"the",
"source",
"filename",
"and",
"apply",
"to",
"each",
"file",
"individually",
"."
] | train | https://github.com/dcramer/django-static-compiler/blob/7218d30e1b4eb88b7a8683ae5748f6a71c502b81/src/static_compiler/management/commands/compilestatic.py#L120-L136 |
dcramer/django-static-compiler | src/static_compiler/management/commands/compilestatic.py | apply_postcompilers | def apply_postcompilers(root, src_list, dst, processors):
"""
Postcompilers operate based on the destination filename. They operate on a collection
of files, and are expected to take a list of 1+ inputs and generate a single output.
"""
dst_file = os.path.join(root, dst)
matches = [(pattern, cm... | python | def apply_postcompilers(root, src_list, dst, processors):
"""
Postcompilers operate based on the destination filename. They operate on a collection
of files, and are expected to take a list of 1+ inputs and generate a single output.
"""
dst_file = os.path.join(root, dst)
matches = [(pattern, cm... | [
"def",
"apply_postcompilers",
"(",
"root",
",",
"src_list",
",",
"dst",
",",
"processors",
")",
":",
"dst_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"root",
",",
"dst",
")",
"matches",
"=",
"[",
"(",
"pattern",
",",
"cmds",
")",
"for",
"pattern... | Postcompilers operate based on the destination filename. They operate on a collection
of files, and are expected to take a list of 1+ inputs and generate a single output. | [
"Postcompilers",
"operate",
"based",
"on",
"the",
"destination",
"filename",
".",
"They",
"operate",
"on",
"a",
"collection",
"of",
"files",
"and",
"are",
"expected",
"to",
"take",
"a",
"list",
"of",
"1",
"+",
"inputs",
"and",
"generate",
"a",
"single",
"o... | train | https://github.com/dcramer/django-static-compiler/blob/7218d30e1b4eb88b7a8683ae5748f6a71c502b81/src/static_compiler/management/commands/compilestatic.py#L139-L167 |
alfred82santa/dirty-models | dirty_models/models.py | set_model_internal_data | def set_model_internal_data(model, original_data, modified_data, deleted_data):
"""
Set internal data to model.
"""
model.__original_data__ = original_data
list(map(model._prepare_child, model.__original_data__))
model.__modified_data__ = modified_data
list(map(model._prepare_child, model._... | python | def set_model_internal_data(model, original_data, modified_data, deleted_data):
"""
Set internal data to model.
"""
model.__original_data__ = original_data
list(map(model._prepare_child, model.__original_data__))
model.__modified_data__ = modified_data
list(map(model._prepare_child, model._... | [
"def",
"set_model_internal_data",
"(",
"model",
",",
"original_data",
",",
"modified_data",
",",
"deleted_data",
")",
":",
"model",
".",
"__original_data__",
"=",
"original_data",
"list",
"(",
"map",
"(",
"model",
".",
"_prepare_child",
",",
"model",
".",
"__ori... | Set internal data to model. | [
"Set",
"internal",
"data",
"to",
"model",
"."
] | train | https://github.com/alfred82santa/dirty-models/blob/354becdb751b21f673515eae928c256c7e923c50/dirty_models/models.py#L139-L151 |
alfred82santa/dirty-models | dirty_models/models.py | recover_model_from_data | def recover_model_from_data(model_class, original_data, modified_data, deleted_data):
"""
Function to reconstruct a model from DirtyModel basic information: original data, the modified and deleted
fields.
Necessary for pickle an object
"""
model = model_class()
return set_model_internal_data... | python | def recover_model_from_data(model_class, original_data, modified_data, deleted_data):
"""
Function to reconstruct a model from DirtyModel basic information: original data, the modified and deleted
fields.
Necessary for pickle an object
"""
model = model_class()
return set_model_internal_data... | [
"def",
"recover_model_from_data",
"(",
"model_class",
",",
"original_data",
",",
"modified_data",
",",
"deleted_data",
")",
":",
"model",
"=",
"model_class",
"(",
")",
"return",
"set_model_internal_data",
"(",
"model",
",",
"original_data",
",",
"modified_data",
","... | Function to reconstruct a model from DirtyModel basic information: original data, the modified and deleted
fields.
Necessary for pickle an object | [
"Function",
"to",
"reconstruct",
"a",
"model",
"from",
"DirtyModel",
"basic",
"information",
":",
"original",
"data",
"the",
"modified",
"and",
"deleted",
"fields",
".",
"Necessary",
"for",
"pickle",
"an",
"object"
] | train | https://github.com/alfred82santa/dirty-models/blob/354becdb751b21f673515eae928c256c7e923c50/dirty_models/models.py#L154-L161 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.