earthengine-api 1.5.24rc0__py3-none-any.whl → 1.6.0rc0__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.24rc0.dist-info → earthengine_api-1.6.0rc0.dist-info}/METADATA +1 -1
  2. earthengine_api-1.6.0rc0.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.24rc0.dist-info/RECORD +0 -107
  60. {earthengine_api-1.5.24rc0.dist-info → earthengine_api-1.6.0rc0.dist-info}/WHEEL +0 -0
  61. {earthengine_api-1.5.24rc0.dist-info → earthengine_api-1.6.0rc0.dist-info}/entry_points.txt +0 -0
  62. {earthengine_api-1.5.24rc0.dist-info → earthengine_api-1.6.0rc0.dist-info}/licenses/LICENSE +0 -0
  63. {earthengine_api-1.5.24rc0.dist-info → earthengine_api-1.6.0rc0.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: earthengine-api
3
- Version: 1.5.24rc0
3
+ Version: 1.6.0rc0
4
4
  Summary: Earth Engine Python API
5
5
  Author-email: Google LLC <noreply@google.com>
6
6
  License: Apache-2.0
@@ -0,0 +1,107 @@
1
+ earthengine_api-1.6.0rc0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
2
+ ee/__init__.py,sha256=zo7fuv9D7RKxglp1XDl0OC9OMluw6-p4SQJwu51MdaI,16810
3
+ ee/_arg_types.py,sha256=nrJrnPFnAS8fzMxAGmG3TbUOi_yFVrnSGW5IP8ATzDQ,2662
4
+ ee/_cloud_api_utils.py,sha256=W3y3PBjWWCD5PYIxYjsFmU8eq-umN_cEs-u6lv5_9sQ,32459
5
+ ee/_helpers.py,sha256=d2gHX7akpY8pnB9guC10Yy53W8sDfriaH21d-mEol18,4700
6
+ ee/_utils.py,sha256=SAXQ_ZefZUaOtyV6Lp3pdYqEFqblMEA6Bvxz0ltLjzA,1329
7
+ ee/apifunction.py,sha256=tzk_emkgi_OxFSEh33zXBHGQd-ja5VHaRTNBCXcrOXo,8747
8
+ ee/apitestcase.py,sha256=K3zHLYFCJ_QhwdhoImIeD-DJjSgd_nAGQpftKYvjF-Q,14959
9
+ ee/batch.py,sha256=vGIhExr37KJIU7-ZJJYckDSa7HK8rUHwEMLRONzuhhs,82481
10
+ ee/blob.py,sha256=TttcEI5eQMMKvvlw5OgGk26-T0LPcHEYmse7K6wOTZo,3192
11
+ ee/classifier.py,sha256=3STLrLT6Ddwzjs2324E02wRWM8VEpeifgOO81geTHJQ,23410
12
+ ee/clusterer.py,sha256=986D68b2eJ4xiiOiIOTNZ1psF8Ro-MFNQFKed058FS4,12256
13
+ ee/collection.py,sha256=20g_Y_UnkhABGFOSybyE_IGmKvod5kR9xm5eKLjzNcE,32277
14
+ ee/computedobject.py,sha256=o5F4y00PK-fye2pduA5QmMd6XIERA1lhC3yLs88zRpY,9082
15
+ ee/confusionmatrix.py,sha256=e6vz-FcT6acWxk5pDEK0vLIN1pUjYMh5Gyn1QSGJT3I,4233
16
+ ee/customfunction.py,sha256=k57sl03_vhOuEwAmgFpg0z3Ze9J3gy_W6n4u3uMaryA,7384
17
+ ee/data.py,sha256=cBPDlbdaAYONZ3_dwZDM_v8rvEoWBDisvFoFE0ZF6Nw,88616
18
+ ee/daterange.py,sha256=nrRYkR2M2aVU0ZJyG7yiZStFt-W2TvYVuazoZK_WZqM,4948
19
+ ee/deprecation.py,sha256=dkTRDZcdT90_j41z_mMlhtX8u5eD5N2BuKL90Q0oWYc,6085
20
+ ee/deserializer.py,sha256=Xz9Dis85JgZeLvpF-4yw3ZRv39rjvCTBYHjio8DE1kM,8424
21
+ ee/dictionary.py,sha256=b0t46vaeVMsFGI2icdGNspmedRtVVxfiIcFLWcmL2v8,10508
22
+ ee/ee_array.py,sha256=oqVm1jiLNUep5RvCO0ONVFLIYTV-WoZdyK-xfUTQc40,36311
23
+ ee/ee_date.py,sha256=ixmLMrrGjq30DX9QY92HTeUgFZhWdn485cyaJkksh6U,10757
24
+ ee/ee_exception.py,sha256=uN3X76HuhicU0LTxqRKQu1ZU6L7zw0GuABgsBTT-Ycw,164
25
+ ee/ee_list.py,sha256=-jf0-zcqiiNexX_6GLZaRKotfmLabJ2o071Bv3MF6kI,19819
26
+ ee/ee_number.py,sha256=5HNEu1cKhaHbosPp1-1AA99SuLd1z3D8N8xGt7Sy_j8,22593
27
+ ee/ee_string.py,sha256=dHShM_ZTwYWEJe7kO_vjx3f2VDOcZBFFQtvhPqEzi08,7729
28
+ ee/ee_types.py,sha256=QMVJePMTpVfyrJgaZyQ0K5LKOAlzrEMqYa8d3WH3wgQ,3083
29
+ ee/element.py,sha256=DDcAeUxP9iZUeArjPl6DcjOJHxI8ND80VwLyxj7aYoY,6262
30
+ ee/encodable.py,sha256=ZzZBOVOEwc8a8Dby3oHwIhW-5za-4tvLDE0Q2oVaNwQ,1884
31
+ ee/errormargin.py,sha256=x8kAgFeUdXmpc_kv8Vx5qv-fHeJvFU9EBFbSOxhNl8Y,3039
32
+ ee/feature.py,sha256=WItnwlQp8U3D0E0YkgJNXIAk2JviwloS9c8j2XqbKEM,30292
33
+ ee/featurecollection.py,sha256=kJFLYx4fFTzO5pzTo-6g-oVhDutvbXRRoIS8IcZsPec,14386
34
+ ee/filter.py,sha256=W_qZ21kr83Ca_3ZzP3mGxvEXN0bf5xsesqFyV4dNsGc,35323
35
+ ee/function.py,sha256=X-Mz0AvF_l809NZXK8RM6fa2h-nP7YU2sUFp6hvIbdU,7049
36
+ ee/geometry.py,sha256=maZDpV7Kd_eiazgREnlRX6Dmk8DIvVGUAhGE23gjWzA,59360
37
+ ee/image.py,sha256=XT2tzNV2CiCWlbwQqgFl22sESHV1uWUH2DW92fmnBIo,171056
38
+ ee/image_converter.py,sha256=CdeM5zMy0T_HylcFeoIcfZxjczWwOA2SklDLg6p9le8,1494
39
+ ee/imagecollection.py,sha256=kC1jdt7Mu3sv5COqRaHBwV7P_FUXv1FZGNhAKDcmq8w,27091
40
+ ee/join.py,sha256=idnuzRNFvKHRLHV5m9unp_xTsZb-E2kfgUCEYSg64ts,7578
41
+ ee/kernel.py,sha256=eTzJFvW4nbyiFl2dDZ0_cA_o3KqCbBewY-BDp7tCB_M,15002
42
+ ee/mapclient.py,sha256=QpUpKreEgOkjSXQBnfyViCwLQGiumHbKr-EA076XLYk,17500
43
+ ee/model.py,sha256=nXn0qhwKgiTA6xOUQ7aFe0o6Mis68hiywLoY9twLOj0,12185
44
+ ee/oauth.py,sha256=hTDY5m4wacRA6mIXl_0oea7g94O5BBbdFR_awBfwFZc,21922
45
+ ee/pixeltype.py,sha256=ucUwJ5SvcOT849Ap4mlJL9z11IAbcT1w9ii8-zOoqdI,5196
46
+ ee/projection.py,sha256=n7WvMeYEG9zksGN1tIX7RGweC4IyCrXAKsvPY0e2b8k,5868
47
+ ee/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
48
+ ee/reducer.py,sha256=80LyfpjpyJj3FO36fviZIK5YcnDxssMZgrRK-Y3whSs,33740
49
+ ee/serializer.py,sha256=OldyytHpwmUVt28TEjlSS7J-3CE7GBZhyyXhvyMQIGs,22806
50
+ ee/table_converter.py,sha256=6ARbOLq1VPU1_wXY2pyv0PuzY4XyEBwM3npMt6Hp__U,2088
51
+ ee/terrain.py,sha256=VBa0VPfAkNuAruEIEu12XarwwlzQSwE09rQghmk62k0,4863
52
+ ee/cli/__init__.py,sha256=YjzBDuYi6fiOv77Xfl-Qib2O6gRZj9z7Sx2Zz6teTXU,33
53
+ ee/cli/commands.py,sha256=06qduHEdR6cE7TJUUAGFlHC8SW0T4mm17haVGMmTuLE,71426
54
+ ee/cli/eecli.py,sha256=iws34w24UJI6H7Wl9WsEUwy-uN57Pw-bgHtr2f92olY,3044
55
+ ee/cli/eecli_wrapper.py,sha256=Z7R3IJcht2uG1h57oY7BSrkPiwQzNmmYlyCSX1_7L7c,1089
56
+ ee/cli/utils.py,sha256=YWrgN_5k8GRWndST20KkGljn4Ee8F8935ID91qiLRtY,13796
57
+ ee/tests/_cloud_api_utils_test.py,sha256=sbts2xDKmf1dCedVv1w3KBp-IvOfihxbM6g_H0nI1sg,18814
58
+ ee/tests/_helpers_test.py,sha256=3nd6pTAykjYRxXDxtYJjkg48EgJSogPRdepi_nwGJAA,1935
59
+ ee/tests/_utils_test.py,sha256=bOarVj3U-VFo9Prog8WQN_hAOMwJOiWKJxevUbdFPBQ,2753
60
+ ee/tests/algorithms.json,sha256=Vx1Kx_MhHv0z0B3WTeVAvchM8xVd3zYE7L-qT3gDGzA,729368
61
+ ee/tests/apifunction_test.py,sha256=62El-6jcgQmD7qt9eEDdM7IeIQmpV8M5xQ439g-zfN4,3767
62
+ ee/tests/batch_test.py,sha256=QN2F6lUgHYws16pfz9LSPnkEteWwkxU3YOfNvfRl-lo,62210
63
+ ee/tests/blob_test.py,sha256=2Y-btrQ8FQqmf1ccYR8hLzdCaM5uoHfSoB7a5OziTxA,3575
64
+ ee/tests/classifier_test.py,sha256=K6-wNZ2uh9oPYo7BV0vtfU73SBFpeNcFRMRmvEFc6Pg,19087
65
+ ee/tests/cloud_api_discovery_document.json,sha256=SnOeL8One57YdeHa7XxGZM-ptDPCeDSymBc7-Bo_hkA,41154
66
+ ee/tests/clusterer_test.py,sha256=B4m06wAtBeqvnIhRD2lnNy1UHDB_caleK_CqcrAU8dk,11620
67
+ ee/tests/collection_test.py,sha256=dnZwFADWQ8oShJHRTcYSzuP-waAxetTdM_CtVckWbMM,7563
68
+ ee/tests/computedobject_test.py,sha256=B27rDq9Urpvy0WqpdbKRYbt6AcT1i93HX-es7hrhWVY,4840
69
+ ee/tests/confusionmatrix_test.py,sha256=46JJh1-91AiYISXWZ6-2lvY5_Njvc8ompO9kmwqlFdg,7437
70
+ ee/tests/data_test.py,sha256=WxNDhGA-wLNvyX45_KfS49l28QmLs8CKXL6zWeVQKBs,35294
71
+ ee/tests/daterange_test.py,sha256=a5fpg2lko3kCJzxQPCoAc_vjXkKy2zYcXbeSZKAFovI,8583
72
+ ee/tests/deprecation_test.py,sha256=_sCs59l6c-ijeyt5yPO-IRJsh8GGPp7ArSg3Y12u4mQ,8352
73
+ ee/tests/deserializer_test.py,sha256=-tbrL0cjrXdSLF7M3wl-QQuj6TjXJdkjp7RZvVErUy4,3427
74
+ ee/tests/dictionary_test.py,sha256=_OCE4i-NWECPnnrT4C54nUZ_2V8PyZvpTqAdKHAkvq8,11809
75
+ ee/tests/ee_array_test.py,sha256=JVXShdbOVOjlfSpNgYc_NVrknQatuPOZ19fG0Ii5yVU,50268
76
+ ee/tests/ee_date_test.py,sha256=8rLUXfjyiW3LiBOCSneA7ZGgmoFgN5oZr58x5THtKGY,11106
77
+ ee/tests/ee_list_test.py,sha256=yd2EWZGdg7pLJhsHSR5AbK58ZhT31GY-n2o1dDT3p9A,21797
78
+ ee/tests/ee_number_test.py,sha256=3MxX8Awie_L3FfwyltrL2UXNdqTyvtYJB9qIi73wlPM,33442
79
+ ee/tests/ee_string_test.py,sha256=9QuseILwZtbcczCyNyJ751kva96_9gPKXLRdgkgWMPs,9389
80
+ ee/tests/ee_test.py,sha256=wTg7mS5dxWtZr5QDpLjsI8LBOQmw5INT6gxo1MBjAGI,17061
81
+ ee/tests/ee_types_test.py,sha256=oRnqplaTWg47zuYfAYTTVwembCnw8XT20HPNMdAvgNE,921
82
+ ee/tests/element_test.py,sha256=Kqu_Z65FQcYHX4LebKm3LD0mWkRTRZccs-qAGz3bLsE,1964
83
+ ee/tests/errormargin_test.py,sha256=YEBzvBFsD756nicZBcjnPFAXy06jZNKiSSAa2hAzN-M,5061
84
+ ee/tests/feature_test.py,sha256=9SotWgRsQ48xZ9N-grlEWZjeamsWweXPS4sMSZCGX-s,22505
85
+ ee/tests/featurecollection_test.py,sha256=b3SwieXb8nyRzAlwKK_nSa4xGcy5AynIDZ1A3sV02Es,38440
86
+ ee/tests/filter_test.py,sha256=d-KQ_zI-r7BAMazKqqHMMzNUZdeC46BZiciMfthKEO8,35033
87
+ ee/tests/function_test.py,sha256=NbluwBCuWUZSzbMLAa04OP_qd95ibMjJWWNuM2P3Izo,3121
88
+ ee/tests/geometry_point_test.py,sha256=w9MYTwvw2Co9rIjffFB0ezQ_jZz8nxbdgOcyhqTTmjk,15093
89
+ ee/tests/geometry_test.py,sha256=z010i7CgwX8taJGk0NaMh6ArUDTIZllFgyZrMSpNFlI,30732
90
+ ee/tests/image_converter_test.py,sha256=uRXYOCU3a0ZaRTHw-ovVP8FJC2mVE9wbHd3JzoExkPs,1885
91
+ ee/tests/image_test.py,sha256=_SJmee7orPot26vbxKEZcNZ6OsrNrxv3ToInWYLNZLM,150917
92
+ ee/tests/imagecollection_test.py,sha256=qosRZXCbhwFuy8qR7DbA-FMl4ktW7Y2cUJHeXLcszpg,38444
93
+ ee/tests/join_test.py,sha256=pFILq3qM27rO64WYbBC1A_Gs8_pabRv68X7MU_EM_cw,7630
94
+ ee/tests/kernel_test.py,sha256=ZblWHqgleJ-7C4lnL7awxfR1mcYtcxpXkkKUziKG2cA,19249
95
+ ee/tests/model_test.py,sha256=f2oLaDaAEr23QjkIAhBKY1Mt8CSRmo5N1-fyYRGd5j8,12053
96
+ ee/tests/oauth_test.py,sha256=hAGvot2xj1MFW6IdD1QAmSNIiuu4z4gCs3beRhp3U_k,2277
97
+ ee/tests/pixeltype_test.py,sha256=00IWKnZ7xxkVwSSCuWOlCwlTsHAb3XPyKp1Arc4S12U,10024
98
+ ee/tests/projection_test.py,sha256=fKXXxQPBvWdlMNtNsJze2pbsT0yHHlL7ON8Pdjm1Z7E,6871
99
+ ee/tests/reducer_test.py,sha256=NYJTmX6AmBZyXGjOkgUh4t3tB6E8_vGlPYQIxJQbV9Q,31518
100
+ ee/tests/serializer_test.py,sha256=xZQBQMDK8dlGYLS-6s1JHhR1L5FKoaIwEkxdKlcpQTE,8802
101
+ ee/tests/table_converter_test.py,sha256=2F7DyEj-iHVbt9-W1iwAHDl-K1GA_2QHalTXzac2ot8,3373
102
+ ee/tests/terrain_test.py,sha256=8TmvGconOR-GkGrll4joXhpU9zi0b_8GFxvX_JlcCos,4328
103
+ earthengine_api-1.6.0rc0.dist-info/METADATA,sha256=xA1DiGvIHjXTUSyn2hDPyYP2ckUpYqqhobb4pkcs7gs,2145
104
+ earthengine_api-1.6.0rc0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
105
+ earthengine_api-1.6.0rc0.dist-info/entry_points.txt,sha256=-Ax4SCU-S474r8OD2LIxata6PRmkZoDrppQ4fP_exNc,50
106
+ earthengine_api-1.6.0rc0.dist-info/top_level.txt,sha256=go5zOwCgm5lIS3yTR-Vsxp1gNI4qdS-MP5eY-7zMxVY,3
107
+ earthengine_api-1.6.0rc0.dist-info/RECORD,,
ee/__init__.py CHANGED
@@ -1,16 +1,17 @@
1
1
  """The EE Python library."""
2
2
 
3
- __version__ = '1.5.24rc0'
3
+ __version__ = '1.6.0rc0'
4
4
 
5
5
  # Using lowercase function naming to match the JavaScript names.
6
6
  # pylint: disable=g-bad-name
7
7
 
8
8
  import collections
9
+ from collections.abc import Hashable, Sequence
9
10
  import datetime
10
11
  import inspect
11
12
  import os
12
13
  import re
13
- from typing import Any, Hashable, Optional, Sequence, Type, Union
14
+ from typing import Any, Optional, Type, Union
14
15
 
15
16
  from google.oauth2 import service_account
16
17
 
@@ -311,7 +312,7 @@ def _Promote(arg: Optional[Any], a_class: str) -> Optional[Any]:
311
312
  return Element(arg.func, arg.args, arg.varName)
312
313
  else:
313
314
  # No way to convert.
314
- raise EEException('Cannot convert {0} to Element.'.format(arg))
315
+ raise EEException(f'Cannot convert {arg} to Element.')
315
316
  elif a_class == 'Geometry':
316
317
  if isinstance(arg, Collection):
317
318
  return ApiFunction.call_('Collection.geometry', arg)
@@ -340,7 +341,7 @@ def _Promote(arg: Optional[Any], a_class: str) -> Optional[Any]:
340
341
  # Image.parseExpression().
341
342
  return arg
342
343
  else:
343
- raise EEException('Argument is not a function: {0}'.format(arg))
344
+ raise EEException(f'Argument is not a function: {arg}')
344
345
  elif a_class == 'Dictionary':
345
346
  if isinstance(arg, dict):
346
347
  return arg
@@ -372,7 +373,7 @@ def _Promote(arg: Optional[Any], a_class: str) -> Optional[Any]:
372
373
  # arg is the name of a method in a_class.
373
374
  return getattr(cls, arg)()
374
375
  else:
375
- raise EEException('Unknown algorithm: {0}.{1}'.format(a_class, arg))
376
+ raise EEException(f'Unknown algorithm: {a_class}.{arg}')
376
377
  else:
377
378
  # Client-side cast.
378
379
  return cls(arg)
@@ -419,9 +420,9 @@ def _InitializeGeneratedClasses() -> None:
419
420
  """Generate classes for extra types that appear in the web API."""
420
421
  signatures = ApiFunction.allSignatures()
421
422
  # Collect the first part of all function names.
422
- names = set([name.split('.')[0] for name in signatures])
423
+ names = {name.split('.')[0] for name in signatures}
423
424
  # Collect the return types of all functions.
424
- returns = set([signatures[sig]['returns'] for sig in signatures])
425
+ returns = {signatures[sig]['returns'] for sig in signatures}
425
426
 
426
427
  want = [name for name in names.intersection(returns) if name not in globals()]
427
428
 
@@ -435,7 +436,7 @@ def _InitializeGeneratedClasses() -> None:
435
436
  types._registerClasses(globals()) # pylint: disable=protected-access
436
437
 
437
438
 
438
- def _MakeClass(name: str) -> Type[Any]:
439
+ def _MakeClass(name: str) -> type[Any]:
439
440
  """Generates a dynamic API class for a given name."""
440
441
 
441
442
  def init(self, *args, **kwargs):
@@ -480,11 +481,11 @@ def _MakeClass(name: str) -> Type[Any]:
480
481
  if not onlyOneArg:
481
482
  # We don't know what to do with multiple args.
482
483
  raise EEException(
483
- 'Too many arguments for ee.{0}(): {1}'.format(name, args))
484
+ f'Too many arguments for ee.{name}(): {args}')
484
485
  elif firstArgIsPrimitive:
485
486
  # Can't cast a primitive.
486
487
  raise EEException(
487
- 'Invalid argument for ee.{0}(): {1}. '
488
+ 'Invalid argument for ee.{}(): {}. '
488
489
  'Must be a ComputedObject.'.format(name, args))
489
490
 
490
491
  result = args[0]
ee/_arg_types.py CHANGED
@@ -1,8 +1,9 @@
1
1
  """Internal types used to represent arguments to the API."""
2
2
  from __future__ import annotations
3
3
 
4
+ from collections.abc import Sequence
4
5
  import datetime
5
- from typing import Any as AnyType, Sequence, Union
6
+ from typing import Any as AnyType, Union
6
7
 
7
8
  from ee import classifier
8
9
  from ee import clusterer
ee/_cloud_api_utils.py CHANGED
@@ -6,12 +6,13 @@ parameters and result values.
6
6
  """
7
7
 
8
8
  import calendar
9
+ from collections.abc import Sequence
9
10
  import copy
10
11
  import datetime
11
12
  import json
12
13
  import os
13
14
  import re
14
- from typing import Any, Callable, Optional, Sequence, Type, Union
15
+ from typing import Any, Callable, Optional, Type, Union
15
16
  import warnings
16
17
 
17
18
  import google_auth_httplib2
@@ -56,7 +57,7 @@ class _Http:
56
57
  body: Optional[str] = None,
57
58
  headers: Optional[dict[str, str]] = None,
58
59
  redirections: Optional[int] = None,
59
- connection_type: Optional[Type[Any]] = None,
60
+ connection_type: Optional[type[Any]] = None,
60
61
  ) -> tuple[httplib2.Response, Any]:
61
62
  """Makes an HTTP request using httplib2 semantics."""
62
63
  del connection_type # Ignored
@@ -434,7 +435,7 @@ def _convert_list_images_filter_params_to_list_assets_params(params) -> str:
434
435
  # query in a set of double quotes. We trivially avoid doubly-escaping the
435
436
  # quotes by replacing double quotes with single quotes.
436
437
  region = region.replace('"', "'")
437
- query_strings.append('intersects("{}")'.format(region))
438
+ query_strings.append(f'intersects("{region}")')
438
439
  del params['region']
439
440
  if 'properties' in params:
440
441
  if isinstance(params['properties'], list) and any(
@@ -534,9 +535,9 @@ def convert_asset_id_to_asset_name(asset_id: str) -> str:
534
535
  if re.match(ASSET_NAME_PATTERN, asset_id) or is_asset_root(asset_id):
535
536
  return asset_id
536
537
  elif asset_id.split('/')[0] in ['users', 'projects']:
537
- return 'projects/earthengine-legacy/assets/{}'.format(asset_id)
538
+ return f'projects/earthengine-legacy/assets/{asset_id}'
538
539
  else:
539
- return 'projects/earthengine-public/assets/{}'.format(asset_id)
540
+ return f'projects/earthengine-public/assets/{asset_id}'
540
541
 
541
542
 
542
543
  def split_asset_name(asset_name: str) -> tuple[str, str]:
@@ -561,7 +562,7 @@ def convert_operation_name_to_task_id(operation_name: str) -> str:
561
562
 
562
563
  def convert_task_id_to_operation_name(task_id: str) -> str:
563
564
  """Converts a task ID to an Operation name."""
564
- return 'projects/{}/operations/{}'.format(_cloud_api_user_project, task_id)
565
+ return f'projects/{_cloud_api_user_project}/operations/{task_id}'
565
566
 
566
567
 
567
568
  def convert_params_to_image_manifest(params: dict[str, Any]) -> dict[str, Any]:
ee/_helpers.py CHANGED
@@ -7,10 +7,11 @@ referenced from there (e.g., "ee.profilePrinting").
7
7
  # Using lowercase function naming to match the JavaScript names.
8
8
  # pylint: disable=g-bad-name
9
9
 
10
+ from collections.abc import Iterator
10
11
  import contextlib
11
12
  import json
12
13
  import sys
13
- from typing import Any, Iterator, Optional, TextIO, Union
14
+ from typing import Any, Optional, TextIO, Union
14
15
 
15
16
  from google.auth import crypt
16
17
  from google.oauth2 import service_account
@@ -59,7 +60,7 @@ def ServiceAccountCredentials(
59
60
 
60
61
  # Probably a PEM key - just read the file into 'key_data'.
61
62
  if key_file:
62
- with open(key_file, 'r') as file_:
63
+ with open(key_file) as file_:
63
64
  key_data = file_.read()
64
65
 
65
66
  # Raw PEM key.
ee/apifunction.py CHANGED
@@ -18,7 +18,7 @@ from __future__ import annotations
18
18
  import copy
19
19
  import keyword
20
20
  import re
21
- from typing import Any, Optional, Type
21
+ from typing import Any
22
22
 
23
23
  from ee import _utils
24
24
  from ee import computedobject
@@ -41,7 +41,7 @@ class ApiFunction(function.Function):
41
41
  _bound_signatures: set[str] = set()
42
42
 
43
43
  @_utils.accept_opt_prefix('opt_signature')
44
- def __init__(self, name: str, signature: Optional[dict[str, Any]] = None):
44
+ def __init__(self, name: str, signature: dict[str, Any] | None = None):
45
45
  """Creates a function defined by the EE API.
