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/dictionary.py CHANGED
@@ -1,7 +1,7 @@
1
1
  """A wrapper for dictionaries."""
2
2
  from __future__ import annotations
3
3
 
4
- from typing import Any, Optional, Union
4
+ from typing import Any, Union
5
5
 
6
6
  from ee import _arg_types
7
7
  from ee import _utils
@@ -26,14 +26,14 @@ _StringListType = Union[Any, computedobject.ComputedObject]
26
26
  class Dictionary(computedobject.ComputedObject):
27
27
  """An object to represent dictionaries."""
28
28
 
29
- _dictionary: Optional[dict[Any, Any]]
29
+ _dictionary: dict[Any, Any] | None
30
30
 
31
31
  _initialized = False
32
32
 
33
33
  # Tell pytype to not complain about dynamic attributes.
34
34
  _HAS_DYNAMIC_ATTRIBUTES = True
35
35
 
36
- def __init__(self, arg: Optional[_arg_types.Dictionary] = None):
36
+ def __init__(self, arg: _arg_types.Dictionary | None = None):
37
37
  """Construct a dictionary.
38
38
 
39
39
  Args:
@@ -91,7 +91,7 @@ class Dictionary(computedobject.ComputedObject):
91
91
  def combine(
92
92
  self,
93
93
  second: _arg_types.Dictionary,
94
- overwrite: Optional[_arg_types.Bool] = None,
94
+ overwrite: _arg_types.Bool | None = None,
95
95
  ) -> Dictionary:
96
96
  """Combines two dictionaries.
97
97
 
@@ -140,7 +140,7 @@ class Dictionary(computedobject.ComputedObject):
140
140
  self,
141
141
  key: _EeKeyType,
142
142
  # pylint: disable-next=invalid-name
143
- defaultValue: Optional[_arg_types.Any] = None,
143
+ defaultValue: _arg_types.Any | None = None,
144
144
  ) -> computedobject.ComputedObject:
145
145
  """Extracts a named value from a dictionary.
146
146
 
@@ -237,7 +237,7 @@ class Dictionary(computedobject.ComputedObject):
237
237
  self,
238
238
  selectors: _arg_types.Any,
239
239
  # pylint: disable-next=invalid-name
240
- ignoreMissing: Optional[_arg_types.Bool] = None,
240
+ ignoreMissing: _arg_types.Bool | None = None,
241
241
  ) -> Dictionary:
242
242
  """Returns a dictionary with the specified keys removed.
243
243
 
@@ -278,7 +278,7 @@ class Dictionary(computedobject.ComputedObject):
278
278
  self,
279
279
  selectors: _arg_types.Any,
280
280
  # pylint: disable-next=invalid-name
281
- ignoreMissing: Optional[_arg_types.Bool] = None,
281
+ ignoreMissing: _arg_types.Bool | None = None,
282
282
  ) -> Dictionary:
283
283
  """Returns a dictionary with only the specified keys.
284
284
 
@@ -315,8 +315,8 @@ class Dictionary(computedobject.ComputedObject):
315
315
 
316
316
  def toArray(
317
317
  self,
318
- keys: Optional[_EeKeyListType] = None,
319
- axis: Optional[_arg_types.Integer] = None,
318
+ keys: _EeKeyListType | None = None,
319
+ axis: _arg_types.Integer | None = None,
320
320
  ) -> ee_array.Array:
321
321
  """Returns numeric values of a dictionary as an array.
322
322
 
@@ -335,7 +335,7 @@ class Dictionary(computedobject.ComputedObject):
335
335
  self.name() + '.toArray', self, keys, axis
336
336
  )
337
337
 
338
- def toImage(self, names: Optional[_arg_types.Any] = None) -> image.Image:
338
+ def toImage(self, names: _arg_types.Any | None = None) -> image.Image:
339
339
  """Creates an image of constants from values in a dictionary.
340
340
 
341
341
  The bands of the image are ordered and named according to the names
@@ -351,7 +351,7 @@ class Dictionary(computedobject.ComputedObject):
351
351
 
352
352
  return apifunction.ApiFunction.call_(self.name() + '.toImage', self, names)
353
353
 
354
- def values(self, keys: Optional[_EeKeyListType] = None) -> ee_list.List:
354
+ def values(self, keys: _EeKeyListType | None = None) -> ee_list.List:
355
355
  """Returns the values of a dictionary as a list.
