earthengine-api 1.5.24__py3-none-any.whl → 1.6.0__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.

Files changed (63) hide show
  1. {earthengine_api-1.5.24.dist-info → earthengine_api-1.6.0.dist-info}/METADATA +1 -1
  2. earthengine_api-1.6.0.dist-info/RECORD +107 -0
  3. ee/__init__.py +11 -10
  4. ee/_arg_types.py +2 -1
  5. ee/_cloud_api_utils.py +7 -6
  6. ee/_helpers.py +3 -2
  7. ee/apifunction.py +11 -9
  8. ee/apitestcase.py +2 -1
  9. ee/batch.py +46 -42
  10. ee/blob.py +2 -2
  11. ee/classifier.py +57 -59
  12. ee/cli/commands.py +9 -7
  13. ee/cli/utils.py +13 -9
  14. ee/clusterer.py +39 -41
  15. ee/collection.py +42 -42
  16. ee/computedobject.py +10 -10
  17. ee/confusionmatrix.py +8 -8
  18. ee/customfunction.py +2 -2
  19. ee/data.py +15 -14
  20. ee/daterange.py +9 -9
  21. ee/deprecation.py +13 -11
  22. ee/deserializer.py +5 -5
  23. ee/dictionary.py +11 -11
  24. ee/ee_array.py +17 -17
  25. ee/ee_date.py +22 -22
  26. ee/ee_list.py +15 -15
  27. ee/ee_number.py +5 -5
  28. ee/ee_string.py +6 -6
  29. ee/ee_types.py +2 -2
  30. ee/element.py +14 -14
  31. ee/errormargin.py +3 -3
  32. ee/feature.py +67 -70
  33. ee/featurecollection.py +30 -32
  34. ee/filter.py +88 -90
  35. ee/function.py +3 -3
  36. ee/geometry.py +61 -62
  37. ee/image.py +216 -209
  38. ee/image_converter.py +2 -2
  39. ee/imagecollection.py +23 -20
  40. ee/join.py +13 -15
  41. ee/kernel.py +55 -57
  42. ee/oauth.py +26 -20
  43. ee/pixeltype.py +5 -5
  44. ee/projection.py +4 -3
  45. ee/reducer.py +39 -41
  46. ee/serializer.py +4 -4
  47. ee/table_converter.py +3 -2
  48. ee/terrain.py +6 -8
  49. ee/tests/_cloud_api_utils_test.py +1 -1
  50. ee/tests/_helpers_test.py +1 -1
  51. ee/tests/batch_test.py +1 -1
  52. ee/tests/data_test.py +2 -2
  53. ee/tests/ee_test.py +3 -3
  54. ee/tests/errormargin_test.py +1 -1
  55. ee/tests/image_converter_test.py +2 -2
  56. ee/tests/pixeltype_test.py +1 -2
  57. ee/tests/projection_test.py +2 -3
  58. ee/tests/table_converter_test.py +2 -2
  59. earthengine_api-1.5.24.dist-info/RECORD +0 -107
  60. {earthengine_api-1.5.24.dist-info → earthengine_api-1.6.0.dist-info}/WHEEL +0 -0
  61. {earthengine_api-1.5.24.dist-info → earthengine_api-1.6.0.dist-info}/entry_points.txt +0 -0
  62. {earthengine_api-1.5.24.dist-info → earthengine_api-1.6.0.dist-info}/licenses/LICENSE +0 -0
  63. {earthengine_api-1.5.24.dist-info → earthengine_api-1.6.0.dist-info}/top_level.txt +0 -0
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, Optional, Type, Union
4
+ from typing import Any, Optional, 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: dict[str, Type[ImageConverter]] = {
46
+ _PIXEL_DATA_CONVERTERS: dict[str, type[ImageConverter]] = {
47
47
  'NUMPY_NDARRAY': NumPyConverter
48
48
  }
49
49
 
ee/imagecollection.py CHANGED
@@ -2,7 +2,8 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Any, Callable, Optional, Sequence
5
+ from collections.abc import Sequence
6
+ from typing import Any, Callable
6
7
 
7
8
  from ee import _arg_types
8
9
  from ee import _utils
@@ -87,7 +88,7 @@ class ImageCollection(collection.Collection):
87
88
  apifunction.ApiFunction.clearApi(cls)
88
89
  cls._initialized = False
89
90
 
90
- def getMapId(self, vis_params: Optional[Any] = None) -> dict[str, Any]:
91
+ def getMapId(self, vis_params: Any | None = None) -> dict[str, Any]:
91
92
  """Fetch and return a Map ID.
92
93
 
93
94
  This mosaics the collection to a single image and return a map ID suitable
@@ -105,7 +106,7 @@ class ImageCollection(collection.Collection):
105
106
  @_utils.accept_opt_prefix('opt_names')
106
107
  # pylint: disable-next=keyword-arg-before-vararg
107
108
  def select(
108
- self, selectors: Any, names: Optional[Any] = None, *args
109
+ self, selectors: Any, names: Any | None = None, *args
109
110
  ) -> ImageCollection:
110
111
  """Select bands from each image in a collection.
111
112
 
@@ -125,10 +126,10 @@ class ImageCollection(collection.Collection):
125
126
  # pylint: disable=unused-argument,g-bad-name
126
127
  def linkCollection(
127
128
  self,
128
- imageCollection: 'ImageCollection',
129
- linkedBands: Optional[Sequence[str]] = None,
130
- linkedProperties: Optional[Sequence[str]] = None,
131
- matchPropertyName: Optional[str] = None,
129
+ imageCollection: ImageCollection,
130
+ linkedBands: Sequence[str] | None = None,
131
+ linkedProperties: Sequence[str] | None = None,
132
+ matchPropertyName: str | None = None,
132
133
  ) -> ImageCollection:
133
134
  """Links images in this collection to matching images from imageCollection.
134
135
 
@@ -170,6 +171,7 @@ class ImageCollection(collection.Collection):
170
171
  'Image.linkCollection', {'input': img, **kwargs})
171
172
 
172
173
  return self.map(_linkCollection)
174
+
173
175
  # pylint: enable=g-bad-name,unused-argument
174
176
 
175
177
  def first(self) -> image.Image:
@@ -188,7 +190,7 @@ class ImageCollection(collection.Collection):
188
190
  def elementType():
189
191
  return image.Image
190
192
 
191
- def getVideoThumbURL(self, params: Optional[dict[str, Any]] = None) -> str:
193
+ def getVideoThumbURL(self, params: dict[str, Any] | None = None) -> str:
192
194
  """Get the URL for an animated video thumbnail of the given collection.
193
195
 
194
196
  Note: Videos can only be created when the image visualization
@@ -221,7 +223,7 @@ class ImageCollection(collection.Collection):
221
223
  """
222
224
  return self._getThumbURL(['gif'], params, thumbType='video')
223
225
 
224
- def getFilmstripThumbURL(self, params: Optional[Any] = None) -> str:
226
+ def getFilmstripThumbURL(self, params: Any | None = None) -> str:
225
227
  """Get the URL for a "filmstrip" thumbnail of the given collection.
226
228
 
227
229
  Args:
@@ -253,8 +255,8 @@ class ImageCollection(collection.Collection):
253
255
  self,
254
256
  valid_formats: Sequence[str],
255
257
  # TODO(user): Need to drop the default None and use dict[str, Any]]
256
- params: Optional[Any] = None,
257
- thumbType: Optional[str] = None, # pylint: disable=g-bad-name
258
+ params: Any | None = None,
259
+ thumbType: str | None = None, # pylint: disable=g-bad-name
258
260
  ) -> str:
259
261
  """Get the URL for a thumbnail of this collection.
260
262
 
@@ -397,7 +399,7 @@ class ImageCollection(collection.Collection):
397
399
  def combine(
398
400
  self,
399
401
  secondary: _arg_types.ImageCollection,
400
- overwrite: Optional[_arg_types.Bool] = None,
402
+ overwrite: _arg_types.Bool | None = None,
401
403
  ) -> ImageCollection:
402
404
  """Returns a collection adding all the bands from the image in secondary.
403
405
 
@@ -421,9 +423,9 @@ class ImageCollection(collection.Collection):
421
423
 
422
424
  def formaTrend(
423
425
  self,
424
- covariates: Optional[_arg_types.ImageCollection] = None,
426
+ covariates: _arg_types.ImageCollection | None = None,
425
427
  # pylint: disable-next=invalid-name
426
- windowSize: Optional[_arg_types.Integer] = None,
428
+ windowSize: _arg_types.Integer | None = None,
427
429
  ) -> image.Image:
428
430
  """Returns an image with the forma trend of the collection.
429
431
 
@@ -457,10 +459,10 @@ class ImageCollection(collection.Collection):
457
459
  def getRegion(
458
460
  self,
459
461
  geometry: _arg_types.Geometry,
460
- scale: Optional[_arg_types.Number] = None,
461
- crs: Optional[_arg_types.Projection] = None,
462
+ scale: _arg_types.Number | None = None,
463
+ crs: _arg_types.Projection | None = None,
462
464
  # pylint: disable-next=invalid-name
463
- crsTransform: Optional[_arg_types.List] = None,
465
+ crsTransform: _arg_types.List | None = None,
464
466
  ) -> ee_list.List:
465
467
  """Returns a list of values for each [pixel, band, image] tuple.
