samgis_web.utilities package

Submodules

samgis_web.utilities.constants module

Project constants

samgis_web.utilities.local_tiles_http_server module

class samgis_web.utilities.local_tiles_http_server.LocalTilesHttpServer(methodName='runTest')[source]

Bases: TestCase

static http_server(host, port, directory)[source]

Function http_server defined within this test class to avoid pytest error “fixture ‘host’ not found”.

Parameters:
  • host (str) – Either the DNS name or the IP address where the server will listen

  • port (int) – number where the server will listen (common ports are 7860 or 8000)

  • directory (str) – folder exposed by the http server

Returns:

samgis_web.utilities.type_hints module

custom type hints

class samgis_web.utilities.type_hints.ApiRequestBody(**data)[source]

Bases: BaseModel

Input request validator type (not yet parsed)

bbox: RawBBox
debug: bool
id: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

prompt: list[RawPromptPoint | RawPromptRectangle]
source_type: str
zoom: int | float
class samgis_web.utilities.type_hints.ApiResponseBodyFailure(**data)[source]

Bases: BaseModel

SamGIS API Response; handle only case of failure

duration_run: float
message: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

request_id: str
class samgis_web.utilities.type_hints.ApiResponseBodySuccess(**data)[source]

Bases: ApiResponseBodyFailure

SamGIS API Response; handle both case of success and failure

geojson: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

n_predictions: int
n_shapes_geojson: int
class samgis_web.utilities.type_hints.ContentTypes(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: str, Enum

Segment Anything: validation point prompt type

APPLICATION_JSON = 'application/json'
TEXT_HTML = 'text/html'
TEXT_PLAIN = 'text/plain'
class samgis_web.utilities.type_hints.ImagePixelCoordinates[source]

Bases: TypedDict

Image pixel coordinates type

x: int
y: int
class samgis_web.utilities.type_hints.LatLngDict(**data)[source]

Bases: BaseModel

Generic geographic latitude-longitude type

lat: float
lng: float
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class samgis_web.utilities.type_hints.PromptLabel(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Valid prompt label type

EXCLUDE = 0
INCLUDE = 1
class samgis_web.utilities.type_hints.PromptPointType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: str, Enum

Segment Anything: validation point prompt type

point = 'point'
class samgis_web.utilities.type_hints.PromptRectangleType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: str, Enum

Segment Anything: validation rectangle prompt type

rectangle = 'rectangle'
class samgis_web.utilities.type_hints.RawBBox(**data)[source]

Bases: BaseModel

Input lambda bbox request type (not yet parsed)

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

ne: LatLngDict
sw: LatLngDict
class samgis_web.utilities.type_hints.RawPromptPoint(**data)[source]

Bases: BaseModel

Input lambda prompt request of type ‘PromptPointType’ - point (not yet parsed)

data: LatLngDict
label: PromptLabel
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

type: PromptPointType
class samgis_web.utilities.type_hints.RawPromptRectangle(**data)[source]

Bases: BaseModel

Input lambda prompt request of type ‘PromptRectangleType’ - rectangle (not yet parsed)

data: RawBBox
get_type_str()[source]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

type: PromptRectangleType
class samgis_web.utilities.type_hints.StringPromptApiRequestBody(**data)[source]

Bases: BaseModel

Input lambda request validator type (not yet parsed)

bbox: RawBBox
debug: bool
id: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

source_type: str
string_prompt: str
zoom: int | float
class samgis_web.utilities.type_hints.WorldFile(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: StrEnum

Default xyz provider names

pgw = 'pgw'
tfw = 'tfw'
class samgis_web.utilities.type_hints.XYZDefaultProvidersNames(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: StrEnum

Default xyz provider names

DEFAULT_TILES_NAME = 'openstreetmap.mapnik'
DEFAULT_TILES_NAME_SHORT = 'openstreetmap'
class samgis_web.utilities.type_hints.XYZTerrainProvidersNames(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: StrEnum

Custom xyz provider names for digital elevation models

MAPBOX_TERRAIN_TILES_NAME = 'mapbox.terrain-rgb'
NEXTZEN_TERRAIN_TILES_NAME = 'nextzen.terrarium'

Module contents

various helpers functions