356
356
 
357
357
  If no keys are specified, all values are returned in the natural ordering of
ee/ee_array.py CHANGED
@@ -1,7 +1,7 @@
1
1
  """A wrapper for Arrays."""
2
2
  from __future__ import annotations
3
3
 
4
- from typing import Any, Optional
4
+ from typing import Any
5
5
 
6
6
  from ee import _arg_types
7
7
  from ee import apifunction
@@ -37,7 +37,7 @@ class Array(computedobject.ComputedObject):
37
37
  self,
38
38
  values: _arg_types.Array,
39
39
  # pylint: disable-next=invalid-name
40
- pixelType: Optional[_arg_types.String] = None,
40
+ pixelType: _arg_types.String | None = None,
41
41
  ):
42
42
  """Creates an Array wrapper.
43
43
 
@@ -92,7 +92,7 @@ class Array(computedobject.ComputedObject):
92
92
  def accum(
93
93
  self,
94
94
  axis: _arg_types.Integer,
95
- reducer: Optional[_arg_types.Reducer] = None,
95
+ reducer: _arg_types.Reducer | None = None,
96
96
  ) -> Array:
97
97
  """Accumulates elements of an array along the given axis.
98
98
 
@@ -261,7 +261,7 @@ class Array(computedobject.ComputedObject):
261
261
 
262
262
  @staticmethod
263
263
  def cat(
264
- arrays: _arg_types.List, axis: Optional[_arg_types.Integer] = None
264
+ arrays: _arg_types.List, axis: _arg_types.Integer | None = None
265
265
  ) -> Array:
266
266
  """Returns an Array that is the concatenation of the given arrays.
267
267
 
@@ -748,8 +748,8 @@ class Array(computedobject.ComputedObject):
748
748
 
749
749
  def matrixTranspose(
750
750
  self,
751
- axis1: Optional[_arg_types.Integer] = None,
752
- axis2: Optional[_arg_types.Integer] = None,
751
+ axis1: _arg_types.Integer | None = None,
752
+ axis2: _arg_types.Integer | None = None,
753
753
  ) -> Array:
754
754
  """Transposes two dimensions of an array.
755
755
 
@@ -843,7 +843,7 @@ class Array(computedobject.ComputedObject):
843
843
  return apifunction.ApiFunction.call_(self.name() + '.or', self, right)
844
844
 
845
845
  def pad(
846
- self, lengths: _arg_types.Any, pad: Optional[_arg_types.Number] = None
846
+ self, lengths: _arg_types.Any, pad: _arg_types.Number | None = None
847
847
  ) -> Array:
848
848
  """Pad an array to a given length.
849
849
 
@@ -896,7 +896,7 @@ class Array(computedobject.ComputedObject):
896
896
  reducer: _arg_types.Reducer,
897
897
  axes: _arg_types.Any,
898
898
  # pylint: disable-next=invalid-name
899
- fieldAxis: Optional[_arg_types.Integer] = None,
899
+ fieldAxis: _arg_types.Integer | None = None,
900
900
  ) -> Array:
901
901
  """Returns the result of applying the reducer on the array.
902
902
 
@@ -934,8 +934,8 @@ class Array(computedobject.ComputedObject):
934
934
 
935
935
  def repeat(
936
936
  self,
937
- axis: Optional[_arg_types.Integer] = None,
938
- copies: Optional[_arg_types.Integer] = None,
937
+ axis: _arg_types.Integer | None = None,
938
+ copies: _arg_types.Integer | None = None,
939
939
  ) -> Array:
940
940
  """Repeats the array along the given axis.
941
941
 
@@ -1019,10 +1019,10 @@ class Array(computedobject.ComputedObject):
1019
1019
 
1020
1020
  def slice(
1021
1021
  self,
1022
- axis: Optional[_arg_types.Integer] = None,
1023
- start: Optional[_arg_types.Integer] = None,
1024
- end: Optional[_arg_types.Integer] = None,
1025
- step: Optional[_arg_types.Integer] = None,
1022
+ axis: _arg_types.Integer | None = None,
1023
+ start: _arg_types.Integer | None = None,
1024
+ end: _arg_types.Integer | None = None,
1025
+ step: _arg_types.Integer | None = None,
1026
1026
  ) -> Array:
1027
1027
  """Returns the result of slicing the array along the given axis.
1028
1028
 
@@ -1059,7 +1059,7 @@ class Array(computedobject.ComputedObject):
1059
1059
  self.name() + '.slice', self, axis, start, end, step
1060
1060
  )
1061
1061
 
1062
- def sort(self, keys: Optional[_arg_types.Any] = None) -> Array:
1062
+ def sort(self, keys: _arg_types.Any | None = None) -> Array:
1063
1063
  """Sorts elements of the array along one axis.
1064
1064
 
1065
1065
  Args:
@@ -1172,8 +1172,8 @@ class Array(computedobject.ComputedObject):
1172
1172
 
1173
1173
  def transpose(
1174
1174
  self,
1175
- axis1: Optional[_arg_types.Integer] = None,
1176
- axis2: Optional[_arg_types.Integer] = None,
1175
+ axis1: _arg_types.Integer | None = None,
1176
+ axis2: _arg_types.Integer | None = None,
1177
1177
  ) -> Array:
1178
1178
  """Transposes two dimensions of an array.
1179
1179
 
ee/ee_date.py CHANGED
@@ -3,7 +3,7 @@ from __future__ import annotations
3
3
 
4
4
  import datetime
5
5
  import math
6
- from typing import Any, Optional, Union
6
+ from typing import Any, Union
7
7
 
8
8
  from ee import _arg_types
9
9
  from ee import _utils
@@ -31,7 +31,7 @@ class Date(computedobject.ComputedObject):
31
31
 
32
32
  @_utils.accept_opt_prefix('opt_tz')
33
33
  def __init__(
34
- self, date: Union[_DateType], tz: Optional[_arg_types.String] = None
34
+ self, date: _DateType, tz: _arg_types.String | None = None
35
35
  ):
36
36
  """Construct a date.
37
37
 
@@ -108,8 +108,8 @@ class Date(computedobject.ComputedObject):
108
108
  delta: _arg_types.Number,
109
109
  unit: _arg_types.String,
110
110
  # pylint: disable-next=invalid-name
111
- timeZone: Optional[_arg_types.String] = None,
112
- ) -> 'Date':
111
+ timeZone: _arg_types.String | None = None,
112
+ ) -> Date:
113
113
  """Create a new Date by adding the specified units to the given Date.
114
114
 
115
115
  Args:
@@ -147,9 +147,9 @@ class Date(computedobject.ComputedObject):
147
147
  def format(
148
148
  self,
149
149
  # pylint: disable-next=redefined-builtin
150
- format: Optional[_arg_types.String] = None,
150
+ format: _arg_types.String | None = None,
151
151
  # pylint: disable-next=invalid-name
152
- timeZone: Optional[_arg_types.String] = None,
152
+ timeZone: _arg_types.String | None = None,
153
153
  ) -> ee_string.String:
154
154
  """Convert a date to string.
155
155
 
@@ -175,8 +175,8 @@ class Date(computedobject.ComputedObject):
175
175
  month: _arg_types.Integer,
176
176
  day: _arg_types.Integer,
177
177
  # pylint: disable=invalid-name
178
- timeZone: Optional[_arg_types.String] = None,
179
- ) -> 'Date':
178
+ timeZone: _arg_types.String | None = None,
179
+ ) -> Date:
180
180
  """Returns a Date given year, month, day.
181
181
 
182
182
  Args:
