diff --git a/src/rok4/Layer.py b/src/rok4/Layer.py index 74387ae..b13e55a 100644 --- a/src/rok4/Layer.py +++ b/src/rok4/Layer.py @@ -12,10 +12,11 @@ from typing import Dict, List, Tuple, Union from rok4.Exceptions import * -from rok4.Pyramid import Pyramid, PyramidType -from rok4.Storage import * +from rok4.Pyramid import Pyramid from rok4.TileMatrixSet import TileMatrixSet +from rok4.Storage import * from rok4.Utils import * +from rok4.enums import PyramidType class Layer: diff --git a/src/rok4/Pyramid.py b/src/rok4/Pyramid.py index a06c73b..f6c670f 100644 --- a/src/rok4/Pyramid.py +++ b/src/rok4/Pyramid.py @@ -22,20 +22,7 @@ from rok4.Storage import * from rok4.TileMatrixSet import TileMatrix, TileMatrixSet from rok4.Utils import * - - -class PyramidType(Enum): - """Pyramid's data type""" - - RASTER = "RASTER" - VECTOR = "VECTOR" - - -class SlabType(Enum): - """Slab's type""" - - DATA = "DATA" # Slab of data, raster or vector - MASK = "MASK" # Slab of mask, only for raster pyramid, image with one band : 0 is nodata, other values are data +from rok4.enums import PyramidType, SlabType, StorageType ROK4_IMAGE_HEADER_SIZE = 2048 diff --git a/src/rok4/Storage.py b/src/rok4/Storage.py index 20dc874..efc3696 100644 --- a/src/rok4/Storage.py +++ b/src/rok4/Storage.py @@ -46,17 +46,10 @@ gdal.UseExceptions() +from rok4.enums import StorageType from rok4.Exceptions import * -class StorageType(Enum): - FILE = "file://" - S3 = "s3://" - CEPH = "ceph://" - HTTP = "http://" - HTTPS = "https://" - - __S3_CLIENTS = {} __S3_DEFAULT_CLIENT = None diff --git a/src/rok4/Utils.py b/src/rok4/Utils.py index 125e391..53450d7 100644 --- a/src/rok4/Utils.py +++ b/src/rok4/Utils.py @@ -3,6 +3,7 @@ import os import re + from enum import Enum from typing import Dict, List, Tuple, Union @@ -13,18 +14,6 @@ gdal.UseExceptions() -class ColorFormat(Enum): - """A color format enumeration. - Except from "BIT", the member's name matches - a common variable format name. The member's value is - the allocated bit size associated to this format. - """ - - BIT = 1 - UINT8 = 8 - FLOAT32 = 32 - - __SR_BOOK = {} diff --git a/src/rok4/enums.py b/src/rok4/enums.py new file mode 100644 index 0000000..76300ce --- /dev/null +++ b/src/rok4/enums.py @@ -0,0 +1,28 @@ +#! python3 # noqa: E265 + +# standard lib +from enum import Enum + + +class PyramidType(Enum): + """Pyramid's data type""" + + RASTER = "RASTER" + VECTOR = "VECTOR" + + +class SlabType(Enum): + """Slab's type""" + + DATA = "DATA" # Slab of data, raster or vector + MASK = "MASK" # Slab of mask, only for raster pyramid, image with one band : 0 is nodata, other values are data + + +class StorageType(Enum): + """Matrice de correspondance entre type de stockage et protocole.""" + + CEPH = "ceph://" + FILE = "file://" + HTTP = "http://" + HTTPS = "https://" + S3 = "s3://" diff --git a/tests/test_Layer.py b/tests/test_Layer.py index a35f649..bbf71eb 100644 --- a/tests/test_Layer.py +++ b/tests/test_Layer.py @@ -6,7 +6,7 @@ from rok4.Exceptions import * from rok4.Layer import Layer -from rok4.Pyramid import PyramidType +from rok4.enums import PyramidType @mock.patch.dict(os.environ, {}, clear=True) diff --git a/tests/test_Pyramid.py b/tests/test_Pyramid.py index f5f1d60..3b75be5 100644 --- a/tests/test_Pyramid.py +++ b/tests/test_Pyramid.py @@ -6,8 +6,9 @@ from rok4.Exceptions import * from rok4.Pyramid import * -from rok4.Storage import StorageType from rok4.TileMatrixSet import TileMatrixSet +from rok4.enums import SlabType, StorageType + from rok4.Utils import * diff --git a/tests/test_Storage.py b/tests/test_Storage.py index f7b665d..8426ccf 100644 --- a/tests/test_Storage.py +++ b/tests/test_Storage.py @@ -8,6 +8,7 @@ from rok4.Exceptions import * from rok4.Storage import * +from rok4.enums import StorageType @mock.patch.dict(os.environ, {}, clear=True)