46
46
 
47
47
  Args:
@@ -113,15 +113,17 @@ class ApiFunction(function.Function):
113
113
  def allSignatures(cls) -> dict[str, dict[str, Any]]:
114
114
  """Returns a map from the name to signature for all API functions."""
115
115
  cls.initialize()
116
- return dict([(name, func.getSignature())
117
- for name, func in cls._api.items()])
116
+ return {name: func.getSignature() for name, func in cls._api.items()}
118
117
 
119
118
  @classmethod
120
119
  def unboundFunctions(cls) -> dict[str, Any]:
121
120
  """Returns the functions that have not been bound using importApi() yet."""
122
121
  cls.initialize()
123
- return dict([(name, func) for name, func in cls._api.items()
124
- if name not in cls._bound_signatures])
122
+ return {
123
+ name: func
124
+ for name, func in cls._api.items()
125
+ if name not in cls._bound_signatures
126
+ }
125
127
 
126
128
  # TODO(user): Any -> ApiFunction for the return type.
127
129
  @classmethod
@@ -142,7 +144,7 @@ class ApiFunction(function.Function):
142
144
  return result
143
145
 
144
146
  @classmethod
145
- def lookupInternal(cls, name: str) -> Optional[ApiFunction]:
147
+ def lookupInternal(cls, name: str) -> ApiFunction | None:
146
148
  """Looks up an API function by name.
147
149
 
148
150
  Args:
@@ -181,7 +183,7 @@ class ApiFunction(function.Function):
181
183
  target: Any,
182
184
  prefix: str,
183
185
  type_name: str,
184
- prepend: Optional[str] = None,
186
+ prepend: str | None = None,
185
187
  ) -> None:
186
188
  """Adds all API functions that begin with a given prefix to a target class.