466
468
 
@@ -488,7 +490,8 @@ class ImageCollection(collection.Collection):
488
490
  @staticmethod
489
491
  def load(
490
492
  # pylint: disable-next=redefined-builtin
491
- id: _arg_types.String, version: Optional[_arg_types.Integer] = None
493
+ id: _arg_types.String,
494
+ version: _arg_types.Integer | None = None,
492
495
  ) -> ImageCollection:
493
496
  """Returns the image collection given its ID.
494
497
 
@@ -537,7 +540,7 @@ class ImageCollection(collection.Collection):
537
540
  self,
538
541
  reducer: _arg_types.Reducer,
539
542
  # pylint: disable-next=invalid-name
540
- parallelScale: Optional[_arg_types.Number] = None,
543
+ parallelScale: _arg_types.Number | None = None,
541
544
  ) -> image.Image:
542
545
  """Returns a reduced image from the collection.
543
546
 
@@ -576,7 +579,7 @@ class ImageCollection(collection.Collection):
576
579
  return apifunction.ApiFunction.call_(self.name() + '.toArray', self)
577
580
 
578
581
  def toArrayPerBand(
579
- self, axis: Optional[_arg_types.Integer] = None
582
+ self, axis: _arg_types.Integer | None = None
580
583
  ) -> image.Image:
581
584
  """Returns an image of an image collection converted into 2D arrays.
582
585
 
ee/join.py CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Optional
6
-
7
5
  from ee import _arg_types
8
6
  from ee import apifunction
9
7
  from ee import computedobject
@@ -91,9 +89,9 @@ class Join(computedobject.ComputedObject):
91
89
  @staticmethod
92
90
  def inner(
93
91
  # pylint: disable=invalid-name
94
- primaryKey: Optional[_arg_types.String] = None,
95
- secondaryKey: Optional[_arg_types.String] = None,
96
- measureKey: Optional[_arg_types.String] = None,
92
+ primaryKey: _arg_types.String | None = None,
93
+ secondaryKey: _arg_types.String | None = None,
94
+ measureKey: _arg_types.String | None = None,
97
95
  # pylint: enable=invalid-name
98
96
  ) -> Join:
99
97
  """Returns a join with matching pairs of elements.
@@ -131,12 +129,12 @@ class Join(computedobject.ComputedObject):
131
129
  @staticmethod