@@ -194,7 +194,7 @@ class Date(computedobject.ComputedObject):
194
194
  self,
195
195
  unit: _arg_types.String,
196
196
  # pylint: disable-next=invalid-name
197
- timeZone: Optional[_arg_types.String] = None,
197
+ timeZone: _arg_types.String | None = None,
198
198
  ) -> ee_number.Number:
199
199
  """Returns the specified unit of this date.
200
200
 
@@ -215,7 +215,7 @@ class Date(computedobject.ComputedObject):
215
215
  self,
216
216
  unit: _arg_types.String,
217
217
  # pylint: disable-next=invalid-name
218
- timeZone: Optional[_arg_types.String] = None,
218
+ timeZone: _arg_types.String | None = None,
219
219
  ) -> ee_number.Number:
220
220
  """Returns this date's elapsed fraction of the specified unit.
221
221
 
@@ -236,7 +236,7 @@ class Date(computedobject.ComputedObject):
236
236
  self,
237
237
  unit: _arg_types.String,
238
238
  # pylint: disable-next=invalid-name
239
- timeZone: Optional[_arg_types.String] = None,
239
+ timeZone: _arg_types.String | None = None,
240
240
  ) -> daterange.DateRange:
241
241
  """Returns a DateRange covering the unit that contains this date.
242
242
 
@@ -266,7 +266,7 @@ class Date(computedobject.ComputedObject):
266
266
  unit: _arg_types.String,
267
267
  inUnit: _arg_types.String, # pylint: disable=invalid-name
268
268
  # pylint: disable-next=invalid-name
269
- timeZone: Optional[_arg_types.String] = None,
269
+ timeZone: _arg_types.String | None = None,
270
270
  ) -> ee_number.Number:
271
271
  """Returns the specified unit of this date relative to a larger unit.
272
272
 
@@ -295,8 +295,8 @@ class Date(computedobject.ComputedObject):
295
295
  format: _arg_types.String, # pylint: disable=redefined-builtin
296
296
  date: _arg_types.String,
297
297
  # pylint: disable-next=invalid-name
298
- timeZone: Optional[_arg_types.String] = None,
299
- ) -> 'Date':
298
+ timeZone: _arg_types.String | None = None,
299
+ ) -> Date:
300
300
  """Parse a date string, given a string describing its format.
301
301
 
302
302
  Args:
@@ -336,15 +336,15 @@ class Date(computedobject.ComputedObject):
336
336
 
337
337
  def update(
338
338
  self,
339
- year: Optional[_arg_types.Integer] = None,
340
- month: Optional[_arg_types.Integer] = None,
341
- day: Optional[_arg_types.Integer] = None,
342
- hour: Optional[_arg_types.Integer] = None,
343
- minute: Optional[_arg_types.Integer] = None,
344
- second: Optional[_arg_types.Number] = None,
339
+ year: _arg_types.Integer | None = None,
340
+ month: _arg_types.Integer | None = None,
341
+ day: _arg_types.Integer | None = None,
342
+ hour: _arg_types.Integer | None = None,
343
+ minute: _arg_types.Integer | None = None,
344
+ second: _arg_types.Number | None = None,
345
345
  # pylint: disable-next=invalid-name
346
- timeZone: Optional[_arg_types.String] = None,
347
- ) -> 'Date':
346
+ timeZone: _arg_types.String | None = None,
347
+ ) -> Date:
348
348
  """Create a new Date by setting one or more of the units of the given Date.
349
349
 
350
350
  If a timeZone is given the new value(s) is interpreted in that zone. Skip or
ee/ee_list.py CHANGED
@@ -1,7 +1,7 @@
1
1
  """A wrapper for lists."""
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 _utils
@@ -17,16 +17,16 @@ from ee import geometry
17
17
 
18
18
  class List(computedobject.ComputedObject):
19
19
  """An object to represent lists."""
20
- _list: Optional[
21
- Union[list[Any], tuple[Any, Any]]
22
- ]
20
+ _list: None | (
21
+ list[Any] | tuple[Any, Any]
22
+ )
23
23
 
