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 | execute | Read, stretch and return raster data.
Inputs:
-------
raster
raster file
Parameters:
-----------
resampling : str
rasterio.Resampling method
scale_method : str
- dtype_scale: use dtype minimum and maximum values
- minmax_scale: use dataset bands minimum and ... | mapchete/processes/pyramid/tilify.py | def execute(
mp,
resampling="nearest",
scale_method=None,
scales_minmax=None
):
"""
Read, stretch and return raster data.
Inputs:
-------
raster
raster file
Parameters:
-----------
resampling : str
rasterio.Resampling method
scale_method : str
... | def execute(
mp,
resampling="nearest",
scale_method=None,
scales_minmax=None
):
"""
Read, stretch and return raster data.
Inputs:
-------
raster
raster file
Parameters:
-----------
resampling : str
rasterio.Resampling method
scale_method : str
... | [
"Read",
"stretch",
"and",
"return",
"raster",
"data",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/processes/pyramid/tilify.py#L16-L69 | [
"def",
"execute",
"(",
"mp",
",",
"resampling",
"=",
"\"nearest\"",
",",
"scale_method",
"=",
"None",
",",
"scales_minmax",
"=",
"None",
")",
":",
"with",
"mp",
".",
"open",
"(",
"\"raster\"",
",",
"resampling",
"=",
"resampling",
")",
"as",
"raster_file",... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | OutputData.read | Read existing process output.
Parameters
----------
output_tile : ``BufferedTile``
must be member of output ``TilePyramid``
Returns
-------
NumPy array | mapchete/formats/default/gtiff.py | def read(self, output_tile, **kwargs):
"""
Read existing process output.
Parameters
----------
output_tile : ``BufferedTile``
must be member of output ``TilePyramid``
Returns
-------
NumPy array
"""
try:
return rea... | def read(self, output_tile, **kwargs):
"""
Read existing process output.
Parameters
----------
output_tile : ``BufferedTile``
must be member of output ``TilePyramid``
Returns
-------
NumPy array
"""
try:
return rea... | [
"Read",
"existing",
"process",
"output",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/default/gtiff.py#L104-L120 | [
"def",
"read",
"(",
"self",
",",
"output_tile",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"return",
"read_raster_no_crs",
"(",
"self",
".",
"get_path",
"(",
"output_tile",
")",
")",
"except",
"FileNotFoundError",
":",
"return",
"self",
".",
"empty",
... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | OutputData.write | Write data from process tiles into GeoTIFF file(s).
Parameters
----------
process_tile : ``BufferedTile``
must be member of process ``TilePyramid``
data : ``np.ndarray`` | mapchete/formats/default/gtiff.py | def write(self, process_tile, data):
"""
Write data from process tiles into GeoTIFF file(s).
Parameters
----------
process_tile : ``BufferedTile``
must be member of process ``TilePyramid``
data : ``np.ndarray``
"""
if (
isinstance(... | def write(self, process_tile, data):
"""
Write data from process tiles into GeoTIFF file(s).
Parameters
----------
process_tile : ``BufferedTile``
must be member of process ``TilePyramid``
data : ``np.ndarray``
"""
if (
isinstance(... | [
"Write",
"data",
"from",
"process",
"tiles",
"into",
"GeoTIFF",
"file",
"(",
"s",
")",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/default/gtiff.py#L122-L166 | [
"def",
"write",
"(",
"self",
",",
"process_tile",
",",
"data",
")",
":",
"if",
"(",
"isinstance",
"(",
"data",
",",
"tuple",
")",
"and",
"len",
"(",
"data",
")",
"==",
"2",
"and",
"isinstance",
"(",
"data",
"[",
"1",
"]",
",",
"dict",
")",
")",
... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | OutputData.profile | Create a metadata dictionary for rasterio.
Parameters
----------
tile : ``BufferedTile``
Returns
-------
metadata : dictionary
output profile dictionary used for rasterio. | mapchete/formats/default/gtiff.py | def profile(self, tile=None):
"""
Create a metadata dictionary for rasterio.
Parameters
----------
tile : ``BufferedTile``
Returns
-------
metadata : dictionary
output profile dictionary used for rasterio.
"""
dst_metadata = G... | def profile(self, tile=None):
"""
Create a metadata dictionary for rasterio.
Parameters
----------
tile : ``BufferedTile``
Returns
-------
metadata : dictionary
output profile dictionary used for rasterio.
"""
dst_metadata = G... | [
"Create",
"a",
"metadata",
"dictionary",
"for",
"rasterio",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/default/gtiff.py#L188-L228 | [
"def",
"profile",
"(",
"self",
",",
"tile",
"=",
"None",
")",
":",
"dst_metadata",
"=",
"GTIFF_DEFAULT_PROFILE",
"dst_metadata",
".",
"pop",
"(",
"\"transform\"",
",",
"None",
")",
"dst_metadata",
".",
"update",
"(",
"count",
"=",
"self",
".",
"output_params... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | OutputData.empty | Return empty data.
Parameters
----------
process_tile : ``BufferedTile``
must be member of process ``TilePyramid``
Returns
-------
empty data : array
empty array with data type provided in output profile | mapchete/formats/default/gtiff.py | def empty(self, process_tile):
"""
Return empty data.
Parameters
----------
process_tile : ``BufferedTile``
must be member of process ``TilePyramid``
Returns
-------
empty data : array
empty array with data type provided in output... | def empty(self, process_tile):
"""
Return empty data.
Parameters
----------
process_tile : ``BufferedTile``
must be member of process ``TilePyramid``
Returns
-------
empty data : array
empty array with data type provided in output... | [
"Return",
"empty",
"data",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/default/gtiff.py#L230-L250 | [
"def",
"empty",
"(",
"self",
",",
"process_tile",
")",
":",
"profile",
"=",
"self",
".",
"profile",
"(",
"process_tile",
")",
"return",
"ma",
".",
"masked_array",
"(",
"data",
"=",
"np",
".",
"full",
"(",
"(",
"profile",
"[",
"\"count\"",
"]",
",",
"... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | OutputData.for_web | Convert data to web output (raster only).
Parameters
----------
data : array
Returns
-------
web data : array | mapchete/formats/default/gtiff.py | def for_web(self, data):
"""
Convert data to web output (raster only).
Parameters
----------
data : array
Returns
-------
web data : array
"""
return memory_file(
prepare_array(
data, masked=True, nodata=self.n... | def for_web(self, data):
"""
Convert data to web output (raster only).
Parameters
----------
data : array
Returns
-------
web data : array
"""
return memory_file(
prepare_array(
data, masked=True, nodata=self.n... | [
"Convert",
"data",
"to",
"web",
"output",
"(",
"raster",
"only",
")",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/default/gtiff.py#L252-L269 | [
"def",
"for_web",
"(",
"self",
",",
"data",
")",
":",
"return",
"memory_file",
"(",
"prepare_array",
"(",
"data",
",",
"masked",
"=",
"True",
",",
"nodata",
"=",
"self",
".",
"nodata",
",",
"dtype",
"=",
"self",
".",
"profile",
"(",
")",
"[",
"\"dtyp... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | OutputData.open | Open process output as input for other process.
Parameters
----------
tile : ``Tile``
process : ``MapcheteProcess``
kwargs : keyword arguments | mapchete/formats/default/gtiff.py | def open(self, tile, process, **kwargs):
"""
Open process output as input for other process.
Parameters
----------
tile : ``Tile``
process : ``MapcheteProcess``
kwargs : keyword arguments
"""
return InputTile(tile, process, kwargs.get("resampling"... | def open(self, tile, process, **kwargs):
"""
Open process output as input for other process.
Parameters
----------
tile : ``Tile``
process : ``MapcheteProcess``
kwargs : keyword arguments
"""
return InputTile(tile, process, kwargs.get("resampling"... | [
"Open",
"process",
"output",
"as",
"input",
"for",
"other",
"process",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/default/gtiff.py#L271-L281 | [
"def",
"open",
"(",
"self",
",",
"tile",
",",
"process",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"InputTile",
"(",
"tile",
",",
"process",
",",
"kwargs",
".",
"get",
"(",
"\"resampling\"",
",",
"None",
")",
")"
] | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | InputTile.read | Read reprojected & resampled input data.
Parameters
----------
indexes : integer or list
band number or list of band numbers
Returns
-------
data : array | mapchete/formats/default/gtiff.py | def read(self, indexes=None, **kwargs):
"""
Read reprojected & resampled input data.
Parameters
----------
indexes : integer or list
band number or list of band numbers
Returns
-------
data : array
"""
band_indexes = self._get... | def read(self, indexes=None, **kwargs):
"""
Read reprojected & resampled input data.
Parameters
----------
indexes : integer or list
band number or list of band numbers
Returns
-------
data : array
"""
band_indexes = self._get... | [
"Read",
"reprojected",
"&",
"resampled",
"input",
"data",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/default/gtiff.py#L311-L329 | [
"def",
"read",
"(",
"self",
",",
"indexes",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"band_indexes",
"=",
"self",
".",
"_get_band_indexes",
"(",
"indexes",
")",
"arr",
"=",
"self",
".",
"process",
".",
"get_raw_output",
"(",
"self",
".",
"tile",... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | InputTile.is_empty | Check if there is data within this tile.
Returns
-------
is empty : bool | mapchete/formats/default/gtiff.py | def is_empty(self, indexes=None):
"""
Check if there is data within this tile.
Returns
-------
is empty : bool
"""
# empty if tile does not intersect with file bounding box
return not self.tile.bbox.intersects(self.process.config.area_at_zoom()) | def is_empty(self, indexes=None):
"""
Check if there is data within this tile.
Returns
-------
is empty : bool
"""
# empty if tile does not intersect with file bounding box
return not self.tile.bbox.intersects(self.process.config.area_at_zoom()) | [
"Check",
"if",
"there",
"is",
"data",
"within",
"this",
"tile",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/default/gtiff.py#L331-L340 | [
"def",
"is_empty",
"(",
"self",
",",
"indexes",
"=",
"None",
")",
":",
"# empty if tile does not intersect with file bounding box",
"return",
"not",
"self",
".",
"tile",
".",
"bbox",
".",
"intersects",
"(",
"self",
".",
"process",
".",
"config",
".",
"area_at_zo... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | InputTile._get_band_indexes | Return valid band indexes. | mapchete/formats/default/gtiff.py | def _get_band_indexes(self, indexes=None):
"""Return valid band indexes."""
if indexes:
if isinstance(indexes, list):
return indexes
else:
return [indexes]
else:
return range(1, self.process.config.output.profile(self.tile)["cou... | def _get_band_indexes(self, indexes=None):
"""Return valid band indexes."""
if indexes:
if isinstance(indexes, list):
return indexes
else:
return [indexes]
else:
return range(1, self.process.config.output.profile(self.tile)["cou... | [
"Return",
"valid",
"band",
"indexes",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/default/gtiff.py#L342-L350 | [
"def",
"_get_band_indexes",
"(",
"self",
",",
"indexes",
"=",
"None",
")",
":",
"if",
"indexes",
":",
"if",
"isinstance",
"(",
"indexes",
",",
"list",
")",
":",
"return",
"indexes",
"else",
":",
"return",
"[",
"indexes",
"]",
"else",
":",
"return",
"ra... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | OutputData.profile | Create a metadata dictionary for rasterio.
Parameters
----------
tile : ``BufferedTile``
Returns
-------
metadata : dictionary
output profile dictionary used for rasterio. | mapchete/formats/default/png.py | def profile(self, tile=None):
"""
Create a metadata dictionary for rasterio.
Parameters
----------
tile : ``BufferedTile``
Returns
-------
metadata : dictionary
output profile dictionary used for rasterio.
"""
dst_metadata = P... | def profile(self, tile=None):
"""
Create a metadata dictionary for rasterio.
Parameters
----------
tile : ``BufferedTile``
Returns
-------
metadata : dictionary
output profile dictionary used for rasterio.
"""
dst_metadata = P... | [
"Create",
"a",
"metadata",
"dictionary",
"for",
"rasterio",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/default/png.py#L156-L179 | [
"def",
"profile",
"(",
"self",
",",
"tile",
"=",
"None",
")",
":",
"dst_metadata",
"=",
"PNG_DEFAULT_PROFILE",
"dst_metadata",
".",
"pop",
"(",
"\"transform\"",
",",
"None",
")",
"if",
"tile",
"is",
"not",
"None",
":",
"dst_metadata",
".",
"update",
"(",
... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | OutputData.for_web | Convert data to web output.
Parameters
----------
data : array
Returns
-------
web data : array | mapchete/formats/default/png.py | def for_web(self, data):
"""
Convert data to web output.
Parameters
----------
data : array
Returns
-------
web data : array
"""
rgba = self._prepare_array_for_png(data)
data = ma.masked_where(rgba == self.nodata, rgba)
re... | def for_web(self, data):
"""
Convert data to web output.
Parameters
----------
data : array
Returns
-------
web data : array
"""
rgba = self._prepare_array_for_png(data)
data = ma.masked_where(rgba == self.nodata, rgba)
re... | [
"Convert",
"data",
"to",
"web",
"output",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/default/png.py#L181-L195 | [
"def",
"for_web",
"(",
"self",
",",
"data",
")",
":",
"rgba",
"=",
"self",
".",
"_prepare_array_for_png",
"(",
"data",
")",
"data",
"=",
"ma",
".",
"masked_where",
"(",
"rgba",
"==",
"self",
".",
"nodata",
",",
"rgba",
")",
"return",
"memory_file",
"("... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | OutputData.empty | Return empty data.
Parameters
----------
process_tile : ``BufferedTile``
must be member of process ``TilePyramid``
Returns
-------
empty data : array
empty array with data type given in output parameters | mapchete/formats/default/png.py | def empty(self, process_tile):
"""
Return empty data.
Parameters
----------
process_tile : ``BufferedTile``
must be member of process ``TilePyramid``
Returns
-------
empty data : array
empty array with data type given in output pa... | def empty(self, process_tile):
"""
Return empty data.
Parameters
----------
process_tile : ``BufferedTile``
must be member of process ``TilePyramid``
Returns
-------
empty data : array
empty array with data type given in output pa... | [
"Return",
"empty",
"data",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/default/png.py#L197-L220 | [
"def",
"empty",
"(",
"self",
",",
"process_tile",
")",
":",
"bands",
"=",
"(",
"self",
".",
"output_params",
"[",
"\"bands\"",
"]",
"if",
"\"bands\"",
"in",
"self",
".",
"output_params",
"else",
"PNG_DEFAULT_PROFILE",
"[",
"\"count\"",
"]",
")",
"return",
... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | serve | Serve a Mapchete process.
Creates the Mapchete host and serves both web page with OpenLayers and the
WMTS simple REST endpoint. | mapchete/cli/default/serve.py | def serve(
mapchete_file,
port=None,
internal_cache=None,
zoom=None,
bounds=None,
overwrite=False,
readonly=False,
memory=False,
input_file=None,
debug=False,
logfile=None
):
"""
Serve a Mapchete process.
Creates the Mapchete host and serves both web page with Op... | def serve(
mapchete_file,
port=None,
internal_cache=None,
zoom=None,
bounds=None,
overwrite=False,
readonly=False,
memory=False,
input_file=None,
debug=False,
logfile=None
):
"""
Serve a Mapchete process.
Creates the Mapchete host and serves both web page with Op... | [
"Serve",
"a",
"Mapchete",
"process",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/cli/default/serve.py#L30-L60 | [
"def",
"serve",
"(",
"mapchete_file",
",",
"port",
"=",
"None",
",",
"internal_cache",
"=",
"None",
",",
"zoom",
"=",
"None",
",",
"bounds",
"=",
"None",
",",
"overwrite",
"=",
"False",
",",
"readonly",
"=",
"False",
",",
"memory",
"=",
"False",
",",
... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | create_app | Configure and create Flask app. | mapchete/cli/default/serve.py | def create_app(
mapchete_files=None, zoom=None, bounds=None, single_input_file=None,
mode="continue", debug=None
):
"""Configure and create Flask app."""
from flask import Flask, render_template_string
app = Flask(__name__)
mapchete_processes = {
os.path.splitext(os.path.basename(mapchet... | def create_app(
mapchete_files=None, zoom=None, bounds=None, single_input_file=None,
mode="continue", debug=None
):
"""Configure and create Flask app."""
from flask import Flask, render_template_string
app = Flask(__name__)
mapchete_processes = {
os.path.splitext(os.path.basename(mapchet... | [
"Configure",
"and",
"create",
"Flask",
"app",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/cli/default/serve.py#L63-L112 | [
"def",
"create_app",
"(",
"mapchete_files",
"=",
"None",
",",
"zoom",
"=",
"None",
",",
"bounds",
"=",
"None",
",",
"single_input_file",
"=",
"None",
",",
"mode",
"=",
"\"continue\"",
",",
"debug",
"=",
"None",
")",
":",
"from",
"flask",
"import",
"Flask... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | read_raster_window | Return NumPy arrays from an input raster.
NumPy arrays are reprojected and resampled to tile properties from input
raster. If tile boundaries cross the antimeridian, data on the other side
of the antimeridian will be read and concatenated to the numpy array
accordingly.
Parameters
----------
... | mapchete/io/raster.py | def read_raster_window(
input_files,
tile,
indexes=None,
resampling="nearest",
src_nodata=None,
dst_nodata=None,
gdal_opts=None
):
"""
Return NumPy arrays from an input raster.
NumPy arrays are reprojected and resampled to tile properties from input
raster. If tile boundarie... | def read_raster_window(
input_files,
tile,
indexes=None,
resampling="nearest",
src_nodata=None,
dst_nodata=None,
gdal_opts=None
):
"""
Return NumPy arrays from an input raster.
NumPy arrays are reprojected and resampled to tile properties from input
raster. If tile boundarie... | [
"Return",
"NumPy",
"arrays",
"from",
"an",
"input",
"raster",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/io/raster.py#L31-L86 | [
"def",
"read_raster_window",
"(",
"input_files",
",",
"tile",
",",
"indexes",
"=",
"None",
",",
"resampling",
"=",
"\"nearest\"",
",",
"src_nodata",
"=",
"None",
",",
"dst_nodata",
"=",
"None",
",",
"gdal_opts",
"=",
"None",
")",
":",
"with",
"rasterio",
"... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | _get_warped_array | Extract a numpy array from a raster file. | mapchete/io/raster.py | def _get_warped_array(
input_file=None,
indexes=None,
dst_bounds=None,
dst_shape=None,
dst_crs=None,
resampling=None,
src_nodata=None,
dst_nodata=None
):
"""Extract a numpy array from a raster file."""
try:
return _rasterio_read(
input_file=input_file,
... | def _get_warped_array(
input_file=None,
indexes=None,
dst_bounds=None,
dst_shape=None,
dst_crs=None,
resampling=None,
src_nodata=None,
dst_nodata=None
):
"""Extract a numpy array from a raster file."""
try:
return _rasterio_read(
input_file=input_file,
... | [
"Extract",
"a",
"numpy",
"array",
"from",
"a",
"raster",
"file",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/io/raster.py#L224-L248 | [
"def",
"_get_warped_array",
"(",
"input_file",
"=",
"None",
",",
"indexes",
"=",
"None",
",",
"dst_bounds",
"=",
"None",
",",
"dst_shape",
"=",
"None",
",",
"dst_crs",
"=",
"None",
",",
"resampling",
"=",
"None",
",",
"src_nodata",
"=",
"None",
",",
"dst... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | read_raster_no_crs | Wrapper function around rasterio.open().read().
Parameters
----------
input_file : str
Path to file
indexes : int or list
Band index or list of band indexes to be read.
Returns
-------
MaskedArray
Raises
------
FileNotFoundError if file cannot be found. | mapchete/io/raster.py | def read_raster_no_crs(input_file, indexes=None, gdal_opts=None):
"""
Wrapper function around rasterio.open().read().
Parameters
----------
input_file : str
Path to file
indexes : int or list
Band index or list of band indexes to be read.
Returns
-------
MaskedArray... | def read_raster_no_crs(input_file, indexes=None, gdal_opts=None):
"""
Wrapper function around rasterio.open().read().
Parameters
----------
input_file : str
Path to file
indexes : int or list
Band index or list of band indexes to be read.
Returns
-------
MaskedArray... | [
"Wrapper",
"function",
"around",
"rasterio",
".",
"open",
"()",
".",
"read",
"()",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/io/raster.py#L290-L324 | [
"def",
"read_raster_no_crs",
"(",
"input_file",
",",
"indexes",
"=",
"None",
",",
"gdal_opts",
"=",
"None",
")",
":",
"with",
"warnings",
".",
"catch_warnings",
"(",
")",
":",
"warnings",
".",
"simplefilter",
"(",
"\"ignore\"",
")",
"try",
":",
"with",
"ra... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | write_raster_window | Write a window from a numpy array to an output file.
Parameters
----------
in_tile : ``BufferedTile``
``BufferedTile`` with a data attribute holding NumPy data
in_data : array
out_profile : dictionary
metadata dictionary for rasterio
out_tile : ``Tile``
provides output b... | mapchete/io/raster.py | def write_raster_window(
in_tile=None, in_data=None, out_profile=None, out_tile=None, out_path=None,
tags=None, bucket_resource=None
):
"""
Write a window from a numpy array to an output file.
Parameters
----------
in_tile : ``BufferedTile``
``BufferedTile`` with a data attribute ho... | def write_raster_window(
in_tile=None, in_data=None, out_profile=None, out_tile=None, out_path=None,
tags=None, bucket_resource=None
):
"""
Write a window from a numpy array to an output file.
Parameters
----------
in_tile : ``BufferedTile``
``BufferedTile`` with a data attribute ho... | [
"Write",
"a",
"window",
"from",
"a",
"numpy",
"array",
"to",
"an",
"output",
"file",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/io/raster.py#L360-L429 | [
"def",
"write_raster_window",
"(",
"in_tile",
"=",
"None",
",",
"in_data",
"=",
"None",
",",
"out_profile",
"=",
"None",
",",
"out_tile",
"=",
"None",
",",
"out_path",
"=",
"None",
",",
"tags",
"=",
"None",
",",
"bucket_resource",
"=",
"None",
")",
":",
... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | extract_from_array | Extract raster data window array.
Parameters
----------
in_raster : array or ReferencedRaster
in_affine : ``Affine`` required if in_raster is an array
out_tile : ``BufferedTile``
Returns
-------
extracted array : array | mapchete/io/raster.py | def extract_from_array(in_raster=None, in_affine=None, out_tile=None):
"""
Extract raster data window array.
Parameters
----------
in_raster : array or ReferencedRaster
in_affine : ``Affine`` required if in_raster is an array
out_tile : ``BufferedTile``
Returns
-------
extracte... | def extract_from_array(in_raster=None, in_affine=None, out_tile=None):
"""
Extract raster data window array.
Parameters
----------
in_raster : array or ReferencedRaster
in_affine : ``Affine`` required if in_raster is an array
out_tile : ``BufferedTile``
Returns
-------
extracte... | [
"Extract",
"raster",
"data",
"window",
"array",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/io/raster.py#L452-L484 | [
"def",
"extract_from_array",
"(",
"in_raster",
"=",
"None",
",",
"in_affine",
"=",
"None",
",",
"out_tile",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"in_raster",
",",
"ReferencedRaster",
")",
":",
"in_affine",
"=",
"in_raster",
".",
"affine",
"in_rast... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | resample_from_array | Extract and resample from array to target tile.
Parameters
----------
in_raster : array
in_affine : ``Affine``
out_tile : ``BufferedTile``
resampling : string
one of rasterio's resampling methods (default: nearest)
nodataval : integer or float
raster nodata value (default: 0... | mapchete/io/raster.py | def resample_from_array(
in_raster=None,
in_affine=None,
out_tile=None,
in_crs=None,
resampling="nearest",
nodataval=0
):
"""
Extract and resample from array to target tile.
Parameters
----------
in_raster : array
in_affine : ``Affine``
out_tile : ``BufferedTile``
... | def resample_from_array(
in_raster=None,
in_affine=None,
out_tile=None,
in_crs=None,
resampling="nearest",
nodataval=0
):
"""
Extract and resample from array to target tile.
Parameters
----------
in_raster : array
in_affine : ``Affine``
out_tile : ``BufferedTile``
... | [
"Extract",
"and",
"resample",
"from",
"array",
"to",
"target",
"tile",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/io/raster.py#L487-L556 | [
"def",
"resample_from_array",
"(",
"in_raster",
"=",
"None",
",",
"in_affine",
"=",
"None",
",",
"out_tile",
"=",
"None",
",",
"in_crs",
"=",
"None",
",",
"resampling",
"=",
"\"nearest\"",
",",
"nodataval",
"=",
"0",
")",
":",
"# TODO rename function",
"if",... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | create_mosaic | Create a mosaic from tiles. Tiles must be connected (also possible over Antimeridian),
otherwise strange things can happen!
Parameters
----------
tiles : iterable
an iterable containing tuples of a BufferedTile and an array
nodata : integer or float
raster nodata value to initialize... | mapchete/io/raster.py | def create_mosaic(tiles, nodata=0):
"""
Create a mosaic from tiles. Tiles must be connected (also possible over Antimeridian),
otherwise strange things can happen!
Parameters
----------
tiles : iterable
an iterable containing tuples of a BufferedTile and an array
nodata : integer or... | def create_mosaic(tiles, nodata=0):
"""
Create a mosaic from tiles. Tiles must be connected (also possible over Antimeridian),
otherwise strange things can happen!
Parameters
----------
tiles : iterable
an iterable containing tuples of a BufferedTile and an array
nodata : integer or... | [
"Create",
"a",
"mosaic",
"from",
"tiles",
".",
"Tiles",
"must",
"be",
"connected",
"(",
"also",
"possible",
"over",
"Antimeridian",
")",
"otherwise",
"strange",
"things",
"can",
"happen!"
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/io/raster.py#L559-L656 | [
"def",
"create_mosaic",
"(",
"tiles",
",",
"nodata",
"=",
"0",
")",
":",
"if",
"isinstance",
"(",
"tiles",
",",
"GeneratorType",
")",
":",
"tiles",
"=",
"list",
"(",
"tiles",
")",
"elif",
"not",
"isinstance",
"(",
"tiles",
",",
"list",
")",
":",
"rai... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | bounds_to_ranges | Return bounds range values from geolocated input.
Parameters
----------
out_bounds : tuple
left, bottom, right, top
in_affine : Affine
input geolocation
in_shape : tuple
input shape
Returns
-------
minrow, maxrow, mincol, maxcol | mapchete/io/raster.py | def bounds_to_ranges(out_bounds=None, in_affine=None, in_shape=None):
"""
Return bounds range values from geolocated input.
Parameters
----------
out_bounds : tuple
left, bottom, right, top
in_affine : Affine
input geolocation
in_shape : tuple
input shape
Return... | def bounds_to_ranges(out_bounds=None, in_affine=None, in_shape=None):
"""
Return bounds range values from geolocated input.
Parameters
----------
out_bounds : tuple
left, bottom, right, top
in_affine : Affine
input geolocation
in_shape : tuple
input shape
Return... | [
"Return",
"bounds",
"range",
"values",
"from",
"geolocated",
"input",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/io/raster.py#L659-L680 | [
"def",
"bounds_to_ranges",
"(",
"out_bounds",
"=",
"None",
",",
"in_affine",
"=",
"None",
",",
"in_shape",
"=",
"None",
")",
":",
"return",
"itertools",
".",
"chain",
"(",
"*",
"from_bounds",
"(",
"*",
"out_bounds",
",",
"transform",
"=",
"in_affine",
",",... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | tiles_to_affine_shape | Return Affine and shape of combined tiles.
Parameters
----------
tiles : iterable
an iterable containing BufferedTiles
Returns
-------
Affine, Shape | mapchete/io/raster.py | def tiles_to_affine_shape(tiles):
"""
Return Affine and shape of combined tiles.
Parameters
----------
tiles : iterable
an iterable containing BufferedTiles
Returns
-------
Affine, Shape
"""
if not tiles:
raise TypeError("no tiles provided")
pixel_size = til... | def tiles_to_affine_shape(tiles):
"""
Return Affine and shape of combined tiles.
Parameters
----------
tiles : iterable
an iterable containing BufferedTiles
Returns
-------
Affine, Shape
"""
if not tiles:
raise TypeError("no tiles provided")
pixel_size = til... | [
"Return",
"Affine",
"and",
"shape",
"of",
"combined",
"tiles",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/io/raster.py#L683-L711 | [
"def",
"tiles_to_affine_shape",
"(",
"tiles",
")",
":",
"if",
"not",
"tiles",
":",
"raise",
"TypeError",
"(",
"\"no tiles provided\"",
")",
"pixel_size",
"=",
"tiles",
"[",
"0",
"]",
".",
"pixel_x_size",
"left",
",",
"bottom",
",",
"right",
",",
"top",
"="... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | _shift_required | Determine if distance over antimeridian is shorter than normal distance. | mapchete/io/raster.py | def _shift_required(tiles):
"""Determine if distance over antimeridian is shorter than normal distance."""
if tiles[0][0].tile_pyramid.is_global:
# get set of tile columns
tile_cols = sorted(list(set([t[0].col for t in tiles])))
# if tile columns are an unbroken sequence, tiles are conne... | def _shift_required(tiles):
"""Determine if distance over antimeridian is shorter than normal distance."""
if tiles[0][0].tile_pyramid.is_global:
# get set of tile columns
tile_cols = sorted(list(set([t[0].col for t in tiles])))
# if tile columns are an unbroken sequence, tiles are conne... | [
"Determine",
"if",
"distance",
"over",
"antimeridian",
"is",
"shorter",
"than",
"normal",
"distance",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/io/raster.py#L727-L767 | [
"def",
"_shift_required",
"(",
"tiles",
")",
":",
"if",
"tiles",
"[",
"0",
"]",
"[",
"0",
"]",
".",
"tile_pyramid",
".",
"is_global",
":",
"# get set of tile columns",
"tile_cols",
"=",
"sorted",
"(",
"list",
"(",
"set",
"(",
"[",
"t",
"[",
"0",
"]",
... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | memory_file | Return a rasterio.io.MemoryFile instance from input.
Parameters
----------
data : array
array to be written
profile : dict
rasterio profile for MemoryFile | mapchete/io/raster.py | def memory_file(data=None, profile=None):
"""
Return a rasterio.io.MemoryFile instance from input.
Parameters
----------
data : array
array to be written
profile : dict
rasterio profile for MemoryFile
"""
memfile = MemoryFile()
profile.update(width=data.shape[-2], he... | def memory_file(data=None, profile=None):
"""
Return a rasterio.io.MemoryFile instance from input.
Parameters
----------
data : array
array to be written
profile : dict
rasterio profile for MemoryFile
"""
memfile = MemoryFile()
profile.update(width=data.shape[-2], he... | [
"Return",
"a",
"rasterio",
".",
"io",
".",
"MemoryFile",
"instance",
"from",
"input",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/io/raster.py#L770-L785 | [
"def",
"memory_file",
"(",
"data",
"=",
"None",
",",
"profile",
"=",
"None",
")",
":",
"memfile",
"=",
"MemoryFile",
"(",
")",
"profile",
".",
"update",
"(",
"width",
"=",
"data",
".",
"shape",
"[",
"-",
"2",
"]",
",",
"height",
"=",
"data",
".",
... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | prepare_array | Turn input data into a proper array for further usage.
Outut array is always 3-dimensional with the given data type. If the output
is masked, the fill_value corresponds to the given nodata value and the
nodata value will be burned into the data array.
Parameters
----------
data : array or iter... | mapchete/io/raster.py | def prepare_array(data, masked=True, nodata=0, dtype="int16"):
"""
Turn input data into a proper array for further usage.
Outut array is always 3-dimensional with the given data type. If the output
is masked, the fill_value corresponds to the given nodata value and the
nodata value will be burned i... | def prepare_array(data, masked=True, nodata=0, dtype="int16"):
"""
Turn input data into a proper array for further usage.
Outut array is always 3-dimensional with the given data type. If the output
is masked, the fill_value corresponds to the given nodata value and the
nodata value will be burned i... | [
"Turn",
"input",
"data",
"into",
"a",
"proper",
"array",
"for",
"further",
"usage",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/io/raster.py#L788-L833 | [
"def",
"prepare_array",
"(",
"data",
",",
"masked",
"=",
"True",
",",
"nodata",
"=",
"0",
",",
"dtype",
"=",
"\"int16\"",
")",
":",
"# input is iterable",
"if",
"isinstance",
"(",
"data",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"return",
"_prepa... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | InputData.bbox | Return data bounding box.
Parameters
----------
out_crs : ``rasterio.crs.CRS``
rasterio CRS object (default: CRS of process pyramid)
Returns
-------
bounding box : geometry
Shapely geometry object | mapchete/formats/default/vector_file.py | def bbox(self, out_crs=None):
"""
Return data bounding box.
Parameters
----------
out_crs : ``rasterio.crs.CRS``
rasterio CRS object (default: CRS of process pyramid)
Returns
-------
bounding box : geometry
Shapely geometry object... | def bbox(self, out_crs=None):
"""
Return data bounding box.
Parameters
----------
out_crs : ``rasterio.crs.CRS``
rasterio CRS object (default: CRS of process pyramid)
Returns
-------
bounding box : geometry
Shapely geometry object... | [
"Return",
"data",
"bounding",
"box",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/default/vector_file.py#L73-L92 | [
"def",
"bbox",
"(",
"self",
",",
"out_crs",
"=",
"None",
")",
":",
"out_crs",
"=",
"self",
".",
"pyramid",
".",
"crs",
"if",
"out_crs",
"is",
"None",
"else",
"out_crs",
"with",
"fiona",
".",
"open",
"(",
"self",
".",
"path",
")",
"as",
"inp",
":",
... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | InputTile.read | Read reprojected & resampled input data.
Parameters
----------
validity_check : bool
also run checks if reprojected geometry is valid, otherwise throw
RuntimeError (default: True)
Returns
-------
data : list | mapchete/formats/default/vector_file.py | def read(self, validity_check=True, **kwargs):
"""
Read reprojected & resampled input data.
Parameters
----------
validity_check : bool
also run checks if reprojected geometry is valid, otherwise throw
RuntimeError (default: True)
Returns
... | def read(self, validity_check=True, **kwargs):
"""
Read reprojected & resampled input data.
Parameters
----------
validity_check : bool
also run checks if reprojected geometry is valid, otherwise throw
RuntimeError (default: True)
Returns
... | [
"Read",
"reprojected",
"&",
"resampled",
"input",
"data",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/default/vector_file.py#L118-L132 | [
"def",
"read",
"(",
"self",
",",
"validity_check",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"[",
"]",
"if",
"self",
".",
"is_empty",
"(",
")",
"else",
"self",
".",
"_read_from_cache",
"(",
"validity_check",
")"
] | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | InputTile.is_empty | Check if there is data within this tile.
Returns
-------
is empty : bool | mapchete/formats/default/vector_file.py | def is_empty(self):
"""
Check if there is data within this tile.
Returns
-------
is empty : bool
"""
if not self.tile.bbox.intersects(self.vector_file.bbox()):
return True
return len(self._read_from_cache(True)) == 0 | def is_empty(self):
"""
Check if there is data within this tile.
Returns
-------
is empty : bool
"""
if not self.tile.bbox.intersects(self.vector_file.bbox()):
return True
return len(self._read_from_cache(True)) == 0 | [
"Check",
"if",
"there",
"is",
"data",
"within",
"this",
"tile",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/default/vector_file.py#L134-L144 | [
"def",
"is_empty",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"tile",
".",
"bbox",
".",
"intersects",
"(",
"self",
".",
"vector_file",
".",
"bbox",
"(",
")",
")",
":",
"return",
"True",
"return",
"len",
"(",
"self",
".",
"_read_from_cache",
"("... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | reproject_geometry | Reproject a geometry to target CRS.
Also, clips geometry if it lies outside the destination CRS boundary.
Supported destination CRSes for clipping: 4326 (WGS84), 3857 (Spherical
Mercator) and 3035 (ETRS89 / ETRS-LAEA).
Parameters
----------
geometry : ``shapely.geometry``
src_crs : ``raste... | mapchete/io/vector.py | def reproject_geometry(
geometry, src_crs=None, dst_crs=None, error_on_clip=False, validity_check=True,
antimeridian_cutting=False
):
"""
Reproject a geometry to target CRS.
Also, clips geometry if it lies outside the destination CRS boundary.
Supported destination CRSes for clipping: 4326 (WGS... | def reproject_geometry(
geometry, src_crs=None, dst_crs=None, error_on_clip=False, validity_check=True,
antimeridian_cutting=False
):
"""
Reproject a geometry to target CRS.
Also, clips geometry if it lies outside the destination CRS boundary.
Supported destination CRSes for clipping: 4326 (WGS... | [
"Reproject",
"a",
"geometry",
"to",
"target",
"CRS",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/io/vector.py#L34-L105 | [
"def",
"reproject_geometry",
"(",
"geometry",
",",
"src_crs",
"=",
"None",
",",
"dst_crs",
"=",
"None",
",",
"error_on_clip",
"=",
"False",
",",
"validity_check",
"=",
"True",
",",
"antimeridian_cutting",
"=",
"False",
")",
":",
"src_crs",
"=",
"_validated_crs... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | segmentize_geometry | Segmentize Polygon outer ring by segmentize value.
Just Polygon geometry type supported.
Parameters
----------
geometry : ``shapely.geometry``
segmentize_value: float
Returns
-------
geometry : ``shapely.geometry`` | mapchete/io/vector.py | def segmentize_geometry(geometry, segmentize_value):
"""
Segmentize Polygon outer ring by segmentize value.
Just Polygon geometry type supported.
Parameters
----------
geometry : ``shapely.geometry``
segmentize_value: float
Returns
-------
geometry : ``shapely.geometry``
"... | def segmentize_geometry(geometry, segmentize_value):
"""
Segmentize Polygon outer ring by segmentize value.
Just Polygon geometry type supported.
Parameters
----------
geometry : ``shapely.geometry``
segmentize_value: float
Returns
-------
geometry : ``shapely.geometry``
"... | [
"Segmentize",
"Polygon",
"outer",
"ring",
"by",
"segmentize",
"value",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/io/vector.py#L131-L163 | [
"def",
"segmentize_geometry",
"(",
"geometry",
",",
"segmentize_value",
")",
":",
"if",
"geometry",
".",
"geom_type",
"!=",
"\"Polygon\"",
":",
"raise",
"TypeError",
"(",
"\"segmentize geometry type must be Polygon\"",
")",
"return",
"Polygon",
"(",
"LinearRing",
"(",... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | read_vector_window | Read a window of an input vector dataset.
Also clips geometry.
Parameters:
-----------
input_file : string
path to vector file
tile : ``Tile``
tile extent to read data from
validity_check : bool
checks if reprojected geometry is valid and throws ``RuntimeError`` if
... | mapchete/io/vector.py | def read_vector_window(input_files, tile, validity_check=True):
"""
Read a window of an input vector dataset.
Also clips geometry.
Parameters:
-----------
input_file : string
path to vector file
tile : ``Tile``
tile extent to read data from
validity_check : bool
... | def read_vector_window(input_files, tile, validity_check=True):
"""
Read a window of an input vector dataset.
Also clips geometry.
Parameters:
-----------
input_file : string
path to vector file
tile : ``Tile``
tile extent to read data from
validity_check : bool
... | [
"Read",
"a",
"window",
"of",
"an",
"input",
"vector",
"dataset",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/io/vector.py#L166-L195 | [
"def",
"read_vector_window",
"(",
"input_files",
",",
"tile",
",",
"validity_check",
"=",
"True",
")",
":",
"if",
"not",
"isinstance",
"(",
"input_files",
",",
"list",
")",
":",
"input_files",
"=",
"[",
"input_files",
"]",
"return",
"[",
"feature",
"for",
... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | write_vector_window | Write features to GeoJSON file.
Parameters
----------
in_data : features
out_schema : dictionary
output schema for fiona
out_tile : ``BufferedTile``
tile used for output extent
out_path : string
output path for GeoJSON file | mapchete/io/vector.py | def write_vector_window(
in_data=None, out_schema=None, out_tile=None, out_path=None, bucket_resource=None
):
"""
Write features to GeoJSON file.
Parameters
----------
in_data : features
out_schema : dictionary
output schema for fiona
out_tile : ``BufferedTile``
tile use... | def write_vector_window(
in_data=None, out_schema=None, out_tile=None, out_path=None, bucket_resource=None
):
"""
Write features to GeoJSON file.
Parameters
----------
in_data : features
out_schema : dictionary
output schema for fiona
out_tile : ``BufferedTile``
tile use... | [
"Write",
"features",
"to",
"GeoJSON",
"file",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/io/vector.py#L221-L292 | [
"def",
"write_vector_window",
"(",
"in_data",
"=",
"None",
",",
"out_schema",
"=",
"None",
",",
"out_tile",
"=",
"None",
",",
"out_path",
"=",
"None",
",",
"bucket_resource",
"=",
"None",
")",
":",
"# Delete existing file.",
"try",
":",
"os",
".",
"remove",
... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | clean_geometry_type | Return geometry of a specific type if possible.
Filters and splits up GeometryCollection into target types. This is
necessary when after clipping and/or reprojecting the geometry types from
source geometries change (i.e. a Polygon becomes a LineString or a
LineString becomes Point) in some edge cases.
... | mapchete/io/vector.py | def clean_geometry_type(geometry, target_type, allow_multipart=True):
"""
Return geometry of a specific type if possible.
Filters and splits up GeometryCollection into target types. This is
necessary when after clipping and/or reprojecting the geometry types from
source geometries change (i.e. a Po... | def clean_geometry_type(geometry, target_type, allow_multipart=True):
"""
Return geometry of a specific type if possible.
Filters and splits up GeometryCollection into target types. This is
necessary when after clipping and/or reprojecting the geometry types from
source geometries change (i.e. a Po... | [
"Return",
"geometry",
"of",
"a",
"specific",
"type",
"if",
"possible",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/io/vector.py#L373-L428 | [
"def",
"clean_geometry_type",
"(",
"geometry",
",",
"target_type",
",",
"allow_multipart",
"=",
"True",
")",
":",
"multipart_geoms",
"=",
"{",
"\"Point\"",
":",
"MultiPoint",
",",
"\"LineString\"",
":",
"MultiLineString",
",",
"\"Polygon\"",
":",
"MultiPolygon",
"... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | multipart_to_singleparts | Yield single part geometries if geom is multipart, otherwise yield geom.
Parameters:
-----------
geom : shapely geometry
Returns:
--------
shapely single part geometries | mapchete/io/vector.py | def multipart_to_singleparts(geom):
"""
Yield single part geometries if geom is multipart, otherwise yield geom.
Parameters:
-----------
geom : shapely geometry
Returns:
--------
shapely single part geometries
"""
if isinstance(geom, base.BaseGeometry):
if hasattr(geom,... | def multipart_to_singleparts(geom):
"""
Yield single part geometries if geom is multipart, otherwise yield geom.
Parameters:
-----------
geom : shapely geometry
Returns:
--------
shapely single part geometries
"""
if isinstance(geom, base.BaseGeometry):
if hasattr(geom,... | [
"Yield",
"single",
"part",
"geometries",
"if",
"geom",
"is",
"multipart",
"otherwise",
"yield",
"geom",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/io/vector.py#L446-L463 | [
"def",
"multipart_to_singleparts",
"(",
"geom",
")",
":",
"if",
"isinstance",
"(",
"geom",
",",
"base",
".",
"BaseGeometry",
")",
":",
"if",
"hasattr",
"(",
"geom",
",",
"\"geoms\"",
")",
":",
"for",
"subgeom",
"in",
"geom",
":",
"yield",
"subgeom",
"els... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | execute | Convert and optionally clip input raster data.
Inputs:
-------
raster
singleband or multiband data input
clip (optional)
vector data used to clip output
Parameters
----------
td_resampling : str (default: 'nearest')
Resampling used when reading from TileDirectory.
... | mapchete/processes/convert.py | def execute(
mp,
td_resampling="nearest",
td_matching_method="gdal",
td_matching_max_zoom=None,
td_matching_precision=8,
td_fallback_to_higher_zoom=False,
clip_pixelbuffer=0,
**kwargs
):
"""
Convert and optionally clip input raster data.
Inputs:
-------
raster
... | def execute(
mp,
td_resampling="nearest",
td_matching_method="gdal",
td_matching_max_zoom=None,
td_matching_precision=8,
td_fallback_to_higher_zoom=False,
clip_pixelbuffer=0,
**kwargs
):
"""
Convert and optionally clip input raster data.
Inputs:
-------
raster
... | [
"Convert",
"and",
"optionally",
"clip",
"input",
"raster",
"data",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/processes/convert.py#L7-L88 | [
"def",
"execute",
"(",
"mp",
",",
"td_resampling",
"=",
"\"nearest\"",
",",
"td_matching_method",
"=",
"\"gdal\"",
",",
"td_matching_max_zoom",
"=",
"None",
",",
"td_matching_precision",
"=",
"8",
",",
"td_fallback_to_higher_zoom",
"=",
"False",
",",
"clip_pixelbuff... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | get_best_zoom_level | Determine the best base zoom level for a raster.
"Best" means the maximum zoom level where no oversampling has to be done.
Parameters
----------
input_file : path to raster file
tile_pyramid_type : ``TilePyramid`` projection (``geodetic`` or``mercator``)
Returns
-------
zoom : integer | mapchete/io/__init__.py | def get_best_zoom_level(input_file, tile_pyramid_type):
"""
Determine the best base zoom level for a raster.
"Best" means the maximum zoom level where no oversampling has to be done.
Parameters
----------
input_file : path to raster file
tile_pyramid_type : ``TilePyramid`` projection (``ge... | def get_best_zoom_level(input_file, tile_pyramid_type):
"""
Determine the best base zoom level for a raster.
"Best" means the maximum zoom level where no oversampling has to be done.
Parameters
----------
input_file : path to raster file
tile_pyramid_type : ``TilePyramid`` projection (``ge... | [
"Determine",
"the",
"best",
"base",
"zoom",
"level",
"for",
"a",
"raster",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/io/__init__.py#L27-L64 | [
"def",
"get_best_zoom_level",
"(",
"input_file",
",",
"tile_pyramid_type",
")",
":",
"tile_pyramid",
"=",
"BufferedTilePyramid",
"(",
"tile_pyramid_type",
")",
"with",
"rasterio",
".",
"open",
"(",
"input_file",
",",
"\"r\"",
")",
"as",
"src",
":",
"xmin",
",",
... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | get_segmentize_value | Return the recommended segmentation value in input file units.
It is calculated by multiplyling raster pixel size with tile shape in
pixels.
Parameters
----------
input_file : str
location of a file readable by rasterio
tile_pyramied : ``TilePyramid`` or ``BufferedTilePyramid``
... | mapchete/io/__init__.py | def get_segmentize_value(input_file=None, tile_pyramid=None):
"""
Return the recommended segmentation value in input file units.
It is calculated by multiplyling raster pixel size with tile shape in
pixels.
Parameters
----------
input_file : str
location of a file readable by raste... | def get_segmentize_value(input_file=None, tile_pyramid=None):
"""
Return the recommended segmentation value in input file units.
It is calculated by multiplyling raster pixel size with tile shape in
pixels.
Parameters
----------
input_file : str
location of a file readable by raste... | [
"Return",
"the",
"recommended",
"segmentation",
"value",
"in",
"input",
"file",
"units",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/io/__init__.py#L67-L88 | [
"def",
"get_segmentize_value",
"(",
"input_file",
"=",
"None",
",",
"tile_pyramid",
"=",
"None",
")",
":",
"with",
"rasterio",
".",
"open",
"(",
"input_file",
",",
"\"r\"",
")",
"as",
"input_raster",
":",
"pixelsize",
"=",
"input_raster",
".",
"transform",
"... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | tile_to_zoom_level | Determine the best zoom level in target TilePyramid from given Tile.
Parameters
----------
tile : BufferedTile
dst_pyramid : BufferedTilePyramid
matching_method : str ('gdal' or 'min')
gdal: Uses GDAL's standard method. Here, the target resolution is calculated by
averaging the... | mapchete/io/__init__.py | def tile_to_zoom_level(tile, dst_pyramid=None, matching_method="gdal", precision=8):
"""
Determine the best zoom level in target TilePyramid from given Tile.
Parameters
----------
tile : BufferedTile
dst_pyramid : BufferedTilePyramid
matching_method : str ('gdal' or 'min')
gdal: Us... | def tile_to_zoom_level(tile, dst_pyramid=None, matching_method="gdal", precision=8):
"""
Determine the best zoom level in target TilePyramid from given Tile.
Parameters
----------
tile : BufferedTile
dst_pyramid : BufferedTilePyramid
matching_method : str ('gdal' or 'min')
gdal: Us... | [
"Determine",
"the",
"best",
"zoom",
"level",
"in",
"target",
"TilePyramid",
"from",
"given",
"Tile",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/io/__init__.py#L91-L173 | [
"def",
"tile_to_zoom_level",
"(",
"tile",
",",
"dst_pyramid",
"=",
"None",
",",
"matching_method",
"=",
"\"gdal\"",
",",
"precision",
"=",
"8",
")",
":",
"def",
"width_height",
"(",
"bounds",
")",
":",
"try",
":",
"l",
",",
"b",
",",
"r",
",",
"t",
"... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | path_is_remote | Determine whether file path is remote or local.
Parameters
----------
path : path to file
Returns
-------
is_remote : bool | mapchete/io/__init__.py | def path_is_remote(path, s3=True):
"""
Determine whether file path is remote or local.
Parameters
----------
path : path to file
Returns
-------
is_remote : bool
"""
prefixes = ("http://", "https://", "/vsicurl/")
if s3:
prefixes += ("s3://", "/vsis3/")
return p... | def path_is_remote(path, s3=True):
"""
Determine whether file path is remote or local.
Parameters
----------
path : path to file
Returns
-------
is_remote : bool
"""
prefixes = ("http://", "https://", "/vsicurl/")
if s3:
prefixes += ("s3://", "/vsis3/")
return p... | [
"Determine",
"whether",
"file",
"path",
"is",
"remote",
"or",
"local",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/io/__init__.py#L176-L191 | [
"def",
"path_is_remote",
"(",
"path",
",",
"s3",
"=",
"True",
")",
":",
"prefixes",
"=",
"(",
"\"http://\"",
",",
"\"https://\"",
",",
"\"/vsicurl/\"",
")",
"if",
"s3",
":",
"prefixes",
"+=",
"(",
"\"s3://\"",
",",
"\"/vsis3/\"",
")",
"return",
"path",
"... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | path_exists | Check if file exists either remote or local.
Parameters:
-----------
path : path to file
Returns:
--------
exists : bool | mapchete/io/__init__.py | def path_exists(path):
"""
Check if file exists either remote or local.
Parameters:
-----------
path : path to file
Returns:
--------
exists : bool
"""
if path.startswith(("http://", "https://")):
try:
urlopen(path).info()
return True
exc... | def path_exists(path):
"""
Check if file exists either remote or local.
Parameters:
-----------
path : path to file
Returns:
--------
exists : bool
"""
if path.startswith(("http://", "https://")):
try:
urlopen(path).info()
return True
exc... | [
"Check",
"if",
"file",
"exists",
"either",
"remote",
"or",
"local",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/io/__init__.py#L194-L225 | [
"def",
"path_exists",
"(",
"path",
")",
":",
"if",
"path",
".",
"startswith",
"(",
"(",
"\"http://\"",
",",
"\"https://\"",
")",
")",
":",
"try",
":",
"urlopen",
"(",
"path",
")",
".",
"info",
"(",
")",
"return",
"True",
"except",
"HTTPError",
"as",
... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | absolute_path | Return absolute path if path is local.
Parameters:
-----------
path : path to file
base_dir : base directory used for absolute path
Returns:
--------
absolute path | mapchete/io/__init__.py | def absolute_path(path=None, base_dir=None):
"""
Return absolute path if path is local.
Parameters:
-----------
path : path to file
base_dir : base directory used for absolute path
Returns:
--------
absolute path
"""
if path_is_remote(path):
return path
else:
... | def absolute_path(path=None, base_dir=None):
"""
Return absolute path if path is local.
Parameters:
-----------
path : path to file
base_dir : base directory used for absolute path
Returns:
--------
absolute path
"""
if path_is_remote(path):
return path
else:
... | [
"Return",
"absolute",
"path",
"if",
"path",
"is",
"local",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/io/__init__.py#L228-L249 | [
"def",
"absolute_path",
"(",
"path",
"=",
"None",
",",
"base_dir",
"=",
"None",
")",
":",
"if",
"path_is_remote",
"(",
"path",
")",
":",
"return",
"path",
"else",
":",
"if",
"os",
".",
"path",
".",
"isabs",
"(",
"path",
")",
":",
"return",
"path",
... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | relative_path | Return relative path if path is local.
Parameters:
-----------
path : path to file
base_dir : directory where path sould be relative to
Returns:
--------
relative path | mapchete/io/__init__.py | def relative_path(path=None, base_dir=None):
"""
Return relative path if path is local.
Parameters:
-----------
path : path to file
base_dir : directory where path sould be relative to
Returns:
--------
relative path
"""
if path_is_remote(path) or not os.path.isabs(path):
... | def relative_path(path=None, base_dir=None):
"""
Return relative path if path is local.
Parameters:
-----------
path : path to file
base_dir : directory where path sould be relative to
Returns:
--------
relative path
"""
if path_is_remote(path) or not os.path.isabs(path):
... | [
"Return",
"relative",
"path",
"if",
"path",
"is",
"local",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/io/__init__.py#L252-L268 | [
"def",
"relative_path",
"(",
"path",
"=",
"None",
",",
"base_dir",
"=",
"None",
")",
":",
"if",
"path_is_remote",
"(",
"path",
")",
"or",
"not",
"os",
".",
"path",
".",
"isabs",
"(",
"path",
")",
":",
"return",
"path",
"else",
":",
"return",
"os",
... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | write_json | Write local or remote. | mapchete/io/__init__.py | def write_json(path, params):
"""Write local or remote."""
logger.debug("write %s to %s", params, path)
if path.startswith("s3://"):
bucket = get_boto3_bucket(path.split("/")[2])
key = "/".join(path.split("/")[3:])
logger.debug("upload %s", key)
bucket.put_object(
... | def write_json(path, params):
"""Write local or remote."""
logger.debug("write %s to %s", params, path)
if path.startswith("s3://"):
bucket = get_boto3_bucket(path.split("/")[2])
key = "/".join(path.split("/")[3:])
logger.debug("upload %s", key)
bucket.put_object(
... | [
"Write",
"local",
"or",
"remote",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/io/__init__.py#L286-L300 | [
"def",
"write_json",
"(",
"path",
",",
"params",
")",
":",
"logger",
".",
"debug",
"(",
"\"write %s to %s\"",
",",
"params",
",",
"path",
")",
"if",
"path",
".",
"startswith",
"(",
"\"s3://\"",
")",
":",
"bucket",
"=",
"get_boto3_bucket",
"(",
"path",
".... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | read_json | Read local or remote. | mapchete/io/__init__.py | def read_json(path):
"""Read local or remote."""
if path.startswith(("http://", "https://")):
try:
return json.loads(urlopen(path).read().decode())
except HTTPError:
raise FileNotFoundError("%s not found", path)
elif path.startswith("s3://"):
bucket = get_boto... | def read_json(path):
"""Read local or remote."""
if path.startswith(("http://", "https://")):
try:
return json.loads(urlopen(path).read().decode())
except HTTPError:
raise FileNotFoundError("%s not found", path)
elif path.startswith("s3://"):
bucket = get_boto... | [
"Read",
"local",
"or",
"remote",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/io/__init__.py#L303-L322 | [
"def",
"read_json",
"(",
"path",
")",
":",
"if",
"path",
".",
"startswith",
"(",
"(",
"\"http://\"",
",",
"\"https://\"",
")",
")",
":",
"try",
":",
"return",
"json",
".",
"loads",
"(",
"urlopen",
"(",
"path",
")",
".",
"read",
"(",
")",
".",
"deco... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | get_gdal_options | Return a merged set of custom and default GDAL/rasterio Env options.
If is_remote is set to True, the default GDAL_HTTP_OPTS are appended.
Parameters
----------
opts : dict or None
Explicit GDAL options.
is_remote : bool
Indicate whether Env is for a remote file.
Returns
-... | mapchete/io/__init__.py | def get_gdal_options(opts, is_remote=False):
"""
Return a merged set of custom and default GDAL/rasterio Env options.
If is_remote is set to True, the default GDAL_HTTP_OPTS are appended.
Parameters
----------
opts : dict or None
Explicit GDAL options.
is_remote : bool
Indi... | def get_gdal_options(opts, is_remote=False):
"""
Return a merged set of custom and default GDAL/rasterio Env options.
If is_remote is set to True, the default GDAL_HTTP_OPTS are appended.
Parameters
----------
opts : dict or None
Explicit GDAL options.
is_remote : bool
Indi... | [
"Return",
"a",
"merged",
"set",
"of",
"custom",
"and",
"default",
"GDAL",
"/",
"rasterio",
"Env",
"options",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/io/__init__.py#L338-L359 | [
"def",
"get_gdal_options",
"(",
"opts",
",",
"is_remote",
"=",
"False",
")",
":",
"user_opts",
"=",
"{",
"}",
"if",
"opts",
"is",
"None",
"else",
"dict",
"(",
"*",
"*",
"opts",
")",
"if",
"is_remote",
":",
"return",
"dict",
"(",
"GDAL_HTTP_OPTS",
",",
... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | InputData.open | Return InputTile object.
Parameters
----------
tile : ``Tile``
Returns
-------
input tile : ``InputTile``
tile view of input data | mapchete/formats/default/mapchete_input.py | def open(self, tile, **kwargs):
"""
Return InputTile object.
Parameters
----------
tile : ``Tile``
Returns
-------
input tile : ``InputTile``
tile view of input data
"""
return self.process.config.output.open(tile, self.proces... | def open(self, tile, **kwargs):
"""
Return InputTile object.
Parameters
----------
tile : ``Tile``
Returns
-------
input tile : ``InputTile``
tile view of input data
"""
return self.process.config.output.open(tile, self.proces... | [
"Return",
"InputTile",
"object",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/default/mapchete_input.py#L56-L69 | [
"def",
"open",
"(",
"self",
",",
"tile",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"process",
".",
"config",
".",
"output",
".",
"open",
"(",
"tile",
",",
"self",
".",
"process",
",",
"*",
"*",
"kwargs",
")"
] | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | InputData.bbox | Return data bounding box.
Parameters
----------
out_crs : ``rasterio.crs.CRS``
rasterio CRS object (default: CRS of process pyramid)
Returns
-------
bounding box : geometry
Shapely geometry object | mapchete/formats/default/mapchete_input.py | def bbox(self, out_crs=None):
"""
Return data bounding box.
Parameters
----------
out_crs : ``rasterio.crs.CRS``
rasterio CRS object (default: CRS of process pyramid)
Returns
-------
bounding box : geometry
Shapely geometry object... | def bbox(self, out_crs=None):
"""
Return data bounding box.
Parameters
----------
out_crs : ``rasterio.crs.CRS``
rasterio CRS object (default: CRS of process pyramid)
Returns
-------
bounding box : geometry
Shapely geometry object... | [
"Return",
"data",
"bounding",
"box",
"."
] | ungarj/mapchete | python | https://github.com/ungarj/mapchete/blob/d482918d0e66a5b414dff6aa7cc854e01fc60ee4/mapchete/formats/default/mapchete_input.py#L71-L89 | [
"def",
"bbox",
"(",
"self",
",",
"out_crs",
"=",
"None",
")",
":",
"return",
"reproject_geometry",
"(",
"self",
".",
"process",
".",
"config",
".",
"area_at_zoom",
"(",
")",
",",
"src_crs",
"=",
"self",
".",
"process",
".",
"config",
".",
"process_pyrami... | d482918d0e66a5b414dff6aa7cc854e01fc60ee4 |
valid | win_activate | Activates (gives focus to) a window.
:param title:
:param text:
:return: | autoit/win.py | def win_activate(title, **kwargs):
"""
Activates (gives focus to) a window.
:param title:
:param text:
:return:
"""
text = kwargs.get("text", "")
ret = AUTO_IT.AU3_WinActivate(LPCWSTR(title), LPCWSTR(text))
return ret | def win_activate(title, **kwargs):
"""
Activates (gives focus to) a window.
:param title:
:param text:
:return:
"""
text = kwargs.get("text", "")
ret = AUTO_IT.AU3_WinActivate(LPCWSTR(title), LPCWSTR(text))
return ret | [
"Activates",
"(",
"gives",
"focus",
"to",
")",
"a",
"window",
".",
":",
"param",
"title",
":",
":",
"param",
"text",
":",
":",
"return",
":"
] | jacexh/pyautoit | python | https://github.com/jacexh/pyautoit/blob/598314c3eed0639c701c8cb2366acb015e04b161/autoit/win.py#L14-L23 | [
"def",
"win_activate",
"(",
"title",
",",
"*",
"*",
"kwargs",
")",
":",
"text",
"=",
"kwargs",
".",
"get",
"(",
"\"text\"",
",",
"\"\"",
")",
"ret",
"=",
"AUTO_IT",
".",
"AU3_WinActivate",
"(",
"LPCWSTR",
"(",
"title",
")",
",",
"LPCWSTR",
"(",
"text... | 598314c3eed0639c701c8cb2366acb015e04b161 |
valid | win_exists | Checks to see if a specified window exists.
:param title: The title of the window to check.
:param text: The text of the window to check.
:return: Returns 1 if the window exists, otherwise returns 0. | autoit/win.py | def win_exists(title, **kwargs):
"""
Checks to see if a specified window exists.
:param title: The title of the window to check.
:param text: The text of the window to check.
:return: Returns 1 if the window exists, otherwise returns 0.
"""
text = kwargs.get("text", "")
ret = AUTO_IT.AU3... | def win_exists(title, **kwargs):
"""
Checks to see if a specified window exists.
:param title: The title of the window to check.
:param text: The text of the window to check.
:return: Returns 1 if the window exists, otherwise returns 0.
"""
text = kwargs.get("text", "")
ret = AUTO_IT.AU3... | [
"Checks",
"to",
"see",
"if",
"a",
"specified",
"window",
"exists",
".",
":",
"param",
"title",
":",
"The",
"title",
"of",
"the",
"window",
"to",
"check",
".",
":",
"param",
"text",
":",
"The",
"text",
"of",
"the",
"window",
"to",
"check",
".",
":",
... | jacexh/pyautoit | python | https://github.com/jacexh/pyautoit/blob/598314c3eed0639c701c8cb2366acb015e04b161/autoit/win.py#L83-L92 | [
"def",
"win_exists",
"(",
"title",
",",
"*",
"*",
"kwargs",
")",
":",
"text",
"=",
"kwargs",
".",
"get",
"(",
"\"text\"",
",",
"\"\"",
")",
"ret",
"=",
"AUTO_IT",
".",
"AU3_WinExists",
"(",
"LPCWSTR",
"(",
"title",
")",
",",
"LPCWSTR",
"(",
"text",
... | 598314c3eed0639c701c8cb2366acb015e04b161 |
valid | win_get_caret_pos | Returns the coordinates of the caret in the foreground window
:return: | autoit/win.py | def win_get_caret_pos():
"""
Returns the coordinates of the caret in the foreground window
:return:
"""
p = POINT()
AUTO_IT.AU3_WinGetCaretPos(byref(p))
return p.x, p.y | def win_get_caret_pos():
"""
Returns the coordinates of the caret in the foreground window
:return:
"""
p = POINT()
AUTO_IT.AU3_WinGetCaretPos(byref(p))
return p.x, p.y | [
"Returns",
"the",
"coordinates",
"of",
"the",
"caret",
"in",
"the",
"foreground",
"window",
":",
"return",
":"
] | jacexh/pyautoit | python | https://github.com/jacexh/pyautoit/blob/598314c3eed0639c701c8cb2366acb015e04b161/autoit/win.py#L106-L113 | [
"def",
"win_get_caret_pos",
"(",
")",
":",
"p",
"=",
"POINT",
"(",
")",
"AUTO_IT",
".",
"AU3_WinGetCaretPos",
"(",
"byref",
"(",
"p",
")",
")",
"return",
"p",
".",
"x",
",",
"p",
".",
"y"
] | 598314c3eed0639c701c8cb2366acb015e04b161 |
valid | win_get_state | Retrieves the state of a given window.
:param title:
:param text:
:return:
1 = Window exists
2 = Window is visible
4 = Windows is enabled
8 = Window is active
16 = Window is minimized
32 = Windows is maximized | autoit/win.py | def win_get_state(title, **kwargs):
"""
Retrieves the state of a given window.
:param title:
:param text:
:return:
1 = Window exists
2 = Window is visible
4 = Windows is enabled
8 = Window is active
16 = Window is minimized
32 = Windows is maximized
"""
text = kwargs.... | def win_get_state(title, **kwargs):
"""
Retrieves the state of a given window.
:param title:
:param text:
:return:
1 = Window exists
2 = Window is visible
4 = Windows is enabled
8 = Window is active
16 = Window is minimized
32 = Windows is maximized
"""
text = kwargs.... | [
"Retrieves",
"the",
"state",
"of",
"a",
"given",
"window",
".",
":",
"param",
"title",
":",
":",
"param",
"text",
":",
":",
"return",
":",
"1",
"=",
"Window",
"exists",
"2",
"=",
"Window",
"is",
"visible",
"4",
"=",
"Windows",
"is",
"enabled",
"8",
... | jacexh/pyautoit | python | https://github.com/jacexh/pyautoit/blob/598314c3eed0639c701c8cb2366acb015e04b161/autoit/win.py#L262-L277 | [
"def",
"win_get_state",
"(",
"title",
",",
"*",
"*",
"kwargs",
")",
":",
"text",
"=",
"kwargs",
".",
"get",
"(",
"\"text\"",
",",
"\"\"",
")",
"res",
"=",
"AUTO_IT",
".",
"AU3_WinGetState",
"(",
"LPCWSTR",
"(",
"title",
")",
",",
"LPCWSTR",
"(",
"tex... | 598314c3eed0639c701c8cb2366acb015e04b161 |
valid | win_menu_select_item | Usage:
win_menu_select_item("[CLASS:Notepad]", "", u"文件(&F)", u"退出(&X)")
:param title:
:param text:
:param items:
:return: | autoit/win.py | def win_menu_select_item(title, *items, **kwargs):
"""
Usage:
win_menu_select_item("[CLASS:Notepad]", "", u"文件(&F)", u"退出(&X)")
:param title:
:param text:
:param items:
:return:
"""
text = kwargs.get("text", "")
if not (0 < len(items) < 8):
raise ValueError("accepted ... | def win_menu_select_item(title, *items, **kwargs):
"""
Usage:
win_menu_select_item("[CLASS:Notepad]", "", u"文件(&F)", u"退出(&X)")
:param title:
:param text:
:param items:
:return:
"""
text = kwargs.get("text", "")
if not (0 < len(items) < 8):
raise ValueError("accepted ... | [
"Usage",
":",
"win_menu_select_item",
"(",
"[",
"CLASS",
":",
"Notepad",
"]",
"u",
"文件",
"(",
"&F",
")",
"u",
"退出",
"(",
"&X",
")",
")",
":",
"param",
"title",
":",
":",
"param",
"text",
":",
":",
"param",
"items",
":",
":",
"return",
":"
] | jacexh/pyautoit | python | https://github.com/jacexh/pyautoit/blob/598314c3eed0639c701c8cb2366acb015e04b161/autoit/win.py#L371-L389 | [
"def",
"win_menu_select_item",
"(",
"title",
",",
"*",
"items",
",",
"*",
"*",
"kwargs",
")",
":",
"text",
"=",
"kwargs",
".",
"get",
"(",
"\"text\"",
",",
"\"\"",
")",
"if",
"not",
"(",
"0",
"<",
"len",
"(",
"items",
")",
"<",
"8",
")",
":",
"... | 598314c3eed0639c701c8cb2366acb015e04b161 |
valid | win_set_trans | Sets the transparency of a window.
:param title:
:param trans: A number in the range 0 - 255. The larger the number,
the more transparent the window will become.
:param kwargs:
:return: | autoit/win.py | def win_set_trans(title, trans, **kwargs):
"""
Sets the transparency of a window.
:param title:
:param trans: A number in the range 0 - 255. The larger the number,
the more transparent the window will become.
:param kwargs:
:return:
"""
text = kwargs.get("text", "")
ret = AU... | def win_set_trans(title, trans, **kwargs):
"""
Sets the transparency of a window.
:param title:
:param trans: A number in the range 0 - 255. The larger the number,
the more transparent the window will become.
:param kwargs:
:return:
"""
text = kwargs.get("text", "")
ret = AU... | [
"Sets",
"the",
"transparency",
"of",
"a",
"window",
".",
":",
"param",
"title",
":",
":",
"param",
"trans",
":",
"A",
"number",
"in",
"the",
"range",
"0",
"-",
"255",
".",
"The",
"larger",
"the",
"number",
"the",
"more",
"transparent",
"the",
"window",... | jacexh/pyautoit | python | https://github.com/jacexh/pyautoit/blob/598314c3eed0639c701c8cb2366acb015e04b161/autoit/win.py#L547-L559 | [
"def",
"win_set_trans",
"(",
"title",
",",
"trans",
",",
"*",
"*",
"kwargs",
")",
":",
"text",
"=",
"kwargs",
".",
"get",
"(",
"\"text\"",
",",
"\"\"",
")",
"ret",
"=",
"AUTO_IT",
".",
"AU3_WinSetTrans",
"(",
"LPCWSTR",
"(",
"title",
")",
",",
"LPCWS... | 598314c3eed0639c701c8cb2366acb015e04b161 |
valid | auto_it_set_option | Changes the operation of various AutoIt functions/parameters
:param option: The option to change
:param param: The parameter (varies by option).
:return: | autoit/autoit.py | def auto_it_set_option(option, param):
"""
Changes the operation of various AutoIt functions/parameters
:param option: The option to change
:param param: The parameter (varies by option).
:return:
"""
pre_value = AUTO_IT.AU3_AutoItSetOption(LPCWSTR(option), INT(param))
return pre_value | def auto_it_set_option(option, param):
"""
Changes the operation of various AutoIt functions/parameters
:param option: The option to change
:param param: The parameter (varies by option).
:return:
"""
pre_value = AUTO_IT.AU3_AutoItSetOption(LPCWSTR(option), INT(param))
return pre_value | [
"Changes",
"the",
"operation",
"of",
"various",
"AutoIt",
"functions",
"/",
"parameters",
":",
"param",
"option",
":",
"The",
"option",
"to",
"change",
":",
"param",
"param",
":",
"The",
"parameter",
"(",
"varies",
"by",
"option",
")",
".",
":",
"return",
... | jacexh/pyautoit | python | https://github.com/jacexh/pyautoit/blob/598314c3eed0639c701c8cb2366acb015e04b161/autoit/autoit.py#L95-L103 | [
"def",
"auto_it_set_option",
"(",
"option",
",",
"param",
")",
":",
"pre_value",
"=",
"AUTO_IT",
".",
"AU3_AutoItSetOption",
"(",
"LPCWSTR",
"(",
"option",
")",
",",
"INT",
"(",
"param",
")",
")",
"return",
"pre_value"
] | 598314c3eed0639c701c8cb2366acb015e04b161 |
valid | AutoItAPI.check | :param mark:
0 - do not need check return value or error()
1 - check error()
2 - check return value | autoit/autoit.py | def check(self, mark=0, err_msg="", **kwds):
"""
:param mark:
0 - do not need check return value or error()
1 - check error()
2 - check return value
"""
unexpected_ret = kwds.get("unexpected_ret", (0,))
def _check(fn):
@wraps(fn)
... | def check(self, mark=0, err_msg="", **kwds):
"""
:param mark:
0 - do not need check return value or error()
1 - check error()
2 - check return value
"""
unexpected_ret = kwds.get("unexpected_ret", (0,))
def _check(fn):
@wraps(fn)
... | [
":",
"param",
"mark",
":",
"0",
"-",
"do",
"not",
"need",
"check",
"return",
"value",
"or",
"error",
"()",
"1",
"-",
"check",
"error",
"()",
"2",
"-",
"check",
"return",
"value"
] | jacexh/pyautoit | python | https://github.com/jacexh/pyautoit/blob/598314c3eed0639c701c8cb2366acb015e04b161/autoit/autoit.py#L61-L88 | [
"def",
"check",
"(",
"self",
",",
"mark",
"=",
"0",
",",
"err_msg",
"=",
"\"\"",
",",
"*",
"*",
"kwds",
")",
":",
"unexpected_ret",
"=",
"kwds",
".",
"get",
"(",
"\"unexpected_ret\"",
",",
"(",
"0",
",",
")",
")",
"def",
"_check",
"(",
"fn",
")",... | 598314c3eed0639c701c8cb2366acb015e04b161 |
valid | process_set_priority | Changes the priority of a process
:param process: The name or PID of the process to check.
:param priority:A flag which determines what priority to set
0 - Idle/Low
1 - Below Normal (Not supported on Windows 95/98/ME)
2 - Normal
3 - Above Normal (Not supported on Windows 95/98/ME... | autoit/process.py | def process_set_priority(process, priority):
"""
Changes the priority of a process
:param process: The name or PID of the process to check.
:param priority:A flag which determines what priority to set
0 - Idle/Low
1 - Below Normal (Not supported on Windows 95/98/ME)
2 - Normal
... | def process_set_priority(process, priority):
"""
Changes the priority of a process
:param process: The name or PID of the process to check.
:param priority:A flag which determines what priority to set
0 - Idle/Low
1 - Below Normal (Not supported on Windows 95/98/ME)
2 - Normal
... | [
"Changes",
"the",
"priority",
"of",
"a",
"process",
":",
"param",
"process",
":",
"The",
"name",
"or",
"PID",
"of",
"the",
"process",
"to",
"check",
".",
":",
"param",
"priority",
":",
"A",
"flag",
"which",
"determines",
"what",
"priority",
"to",
"set",
... | jacexh/pyautoit | python | https://github.com/jacexh/pyautoit/blob/598314c3eed0639c701c8cb2366acb015e04b161/autoit/process.py#L58-L77 | [
"def",
"process_set_priority",
"(",
"process",
",",
"priority",
")",
":",
"ret",
"=",
"AUTO_IT",
".",
"AU3_ProcessSetPriority",
"(",
"LPCWSTR",
"(",
"process",
")",
",",
"INT",
"(",
"priority",
")",
")",
"if",
"ret",
"==",
"0",
":",
"if",
"error",
"(",
... | 598314c3eed0639c701c8cb2366acb015e04b161 |
valid | process_wait | Pauses script execution until a given process exists.
:param process:
:param timeout:
:return: | autoit/process.py | def process_wait(process, timeout=0):
"""
Pauses script execution until a given process exists.
:param process:
:param timeout:
:return:
"""
ret = AUTO_IT.AU3_ProcessWait(LPCWSTR(process), INT(timeout))
return ret | def process_wait(process, timeout=0):
"""
Pauses script execution until a given process exists.
:param process:
:param timeout:
:return:
"""
ret = AUTO_IT.AU3_ProcessWait(LPCWSTR(process), INT(timeout))
return ret | [
"Pauses",
"script",
"execution",
"until",
"a",
"given",
"process",
"exists",
".",
":",
"param",
"process",
":",
":",
"param",
"timeout",
":",
":",
"return",
":"
] | jacexh/pyautoit | python | https://github.com/jacexh/pyautoit/blob/598314c3eed0639c701c8cb2366acb015e04b161/autoit/process.py#L81-L89 | [
"def",
"process_wait",
"(",
"process",
",",
"timeout",
"=",
"0",
")",
":",
"ret",
"=",
"AUTO_IT",
".",
"AU3_ProcessWait",
"(",
"LPCWSTR",
"(",
"process",
")",
",",
"INT",
"(",
"timeout",
")",
")",
"return",
"ret"
] | 598314c3eed0639c701c8cb2366acb015e04b161 |
valid | process_wait_close | Pauses script execution until a given process does not exist.
:param process:
:param timeout:
:return: | autoit/process.py | def process_wait_close(process, timeout=0):
"""
Pauses script execution until a given process does not exist.
:param process:
:param timeout:
:return:
"""
ret = AUTO_IT.AU3_ProcessWaitClose(LPCWSTR(process), INT(timeout))
return ret | def process_wait_close(process, timeout=0):
"""
Pauses script execution until a given process does not exist.
:param process:
:param timeout:
:return:
"""
ret = AUTO_IT.AU3_ProcessWaitClose(LPCWSTR(process), INT(timeout))
return ret | [
"Pauses",
"script",
"execution",
"until",
"a",
"given",
"process",
"does",
"not",
"exist",
".",
":",
"param",
"process",
":",
":",
"param",
"timeout",
":",
":",
"return",
":"
] | jacexh/pyautoit | python | https://github.com/jacexh/pyautoit/blob/598314c3eed0639c701c8cb2366acb015e04b161/autoit/process.py#L93-L101 | [
"def",
"process_wait_close",
"(",
"process",
",",
"timeout",
"=",
"0",
")",
":",
"ret",
"=",
"AUTO_IT",
".",
"AU3_ProcessWaitClose",
"(",
"LPCWSTR",
"(",
"process",
")",
",",
"INT",
"(",
"timeout",
")",
")",
"return",
"ret"
] | 598314c3eed0639c701c8cb2366acb015e04b161 |
valid | run_as | Runs an external program.
:param user: username The user name to use.
:param domain: The domain name to use.
:param password: The password to use.
:param logon_flag: 0 = do not load the user profile, 1 = (default) load
the user profile, 2 = use for net credentials only
:param filename: The n... | autoit/process.py | def run_as(user, domain, password, filename, logon_flag=1, work_dir="",
show_flag=Properties.SW_SHOWNORMAL):
"""
Runs an external program.
:param user: username The user name to use.
:param domain: The domain name to use.
:param password: The password to use.
:param logon_flag: 0 = do... | def run_as(user, domain, password, filename, logon_flag=1, work_dir="",
show_flag=Properties.SW_SHOWNORMAL):
"""
Runs an external program.
:param user: username The user name to use.
:param domain: The domain name to use.
:param password: The password to use.
:param logon_flag: 0 = do... | [
"Runs",
"an",
"external",
"program",
".",
":",
"param",
"user",
":",
"username",
"The",
"user",
"name",
"to",
"use",
".",
":",
"param",
"domain",
":",
"The",
"domain",
"name",
"to",
"use",
".",
":",
"param",
"password",
":",
"The",
"password",
"to",
... | jacexh/pyautoit | python | https://github.com/jacexh/pyautoit/blob/598314c3eed0639c701c8cb2366acb015e04b161/autoit/process.py#L105-L126 | [
"def",
"run_as",
"(",
"user",
",",
"domain",
",",
"password",
",",
"filename",
",",
"logon_flag",
"=",
"1",
",",
"work_dir",
"=",
"\"\"",
",",
"show_flag",
"=",
"Properties",
".",
"SW_SHOWNORMAL",
")",
":",
"ret",
"=",
"AUTO_IT",
".",
"AU3_RunAs",
"(",
... | 598314c3eed0639c701c8cb2366acb015e04b161 |
valid | run_as_wait | Runs an external program.
:param user: username The user name to use.
:param domain: The domain name to use.
:param password: The password to use.
:param logon_flag: 0 = do not load the user profile, 1 = (default) load
the user profile, 2 = use for net credentials only
:param filename: The n... | autoit/process.py | def run_as_wait(user, domain, password, filename, logon_flag=1, work_dir="",
show_flag=Properties.SW_SHOWNORMAL):
"""
Runs an external program.
:param user: username The user name to use.
:param domain: The domain name to use.
:param password: The password to use.
:param logon_fl... | def run_as_wait(user, domain, password, filename, logon_flag=1, work_dir="",
show_flag=Properties.SW_SHOWNORMAL):
"""
Runs an external program.
:param user: username The user name to use.
:param domain: The domain name to use.
:param password: The password to use.
:param logon_fl... | [
"Runs",
"an",
"external",
"program",
".",
":",
"param",
"user",
":",
"username",
"The",
"user",
"name",
"to",
"use",
".",
":",
"param",
"domain",
":",
"The",
"domain",
"name",
"to",
"use",
".",
":",
"param",
"password",
":",
"The",
"password",
"to",
... | jacexh/pyautoit | python | https://github.com/jacexh/pyautoit/blob/598314c3eed0639c701c8cb2366acb015e04b161/autoit/process.py#L130-L151 | [
"def",
"run_as_wait",
"(",
"user",
",",
"domain",
",",
"password",
",",
"filename",
",",
"logon_flag",
"=",
"1",
",",
"work_dir",
"=",
"\"\"",
",",
"show_flag",
"=",
"Properties",
".",
"SW_SHOWNORMAL",
")",
":",
"ret",
"=",
"AUTO_IT",
".",
"AU3_RunAsWait",... | 598314c3eed0639c701c8cb2366acb015e04b161 |
valid | Webhook.hook | Registers a function as a hook. Multiple hooks can be registered for a given type, but the
order in which they are invoke is unspecified.
:param event_type: The event type this hook will be invoked for. | github_webhook/webhook.py | def hook(self, event_type='push'):
"""
Registers a function as a hook. Multiple hooks can be registered for a given type, but the
order in which they are invoke is unspecified.
:param event_type: The event type this hook will be invoked for.
"""
def decorator(func):
... | def hook(self, event_type='push'):
"""
Registers a function as a hook. Multiple hooks can be registered for a given type, but the
order in which they are invoke is unspecified.
:param event_type: The event type this hook will be invoked for.
"""
def decorator(func):
... | [
"Registers",
"a",
"function",
"as",
"a",
"hook",
".",
"Multiple",
"hooks",
"can",
"be",
"registered",
"for",
"a",
"given",
"type",
"but",
"the",
"order",
"in",
"which",
"they",
"are",
"invoke",
"is",
"unspecified",
"."
] | bloomberg/python-github-webhook | python | https://github.com/bloomberg/python-github-webhook/blob/e9a70dd3a907f5c1a8f4cee190c59e4e775af37f/github_webhook/webhook.py#L29-L41 | [
"def",
"hook",
"(",
"self",
",",
"event_type",
"=",
"'push'",
")",
":",
"def",
"decorator",
"(",
"func",
")",
":",
"self",
".",
"_hooks",
"[",
"event_type",
"]",
".",
"append",
"(",
"func",
")",
"return",
"func",
"return",
"decorator"
] | e9a70dd3a907f5c1a8f4cee190c59e4e775af37f |
valid | Webhook._get_digest | Return message digest if a secret key was provided | github_webhook/webhook.py | def _get_digest(self):
"""Return message digest if a secret key was provided"""
return hmac.new(
self._secret, request.data, hashlib.sha1).hexdigest() if self._secret else None | def _get_digest(self):
"""Return message digest if a secret key was provided"""
return hmac.new(
self._secret, request.data, hashlib.sha1).hexdigest() if self._secret else None | [
"Return",
"message",
"digest",
"if",
"a",
"secret",
"key",
"was",
"provided"
] | bloomberg/python-github-webhook | python | https://github.com/bloomberg/python-github-webhook/blob/e9a70dd3a907f5c1a8f4cee190c59e4e775af37f/github_webhook/webhook.py#L43-L47 | [
"def",
"_get_digest",
"(",
"self",
")",
":",
"return",
"hmac",
".",
"new",
"(",
"self",
".",
"_secret",
",",
"request",
".",
"data",
",",
"hashlib",
".",
"sha1",
")",
".",
"hexdigest",
"(",
")",
"if",
"self",
".",
"_secret",
"else",
"None"
] | e9a70dd3a907f5c1a8f4cee190c59e4e775af37f |
valid | Webhook._postreceive | Callback from Flask | github_webhook/webhook.py | def _postreceive(self):
"""Callback from Flask"""
digest = self._get_digest()
if digest is not None:
sig_parts = _get_header('X-Hub-Signature').split('=', 1)
if not isinstance(digest, six.text_type):
digest = six.text_type(digest)
if (len(si... | def _postreceive(self):
"""Callback from Flask"""
digest = self._get_digest()
if digest is not None:
sig_parts = _get_header('X-Hub-Signature').split('=', 1)
if not isinstance(digest, six.text_type):
digest = six.text_type(digest)
if (len(si... | [
"Callback",
"from",
"Flask"
] | bloomberg/python-github-webhook | python | https://github.com/bloomberg/python-github-webhook/blob/e9a70dd3a907f5c1a8f4cee190c59e4e775af37f/github_webhook/webhook.py#L49-L75 | [
"def",
"_postreceive",
"(",
"self",
")",
":",
"digest",
"=",
"self",
".",
"_get_digest",
"(",
")",
"if",
"digest",
"is",
"not",
"None",
":",
"sig_parts",
"=",
"_get_header",
"(",
"'X-Hub-Signature'",
")",
".",
"split",
"(",
"'='",
",",
"1",
")",
"if",
... | e9a70dd3a907f5c1a8f4cee190c59e4e775af37f |
valid | long_description | Generate .rst document for PyPi. | setup.py | def long_description():
"""Generate .rst document for PyPi."""
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--doc', dest="doc",
action="store_true", default=False)
args, sys.argv = parser.parse_known_args(sys.argv)
if args.doc:
import doc2md, pypand... | def long_description():
"""Generate .rst document for PyPi."""
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--doc', dest="doc",
action="store_true", default=False)
args, sys.argv = parser.parse_known_args(sys.argv)
if args.doc:
import doc2md, pypand... | [
"Generate",
".",
"rst",
"document",
"for",
"PyPi",
"."
] | coldfix/doc2md | python | https://github.com/coldfix/doc2md/blob/afd2876316a715d3401adb442d46c9a07cd7e806/setup.py#L5-L17 | [
"def",
"long_description",
"(",
")",
":",
"import",
"argparse",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
")",
"parser",
".",
"add_argument",
"(",
"'--doc'",
",",
"dest",
"=",
"\"doc\"",
",",
"action",
"=",
"\"store_true\"",
",",
"default",
"=",... | afd2876316a715d3401adb442d46c9a07cd7e806 |
valid | unindent | Remove common indentation from string.
Unlike doctrim there is no special treatment of the first line. | doc2md.py | def unindent(lines):
"""
Remove common indentation from string.
Unlike doctrim there is no special treatment of the first line.
"""
try:
# Determine minimum indentation:
indent = min(len(line) - len(line.lstrip())
for line in lines if line)
except ValueErro... | def unindent(lines):
"""
Remove common indentation from string.
Unlike doctrim there is no special treatment of the first line.
"""
try:
# Determine minimum indentation:
indent = min(len(line) - len(line.lstrip())
for line in lines if line)
except ValueErro... | [
"Remove",
"common",
"indentation",
"from",
"string",
"."
] | coldfix/doc2md | python | https://github.com/coldfix/doc2md/blob/afd2876316a715d3401adb442d46c9a07cd7e806/doc2md.py#L64-L78 | [
"def",
"unindent",
"(",
"lines",
")",
":",
"try",
":",
"# Determine minimum indentation:",
"indent",
"=",
"min",
"(",
"len",
"(",
"line",
")",
"-",
"len",
"(",
"line",
".",
"lstrip",
"(",
")",
")",
"for",
"line",
"in",
"lines",
"if",
"line",
")",
"ex... | afd2876316a715d3401adb442d46c9a07cd7e806 |
valid | find_sections | Find all section names and return a list with their names. | doc2md.py | def find_sections(lines):
"""
Find all section names and return a list with their names.
"""
sections = []
for line in lines:
if is_heading(line):
sections.append(get_heading(line))
return sections | def find_sections(lines):
"""
Find all section names and return a list with their names.
"""
sections = []
for line in lines:
if is_heading(line):
sections.append(get_heading(line))
return sections | [
"Find",
"all",
"section",
"names",
"and",
"return",
"a",
"list",
"with",
"their",
"names",
"."
] | coldfix/doc2md | python | https://github.com/coldfix/doc2md/blob/afd2876316a715d3401adb442d46c9a07cd7e806/doc2md.py#L120-L128 | [
"def",
"find_sections",
"(",
"lines",
")",
":",
"sections",
"=",
"[",
"]",
"for",
"line",
"in",
"lines",
":",
"if",
"is_heading",
"(",
"line",
")",
":",
"sections",
".",
"append",
"(",
"get_heading",
"(",
"line",
")",
")",
"return",
"sections"
] | afd2876316a715d3401adb442d46c9a07cd7e806 |
valid | make_toc | Generate table of contents for array of section names. | doc2md.py | def make_toc(sections, maxdepth=0):
"""
Generate table of contents for array of section names.
"""
if not sections:
return []
outer = min(n for n,t in sections)
refs = []
for ind,sec in sections:
if maxdepth and ind-outer+1 > maxdepth:
continue
ref = sec.l... | def make_toc(sections, maxdepth=0):
"""
Generate table of contents for array of section names.
"""
if not sections:
return []
outer = min(n for n,t in sections)
refs = []
for ind,sec in sections:
if maxdepth and ind-outer+1 > maxdepth:
continue
ref = sec.l... | [
"Generate",
"table",
"of",
"contents",
"for",
"array",
"of",
"section",
"names",
"."
] | coldfix/doc2md | python | https://github.com/coldfix/doc2md/blob/afd2876316a715d3401adb442d46c9a07cd7e806/doc2md.py#L130-L146 | [
"def",
"make_toc",
"(",
"sections",
",",
"maxdepth",
"=",
"0",
")",
":",
"if",
"not",
"sections",
":",
"return",
"[",
"]",
"outer",
"=",
"min",
"(",
"n",
"for",
"n",
",",
"t",
"in",
"sections",
")",
"refs",
"=",
"[",
"]",
"for",
"ind",
",",
"se... | afd2876316a715d3401adb442d46c9a07cd7e806 |
valid | doc2md | Convert a docstring to a markdown text. | doc2md.py | def doc2md(docstr, title, min_level=1, more_info=False, toc=True, maxdepth=0):
"""
Convert a docstring to a markdown text.
"""
text = doctrim(docstr)
lines = text.split('\n')
sections = find_sections(lines)
if sections:
level = min(n for n,t in sections) - 1
else:
level ... | def doc2md(docstr, title, min_level=1, more_info=False, toc=True, maxdepth=0):
"""
Convert a docstring to a markdown text.
"""
text = doctrim(docstr)
lines = text.split('\n')
sections = find_sections(lines)
if sections:
level = min(n for n,t in sections) - 1
else:
level ... | [
"Convert",
"a",
"docstring",
"to",
"a",
"markdown",
"text",
"."
] | coldfix/doc2md | python | https://github.com/coldfix/doc2md/blob/afd2876316a715d3401adb442d46c9a07cd7e806/doc2md.py#L177-L208 | [
"def",
"doc2md",
"(",
"docstr",
",",
"title",
",",
"min_level",
"=",
"1",
",",
"more_info",
"=",
"False",
",",
"toc",
"=",
"True",
",",
"maxdepth",
"=",
"0",
")",
":",
"text",
"=",
"doctrim",
"(",
"docstr",
")",
"lines",
"=",
"text",
".",
"split",
... | afd2876316a715d3401adb442d46c9a07cd7e806 |
valid | mod2md | Generate markdown document from module, including API section. | doc2md.py | def mod2md(module, title, title_api_section, toc=True, maxdepth=0):
"""
Generate markdown document from module, including API section.
"""
docstr = module.__doc__
text = doctrim(docstr)
lines = text.split('\n')
sections = find_sections(lines)
if sections:
level = min(n for n,t ... | def mod2md(module, title, title_api_section, toc=True, maxdepth=0):
"""
Generate markdown document from module, including API section.
"""
docstr = module.__doc__
text = doctrim(docstr)
lines = text.split('\n')
sections = find_sections(lines)
if sections:
level = min(n for n,t ... | [
"Generate",
"markdown",
"document",
"from",
"module",
"including",
"API",
"section",
"."
] | coldfix/doc2md | python | https://github.com/coldfix/doc2md/blob/afd2876316a715d3401adb442d46c9a07cd7e806/doc2md.py#L210-L265 | [
"def",
"mod2md",
"(",
"module",
",",
"title",
",",
"title_api_section",
",",
"toc",
"=",
"True",
",",
"maxdepth",
"=",
"0",
")",
":",
"docstr",
"=",
"module",
".",
"__doc__",
"text",
"=",
"doctrim",
"(",
"docstr",
")",
"lines",
"=",
"text",
".",
"spl... | afd2876316a715d3401adb442d46c9a07cd7e806 |
valid | ProfileBlockAnalyzer.largest_finite_distance | Compute the maximum temporal distance.
Returns
-------
max_temporal_distance : float | gtfspy/routing/profile_block_analyzer.py | def largest_finite_distance(self):
"""
Compute the maximum temporal distance.
Returns
-------
max_temporal_distance : float
"""
block_start_distances = [block.distance_start for block in self._profile_blocks if
block.distance_star... | def largest_finite_distance(self):
"""
Compute the maximum temporal distance.
Returns
-------
max_temporal_distance : float
"""
block_start_distances = [block.distance_start for block in self._profile_blocks if
block.distance_star... | [
"Compute",
"the",
"maximum",
"temporal",
"distance",
"."
] | CxAalto/gtfspy | python | https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/routing/profile_block_analyzer.py#L104-L120 | [
"def",
"largest_finite_distance",
"(",
"self",
")",
":",
"block_start_distances",
"=",
"[",
"block",
".",
"distance_start",
"for",
"block",
"in",
"self",
".",
"_profile_blocks",
"if",
"block",
".",
"distance_start",
"<",
"float",
"(",
"'inf'",
")",
"]",
"block... | bddba4b74faae6c1b91202f19184811e326547e5 |
valid | ProfileBlockAnalyzer._temporal_distance_cdf | Temporal distance cumulative density function.
Returns
-------
x_values: numpy.array
values for the x-axis
cdf: numpy.array
cdf values | gtfspy/routing/profile_block_analyzer.py | def _temporal_distance_cdf(self):
"""
Temporal distance cumulative density function.
Returns
-------
x_values: numpy.array
values for the x-axis
cdf: numpy.array
cdf values
"""
distance_split_points = set()
for block in sel... | def _temporal_distance_cdf(self):
"""
Temporal distance cumulative density function.
Returns
-------
x_values: numpy.array
values for the x-axis
cdf: numpy.array
cdf values
"""
distance_split_points = set()
for block in sel... | [
"Temporal",
"distance",
"cumulative",
"density",
"function",
"."
] | CxAalto/gtfspy | python | https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/routing/profile_block_analyzer.py#L133-L183 | [
"def",
"_temporal_distance_cdf",
"(",
"self",
")",
":",
"distance_split_points",
"=",
"set",
"(",
")",
"for",
"block",
"in",
"self",
".",
"_profile_blocks",
":",
"if",
"block",
".",
"distance_start",
"!=",
"float",
"(",
"'inf'",
")",
":",
"distance_split_point... | bddba4b74faae6c1b91202f19184811e326547e5 |
valid | ProfileBlockAnalyzer._temporal_distance_pdf | Temporal distance probability density function.
Returns
-------
non_delta_peak_split_points: numpy.array
non_delta_peak_densities: numpy.array
len(density) == len(temporal_distance_split_points_ordered) -1
delta_peak_loc_to_probability_mass : dict | gtfspy/routing/profile_block_analyzer.py | def _temporal_distance_pdf(self):
"""
Temporal distance probability density function.
Returns
-------
non_delta_peak_split_points: numpy.array
non_delta_peak_densities: numpy.array
len(density) == len(temporal_distance_split_points_ordered) -1
delta_p... | def _temporal_distance_pdf(self):
"""
Temporal distance probability density function.
Returns
-------
non_delta_peak_split_points: numpy.array
non_delta_peak_densities: numpy.array
len(density) == len(temporal_distance_split_points_ordered) -1
delta_p... | [
"Temporal",
"distance",
"probability",
"density",
"function",
"."
] | CxAalto/gtfspy | python | https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/routing/profile_block_analyzer.py#L185-L213 | [
"def",
"_temporal_distance_pdf",
"(",
"self",
")",
":",
"temporal_distance_split_points_ordered",
",",
"norm_cdf",
"=",
"self",
".",
"_temporal_distance_cdf",
"(",
")",
"delta_peak_loc_to_probability_mass",
"=",
"{",
"}",
"non_delta_peak_split_points",
"=",
"[",
"temporal... | bddba4b74faae6c1b91202f19184811e326547e5 |
valid | remove_all_trips_fully_outside_buffer | Not used in the regular filter process for the time being.
Parameters
----------
db_conn: sqlite3.Connection
connection to the GTFS object
center_lat: float
center_lon: float
buffer_km: float | gtfspy/filter.py | def remove_all_trips_fully_outside_buffer(db_conn, center_lat, center_lon, buffer_km, update_secondary_data=True):
"""
Not used in the regular filter process for the time being.
Parameters
----------
db_conn: sqlite3.Connection
connection to the GTFS object
center_lat: float
center_... | def remove_all_trips_fully_outside_buffer(db_conn, center_lat, center_lon, buffer_km, update_secondary_data=True):
"""
Not used in the regular filter process for the time being.
Parameters
----------
db_conn: sqlite3.Connection
connection to the GTFS object
center_lat: float
center_... | [
"Not",
"used",
"in",
"the",
"regular",
"filter",
"process",
"for",
"the",
"time",
"being",
"."
] | CxAalto/gtfspy | python | https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/filter.py#L495-L529 | [
"def",
"remove_all_trips_fully_outside_buffer",
"(",
"db_conn",
",",
"center_lat",
",",
"center_lon",
",",
"buffer_km",
",",
"update_secondary_data",
"=",
"True",
")",
":",
"distance_function_str",
"=",
"add_wgs84_distance_function_to_db",
"(",
"db_conn",
")",
"stops_with... | bddba4b74faae6c1b91202f19184811e326547e5 |
valid | remove_dangling_shapes | Remove dangling entries from the shapes directory.
Parameters
----------
db_conn: sqlite3.Connection
connection to the GTFS object | gtfspy/filter.py | def remove_dangling_shapes(db_conn):
"""
Remove dangling entries from the shapes directory.
Parameters
----------
db_conn: sqlite3.Connection
connection to the GTFS object
"""
db_conn.execute(DELETE_SHAPES_NOT_REFERENCED_IN_TRIPS_SQL)
SELECT_MIN_MAX_SHAPE_BREAKS_BY_TRIP_I_SQL = ... | def remove_dangling_shapes(db_conn):
"""
Remove dangling entries from the shapes directory.
Parameters
----------
db_conn: sqlite3.Connection
connection to the GTFS object
"""
db_conn.execute(DELETE_SHAPES_NOT_REFERENCED_IN_TRIPS_SQL)
SELECT_MIN_MAX_SHAPE_BREAKS_BY_TRIP_I_SQL = ... | [
"Remove",
"dangling",
"entries",
"from",
"the",
"shapes",
"directory",
"."
] | CxAalto/gtfspy | python | https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/filter.py#L532-L555 | [
"def",
"remove_dangling_shapes",
"(",
"db_conn",
")",
":",
"db_conn",
".",
"execute",
"(",
"DELETE_SHAPES_NOT_REFERENCED_IN_TRIPS_SQL",
")",
"SELECT_MIN_MAX_SHAPE_BREAKS_BY_TRIP_I_SQL",
"=",
"\"SELECT trips.trip_I, shape_id, min(shape_break) as min_shape_break, max(shape_break) as max_sh... | bddba4b74faae6c1b91202f19184811e326547e5 |
valid | FilterExtract._delete_rows_by_start_and_end_date | Removes rows from the sqlite database copy that are out of the time span defined by start_date and end_date
:param gtfs: GTFS object
:param copy_db_conn: sqlite database connection
:param start_date:
:param end_date:
:return: | gtfspy/filter.py | def _delete_rows_by_start_and_end_date(self):
"""
Removes rows from the sqlite database copy that are out of the time span defined by start_date and end_date
:param gtfs: GTFS object
:param copy_db_conn: sqlite database connection
:param start_date:
:param end_date:
... | def _delete_rows_by_start_and_end_date(self):
"""
Removes rows from the sqlite database copy that are out of the time span defined by start_date and end_date
:param gtfs: GTFS object
:param copy_db_conn: sqlite database connection
:param start_date:
:param end_date:
... | [
"Removes",
"rows",
"from",
"the",
"sqlite",
"database",
"copy",
"that",
"are",
"out",
"of",
"the",
"time",
"span",
"defined",
"by",
"start_date",
"and",
"end_date",
":",
"param",
"gtfs",
":",
"GTFS",
"object",
":",
"param",
"copy_db_conn",
":",
"sqlite",
"... | CxAalto/gtfspy | python | https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/filter.py#L152-L200 | [
"def",
"_delete_rows_by_start_and_end_date",
"(",
"self",
")",
":",
"# filter by start_time_ut and end_date_ut:",
"if",
"(",
"self",
".",
"start_date",
"is",
"not",
"None",
")",
"and",
"(",
"self",
".",
"end_date",
"is",
"not",
"None",
")",
":",
"start_date_ut",
... | bddba4b74faae6c1b91202f19184811e326547e5 |
valid | FilterExtract._filter_by_calendar | update calendar table's services
:param copy_db_conn:
:param start_date:
:param end_date:
:return: | gtfspy/filter.py | def _filter_by_calendar(self):
"""
update calendar table's services
:param copy_db_conn:
:param start_date:
:param end_date:
:return:
"""
if (self.start_date is not None) and (self.end_date is not None):
logging.info("Making date extract")
... | def _filter_by_calendar(self):
"""
update calendar table's services
:param copy_db_conn:
:param start_date:
:param end_date:
:return:
"""
if (self.start_date is not None) and (self.end_date is not None):
logging.info("Making date extract")
... | [
"update",
"calendar",
"table",
"s",
"services",
":",
"param",
"copy_db_conn",
":",
":",
"param",
"start_date",
":",
":",
"param",
"end_date",
":",
":",
"return",
":"
] | CxAalto/gtfspy | python | https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/filter.py#L234-L267 | [
"def",
"_filter_by_calendar",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"start_date",
"is",
"not",
"None",
")",
"and",
"(",
"self",
".",
"end_date",
"is",
"not",
"None",
")",
":",
"logging",
".",
"info",
"(",
"\"Making date extract\"",
")",
"start_d... | bddba4b74faae6c1b91202f19184811e326547e5 |
valid | FilterExtract._filter_by_agency | filter by agency ids
:param copy_db_conn:
:param agency_ids_to_preserve:
:return: | gtfspy/filter.py | def _filter_by_agency(self):
"""
filter by agency ids
:param copy_db_conn:
:param agency_ids_to_preserve:
:return:
"""
if self.agency_ids_to_preserve is not None:
logging.info("Filtering based on agency_ids")
agency_ids_to_preserve = list(s... | def _filter_by_agency(self):
"""
filter by agency ids
:param copy_db_conn:
:param agency_ids_to_preserve:
:return:
"""
if self.agency_ids_to_preserve is not None:
logging.info("Filtering based on agency_ids")
agency_ids_to_preserve = list(s... | [
"filter",
"by",
"agency",
"ids",
":",
"param",
"copy_db_conn",
":",
":",
"param",
"agency_ids_to_preserve",
":",
":",
"return",
":"
] | CxAalto/gtfspy | python | https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/filter.py#L269-L308 | [
"def",
"_filter_by_agency",
"(",
"self",
")",
":",
"if",
"self",
".",
"agency_ids_to_preserve",
"is",
"not",
"None",
":",
"logging",
".",
"info",
"(",
"\"Filtering based on agency_ids\"",
")",
"agency_ids_to_preserve",
"=",
"list",
"(",
"self",
".",
"agency_ids_to... | bddba4b74faae6c1b91202f19184811e326547e5 |
valid | FilterExtract._filter_spatially | Filter the feed based on self.buffer_distance_km from self.buffer_lon and self.buffer_lat.
1. First include all stops that are within self.buffer_distance_km from self.buffer_lon and self.buffer_lat.
2. Then include all intermediate stops that are between any of the included stop pairs with some PT tri... | gtfspy/filter.py | def _filter_spatially(self):
"""
Filter the feed based on self.buffer_distance_km from self.buffer_lon and self.buffer_lat.
1. First include all stops that are within self.buffer_distance_km from self.buffer_lon and self.buffer_lat.
2. Then include all intermediate stops that are betwee... | def _filter_spatially(self):
"""
Filter the feed based on self.buffer_distance_km from self.buffer_lon and self.buffer_lat.
1. First include all stops that are within self.buffer_distance_km from self.buffer_lon and self.buffer_lat.
2. Then include all intermediate stops that are betwee... | [
"Filter",
"the",
"feed",
"based",
"on",
"self",
".",
"buffer_distance_km",
"from",
"self",
".",
"buffer_lon",
"and",
"self",
".",
"buffer_lat",
"."
] | CxAalto/gtfspy | python | https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/filter.py#L310-L435 | [
"def",
"_filter_spatially",
"(",
"self",
")",
":",
"if",
"self",
".",
"buffer_lat",
"is",
"None",
"or",
"self",
".",
"buffer_lon",
"is",
"None",
"or",
"self",
".",
"buffer_distance_km",
"is",
"None",
":",
"return",
"NOT_FILTERED",
"print",
"(",
"\"filtering ... | bddba4b74faae6c1b91202f19184811e326547e5 |
valid | compute_pseudo_connections | Given a set of transit events and the static walk network,
"transform" the static walking network into a set of "pseudo-connections".
As a first approximation, we add pseudo-connections to depart after each arrival of a transit connection
to it's arrival stop.
Parameters
----------
transit_con... | gtfspy/routing/pseudo_connections.py | def compute_pseudo_connections(transit_connections, start_time_dep,
end_time_dep, transfer_margin,
walk_network, walk_speed):
"""
Given a set of transit events and the static walk network,
"transform" the static walking network into a set of "pse... | def compute_pseudo_connections(transit_connections, start_time_dep,
end_time_dep, transfer_margin,
walk_network, walk_speed):
"""
Given a set of transit events and the static walk network,
"transform" the static walking network into a set of "pse... | [
"Given",
"a",
"set",
"of",
"transit",
"events",
"and",
"the",
"static",
"walk",
"network",
"transform",
"the",
"static",
"walking",
"network",
"into",
"a",
"set",
"of",
"pseudo",
"-",
"connections",
"."
] | CxAalto/gtfspy | python | https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/routing/pseudo_connections.py#L4-L50 | [
"def",
"compute_pseudo_connections",
"(",
"transit_connections",
",",
"start_time_dep",
",",
"end_time_dep",
",",
"transfer_margin",
",",
"walk_network",
",",
"walk_speed",
")",
":",
"# A pseudo-connection should be created after (each) arrival to a transit_connection's arrival stop.... | bddba4b74faae6c1b91202f19184811e326547e5 |
valid | SpreadingStop.get_min_visit_time | Get the earliest visit time of the stop. | gtfspy/spreading/spreading_stop.py | def get_min_visit_time(self):
"""
Get the earliest visit time of the stop.
"""
if not self.visit_events:
return float('inf')
else:
return min(self.visit_events, key=lambda event: event.arr_time_ut).arr_time_ut | def get_min_visit_time(self):
"""
Get the earliest visit time of the stop.
"""
if not self.visit_events:
return float('inf')
else:
return min(self.visit_events, key=lambda event: event.arr_time_ut).arr_time_ut | [
"Get",
"the",
"earliest",
"visit",
"time",
"of",
"the",
"stop",
"."
] | CxAalto/gtfspy | python | https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/spreading/spreading_stop.py#L8-L15 | [
"def",
"get_min_visit_time",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"visit_events",
":",
"return",
"float",
"(",
"'inf'",
")",
"else",
":",
"return",
"min",
"(",
"self",
".",
"visit_events",
",",
"key",
"=",
"lambda",
"event",
":",
"event",
"... | bddba4b74faae6c1b91202f19184811e326547e5 |
valid | SpreadingStop.visit | Visit the stop if it has not been visited already by an event with
earlier arr_time_ut (or with other trip that does not require a transfer)
Parameters
----------
event : Event
an instance of the Event (namedtuple)
Returns
-------
visited : bool
... | gtfspy/spreading/spreading_stop.py | def visit(self, event):
"""
Visit the stop if it has not been visited already by an event with
earlier arr_time_ut (or with other trip that does not require a transfer)
Parameters
----------
event : Event
an instance of the Event (namedtuple)
Returns... | def visit(self, event):
"""
Visit the stop if it has not been visited already by an event with
earlier arr_time_ut (or with other trip that does not require a transfer)
Parameters
----------
event : Event
an instance of the Event (namedtuple)
Returns... | [
"Visit",
"the",
"stop",
"if",
"it",
"has",
"not",
"been",
"visited",
"already",
"by",
"an",
"event",
"with",
"earlier",
"arr_time_ut",
"(",
"or",
"with",
"other",
"trip",
"that",
"does",
"not",
"require",
"a",
"transfer",
")"
] | CxAalto/gtfspy | python | https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/spreading/spreading_stop.py#L23-L51 | [
"def",
"visit",
"(",
"self",
",",
"event",
")",
":",
"to_visit",
"=",
"False",
"if",
"event",
".",
"arr_time_ut",
"<=",
"self",
".",
"min_transfer_time",
"+",
"self",
".",
"get_min_visit_time",
"(",
")",
":",
"to_visit",
"=",
"True",
"else",
":",
"for",
... | bddba4b74faae6c1b91202f19184811e326547e5 |
valid | SpreadingStop.can_infect | Whether the spreading stop can infect using this event. | gtfspy/spreading/spreading_stop.py | def can_infect(self, event):
"""
Whether the spreading stop can infect using this event.
"""
if event.from_stop_I != self.stop_I:
return False
if not self.has_been_visited():
return False
else:
time_sep = event.dep_time_ut-self.get_min... | def can_infect(self, event):
"""
Whether the spreading stop can infect using this event.
"""
if event.from_stop_I != self.stop_I:
return False
if not self.has_been_visited():
return False
else:
time_sep = event.dep_time_ut-self.get_min... | [
"Whether",
"the",
"spreading",
"stop",
"can",
"infect",
"using",
"this",
"event",
"."
] | CxAalto/gtfspy | python | https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/spreading/spreading_stop.py#L56-L77 | [
"def",
"can_infect",
"(",
"self",
",",
"event",
")",
":",
"if",
"event",
".",
"from_stop_I",
"!=",
"self",
".",
"stop_I",
":",
"return",
"False",
"if",
"not",
"self",
".",
"has_been_visited",
"(",
")",
":",
"return",
"False",
"else",
":",
"time_sep",
"... | bddba4b74faae6c1b91202f19184811e326547e5 |
valid | get_transit_connections | Parameters
----------
gtfs: gtfspy.GTFS
end_time_ut: int
start_time_ut: int
Returns
-------
list[Connection] | gtfspy/routing/helpers.py | def get_transit_connections(gtfs, start_time_ut, end_time_ut):
"""
Parameters
----------
gtfs: gtfspy.GTFS
end_time_ut: int
start_time_ut: int
Returns
-------
list[Connection]
"""
if start_time_ut + 20 * 3600 < end_time_ut:
warn("Note that it is possible that same tr... | def get_transit_connections(gtfs, start_time_ut, end_time_ut):
"""
Parameters
----------
gtfs: gtfspy.GTFS
end_time_ut: int
start_time_ut: int
Returns
-------
list[Connection]
"""
if start_time_ut + 20 * 3600 < end_time_ut:
warn("Note that it is possible that same tr... | [
"Parameters",
"----------",
"gtfs",
":",
"gtfspy",
".",
"GTFS",
"end_time_ut",
":",
"int",
"start_time_ut",
":",
"int"
] | CxAalto/gtfspy | python | https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/routing/helpers.py#L8-L29 | [
"def",
"get_transit_connections",
"(",
"gtfs",
",",
"start_time_ut",
",",
"end_time_ut",
")",
":",
"if",
"start_time_ut",
"+",
"20",
"*",
"3600",
"<",
"end_time_ut",
":",
"warn",
"(",
"\"Note that it is possible that same trip_I's can take place during multiple days, \"",
... | bddba4b74faae6c1b91202f19184811e326547e5 |
valid | get_walk_network | Parameters
----------
gtfs: gtfspy.GTFS
Returns
-------
walk_network: networkx.Graph: | gtfspy/routing/helpers.py | def get_walk_network(gtfs, max_link_distance_m=1000):
"""
Parameters
----------
gtfs: gtfspy.GTFS
Returns
-------
walk_network: networkx.Graph:
"""
assert (isinstance(gtfs, GTFS))
return walk_transfer_stop_to_stop_network(gtfs, max_link_distance=max_link_distance_m) | def get_walk_network(gtfs, max_link_distance_m=1000):
"""
Parameters
----------
gtfs: gtfspy.GTFS
Returns
-------
walk_network: networkx.Graph:
"""
assert (isinstance(gtfs, GTFS))
return walk_transfer_stop_to_stop_network(gtfs, max_link_distance=max_link_distance_m) | [
"Parameters",
"----------",
"gtfs",
":",
"gtfspy",
".",
"GTFS"
] | CxAalto/gtfspy | python | https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/routing/helpers.py#L32-L43 | [
"def",
"get_walk_network",
"(",
"gtfs",
",",
"max_link_distance_m",
"=",
"1000",
")",
":",
"assert",
"(",
"isinstance",
"(",
"gtfs",
",",
"GTFS",
")",
")",
"return",
"walk_transfer_stop_to_stop_network",
"(",
"gtfs",
",",
"max_link_distance",
"=",
"max_link_distan... | bddba4b74faae6c1b91202f19184811e326547e5 |
valid | calculate_trip_shape_breakpoints | Pre-compute the shape points corresponding to each trip's stop.
Depends: shapes | gtfspy/import_loaders/stop_times_loader.py | def calculate_trip_shape_breakpoints(conn):
"""Pre-compute the shape points corresponding to each trip's stop.
Depends: shapes"""
from gtfspy import shapes
cur = conn.cursor()
breakpoints_cache = {}
# Counters for problems - don't print every problem.
count_bad_shape_ordering = 0
coun... | def calculate_trip_shape_breakpoints(conn):
"""Pre-compute the shape points corresponding to each trip's stop.
Depends: shapes"""
from gtfspy import shapes
cur = conn.cursor()
breakpoints_cache = {}
# Counters for problems - don't print every problem.
count_bad_shape_ordering = 0
coun... | [
"Pre",
"-",
"compute",
"the",
"shape",
"points",
"corresponding",
"to",
"each",
"trip",
"s",
"stop",
"."
] | CxAalto/gtfspy | python | https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/import_loaders/stop_times_loader.py#L97-L184 | [
"def",
"calculate_trip_shape_breakpoints",
"(",
"conn",
")",
":",
"from",
"gtfspy",
"import",
"shapes",
"cur",
"=",
"conn",
".",
"cursor",
"(",
")",
"breakpoints_cache",
"=",
"{",
"}",
"# Counters for problems - don't print every problem.",
"count_bad_shape_ordering",
"... | bddba4b74faae6c1b91202f19184811e326547e5 |
valid | JourneyDataManager.import_journey_data_for_target_stop | Parameters
----------
origin_stop_I_to_journey_labels: dict
key: origin_stop_Is
value: list of labels
target_stop_I: int | gtfspy/routing/journey_data.py | def import_journey_data_for_target_stop(self, target_stop_I, origin_stop_I_to_journey_labels, enforce_synchronous_writes=False):
"""
Parameters
----------
origin_stop_I_to_journey_labels: dict
key: origin_stop_Is
value: list of labels
target_stop_I: int
... | def import_journey_data_for_target_stop(self, target_stop_I, origin_stop_I_to_journey_labels, enforce_synchronous_writes=False):
"""
Parameters
----------
origin_stop_I_to_journey_labels: dict
key: origin_stop_Is
value: list of labels
target_stop_I: int
... | [
"Parameters",
"----------",
"origin_stop_I_to_journey_labels",
":",
"dict",
"key",
":",
"origin_stop_Is",
"value",
":",
"list",
"of",
"labels",
"target_stop_I",
":",
"int"
] | CxAalto/gtfspy | python | https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/routing/journey_data.py#L82-L101 | [
"def",
"import_journey_data_for_target_stop",
"(",
"self",
",",
"target_stop_I",
",",
"origin_stop_I_to_journey_labels",
",",
"enforce_synchronous_writes",
"=",
"False",
")",
":",
"cur",
"=",
"self",
".",
"conn",
".",
"cursor",
"(",
")",
"self",
".",
"conn",
".",
... | bddba4b74faae6c1b91202f19184811e326547e5 |
valid | JourneyDataManager._insert_journeys_into_db_no_route | con.isolation_level = 'EXCLUSIVE'
con.execute('BEGIN EXCLUSIVE')
#exclusive access starts here. Nothing else can r/w the db, do your magic here.
con.commit() | gtfspy/routing/journey_data.py | def _insert_journeys_into_db_no_route(self, stop_profiles, target_stop=None):
# TODO: Change the insertion so that the check last journey id and insertions are in the same transaction block
"""
con.isolation_level = 'EXCLUSIVE'
con.execute('BEGIN EXCLUSIVE')
#exclusive access sta... | def _insert_journeys_into_db_no_route(self, stop_profiles, target_stop=None):
# TODO: Change the insertion so that the check last journey id and insertions are in the same transaction block
"""
con.isolation_level = 'EXCLUSIVE'
con.execute('BEGIN EXCLUSIVE')
#exclusive access sta... | [
"con",
".",
"isolation_level",
"=",
"EXCLUSIVE",
"con",
".",
"execute",
"(",
"BEGIN",
"EXCLUSIVE",
")",
"#exclusive",
"access",
"starts",
"here",
".",
"Nothing",
"else",
"can",
"r",
"/",
"w",
"the",
"db",
"do",
"your",
"magic",
"here",
".",
"con",
".",
... | CxAalto/gtfspy | python | https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/routing/journey_data.py#L113-L153 | [
"def",
"_insert_journeys_into_db_no_route",
"(",
"self",
",",
"stop_profiles",
",",
"target_stop",
"=",
"None",
")",
":",
"# TODO: Change the insertion so that the check last journey id and insertions are in the same transaction block",
"print",
"(",
"\"Collecting journey data\"",
")... | bddba4b74faae6c1b91202f19184811e326547e5 |
valid | JourneyDataManager._journey_label_generator | Parameters
----------
destination_stop_Is: list-like
origin_stop_Is: list-like
Yields
------
(origin_stop_I, destination_stop_I, journey_labels) : tuple | gtfspy/routing/journey_data.py | def _journey_label_generator(self, destination_stop_Is=None, origin_stop_Is=None):
"""
Parameters
----------
destination_stop_Is: list-like
origin_stop_Is: list-like
Yields
------
(origin_stop_I, destination_stop_I, journey_labels) : tuple
"""
... | def _journey_label_generator(self, destination_stop_Is=None, origin_stop_Is=None):
"""
Parameters
----------
destination_stop_Is: list-like
origin_stop_Is: list-like
Yields
------
(origin_stop_I, destination_stop_I, journey_labels) : tuple
"""
... | [
"Parameters",
"----------",
"destination_stop_Is",
":",
"list",
"-",
"like",
"origin_stop_Is",
":",
"list",
"-",
"like"
] | CxAalto/gtfspy | python | https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/routing/journey_data.py#L427-L466 | [
"def",
"_journey_label_generator",
"(",
"self",
",",
"destination_stop_Is",
"=",
"None",
",",
"origin_stop_Is",
"=",
"None",
")",
":",
"conn",
"=",
"self",
".",
"conn",
"conn",
".",
"row_factory",
"=",
"sqlite3",
".",
"Row",
"if",
"destination_stop_Is",
"is",
... | bddba4b74faae6c1b91202f19184811e326547e5 |
valid | JourneyDataManager._insert_travel_impedance_data_to_db | Parameters
----------
travel_impedance_measure_name: str
data: list[dict]
Each list element must contain keys:
"from_stop_I", "to_stop_I", "min", "max", "median" and "mean" | gtfspy/routing/journey_data.py | def _insert_travel_impedance_data_to_db(self, travel_impedance_measure_name, data):
"""
Parameters
----------
travel_impedance_measure_name: str
data: list[dict]
Each list element must contain keys:
"from_stop_I", "to_stop_I", "min", "max", "median" and "m... | def _insert_travel_impedance_data_to_db(self, travel_impedance_measure_name, data):
"""
Parameters
----------
travel_impedance_measure_name: str
data: list[dict]
Each list element must contain keys:
"from_stop_I", "to_stop_I", "min", "max", "median" and "m... | [
"Parameters",
"----------",
"travel_impedance_measure_name",
":",
"str",
"data",
":",
"list",
"[",
"dict",
"]",
"Each",
"list",
"element",
"must",
"contain",
"keys",
":",
"from_stop_I",
"to_stop_I",
"min",
"max",
"median",
"and",
"mean"
] | CxAalto/gtfspy | python | https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/routing/journey_data.py#L640-L659 | [
"def",
"_insert_travel_impedance_data_to_db",
"(",
"self",
",",
"travel_impedance_measure_name",
",",
"data",
")",
":",
"f",
"=",
"float",
"data_tuple",
"=",
"[",
"(",
"x",
"[",
"\"from_stop_I\"",
"]",
",",
"x",
"[",
"\"to_stop_I\"",
"]",
",",
"f",
"(",
"x",... | bddba4b74faae6c1b91202f19184811e326547e5 |
valid | plot_trip_counts_per_day | Parameters
----------
G: gtfspy.GTFS
ax: maptlotlib.Axes, optional
highlight_dates: list[str|datetime.datetime]
The values of highlight dates should represent dates, and or datetime objects.
highlight_date_labels: list
The labels for each highlight dates.
show: bool, optional
... | gtfspy/plots.py | def plot_trip_counts_per_day(G, ax=None, highlight_dates=None, highlight_date_labels=None, show=False):
"""
Parameters
----------
G: gtfspy.GTFS
ax: maptlotlib.Axes, optional
highlight_dates: list[str|datetime.datetime]
The values of highlight dates should represent dates, and or dateti... | def plot_trip_counts_per_day(G, ax=None, highlight_dates=None, highlight_date_labels=None, show=False):
"""
Parameters
----------
G: gtfspy.GTFS
ax: maptlotlib.Axes, optional
highlight_dates: list[str|datetime.datetime]
The values of highlight dates should represent dates, and or dateti... | [
"Parameters",
"----------",
"G",
":",
"gtfspy",
".",
"GTFS",
"ax",
":",
"maptlotlib",
".",
"Axes",
"optional",
"highlight_dates",
":",
"list",
"[",
"str|datetime",
".",
"datetime",
"]",
"The",
"values",
"of",
"highlight",
"dates",
"should",
"represent",
"dates... | CxAalto/gtfspy | python | https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/plots.py#L9-L49 | [
"def",
"plot_trip_counts_per_day",
"(",
"G",
",",
"ax",
"=",
"None",
",",
"highlight_dates",
"=",
"None",
",",
"highlight_date_labels",
"=",
"None",
",",
"show",
"=",
"False",
")",
":",
"daily_trip_counts",
"=",
"G",
".",
"get_trip_counts_per_day",
"(",
")",
... | bddba4b74faae6c1b91202f19184811e326547e5 |
valid | DayTripsMaterializer.make_views | Create day_trips and day_stop_times views.
day_trips: day_trips2 x trips = days x trips
day_stop_times: day_trips2 x trips x stop_times = days x trips x stop_times | gtfspy/import_loaders/day_trips_materializer.py | def make_views(cls, conn):
"""Create day_trips and day_stop_times views.
day_trips: day_trips2 x trips = days x trips
day_stop_times: day_trips2 x trips x stop_times = days x trips x stop_times
"""
conn.execute('DROP VIEW IF EXISTS main.day_trips')
conn.execute('CREATE... | def make_views(cls, conn):
"""Create day_trips and day_stop_times views.
day_trips: day_trips2 x trips = days x trips
day_stop_times: day_trips2 x trips x stop_times = days x trips x stop_times
"""
conn.execute('DROP VIEW IF EXISTS main.day_trips')
conn.execute('CREATE... | [
"Create",
"day_trips",
"and",
"day_stop_times",
"views",
"."
] | CxAalto/gtfspy | python | https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/import_loaders/day_trips_materializer.py#L33-L57 | [
"def",
"make_views",
"(",
"cls",
",",
"conn",
")",
":",
"conn",
".",
"execute",
"(",
"'DROP VIEW IF EXISTS main.day_trips'",
")",
"conn",
".",
"execute",
"(",
"'CREATE VIEW day_trips AS '",
"'SELECT day_trips2.*, trips.* '",
"#'days.day_start_ut+trips.start_time_ds AS start... | bddba4b74faae6c1b91202f19184811e326547e5 |
valid | createcolorbar | Create a colourbar with limits of lwr and upr | gtfspy/colormaps.py | def createcolorbar(cmap, norm):
"""Create a colourbar with limits of lwr and upr"""
cax, kw = matplotlib.colorbar.make_axes(matplotlib.pyplot.gca())
c = matplotlib.colorbar.ColorbarBase(cax, cmap=cmap, norm=norm)
return c | def createcolorbar(cmap, norm):
"""Create a colourbar with limits of lwr and upr"""
cax, kw = matplotlib.colorbar.make_axes(matplotlib.pyplot.gca())
c = matplotlib.colorbar.ColorbarBase(cax, cmap=cmap, norm=norm)
return c | [
"Create",
"a",
"colourbar",
"with",
"limits",
"of",
"lwr",
"and",
"upr"
] | CxAalto/gtfspy | python | https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/colormaps.py#L71-L75 | [
"def",
"createcolorbar",
"(",
"cmap",
",",
"norm",
")",
":",
"cax",
",",
"kw",
"=",
"matplotlib",
".",
"colorbar",
".",
"make_axes",
"(",
"matplotlib",
".",
"pyplot",
".",
"gca",
"(",
")",
")",
"c",
"=",
"matplotlib",
".",
"colorbar",
".",
"ColorbarBas... | bddba4b74faae6c1b91202f19184811e326547e5 |
valid | write_walk_transfer_edges | Parameters
----------
gtfs: gtfspy.GTFS
output_file_name: str | gtfspy/exports.py | def write_walk_transfer_edges(gtfs, output_file_name):
"""
Parameters
----------
gtfs: gtfspy.GTFS
output_file_name: str
"""
transfers = gtfs.get_table("stop_distances")
transfers.drop([u"min_transfer_time", u"timed_transfer"], 1, inplace=True)
with util.create_file(output_file_name,... | def write_walk_transfer_edges(gtfs, output_file_name):
"""
Parameters
----------
gtfs: gtfspy.GTFS
output_file_name: str
"""
transfers = gtfs.get_table("stop_distances")
transfers.drop([u"min_transfer_time", u"timed_transfer"], 1, inplace=True)
with util.create_file(output_file_name,... | [
"Parameters",
"----------",
"gtfs",
":",
"gtfspy",
".",
"GTFS",
"output_file_name",
":",
"str"
] | CxAalto/gtfspy | python | https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/exports.py#L17-L27 | [
"def",
"write_walk_transfer_edges",
"(",
"gtfs",
",",
"output_file_name",
")",
":",
"transfers",
"=",
"gtfs",
".",
"get_table",
"(",
"\"stop_distances\"",
")",
"transfers",
".",
"drop",
"(",
"[",
"u\"min_transfer_time\"",
",",
"u\"timed_transfer\"",
"]",
",",
"1",... | bddba4b74faae6c1b91202f19184811e326547e5 |
valid | write_nodes | Parameters
----------
gtfs: gtfspy.GTFS
output: str
Path to the output file
fields: list, optional
which pieces of information to provide | gtfspy/exports.py | def write_nodes(gtfs, output, fields=None):
"""
Parameters
----------
gtfs: gtfspy.GTFS
output: str
Path to the output file
fields: list, optional
which pieces of information to provide
"""
nodes = gtfs.get_table("stops")
if fields is not None:
nodes = nodes[f... | def write_nodes(gtfs, output, fields=None):
"""
Parameters
----------
gtfs: gtfspy.GTFS
output: str
Path to the output file
fields: list, optional
which pieces of information to provide
"""
nodes = gtfs.get_table("stops")
if fields is not None:
nodes = nodes[f... | [
"Parameters",
"----------",
"gtfs",
":",
"gtfspy",
".",
"GTFS",
"output",
":",
"str",
"Path",
"to",
"the",
"output",
"file",
"fields",
":",
"list",
"optional",
"which",
"pieces",
"of",
"information",
"to",
"provide"
] | CxAalto/gtfspy | python | https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/exports.py#L30-L44 | [
"def",
"write_nodes",
"(",
"gtfs",
",",
"output",
",",
"fields",
"=",
"None",
")",
":",
"nodes",
"=",
"gtfs",
".",
"get_table",
"(",
"\"stops\"",
")",
"if",
"fields",
"is",
"not",
"None",
":",
"nodes",
"=",
"nodes",
"[",
"fields",
"]",
"with",
"util"... | bddba4b74faae6c1b91202f19184811e326547e5 |
valid | write_stops_geojson | Parameters
----------
gtfs: gtfspy.GTFS
out_file: file-like or path to file
fields: dict
simultaneously map each original_name to the new_name
Returns
------- | gtfspy/exports.py | def write_stops_geojson(gtfs, out_file, fields=None):
"""
Parameters
----------
gtfs: gtfspy.GTFS
out_file: file-like or path to file
fields: dict
simultaneously map each original_name to the new_name
Returns
-------
"""
geojson = create_stops_geojson_dict(gtfs, fields)
... | def write_stops_geojson(gtfs, out_file, fields=None):
"""
Parameters
----------
gtfs: gtfspy.GTFS
out_file: file-like or path to file
fields: dict
simultaneously map each original_name to the new_name
Returns
-------
"""
geojson = create_stops_geojson_dict(gtfs, fields)
... | [
"Parameters",
"----------",
"gtfs",
":",
"gtfspy",
".",
"GTFS",
"out_file",
":",
"file",
"-",
"like",
"or",
"path",
"to",
"file",
"fields",
":",
"dict",
"simultaneously",
"map",
"each",
"original_name",
"to",
"the",
"new_name",
"Returns",
"-------"
] | CxAalto/gtfspy | python | https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/exports.py#L81-L98 | [
"def",
"write_stops_geojson",
"(",
"gtfs",
",",
"out_file",
",",
"fields",
"=",
"None",
")",
":",
"geojson",
"=",
"create_stops_geojson_dict",
"(",
"gtfs",
",",
"fields",
")",
"if",
"hasattr",
"(",
"out_file",
",",
"\"write\"",
")",
":",
"out_file",
".",
"... | bddba4b74faae6c1b91202f19184811e326547e5 |
valid | write_combined_transit_stop_to_stop_network | Parameters
----------
gtfs : gtfspy.GTFS
output_path : str
fmt: None, optional
defaulting to "edg" and writing results as ".edg" files
If "csv" csv files are produced instead | gtfspy/exports.py | def write_combined_transit_stop_to_stop_network(gtfs, output_path, fmt=None):
"""
Parameters
----------
gtfs : gtfspy.GTFS
output_path : str
fmt: None, optional
defaulting to "edg" and writing results as ".edg" files
If "csv" csv files are produced instead """
if fmt is N... | def write_combined_transit_stop_to_stop_network(gtfs, output_path, fmt=None):
"""
Parameters
----------
gtfs : gtfspy.GTFS
output_path : str
fmt: None, optional
defaulting to "edg" and writing results as ".edg" files
If "csv" csv files are produced instead """
if fmt is N... | [
"Parameters",
"----------",
"gtfs",
":",
"gtfspy",
".",
"GTFS",
"output_path",
":",
"str",
"fmt",
":",
"None",
"optional",
"defaulting",
"to",
"edg",
"and",
"writing",
"results",
"as",
".",
"edg",
"files",
"If",
"csv",
"csv",
"files",
"are",
"produced",
"i... | CxAalto/gtfspy | python | https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/exports.py#L101-L113 | [
"def",
"write_combined_transit_stop_to_stop_network",
"(",
"gtfs",
",",
"output_path",
",",
"fmt",
"=",
"None",
")",
":",
"if",
"fmt",
"is",
"None",
":",
"fmt",
"=",
"\"edg\"",
"multi_di_graph",
"=",
"combined_stop_to_stop_transit_network",
"(",
"gtfs",
")",
"_wri... | bddba4b74faae6c1b91202f19184811e326547e5 |
valid | write_static_networks | Parameters
----------
gtfs: gtfspy.GTFS
output_dir: (str, unicode)
a path where to write
fmt: None, optional
defaulting to "edg" and writing results as ".edg" files
If "csv" csv files are produced instead | gtfspy/exports.py | def write_static_networks(gtfs, output_dir, fmt=None):
"""
Parameters
----------
gtfs: gtfspy.GTFS
output_dir: (str, unicode)
a path where to write
fmt: None, optional
defaulting to "edg" and writing results as ".edg" files
If "csv" csv files are produced instead
"""... | def write_static_networks(gtfs, output_dir, fmt=None):
"""
Parameters
----------
gtfs: gtfspy.GTFS
output_dir: (str, unicode)
a path where to write
fmt: None, optional
defaulting to "edg" and writing results as ".edg" files
If "csv" csv files are produced instead
"""... | [
"Parameters",
"----------",
"gtfs",
":",
"gtfspy",
".",
"GTFS",
"output_dir",
":",
"(",
"str",
"unicode",
")",
"a",
"path",
"where",
"to",
"write",
"fmt",
":",
"None",
"optional",
"defaulting",
"to",
"edg",
"and",
"writing",
"results",
"as",
".",
"edg",
... | CxAalto/gtfspy | python | https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/exports.py#L116-L135 | [
"def",
"write_static_networks",
"(",
"gtfs",
",",
"output_dir",
",",
"fmt",
"=",
"None",
")",
":",
"if",
"fmt",
"is",
"None",
":",
"fmt",
"=",
"\"edg\"",
"single_layer_networks",
"=",
"stop_to_stop_networks_by_type",
"(",
"gtfs",
")",
"util",
".",
"makedirs",
... | bddba4b74faae6c1b91202f19184811e326547e5 |
valid | write_temporal_networks_by_route_type | Write temporal networks by route type to disk.
Parameters
----------
gtfs: gtfspy.GTFS
extract_output_dir: str | gtfspy/exports.py | def write_temporal_networks_by_route_type(gtfs, extract_output_dir):
"""
Write temporal networks by route type to disk.
Parameters
----------
gtfs: gtfspy.GTFS
extract_output_dir: str
"""
util.makedirs(extract_output_dir)
for route_type in route_types.TRANSIT_ROUTE_TYPES:
pa... | def write_temporal_networks_by_route_type(gtfs, extract_output_dir):
"""
Write temporal networks by route type to disk.
Parameters
----------
gtfs: gtfspy.GTFS
extract_output_dir: str
"""
util.makedirs(extract_output_dir)
for route_type in route_types.TRANSIT_ROUTE_TYPES:
pa... | [
"Write",
"temporal",
"networks",
"by",
"route",
"type",
"to",
"disk",
"."
] | CxAalto/gtfspy | python | https://github.com/CxAalto/gtfspy/blob/bddba4b74faae6c1b91202f19184811e326547e5/gtfspy/exports.py#L138-L152 | [
"def",
"write_temporal_networks_by_route_type",
"(",
"gtfs",
",",
"extract_output_dir",
")",
":",
"util",
".",
"makedirs",
"(",
"extract_output_dir",
")",
"for",
"route_type",
"in",
"route_types",
".",
"TRANSIT_ROUTE_TYPES",
":",
"pandas_data_frame",
"=",
"temporal_netw... | bddba4b74faae6c1b91202f19184811e326547e5 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.