redshred package

Subpackages

Submodules

redshred.configuration module

class redshred.configuration.Configuration(token=None, host=None, host_verify=None, config_path=None, context_override=None)[source]

Bases: object

RedShred Configuration, here is the order that various configured sources are looked up

REDSHRED_TOKEN + REDSHRED_HOST REDSHRED_CONTEXT + REDSHRED_CONFIG REDSHRED_CONTEXT (uses default config path) REDSHRED_CONFIG (defaults to currentContext) None default config path with currentContext

context: str
host: str
info()[source]

multiline string representation of the configuration details

options: Dict[str, Any]
source: str
token: str
user: str | None
verify: bool
exception redshred.configuration.ConfigurationError[source]

Bases: Exception

exception redshred.configuration.ConfigurationFileError[source]

Bases: Exception

redshred.exceptions module

exception redshred.exceptions.RedShredAPIError(*args, reason=None, **kwargs)[source]

Bases: Exception

reason: Any
exception redshred.exceptions.RedShredFileExistsError(*args, **kwargs)[source]

Bases: RedShredHTTPError

exception redshred.exceptions.RedShredHTTPError(*args, **kwargs)[source]

Bases: HTTPError

classmethod from_http_error(http_error)[source]

redshred.spatial module

class redshred.spatial.BoundingBox(initlist: Iterable | None = None)[source]

Bases: list, _BaseGeometricMixin

as_boundingbox() BoundingBox[source]

Get a BoundingBox object from a GeoJSON object

as_geojson(_type='Polygon') GeoJSON[source]
as_numpy(dtype=<class 'numpy.float64'>)[source]
as_shape() BaseGeometry[source]

Get a shapely object from the BoundingBox

classmethod from_shape(geometry) BoundingBox[source]
get_bounds() BoundingBox[source]

for api consistency with Geojson

get_offsets(numpy=False) tuple[int, int][source]

x and y offsets for each coordinate of the geojson object

property height
json(**kwargs) str[source]

Dump current object to GeoJSON string

property min_x
property min_y
normalize_to_page() BoundingBox[source]
rotate(rotation, origin=(0.5, 0.5)) BoundingBox[source]
scale(xfact=1.0, yfact=1.0, origin=(0, 0)) BoundingBox[source]

shapely scaling transformation

translate(xoff=0.0, yoff=0.0) BoundingBox[source]

shapely offset transformation

property width
class redshred.spatial.GeoJSON[source]

Bases: dict, _BaseGeometricMixin

as_boundingbox() BoundingBox[source]

Get a BoundingBox object from a GeoJSON object

as_geojson() GeoJSON[source]
as_shape() BaseGeometry[source]

Get a shapely object from the GeoJSON dictionary Returns:

BaseGeometry

convex_hull()[source]

Return the convex hull of a geometry

classmethod from_bounds(x_min, y_min, x_max, y_max, base_class='polygon')[source]

Create a new object from x_min, y_min, x_max, y_max values. By default, a polygon is returned, but you can override this functionality by passing “multipolygon” as your base_class

classmethod from_coords(coords)[source]

Create a new GeoJSON object from either a list of coordinates, or a list of list of coordinates for a Polygon and Multipolygon respectively

classmethod from_shape(shapely_shape)[source]

Create a new GeoJSON object from a shapely shape

get_bounds() BoundingBox[source]

Get a BoundingBox object from a GeoJSON object

get_coordinates(canonical=True, numpy=False) List[List[float]][source]

Get a coordinates list object from a GeoJSON object

get_offsets(numpy=False) Tuple[int, int][source]

x and y offsets for each coordinate of the geojson object

property height
json(**kwargs) str[source]

Dump current object to GeoJSON string

property min_x
property min_y
normalize_to_page() GeoJSON[source]

Normalize the given GeoJSON from the quiltspace or document space to a [0,1], [0,1] scale. This returns a new GeoJSON instance.

rotate(angle, origin='center') GeoJSON[source]

Rotate a GeoJSON object using affine transformations. This returns a new GeoJSON instance.

scale(xfact=1.0, yfact=1.0, origin=(0, 0)) GeoJSON[source]

Scale a GeoJSON object using affine transformations. This returns a new GeoJSON instance.

translate(xoff=0.0, yoff=0.0) GeoJSON[source]

Offset a GeoJSON object by the specified amount. This returns a new GeoJSON instance.

property width

redshred.util module

util functions

redshred.util.decode_datetime(string_repr)[source]
redshred.util.id_from_any(something)[source]

Module contents

This is the RedShred client library in Python.

  1. RedShred, LLC 2018-2023