24
24
  _initialized = False
25
25
 
26
26
  # Tell pytype to not complain about dynamic attributes.
27
27
  _HAS_DYNAMIC_ATTRIBUTES = True
28
28
 
29
- def __init__(self, arg: Optional[_arg_types.List]):
29
+ def __init__(self, arg: _arg_types.List | None):
30
30
  """Construct a list wrapper.
31
31
 
32
32
  This constructor accepts the following args:
@@ -64,9 +64,9 @@ class List(computedobject.ComputedObject):
64
64
  @staticmethod
65
65
  def sequence(
66
66
  start: _arg_types.Number,
67
- end: Optional[_arg_types.Number] = None,
68
- step: Optional[_arg_types.Number] = None,
69
- count: Optional[_arg_types.Integer] = None,
67
+ end: _arg_types.Number | None = None,
68
+ step: _arg_types.Number | None = None,
69
+ count: _arg_types.Integer | None = None,
70
70
  ) -> List:
71
71
  """Returns a List of numbers from start to end (inclusive).
72
72
 
@@ -104,7 +104,7 @@ class List(computedobject.ComputedObject):
104
104
  return 'List'
105
105
 
106
106
  @_utils.accept_opt_prefix('opt_encoder')
107
- def encode(self, encoder: Optional[Any] = None) -> Any:
107
+ def encode(self, encoder: Any | None = None) -> Any:
108
108
  if isinstance(self._list, (list, tuple)):
109
109
  assert self._list is not None
110
110
  return [encoder(elem) for elem in self._list]
@@ -112,7 +112,7 @@ class List(computedobject.ComputedObject):
112
112
  return super().encode(encoder)
113
113
 
114
114
  @_utils.accept_opt_prefix('opt_encoder')
115
- def encode_cloud_value(self, encoder: Optional[Any] = None) -> Any:
115
+ def encode_cloud_value(self, encoder: Any | None = None) -> Any:
116
116
  if isinstance(self._list, (list, tuple)):
117
117
  return {'valueReference': encoder(self._list)}
118
118
  else:
@@ -557,7 +557,7 @@ class List(computedobject.ComputedObject):
557
557
  self.name() + '.set', self, index, element
558
558
  )
559
559
 
560
- def shuffle(self, seed: Optional[_arg_types.Integer] = None) -> List:
560
+ def shuffle(self, seed: _arg_types.Integer | None = None) -> List:
561
561
  """Randomly permute the specified list.
562
562
 
563
563
  Note that the permutation order will always be the same for any given seed,
@@ -582,8 +582,8 @@ class List(computedobject.ComputedObject):
582
582
  def slice(
583
583
  self,
584
584
  start: _arg_types.Integer,
585
- end: Optional[_arg_types.Integer] = None,
586
- step: Optional[_arg_types.Integer] = None,
585
+ end: _arg_types.Integer | None = None,
586
+ step: _arg_types.Integer | None = None,
587
587
  ) -> List:
588
588
  """Returns a range of elements from a list.
589
589
 
@@ -607,7 +607,7 @@ class List(computedobject.ComputedObject):
607
607
  self.name() + '.slice', self, start, end, step
608
608
  )
609
609
 
610
- def sort(self, keys: Optional[_arg_types.List] = None) -> List:
610
+ def sort(self, keys: _arg_types.List | None = None) -> List:
611
611
  """Sorts the list into ascending order.
612
612
 
613
613
  If the keys argument is provided, then it is sorted first, and the
@@ -627,7 +627,7 @@ class List(computedobject.ComputedObject):
627
627
  self,
628
628
  start: _arg_types.Integer,
629
629
  count: _arg_types.Integer,
630
- other: Optional[_arg_types.List] = None,
630
+ other: _arg_types.List | None = None,
631
631
  ) -> List:
632
632
  """Removes elements from list and replaces with elements from other.
633
633
 
ee/ee_number.py CHANGED
@@ -1,7 +1,7 @@
1
1
  """A wrapper for numbers."""
