Skip to content

Commit 751ae84

Browse files
author
Stefan Kuethe
committed
Refactor formats and import in init
1 parent 1329364 commit 751ae84

File tree

6 files changed

+26
-10
lines changed

6 files changed

+26
-10
lines changed

src/openlayers/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
except ImportError as e:
77
...
88

9-
from . import controls, layers
9+
from . import controls, layers, formats
1010
from .controls import *
1111
from .layers import *
1212
from .map import Map
13-
from .models import formats
13+
from .formats import *
1414
from .sources import *
1515
from .styles import FlatStyle
1616
from .view import View

src/openlayers/basemaps.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
from __future__ import annotations
22

33
import os
4-
54
from enum import Enum
65

76
from pydantic import BaseModel, Field
87

98
from .abstracts import LayerLike
9+
from .constants import MAPTILER_API_KEY_ENV_VAR
1010
from .models.layers import TileLayer
1111
from .models.sources import OSM, ImageTileSource, TileJSONSource
12-
from .constants import MAPTILER_API_KEY_ENV_VAR
1312

1413
# --- OSM
1514

src/openlayers/formats.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from .models.formats import GPX, KML, MVT, GeoJSON, TopoJSON
2+
3+
__all__ = ["GeoJSON", "TopoJSON", "GPX", "KML", "MVT"]

src/openlayers/layers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from .basemaps import BasemapLayer
44
from .models.layers import (
5+
HeatmapLayer,
56
Layer,
67
LayerT,
78
TileLayer,
@@ -11,7 +12,6 @@
1112
WebGLTileLayer,
1213
WebGLVectorLayer,
1314
WebGLVectorTileLayer,
14-
HeatmapLayer,
1515
)
1616

1717
__all__ = [

src/openlayers/models/controls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

77
from pydantic import Field, field_validator
88

9+
from ..constants import MAPTILER_API_KEY_ENV_VAR
910
from .core import OLBaseModel
1011
from .layers import LayerT, TileLayer
1112
from .sources import OSM
12-
from ..constants import MAPTILER_API_KEY_ENV_VAR
1313

1414

1515
# -- Base control

src/openlayers/models/formats.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,34 @@ class Format(OLBaseModel): ...
1212

1313

1414
# --- Formats
15-
class GeoJSON(Format): ...
15+
class GeoJSON(Format):
16+
"""GeoJSON format"""
1617

18+
...
1719

18-
class TopoJSON(Format): ...
20+
21+
class TopoJSON(Format):
22+
"""TopoJSON format"""
23+
24+
...
1925

2026

2127
class KML(Format):
28+
"""KML format"""
29+
2230
extract_styles: bool = Field(True, serialization_alias="extractStyles")
2331

2432

25-
class GPX(Format): ...
33+
class GPX(Format):
34+
"""GPX format"""
35+
36+
...
37+
2638

39+
class MVT(Format):
40+
"""MVT format"""
2741

28-
class MVT(Format): ...
42+
...
2943

3044

3145
# --- Format type

0 commit comments

Comments
 (0)