earthengine-api 1.5.23__py3-none-any.whl → 1.5.24__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of earthengine-api might be problematic. Click here for more details.
- {earthengine_api-1.5.23.dist-info → earthengine_api-1.5.24.dist-info}/METADATA +1 -1
- earthengine_api-1.5.24.dist-info/RECORD +107 -0
- ee/__init__.py +3 -3
- ee/_arg_types.py +6 -6
- ee/_cloud_api_utils.py +35 -35
- ee/_helpers.py +2 -2
- ee/apifunction.py +10 -10
- ee/apitestcase.py +9 -9
- ee/batch.py +39 -39
- ee/blob.py +2 -2
- ee/cli/commands.py +15 -15
- ee/cli/utils.py +5 -5
- ee/collection.py +3 -3
- ee/computedobject.py +6 -6
- ee/confusionmatrix.py +2 -2
- ee/customfunction.py +8 -8
- ee/data.py +55 -55
- ee/daterange.py +2 -2
- ee/deprecation.py +4 -4
- ee/dictionary.py +2 -2
- ee/ee_array.py +2 -2
- ee/ee_date.py +2 -2
- ee/ee_list.py +2 -3
- ee/element.py +3 -3
- ee/errormargin.py +2 -2
- ee/feature.py +5 -5
- ee/featurecollection.py +5 -5
- ee/function.py +5 -5
- ee/geometry.py +10 -10
- ee/image.py +19 -19
- ee/image_converter.py +2 -2
- ee/imagecollection.py +7 -7
- ee/oauth.py +4 -4
- ee/pixeltype.py +2 -2
- ee/projection.py +2 -2
- ee/serializer.py +5 -5
- ee/table_converter.py +4 -4
- ee/tests/blob_test.py +3 -3
- ee/tests/classifier_test.py +3 -3
- ee/tests/clusterer_test.py +3 -3
- ee/tests/confusionmatrix_test.py +3 -3
- ee/tests/daterange_test.py +4 -4
- ee/tests/deprecation_test.py +2 -2
- ee/tests/dictionary_test.py +3 -3
- ee/tests/ee_array_test.py +3 -3
- ee/tests/ee_date_test.py +4 -4
- ee/tests/ee_list_test.py +3 -3
- ee/tests/ee_number_test.py +3 -3
- ee/tests/ee_string_test.py +3 -3
- ee/tests/feature_test.py +4 -4
- ee/tests/featurecollection_test.py +3 -3
- ee/tests/filter_test.py +4 -4
- ee/tests/geometry_point_test.py +3 -3
- ee/tests/image_test.py +3 -3
- ee/tests/imagecollection_test.py +3 -3
- ee/tests/join_test.py +3 -3
- ee/tests/kernel_test.py +3 -3
- ee/tests/model_test.py +5 -5
- ee/tests/pixeltype_test.py +5 -5
- ee/tests/projection_test.py +3 -3
- ee/tests/reducer_test.py +3 -3
- ee/tests/serializer_test.py +4 -4
- ee/tests/table_converter_test.py +3 -3
- ee/tests/terrain_test.py +3 -3
- earthengine_api-1.5.23.dist-info/RECORD +0 -107
- {earthengine_api-1.5.23.dist-info → earthengine_api-1.5.24.dist-info}/WHEEL +0 -0
- {earthengine_api-1.5.23.dist-info → earthengine_api-1.5.24.dist-info}/entry_points.txt +0 -0
- {earthengine_api-1.5.23.dist-info → earthengine_api-1.5.24.dist-info}/licenses/LICENSE +0 -0
- {earthengine_api-1.5.23.dist-info → earthengine_api-1.5.24.dist-info}/top_level.txt +0 -0
ee/function.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""A base class for EE Functions."""
|
|
2
2
|
|
|
3
3
|
import textwrap
|
|
4
|
-
from typing import Any
|
|
4
|
+
from typing import Any
|
|
5
5
|
|
|
6
6
|
from ee import computedobject
|
|
7
7
|
from ee import ee_exception
|
|
@@ -31,7 +31,7 @@ class Function(encodable.EncodableFunction):
|
|
|
31
31
|
"""
|
|
32
32
|
Function._promoter = staticmethod(promoter)
|
|
33
33
|
|
|
34
|
-
def getSignature(self) ->
|
|
34
|
+
def getSignature(self) -> dict[str, Any]:
|
|
35
35
|
"""Returns a description of the interface provided by this function.
|
|
36
36
|
|
|
37
37
|
Returns:
|
|
@@ -75,7 +75,7 @@ class Function(encodable.EncodableFunction):
|
|
|
75
75
|
result = computedobject.ComputedObject(self, self.promoteArgs(named_args))
|
|
76
76
|
return Function._promoter(result, self.getReturnType())
|
|
77
77
|
|
|
78
|
-
def promoteArgs(self, args:
|
|
78
|
+
def promoteArgs(self, args: dict[str, Any]) -> dict[str, Any]:
|
|
79
79
|
"""Promotes arguments to their types based on the function's signature.
|
|
80
80
|
|
|
81
81
|
Verifies that all required arguments are provided and no unknown arguments
|
|
@@ -95,8 +95,8 @@ class Function(encodable.EncodableFunction):
|
|
|
95
95
|
arg_specs = signature['args']
|
|
96
96
|
|
|
97
97
|
# Promote all recognized args.
|
|
98
|
-
promoted_args:
|
|
99
|
-
known:
|
|
98
|
+
promoted_args: dict[str, Any] = {}
|
|
99
|
+
known: set[str] = set()
|
|
100
100
|
for arg_spec in arg_specs:
|
|
101
101
|
name = arg_spec['name']
|
|
102
102
|
if name in args:
|
ee/geometry.py
CHANGED
|
@@ -5,7 +5,7 @@ from __future__ import annotations
|
|
|
5
5
|
import collections.abc
|
|
6
6
|
import json
|
|
7
7
|
import math
|
|
8
|
-
from typing import Any,
|
|
8
|
+
from typing import Any, Optional, Sequence, Union
|
|
9
9
|
|
|
10
10
|
from ee import _arg_types
|
|
11
11
|
from ee import _utils
|
|
@@ -17,7 +17,7 @@ from ee import ee_number
|
|
|
17
17
|
from ee import ee_string
|
|
18
18
|
from ee import ee_types
|
|
19
19
|
from ee import featurecollection
|
|
20
|
-
from ee import projection
|
|
20
|
+
from ee import projection as ee_projection
|
|
21
21
|
from ee import serializer
|
|
22
22
|
|
|
23
23
|
|
|
@@ -36,7 +36,7 @@ class Geometry(computedobject.ComputedObject):
|
|
|
36
36
|
@_utils.accept_opt_prefix('opt_proj', 'opt_geodesic', 'opt_evenOdd')
|
|
37
37
|
def __init__(
|
|
38
38
|
self,
|
|
39
|
-
geo_json: Union[
|
|
39
|
+
geo_json: Union[dict[str, Any], computedobject.ComputedObject, Geometry],
|
|
40
40
|
proj: Optional[Any] = None,
|
|
41
41
|
geodesic: Optional[bool] = None,
|
|
42
42
|
evenOdd: Optional[bool] = None, # pylint: disable=g-bad-name
|
|
@@ -147,7 +147,7 @@ class Geometry(computedobject.ComputedObject):
|
|
|
147
147
|
self._computed_equivalent = apifunction.ApiFunction.lookup(
|
|
148
148
|
'GeometryConstructors.' + ctor_name).apply(ctor_args)
|
|
149
149
|
|
|
150
|
-
def _get_name_from_crs(self, crs:
|
|
150
|
+
def _get_name_from_crs(self, crs: dict[str, Any]) -> str:
|
|
151
151
|
"""Returns projection name from a CRS."""
|
|
152
152
|
if isinstance(crs, dict) and crs.get('type') == 'name':
|
|
153
153
|
properties = crs.get('properties')
|
|
@@ -600,7 +600,7 @@ class Geometry(computedobject.ComputedObject):
|
|
|
600
600
|
return Geometry(Geometry._parseArgs('MultiPolygon', 4, all_args))
|
|
601
601
|
|
|
602
602
|
@_utils.accept_opt_prefix('opt_encoder')
|
|
603
|
-
def encode(self, encoder: Optional[Any] = None) ->
|
|
603
|
+
def encode(self, encoder: Optional[Any] = None) -> dict[str, Any]:
|
|
604
604
|
"""Returns a GeoJSON-compatible representation of the geometry."""
|
|
605
605
|
if not getattr(self, '_type', None):
|
|
606
606
|
return super().encode(encoder)
|
|
@@ -629,7 +629,7 @@ class Geometry(computedobject.ComputedObject):
|
|
|
629
629
|
|
|
630
630
|
return self._computed_equivalent.encode_cloud_value(encoder)
|
|
631
631
|
|
|
632
|
-
def toGeoJSON(self) ->
|
|
632
|
+
def toGeoJSON(self) -> dict[str, Any]:
|
|
633
633
|
"""Returns a GeoJSON representation of the geometry."""
|
|
634
634
|
if self.func:
|
|
635
635
|
raise ee_exception.EEException(
|
|
@@ -659,7 +659,7 @@ class Geometry(computedobject.ComputedObject):
|
|
|
659
659
|
return self.__str__()
|
|
660
660
|
|
|
661
661
|
@staticmethod
|
|
662
|
-
def _isValidGeometry(geometry:
|
|
662
|
+
def _isValidGeometry(geometry: dict[str, Any]) -> bool:
|
|
663
663
|
"""Check if a geometry looks valid.
|
|
664
664
|
|
|
665
665
|
Args:
|
|
@@ -752,7 +752,7 @@ class Geometry(computedobject.ComputedObject):
|
|
|
752
752
|
return line
|
|
753
753
|
|
|
754
754
|
@staticmethod
|
|
755
|
-
def _parseArgs(ctor_name: str, depth: int, args: Any) ->
|
|
755
|
+
def _parseArgs(ctor_name: str, depth: int, args: Any) -> dict[str, Any]:
|
|
756
756
|
"""Parses arguments into a GeoJSON dictionary or a ComputedObject.
|
|
757
757
|
|
|
758
758
|
Args:
|
|
@@ -870,7 +870,7 @@ class Geometry(computedobject.ComputedObject):
|
|
|
870
870
|
return coords
|
|
871
871
|
|
|
872
872
|
@staticmethod
|
|
873
|
-
def _GetArgs(args, keywords:
|
|
873
|
+
def _GetArgs(args, keywords: tuple[str, ...] = (), **kwargs) -> list[Any]:
|
|
874
874
|
"""Returns all args, specified or not, checking for keywords."""
|
|
875
875
|
args = list(args)
|
|
876
876
|
if keywords:
|
|
@@ -1417,7 +1417,7 @@ class Geometry(computedobject.ComputedObject):
|
|
|
1417
1417
|
self.name() + '.perimeter', self, maxError, proj
|
|
1418
1418
|
)
|
|
1419
1419
|
|
|
1420
|
-
def projection(self) ->
|
|
1420
|
+
def projection(self) -> ee_projection.Projection:
|
|
1421
1421
|
"""Returns the projection of the geometry."""
|
|
1422
1422
|
|
|
1423
1423
|
return apifunction.ApiFunction.call_(self.name() + '.projection', self)
|
ee/image.py
CHANGED
|
@@ -7,7 +7,7 @@ details.
|
|
|
7
7
|
from __future__ import annotations
|
|
8
8
|
|
|
9
9
|
import json
|
|
10
|
-
from typing import Any,
|
|
10
|
+
from typing import Any, Optional, Sequence
|
|
11
11
|
|
|
12
12
|
from ee import _arg_types
|
|
13
13
|
from ee import _utils
|
|
@@ -142,7 +142,7 @@ class Image(element.Element):
|
|
|
142
142
|
"""
|
|
143
143
|
return super().getInfo()
|
|
144
144
|
|
|
145
|
-
def getMapId(self, vis_params: Optional[Any] = None) ->
|
|
145
|
+
def getMapId(self, vis_params: Optional[Any] = None) -> dict[str, Any]:
|
|
146
146
|
"""Fetch and return a map ID dictionary, suitable for use in a Map overlay.
|
|
147
147
|
|
|
148
148
|
Args:
|
|
@@ -158,8 +158,8 @@ class Image(element.Element):
|
|
|
158
158
|
return response
|
|
159
159
|
|
|
160
160
|
def _apply_crs_and_affine(
|
|
161
|
-
self, params:
|
|
162
|
-
) ->
|
|
161
|
+
self, params: dict[str, Any]
|
|
162
|
+
) -> tuple[Any, Any, Any]:
|
|
163
163
|
"""Applies any CRS and affine parameters to an image.
|
|
164
164
|
|
|
165
165
|
Wraps the image in a call to Reproject() if the request includes
|
|
@@ -246,8 +246,8 @@ class Image(element.Element):
|
|
|
246
246
|
return image, request, dimensions_consumed
|
|
247
247
|
|
|
248
248
|
def _apply_selection_and_scale(
|
|
249
|
-
self, params:
|
|
250
|
-
) ->
|
|
249
|
+
self, params: dict[str, Any], dimensions_consumed: bool
|
|
250
|
+
) -> tuple[Any, dict[str, Any]]:
|
|
251
251
|
"""Applies region selection and scaling parameters to an image.
|
|
252
252
|
|
|
253
253
|
Wraps the image in a call to clipToBoundsAndScale() if there are any
|
|
@@ -266,8 +266,8 @@ class Image(element.Element):
|
|
|
266
266
|
"""
|
|
267
267
|
keys_to_extract = set(['region', 'dimensions', 'scale'])
|
|
268
268
|
scale_keys = ['maxDimension', 'height', 'width', 'scale']
|
|
269
|
-
request:
|
|
270
|
-
selection_params:
|
|
269
|
+
request: dict[str, Any] = {}
|
|
270
|
+
selection_params: dict[str, Any] = {}
|
|
271
271
|
if params:
|
|
272
272
|
for key in params:
|
|
273
273
|
if key not in keys_to_extract:
|
|
@@ -322,8 +322,8 @@ class Image(element.Element):
|
|
|
322
322
|
return image, request
|
|
323
323
|
|
|
324
324
|
def _apply_spatial_transformations(
|
|
325
|
-
self, params:
|
|
326
|
-
) ->
|
|
325
|
+
self, params: dict[str, Any]
|
|
326
|
+
) -> tuple[Any, dict[str, Any]]:
|
|
327
327
|
"""Applies spatial transformation and clipping.
|
|
328
328
|
|
|
329
329
|
Args:
|
|
@@ -340,8 +340,8 @@ class Image(element.Element):
|
|
|
340
340
|
return image._apply_selection_and_scale(params, dimensions_consumed)
|
|
341
341
|
|
|
342
342
|
def _apply_visualization(
|
|
343
|
-
self, params:
|
|
344
|
-
) ->
|
|
343
|
+
self, params: dict[str, Any]
|
|
344
|
+
) -> tuple[Any, dict[str, Any]]:
|
|
345
345
|
"""Applies visualization parameters to an image.
|
|
346
346
|
|
|
347
347
|
Wraps the image in a call to visualize() if there are any recognized
|
|
@@ -373,7 +373,7 @@ class Image(element.Element):
|
|
|
373
373
|
image = apifunction.ApiFunction.apply_('Image.visualize', vis_params)
|
|
374
374
|
return image, request
|
|
375
375
|
|
|
376
|
-
def _build_download_id_image(self, params:
|
|
376
|
+
def _build_download_id_image(self, params: dict[str, Any]) -> Any:
|
|
377
377
|
"""Processes the getDownloadId parameters and returns the built image.
|
|
378
378
|
|
|
379
379
|
Given transformation parameters (crs, crs_transform, dimensions, scale, and
|
|
@@ -395,7 +395,7 @@ class Image(element.Element):
|
|
|
395
395
|
"""
|
|
396
396
|
params = params.copy()
|
|
397
397
|
|
|
398
|
-
def _extract_and_validate_transforms(obj:
|
|
398
|
+
def _extract_and_validate_transforms(obj: dict[str, Any]) -> dict[str, Any]:
|
|
399
399
|
"""Takes a parameter dictionary and extracts the transformation keys."""
|
|
400
400
|
extracted = {}
|
|
401
401
|
for key in ['crs', 'crs_transform', 'dimensions', 'region']:
|
|
@@ -407,7 +407,7 @@ class Image(element.Element):
|
|
|
407
407
|
extracted['scale'] = obj['scale']
|
|
408
408
|
return extracted
|
|
409
409
|
|
|
410
|
-
def _build_image_per_band(band_params:
|
|
410
|
+
def _build_image_per_band(band_params: dict[str, Any]) -> Any:
|
|
411
411
|
"""Takes a band dictionary and builds an image for it."""
|
|
412
412
|
if 'id' not in band_params:
|
|
413
413
|
raise ee_exception.EEException('Each band dictionary must have an id.')
|
|
@@ -435,7 +435,7 @@ class Image(element.Element):
|
|
|
435
435
|
del copy_params # Unused.
|
|
436
436
|
return image
|
|
437
437
|
|
|
438
|
-
def prepare_for_export(self, params:
|
|
438
|
+
def prepare_for_export(self, params: dict[str, Any]) -> Any:
|
|
439
439
|
"""Applies all relevant export parameters to an image.
|
|
440
440
|
|
|
441
441
|
Args:
|
|
@@ -449,7 +449,7 @@ class Image(element.Element):
|
|
|
449
449
|
"""
|
|
450
450
|
return self._apply_spatial_transformations(params)
|
|
451
451
|
|
|
452
|
-
def getDownloadURL(self, params: Optional[
|
|
452
|
+
def getDownloadURL(self, params: Optional[dict[str, Any]] = None) -> str:
|
|
453
453
|
"""Get a download URL for an image chunk.
|
|
454
454
|
|
|
455
455
|
Generates a download URL for small chunks of image data in GeoTIFF or NumPy
|
|
@@ -509,7 +509,7 @@ class Image(element.Element):
|
|
|
509
509
|
request['image'] = self
|
|
510
510
|
return data.makeDownloadUrl(data.getDownloadId(request))
|
|
511
511
|
|
|
512
|
-
def getThumbId(self, params:
|
|
512
|
+
def getThumbId(self, params: dict[str, Any]) -> dict[str, str]:
|
|
513
513
|
"""Applies transformations and returns the thumbId.
|
|
514
514
|
|
|
515
515
|
Args:
|
|
@@ -534,7 +534,7 @@ class Image(element.Element):
|
|
|
534
534
|
params['image'] = image
|
|
535
535
|
return data.getThumbId(params)
|
|
536
536
|
|
|
537
|
-
def getThumbURL(self, params: Optional[
|
|
537
|
+
def getThumbURL(self, params: Optional[dict[str, Any]] = None) -> str:
|
|
538
538
|
"""Get a thumbnail URL for this image.
|
|
539
539
|
|
|
540
540
|
Args:
|
ee/image_converter.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""Converters used in the image data fetching methods."""
|
|
2
2
|
|
|
3
3
|
import io
|
|
4
|
-
from typing import Any,
|
|
4
|
+
from typing import Any, Optional, Type, Union
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
class ImageConverter:
|
|
@@ -43,7 +43,7 @@ class NumPyConverter(ImageConverter):
|
|
|
43
43
|
return numpy.load(io.BytesIO(data))
|
|
44
44
|
|
|
45
45
|
|
|
46
|
-
_PIXEL_DATA_CONVERTERS:
|
|
46
|
+
_PIXEL_DATA_CONVERTERS: dict[str, Type[ImageConverter]] = {
|
|
47
47
|
'NUMPY_NDARRAY': NumPyConverter
|
|
48
48
|
}
|
|
49
49
|
|
ee/imagecollection.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import Any, Callable,
|
|
5
|
+
from typing import Any, Callable, Optional, Sequence
|
|
6
6
|
|
|
7
7
|
from ee import _arg_types
|
|
8
8
|
from ee import _utils
|
|
@@ -87,7 +87,7 @@ class ImageCollection(collection.Collection):
|
|
|
87
87
|
apifunction.ApiFunction.clearApi(cls)
|
|
88
88
|
cls._initialized = False
|
|
89
89
|
|
|
90
|
-
def getMapId(self, vis_params: Optional[Any] = None) ->
|
|
90
|
+
def getMapId(self, vis_params: Optional[Any] = None) -> dict[str, Any]:
|
|
91
91
|
"""Fetch and return a Map ID.
|
|
92
92
|
|
|
93
93
|
This mosaics the collection to a single image and return a map ID suitable
|
|
@@ -188,7 +188,7 @@ class ImageCollection(collection.Collection):
|
|
|
188
188
|
def elementType():
|
|
189
189
|
return image.Image
|
|
190
190
|
|
|
191
|
-
def getVideoThumbURL(self, params: Optional[
|
|
191
|
+
def getVideoThumbURL(self, params: Optional[dict[str, Any]] = None) -> str:
|
|
192
192
|
"""Get the URL for an animated video thumbnail of the given collection.
|
|
193
193
|
|
|
194
194
|
Note: Videos can only be created when the image visualization
|
|
@@ -252,7 +252,7 @@ class ImageCollection(collection.Collection):
|
|
|
252
252
|
def _getThumbURL(
|
|
253
253
|
self,
|
|
254
254
|
valid_formats: Sequence[str],
|
|
255
|
-
# TODO(user): Need to drop the default None and use
|
|
255
|
+
# TODO(user): Need to drop the default None and use dict[str, Any]]
|
|
256
256
|
params: Optional[Any] = None,
|
|
257
257
|
thumbType: Optional[str] = None, # pylint: disable=g-bad-name
|
|
258
258
|
) -> str:
|
|
@@ -314,7 +314,7 @@ class ImageCollection(collection.Collection):
|
|
|
314
314
|
def _apply_preparation_function(
|
|
315
315
|
self,
|
|
316
316
|
preparation_function: Callable[[Any, Any], Any],
|
|
317
|
-
params:
|
|
317
|
+
params: dict[str, Any],
|
|
318
318
|
) -> Any:
|
|
319
319
|
"""Applies a preparation function to an ImageCollection.
|
|
320
320
|
|
|
@@ -350,8 +350,8 @@ class ImageCollection(collection.Collection):
|
|
|
350
350
|
return self.map(apply_params), remaining_params
|
|
351
351
|
|
|
352
352
|
def prepare_for_export(
|
|
353
|
-
self, params:
|
|
354
|
-
) ->
|
|
353
|
+
self, params: dict[str, Any]
|
|
354
|
+
) -> tuple[ImageCollection, dict[str, Any]]:
|
|
355
355
|
"""Applies all relevant export parameters to an ImageCollection.
|
|
356
356
|
|
|
357
357
|
Args:
|
ee/oauth.py
CHANGED
|
@@ -17,7 +17,7 @@ import os
|
|
|
17
17
|
import shutil
|
|
18
18
|
import subprocess
|
|
19
19
|
import sys
|
|
20
|
-
from typing import Any,
|
|
20
|
+
from typing import Any, Optional, Sequence, Union
|
|
21
21
|
import urllib.error
|
|
22
22
|
import urllib.parse
|
|
23
23
|
import urllib.request
|
|
@@ -87,7 +87,7 @@ def get_credentials_path() -> str:
|
|
|
87
87
|
return cred_path
|
|
88
88
|
|
|
89
89
|
|
|
90
|
-
def get_credentials_arguments() ->
|
|
90
|
+
def get_credentials_arguments() -> dict[str, Any]:
|
|
91
91
|
with open(get_credentials_path()) as creds:
|
|
92
92
|
stored = json.load(creds)
|
|
93
93
|
args = {}
|
|
@@ -191,7 +191,7 @@ def request_token(
|
|
|
191
191
|
return json.loads(response)['refresh_token']
|
|
192
192
|
|
|
193
193
|
|
|
194
|
-
def write_private_json(json_path: str, info_dict:
|
|
194
|
+
def write_private_json(json_path: str, info_dict: dict[str, Any]) -> None:
|
|
195
195
|
"""Attempts to write the passed token to the given user directory."""
|
|
196
196
|
|
|
197
197
|
dirname = os.path.dirname(json_path)
|
|
@@ -339,7 +339,7 @@ def _base64param(byte_string: bytes) -> bytes:
|
|
|
339
339
|
return base64.urlsafe_b64encode(byte_string).rstrip(b'=')
|
|
340
340
|
|
|
341
341
|
|
|
342
|
-
def _nonce_table(*nonce_keys: str) ->
|
|
342
|
+
def _nonce_table(*nonce_keys: str) -> dict[str, str]:
|
|
343
343
|
"""Makes random nonces, and adds PKCE challenges for each _verifier nonce."""
|
|
344
344
|
table = {}
|
|
345
345
|
for key in nonce_keys:
|
ee/pixeltype.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""A wrapper for PixelTypes."""
|
|
2
2
|
from __future__ import annotations
|
|
3
3
|
|
|
4
|
-
from typing import Any,
|
|
4
|
+
from typing import Any, Optional, Union
|
|
5
5
|
|
|
6
6
|
from ee import _arg_types
|
|
7
7
|
from ee import apifunction
|
|
@@ -72,7 +72,7 @@ class PixelType(computedobject.ComputedObject):
|
|
|
72
72
|
"""
|
|
73
73
|
self.initialize()
|
|
74
74
|
|
|
75
|
-
args:
|
|
75
|
+
args: dict[str, Any] = {'precision': precision}
|
|
76
76
|
if minValue is not None:
|
|
77
77
|
args['minValue'] = minValue
|
|
78
78
|
if maxValue is not None:
|
ee/projection.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""A wrapper for Projections."""
|
|
2
2
|
from __future__ import annotations
|
|
3
3
|
|
|
4
|
-
from typing import Any,
|
|
4
|
+
from typing import Any, Optional, Sequence, Union
|
|
5
5
|
|
|
6
6
|
from ee import _arg_types
|
|
7
7
|
from ee import apifunction
|
|
@@ -80,7 +80,7 @@ class Projection(computedobject.ComputedObject):
|
|
|
80
80
|
super().__init__(crs.func, crs.args, crs.varName)
|
|
81
81
|
return
|
|
82
82
|
|
|
83
|
-
args:
|
|
83
|
+
args: dict[str, Any] = {'crs': crs}
|
|
84
84
|
if transform is not None:
|
|
85
85
|
args['transform'] = transform
|
|
86
86
|
if transformWkt is not None:
|
ee/serializer.py
CHANGED
|
@@ -4,7 +4,7 @@ import collections
|
|
|
4
4
|
import datetime
|
|
5
5
|
import hashlib
|
|
6
6
|
import json
|
|
7
|
-
from typing import Any,
|
|
7
|
+
from typing import Any, Optional
|
|
8
8
|
|
|
9
9
|
from ee import _cloud_api_utils
|
|
10
10
|
from ee import _utils
|
|
@@ -38,11 +38,11 @@ class Serializer:
|
|
|
38
38
|
_is_compound: bool
|
|
39
39
|
_for_cloud_api: bool
|
|
40
40
|
# A list of shared subtrees as [name, value] pairs.
|
|
41
|
-
_scope:
|
|
41
|
+
_scope: list[str]
|
|
42
42
|
# A lookup table from object hash to subtree names as stored in self._scope
|
|
43
|
-
_encoded:
|
|
43
|
+
_encoded: dict[Any, Any]
|
|
44
44
|
# A lookup table from object ID as retrieved by id() to md5 hash values.
|
|
45
|
-
_hashcache:
|
|
45
|
+
_hashcache: dict[Any, Any]
|
|
46
46
|
|
|
47
47
|
def __init__(
|
|
48
48
|
self,
|
|
@@ -380,7 +380,7 @@ class _ExpressionOptimizer:
|
|
|
380
380
|
def _is_compound(self) -> bool:
|
|
381
381
|
return self._values is not None
|
|
382
382
|
|
|
383
|
-
def _find_single_uses(self) ->
|
|
383
|
+
def _find_single_uses(self) -> set[Any]:
|
|
384
384
|
"""Finds the names of all named values that are referred to only once."""
|
|
385
385
|
reference_counts = collections.defaultdict(int)
|
|
386
386
|
reference_counts[self._result] += 1
|
ee/table_converter.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Converters used in the table data fetching methods."""
|
|
2
2
|
|
|
3
|
-
from typing import Any,
|
|
3
|
+
from typing import Any, Iterator, Optional, Type, Union
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
class TableConverter:
|
|
@@ -24,7 +24,7 @@ class PandasConverter(TableConverter):
|
|
|
24
24
|
|
|
25
25
|
def _convert_to_records(
|
|
26
26
|
self, features: Iterator[Any]
|
|
27
|
-
) -> Iterator[
|
|
27
|
+
) -> Iterator[dict[str, Any]]:
|
|
28
28
|
for feature in features:
|
|
29
29
|
yield {
|
|
30
30
|
'geo': feature.get('geometry'),
|
|
@@ -46,12 +46,12 @@ class GeoPandasConverter(TableConverter):
|
|
|
46
46
|
self._materialize_features(features)
|
|
47
47
|
)
|
|
48
48
|
|
|
49
|
-
def _materialize_features(self, features: Iterator[Any]) ->
|
|
49
|
+
def _materialize_features(self, features: Iterator[Any]) -> list[Any]:
|
|
50
50
|
"""Materializes the features, making several requests if necessary."""
|
|
51
51
|
return list(features)
|
|
52
52
|
|
|
53
53
|
|
|
54
|
-
_TABLE_DATA_CONVERTERS:
|
|
54
|
+
_TABLE_DATA_CONVERTERS: dict[str, Type[TableConverter]] = {
|
|
55
55
|
'PANDAS_DATAFRAME': PandasConverter,
|
|
56
56
|
'GEOPANDAS_GEODATAFRAME': GeoPandasConverter,
|
|
57
57
|
}
|
ee/tests/blob_test.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"""Test for the blob module."""
|
|
3
3
|
|
|
4
4
|
import json
|
|
5
|
-
from typing import Any
|
|
5
|
+
from typing import Any
|
|
6
6
|
|
|
7
7
|
import unittest
|
|
8
8
|
import ee
|
|
@@ -12,8 +12,8 @@ URL = 'gs://ee-docs-demos/something'
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
def make_expression_graph(
|
|
15
|
-
function_invocation_value:
|
|
16
|
-
) ->
|
|
15
|
+
function_invocation_value: dict[str, Any],
|
|
16
|
+
) -> dict[str, Any]:
|
|
17
17
|
return {
|
|
18
18
|
'result': '0',
|
|
19
19
|
'values': {'0': {'functionInvocationValue': function_invocation_value}},
|
ee/tests/classifier_test.py
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import json
|
|
5
5
|
import sys
|
|
6
|
-
from typing import Any
|
|
6
|
+
from typing import Any
|
|
7
7
|
import unittest
|
|
8
8
|
|
|
9
9
|
import unittest
|
|
@@ -33,8 +33,8 @@ _CLASSIFIER_LOAD_A = {
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
def make_expression_graph(
|
|
36
|
-
function_invocation_value:
|
|
37
|
-
) ->
|
|
36
|
+
function_invocation_value: dict[str, Any],
|
|
37
|
+
) -> dict[str, Any]:
|
|
38
38
|
return {
|
|
39
39
|
'result': '0',
|
|
40
40
|
'values': {'0': {'functionInvocationValue': function_invocation_value}},
|
ee/tests/clusterer_test.py
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import json
|
|
5
5
|
import sys
|
|
6
|
-
from typing import Any
|
|
6
|
+
from typing import Any
|
|
7
7
|
import unittest
|
|
8
8
|
|
|
9
9
|
import unittest
|
|
@@ -28,8 +28,8 @@ _WEKA_COBWEB_SERIALIZED = {
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
def make_expression_graph(
|
|
31
|
-
function_invocation_value:
|
|
32
|
-
) ->
|
|
31
|
+
function_invocation_value: dict[str, Any],
|
|
32
|
+
) -> dict[str, Any]:
|
|
33
33
|
return {
|
|
34
34
|
'result': '0',
|
|
35
35
|
'values': {'0': {'functionInvocationValue': function_invocation_value}},
|
ee/tests/confusionmatrix_test.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"""Tests for the ee.ConfusionMatrix module."""
|
|
3
3
|
|
|
4
4
|
import json
|
|
5
|
-
from typing import Any
|
|
5
|
+
from typing import Any
|
|
6
6
|
|
|
7
7
|
import unittest
|
|
8
8
|
import ee
|
|
@@ -26,8 +26,8 @@ MATRIX = {
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
def make_expression_graph(
|
|
29
|
-
function_invocation_value:
|
|
30
|
-
) ->
|
|
29
|
+
function_invocation_value: dict[str, Any],
|
|
30
|
+
) -> dict[str, Any]:
|
|
31
31
|
return {
|
|
32
32
|
'result': '0',
|
|
33
33
|
'values': {'0': {'functionInvocationValue': function_invocation_value}},
|
ee/tests/daterange_test.py
CHANGED
|
@@ -6,7 +6,7 @@ DateRange is currently 100% dynamically generated.
|
|
|
6
6
|
|
|
7
7
|
import datetime
|
|
8
8
|
import json
|
|
9
|
-
from typing import Any
|
|
9
|
+
from typing import Any
|
|
10
10
|
|
|
11
11
|
import unittest
|
|
12
12
|
import ee
|
|
@@ -22,15 +22,15 @@ DATERANGE = 'DateRange'
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
def make_expression_graph(
|
|
25
|
-
function_invocation_value:
|
|
26
|
-
) ->
|
|
25
|
+
function_invocation_value: dict[str, Any]
|
|
26
|
+
) -> dict[str, Any]:
|
|
27
27
|
return {
|
|
28
28
|
'result': '0',
|
|
29
29
|
'values': {'0': {'functionInvocationValue': function_invocation_value}},
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
def daterange_function_expr(value: int) ->
|
|
33
|
+
def daterange_function_expr(value: int) -> dict[str, Any]:
|
|
34
34
|
return {
|
|
35
35
|
'functionInvocationValue': {
|
|
36
36
|
'functionName': 'DateRange',
|
ee/tests/deprecation_test.py
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import contextlib
|
|
5
5
|
import datetime
|
|
6
|
-
from typing import Any
|
|
6
|
+
from typing import Any
|
|
7
7
|
from unittest import mock
|
|
8
8
|
import warnings
|
|
9
9
|
|
|
@@ -173,7 +173,7 @@ class DeprecationTest(apitestcase.ApiTestCase, parameterized.TestCase):
|
|
|
173
173
|
yield
|
|
174
174
|
|
|
175
175
|
# Overridden from apitestcase.ApiTestCase.
|
|
176
|
-
def _MockFetchDataCatalogStac(self) ->
|
|
176
|
+
def _MockFetchDataCatalogStac(self) -> dict[str, Any]:
|
|
177
177
|
return _STAC_JSON
|
|
178
178
|
|
|
179
179
|
def test_no_warnings_thrown(self):
|
ee/tests/dictionary_test.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
"""Test for the ee.dictionary module."""
|
|
3
3
|
import json
|
|
4
|
-
from typing import Any
|
|
4
|
+
from typing import Any
|
|
5
5
|
import unittest
|
|
6
6
|
|
|
7
7
|
import unittest
|
|
@@ -10,8 +10,8 @@ from ee import apitestcase
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
def make_expression_graph(
|
|
13
|
-
function_invocation_value:
|
|
14
|
-
) ->
|
|
13
|
+
function_invocation_value: dict[str, Any],
|
|
14
|
+
) -> dict[str, Any]:
|
|
15
15
|
return {
|
|
16
16
|
'result': '0',
|
|
17
17
|
'values': {'0': {'functionInvocationValue': function_invocation_value}},
|
ee/tests/ee_array_test.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"""Tests for the ee.Array module."""
|
|
3
3
|
|
|
4
4
|
import json
|
|
5
|
-
from typing import Any
|
|
5
|
+
from typing import Any
|
|
6
6
|
|
|
7
7
|
import unittest
|
|
8
8
|
import ee
|
|
@@ -24,8 +24,8 @@ ARRAY_TWO = {
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
def make_expression_graph(
|
|
27
|
-
function_invocation_value:
|
|
28
|
-
) ->
|
|
27
|
+
function_invocation_value: dict[str, Any],
|
|
28
|
+
) -> dict[str, Any]:
|
|
29
29
|
return {
|
|
30
30
|
'result': '0',
|
|
31
31
|
'values': {'0': {'functionInvocationValue': function_invocation_value}},
|
ee/tests/ee_date_test.py
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import datetime
|
|
5
5
|
import json
|
|
6
|
-
from typing import Any
|
|
6
|
+
from typing import Any
|
|
7
7
|
|
|
8
8
|
import unittest
|
|
9
9
|
import ee
|
|
@@ -16,15 +16,15 @@ UTC = 'UTC'
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
def make_expression_graph(
|
|
19
|
-
function_invocation_value:
|
|
20
|
-
) ->
|
|
19
|
+
function_invocation_value: dict[str, Any]
|
|
20
|
+
) -> dict[str, Any]:
|
|
21
21
|
return {
|
|
22
22
|
'result': '0',
|
|
23
23
|
'values': {'0': {'functionInvocationValue': function_invocation_value}},
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
def date_function_expr(value: int) ->
|
|
27
|
+
def date_function_expr(value: int) -> dict[str, Any]:
|
|
28
28
|
return {
|
|
29
29
|
'functionInvocationValue': {
|
|
30
30
|
'functionName': 'Date',
|