187
189
 
@@ -248,7 +250,7 @@ class ApiFunction(function.Function):
248
250
  setattr(target, fname, bound_function)
249
251
 
250
252
  @staticmethod
251
- def clearApi(target: Type[Any]) -> None:
253
+ def clearApi(target: type[Any]) -> None:
252
254
  """Removes all methods added by importApi() from a target class.
253
255
 
254
256
  Args:
ee/apitestcase.py CHANGED
@@ -1,9 +1,10 @@
1
1
  """A TestCase that initializes the library with standard API methods."""
2
2
 
3
+ from collections.abc import Iterable
3
4
  import contextlib
4
5
  import json
5
6
  import os
6
- from typing import Any, Iterable, Optional
7
+ from typing import Any, Optional
7
8
 
8
9
  from googleapiclient import discovery
9
10
 
ee/batch.py CHANGED
@@ -9,10 +9,11 @@ The public function styling uses camelCase to match the JavaScript names.
9
9
 
10
10
  from __future__ import annotations
11
11
 
12
+ from collections.abc import Sequence
12
13
  import enum
13
14
  import json
14
15
  import re
15
- from typing import Any, Optional, Sequence, Union
16
+ from typing import Any
16
17
 
17
18
  from ee import _cloud_api_utils
18
19
  from ee import data
@@ -54,14 +55,14 @@ class Task:
54
55
  CANCELLED = 'CANCELLED'
55
56
 
56
57
  @classmethod
57
- def active(cls, state: Union[str, Task.State]) -> bool:
58
+ def active(cls, state: str | Task.State) -> bool:
58
59
  """Returns True if the given state is an active one."""
59
60
  if isinstance(state, str):
60
61
  state = cls(state)
61
62
  return state in (cls.READY, cls.RUNNING, cls.CANCEL_REQUESTED)
62
63
 
63
64
  @classmethod
64
- def success(cls, state: Union[str, Task.State]) -> bool:
65
+ def success(cls, state: str | Task.State) -> bool:
65
66
  """Returns True if the given state indicates a completed task."""
66
67
  if isinstance(state, str):
67
68
  state = cls(state)
@@ -74,22 +75,22 @@ class Task:
74
75
  FEATURE_VIEW = 'FEATURE_VIEW'
75
76
  BIGQUERY = 'BIGQUERY'
76
77
 
77
- config: Optional[dict[str, Any]]
78
- id: Optional[str]
79
- name: Optional[str]
78
+ config: dict[str, Any] | None
79
+ id: str | None
80
+ name: str | None
80
81
  state: State
81
82
  task_type: Type
82
- workload_tag: Optional[Union[int, str]]
83
+ workload_tag: int | str | None
83
84
 
84
- _request_id: Optional[str]
85
+ _request_id: str | None
85
86
 
86
87
  def __init__(
87
88
  self,
88
- task_id: Optional[str],
89
+ task_id: str | None,
89
90
  task_type: Type,
90
91
  state: State,
91
- config: Optional[dict[str, Any]] = None,
92
- name: Optional[str] = None,
92
+ config: dict[str, Any] | None = None,
93
+ name: str | None = None,
93
94
  ):
94
95
  """Creates a Task with the given ID and configuration.
