earthengine-api 1.5.9rc2__tar.gz → 1.5.10rc0__tar.gz

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 (113) hide show
  1. {earthengine_api-1.5.9rc2/earthengine_api.egg-info → earthengine_api-1.5.10rc0}/PKG-INFO +1 -1
  2. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0/earthengine_api.egg-info}/PKG-INFO +1 -1
  3. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/__init__.py +1 -1
  4. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/cli/commands.py +3 -0
  5. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/data.py +5 -4
  6. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/data_test.py +82 -0
  7. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/pyproject.toml +1 -1
  8. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/LICENSE +0 -0
  9. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/MANIFEST.in +0 -0
  10. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/README.md +0 -0
  11. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/earthengine_api.egg-info/SOURCES.txt +0 -0
  12. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/earthengine_api.egg-info/dependency_links.txt +0 -0
  13. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/earthengine_api.egg-info/entry_points.txt +0 -0
  14. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/earthengine_api.egg-info/requires.txt +0 -0
  15. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/earthengine_api.egg-info/top_level.txt +0 -0
  16. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/_arg_types.py +0 -0
  17. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/_cloud_api_utils.py +0 -0
  18. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/_helpers.py +0 -0
  19. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/_utils.py +0 -0
  20. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/apifunction.py +0 -0
  21. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/apitestcase.py +0 -0
  22. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/batch.py +0 -0
  23. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/blob.py +0 -0
  24. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/classifier.py +0 -0
  25. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/cli/__init__.py +0 -0
  26. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/cli/eecli.py +0 -0
  27. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/cli/eecli_wrapper.py +0 -0
  28. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/cli/utils.py +0 -0
  29. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/clusterer.py +0 -0
  30. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/collection.py +0 -0
  31. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/computedobject.py +0 -0
  32. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/confusionmatrix.py +0 -0
  33. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/customfunction.py +0 -0
  34. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/daterange.py +0 -0
  35. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/deprecation.py +0 -0
  36. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/deserializer.py +0 -0
  37. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/dictionary.py +0 -0
  38. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/ee_array.py +0 -0
  39. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/ee_date.py +0 -0
  40. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/ee_exception.py +0 -0
  41. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/ee_list.py +0 -0
  42. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/ee_number.py +0 -0
  43. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/ee_string.py +0 -0
  44. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/ee_types.py +0 -0
  45. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/element.py +0 -0
  46. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/encodable.py +0 -0
  47. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/errormargin.py +0 -0
  48. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/feature.py +0 -0
  49. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/featurecollection.py +0 -0
  50. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/filter.py +0 -0
  51. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/function.py +0 -0
  52. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/geometry.py +0 -0
  53. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/image.py +0 -0
  54. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/image_converter.py +0 -0
  55. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/imagecollection.py +0 -0
  56. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/join.py +0 -0
  57. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/kernel.py +0 -0
  58. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/mapclient.py +0 -0
  59. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/model.py +0 -0
  60. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/oauth.py +0 -0
  61. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/pixeltype.py +0 -0
  62. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/projection.py +0 -0
  63. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/py.typed +0 -0
  64. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/reducer.py +0 -0
  65. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/serializer.py +0 -0
  66. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/table_converter.py +0 -0
  67. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/terrain.py +0 -0
  68. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/_cloud_api_utils_test.py +0 -0
  69. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/_helpers_test.py +0 -0
  70. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/_utils_test.py +0 -0
  71. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/algorithms.json +0 -0
  72. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/apifunction_test.py +0 -0
  73. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/batch_test.py +0 -0
  74. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/blob_test.py +0 -0
  75. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/classifier_test.py +0 -0
  76. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/cloud_api_discovery_document.json +0 -0
  77. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/clusterer_test.py +0 -0
  78. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/collection_test.py +0 -0
  79. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/computedobject_test.py +0 -0
  80. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/confusionmatrix_test.py +0 -0
  81. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/daterange_test.py +0 -0
  82. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/deprecation_test.py +0 -0
  83. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/deserializer_test.py +0 -0
  84. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/dictionary_test.py +0 -0
  85. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/ee_array_test.py +0 -0
  86. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/ee_date_test.py +0 -0
  87. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/ee_list_test.py +0 -0
  88. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/ee_number_test.py +0 -0
  89. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/ee_string_test.py +0 -0
  90. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/ee_test.py +0 -0
  91. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/ee_types_test.py +0 -0
  92. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/element_test.py +0 -0
  93. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/errormargin_test.py +0 -0
  94. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/feature_test.py +0 -0
  95. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/featurecollection_test.py +0 -0
  96. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/filter_test.py +0 -0
  97. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/function_test.py +0 -0
  98. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/geometry_point_test.py +0 -0
  99. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/geometry_test.py +0 -0
  100. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/image_converter_test.py +0 -0
  101. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/image_test.py +0 -0
  102. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/imagecollection_test.py +0 -0
  103. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/join_test.py +0 -0
  104. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/kernel_test.py +0 -0
  105. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/model_test.py +0 -0
  106. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/oauth_test.py +0 -0
  107. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/pixeltype_test.py +0 -0
  108. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/projection_test.py +0 -0
  109. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/reducer_test.py +0 -0
  110. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/serializer_test.py +0 -0
  111. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/table_converter_test.py +0 -0
  112. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/ee/tests/terrain_test.py +0 -0
  113. {earthengine_api-1.5.9rc2 → earthengine_api-1.5.10rc0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: earthengine-api
3
- Version: 1.5.9rc2
3
+ Version: 1.5.10rc0
4
4
  Summary: Earth Engine Python API
5
5
  Author-email: Google LLC <noreply@google.com>
6
6
  License: Apache-2.0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: earthengine-api
3
- Version: 1.5.9rc2
3
+ Version: 1.5.10rc0
4
4
  Summary: Earth Engine Python API
5
5
  Author-email: Google LLC <noreply@google.com>
6
6
  License: Apache-2.0
@@ -1,6 +1,6 @@
1
1
  """The EE Python library."""
2
2
 
3
- __version__ = '1.5.9rc2'
3
+ __version__ = '1.5.10rc0'
4
4
 
5
5
  # Using lowercase function naming to match the JavaScript names.
6
6
  # pylint: disable=g-bad-name
@@ -2049,6 +2049,9 @@ class ProjectConfigSetCommand:
2049
2049
  def run(
2050
2050
  self, args: argparse.Namespace, config: utils.CommandLineConfig
2051
2051
  ) -> None:
2052
+ if not args.max_concurrent_exports:
2053
+ raise ValueError('Flag --max_concurrent_exports must be set.')
2054
+
2052
2055
  if args.max_concurrent_exports < 0:
2053
2056
  raise ValueError('"max_concurrent_exports" must be >= 0.')
2054
2057
 
@@ -2331,16 +2331,17 @@ def create_assets(
2331
2331
  asset_ids: Sequence[str], asset_type: str, mk_parents: bool
2332
2332
  ) -> None:
2333
2333
  """Creates the specified assets if they do not exist."""
2334
- for asset_id in asset_ids:
2334
+ ids = [convert_asset_id_to_asset_name(asset_id) for asset_id in asset_ids]
2335
+ for asset_id in ids:
2335
2336
  if getInfo(asset_id):
2336
2337
  print('Asset %s already exists.' % asset_id)
2337
2338
  continue
2338
2339
  if mk_parents:
2339
2340
  parts = asset_id.split('/')
2340
2341
  # We don't need to create the namespace and the user's/project's folder.
2341
- if len(parts) > 2:
2342
- path = parts[0] + '/' + parts[1] + '/'
2343
- for part in parts[2:-1]:
2342
+ if len(parts) > 3:
2343
+ path = '/'.join(parts[0:3]) + '/'
2344
+ for part in parts[3:-1]:
2344
2345
  path += part
2345
2346
  if getInfo(path) is None:
2346
2347
  createAsset({'type': ASSET_TYPE_FOLDER_CLOUD}, path)
@@ -1,8 +1,11 @@
1
1
  #!/usr/bin/env python3
2
2
  """Test for the ee.data module."""
3
3
 
4
+ import json
5
+ from typing import Any, Optional
4
6
  from unittest import mock
5
7
 
8
+ import googleapiclient
6
9
  import httplib2
7
10
  import requests
8
11
 
@@ -14,6 +17,25 @@ from ee import featurecollection
14
17
  from ee import image
15
18
 
16
19
 
20
+ def NotFoundError() -> googleapiclient.errors.HttpError:
21
+ """Creates a mock HttpError with a 404 status code."""
22
+ resp = httplib2.Response({'status': '404', 'reason': 'Not Found'})
23
+ content = json.dumps({'error': {'code': 404, 'message': 'Not Found'}}).encode(
24
+ 'utf-8'
25
+ )
26
+ return googleapiclient.errors.HttpError(resp, content)
27
+
28
+
29
+ def NewFolderAsset(
30
+ name: str, quota: Optional[dict[str, int]] = None
31
+ ) -> dict[str, Any]:
32
+ return {
33
+ 'type': 'FOLDER',
34
+ 'name': name,
35
+ 'quota': quota or {},
36
+ }
37
+
38
+
17
39
  class DataTest(unittest.TestCase):
18
40
 
19
41
  def setUp(self):
@@ -183,6 +205,66 @@ class DataTest(unittest.TestCase):
183
205
  asset = mock_create_asset.call_args.kwargs['body']
184
206
  self.assertEqual(asset, {'type': 'FOLDER'})
185
207
 
208
+ def testCreateAssets(self):
209
+ cloud_api_resource = mock.MagicMock()
210
+ with apitestcase.UsingCloudApi(cloud_api_resource=cloud_api_resource):
211
+ asset_name = 'projects/some-project/assets/some-asset'
212
+ cloud_api_resource.projects().assets().get().execute.side_effect = (
213
+ NotFoundError()
214
+ )
215
+ ee.data.create_assets([asset_name], 'FOLDER', False)
216
+ mock_create_asset = cloud_api_resource.projects().assets().create
217
+ mock_create_asset.assert_called_once_with(
218
+ parent='projects/some-project',
219
+ assetId='some-asset',
220
+ body={'type': 'FOLDER'},
221
+ prettyPrint=False,
222
+ )
223
+
224
+ def testCreateAssets_empty(self):
225
+ cloud_api_resource = mock.MagicMock()
226
+ with apitestcase.UsingCloudApi(cloud_api_resource=cloud_api_resource):
227
+ ee.data.create_assets([], 'FOLDER', False)
228
+ mock_create_asset = cloud_api_resource.projects().assets().create
229
+ mock_create_asset.assert_not_called()
230
+
231
+ def testCreateAssets_noOpIfAssetExists(self):
232
+ cloud_api_resource = mock.MagicMock()
233
+ with apitestcase.UsingCloudApi(cloud_api_resource=cloud_api_resource):
234
+ asset_name = 'projects/some-project/assets/some-asset'
235
+ cloud_api_resource.projects().assets().get.execute.return_value = (
236
+ NewFolderAsset(asset_name)
237
+ )
238
+ ee.data.create_assets([asset_name], 'FOLDER', False)
239
+ mock_create_asset = cloud_api_resource.projects().assets().create
240
+ mock_create_asset.assert_not_called()
241
+
242
+ def testCreateAssets_withParents(self):
243
+ cloud_api_resource = mock.MagicMock()
244
+ with apitestcase.UsingCloudApi(cloud_api_resource=cloud_api_resource):
245
+ asset_name = 'projects/some-project/assets/foo/bar'
246
+ cloud_api_resource.projects().assets().get().execute.side_effect = (
247
+ NotFoundError()
248
+ )
249
+ ee.data.create_assets([asset_name], 'FOLDER', True)
250
+ mock_create_asset = cloud_api_resource.projects().assets().create
251
+ mock_create_asset.assert_has_calls([
252
+ mock.call(
253
+ parent='projects/some-project',
254
+ assetId='foo',
255
+ body={'type': 'FOLDER'},
256
+ prettyPrint=False,
257
+ ),
258
+ mock.call().execute(num_retries=5),
259
+ mock.call(
260
+ parent='projects/some-project',
261
+ assetId='foo/bar',
262
+ body={'type': 'FOLDER'},
263
+ prettyPrint=False,
264
+ ),
265
+ mock.call().execute(num_retries=5),
266
+ ])
267
+
186
268
  def testStartIngestion(self):
187
269
  cloud_api_resource = mock.MagicMock()
188
270
  with apitestcase.UsingCloudApi(cloud_api_resource=cloud_api_resource):
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "earthengine-api"
3
- version = "1.5.9rc2"
3
+ version = "1.5.10rc0"
4
4
  description = "Earth Engine Python API"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.9"