132
130
  def saveAll(
133
131
  # pylint: disable-next=invalid-name
134
- matchesKey: Optional[_arg_types.String] = None,
135
- ordering: Optional[_arg_types.String] = None,
136
- ascending: Optional[_arg_types.Bool] = None,
132
+ matchesKey: _arg_types.String | None = None,
133
+ ordering: _arg_types.String | None = None,
134
+ ascending: _arg_types.Bool | None = None,
137
135
  # pylint: disable-next=invalid-name
138
- measureKey: Optional[_arg_types.String] = None,
139
- outer: Optional[_arg_types.Bool] = None,
136
+ measureKey: _arg_types.String | None = None,
137
+ outer: _arg_types.Bool | None = None,
140
138
  ) -> Join:
141
139
  """Returns a join that returns all pairs of elements.
142
140
 
@@ -166,7 +164,7 @@ class Join(computedobject.ComputedObject):
166
164
  def saveBest(
167
165
  matchKey: _arg_types.String, # pylint: disable=invalid-name
168
166
  measureKey: _arg_types.String, # pylint: disable=invalid-name
169
- outer: Optional[_arg_types.Bool] = None,
167
+ outer: _arg_types.Bool | None = None,
170
168
  ) -> Join:
171
169
  """Returns a join that returns the best match pairs.
172
170
 
@@ -191,11 +189,11 @@ class Join(computedobject.ComputedObject):
191
189
  @staticmethod
192
190
  def saveFirst(
193
191
  matchKey: _arg_types.String, # pylint: disable=invalid-name
194
- ordering: Optional[_arg_types.String] = None,
195
- ascending: Optional[_arg_types.Bool] = None,
192
+ ordering: _arg_types.String | None = None,
193
+ ascending: _arg_types.Bool | None = None,
196
194
  # pylint: disable-next=invalid-name
197
- measureKey: Optional[_arg_types.String] = None,
198
- outer: Optional[_arg_types.Bool] = None,
195
+ measureKey: _arg_types.String | None = None,
196
+ outer: _arg_types.Bool | None = None,
199
197
  ) -> Join:
200
198
  """Returns a join that returns the first match pairs.
201
199
 
ee/kernel.py CHANGED
@@ -1,8 +1,6 @@
1
1
  """A wrapper for Kernels."""
2
2
  from __future__ import annotations
3
3
 
4
- from typing import Optional
5
-
6
4
  from ee import _arg_types
7
5
  from ee import apifunction
8
6
  from ee import computedobject
@@ -58,7 +56,7 @@ class Kernel(computedobject.ComputedObject):
58
56
  def add(
59
57
  self,
60
58
  kernel2: _arg_types.Kernel,
61
- normalize: Optional[_arg_types.Bool] = None,
59
+ normalize: _arg_types.Bool | None = None,
62
60
  ) -> Kernel:
63
61
  """Returns the addition of two kernels.
64
62
 
@@ -79,9 +77,9 @@ class Kernel(computedobject.ComputedObject):
79
77
  @staticmethod
80
78
  def chebyshev(
81
79
  radius: _arg_types.Number,
82
- units: Optional[_arg_types.String] = None,
83
- normalize: Optional[_arg_types.Bool] = None,
84
- magnitude: Optional[_arg_types.Number] = None,
80
+ units: _arg_types.String | None = None,
81
+ normalize: _arg_types.Bool | None = None,
82
+ magnitude: _arg_types.Number | None = None,
85
83
  ) -> Kernel:
86
84
  """Returns a Chebyshev kernel.
87
85
 
@@ -104,9 +102,9 @@ class Kernel(computedobject.ComputedObject):
104
102
  @staticmethod
105
103
  def circle(
106
104
  radius: _arg_types.Number,
107
- units: Optional[_arg_types.String] = None,
108
- normalize: Optional[_arg_types.Bool] = None,
109
- magnitude: Optional[_arg_types.Number] = None,
105
+ units: _arg_types.String | None = None,
106
+ normalize: _arg_types.Bool | None = None,
107
+ magnitude: _arg_types.Number | None = None,
110
108
  ) -> Kernel:
111
109
  """Returns a circle-shaped boolean kernel.