95
96
 
@@ -121,7 +122,7 @@ class Task:
121
122
  self.name = name
122
123
 
123
124
  @property
124
- def operation_name(self) -> Optional[str]:
125
+ def operation_name(self) -> str | None:
125
126
  if self.name:
126
127
  return self.name
127
128
  if self.id:
@@ -152,8 +153,7 @@ class Task:
152
153
  elif self.task_type == Task.Type.EXPORT_CLASSIFIER:
153
154
  result = data.exportClassifier(self._request_id, self.config)
154
155
  else:
155
- raise ee_exception.EEException(
156
- 'Unknown Task type "{}"'.format(self.task_type))
156
+ raise ee_exception.EEException(f'Unknown Task type "{self.task_type}"')
157
157
  if not self.id:
158
158
  self.id = _cloud_api_utils.convert_operation_name_to_task_id(
159
159
  result['name'])
@@ -204,11 +204,13 @@ class Task:
204
204
  def __repr__(self) -> str:
205
205
  """Returns a string representation of the task."""
206
206
  if self.config and self.id:
207
- return '<Task %s %s: %s (%s)>' % (self.id, self.task_type,
208
- self.config['description'], self.state)
207
+ return '<Task {} {}: {} ({})>'.format(
208
+ self.id, self.task_type, self.config['description'], self.state
209
+ )
209
210
  elif self.config:
210
- return '<Task %s: %s (%s)>' % (self.task_type, self.config['description'],
211
- self.state)
211
+ return '<Task {}: {} ({})>'.format(
212
+ self.task_type, self.config['description'], self.state
213
+ )
212
214
  else:
213
215
  return '<Task "%s">' % self.id
214
216
 
@@ -231,7 +233,7 @@ class Export:
231
233
  cls,
232
234
  image: Any,
233
235
  description: str = 'myExportImageTask',
234
- config: Optional[dict[str, Any]] = None,
236
+ config: dict[str, Any] | None = None,
235
237
  ):
236
238
  """Creates a task to export an EE Image to Google Drive or Cloud Storage.
237
239
 
@@ -1231,8 +1233,7 @@ def _prepare_image_export_config(
1231
1233
  if config:
1232
1234
  if 'skipEmptyTiles' in config:
1233
1235
  raise ValueError('skipEmptyTiles is only supported for GeoTIFF exports.')
1234
- raise ee_exception.EEException(
1235
- 'Unknown configuration options: {}.'.format(config))
1236
+ raise ee_exception.EEException(f'Unknown configuration options: {config}.')
1236
1237
 
1237
1238
  return request
1238
1239
 
@@ -1279,8 +1280,7 @@ def _prepare_map_export_config(
1279
1280
  # for JSON encoding.
1280
1281
  request['priority'] = {'value': int(config.pop('priority'))}
1281
1282
  if config:
1282
- raise ee_exception.EEException(
1283
- 'Unknown configuration options: {}.'.format(config))
1283
+ raise ee_exception.EEException(f'Unknown configuration options: {config}.')
1284
1284
  return request
1285
1285
 
1286
1286
 
@@ -1351,8 +1351,7 @@ def _prepare_table_export_config(
1351
1351
  request['priority'] = {'value': int(config.pop('priority'))}
1352
1352
 
1353
1353
  if config:
1354
- raise ee_exception.EEException(
1355
- 'Unknown configuration options: {}.'.format(config))
1354
+ raise ee_exception.EEException(f'Unknown configuration options: {config}.')
1356
1355
  return request
1357
1356
 
1358
1357
 
@@ -1394,8 +1393,7 @@ def _prepare_video_export_config(
1394
1393
  request['priority'] = {'value': int(config.pop('priority'))}
1395
1394
 
1396
1395
  if config:
1397
- raise ee_exception.EEException(
1398
- 'Unknown configuration options: {}.'.format(config))
1396
+ raise ee_exception.EEException(f'Unknown configuration options: {config}.')
1399
1397
  return request
1400
1398
 
1401
1399
 
@@ -1427,7 +1425,8 @@ def _build_image_file_export_options(
1427
1425
  config)
1428
1426
  else:
1429
1427
  raise ee_exception.EEException(
1430
- '"{}" is not a valid export destination'.format(export_destination))
1428
+ f'"{export_destination}" is not a valid export destination'
1429
+ )
1431
1430
 
1432
1431
  file_format_options = config.pop(IMAGE_FORMAT_OPTIONS_FIELD, {})
1433
1432
 
@@ -1499,7 +1498,8 @@ def _build_image_file_export_options(
1499
1498
 
1500
1499
  if file_format_options:
1501
1500
  raise ee_exception.EEException(
1502
- 'Unknown file format options: {}.'.format(file_format_options))
1501
+ f'Unknown file format options: {file_format_options}.'
1502
+ )
1503
1503
 
1504
1504
  return file_export_options
1505
1505
 
@@ -1531,7 +1531,8 @@ def _build_table_file_export_options(
1531
1531
  config)
1532
1532
  else:
1533
1533
  raise ee_exception.EEException(
1534
- '"{}" is not a valid export destination'.format(export_destination))
1534
+ f'"{export_destination}" is not a valid export destination'
1535
+ )
1535
1536
  return file_export_options
1536
1537
 
1537
1538
 
@@ -1584,7 +1585,8 @@ def _build_video_file_export_options(
1584
1585
  config)
1585
1586
  else:
1586
1587
  raise ee_exception.EEException(
1587
- '"{}" is not a valid export destination'.format(export_destination))
1588
+ f'"{export_destination}" is not a valid export destination'
1589
+ )
1588
1590
  return file_export_options
1589
1591
 
1590
1592
 
@@ -1773,10 +1775,11 @@ def _get_rank_by_one_thing_rule(rule_str: str) -> dict[str, Any]:
1773
1775
  matches = re.findall(r'^([\S]+.*)\s+(ASC|DESC)$', rule_str.strip())
1774
1776
  if not matches:
1775
1777
  raise ee_exception.EEException(
1776
- ('Ranking rule format is invalid. Each rule should be defined by a '
1777
- 'rule type and a direction (ASC or DESC), separated by a space. '
1778
- 'Valid rule types are: .geometryType, .minZoomLevel, or a feature '
1779
- 'property name.'))
1778
+ 'Ranking rule format is invalid. Each rule should be defined by a '
1779
+ 'rule type and a direction (ASC or DESC), separated by a space. '
1780
+ 'Valid rule types are: .geometryType, .minZoomLevel, or a feature '
1781
+ 'property name.'
1782
+ )
1780
1783
 
1781
1784
  output = {}
1782
1785
  rule_type, rule_dir = matches[0]
@@ -1796,8 +1799,8 @@ def _get_rank_by_one_thing_rule(rule_str: str) -> dict[str, Any]:
1796
1799
 
1797
1800
 
1798
1801
  def _get_ranking_rule(
1799
- rules: Optional[Union[str, list[str]]]
1800
- ) -> Optional[dict[str, list[dict[str, Any]]]]:
1802
+ rules: str | list[str] | None,
1803
+ ) -> dict[str, list[dict[str, Any]]] | None:
1801
1804
  """Returns a RankingRule dict created from the rank-by-one-thing rules.
