partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
valid | is_ordered | Checks to see if a CatalogID has been ordered or not.
Args:
catalogID (str): The catalog ID from the platform catalog.
Returns:
ordered (bool): Whether or not the image has been ordered | gbdxtools/images/util/image.py | def is_ordered(cat_id):
"""
Checks to see if a CatalogID has been ordered or not.
Args:
catalogID (str): The catalog ID from the platform catalog.
Returns:
ordered (bool): Whether or not the image has been ordered
"""
url = 'https://rda.geobigdata.io/v1/stripMetadata/{}'.f... | def is_ordered(cat_id):
"""
Checks to see if a CatalogID has been ordered or not.
Args:
catalogID (str): The catalog ID from the platform catalog.
Returns:
ordered (bool): Whether or not the image has been ordered
"""
url = 'https://rda.geobigdata.io/v1/stripMetadata/{}'.f... | [
"Checks",
"to",
"see",
"if",
"a",
"CatalogID",
"has",
"been",
"ordered",
"or",
"not",
"."
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/images/util/image.py#L49-L63 | [
"def",
"is_ordered",
"(",
"cat_id",
")",
":",
"url",
"=",
"'https://rda.geobigdata.io/v1/stripMetadata/{}'",
".",
"format",
"(",
"cat_id",
")",
"auth",
"=",
"Auth",
"(",
")",
"r",
"=",
"_req_with_retries",
"(",
"auth",
".",
"gbdx_connection",
",",
"url",
")",
... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | can_acomp | Checks to see if a CatalogID can be atmos. compensated or not.
Args:
catalogID (str): The catalog ID from the platform catalog.
Returns:
available (bool): Whether or not the image can be acomp'd | gbdxtools/images/util/image.py | def can_acomp(cat_id):
"""
Checks to see if a CatalogID can be atmos. compensated or not.
Args:
catalogID (str): The catalog ID from the platform catalog.
Returns:
available (bool): Whether or not the image can be acomp'd
"""
url = 'https://rda.geobigdata.io/v1/stripMetada... | def can_acomp(cat_id):
"""
Checks to see if a CatalogID can be atmos. compensated or not.
Args:
catalogID (str): The catalog ID from the platform catalog.
Returns:
available (bool): Whether or not the image can be acomp'd
"""
url = 'https://rda.geobigdata.io/v1/stripMetada... | [
"Checks",
"to",
"see",
"if",
"a",
"CatalogID",
"can",
"be",
"atmos",
".",
"compensated",
"or",
"not",
"."
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/images/util/image.py#L65-L81 | [
"def",
"can_acomp",
"(",
"cat_id",
")",
":",
"url",
"=",
"'https://rda.geobigdata.io/v1/stripMetadata/{}/capabilities'",
".",
"format",
"(",
"cat_id",
")",
"auth",
"=",
"Auth",
"(",
")",
"r",
"=",
"_req_with_retries",
"(",
"auth",
".",
"gbdx_connection",
",",
"u... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | deprecate_module_attr | Return a wrapped object that warns about deprecated accesses | gbdxtools/deprecate.py | def deprecate_module_attr(mod, deprecated):
"""Return a wrapped object that warns about deprecated accesses"""
deprecated = set(deprecated)
class Wrapper(object):
def __getattr__(self, attr):
if attr in deprecated:
warnings.warn("Property {} is deprecated".format(attr), G... | def deprecate_module_attr(mod, deprecated):
"""Return a wrapped object that warns about deprecated accesses"""
deprecated = set(deprecated)
class Wrapper(object):
def __getattr__(self, attr):
if attr in deprecated:
warnings.warn("Property {} is deprecated".format(attr), G... | [
"Return",
"a",
"wrapped",
"object",
"that",
"warns",
"about",
"deprecated",
"accesses"
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/deprecate.py#L13-L27 | [
"def",
"deprecate_module_attr",
"(",
"mod",
",",
"deprecated",
")",
":",
"deprecated",
"=",
"set",
"(",
"deprecated",
")",
"class",
"Wrapper",
"(",
"object",
")",
":",
"def",
"__getattr__",
"(",
"self",
",",
"attr",
")",
":",
"if",
"attr",
"in",
"depreca... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | PortList.get_matching_multiplex_port | Given a name, figure out if a multiplex port prefixes this name and return it. Otherwise return none. | gbdxtools/simpleworkflows.py | def get_matching_multiplex_port(self,name):
"""
Given a name, figure out if a multiplex port prefixes this name and return it. Otherwise return none.
"""
# short circuit: if the attribute name already exists return none
# if name in self._portnames: return None
# if no... | def get_matching_multiplex_port(self,name):
"""
Given a name, figure out if a multiplex port prefixes this name and return it. Otherwise return none.
"""
# short circuit: if the attribute name already exists return none
# if name in self._portnames: return None
# if no... | [
"Given",
"a",
"name",
"figure",
"out",
"if",
"a",
"multiplex",
"port",
"prefixes",
"this",
"name",
"and",
"return",
"it",
".",
"Otherwise",
"return",
"none",
"."
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/simpleworkflows.py#L109-L128 | [
"def",
"get_matching_multiplex_port",
"(",
"self",
",",
"name",
")",
":",
"# short circuit: if the attribute name already exists return none",
"# if name in self._portnames: return None",
"# if not len([p for p in self._portnames if name.startswith(p) and name != p]): return None",
"matching_... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | Task.set | Set input values on task
Args:
arbitrary_keys: values for the keys
Returns:
None | gbdxtools/simpleworkflows.py | def set(self, **kwargs):
"""
Set input values on task
Args:
arbitrary_keys: values for the keys
Returns:
None
"""
for port_name, port_value in kwargs.items():
# Support both port and port.value
if hasattr(port_value, 'v... | def set(self, **kwargs):
"""
Set input values on task
Args:
arbitrary_keys: values for the keys
Returns:
None
"""
for port_name, port_value in kwargs.items():
# Support both port and port.value
if hasattr(port_value, 'v... | [
"Set",
"input",
"values",
"on",
"task"
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/simpleworkflows.py#L273-L288 | [
"def",
"set",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"port_name",
",",
"port_value",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"# Support both port and port.value",
"if",
"hasattr",
"(",
"port_value",
",",
"'value'",
")",
":",
"port_valu... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | Workflow.savedata | Save output data from any task in this workflow to S3
Args:
output: Reference task output (e.g. task.outputs.output1).
location (optional): Subfolder under which the output will be saved.
It will be placed under the account directory in gbd-cus... | gbdxtools/simpleworkflows.py | def savedata(self, output, location=None):
'''
Save output data from any task in this workflow to S3
Args:
output: Reference task output (e.g. task.outputs.output1).
location (optional): Subfolder under which the output will be saved.
... | def savedata(self, output, location=None):
'''
Save output data from any task in this workflow to S3
Args:
output: Reference task output (e.g. task.outputs.output1).
location (optional): Subfolder under which the output will be saved.
... | [
"Save",
"output",
"data",
"from",
"any",
"task",
"in",
"this",
"workflow",
"to",
"S3"
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/simpleworkflows.py#L402-L420 | [
"def",
"savedata",
"(",
"self",
",",
"output",
",",
"location",
"=",
"None",
")",
":",
"output",
".",
"persist",
"=",
"True",
"if",
"location",
":",
"output",
".",
"persist_location",
"=",
"location"
] | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | Workflow.list_workflow_outputs | Get a list of outputs from the workflow that are saved to S3. To get resolved locations call workflow status.
Args:
None
Returns:
list | gbdxtools/simpleworkflows.py | def list_workflow_outputs(self):
'''
Get a list of outputs from the workflow that are saved to S3. To get resolved locations call workflow status.
Args:
None
Returns:
list
'''
workflow_outputs = []
for task in self.tasks:
for o... | def list_workflow_outputs(self):
'''
Get a list of outputs from the workflow that are saved to S3. To get resolved locations call workflow status.
Args:
None
Returns:
list
'''
workflow_outputs = []
for task in self.tasks:
for o... | [
"Get",
"a",
"list",
"of",
"outputs",
"from",
"the",
"workflow",
"that",
"are",
"saved",
"to",
"S3",
".",
"To",
"get",
"resolved",
"locations",
"call",
"workflow",
"status",
".",
"Args",
":",
"None"
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/simpleworkflows.py#L428-L443 | [
"def",
"list_workflow_outputs",
"(",
"self",
")",
":",
"workflow_outputs",
"=",
"[",
"]",
"for",
"task",
"in",
"self",
".",
"tasks",
":",
"for",
"output_port_name",
"in",
"task",
".",
"outputs",
".",
"_portnames",
":",
"if",
"task",
".",
"outputs",
".",
... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | Workflow.generate_workflow_description | Generate workflow json for launching the workflow against the gbdx api
Args:
None
Returns:
json string | gbdxtools/simpleworkflows.py | def generate_workflow_description(self):
'''
Generate workflow json for launching the workflow against the gbdx api
Args:
None
Returns:
json string
'''
if not self.tasks:
raise WorkflowError('Workflow contains no tasks, and cannot be ... | def generate_workflow_description(self):
'''
Generate workflow json for launching the workflow against the gbdx api
Args:
None
Returns:
json string
'''
if not self.tasks:
raise WorkflowError('Workflow contains no tasks, and cannot be ... | [
"Generate",
"workflow",
"json",
"for",
"launching",
"the",
"workflow",
"against",
"the",
"gbdx",
"api"
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/simpleworkflows.py#L445-L485 | [
"def",
"generate_workflow_description",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"tasks",
":",
"raise",
"WorkflowError",
"(",
"'Workflow contains no tasks, and cannot be executed.'",
")",
"self",
".",
"definition",
"=",
"self",
".",
"workflow_skeleton",
"(",
... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | Workflow.execute | Execute the workflow.
Args:
None
Returns:
Workflow_id | gbdxtools/simpleworkflows.py | def execute(self):
'''
Execute the workflow.
Args:
None
Returns:
Workflow_id
'''
# if not self.tasks:
# raise WorkflowError('Workflow contains no tasks, and cannot be executed.')
# for task in self.tasks:
# self.d... | def execute(self):
'''
Execute the workflow.
Args:
None
Returns:
Workflow_id
'''
# if not self.tasks:
# raise WorkflowError('Workflow contains no tasks, and cannot be executed.')
# for task in self.tasks:
# self.d... | [
"Execute",
"the",
"workflow",
"."
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/simpleworkflows.py#L487-L513 | [
"def",
"execute",
"(",
"self",
")",
":",
"# if not self.tasks:",
"# raise WorkflowError('Workflow contains no tasks, and cannot be executed.')",
"# for task in self.tasks:",
"# self.definition['tasks'].append( task.generate_task_workflow_json() )",
"self",
".",
"generate_workflow_des... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | Workflow.task_ids | Get the task IDs of a running workflow
Args:
None
Returns:
List of task IDs | gbdxtools/simpleworkflows.py | def task_ids(self):
'''
Get the task IDs of a running workflow
Args:
None
Returns:
List of task IDs
'''
if not self.id:
raise WorkflowError('Workflow is not running. Cannot get task IDs.')
if self.batch_values:
r... | def task_ids(self):
'''
Get the task IDs of a running workflow
Args:
None
Returns:
List of task IDs
'''
if not self.id:
raise WorkflowError('Workflow is not running. Cannot get task IDs.')
if self.batch_values:
r... | [
"Get",
"the",
"task",
"IDs",
"of",
"a",
"running",
"workflow"
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/simpleworkflows.py#L516-L534 | [
"def",
"task_ids",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"id",
":",
"raise",
"WorkflowError",
"(",
"'Workflow is not running. Cannot get task IDs.'",
")",
"if",
"self",
".",
"batch_values",
":",
"raise",
"NotImplementedError",
"(",
"\"Query Each Workflow... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | Workflow.cancel | Cancel a running workflow.
Args:
None
Returns:
None | gbdxtools/simpleworkflows.py | def cancel(self):
'''
Cancel a running workflow.
Args:
None
Returns:
None
'''
if not self.id:
raise WorkflowError('Workflow is not running. Cannot cancel.')
if self.batch_values:
self.workflow.batch_workflow_canc... | def cancel(self):
'''
Cancel a running workflow.
Args:
None
Returns:
None
'''
if not self.id:
raise WorkflowError('Workflow is not running. Cannot cancel.')
if self.batch_values:
self.workflow.batch_workflow_canc... | [
"Cancel",
"a",
"running",
"workflow",
"."
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/simpleworkflows.py#L541-L557 | [
"def",
"cancel",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"id",
":",
"raise",
"WorkflowError",
"(",
"'Workflow is not running. Cannot cancel.'",
")",
"if",
"self",
".",
"batch_values",
":",
"self",
".",
"workflow",
".",
"batch_workflow_cancel",
"(",
"... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | Workflow.stdout | Get stdout from all the tasks of a workflow.
Returns:
(list): tasks with their stdout
Example:
>>> workflow.stdout
[
{
"id": "4488895771403082552",
"taskType": "AOP_Strip_Processor",
... | gbdxtools/simpleworkflows.py | def stdout(self):
''' Get stdout from all the tasks of a workflow.
Returns:
(list): tasks with their stdout
Example:
>>> workflow.stdout
[
{
"id": "4488895771403082552",
"taskType": "AOP_Strip_P... | def stdout(self):
''' Get stdout from all the tasks of a workflow.
Returns:
(list): tasks with their stdout
Example:
>>> workflow.stdout
[
{
"id": "4488895771403082552",
"taskType": "AOP_Strip_P... | [
"Get",
"stdout",
"from",
"all",
"the",
"tasks",
"of",
"a",
"workflow",
"."
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/simpleworkflows.py#L726-L762 | [
"def",
"stdout",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"id",
":",
"raise",
"WorkflowError",
"(",
"'Workflow is not running. Cannot get stdout.'",
")",
"if",
"self",
".",
"batch_values",
":",
"raise",
"NotImplementedError",
"(",
"\"Query Each Workflow Id ... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | Workflow.stderr | Get stderr from all the tasks of a workflow.
Returns:
(list): tasks with their stderr
Example:
>>> workflow.stderr
[
{
"id": "4488895771403082552",
"taskType": "AOP_Strip_Processor",
"name":... | gbdxtools/simpleworkflows.py | def stderr(self):
'''Get stderr from all the tasks of a workflow.
Returns:
(list): tasks with their stderr
Example:
>>> workflow.stderr
[
{
"id": "4488895771403082552",
"taskType": "AOP_Strip_Processor"... | def stderr(self):
'''Get stderr from all the tasks of a workflow.
Returns:
(list): tasks with their stderr
Example:
>>> workflow.stderr
[
{
"id": "4488895771403082552",
"taskType": "AOP_Strip_Processor"... | [
"Get",
"stderr",
"from",
"all",
"the",
"tasks",
"of",
"a",
"workflow",
"."
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/simpleworkflows.py#L769-L806 | [
"def",
"stderr",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"id",
":",
"raise",
"WorkflowError",
"(",
"'Workflow is not running. Cannot get stderr.'",
")",
"if",
"self",
".",
"batch_values",
":",
"raise",
"NotImplementedError",
"(",
"\"Query Each Workflow Id ... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | VectorLayer.layers | Renders the list of layers to add to the map.
Returns:
layers (list): list of layer entries suitable for use in mapbox-gl 'map.addLayer()' call | gbdxtools/vector_layers.py | def layers(self):
""" Renders the list of layers to add to the map.
Returns:
layers (list): list of layer entries suitable for use in mapbox-gl 'map.addLayer()' call
"""
layers = [self._layer_def(style) for style in self.styles]
return layers | def layers(self):
""" Renders the list of layers to add to the map.
Returns:
layers (list): list of layer entries suitable for use in mapbox-gl 'map.addLayer()' call
"""
layers = [self._layer_def(style) for style in self.styles]
return layers | [
"Renders",
"the",
"list",
"of",
"layers",
"to",
"add",
"to",
"the",
"map",
"."
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/vector_layers.py#L51-L58 | [
"def",
"layers",
"(",
"self",
")",
":",
"layers",
"=",
"[",
"self",
".",
"_layer_def",
"(",
"style",
")",
"for",
"style",
"in",
"self",
".",
"styles",
"]",
"return",
"layers"
] | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | get_proj | Helper method for handling projection codes that are unknown to pyproj
Args:
prj_code (str): an epsg proj code
Returns:
projection: a pyproj projection | gbdxtools/rda/util.py | def get_proj(prj_code):
"""
Helper method for handling projection codes that are unknown to pyproj
Args:
prj_code (str): an epsg proj code
Returns:
projection: a pyproj projection
"""
if prj_code in CUSTOM_PRJ:
proj = pyproj.Proj(CUSTOM_PRJ[prj_code])
else... | def get_proj(prj_code):
"""
Helper method for handling projection codes that are unknown to pyproj
Args:
prj_code (str): an epsg proj code
Returns:
projection: a pyproj projection
"""
if prj_code in CUSTOM_PRJ:
proj = pyproj.Proj(CUSTOM_PRJ[prj_code])
else... | [
"Helper",
"method",
"for",
"handling",
"projection",
"codes",
"that",
"are",
"unknown",
"to",
"pyproj"
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/rda/util.py#L52-L66 | [
"def",
"get_proj",
"(",
"prj_code",
")",
":",
"if",
"prj_code",
"in",
"CUSTOM_PRJ",
":",
"proj",
"=",
"pyproj",
".",
"Proj",
"(",
"CUSTOM_PRJ",
"[",
"prj_code",
"]",
")",
"else",
":",
"proj",
"=",
"pyproj",
".",
"Proj",
"(",
"init",
"=",
"prj_code",
... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | preview | Show a slippy map preview of the image. Requires iPython.
Args:
image (image): image object to display
zoom (int): zoom level to intialize the map, default is 16
center (list): center coordinates to initialize the map, defaults to center of image
bands (list): bands of image to disp... | gbdxtools/rda/util.py | def preview(image, **kwargs):
''' Show a slippy map preview of the image. Requires iPython.
Args:
image (image): image object to display
zoom (int): zoom level to intialize the map, default is 16
center (list): center coordinates to initialize the map, defaults to center of image
... | def preview(image, **kwargs):
''' Show a slippy map preview of the image. Requires iPython.
Args:
image (image): image object to display
zoom (int): zoom level to intialize the map, default is 16
center (list): center coordinates to initialize the map, defaults to center of image
... | [
"Show",
"a",
"slippy",
"map",
"preview",
"of",
"the",
"image",
".",
"Requires",
"iPython",
"."
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/rda/util.py#L69-L221 | [
"def",
"preview",
"(",
"image",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"from",
"IPython",
".",
"display",
"import",
"Javascript",
",",
"HTML",
",",
"display",
"from",
"gbdxtools",
".",
"rda",
".",
"interface",
"import",
"RDA",
"from",
"gbdxtools"... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | calc_toa_gain_offset | Compute (gain, offset) tuples for each band of the specified image metadata | gbdxtools/rda/util.py | def calc_toa_gain_offset(meta):
"""
Compute (gain, offset) tuples for each band of the specified image metadata
"""
# Set satellite index to look up cal factors
sat_index = meta['satid'].upper() + "_" + meta['bandid'].upper()
# Set scale for at sensor radiance
# Eq is:
# L = GAIN * DN *... | def calc_toa_gain_offset(meta):
"""
Compute (gain, offset) tuples for each band of the specified image metadata
"""
# Set satellite index to look up cal factors
sat_index = meta['satid'].upper() + "_" + meta['bandid'].upper()
# Set scale for at sensor radiance
# Eq is:
# L = GAIN * DN *... | [
"Compute",
"(",
"gain",
"offset",
")",
"tuples",
"for",
"each",
"band",
"of",
"the",
"specified",
"image",
"metadata"
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/rda/util.py#L246-L287 | [
"def",
"calc_toa_gain_offset",
"(",
"meta",
")",
":",
"# Set satellite index to look up cal factors",
"sat_index",
"=",
"meta",
"[",
"'satid'",
"]",
".",
"upper",
"(",
")",
"+",
"\"_\"",
"+",
"meta",
"[",
"'bandid'",
"]",
".",
"upper",
"(",
")",
"# Set scale f... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | RDAImage.materialize | Materializes images into gbdx user buckets in s3.
Note: This method is only available to RDA based image classes.
Args:
node (str): the node in the graph to materialize
bounds (list): optional bbox for cropping what gets materialized in s3
out_format (str): VECT... | gbdxtools/images/rda_image.py | def materialize(self, node=None, bounds=None, callback=None, out_format='TILE_STREAM', **kwargs):
"""
Materializes images into gbdx user buckets in s3.
Note: This method is only available to RDA based image classes.
Args:
node (str): the node in the graph to materiali... | def materialize(self, node=None, bounds=None, callback=None, out_format='TILE_STREAM', **kwargs):
"""
Materializes images into gbdx user buckets in s3.
Note: This method is only available to RDA based image classes.
Args:
node (str): the node in the graph to materiali... | [
"Materializes",
"images",
"into",
"gbdx",
"user",
"buckets",
"in",
"s3",
".",
"Note",
":",
"This",
"method",
"is",
"only",
"available",
"to",
"RDA",
"based",
"image",
"classes",
"."
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/images/rda_image.py#L177-L196 | [
"def",
"materialize",
"(",
"self",
",",
"node",
"=",
"None",
",",
"bounds",
"=",
"None",
",",
"callback",
"=",
"None",
",",
"out_format",
"=",
"'TILE_STREAM'",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
".",
"update",
"(",
"{",
"\"node\"",
":",
"no... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | TaskRegistry.list | Lists available and visible GBDX tasks.
Returns:
List of tasks | gbdxtools/task_registry.py | def list(self):
"""Lists available and visible GBDX tasks.
Returns:
List of tasks
"""
r = self.gbdx_connection.get(self._base_url)
raise_for_status(r)
return r.json()['tasks'] | def list(self):
"""Lists available and visible GBDX tasks.
Returns:
List of tasks
"""
r = self.gbdx_connection.get(self._base_url)
raise_for_status(r)
return r.json()['tasks'] | [
"Lists",
"available",
"and",
"visible",
"GBDX",
"tasks",
"."
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/task_registry.py#L31-L40 | [
"def",
"list",
"(",
"self",
")",
":",
"r",
"=",
"self",
".",
"gbdx_connection",
".",
"get",
"(",
"self",
".",
"_base_url",
")",
"raise_for_status",
"(",
"r",
")",
"return",
"r",
".",
"json",
"(",
")",
"[",
"'tasks'",
"]"
] | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | TaskRegistry.register | Registers a new GBDX task.
Args:
task_json (dict): Dictionary representing task definition.
json_filename (str): A full path of a file with json representing the task definition.
Only one out of task_json and json_filename should be provided.
Returns:
Res... | gbdxtools/task_registry.py | def register(self, task_json=None, json_filename=None):
"""Registers a new GBDX task.
Args:
task_json (dict): Dictionary representing task definition.
json_filename (str): A full path of a file with json representing the task definition.
Only one out of task_json and... | def register(self, task_json=None, json_filename=None):
"""Registers a new GBDX task.
Args:
task_json (dict): Dictionary representing task definition.
json_filename (str): A full path of a file with json representing the task definition.
Only one out of task_json and... | [
"Registers",
"a",
"new",
"GBDX",
"task",
"."
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/task_registry.py#L42-L64 | [
"def",
"register",
"(",
"self",
",",
"task_json",
"=",
"None",
",",
"json_filename",
"=",
"None",
")",
":",
"if",
"not",
"task_json",
"and",
"not",
"json_filename",
":",
"raise",
"Exception",
"(",
"\"Both task json and filename can't be none.\"",
")",
"if",
"tas... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | TaskRegistry.get_definition | Gets definition of a registered GBDX task.
Args:
task_name (str): Task name.
Returns:
Dictionary representing the task definition. | gbdxtools/task_registry.py | def get_definition(self, task_name):
"""Gets definition of a registered GBDX task.
Args:
task_name (str): Task name.
Returns:
Dictionary representing the task definition.
"""
r = self.gbdx_connection.get(self._base_url + '/' + task_name)
raise_fo... | def get_definition(self, task_name):
"""Gets definition of a registered GBDX task.
Args:
task_name (str): Task name.
Returns:
Dictionary representing the task definition.
"""
r = self.gbdx_connection.get(self._base_url + '/' + task_name)
raise_fo... | [
"Gets",
"definition",
"of",
"a",
"registered",
"GBDX",
"task",
"."
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/task_registry.py#L66-L78 | [
"def",
"get_definition",
"(",
"self",
",",
"task_name",
")",
":",
"r",
"=",
"self",
".",
"gbdx_connection",
".",
"get",
"(",
"self",
".",
"_base_url",
"+",
"'/'",
"+",
"task_name",
")",
"raise_for_status",
"(",
"r",
")",
"return",
"r",
".",
"json",
"("... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | TaskRegistry.delete | Deletes a GBDX task.
Args:
task_name (str): Task name.
Returns:
Response (str). | gbdxtools/task_registry.py | def delete(self, task_name):
"""Deletes a GBDX task.
Args:
task_name (str): Task name.
Returns:
Response (str).
"""
r = self.gbdx_connection.delete(self._base_url + '/' + task_name)
raise_for_status(r)
return r.text | def delete(self, task_name):
"""Deletes a GBDX task.
Args:
task_name (str): Task name.
Returns:
Response (str).
"""
r = self.gbdx_connection.delete(self._base_url + '/' + task_name)
raise_for_status(r)
return r.text | [
"Deletes",
"a",
"GBDX",
"task",
"."
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/task_registry.py#L80-L92 | [
"def",
"delete",
"(",
"self",
",",
"task_name",
")",
":",
"r",
"=",
"self",
".",
"gbdx_connection",
".",
"delete",
"(",
"self",
".",
"_base_url",
"+",
"'/'",
"+",
"task_name",
")",
"raise_for_status",
"(",
"r",
")",
"return",
"r",
".",
"text"
] | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | TaskRegistry.update | Updates a GBDX task.
Args:
task_name (str): Task name.
task_json (dict): Dictionary representing updated task definition.
Returns:
Dictionary representing the updated task definition. | gbdxtools/task_registry.py | def update(self, task_name, task_json):
"""Updates a GBDX task.
Args:
task_name (str): Task name.
task_json (dict): Dictionary representing updated task definition.
Returns:
Dictionary representing the updated task definition.
"""
r = self.gb... | def update(self, task_name, task_json):
"""Updates a GBDX task.
Args:
task_name (str): Task name.
task_json (dict): Dictionary representing updated task definition.
Returns:
Dictionary representing the updated task definition.
"""
r = self.gb... | [
"Updates",
"a",
"GBDX",
"task",
"."
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/task_registry.py#L94-L107 | [
"def",
"update",
"(",
"self",
",",
"task_name",
",",
"task_json",
")",
":",
"r",
"=",
"self",
".",
"gbdx_connection",
".",
"put",
"(",
"self",
".",
"_base_url",
"+",
"'/'",
"+",
"task_name",
",",
"json",
"=",
"task_json",
")",
"raise_for_status",
"(",
... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | to_geotiff | Write out a geotiff file of the image
Args:
path (str): path to write the geotiff file to, default is ./output.tif
proj (str): EPSG string of projection to reproject to
spec (str): if set to 'rgb', write out color-balanced 8-bit RGB tif
bands (list): list of bands to export. If spec... | gbdxtools/rda/io.py | def to_geotiff(arr, path='./output.tif', proj=None, spec=None, bands=None, **kwargs):
''' Write out a geotiff file of the image
Args:
path (str): path to write the geotiff file to, default is ./output.tif
proj (str): EPSG string of projection to reproject to
spec (str): if set to 'rgb',... | def to_geotiff(arr, path='./output.tif', proj=None, spec=None, bands=None, **kwargs):
''' Write out a geotiff file of the image
Args:
path (str): path to write the geotiff file to, default is ./output.tif
proj (str): EPSG string of projection to reproject to
spec (str): if set to 'rgb',... | [
"Write",
"out",
"a",
"geotiff",
"file",
"of",
"the",
"image"
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/rda/io.py#L27-L91 | [
"def",
"to_geotiff",
"(",
"arr",
",",
"path",
"=",
"'./output.tif'",
",",
"proj",
"=",
"None",
",",
"spec",
"=",
"None",
",",
"bands",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"assert",
"has_rasterio",
",",
"\"To create geotiff images please install r... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | Recipe.ingest_vectors | append two required tasks to the given output to ingest to VS | gbdxtools/simple_answerfactory.py | def ingest_vectors(self, output_port_value):
''' append two required tasks to the given output to ingest to VS
'''
# append two tasks to self['definition']['tasks']
ingest_task = Task('IngestItemJsonToVectorServices')
ingest_task.inputs.items = output_port_value
ingest_ta... | def ingest_vectors(self, output_port_value):
''' append two required tasks to the given output to ingest to VS
'''
# append two tasks to self['definition']['tasks']
ingest_task = Task('IngestItemJsonToVectorServices')
ingest_task.inputs.items = output_port_value
ingest_ta... | [
"append",
"two",
"required",
"tasks",
"to",
"the",
"given",
"output",
"to",
"ingest",
"to",
"VS"
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/simple_answerfactory.py#L550-L563 | [
"def",
"ingest_vectors",
"(",
"self",
",",
"output_port_value",
")",
":",
"# append two tasks to self['definition']['tasks']",
"ingest_task",
"=",
"Task",
"(",
"'IngestItemJsonToVectorServices'",
")",
"ingest_task",
".",
"inputs",
".",
"items",
"=",
"output_port_value",
"... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | Recipe.get | Retrieves an AnswerFactory Recipe by id
Args:
recipe_id The id of the recipe
Returns:
A JSON representation of the recipe | gbdxtools/answerfactory.py | def get(self, recipe_id):
'''
Retrieves an AnswerFactory Recipe by id
Args:
recipe_id The id of the recipe
Returns:
A JSON representation of the recipe
'''
self.logger.debug('Retrieving recipe by id: ' + recipe_id)
url = '%(base_url)s/rec... | def get(self, recipe_id):
'''
Retrieves an AnswerFactory Recipe by id
Args:
recipe_id The id of the recipe
Returns:
A JSON representation of the recipe
'''
self.logger.debug('Retrieving recipe by id: ' + recipe_id)
url = '%(base_url)s/rec... | [
"Retrieves",
"an",
"AnswerFactory",
"Recipe",
"by",
"id"
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/answerfactory.py#L32-L48 | [
"def",
"get",
"(",
"self",
",",
"recipe_id",
")",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"'Retrieving recipe by id: '",
"+",
"recipe_id",
")",
"url",
"=",
"'%(base_url)s/recipe/%(recipe_id)s'",
"%",
"{",
"'base_url'",
":",
"self",
".",
"base_url",
",",... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | Recipe.save | Saves an AnswerFactory Recipe
Args:
recipe (dict): Dictionary specifying a recipe
Returns:
AnswerFactory Recipe id | gbdxtools/answerfactory.py | def save(self, recipe):
'''
Saves an AnswerFactory Recipe
Args:
recipe (dict): Dictionary specifying a recipe
Returns:
AnswerFactory Recipe id
'''
# test if this is a create vs. an update
if 'id' in recipe and recipe['id'] is not None:
... | def save(self, recipe):
'''
Saves an AnswerFactory Recipe
Args:
recipe (dict): Dictionary specifying a recipe
Returns:
AnswerFactory Recipe id
'''
# test if this is a create vs. an update
if 'id' in recipe and recipe['id'] is not None:
... | [
"Saves",
"an",
"AnswerFactory",
"Recipe"
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/answerfactory.py#L68-L105 | [
"def",
"save",
"(",
"self",
",",
"recipe",
")",
":",
"# test if this is a create vs. an update",
"if",
"'id'",
"in",
"recipe",
"and",
"recipe",
"[",
"'id'",
"]",
"is",
"not",
"None",
":",
"# update -> use put op",
"self",
".",
"logger",
".",
"debug",
"(",
"\... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | Project.save | Saves an AnswerFactory Project
Args:
project (dict): Dictionary specifying an AnswerFactory Project.
Returns:
AnswerFactory Project id | gbdxtools/answerfactory.py | def save(self, project):
'''
Saves an AnswerFactory Project
Args:
project (dict): Dictionary specifying an AnswerFactory Project.
Returns:
AnswerFactory Project id
'''
# test if this is a create vs. an update
if 'id' in project and proje... | def save(self, project):
'''
Saves an AnswerFactory Project
Args:
project (dict): Dictionary specifying an AnswerFactory Project.
Returns:
AnswerFactory Project id
'''
# test if this is a create vs. an update
if 'id' in project and proje... | [
"Saves",
"an",
"AnswerFactory",
"Project"
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/answerfactory.py#L160-L198 | [
"def",
"save",
"(",
"self",
",",
"project",
")",
":",
"# test if this is a create vs. an update",
"if",
"'id'",
"in",
"project",
"and",
"project",
"[",
"'id'",
"]",
"is",
"not",
"None",
":",
"# update -> use put op",
"self",
".",
"logger",
".",
"debug",
"(",
... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | Project.delete | Deletes a project by id
Args:
project_id: The project id to delete
Returns:
Nothing | gbdxtools/answerfactory.py | def delete(self, project_id):
'''
Deletes a project by id
Args:
project_id: The project id to delete
Returns:
Nothing
'''
self.logger.debug('Deleting project by id: ' + project_id)
url = '%(base_url)s/%(project_id)s' % {
'ba... | def delete(self, project_id):
'''
Deletes a project by id
Args:
project_id: The project id to delete
Returns:
Nothing
'''
self.logger.debug('Deleting project by id: ' + project_id)
url = '%(base_url)s/%(project_id)s' % {
'ba... | [
"Deletes",
"a",
"project",
"by",
"id"
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/answerfactory.py#L200-L215 | [
"def",
"delete",
"(",
"self",
",",
"project_id",
")",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"'Deleting project by id: '",
"+",
"project_id",
")",
"url",
"=",
"'%(base_url)s/%(project_id)s'",
"%",
"{",
"'base_url'",
":",
"self",
".",
"base_url",
",",
... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | LineStyle.paint | Renders a javascript snippet suitable for use as a mapbox-gl line paint entry
Returns:
A dict that can be converted to a mapbox-gl javascript paint snippet | gbdxtools/vector_styles.py | def paint(self):
"""
Renders a javascript snippet suitable for use as a mapbox-gl line paint entry
Returns:
A dict that can be converted to a mapbox-gl javascript paint snippet
"""
# TODO Figure out why i cant use some of these props
snippet = {
'... | def paint(self):
"""
Renders a javascript snippet suitable for use as a mapbox-gl line paint entry
Returns:
A dict that can be converted to a mapbox-gl javascript paint snippet
"""
# TODO Figure out why i cant use some of these props
snippet = {
'... | [
"Renders",
"a",
"javascript",
"snippet",
"suitable",
"for",
"use",
"as",
"a",
"mapbox",
"-",
"gl",
"line",
"paint",
"entry"
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/vector_styles.py#L120-L143 | [
"def",
"paint",
"(",
"self",
")",
":",
"# TODO Figure out why i cant use some of these props",
"snippet",
"=",
"{",
"'line-opacity'",
":",
"VectorStyle",
".",
"get_style_value",
"(",
"self",
".",
"opacity",
")",
",",
"'line-color'",
":",
"VectorStyle",
".",
"get_sty... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | FillStyle.paint | Renders a javascript snippet suitable for use as a mapbox-gl fill paint entry
Returns:
A dict that can be converted to a mapbox-gl javascript paint snippet | gbdxtools/vector_styles.py | def paint(self):
"""
Renders a javascript snippet suitable for use as a mapbox-gl fill paint entry
Returns:
A dict that can be converted to a mapbox-gl javascript paint snippet
"""
snippet = {
'fill-opacity': VectorStyle.get_style_value(self.opacity),
... | def paint(self):
"""
Renders a javascript snippet suitable for use as a mapbox-gl fill paint entry
Returns:
A dict that can be converted to a mapbox-gl javascript paint snippet
"""
snippet = {
'fill-opacity': VectorStyle.get_style_value(self.opacity),
... | [
"Renders",
"a",
"javascript",
"snippet",
"suitable",
"for",
"use",
"as",
"a",
"mapbox",
"-",
"gl",
"fill",
"paint",
"entry"
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/vector_styles.py#L174-L189 | [
"def",
"paint",
"(",
"self",
")",
":",
"snippet",
"=",
"{",
"'fill-opacity'",
":",
"VectorStyle",
".",
"get_style_value",
"(",
"self",
".",
"opacity",
")",
",",
"'fill-color'",
":",
"VectorStyle",
".",
"get_style_value",
"(",
"self",
".",
"color",
")",
","... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | FillExtrusionStyle.paint | Renders a javascript snippet suitable for use as a mapbox-gl fill-extrusion paint entry
Returns:
A dict that can be converted to a mapbox-gl javascript paint snippet | gbdxtools/vector_styles.py | def paint(self):
"""
Renders a javascript snippet suitable for use as a mapbox-gl fill-extrusion paint entry
Returns:
A dict that can be converted to a mapbox-gl javascript paint snippet
"""
snippet = {
'fill-extrusion-opacity': VectorStyle.get_style_valu... | def paint(self):
"""
Renders a javascript snippet suitable for use as a mapbox-gl fill-extrusion paint entry
Returns:
A dict that can be converted to a mapbox-gl javascript paint snippet
"""
snippet = {
'fill-extrusion-opacity': VectorStyle.get_style_valu... | [
"Renders",
"a",
"javascript",
"snippet",
"suitable",
"for",
"use",
"as",
"a",
"mapbox",
"-",
"gl",
"fill",
"-",
"extrusion",
"paint",
"entry"
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/vector_styles.py#L216-L232 | [
"def",
"paint",
"(",
"self",
")",
":",
"snippet",
"=",
"{",
"'fill-extrusion-opacity'",
":",
"VectorStyle",
".",
"get_style_value",
"(",
"self",
".",
"opacity",
")",
",",
"'fill-extrusion-color'",
":",
"VectorStyle",
".",
"get_style_value",
"(",
"self",
".",
"... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | HeatmapStyle.paint | Renders a javascript snippet suitable for use as a mapbox-gl heatmap paint entry
Returns:
A dict that can be converted to a mapbox-gl javascript paint snippet | gbdxtools/vector_styles.py | def paint(self):
"""
Renders a javascript snippet suitable for use as a mapbox-gl heatmap paint entry
Returns:
A dict that can be converted to a mapbox-gl javascript paint snippet
"""
snippet = {
'heatmap-radius': VectorStyle.get_style_value(self.radius),... | def paint(self):
"""
Renders a javascript snippet suitable for use as a mapbox-gl heatmap paint entry
Returns:
A dict that can be converted to a mapbox-gl javascript paint snippet
"""
snippet = {
'heatmap-radius': VectorStyle.get_style_value(self.radius),... | [
"Renders",
"a",
"javascript",
"snippet",
"suitable",
"for",
"use",
"as",
"a",
"mapbox",
"-",
"gl",
"heatmap",
"paint",
"entry"
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/vector_styles.py#L278-L293 | [
"def",
"paint",
"(",
"self",
")",
":",
"snippet",
"=",
"{",
"'heatmap-radius'",
":",
"VectorStyle",
".",
"get_style_value",
"(",
"self",
".",
"radius",
")",
",",
"'heatmap-opacity'",
":",
"VectorStyle",
".",
"get_style_value",
"(",
"self",
".",
"opacity",
")... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | Vectors.create | Create a vectors in the vector service.
Args:
vectors: A single geojson vector or a list of geojson vectors. Item_type and ingest_source are required.
Returns:
(list): IDs of the vectors created
Example:
>>> vectors.create(
... {
... | gbdxtools/vectors.py | def create(self,vectors):
""" Create a vectors in the vector service.
Args:
vectors: A single geojson vector or a list of geojson vectors. Item_type and ingest_source are required.
Returns:
(list): IDs of the vectors created
Example:
>>> vectors.cre... | def create(self,vectors):
""" Create a vectors in the vector service.
Args:
vectors: A single geojson vector or a list of geojson vectors. Item_type and ingest_source are required.
Returns:
(list): IDs of the vectors created
Example:
>>> vectors.cre... | [
"Create",
"a",
"vectors",
"in",
"the",
"vector",
"service",
"."
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/vectors.py#L53-L101 | [
"def",
"create",
"(",
"self",
",",
"vectors",
")",
":",
"if",
"type",
"(",
"vectors",
")",
"is",
"dict",
":",
"vectors",
"=",
"[",
"vectors",
"]",
"# validate they all have item_type and ingest_source in properties",
"for",
"vector",
"in",
"vectors",
":",
"if",
... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | Vectors.create_from_wkt | Create a single vector in the vector service
Args:
wkt (str): wkt representation of the geometry
item_type (str): item_type of the vector
ingest_source (str): source of the vector
attributes: a set of key-value pairs of attributes
Returns:
id... | gbdxtools/vectors.py | def create_from_wkt(self, wkt, item_type, ingest_source, **attributes):
'''
Create a single vector in the vector service
Args:
wkt (str): wkt representation of the geometry
item_type (str): item_type of the vector
ingest_source (str): source of the vector
... | def create_from_wkt(self, wkt, item_type, ingest_source, **attributes):
'''
Create a single vector in the vector service
Args:
wkt (str): wkt representation of the geometry
item_type (str): item_type of the vector
ingest_source (str): source of the vector
... | [
"Create",
"a",
"single",
"vector",
"in",
"the",
"vector",
"service"
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/vectors.py#L103-L129 | [
"def",
"create_from_wkt",
"(",
"self",
",",
"wkt",
",",
"item_type",
",",
"ingest_source",
",",
"*",
"*",
"attributes",
")",
":",
"# verify the \"depth\" of the attributes is single layer",
"geojson",
"=",
"load_wkt",
"(",
"wkt",
")",
".",
"__geo_interface__",
"vect... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | Vectors.get | Retrieves a vector. Not usually necessary because searching is the best way to find & get stuff.
Args:
ID (str): ID of the vector object
index (str): Optional. Index the object lives in. defaults to 'vector-web-s'
Returns:
record (dict): A dict object identical t... | gbdxtools/vectors.py | def get(self, ID, index='vector-web-s'):
'''Retrieves a vector. Not usually necessary because searching is the best way to find & get stuff.
Args:
ID (str): ID of the vector object
index (str): Optional. Index the object lives in. defaults to 'vector-web-s'
Returns:
... | def get(self, ID, index='vector-web-s'):
'''Retrieves a vector. Not usually necessary because searching is the best way to find & get stuff.
Args:
ID (str): ID of the vector object
index (str): Optional. Index the object lives in. defaults to 'vector-web-s'
Returns:
... | [
"Retrieves",
"a",
"vector",
".",
"Not",
"usually",
"necessary",
"because",
"searching",
"is",
"the",
"best",
"way",
"to",
"find",
"&",
"get",
"stuff",
"."
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/vectors.py#L132-L146 | [
"def",
"get",
"(",
"self",
",",
"ID",
",",
"index",
"=",
"'vector-web-s'",
")",
":",
"url",
"=",
"self",
".",
"get_url",
"%",
"index",
"r",
"=",
"self",
".",
"gbdx_connection",
".",
"get",
"(",
"url",
"+",
"ID",
")",
"r",
".",
"raise_for_status",
"... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | Vectors.query | Perform a vector services query using the QUERY API
(https://gbdxdocs.digitalglobe.com/docs/vs-query-list-vector-items-returns-default-fields)
Args:
searchAreaWkt: WKT Polygon of area to search
query: Elastic Search query
count: Maximum number of results to return
... | gbdxtools/vectors.py | def query(self, searchAreaWkt, query, count=100, ttl='5m', index=default_index):
'''
Perform a vector services query using the QUERY API
(https://gbdxdocs.digitalglobe.com/docs/vs-query-list-vector-items-returns-default-fields)
Args:
searchAreaWkt: WKT Polygon of area to sea... | def query(self, searchAreaWkt, query, count=100, ttl='5m', index=default_index):
'''
Perform a vector services query using the QUERY API
(https://gbdxdocs.digitalglobe.com/docs/vs-query-list-vector-items-returns-default-fields)
Args:
searchAreaWkt: WKT Polygon of area to sea... | [
"Perform",
"a",
"vector",
"services",
"query",
"using",
"the",
"QUERY",
"API",
"(",
"https",
":",
"//",
"gbdxdocs",
".",
"digitalglobe",
".",
"com",
"/",
"docs",
"/",
"vs",
"-",
"query",
"-",
"list",
"-",
"vector",
"-",
"items",
"-",
"returns",
"-",
... | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/vectors.py#L149-L183 | [
"def",
"query",
"(",
"self",
",",
"searchAreaWkt",
",",
"query",
",",
"count",
"=",
"100",
",",
"ttl",
"=",
"'5m'",
",",
"index",
"=",
"default_index",
")",
":",
"if",
"count",
"<",
"1000",
":",
"# issue a single page query",
"search_area_polygon",
"=",
"f... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | Vectors.query_iteratively | Perform a vector services query using the QUERY API
(https://gbdxdocs.digitalglobe.com/docs/vs-query-list-vector-items-returns-default-fields)
Args:
searchAreaWkt: WKT Polygon of area to search
query: Elastic Search query
count: Maximum number of results to return
... | gbdxtools/vectors.py | def query_iteratively(self, searchAreaWkt, query, count=100, ttl='5m', index=default_index):
'''
Perform a vector services query using the QUERY API
(https://gbdxdocs.digitalglobe.com/docs/vs-query-list-vector-items-returns-default-fields)
Args:
searchAreaWkt: WKT Polygon of... | def query_iteratively(self, searchAreaWkt, query, count=100, ttl='5m', index=default_index):
'''
Perform a vector services query using the QUERY API
(https://gbdxdocs.digitalglobe.com/docs/vs-query-list-vector-items-returns-default-fields)
Args:
searchAreaWkt: WKT Polygon of... | [
"Perform",
"a",
"vector",
"services",
"query",
"using",
"the",
"QUERY",
"API",
"(",
"https",
":",
"//",
"gbdxdocs",
".",
"digitalglobe",
".",
"com",
"/",
"docs",
"/",
"vs",
"-",
"query",
"-",
"list",
"-",
"vector",
"-",
"items",
"-",
"returns",
"-",
... | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/vectors.py#L186-L254 | [
"def",
"query_iteratively",
"(",
"self",
",",
"searchAreaWkt",
",",
"query",
",",
"count",
"=",
"100",
",",
"ttl",
"=",
"'5m'",
",",
"index",
"=",
"default_index",
")",
":",
"search_area_polygon",
"=",
"from_wkt",
"(",
"searchAreaWkt",
")",
"left",
",",
"l... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | Vectors.aggregate_query | Aggregates results of a query into buckets defined by the 'agg_def' parameter. The aggregations are
represented by dicts containing a 'name' key and a 'terms' key holding a list of the aggregation buckets.
Each bucket element is a dict containing a 'term' key containing the term used for this bucket, a... | gbdxtools/vectors.py | def aggregate_query(self, searchAreaWkt, agg_def, query=None, start_date=None, end_date=None, count=10, index=default_index):
"""Aggregates results of a query into buckets defined by the 'agg_def' parameter. The aggregations are
represented by dicts containing a 'name' key and a 'terms' key holding a l... | def aggregate_query(self, searchAreaWkt, agg_def, query=None, start_date=None, end_date=None, count=10, index=default_index):
"""Aggregates results of a query into buckets defined by the 'agg_def' parameter. The aggregations are
represented by dicts containing a 'name' key and a 'terms' key holding a l... | [
"Aggregates",
"results",
"of",
"a",
"query",
"into",
"buckets",
"defined",
"by",
"the",
"agg_def",
"parameter",
".",
"The",
"aggregations",
"are",
"represented",
"by",
"dicts",
"containing",
"a",
"name",
"key",
"and",
"a",
"terms",
"key",
"holding",
"a",
"li... | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/vectors.py#L256-L296 | [
"def",
"aggregate_query",
"(",
"self",
",",
"searchAreaWkt",
",",
"agg_def",
",",
"query",
"=",
"None",
",",
"start_date",
"=",
"None",
",",
"end_date",
"=",
"None",
",",
"count",
"=",
"10",
",",
"index",
"=",
"default_index",
")",
":",
"geojson",
"=",
... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | Vectors.tilemap | Renders a mapbox gl map from a vector service query | gbdxtools/vectors.py | def tilemap(self, query, styles={}, bbox=[-180,-90,180,90], zoom=16,
api_key=os.environ.get('MAPBOX_API_KEY', None),
image=None, image_bounds=None,
index="vector-user-provided", name="GBDX_Task_Output", **kwargs):
"""
Renders a mapbox... | def tilemap(self, query, styles={}, bbox=[-180,-90,180,90], zoom=16,
api_key=os.environ.get('MAPBOX_API_KEY', None),
image=None, image_bounds=None,
index="vector-user-provided", name="GBDX_Task_Output", **kwargs):
"""
Renders a mapbox... | [
"Renders",
"a",
"mapbox",
"gl",
"map",
"from",
"a",
"vector",
"service",
"query"
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/vectors.py#L298-L339 | [
"def",
"tilemap",
"(",
"self",
",",
"query",
",",
"styles",
"=",
"{",
"}",
",",
"bbox",
"=",
"[",
"-",
"180",
",",
"-",
"90",
",",
"180",
",",
"90",
"]",
",",
"zoom",
"=",
"16",
",",
"api_key",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"'... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | Vectors.map | Renders a mapbox gl map from a vector service query or a list of geojson features
Args:
features (list): a list of geojson features
query (str): a VectorServices query
styles (list): a list of VectorStyles to apply to the features
bbox (list): a bounding box... | gbdxtools/vectors.py | def map(self, features=None, query=None, styles=None,
bbox=[-180,-90,180,90], zoom=10, center=None,
image=None, image_bounds=None, cmap='viridis',
api_key=os.environ.get('MAPBOX_API_KEY', None), **kwargs):
"""
Renders a mapbox gl map from a vector... | def map(self, features=None, query=None, styles=None,
bbox=[-180,-90,180,90], zoom=10, center=None,
image=None, image_bounds=None, cmap='viridis',
api_key=os.environ.get('MAPBOX_API_KEY', None), **kwargs):
"""
Renders a mapbox gl map from a vector... | [
"Renders",
"a",
"mapbox",
"gl",
"map",
"from",
"a",
"vector",
"service",
"query",
"or",
"a",
"list",
"of",
"geojson",
"features"
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/vectors.py#L342-L407 | [
"def",
"map",
"(",
"self",
",",
"features",
"=",
"None",
",",
"query",
"=",
"None",
",",
"styles",
"=",
"None",
",",
"bbox",
"=",
"[",
"-",
"180",
",",
"-",
"90",
",",
"180",
",",
"90",
"]",
",",
"zoom",
"=",
"10",
",",
"center",
"=",
"None",... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | DaskImage.read | Reads data from a dask array and returns the computed ndarray matching the given bands
Args:
bands (list): band indices to read from the image. Returns bands in the order specified in the list of bands.
Returns:
ndarray: a numpy array of image data | gbdxtools/images/meta.py | def read(self, bands=None, **kwargs):
"""Reads data from a dask array and returns the computed ndarray matching the given bands
Args:
bands (list): band indices to read from the image. Returns bands in the order specified in the list of bands.
Returns:
ndarray: a numpy ... | def read(self, bands=None, **kwargs):
"""Reads data from a dask array and returns the computed ndarray matching the given bands
Args:
bands (list): band indices to read from the image. Returns bands in the order specified in the list of bands.
Returns:
ndarray: a numpy ... | [
"Reads",
"data",
"from",
"a",
"dask",
"array",
"and",
"returns",
"the",
"computed",
"ndarray",
"matching",
"the",
"given",
"bands"
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/images/meta.py#L77-L89 | [
"def",
"read",
"(",
"self",
",",
"bands",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"arr",
"=",
"self",
"if",
"bands",
"is",
"not",
"None",
":",
"arr",
"=",
"self",
"[",
"bands",
",",
"...",
"]",
"return",
"arr",
".",
"compute",
"(",
"sch... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | DaskImage.randwindow | Get a random window of a given shape from within an image
Args:
window_shape (tuple): The desired shape of the returned image as (height, width) in pixels.
Returns:
image: a new image object of the specified shape and same type | gbdxtools/images/meta.py | def randwindow(self, window_shape):
"""Get a random window of a given shape from within an image
Args:
window_shape (tuple): The desired shape of the returned image as (height, width) in pixels.
Returns:
image: a new image object of the specified shape and same type
... | def randwindow(self, window_shape):
"""Get a random window of a given shape from within an image
Args:
window_shape (tuple): The desired shape of the returned image as (height, width) in pixels.
Returns:
image: a new image object of the specified shape and same type
... | [
"Get",
"a",
"random",
"window",
"of",
"a",
"given",
"shape",
"from",
"within",
"an",
"image"
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/images/meta.py#L91-L102 | [
"def",
"randwindow",
"(",
"self",
",",
"window_shape",
")",
":",
"row",
"=",
"random",
".",
"randrange",
"(",
"window_shape",
"[",
"0",
"]",
",",
"self",
".",
"shape",
"[",
"1",
"]",
")",
"col",
"=",
"random",
".",
"randrange",
"(",
"window_shape",
"... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | DaskImage.iterwindows | Iterate over random windows of an image
Args:
count (int): the number of the windows to generate. Defaults to 64, if `None` will continue to iterate over random windows until stopped.
window_shape (tuple): The desired shape of each image as (height, width) in pixels.
Yields:
... | gbdxtools/images/meta.py | def iterwindows(self, count=64, window_shape=(256, 256)):
""" Iterate over random windows of an image
Args:
count (int): the number of the windows to generate. Defaults to 64, if `None` will continue to iterate over random windows until stopped.
window_shape (tuple): The desired... | def iterwindows(self, count=64, window_shape=(256, 256)):
""" Iterate over random windows of an image
Args:
count (int): the number of the windows to generate. Defaults to 64, if `None` will continue to iterate over random windows until stopped.
window_shape (tuple): The desired... | [
"Iterate",
"over",
"random",
"windows",
"of",
"an",
"image"
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/images/meta.py#L104-L119 | [
"def",
"iterwindows",
"(",
"self",
",",
"count",
"=",
"64",
",",
"window_shape",
"=",
"(",
"256",
",",
"256",
")",
")",
":",
"if",
"count",
"is",
"None",
":",
"while",
"True",
":",
"yield",
"self",
".",
"randwindow",
"(",
"window_shape",
")",
"else",... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | DaskImage.window_at | Return a subsetted window of a given size, centered on a geometry object
Useful for generating training sets from vector training data
Will throw a ValueError if the window is not within the image bounds
Args:
geom (shapely,geometry): Geometry to center the image on
win... | gbdxtools/images/meta.py | def window_at(self, geom, window_shape):
"""Return a subsetted window of a given size, centered on a geometry object
Useful for generating training sets from vector training data
Will throw a ValueError if the window is not within the image bounds
Args:
geom (shapely,geomet... | def window_at(self, geom, window_shape):
"""Return a subsetted window of a given size, centered on a geometry object
Useful for generating training sets from vector training data
Will throw a ValueError if the window is not within the image bounds
Args:
geom (shapely,geomet... | [
"Return",
"a",
"subsetted",
"window",
"of",
"a",
"given",
"size",
"centered",
"on",
"a",
"geometry",
"object"
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/images/meta.py#L121-L145 | [
"def",
"window_at",
"(",
"self",
",",
"geom",
",",
"window_shape",
")",
":",
"# Centroids of the input geometry may not be centered on the object.",
"# For a covering image we use the bounds instead.",
"# This is also a workaround for issue 387.",
"y_size",
",",
"x_size",
"=",
"win... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | DaskImage.window_cover | Iterate over a grid of windows of a specified shape covering an image.
The image is divided into a grid of tiles of size window_shape. Each iteration returns
the next window.
Args:
window_shape (tuple): The desired shape of each image as (height,
width) in pixels.
... | gbdxtools/images/meta.py | def window_cover(self, window_shape, pad=True):
""" Iterate over a grid of windows of a specified shape covering an image.
The image is divided into a grid of tiles of size window_shape. Each iteration returns
the next window.
Args:
window_shape (tuple): The desired shape ... | def window_cover(self, window_shape, pad=True):
""" Iterate over a grid of windows of a specified shape covering an image.
The image is divided into a grid of tiles of size window_shape. Each iteration returns
the next window.
Args:
window_shape (tuple): The desired shape ... | [
"Iterate",
"over",
"a",
"grid",
"of",
"windows",
"of",
"a",
"specified",
"shape",
"covering",
"an",
"image",
"."
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/images/meta.py#L147-L188 | [
"def",
"window_cover",
"(",
"self",
",",
"window_shape",
",",
"pad",
"=",
"True",
")",
":",
"size_y",
",",
"size_x",
"=",
"window_shape",
"[",
"0",
"]",
",",
"window_shape",
"[",
"1",
"]",
"_ndepth",
",",
"_nheight",
",",
"_nwidth",
"=",
"self",
".",
... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | GeoDaskImage.aoi | Subsets the Image by the given bounds
Args:
bbox (list): optional. A bounding box array [minx, miny, maxx, maxy]
wkt (str): optional. A WKT geometry string
geojson (str): optional. A GeoJSON geometry dictionary
Returns:
image: an image instance of the sa... | gbdxtools/images/meta.py | def aoi(self, **kwargs):
""" Subsets the Image by the given bounds
Args:
bbox (list): optional. A bounding box array [minx, miny, maxx, maxy]
wkt (str): optional. A WKT geometry string
geojson (str): optional. A GeoJSON geometry dictionary
Returns:
... | def aoi(self, **kwargs):
""" Subsets the Image by the given bounds
Args:
bbox (list): optional. A bounding box array [minx, miny, maxx, maxy]
wkt (str): optional. A WKT geometry string
geojson (str): optional. A GeoJSON geometry dictionary
Returns:
... | [
"Subsets",
"the",
"Image",
"by",
"the",
"given",
"bounds"
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/images/meta.py#L243-L258 | [
"def",
"aoi",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"g",
"=",
"self",
".",
"_parse_geoms",
"(",
"*",
"*",
"kwargs",
")",
"if",
"g",
"is",
"None",
":",
"return",
"self",
"else",
":",
"return",
"self",
"[",
"g",
"]"
] | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | GeoDaskImage.pxbounds | Returns the bounds of a geometry object in pixel coordinates
Args:
geom: Shapely geometry object or GeoJSON as Python dictionary or WKT string
clip (bool): Clip the bounds to the min/max extent of the image
Returns:
list: bounds in pixels [min x, min y, max x, max y... | gbdxtools/images/meta.py | def pxbounds(self, geom, clip=False):
""" Returns the bounds of a geometry object in pixel coordinates
Args:
geom: Shapely geometry object or GeoJSON as Python dictionary or WKT string
clip (bool): Clip the bounds to the min/max extent of the image
Returns:
... | def pxbounds(self, geom, clip=False):
""" Returns the bounds of a geometry object in pixel coordinates
Args:
geom: Shapely geometry object or GeoJSON as Python dictionary or WKT string
clip (bool): Clip the bounds to the min/max extent of the image
Returns:
... | [
"Returns",
"the",
"bounds",
"of",
"a",
"geometry",
"object",
"in",
"pixel",
"coordinates"
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/images/meta.py#L260-L296 | [
"def",
"pxbounds",
"(",
"self",
",",
"geom",
",",
"clip",
"=",
"False",
")",
":",
"try",
":",
"if",
"isinstance",
"(",
"geom",
",",
"dict",
")",
":",
"if",
"'geometry'",
"in",
"geom",
":",
"geom",
"=",
"shape",
"(",
"geom",
"[",
"'geometry'",
"]",
... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | GeoDaskImage.geotiff | Creates a geotiff on the filesystem
Args:
path (str): optional, path to write the geotiff file to, default is ./output.tif
proj (str): optional, EPSG string of projection to reproject to
spec (str): optional, if set to 'rgb', write out color-balanced 8-bit RGB tif
... | gbdxtools/images/meta.py | def geotiff(self, **kwargs):
""" Creates a geotiff on the filesystem
Args:
path (str): optional, path to write the geotiff file to, default is ./output.tif
proj (str): optional, EPSG string of projection to reproject to
spec (str): optional, if set to 'rgb', write ou... | def geotiff(self, **kwargs):
""" Creates a geotiff on the filesystem
Args:
path (str): optional, path to write the geotiff file to, default is ./output.tif
proj (str): optional, EPSG string of projection to reproject to
spec (str): optional, if set to 'rgb', write ou... | [
"Creates",
"a",
"geotiff",
"on",
"the",
"filesystem"
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/images/meta.py#L298-L313 | [
"def",
"geotiff",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"'proj'",
"not",
"in",
"kwargs",
":",
"kwargs",
"[",
"'proj'",
"]",
"=",
"self",
".",
"proj",
"return",
"to_geotiff",
"(",
"self",
",",
"*",
"*",
"kwargs",
")"
] | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | GeoDaskImage.warp | Delayed warp across an entire AOI or Image
Creates a new dask image by deferring calls to the warp_geometry on chunks
Args:
dem (ndarray): optional. A DEM for warping to specific elevation planes
proj (str): optional. An EPSG proj string to project the image data into ("EPSG:32... | gbdxtools/images/meta.py | def warp(self, dem=None, proj="EPSG:4326", **kwargs):
"""Delayed warp across an entire AOI or Image
Creates a new dask image by deferring calls to the warp_geometry on chunks
Args:
dem (ndarray): optional. A DEM for warping to specific elevation planes
proj (str): optio... | def warp(self, dem=None, proj="EPSG:4326", **kwargs):
"""Delayed warp across an entire AOI or Image
Creates a new dask image by deferring calls to the warp_geometry on chunks
Args:
dem (ndarray): optional. A DEM for warping to specific elevation planes
proj (str): optio... | [
"Delayed",
"warp",
"across",
"an",
"entire",
"AOI",
"or",
"Image"
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/images/meta.py#L318-L406 | [
"def",
"warp",
"(",
"self",
",",
"dem",
"=",
"None",
",",
"proj",
"=",
"\"EPSG:4326\"",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"img_md",
"=",
"self",
".",
"rda",
".",
"metadata",
"[",
"\"image\"",
"]",
"x_size",
"=",
"img_md",
"[",
"\"tileX... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | GeoDaskImage._parse_geoms | Finds supported geometry types, parses them and returns the bbox | gbdxtools/images/meta.py | def _parse_geoms(self, **kwargs):
""" Finds supported geometry types, parses them and returns the bbox """
bbox = kwargs.get('bbox', None)
wkt_geom = kwargs.get('wkt', None)
geojson = kwargs.get('geojson', None)
if bbox is not None:
g = box(*bbox)
elif wkt_geo... | def _parse_geoms(self, **kwargs):
""" Finds supported geometry types, parses them and returns the bbox """
bbox = kwargs.get('bbox', None)
wkt_geom = kwargs.get('wkt', None)
geojson = kwargs.get('geojson', None)
if bbox is not None:
g = box(*bbox)
elif wkt_geo... | [
"Finds",
"supported",
"geometry",
"types",
"parses",
"them",
"and",
"returns",
"the",
"bbox"
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/images/meta.py#L451-L467 | [
"def",
"_parse_geoms",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"bbox",
"=",
"kwargs",
".",
"get",
"(",
"'bbox'",
",",
"None",
")",
"wkt_geom",
"=",
"kwargs",
".",
"get",
"(",
"'wkt'",
",",
"None",
")",
"geojson",
"=",
"kwargs",
".",
"get",
... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | load_url | Loads a geotiff url inside a thread and returns as an ndarray | gbdxtools/images/tms_image.py | def load_url(url, shape=(8, 256, 256)):
""" Loads a geotiff url inside a thread and returns as an ndarray """
thread_id = threading.current_thread().ident
_curl = _curl_pool[thread_id]
_curl.setopt(_curl.URL, url)
_curl.setopt(pycurl.NOSIGNAL, 1)
_, ext = os.path.splitext(urlparse(url).path)
... | def load_url(url, shape=(8, 256, 256)):
""" Loads a geotiff url inside a thread and returns as an ndarray """
thread_id = threading.current_thread().ident
_curl = _curl_pool[thread_id]
_curl.setopt(_curl.URL, url)
_curl.setopt(pycurl.NOSIGNAL, 1)
_, ext = os.path.splitext(urlparse(url).path)
... | [
"Loads",
"a",
"geotiff",
"url",
"inside",
"a",
"thread",
"and",
"returns",
"as",
"an",
"ndarray"
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/images/tms_image.py#L42-L68 | [
"def",
"load_url",
"(",
"url",
",",
"shape",
"=",
"(",
"8",
",",
"256",
",",
"256",
")",
")",
":",
"thread_id",
"=",
"threading",
".",
"current_thread",
"(",
")",
".",
"ident",
"_curl",
"=",
"_curl_pool",
"[",
"thread_id",
"]",
"_curl",
".",
"setopt"... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | TmsMeta._tile_coords | convert mercator bbox to tile index limits | gbdxtools/images/tms_image.py | def _tile_coords(self, bounds):
""" convert mercator bbox to tile index limits """
tfm = partial(pyproj.transform,
pyproj.Proj(init="epsg:3857"),
pyproj.Proj(init="epsg:4326"))
bounds = ops.transform(tfm, box(*bounds)).bounds
# because tiles h... | def _tile_coords(self, bounds):
""" convert mercator bbox to tile index limits """
tfm = partial(pyproj.transform,
pyproj.Proj(init="epsg:3857"),
pyproj.Proj(init="epsg:4326"))
bounds = ops.transform(tfm, box(*bounds)).bounds
# because tiles h... | [
"convert",
"mercator",
"bbox",
"to",
"tile",
"index",
"limits"
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/images/tms_image.py#L166-L195 | [
"def",
"_tile_coords",
"(",
"self",
",",
"bounds",
")",
":",
"tfm",
"=",
"partial",
"(",
"pyproj",
".",
"transform",
",",
"pyproj",
".",
"Proj",
"(",
"init",
"=",
"\"epsg:3857\"",
")",
",",
"pyproj",
".",
"Proj",
"(",
"init",
"=",
"\"epsg:4326\"",
")",... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | InputPorts.get | >>> inputs = InputPorts({"one": 1})
>>> "one" in inputs._ports
True
>>> "one" in inputs._vals
True
>>> inputs.get("one", 2) == 1
True
>>> inputs.get("two", 2) == 2
True
>>> "two" in inputs._ports
True
>>> "two" in inputs._vals
... | gbdxtools/task.py | def get(self, key, default=None):
"""
>>> inputs = InputPorts({"one": 1})
>>> "one" in inputs._ports
True
>>> "one" in inputs._vals
True
>>> inputs.get("one", 2) == 1
True
>>> inputs.get("two", 2) == 2
True
>>> "two" in inputs._port... | def get(self, key, default=None):
"""
>>> inputs = InputPorts({"one": 1})
>>> "one" in inputs._ports
True
>>> "one" in inputs._vals
True
>>> inputs.get("one", 2) == 1
True
>>> inputs.get("two", 2) == 2
True
>>> "two" in inputs._port... | [
">>>",
"inputs",
"=",
"InputPorts",
"(",
"{",
"one",
":",
"1",
"}",
")",
">>>",
"one",
"in",
"inputs",
".",
"_ports",
"True",
">>>",
"one",
"in",
"inputs",
".",
"_vals",
"True",
">>>",
"inputs",
".",
"get",
"(",
"one",
"2",
")",
"==",
"1",
"True"... | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/task.py#L45-L63 | [
"def",
"get",
"(",
"self",
",",
"key",
",",
"default",
"=",
"None",
")",
":",
"if",
"key",
"not",
"in",
"self",
".",
"_ports",
":",
"self",
".",
"_ports",
"[",
"key",
"]",
"=",
"self",
".",
"_port_template",
"(",
"key",
")",
"return",
"self",
"."... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | load_url | Loads a geotiff url inside a thread and returns as an ndarray | gbdxtools/rda/fetch/threaded/libcurl/easy.py | def load_url(url, token, shape=(8, 256, 256)):
""" Loads a geotiff url inside a thread and returns as an ndarray """
_, ext = os.path.splitext(urlparse(url).path)
success = False
for i in xrange(MAX_RETRIES):
thread_id = threading.current_thread().ident
_curl = _curl_pool[thread_id]
... | def load_url(url, token, shape=(8, 256, 256)):
""" Loads a geotiff url inside a thread and returns as an ndarray """
_, ext = os.path.splitext(urlparse(url).path)
success = False
for i in xrange(MAX_RETRIES):
thread_id = threading.current_thread().ident
_curl = _curl_pool[thread_id]
... | [
"Loads",
"a",
"geotiff",
"url",
"inside",
"a",
"thread",
"and",
"returns",
"as",
"an",
"ndarray"
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/rda/fetch/threaded/libcurl/easy.py#L36-L71 | [
"def",
"load_url",
"(",
"url",
",",
"token",
",",
"shape",
"=",
"(",
"8",
",",
"256",
",",
"256",
")",
")",
":",
"_",
",",
"ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"urlparse",
"(",
"url",
")",
".",
"path",
")",
"success",
"=",
"Fa... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | Workflow.launch | Launches GBDX workflow.
Args:
workflow (dict): Dictionary specifying workflow tasks.
Returns:
Workflow id (str). | gbdxtools/workflow.py | def launch(self, workflow):
"""Launches GBDX workflow.
Args:
workflow (dict): Dictionary specifying workflow tasks.
Returns:
Workflow id (str).
"""
# hit workflow api
try:
r = self.gbdx_connection.post(self.workflows_url, json=workfl... | def launch(self, workflow):
"""Launches GBDX workflow.
Args:
workflow (dict): Dictionary specifying workflow tasks.
Returns:
Workflow id (str).
"""
# hit workflow api
try:
r = self.gbdx_connection.post(self.workflows_url, json=workfl... | [
"Launches",
"GBDX",
"workflow",
"."
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/workflow.py#L35-L57 | [
"def",
"launch",
"(",
"self",
",",
"workflow",
")",
":",
"# hit workflow api",
"try",
":",
"r",
"=",
"self",
".",
"gbdx_connection",
".",
"post",
"(",
"self",
".",
"workflows_url",
",",
"json",
"=",
"workflow",
")",
"try",
":",
"r",
".",
"raise_for_statu... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | Workflow.status | Checks workflow status.
Args:
workflow_id (str): Workflow id.
Returns:
Workflow status (str). | gbdxtools/workflow.py | def status(self, workflow_id):
"""Checks workflow status.
Args:
workflow_id (str): Workflow id.
Returns:
Workflow status (str).
"""
self.logger.debug('Get status of workflow: ' + workflow_id)
url = '%(wf_url)s/%(wf_id)s' % {
'wf_u... | def status(self, workflow_id):
"""Checks workflow status.
Args:
workflow_id (str): Workflow id.
Returns:
Workflow status (str).
"""
self.logger.debug('Get status of workflow: ' + workflow_id)
url = '%(wf_url)s/%(wf_id)s' % {
'wf_u... | [
"Checks",
"workflow",
"status",
"."
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/workflow.py#L59-L74 | [
"def",
"status",
"(",
"self",
",",
"workflow_id",
")",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"'Get status of workflow: '",
"+",
"workflow_id",
")",
"url",
"=",
"'%(wf_url)s/%(wf_id)s'",
"%",
"{",
"'wf_url'",
":",
"self",
".",
"workflows_url",
",",
"... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | Workflow.get_stdout | Get stdout for a particular task.
Args:
workflow_id (str): Workflow id.
task_id (str): Task id.
Returns:
Stdout of the task (string). | gbdxtools/workflow.py | def get_stdout(self, workflow_id, task_id):
"""Get stdout for a particular task.
Args:
workflow_id (str): Workflow id.
task_id (str): Task id.
Returns:
Stdout of the task (string).
"""
url = '%(wf_url)s/%(wf_id)s/tasks/%(task_id)s/stdout... | def get_stdout(self, workflow_id, task_id):
"""Get stdout for a particular task.
Args:
workflow_id (str): Workflow id.
task_id (str): Task id.
Returns:
Stdout of the task (string).
"""
url = '%(wf_url)s/%(wf_id)s/tasks/%(task_id)s/stdout... | [
"Get",
"stdout",
"for",
"a",
"particular",
"task",
"."
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/workflow.py#L94-L110 | [
"def",
"get_stdout",
"(",
"self",
",",
"workflow_id",
",",
"task_id",
")",
":",
"url",
"=",
"'%(wf_url)s/%(wf_id)s/tasks/%(task_id)s/stdout'",
"%",
"{",
"'wf_url'",
":",
"self",
".",
"workflows_url",
",",
"'wf_id'",
":",
"workflow_id",
",",
"'task_id'",
":",
"ta... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | Workflow.cancel | Cancels a running workflow.
Args:
workflow_id (str): Workflow id.
Returns:
Nothing | gbdxtools/workflow.py | def cancel(self, workflow_id):
"""Cancels a running workflow.
Args:
workflow_id (str): Workflow id.
Returns:
Nothing
"""
self.logger.debug('Canceling workflow: ' + workflow_id)
url = '%(wf_url)s/%(wf_id)s/cancel' % {
'wf_u... | def cancel(self, workflow_id):
"""Cancels a running workflow.
Args:
workflow_id (str): Workflow id.
Returns:
Nothing
"""
self.logger.debug('Canceling workflow: ' + workflow_id)
url = '%(wf_url)s/%(wf_id)s/cancel' % {
'wf_u... | [
"Cancels",
"a",
"running",
"workflow",
"."
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/workflow.py#L147-L161 | [
"def",
"cancel",
"(",
"self",
",",
"workflow_id",
")",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"'Canceling workflow: '",
"+",
"workflow_id",
")",
"url",
"=",
"'%(wf_url)s/%(wf_id)s/cancel'",
"%",
"{",
"'wf_url'",
":",
"self",
".",
"workflows_url",
",",
... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | Workflow.launch_batch_workflow | Launches GBDX batch workflow.
Args:
batch_workflow (dict): Dictionary specifying batch workflow tasks.
Returns:
Batch Workflow id (str). | gbdxtools/workflow.py | def launch_batch_workflow(self, batch_workflow):
"""Launches GBDX batch workflow.
Args:
batch_workflow (dict): Dictionary specifying batch workflow tasks.
Returns:
Batch Workflow id (str).
"""
# hit workflow api
url = '%(base_url)s/batch_workflo... | def launch_batch_workflow(self, batch_workflow):
"""Launches GBDX batch workflow.
Args:
batch_workflow (dict): Dictionary specifying batch workflow tasks.
Returns:
Batch Workflow id (str).
"""
# hit workflow api
url = '%(base_url)s/batch_workflo... | [
"Launches",
"GBDX",
"batch",
"workflow",
"."
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/workflow.py#L163-L182 | [
"def",
"launch_batch_workflow",
"(",
"self",
",",
"batch_workflow",
")",
":",
"# hit workflow api",
"url",
"=",
"'%(base_url)s/batch_workflows'",
"%",
"{",
"'base_url'",
":",
"self",
".",
"base_url",
"}",
"try",
":",
"r",
"=",
"self",
".",
"gbdx_connection",
"."... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | Workflow.batch_workflow_status | Checks GBDX batch workflow status.
Args:
batch workflow_id (str): Batch workflow id.
Returns:
Batch Workflow status (str). | gbdxtools/workflow.py | def batch_workflow_status(self, batch_workflow_id):
"""Checks GBDX batch workflow status.
Args:
batch workflow_id (str): Batch workflow id.
Returns:
Batch Workflow status (str).
"""
self.logger.debug('Get status of batch workflow: ' + batch_workflow_... | def batch_workflow_status(self, batch_workflow_id):
"""Checks GBDX batch workflow status.
Args:
batch workflow_id (str): Batch workflow id.
Returns:
Batch Workflow status (str).
"""
self.logger.debug('Get status of batch workflow: ' + batch_workflow_... | [
"Checks",
"GBDX",
"batch",
"workflow",
"status",
"."
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/workflow.py#L184-L199 | [
"def",
"batch_workflow_status",
"(",
"self",
",",
"batch_workflow_id",
")",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"'Get status of batch workflow: '",
"+",
"batch_workflow_id",
")",
"url",
"=",
"'%(base_url)s/batch_workflows/%(batch_id)s'",
"%",
"{",
"'base_url'... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | Workflow.batch_workflow_cancel | Cancels GBDX batch workflow.
Args:
batch workflow_id (str): Batch workflow id.
Returns:
Batch Workflow status (str). | gbdxtools/workflow.py | def batch_workflow_cancel(self, batch_workflow_id):
"""Cancels GBDX batch workflow.
Args:
batch workflow_id (str): Batch workflow id.
Returns:
Batch Workflow status (str).
"""
self.logger.debug('Cancel batch workflow: ' + batch_workflow_id)
u... | def batch_workflow_cancel(self, batch_workflow_id):
"""Cancels GBDX batch workflow.
Args:
batch workflow_id (str): Batch workflow id.
Returns:
Batch Workflow status (str).
"""
self.logger.debug('Cancel batch workflow: ' + batch_workflow_id)
u... | [
"Cancels",
"GBDX",
"batch",
"workflow",
"."
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/workflow.py#L201-L216 | [
"def",
"batch_workflow_cancel",
"(",
"self",
",",
"batch_workflow_id",
")",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"'Cancel batch workflow: '",
"+",
"batch_workflow_id",
")",
"url",
"=",
"'%(base_url)s/batch_workflows/%(batch_id)s/cancel'",
"%",
"{",
"'base_url'... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | Workflow.search | Cancels GBDX batch workflow.
Params:
lookback_h (int): Look back time in hours.
owner (str): Workflow owner to search by
state (str): State to filter by, eg:
"submitted",
"scheduled",
"started",
"canceled",
... | gbdxtools/workflow.py | def search(self, lookback_h=12, owner=None, state="all"):
"""Cancels GBDX batch workflow.
Params:
lookback_h (int): Look back time in hours.
owner (str): Workflow owner to search by
state (str): State to filter by, eg:
"submitted",
"s... | def search(self, lookback_h=12, owner=None, state="all"):
"""Cancels GBDX batch workflow.
Params:
lookback_h (int): Look back time in hours.
owner (str): Workflow owner to search by
state (str): State to filter by, eg:
"submitted",
"s... | [
"Cancels",
"GBDX",
"batch",
"workflow",
"."
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/workflow.py#L218-L253 | [
"def",
"search",
"(",
"self",
",",
"lookback_h",
"=",
"12",
",",
"owner",
"=",
"None",
",",
"state",
"=",
"\"all\"",
")",
":",
"postdata",
"=",
"{",
"\"lookback_h\"",
":",
"lookback_h",
",",
"\"state\"",
":",
"state",
"}",
"if",
"owner",
"is",
"not",
... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | Ordering.order | Orders images from GBDX.
Args:
image_catalog_ids (str or list): A single catalog id or a list of
catalog ids.
batch_size (int): The image_catalog_ids will be split into
batches of batch_size. The... | gbdxtools/ordering.py | def order(self, image_catalog_ids, batch_size=100, callback=None):
'''Orders images from GBDX.
Args:
image_catalog_ids (str or list): A single catalog id or a list of
catalog ids.
batch_size (int): The image_catalog_ids w... | def order(self, image_catalog_ids, batch_size=100, callback=None):
'''Orders images from GBDX.
Args:
image_catalog_ids (str or list): A single catalog id or a list of
catalog ids.
batch_size (int): The image_catalog_ids w... | [
"Orders",
"images",
"from",
"GBDX",
"."
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/ordering.py#L27-L76 | [
"def",
"order",
"(",
"self",
",",
"image_catalog_ids",
",",
"batch_size",
"=",
"100",
",",
"callback",
"=",
"None",
")",
":",
"def",
"_order_single_batch",
"(",
"url_",
",",
"ids",
",",
"results_list",
")",
":",
"data",
"=",
"json",
".",
"dumps",
"(",
... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | Ordering.status | Checks imagery order status. There can be more than one image per
order and this function returns the status of all images
within the order.
Args:
order_id (str): The id of the order placed.
Returns:
List of dictionaries, one per image. Each di... | gbdxtools/ordering.py | def status(self, order_id):
'''Checks imagery order status. There can be more than one image per
order and this function returns the status of all images
within the order.
Args:
order_id (str): The id of the order placed.
Returns:
List ... | def status(self, order_id):
'''Checks imagery order status. There can be more than one image per
order and this function returns the status of all images
within the order.
Args:
order_id (str): The id of the order placed.
Returns:
List ... | [
"Checks",
"imagery",
"order",
"status",
".",
"There",
"can",
"be",
"more",
"than",
"one",
"image",
"per",
"order",
"and",
"this",
"function",
"returns",
"the",
"status",
"of",
"all",
"images",
"within",
"the",
"order",
"."
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/ordering.py#L78-L97 | [
"def",
"status",
"(",
"self",
",",
"order_id",
")",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"'Get status of order '",
"+",
"order_id",
")",
"url",
"=",
"'%(base_url)s/order/%(order_id)s'",
"%",
"{",
"'base_url'",
":",
"self",
".",
"base_url",
",",
"'o... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | Ordering.heartbeat | Check the heartbeat of the ordering API
Args: None
Returns: True or False | gbdxtools/ordering.py | def heartbeat(self):
'''
Check the heartbeat of the ordering API
Args: None
Returns: True or False
'''
url = '%s/heartbeat' % self.base_url
# Auth is not required to hit the heartbeat
r = requests.get(url)
try:
return r.json() == "... | def heartbeat(self):
'''
Check the heartbeat of the ordering API
Args: None
Returns: True or False
'''
url = '%s/heartbeat' % self.base_url
# Auth is not required to hit the heartbeat
r = requests.get(url)
try:
return r.json() == "... | [
"Check",
"the",
"heartbeat",
"of",
"the",
"ordering",
"API"
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/ordering.py#L99-L114 | [
"def",
"heartbeat",
"(",
"self",
")",
":",
"url",
"=",
"'%s/heartbeat'",
"%",
"self",
".",
"base_url",
"# Auth is not required to hit the heartbeat",
"r",
"=",
"requests",
".",
"get",
"(",
"url",
")",
"try",
":",
"return",
"r",
".",
"json",
"(",
")",
"==",... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | Catalog.get | Retrieves the strip footprint WKT string given a cat ID.
Args:
catID (str): The source catalog ID from the platform catalog.
includeRelationships (bool): whether to include graph links to related objects. Default False.
Returns:
record (dict): A dict object identic... | gbdxtools/catalog.py | def get(self, catID, includeRelationships=False):
'''Retrieves the strip footprint WKT string given a cat ID.
Args:
catID (str): The source catalog ID from the platform catalog.
includeRelationships (bool): whether to include graph links to related objects. Default False.
... | def get(self, catID, includeRelationships=False):
'''Retrieves the strip footprint WKT string given a cat ID.
Args:
catID (str): The source catalog ID from the platform catalog.
includeRelationships (bool): whether to include graph links to related objects. Default False.
... | [
"Retrieves",
"the",
"strip",
"footprint",
"WKT",
"string",
"given",
"a",
"cat",
"ID",
"."
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/catalog.py#L55-L70 | [
"def",
"get",
"(",
"self",
",",
"catID",
",",
"includeRelationships",
"=",
"False",
")",
":",
"url",
"=",
"'%(base_url)s/record/%(catID)s'",
"%",
"{",
"'base_url'",
":",
"self",
".",
"base_url",
",",
"'catID'",
":",
"catID",
"}",
"r",
"=",
"self",
".",
"... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | Catalog.get_strip_metadata | Retrieves the strip catalog metadata given a cat ID.
Args:
catID (str): The source catalog ID from the platform catalog.
Returns:
metadata (dict): A metadata dictionary .
TODO: have this return a class object with interesting information exposed. | gbdxtools/catalog.py | def get_strip_metadata(self, catID):
'''Retrieves the strip catalog metadata given a cat ID.
Args:
catID (str): The source catalog ID from the platform catalog.
Returns:
metadata (dict): A metadata dictionary .
TODO: have this return a class object with int... | def get_strip_metadata(self, catID):
'''Retrieves the strip catalog metadata given a cat ID.
Args:
catID (str): The source catalog ID from the platform catalog.
Returns:
metadata (dict): A metadata dictionary .
TODO: have this return a class object with int... | [
"Retrieves",
"the",
"strip",
"catalog",
"metadata",
"given",
"a",
"cat",
"ID",
"."
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/catalog.py#L73-L97 | [
"def",
"get_strip_metadata",
"(",
"self",
",",
"catID",
")",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"'Retrieving strip catalog metadata'",
")",
"url",
"=",
"'%(base_url)s/record/%(catID)s?includeRelationships=false'",
"%",
"{",
"'base_url'",
":",
"self",
".",
... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | Catalog.get_address_coords | Use the google geocoder to get latitude and longitude for an address string
Args:
address: any address string
Returns:
A tuple of (lat,lng) | gbdxtools/catalog.py | def get_address_coords(self, address):
''' Use the google geocoder to get latitude and longitude for an address string
Args:
address: any address string
Returns:
A tuple of (lat,lng)
'''
url = "https://maps.googleapis.com/maps/api/geocode/json?&address="... | def get_address_coords(self, address):
''' Use the google geocoder to get latitude and longitude for an address string
Args:
address: any address string
Returns:
A tuple of (lat,lng)
'''
url = "https://maps.googleapis.com/maps/api/geocode/json?&address="... | [
"Use",
"the",
"google",
"geocoder",
"to",
"get",
"latitude",
"and",
"longitude",
"for",
"an",
"address",
"string"
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/catalog.py#L100-L115 | [
"def",
"get_address_coords",
"(",
"self",
",",
"address",
")",
":",
"url",
"=",
"\"https://maps.googleapis.com/maps/api/geocode/json?&address=\"",
"+",
"address",
"r",
"=",
"requests",
".",
"get",
"(",
"url",
")",
"r",
".",
"raise_for_status",
"(",
")",
"results",... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | Catalog.search_address | Perform a catalog search over an address string
Args:
address: any address string
filters: Array of filters. Optional. Example:
[
"(sensorPlatformName = 'WORLDVIEW01' OR sensorPlatformName ='QUICKBIRD02')",
"cloudCover < 10",
... | gbdxtools/catalog.py | def search_address(self, address, filters=None, startDate=None, endDate=None, types=None):
''' Perform a catalog search over an address string
Args:
address: any address string
filters: Array of filters. Optional. Example:
[
"(sensorPlatformName = '... | def search_address(self, address, filters=None, startDate=None, endDate=None, types=None):
''' Perform a catalog search over an address string
Args:
address: any address string
filters: Array of filters. Optional. Example:
[
"(sensorPlatformName = '... | [
"Perform",
"a",
"catalog",
"search",
"over",
"an",
"address",
"string"
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/catalog.py#L117-L136 | [
"def",
"search_address",
"(",
"self",
",",
"address",
",",
"filters",
"=",
"None",
",",
"startDate",
"=",
"None",
",",
"endDate",
"=",
"None",
",",
"types",
"=",
"None",
")",
":",
"lat",
",",
"lng",
"=",
"self",
".",
"get_address_coords",
"(",
"address... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | Catalog.search_point | Perform a catalog search over a specific point, specified by lat,lng
Args:
lat: latitude
lng: longitude
filters: Array of filters. Optional. Example:
[
"(sensorPlatformName = 'WORLDVIEW01' OR sensorPlatformName ='QUICKBIRD02')",
... | gbdxtools/catalog.py | def search_point(self, lat, lng, filters=None, startDate=None, endDate=None, types=None, type=None):
''' Perform a catalog search over a specific point, specified by lat,lng
Args:
lat: latitude
lng: longitude
filters: Array of filters. Optional. Example:
... | def search_point(self, lat, lng, filters=None, startDate=None, endDate=None, types=None, type=None):
''' Perform a catalog search over a specific point, specified by lat,lng
Args:
lat: latitude
lng: longitude
filters: Array of filters. Optional. Example:
... | [
"Perform",
"a",
"catalog",
"search",
"over",
"a",
"specific",
"point",
"specified",
"by",
"lat",
"lng"
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/catalog.py#L139-L159 | [
"def",
"search_point",
"(",
"self",
",",
"lat",
",",
"lng",
",",
"filters",
"=",
"None",
",",
"startDate",
"=",
"None",
",",
"endDate",
"=",
"None",
",",
"types",
"=",
"None",
",",
"type",
"=",
"None",
")",
":",
"searchAreaWkt",
"=",
"\"POLYGON ((%s %s... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | Catalog.get_data_location | Find and return the S3 data location given a catalog_id.
Args:
catalog_id: The catalog ID
Returns:
A string containing the s3 location of the data associated with a catalog ID. Returns
None if the catalog ID is not found, or if there is no data yet associated with ... | gbdxtools/catalog.py | def get_data_location(self, catalog_id):
"""
Find and return the S3 data location given a catalog_id.
Args:
catalog_id: The catalog ID
Returns:
A string containing the s3 location of the data associated with a catalog ID. Returns
None if the catalog... | def get_data_location(self, catalog_id):
"""
Find and return the S3 data location given a catalog_id.
Args:
catalog_id: The catalog ID
Returns:
A string containing the s3 location of the data associated with a catalog ID. Returns
None if the catalog... | [
"Find",
"and",
"return",
"the",
"S3",
"data",
"location",
"given",
"a",
"catalog_id",
"."
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/catalog.py#L161-L190 | [
"def",
"get_data_location",
"(",
"self",
",",
"catalog_id",
")",
":",
"try",
":",
"record",
"=",
"self",
".",
"get",
"(",
"catalog_id",
")",
"except",
":",
"return",
"None",
"# Handle Landsat8",
"if",
"'Landsat8'",
"in",
"record",
"[",
"'type'",
"]",
"and"... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | Catalog.search | Perform a catalog search
Args:
searchAreaWkt: WKT Polygon of area to search. Optional.
filters: Array of filters. Optional. Example:
[
"(sensorPlatformName = 'WORLDVIEW01' OR sensorPlatformName ='QUICKBIRD02')",
"cloudCover < 10",
... | gbdxtools/catalog.py | def search(self, searchAreaWkt=None, filters=None, startDate=None, endDate=None, types=None):
''' Perform a catalog search
Args:
searchAreaWkt: WKT Polygon of area to search. Optional.
filters: Array of filters. Optional. Example:
[
"(sensorPlatfor... | def search(self, searchAreaWkt=None, filters=None, startDate=None, endDate=None, types=None):
''' Perform a catalog search
Args:
searchAreaWkt: WKT Polygon of area to search. Optional.
filters: Array of filters. Optional. Example:
[
"(sensorPlatfor... | [
"Perform",
"a",
"catalog",
"search"
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/catalog.py#L192-L247 | [
"def",
"search",
"(",
"self",
",",
"searchAreaWkt",
"=",
"None",
",",
"filters",
"=",
"None",
",",
"startDate",
"=",
"None",
",",
"endDate",
"=",
"None",
",",
"types",
"=",
"None",
")",
":",
"# Default to search for Acquisition type objects.",
"if",
"not",
"... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | Catalog.get_most_recent_images | Return the most recent image
Args:
results: a catalog resultset, as returned from a search
types: array of types you want. optional.
sensors: array of sensornames. optional.
N: number of recent images to return. defaults to 1.
Returns:
singl... | gbdxtools/catalog.py | def get_most_recent_images(self, results, types=[], sensors=[], N=1):
''' Return the most recent image
Args:
results: a catalog resultset, as returned from a search
types: array of types you want. optional.
sensors: array of sensornames. optional.
N: numb... | def get_most_recent_images(self, results, types=[], sensors=[], N=1):
''' Return the most recent image
Args:
results: a catalog resultset, as returned from a search
types: array of types you want. optional.
sensors: array of sensornames. optional.
N: numb... | [
"Return",
"the",
"most",
"recent",
"image"
] | DigitalGlobe/gbdxtools | python | https://github.com/DigitalGlobe/gbdxtools/blob/def62f8f2d77b168aa2bd115290aaa0f9a08a4bb/gbdxtools/catalog.py#L249-L277 | [
"def",
"get_most_recent_images",
"(",
"self",
",",
"results",
",",
"types",
"=",
"[",
"]",
",",
"sensors",
"=",
"[",
"]",
",",
"N",
"=",
"1",
")",
":",
"if",
"not",
"len",
"(",
"results",
")",
":",
"return",
"None",
"# filter on type",
"if",
"types",... | def62f8f2d77b168aa2bd115290aaa0f9a08a4bb |
valid | get_bytes_from_blob | 不同数据库从blob拿出的数据有所差别,有的是memoryview有的是bytes | slim/utils/__init__.py | def get_bytes_from_blob(val) -> bytes:
""" 不同数据库从blob拿出的数据有所差别,有的是memoryview有的是bytes """
if isinstance(val, bytes):
return val
elif isinstance(val, memoryview):
return val.tobytes()
else:
raise TypeError('invalid type for get bytes') | def get_bytes_from_blob(val) -> bytes:
""" 不同数据库从blob拿出的数据有所差别,有的是memoryview有的是bytes """
if isinstance(val, bytes):
return val
elif isinstance(val, memoryview):
return val.tobytes()
else:
raise TypeError('invalid type for get bytes') | [
"不同数据库从blob拿出的数据有所差别,有的是memoryview有的是bytes"
] | fy0/slim | python | https://github.com/fy0/slim/blob/9951a910750888dbe7dd3e98acae9c40efae0689/slim/utils/__init__.py#L44-L51 | [
"def",
"get_bytes_from_blob",
"(",
"val",
")",
"->",
"bytes",
":",
"if",
"isinstance",
"(",
"val",
",",
"bytes",
")",
":",
"return",
"val",
"elif",
"isinstance",
"(",
"val",
",",
"memoryview",
")",
":",
"return",
"val",
".",
"tobytes",
"(",
")",
"else"... | 9951a910750888dbe7dd3e98acae9c40efae0689 |
valid | pagination_calc | :param nearby:
:param items_count: count of all items
:param page_size: size of one page
:param cur_page: current page number, accept string digit
:return: num of pages, an iterator | slim/utils/pagination.py | def pagination_calc(items_count, page_size, cur_page=1, nearby=2):
"""
:param nearby:
:param items_count: count of all items
:param page_size: size of one page
:param cur_page: current page number, accept string digit
:return: num of pages, an iterator
"""
if type(cur_page) == str:
... | def pagination_calc(items_count, page_size, cur_page=1, nearby=2):
"""
:param nearby:
:param items_count: count of all items
:param page_size: size of one page
:param cur_page: current page number, accept string digit
:return: num of pages, an iterator
"""
if type(cur_page) == str:
... | [
":",
"param",
"nearby",
":",
":",
"param",
"items_count",
":",
"count",
"of",
"all",
"items",
":",
"param",
"page_size",
":",
"size",
"of",
"one",
"page",
":",
"param",
"cur_page",
":",
"current",
"page",
"number",
"accept",
"string",
"digit",
":",
"retu... | fy0/slim | python | https://github.com/fy0/slim/blob/9951a910750888dbe7dd3e98acae9c40efae0689/slim/utils/pagination.py#L4-L65 | [
"def",
"pagination_calc",
"(",
"items_count",
",",
"page_size",
",",
"cur_page",
"=",
"1",
",",
"nearby",
"=",
"2",
")",
":",
"if",
"type",
"(",
"cur_page",
")",
"==",
"str",
":",
"# noinspection PyUnresolvedReferences",
"cur_page",
"=",
"int",
"(",
"cur_pag... | 9951a910750888dbe7dd3e98acae9c40efae0689 |
valid | Ability.add_common_check | emitted before query
:param actions:
:param table:
:param func:
:return: | slim/base/permission.py | def add_common_check(self, actions, table, func):
"""
emitted before query
:param actions:
:param table:
:param func:
:return:
"""
self.common_checks.append([table, actions, func])
"""def func(ability, user, action, available_columns: list):
... | def add_common_check(self, actions, table, func):
"""
emitted before query
:param actions:
:param table:
:param func:
:return:
"""
self.common_checks.append([table, actions, func])
"""def func(ability, user, action, available_columns: list):
... | [
"emitted",
"before",
"query",
":",
"param",
"actions",
":",
":",
"param",
"table",
":",
":",
"param",
"func",
":",
":",
"return",
":"
] | fy0/slim | python | https://github.com/fy0/slim/blob/9951a910750888dbe7dd3e98acae9c40efae0689/slim/base/permission.py#L130-L142 | [
"def",
"add_common_check",
"(",
"self",
",",
"actions",
",",
"table",
",",
"func",
")",
":",
"self",
".",
"common_checks",
".",
"append",
"(",
"[",
"table",
",",
"actions",
",",
"func",
"]",
")",
"\"\"\"def func(ability, user, action, available_columns: list):\n ... | 9951a910750888dbe7dd3e98acae9c40efae0689 |
valid | Ability.add_record_check | def func(ability, user, action, record: DataRecord, available_columns: list):
pass | slim/base/permission.py | def add_record_check(self, actions, table, func):
# emitted after query
# table: 'table_name'
# column: ('table_name', 'column_name')
assert isinstance(table, str), '`table` must be table name'
for i in actions:
assert i not in (A.QUERY, A.CREATE), "meaningless action... | def add_record_check(self, actions, table, func):
# emitted after query
# table: 'table_name'
# column: ('table_name', 'column_name')
assert isinstance(table, str), '`table` must be table name'
for i in actions:
assert i not in (A.QUERY, A.CREATE), "meaningless action... | [
"def",
"func",
"(",
"ability",
"user",
"action",
"record",
":",
"DataRecord",
"available_columns",
":",
"list",
")",
":",
"pass"
] | fy0/slim | python | https://github.com/fy0/slim/blob/9951a910750888dbe7dd3e98acae9c40efae0689/slim/base/permission.py#L144-L156 | [
"def",
"add_record_check",
"(",
"self",
",",
"actions",
",",
"table",
",",
"func",
")",
":",
"# emitted after query",
"# table: 'table_name'",
"# column: ('table_name', 'column_name')",
"assert",
"isinstance",
"(",
"table",
",",
"str",
")",
",",
"'`table` must be table ... | 9951a910750888dbe7dd3e98acae9c40efae0689 |
valid | Ability._parse_permission | 从 obj 中取出权限
:param obj:
:return: [A.QUERY, A.WRITE, ...] | slim/base/permission.py | def _parse_permission(self, obj):
"""
从 obj 中取出权限
:param obj:
:return: [A.QUERY, A.WRITE, ...]
"""
if isinstance(obj, str):
if obj == '*':
return A.ALL
elif obj in A.ALL:
return obj,
else:
... | def _parse_permission(self, obj):
"""
从 obj 中取出权限
:param obj:
:return: [A.QUERY, A.WRITE, ...]
"""
if isinstance(obj, str):
if obj == '*':
return A.ALL
elif obj in A.ALL:
return obj,
else:
... | [
"从",
"obj",
"中取出权限",
":",
"param",
"obj",
":",
":",
"return",
":",
"[",
"A",
".",
"QUERY",
"A",
".",
"WRITE",
"...",
"]"
] | fy0/slim | python | https://github.com/fy0/slim/blob/9951a910750888dbe7dd3e98acae9c40efae0689/slim/base/permission.py#L158-L177 | [
"def",
"_parse_permission",
"(",
"self",
",",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"str",
")",
":",
"if",
"obj",
"==",
"'*'",
":",
"return",
"A",
".",
"ALL",
"elif",
"obj",
"in",
"A",
".",
"ALL",
":",
"return",
"obj",
",",
"else"... | 9951a910750888dbe7dd3e98acae9c40efae0689 |
valid | Ability.can_with_columns | 根据权限进行列过滤
注意一点,只要有一个条件能够通过权限检测,那么过滤后还会有剩余条件,最终就不会报错。
如果全部条件都不能过检测,就会爆出权限错误了。
:param user:
:param action: 行为
:param table: 表名
:param columns: 列名列表
:return: 可用列的列表 | slim/base/permission.py | def can_with_columns(self, user, action, table, columns):
"""
根据权限进行列过滤
注意一点,只要有一个条件能够通过权限检测,那么过滤后还会有剩余条件,最终就不会报错。
如果全部条件都不能过检测,就会爆出权限错误了。
:param user:
:param action: 行为
:param table: 表名
:param columns: 列名列表
:return: 可用列的列表
"""
# T... | def can_with_columns(self, user, action, table, columns):
"""
根据权限进行列过滤
注意一点,只要有一个条件能够通过权限检测,那么过滤后还会有剩余条件,最终就不会报错。
如果全部条件都不能过检测,就会爆出权限错误了。
:param user:
:param action: 行为
:param table: 表名
:param columns: 列名列表
:return: 可用列的列表
"""
# T... | [
"根据权限进行列过滤",
"注意一点,只要有一个条件能够通过权限检测,那么过滤后还会有剩余条件,最终就不会报错。",
"如果全部条件都不能过检测,就会爆出权限错误了。"
] | fy0/slim | python | https://github.com/fy0/slim/blob/9951a910750888dbe7dd3e98acae9c40efae0689/slim/base/permission.py#L179-L237 | [
"def",
"can_with_columns",
"(",
"self",
",",
"user",
",",
"action",
",",
"table",
",",
"columns",
")",
":",
"# TODO: 此过程可以加缓存",
"# 全局",
"global_data",
"=",
"self",
".",
"rules",
".",
"get",
"(",
"'*'",
")",
"global_actions",
"=",
"self",
".",
"_parse_permi... | 9951a910750888dbe7dd3e98acae9c40efae0689 |
valid | Ability.can_with_record | 进行基于 Record 的权限判定,返回可用列。
:param user:
:param action:
:param record:
:param available: 限定检查范围
:return: 可用列 | slim/base/permission.py | def can_with_record(self, user, action, record: DataRecord, *, available=None):
"""
进行基于 Record 的权限判定,返回可用列。
:param user:
:param action:
:param record:
:param available: 限定检查范围
:return: 可用列
"""
assert action not in (A.QUERY, A.CREATE), "meaningless... | def can_with_record(self, user, action, record: DataRecord, *, available=None):
"""
进行基于 Record 的权限判定,返回可用列。
:param user:
:param action:
:param record:
:param available: 限定检查范围
:return: 可用列
"""
assert action not in (A.QUERY, A.CREATE), "meaningless... | [
"进行基于",
"Record",
"的权限判定,返回可用列。",
":",
"param",
"user",
":",
":",
"param",
"action",
":",
":",
"param",
"record",
":",
":",
"param",
"available",
":",
"限定检查范围",
":",
"return",
":",
"可用列"
] | fy0/slim | python | https://github.com/fy0/slim/blob/9951a910750888dbe7dd3e98acae9c40efae0689/slim/base/permission.py#L239-L270 | [
"def",
"can_with_record",
"(",
"self",
",",
"user",
",",
"action",
",",
"record",
":",
"DataRecord",
",",
"*",
",",
"available",
"=",
"None",
")",
":",
"assert",
"action",
"not",
"in",
"(",
"A",
".",
"QUERY",
",",
"A",
".",
"CREATE",
")",
",",
"\"m... | 9951a910750888dbe7dd3e98acae9c40efae0689 |
valid | BaseView.use | interface helper function | slim/base/view.py | def use(cls, name, method: [str, Set, List], url=None):
""" interface helper function"""
if not isinstance(method, (str, list, set, tuple)):
raise BaseException('Invalid type of method: %s' % type(method).__name__)
if isinstance(method, str):
method = {method}
#... | def use(cls, name, method: [str, Set, List], url=None):
""" interface helper function"""
if not isinstance(method, (str, list, set, tuple)):
raise BaseException('Invalid type of method: %s' % type(method).__name__)
if isinstance(method, str):
method = {method}
#... | [
"interface",
"helper",
"function"
] | fy0/slim | python | https://github.com/fy0/slim/blob/9951a910750888dbe7dd3e98acae9c40efae0689/slim/base/view.py#L40-L49 | [
"def",
"use",
"(",
"cls",
",",
"name",
",",
"method",
":",
"[",
"str",
",",
"Set",
",",
"List",
"]",
",",
"url",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"method",
",",
"(",
"str",
",",
"list",
",",
"set",
",",
"tuple",
")",
")"... | 9951a910750888dbe7dd3e98acae9c40efae0689 |
valid | BaseView.get_ip | get ip address of client
:return: | slim/base/view.py | async def get_ip(self) -> Union[IPv4Address, IPv6Address]:
"""
get ip address of client
:return:
"""
xff = await self.get_x_forwarded_for()
if xff: return xff[0]
ip_addr = self._request.transport.get_extra_info('peername')[0]
return ip_address(ip_addr) | async def get_ip(self) -> Union[IPv4Address, IPv6Address]:
"""
get ip address of client
:return:
"""
xff = await self.get_x_forwarded_for()
if xff: return xff[0]
ip_addr = self._request.transport.get_extra_info('peername')[0]
return ip_address(ip_addr) | [
"get",
"ip",
"address",
"of",
"client",
":",
"return",
":"
] | fy0/slim | python | https://github.com/fy0/slim/blob/9951a910750888dbe7dd3e98acae9c40efae0689/slim/base/view.py#L128-L136 | [
"async",
"def",
"get_ip",
"(",
"self",
")",
"->",
"Union",
"[",
"IPv4Address",
",",
"IPv6Address",
"]",
":",
"xff",
"=",
"await",
"self",
".",
"get_x_forwarded_for",
"(",
")",
"if",
"xff",
":",
"return",
"xff",
"[",
"0",
"]",
"ip_addr",
"=",
"self",
... | 9951a910750888dbe7dd3e98acae9c40efae0689 |
valid | BaseView.finish | Set response as {'code': xxx, 'data': xxx}
:param code:
:param data:
:return: | slim/base/view.py | def finish(self, code, data=NotImplemented):
"""
Set response as {'code': xxx, 'data': xxx}
:param code:
:param data:
:return:
"""
if data is NotImplemented:
data = RETCODE.txt_cn.get(code, None)
self.ret_val = {'code': code, 'data': data} # f... | def finish(self, code, data=NotImplemented):
"""
Set response as {'code': xxx, 'data': xxx}
:param code:
:param data:
:return:
"""
if data is NotImplemented:
data = RETCODE.txt_cn.get(code, None)
self.ret_val = {'code': code, 'data': data} # f... | [
"Set",
"response",
"as",
"{",
"code",
":",
"xxx",
"data",
":",
"xxx",
"}",
":",
"param",
"code",
":",
":",
"param",
"data",
":",
":",
"return",
":"
] | fy0/slim | python | https://github.com/fy0/slim/blob/9951a910750888dbe7dd3e98acae9c40efae0689/slim/base/view.py#L179-L191 | [
"def",
"finish",
"(",
"self",
",",
"code",
",",
"data",
"=",
"NotImplemented",
")",
":",
"if",
"data",
"is",
"NotImplemented",
":",
"data",
"=",
"RETCODE",
".",
"txt_cn",
".",
"get",
"(",
"code",
",",
"None",
")",
"self",
".",
"ret_val",
"=",
"{",
... | 9951a910750888dbe7dd3e98acae9c40efae0689 |
valid | BaseView.finish_raw | Set raw response
:param body:
:param status:
:param content_type:
:return: | slim/base/view.py | def finish_raw(self, body: bytes, status: int = 200, content_type: Optional[str] = None):
"""
Set raw response
:param body:
:param status:
:param content_type:
:return:
"""
self.ret_val = body
self.response = web.Response(body=body, status=status, ... | def finish_raw(self, body: bytes, status: int = 200, content_type: Optional[str] = None):
"""
Set raw response
:param body:
:param status:
:param content_type:
:return:
"""
self.ret_val = body
self.response = web.Response(body=body, status=status, ... | [
"Set",
"raw",
"response",
":",
"param",
"body",
":",
":",
"param",
"status",
":",
":",
"param",
"content_type",
":",
":",
"return",
":"
] | fy0/slim | python | https://github.com/fy0/slim/blob/9951a910750888dbe7dd3e98acae9c40efae0689/slim/base/view.py#L193-L204 | [
"def",
"finish_raw",
"(",
"self",
",",
"body",
":",
"bytes",
",",
"status",
":",
"int",
"=",
"200",
",",
"content_type",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
")",
":",
"self",
".",
"ret_val",
"=",
"body",
"self",
".",
"response",
"=",
"we... | 9951a910750888dbe7dd3e98acae9c40efae0689 |
valid | AbstractSQLView.add_soft_foreign_key | the column stores foreign table's primary key but isn't a foreign key (to avoid constraint)
warning: if the table not exists, will crash when query with loadfk
:param column: table's column
:param table_name: foreign table name
:param alias: table name's alias. Default is as same as tabl... | slim/base/view.py | def add_soft_foreign_key(cls, column, table_name, alias=None):
"""
the column stores foreign table's primary key but isn't a foreign key (to avoid constraint)
warning: if the table not exists, will crash when query with loadfk
:param column: table's column
:param table_name: fore... | def add_soft_foreign_key(cls, column, table_name, alias=None):
"""
the column stores foreign table's primary key but isn't a foreign key (to avoid constraint)
warning: if the table not exists, will crash when query with loadfk
:param column: table's column
:param table_name: fore... | [
"the",
"column",
"stores",
"foreign",
"table",
"s",
"primary",
"key",
"but",
"isn",
"t",
"a",
"foreign",
"key",
"(",
"to",
"avoid",
"constraint",
")",
"warning",
":",
"if",
"the",
"table",
"not",
"exists",
"will",
"crash",
"when",
"query",
"with",
"loadf... | fy0/slim | python | https://github.com/fy0/slim/blob/9951a910750888dbe7dd3e98acae9c40efae0689/slim/base/view.py#L428-L453 | [
"def",
"add_soft_foreign_key",
"(",
"cls",
",",
"column",
",",
"table_name",
",",
"alias",
"=",
"None",
")",
":",
"if",
"column",
"in",
"cls",
".",
"fields",
":",
"table",
"=",
"SQLForeignKey",
"(",
"table_name",
",",
"column",
",",
"cls",
".",
"fields",... | 9951a910750888dbe7dd3e98acae9c40efae0689 |
valid | AbstractSQLView.current_request_role | Current role requested by client.
:return: | slim/base/view.py | def current_request_role(self) -> [int, str]:
"""
Current role requested by client.
:return:
"""
role_val = self.headers.get('Role')
return int(role_val) if role_val and role_val.isdigit() else role_val | def current_request_role(self) -> [int, str]:
"""
Current role requested by client.
:return:
"""
role_val = self.headers.get('Role')
return int(role_val) if role_val and role_val.isdigit() else role_val | [
"Current",
"role",
"requested",
"by",
"client",
".",
":",
"return",
":"
] | fy0/slim | python | https://github.com/fy0/slim/blob/9951a910750888dbe7dd3e98acae9c40efae0689/slim/base/view.py#L496-L502 | [
"def",
"current_request_role",
"(",
"self",
")",
"->",
"[",
"int",
",",
"str",
"]",
":",
"role_val",
"=",
"self",
".",
"headers",
".",
"get",
"(",
"'Role'",
")",
"return",
"int",
"(",
"role_val",
")",
"if",
"role_val",
"and",
"role_val",
".",
"isdigit"... | 9951a910750888dbe7dd3e98acae9c40efae0689 |
valid | AbstractSQLView.load_fk | :param info:
:param records: the data got from database and filtered from permission
:return: | slim/base/view.py | async def load_fk(self, info: SQLQueryInfo, records: Iterable[DataRecord]) -> Union[List, Iterable]:
"""
:param info:
:param records: the data got from database and filtered from permission
:return:
"""
# if not items, items is probably [], so return itself.
# if... | async def load_fk(self, info: SQLQueryInfo, records: Iterable[DataRecord]) -> Union[List, Iterable]:
"""
:param info:
:param records: the data got from database and filtered from permission
:return:
"""
# if not items, items is probably [], so return itself.
# if... | [
":",
"param",
"info",
":",
":",
"param",
"records",
":",
"the",
"data",
"got",
"from",
"database",
"and",
"filtered",
"from",
"permission",
":",
"return",
":"
] | fy0/slim | python | https://github.com/fy0/slim/blob/9951a910750888dbe7dd3e98acae9c40efae0689/slim/base/view.py#L515-L584 | [
"async",
"def",
"load_fk",
"(",
"self",
",",
"info",
":",
"SQLQueryInfo",
",",
"records",
":",
"Iterable",
"[",
"DataRecord",
"]",
")",
"->",
"Union",
"[",
"List",
",",
"Iterable",
"]",
":",
"# if not items, items is probably [], so return itself.",
"# if not item... | 9951a910750888dbe7dd3e98acae9c40efae0689 |
valid | AbstractSQLView._call_handle | call and check result of handle_query/read/insert/update | slim/base/view.py | async def _call_handle(self, func, *args):
""" call and check result of handle_query/read/insert/update """
await async_call(func, *args)
if self.is_finished:
raise FinishQuitException() | async def _call_handle(self, func, *args):
""" call and check result of handle_query/read/insert/update """
await async_call(func, *args)
if self.is_finished:
raise FinishQuitException() | [
"call",
"and",
"check",
"result",
"of",
"handle_query",
"/",
"read",
"/",
"insert",
"/",
"update"
] | fy0/slim | python | https://github.com/fy0/slim/blob/9951a910750888dbe7dd3e98acae9c40efae0689/slim/base/view.py#L586-L591 | [
"async",
"def",
"_call_handle",
"(",
"self",
",",
"func",
",",
"*",
"args",
")",
":",
"await",
"async_call",
"(",
"func",
",",
"*",
"args",
")",
"if",
"self",
".",
"is_finished",
":",
"raise",
"FinishQuitException",
"(",
")"
] | 9951a910750888dbe7dd3e98acae9c40efae0689 |
valid | AbstractSQLView.after_update | :param old_records:
:param raw_post:
:param values:
:param records:
:return: | slim/base/view.py | async def after_update(self, raw_post: Dict, values: SQLValuesToWrite,
old_records: List[DataRecord], records: List[DataRecord]):
"""
:param old_records:
:param raw_post:
:param values:
:param records:
:return:
""" | async def after_update(self, raw_post: Dict, values: SQLValuesToWrite,
old_records: List[DataRecord], records: List[DataRecord]):
"""
:param old_records:
:param raw_post:
:param values:
:param records:
:return:
""" | [
":",
"param",
"old_records",
":",
":",
"param",
"raw_post",
":",
":",
"param",
"values",
":",
":",
"param",
"records",
":",
":",
"return",
":"
] | fy0/slim | python | https://github.com/fy0/slim/blob/9951a910750888dbe7dd3e98acae9c40efae0689/slim/base/view.py#L786-L794 | [
"async",
"def",
"after_update",
"(",
"self",
",",
"raw_post",
":",
"Dict",
",",
"values",
":",
"SQLValuesToWrite",
",",
"old_records",
":",
"List",
"[",
"DataRecord",
"]",
",",
"records",
":",
"List",
"[",
"DataRecord",
"]",
")",
":"
] | 9951a910750888dbe7dd3e98acae9c40efae0689 |
valid | User.roles | BaseUser.roles 的实现,返回用户可用角色
:return: | slim_cli/template/model/user.py | def roles(self):
"""
BaseUser.roles 的实现,返回用户可用角色
:return:
"""
ret = {None}
if self.state == POST_STATE.DEL:
return ret
ret.add('user')
return ret | def roles(self):
"""
BaseUser.roles 的实现,返回用户可用角色
:return:
"""
ret = {None}
if self.state == POST_STATE.DEL:
return ret
ret.add('user')
return ret | [
"BaseUser",
".",
"roles",
"的实现,返回用户可用角色",
":",
"return",
":"
] | fy0/slim | python | https://github.com/fy0/slim/blob/9951a910750888dbe7dd3e98acae9c40efae0689/slim_cli/template/model/user.py#L38-L47 | [
"def",
"roles",
"(",
"self",
")",
":",
"ret",
"=",
"{",
"None",
"}",
"if",
"self",
".",
"state",
"==",
"POST_STATE",
".",
"DEL",
":",
"return",
"ret",
"ret",
".",
"add",
"(",
"'user'",
")",
"return",
"ret"
] | 9951a910750888dbe7dd3e98acae9c40efae0689 |
valid | User.gen_password_and_salt | 生成加密后的密码和盐 | slim_cli/template/model/user.py | def gen_password_and_salt(cls, password_text):
""" 生成加密后的密码和盐 """
salt = os.urandom(32)
dk = hashlib.pbkdf2_hmac(
config.PASSWORD_HASH_FUNC_NAME,
password_text.encode('utf-8'),
salt,
config.PASSWORD_HASH_ITERATIONS,
)
return {'passw... | def gen_password_and_salt(cls, password_text):
""" 生成加密后的密码和盐 """
salt = os.urandom(32)
dk = hashlib.pbkdf2_hmac(
config.PASSWORD_HASH_FUNC_NAME,
password_text.encode('utf-8'),
salt,
config.PASSWORD_HASH_ITERATIONS,
)
return {'passw... | [
"生成加密后的密码和盐"
] | fy0/slim | python | https://github.com/fy0/slim/blob/9951a910750888dbe7dd3e98acae9c40efae0689/slim_cli/template/model/user.py#L50-L59 | [
"def",
"gen_password_and_salt",
"(",
"cls",
",",
"password_text",
")",
":",
"salt",
"=",
"os",
".",
"urandom",
"(",
"32",
")",
"dk",
"=",
"hashlib",
".",
"pbkdf2_hmac",
"(",
"config",
".",
"PASSWORD_HASH_FUNC_NAME",
",",
"password_text",
".",
"encode",
"(",
... | 9951a910750888dbe7dd3e98acae9c40efae0689 |
valid | User.gen_token | 生成 access_token | slim_cli/template/model/user.py | def gen_token(cls):
""" 生成 access_token """
token = os.urandom(16)
token_time = int(time.time())
return {'token': token, 'token_time': token_time} | def gen_token(cls):
""" 生成 access_token """
token = os.urandom(16)
token_time = int(time.time())
return {'token': token, 'token_time': token_time} | [
"生成",
"access_token"
] | fy0/slim | python | https://github.com/fy0/slim/blob/9951a910750888dbe7dd3e98acae9c40efae0689/slim_cli/template/model/user.py#L62-L66 | [
"def",
"gen_token",
"(",
"cls",
")",
":",
"token",
"=",
"os",
".",
"urandom",
"(",
"16",
")",
"token_time",
"=",
"int",
"(",
"time",
".",
"time",
"(",
")",
")",
"return",
"{",
"'token'",
":",
"token",
",",
"'token_time'",
":",
"token_time",
"}"
] | 9951a910750888dbe7dd3e98acae9c40efae0689 |
valid | User.set_password | 设置密码 | slim_cli/template/model/user.py | def set_password(self, new_password):
""" 设置密码 """
info = self.gen_password_and_salt(new_password)
self.password = info['password']
self.salt = info['salt']
self.save() | def set_password(self, new_password):
""" 设置密码 """
info = self.gen_password_and_salt(new_password)
self.password = info['password']
self.salt = info['salt']
self.save() | [
"设置密码"
] | fy0/slim | python | https://github.com/fy0/slim/blob/9951a910750888dbe7dd3e98acae9c40efae0689/slim_cli/template/model/user.py#L91-L96 | [
"def",
"set_password",
"(",
"self",
",",
"new_password",
")",
":",
"info",
"=",
"self",
".",
"gen_password_and_salt",
"(",
"new_password",
")",
"self",
".",
"password",
"=",
"info",
"[",
"'password'",
"]",
"self",
".",
"salt",
"=",
"info",
"[",
"'salt'",
... | 9951a910750888dbe7dd3e98acae9c40efae0689 |
valid | User._auth_base | 已获取了用户对象,进行密码校验
:param password_text:
:return: | slim_cli/template/model/user.py | def _auth_base(self, password_text):
"""
已获取了用户对象,进行密码校验
:param password_text:
:return:
"""
dk = hashlib.pbkdf2_hmac(
config.PASSWORD_HASH_FUNC_NAME,
password_text.encode('utf-8'),
get_bytes_from_blob(self.salt),
config.PASS... | def _auth_base(self, password_text):
"""
已获取了用户对象,进行密码校验
:param password_text:
:return:
"""
dk = hashlib.pbkdf2_hmac(
config.PASSWORD_HASH_FUNC_NAME,
password_text.encode('utf-8'),
get_bytes_from_blob(self.salt),
config.PASS... | [
"已获取了用户对象,进行密码校验",
":",
"param",
"password_text",
":",
":",
"return",
":"
] | fy0/slim | python | https://github.com/fy0/slim/blob/9951a910750888dbe7dd3e98acae9c40efae0689/slim_cli/template/model/user.py#L98-L112 | [
"def",
"_auth_base",
"(",
"self",
",",
"password_text",
")",
":",
"dk",
"=",
"hashlib",
".",
"pbkdf2_hmac",
"(",
"config",
".",
"PASSWORD_HASH_FUNC_NAME",
",",
"password_text",
".",
"encode",
"(",
"'utf-8'",
")",
",",
"get_bytes_from_blob",
"(",
"self",
".",
... | 9951a910750888dbe7dd3e98acae9c40efae0689 |
valid | BaseSession.get_session | Every request have a session instance
:param view:
:return: | slim/base/session.py | async def get_session(cls, view):
"""
Every request have a session instance
:param view:
:return:
"""
session = cls(view)
session.key = await session.get_key()
session._data = await session.load() or {}
return session | async def get_session(cls, view):
"""
Every request have a session instance
:param view:
:return:
"""
session = cls(view)
session.key = await session.get_key()
session._data = await session.load() or {}
return session | [
"Every",
"request",
"have",
"a",
"session",
"instance",
":",
"param",
"view",
":",
":",
"return",
":"
] | fy0/slim | python | https://github.com/fy0/slim/blob/9951a910750888dbe7dd3e98acae9c40efae0689/slim/base/session.py#L45-L54 | [
"async",
"def",
"get_session",
"(",
"cls",
",",
"view",
")",
":",
"session",
"=",
"cls",
"(",
"view",
")",
"session",
".",
"key",
"=",
"await",
"session",
".",
"get_key",
"(",
")",
"session",
".",
"_data",
"=",
"await",
"session",
".",
"load",
"(",
... | 9951a910750888dbe7dd3e98acae9c40efae0689 |
valid | AbstractSQLFunctions.select_page | Select from database
:param info:
:param size: -1 means infinite
:param page:
:param need_count: if True, get count as second return value, otherwise -1
:return: records. count | slim/base/sqlfuncs.py | async def select_page(self, info: SQLQueryInfo, size=1, page=1) -> Tuple[Tuple[DataRecord, ...], int]:
"""
Select from database
:param info:
:param size: -1 means infinite
:param page:
:param need_count: if True, get count as second return value, otherwise -1
:ret... | async def select_page(self, info: SQLQueryInfo, size=1, page=1) -> Tuple[Tuple[DataRecord, ...], int]:
"""
Select from database
:param info:
:param size: -1 means infinite
:param page:
:param need_count: if True, get count as second return value, otherwise -1
:ret... | [
"Select",
"from",
"database",
":",
"param",
"info",
":",
":",
"param",
"size",
":",
"-",
"1",
"means",
"infinite",
":",
"param",
"page",
":",
":",
"param",
"need_count",
":",
"if",
"True",
"get",
"count",
"as",
"second",
"return",
"value",
"otherwise",
... | fy0/slim | python | https://github.com/fy0/slim/blob/9951a910750888dbe7dd3e98acae9c40efae0689/slim/base/sqlfuncs.py#L24-L33 | [
"async",
"def",
"select_page",
"(",
"self",
",",
"info",
":",
"SQLQueryInfo",
",",
"size",
"=",
"1",
",",
"page",
"=",
"1",
")",
"->",
"Tuple",
"[",
"Tuple",
"[",
"DataRecord",
",",
"...",
"]",
",",
"int",
"]",
":",
"raise",
"NotImplementedError",
"(... | 9951a910750888dbe7dd3e98acae9c40efae0689 |
valid | AbstractSQLFunctions.update | :param records:
:param values:
:param returning:
:return: return count if returning is False, otherwise records | slim/base/sqlfuncs.py | async def update(self, records: Iterable[DataRecord], values: SQLValuesToWrite, returning=False) -> Union[int, Iterable[DataRecord]]:
"""
:param records:
:param values:
:param returning:
:return: return count if returning is False, otherwise records
"""
raise NotI... | async def update(self, records: Iterable[DataRecord], values: SQLValuesToWrite, returning=False) -> Union[int, Iterable[DataRecord]]:
"""
:param records:
:param values:
:param returning:
:return: return count if returning is False, otherwise records
"""
raise NotI... | [
":",
"param",
"records",
":",
":",
"param",
"values",
":",
":",
"param",
"returning",
":",
":",
"return",
":",
"return",
"count",
"if",
"returning",
"is",
"False",
"otherwise",
"records"
] | fy0/slim | python | https://github.com/fy0/slim/blob/9951a910750888dbe7dd3e98acae9c40efae0689/slim/base/sqlfuncs.py#L36-L43 | [
"async",
"def",
"update",
"(",
"self",
",",
"records",
":",
"Iterable",
"[",
"DataRecord",
"]",
",",
"values",
":",
"SQLValuesToWrite",
",",
"returning",
"=",
"False",
")",
"->",
"Union",
"[",
"int",
",",
"Iterable",
"[",
"DataRecord",
"]",
"]",
":",
"... | 9951a910750888dbe7dd3e98acae9c40efae0689 |
valid | AbstractSQLFunctions.insert | :param values_lst:
:param returning:
:return: return count if returning is False, otherwise records | slim/base/sqlfuncs.py | async def insert(self, values_lst: Iterable[SQLValuesToWrite], returning=False) -> Union[int, List[DataRecord]]:
"""
:param values_lst:
:param returning:
:return: return count if returning is False, otherwise records
"""
raise NotImplementedError() | async def insert(self, values_lst: Iterable[SQLValuesToWrite], returning=False) -> Union[int, List[DataRecord]]:
"""
:param values_lst:
:param returning:
:return: return count if returning is False, otherwise records
"""
raise NotImplementedError() | [
":",
"param",
"values_lst",
":",
":",
"param",
"returning",
":",
":",
"return",
":",
"return",
"count",
"if",
"returning",
"is",
"False",
"otherwise",
"records"
] | fy0/slim | python | https://github.com/fy0/slim/blob/9951a910750888dbe7dd3e98acae9c40efae0689/slim/base/sqlfuncs.py#L46-L52 | [
"async",
"def",
"insert",
"(",
"self",
",",
"values_lst",
":",
"Iterable",
"[",
"SQLValuesToWrite",
"]",
",",
"returning",
"=",
"False",
")",
"->",
"Union",
"[",
"int",
",",
"List",
"[",
"DataRecord",
"]",
"]",
":",
"raise",
"NotImplementedError",
"(",
"... | 9951a910750888dbe7dd3e98acae9c40efae0689 |
valid | SQLQueryInfo.parse_order | :param text: order=id.desc, xxx.asc
:return: [
[<column>, asc|desc|default],
[<column2>, asc|desc|default],
] | slim/base/sqlquery.py | def parse_order(text):
"""
:param text: order=id.desc, xxx.asc
:return: [
[<column>, asc|desc|default],
[<column2>, asc|desc|default],
]
"""
orders = []
for i in map(str.strip, text.split(',')):
items = i.split('.', 2)
... | def parse_order(text):
"""
:param text: order=id.desc, xxx.asc
:return: [
[<column>, asc|desc|default],
[<column2>, asc|desc|default],
]
"""
orders = []
for i in map(str.strip, text.split(',')):
items = i.split('.', 2)
... | [
":",
"param",
"text",
":",
"order",
"=",
"id",
".",
"desc",
"xxx",
".",
"asc",
":",
"return",
":",
"[",
"[",
"<column",
">",
"asc|desc|default",
"]",
"[",
"<column2",
">",
"asc|desc|default",
"]",
"]"
] | fy0/slim | python | https://github.com/fy0/slim/blob/9951a910750888dbe7dd3e98acae9c40efae0689/slim/base/sqlquery.py#L186-L208 | [
"def",
"parse_order",
"(",
"text",
")",
":",
"orders",
"=",
"[",
"]",
"for",
"i",
"in",
"map",
"(",
"str",
".",
"strip",
",",
"text",
".",
"split",
"(",
"','",
")",
")",
":",
"items",
"=",
"i",
".",
"split",
"(",
"'.'",
",",
"2",
")",
"if",
... | 9951a910750888dbe7dd3e98acae9c40efae0689 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.