112
110
 
@@ -125,8 +123,8 @@ class Kernel(computedobject.ComputedObject):
125
123
 
126
124
  @staticmethod
127
125
  def compass(
128
- magnitude: Optional[_arg_types.Number] = None,
129
- normalize: Optional[_arg_types.Bool] = None,
126
+ magnitude: _arg_types.Number | None = None,
127
+ normalize: _arg_types.Bool | None = None,
130
128
  ) -> Kernel:
131
129
  """Returns a 3x3 Prewitt's Compass edge-detection kernel.
132
130
 
@@ -140,9 +138,9 @@ class Kernel(computedobject.ComputedObject):
140
138
  @staticmethod
141
139
  def cross(
142
140
  radius: _arg_types.Number,
143
- units: Optional[_arg_types.String] = None,
144
- normalize: Optional[_arg_types.Bool] = None,
145
- magnitude: Optional[_arg_types.Number] = None,
141
+ units: _arg_types.String | None = None,
142
+ normalize: _arg_types.Bool | None = None,
143
+ magnitude: _arg_types.Number | None = None,
146
144
  ) -> Kernel:
147
145
  """Returns a cross-shaped boolean kernel.
148
146
 
@@ -162,9 +160,9 @@ class Kernel(computedobject.ComputedObject):
162
160
  @staticmethod
163
161
  def diamond(
164
162
  radius: _arg_types.Number,
165
- units: Optional[_arg_types.String] = None,
166
- normalize: Optional[_arg_types.Bool] = None,
167
- magnitude: Optional[_arg_types.Number] = None,
163
+ units: _arg_types.String | None = None,
164
+ normalize: _arg_types.Bool | None = None,
165
+ magnitude: _arg_types.Number | None = None,
168
166
  ) -> Kernel:
169
167
  """Returns a diamond-shaped boolean kernel.
170
168
 
@@ -184,9 +182,9 @@ class Kernel(computedobject.ComputedObject):
184
182
  @staticmethod
185
183
  def euclidean(
186
184
  radius: _arg_types.Number,
187
- units: Optional[_arg_types.String] = None,
188
- normalize: Optional[_arg_types.Bool] = None,
189
- magnitude: Optional[_arg_types.Number] = None,
185
+ units: _arg_types.String | None = None,
186
+ normalize: _arg_types.Bool | None = None,
187
+ magnitude: _arg_types.Number | None = None,
190
188
  ) -> Kernel:
191
189
  """Returns a distance kernel based on Euclidean (straight-line) distance.
192
190
 
@@ -206,12 +204,12 @@ class Kernel(computedobject.ComputedObject):
206
204
  # TODO: Test missing weights.
207
205
  @staticmethod
208
206
  def fixed(
209
- width: Optional[_arg_types.Integer] = None,
210
- height: Optional[_arg_types.Integer] = None,
211
- weights: Optional[_arg_types.List] = None,
212
- x: Optional[_arg_types.Integer] = None,
213
- y: Optional[_arg_types.Integer] = None,
214
- normalize: Optional[_arg_types.Bool] = None,
207
+ width: _arg_types.Integer | None = None,
208
+ height: _arg_types.Integer | None = None,
209
+ weights: _arg_types.List | None = None,
210
+ x: _arg_types.Integer | None = None,
211
+ y: _arg_types.Integer | None = None,
212
+ normalize: _arg_types.Bool | None = None,
215
213
  ) -> Kernel:
216
214
  """Returns a kernel with the given weights.
217
215
 
@@ -234,10 +232,10 @@ class Kernel(computedobject.ComputedObject):
234
232
  @staticmethod
235
233
  def gaussian(
236
234
  radius: _arg_types.Number,
237
- sigma: Optional[_arg_types.Number] = None,
238
- units: Optional[_arg_types.String] = None,
239
- normalize: Optional[_arg_types.Bool] = None,
240
- magnitude: Optional[_arg_types.Number] = None,
235
+ sigma: _arg_types.Number | None = None,
236
+ units: _arg_types.String | None = None,
237
+ normalize: _arg_types.Bool | None = None,
238
+ magnitude: _arg_types.Number | None = None,
241
239
  ) -> Kernel:
242
240
  """Returns a Gaussian kernel from a sampled continuous Gaussian.