2
2
  from __future__ import annotations
3
3
 
4
- from typing import Any, Optional, Union
4
+ from typing import Any, Union
5
5
 
6
6
  from ee import _arg_types
7
7
  from ee import _cloud_api_utils
@@ -15,7 +15,7 @@ from ee import ee_string
15
15
  class Number(computedobject.ComputedObject):
16
16
  """An object to represent numbers."""
17
17
 
18
- _number: Optional[float]
18
+ _number: float | None
19
19
 
20
20
  _initialized = False
21
21
 
@@ -299,7 +299,7 @@ class Number(computedobject.ComputedObject):
299
299
  def expression(
300
300
  expression: _arg_types.String,
301
301
  # pylint: disable-next=redefined-builtin
302
- vars: Optional[_arg_types.Dictionary] = None,
302
+ vars: _arg_types.Dictionary | None = None,
303
303
  ) -> Number:
304
304
  """Returns a number from computing a numeric expression.
305
305
 
@@ -351,7 +351,7 @@ class Number(computedobject.ComputedObject):
351
351
  return apifunction.ApiFunction.call_(self.name() + '.floor', self)
352
352
 
353
353
  def format(
354
- self, pattern: Optional[_arg_types.String] = None
354
+ self, pattern: _arg_types.String | None = None
355
355
  ) -> ee_string.String:
356
356
  r"""Convert a number to a string using printf-style formatting.
357
357
 
@@ -589,7 +589,7 @@ class Number(computedobject.ComputedObject):
589
589
  def parse(
590
590
  # pylint: disable=redefined-builtin
591
591
  input: _arg_types.String,
592
- radix: Optional[_arg_types.Integer] = None,
592
+ radix: _arg_types.Integer | None = None,
593
593
  ) -> Number:
594
594
  """Returns a number from a string.
595
595
 
ee/ee_string.py CHANGED
@@ -1,7 +1,7 @@
1
1
  """A wrapper for strings."""
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 _utils
@@ -15,7 +15,7 @@ from ee import ee_number
15
15
  class String(computedobject.ComputedObject):
16
16
  """An object to represent strings."""
17
17
 
18
- _string: Optional[str]
18
+ _string: str | None
19
19
 
20
20
  _initialized = False
21
21
 
@@ -158,7 +158,7 @@ class String(computedobject.ComputedObject):
158
158
  return apifunction.ApiFunction.call_(self.name() + '.length', self)
159
159
 
160
160
  def match(
161
- self, regex: _arg_types.String, flags: Optional[_arg_types.String] = None
161
+ self, regex: _arg_types.String, flags: _arg_types.String | None = None
162
162
  ) -> ee_list.List:
163
163
  """Matches a string against a regular expression.
164
164
 
@@ -179,7 +179,7 @@ class String(computedobject.ComputedObject):
179
179
  self,
180
180
  regex: _arg_types.String,
181
181
  replacement: _arg_types.String,
182
- flags: Optional[_arg_types.String] = None,
182
+ flags: _arg_types.String | None = None,
183
183
  ) -> String:
184
184
  """Returns a string with some or all matches of a pattern replaced.
185
185
 
@@ -210,7 +210,7 @@ class String(computedobject.ComputedObject):
210
210
  return apifunction.ApiFunction.call_(self.name() + '.rindex', self, pattern)
211
211
 
212
212
  def slice(
213
- self, start: _arg_types.Integer, end: Optional[_arg_types.Integer] = None
213
+ self, start: _arg_types.Integer, end: _arg_types.Integer | None = None
214
214
  ) -> String:
215
215
  """Returns a substring of the given string.
216
216
 
@@ -232,7 +232,7 @@ class String(computedobject.ComputedObject):
232
232
  )
233
233
 
234
234
  def split(
235
- self, regex: _arg_types.String, flags: Optional[_arg_types.String] = None
235
+ self, regex: _arg_types.String, flags: _arg_types.String | None = None
236
236
  ) -> ee_list.List:
237
237
  """Splits a string on a regular expression into a list of strings.
238
238
 
ee/ee_types.py CHANGED
@@ -4,7 +4,7 @@
4
4
  # pylint: disable=g-bad-name
5
5
 
6
6
  import datetime
7
- from typing import Any, Type
7
+ from typing import Any
8
8
 
9
9
  from ee import computedobject
10
10
 
@@ -23,7 +23,7 @@ def _registerClasses(classes) -> None:
23
23
  _registered_classes = classes
24
24
 
25
25
 
26
- def classToName(a_class: Type[Any]) -> str:
26
+ def classToName(a_class: type[Any]) -> str:
27
27
  """Converts a class to the API-friendly type name.
28
28
 
29
29
  Args:
ee/element.py CHANGED
@@ -6,7 +6,7 @@ This class is never intended to be instantiated by the user.
6
6
  from __future__ import annotations
7
7
 
8
8
  import datetime
9
- from typing import Any, Optional, Union
9
+ from typing import Any
10
10
 
11
11
  from ee import _arg_types
12
12
  from ee import _utils
@@ -29,9 +29,9 @@ class Element(computedobject.ComputedObject):
29
29
  @_utils.accept_opt_prefix('opt_varName')
30
30
  def __init__(
31
31
  self,
32
- func: Optional[apifunction.ApiFunction],
33
- args: Optional[dict[str, Any]],
34
- varName: Optional[str] = None, # pylint: disable=g-bad-name
32
+ func: apifunction.ApiFunction | None,
33
+ args: dict[str, Any] | None,
34
+ varName: str | None = None, # pylint: disable=g-bad-name
35
35
  ):
36
36
  """Constructs a collection by initializing its ComputedObject."""
37
37
  super().__init__(func, args, varName)
@@ -58,8 +58,8 @@ class Element(computedobject.ComputedObject):
58
58
  def copyProperties(
59
59
  self,
60
60
  source: _arg_types.Element,
61
- properties: Optional[_arg_types.List] = None,
62
- exclude: Optional[_arg_types.List] = None,
61
+ properties: _arg_types.List | None = None,
62
+ exclude: _arg_types.List | None = None,
63
63
  ) -> Element:
64
64
  """Copies metadata properties from one element to another.
65
65
 
@@ -121,13 +121,13 @@ class Element(computedobject.ComputedObject):
121
121
 
122
122
  def set(
123
123
  self,
124
- *args: Union[
125
- dict[str, Any],
126
- float,
127
- str,
128
- datetime.datetime,
129
- computedobject.ComputedObject,
130
- ],
124
+ *args: (
125
+ dict[str, Any] |
126
+ float |
127
+ str |
128
+ datetime.datetime |
129
+ computedobject.ComputedObject
130
+ ),
131
131
  ) -> Element:
132
132
  """Overrides one or more metadata properties of an Element.
133
133
 
@@ -182,7 +182,7 @@ class Element(computedobject.ComputedObject):
182
182
  return self._cast(result)
183
183
 
184
184
  def toDictionary(
185
- self, properties: Optional[_arg_types.List] = None
185
+ self, properties: _arg_types.List | None = None
186
186
  ) -> dictionary.Dictionary:
187
187
  """Returns properties from a feature as a dictionary.
188
188
 
ee/errormargin.py CHANGED
@@ -1,7 +1,7 @@
1
1
  """A wrapper for ErrorMargins."""
2
2
  from __future__ import annotations
3
3
 
4
- from typing import Any, Optional
4
+ from typing import Any
5
5
 
6
6
  from ee import _arg_types
7
7
  from ee import apifunction
@@ -36,8 +36,8 @@ class ErrorMargin(computedobject.ComputedObject):
36
36
 
37
37
  def __init__(
38
38
  self,
39
- value: Optional[_arg_types.Number] = None,
40
- unit: Optional[_arg_types.String] = None,
39
+ value: _arg_types.Number | None = None,
40
+ unit: _arg_types.String | None = None,
41
41
  ):
42
42
  """Creates a ErrorMargin wrapper.
43
43