1802
1805
 
1803
1806
  Args:
@@ -1819,11 +1822,12 @@ def _get_ranking_rule(
1819
1822
  return {'rankByOneThingRule': rank_by_one_thing_rules}
1820
1823
 
1821
1824
  raise ee_exception.EEException(
1822
- ('Unable to build ranking rule from rules. Rules should '
1823
- 'either be a comma-separated string or list of strings.'))
1825
+ 'Unable to build ranking rule from rules. Rules should '
1826
+ 'either be a comma-separated string or list of strings.'
1827
+ )
1824
1828
 
1825
1829
 
1826
- def _build_thinning_options(config: dict[str, Any]) -> Optional[dict[str, Any]]:
1830
+ def _build_thinning_options(config: dict[str, Any]) -> dict[str, Any] | None:
1827
1831
  """Returns a ThinningOptions dict created from the config.
1828
1832
 
1829
1833
  Args:
@@ -1843,7 +1847,7 @@ def _build_thinning_options(config: dict[str, Any]) -> Optional[dict[str, Any]]:
1843
1847
  return output
1844
1848
 
1845
1849
 
1846
- def _build_ranking_options(config: dict[str, Any]) -> Optional[dict[str, Any]]:
1850
+ def _build_ranking_options(config: dict[str, Any]) -> dict[str, Any] | None:
1847
1851
  """Returns a RankingOptions dict created from the config.
1848
1852
 
1849
1853
  Args:
@@ -2027,7 +2031,7 @@ def _canonicalize_parameters(config, destination):
2027
2031
 
2028
2032
 
2029
2033
  def _canonicalize_region(
2030
- region: Union[str, geometry.Geometry, Any]
2034
+ region: str | geometry.Geometry | Any,
2031
2035
  ) -> geometry.Geometry:
2032
2036
  """Converts a region parameter to a form appropriate for export."""
2033
2037
  region_error = ee_exception.EEException(
ee/blob.py CHANGED
@@ -1,7 +1,7 @@
1
1
  """A wrapper for Blobs."""
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
@@ -84,7 +84,7 @@ class Blob(computedobject.ComputedObject):
84
84
  return 'Blob'
85
85
 
86
86
  def string(
87
- self, encoding: Optional[_arg_types.String] = None
87
+ self, encoding: _arg_types.String | None = None
88
88
  ) -> ee_string.String:
89
89
  """Returns the contents of the blob as a String.
90
90