243
241
 
@@ -265,8 +263,8 @@ class Kernel(computedobject.ComputedObject):
265
263
 
266
264
  @staticmethod
267
265
  def kirsch(
268
- magnitude: Optional[_arg_types.Number] = None,
269
- normalize: Optional[_arg_types.Bool] = None,
266
+ magnitude: _arg_types.Number | None = None,
267
+ normalize: _arg_types.Bool | None = None,
270
268
  ) -> Kernel:
271
269
  """Returns a 3x3 Kirsch's Compass edge-detection kernel.
272
270
 
@@ -279,8 +277,8 @@ class Kernel(computedobject.ComputedObject):
279
277
 
280
278
  @staticmethod
281
279
  def laplacian4(
282
- magnitude: Optional[_arg_types.Number] = None,
283
- normalize: Optional[_arg_types.Bool] = None,
280
+ magnitude: _arg_types.Number | None = None,
281
+ normalize: _arg_types.Bool | None = None,
284
282
  ) -> Kernel:
285
283
  """Returns a 3x3 Laplacian-4 edge-detection kernel.
286
284
 
@@ -295,8 +293,8 @@ class Kernel(computedobject.ComputedObject):
295
293
 
296
294
  @staticmethod
297
295
  def laplacian8(
298
- magnitude: Optional[_arg_types.Number] = None,
299
- normalize: Optional[_arg_types.Bool] = None,
296
+ magnitude: _arg_types.Number | None = None,
297
+ normalize: _arg_types.Bool | None = None,
300
298
  ) -> Kernel:
301
299
  """Returns a 3x3 Laplacian-8 edge-detection kernel.
302
300
 
@@ -312,9 +310,9 @@ class Kernel(computedobject.ComputedObject):
312
310
  @staticmethod
313
311
  def manhattan(
314
312
  radius: _arg_types.Number,
315
- units: Optional[_arg_types.String] = None,
316
- normalize: Optional[_arg_types.Bool] = None,
317
- magnitude: Optional[_arg_types.Number] = None,
313
+ units: _arg_types.String | None = None,
314
+ normalize: _arg_types.Bool | None = None,
315
+ magnitude: _arg_types.Number | None = None,
318
316
  ) -> Kernel:
319
317
  """Returns a distance kernel based on rectilinear (city-block) distance.
320
318
 
@@ -334,9 +332,9 @@ class Kernel(computedobject.ComputedObject):
334
332
  @staticmethod
335
333
  def octagon(
336
334
  radius: _arg_types.Number,
337
- units: Optional[_arg_types.String] = None,
338
- normalize: Optional[_arg_types.Bool] = None,
339
- magnitude: Optional[_arg_types.Number] = None,
335
+ units: _arg_types.String | None = None,
336
+ normalize: _arg_types.Bool | None = None,
337
+ magnitude: _arg_types.Number | None = None,
340
338
  ) -> Kernel:
341
339
  """Returns an octagon-shaped boolean kernel.
342
340
 
@@ -356,9 +354,9 @@ class Kernel(computedobject.ComputedObject):
356
354
  @staticmethod
357
355
  def plus(
358
356
  radius: _arg_types.Number,
359
- units: Optional[_arg_types.String] = None,
360
- normalize: Optional[_arg_types.Bool] = None,
361
- magnitude: Optional[_arg_types.Number] = None,
357
+ units: _arg_types.String | None = None,
358
+ normalize: _arg_types.Bool | None = None,
359
+ magnitude: _arg_types.Number | None = None,
362
360
  ) -> Kernel:
363
361
  """Returns a plus-shaped boolean kernel.
364
362
 
@@ -377,8 +375,8 @@ class Kernel(computedobject.ComputedObject):
377
375
 
378
376
  @staticmethod
379
377
  def prewitt(
380
- magnitude: Optional[_arg_types.Number] = None,
381
- normalize: Optional[_arg_types.Bool] = None,
378
+ magnitude: _arg_types.Number | None = None,
379
+ normalize: _arg_types.Bool | None = None,
382
380
  ) -> Kernel:
383
381
  """Returns a 3x3 Prewitt edge-detection kernel.
384
382
 
@@ -393,9 +391,9 @@ class Kernel(computedobject.ComputedObject):
393
391
  def rectangle(
394
392
  xRadius: _arg_types.Number, # pylint: disable=invalid-name
395
393
  yRadius: _arg_types.Number, # pylint: disable=invalid-name
396
- units: Optional[_arg_types.String] = None,
397
- normalize: Optional[_arg_types.Bool] = None,
398
- magnitude: Optional[_arg_types.Number] = None,
394
+ units: _arg_types.String | None = None,
395
+ normalize: _arg_types.Bool | None = None,
396
+ magnitude: _arg_types.Number | None = None,
399
397
  ) -> Kernel:
400
398
  """Returns a rectangular-shaped kernel.
401
399
 
@@ -415,8 +413,8 @@ class Kernel(computedobject.ComputedObject):
415
413
 
416
414
  @staticmethod
417
415
  def roberts(
418
- magnitude: Optional[_arg_types.Number] = None,
419
- normalize: Optional[_arg_types.Bool] = None,
416
+ magnitude: _arg_types.Number | None = None,
417
+ normalize: _arg_types.Bool | None = None,
420
418
  ) -> Kernel:
421
419
  """Returns a 2x2 Roberts edge-detection kernel.
422
420
 
@@ -441,8 +439,8 @@ class Kernel(computedobject.ComputedObject):
441
439
 
442
440
  @staticmethod
443
441
  def sobel(
444
- magnitude: Optional[_arg_types.Number] = None,
445
- normalize: Optional[_arg_types.Bool] = None,
442
+ magnitude: _arg_types.Number | None = None,
443
+ normalize: _arg_types.Bool | None = None,
446
444
  ) -> Kernel:
447
445
  """Returns a 3x3 Sobel edge-detection kernel.
448
446
 
@@ -456,9 +454,9 @@ class Kernel(computedobject.ComputedObject):
456
454
  @staticmethod
457
455
  def square(
458
456
  radius: _arg_types.Number,
459
- units: Optional[_arg_types.String] = None,
460
- normalize: Optional[_arg_types.Bool] = None,
461
- magnitude: Optional[_arg_types.Number] = None,
457
+ units: _arg_types.String | None = None,
458
+ normalize: _arg_types.Bool | None = None,
459
+ magnitude: _arg_types.Number | None = None,
462
460
  ) -> Kernel:
463
461
  """Returns a square-shaped boolean kernel.
464
462
 
ee/oauth.py CHANGED
@@ -17,7 +17,8 @@ import os
17
17
  import shutil
18
18
  import subprocess
19
19
  import sys
20
- from typing import Any, Optional, Sequence, Union
20
+ from typing import Any, Optional, Union
21
+ from collections.abc import Sequence
21
22
  import urllib.error
22
23
  import urllib.parse
23
24
  import urllib.request
@@ -200,7 +201,7 @@ def write_private_json(json_path: str, info_dict: dict[str, Any]) -> None:
200
201
  except OSError as e:
201
202
  if e.errno != errno.EEXIST:
202
203
  # pylint:disable=broad-exception-raised,raise-missing-from
203
- raise Exception('Error creating directory %s: %s' % (dirname, e))
204
+ raise Exception('Error creating directory {}: {}'.format(dirname, e))
204
205
  # pylint:enable=broad-exception-raised,raise-missing-from
205
206
 
206
207
  file_content = json.dumps(info_dict)
@@ -292,30 +293,35 @@ def _display_auth_instructions_for_noninteractive(
292
293
  else:
293
294
  code_verifier_str = code_verifier
294
295
 
295
- print('Paste the following address into a web browser:\n'
296
- '\n'
297
- ' {0}\n'
298
- '\n'
299
- 'On the web page, please authorize access to your '
300
- 'Earth Engine account and copy the authentication code. '
301
- 'Next authenticate with the following command:\n'
302
- '\n'
303
- ' earthengine authenticate --code-verifier={1} '
304
- '--authorization-code=PLACE_AUTH_CODE_HERE\n'.format(
305
- auth_url, code_verifier_str))
296
+ print(
297
+ 'Paste the following address into a web browser:\n'
298
+ '\n'
299
+ ' {}\n'
300
+ '\n'
301
+ 'On the web page, please authorize access to your '
302
+ 'Earth Engine account and copy the authentication code. '
303
+ 'Next authenticate with the following command:\n'
304
+ '\n'
305
+ ' earthengine authenticate --code-verifier={} '
306
+ '--authorization-code=PLACE_AUTH_CODE_HERE\n'.format(
307
+ auth_url, code_verifier_str
308
+ )
309
+ )
306
310
 
307
311
 
308
312
  def _display_auth_instructions_with_print(
309
313
  auth_url: str, coda: Optional[str] = None
310
314
  ) -> None:
311
315
  """Displays instructions for authenticating using a print statement."""
312
- print('To authorize access needed by Earth Engine, open the following '
313
- 'URL in a web browser and follow the instructions. If the web '
314
- 'browser does not start automatically, please manually browse the '
315
- 'URL below.\n'
316
- '\n'
317
- ' {0}\n'
318
- '\n{1}'.format(auth_url, coda or PASTE_CODA))
316
+ print(
317
+ 'To authorize access needed by Earth Engine, open the following '
318
+ 'URL in a web browser and follow the instructions. If the web '
319
+ 'browser does not start automatically, please manually browse the '
320
+ 'URL below.\n'
321
+ '\n'
322
+ ' {}\n'
323
+ '\n{}'.format(auth_url, coda or PASTE_CODA)
324
+ )
319
325
 
320
326
 
321
327
  def _display_auth_instructions_with_html(
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, Optional, Union
4
+ from typing import Any
5
5
 
6
6
  from ee import _arg_types
7
7
  from ee import apifunction
@@ -52,12 +52,12 @@ class PixelType(computedobject.ComputedObject):
52
52
 
53
53
  def __init__(
54
54
  self,
55
- precision: Union[_arg_types.String],
55
+ precision: _arg_types.String,
56
56
  # pylint: disable=invalid-name
57
- minValue: Optional[_arg_types.Number] = None,
58
- maxValue: Optional[_arg_types.Number] = None,
57
+ minValue: _arg_types.Number | None = None,
58
+ maxValue: _arg_types.Number | None = None,
59
59
  # pylint: enable=invalid-name
60
- dimensions: Optional[_arg_types.Integer] = None,
60
+ dimensions: _arg_types.Integer | None = None,
61
61
  ):
62
62
  """Creates a PixelType wrapper.
63
63
 
ee/projection.py CHANGED
@@ -1,7 +1,8 @@
1
1
  """A wrapper for Projections."""
2
2
  from __future__ import annotations
3
3
 
4
- from typing import Any, Optional, Sequence, Union
4
+ from collections.abc import Sequence
5
+ from typing import Any, Union
5
6
 
6
7
  from ee import _arg_types
7
8
  from ee import apifunction
@@ -45,9 +46,9 @@ class Projection(computedobject.ComputedObject):
45
46
  def __init__(
46
47
  self,
47
48
  crs: _arg_types.String,
48
- transform: Optional[_NumberSequenceType] = None,
49
+ transform: _NumberSequenceType | None = None,
49
50
  # pylint: disable-next=invalid-name
50
- transformWkt: Optional[_arg_types.String] = None,
51
+ transformWkt: _arg_types.String | None = None,
51
52
  ):
52
53
  """Creates a Projection wrapper.
53
54