geobox 1.1.0__tar.gz → 1.1.1__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.
- {geobox-1.1.0 → geobox-1.1.1}/PKG-INFO +1 -1
- {geobox-1.1.0 → geobox-1.1.1}/geobox/api.py +5 -5
- {geobox-1.1.0 → geobox-1.1.1}/geobox/enums.py +1 -1
- {geobox-1.1.0 → geobox-1.1.1}/geobox/file.py +6 -10
- {geobox-1.1.0 → geobox-1.1.1}/geobox.egg-info/PKG-INFO +1 -1
- {geobox-1.1.0 → geobox-1.1.1}/pyproject.toml +1 -1
- {geobox-1.1.0 → geobox-1.1.1}/tests/test_api.py +4 -4
- {geobox-1.1.0 → geobox-1.1.1}/tests/test_file.py +7 -10
- {geobox-1.1.0 → geobox-1.1.1}/LICENSE +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/README.md +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/geobox/__init__.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/geobox/apikey.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/geobox/attachment.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/geobox/base.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/geobox/basemap.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/geobox/dashboard.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/geobox/exception.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/geobox/feature.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/geobox/field.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/geobox/log.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/geobox/map.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/geobox/model3d.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/geobox/mosaic.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/geobox/plan.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/geobox/query.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/geobox/raster.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/geobox/route.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/geobox/scene.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/geobox/settings.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/geobox/task.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/geobox/tile3d.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/geobox/tileset.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/geobox/usage.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/geobox/user.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/geobox/utils.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/geobox/vectorlayer.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/geobox/version.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/geobox/view.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/geobox/workflow.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/geobox.egg-info/SOURCES.txt +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/geobox.egg-info/dependency_links.txt +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/geobox.egg-info/requires.txt +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/geobox.egg-info/top_level.txt +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/setup.cfg +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/tests/test_apikey.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/tests/test_attachment.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/tests/test_basemap.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/tests/test_dashboard.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/tests/test_feature.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/tests/test_field.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/tests/test_log.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/tests/test_map.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/tests/test_model3d.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/tests/test_mosaic.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/tests/test_plan.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/tests/test_query.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/tests/test_raster.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/tests/test_route.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/tests/test_scene.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/tests/test_settings.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/tests/test_task.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/tests/test_tile3d.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/tests/test_tileset.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/tests/test_usage.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/tests/test_user.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/tests/test_vectorlayer.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/tests/test_version.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/tests/test_view.py +0 -0
- {geobox-1.1.0 → geobox-1.1.1}/tests/test_workflow.py +0 -0
|
@@ -597,23 +597,23 @@ class GeoboxClient:
|
|
|
597
597
|
return File.get_file(self, uuid=uuid)
|
|
598
598
|
|
|
599
599
|
|
|
600
|
-
def
|
|
600
|
+
def get_files_by_name(self, name: str, user_id: int = None) -> List['File']:
|
|
601
601
|
"""
|
|
602
|
-
Get
|
|
602
|
+
Get files by name
|
|
603
603
|
|
|
604
604
|
Args:
|
|
605
605
|
name (str): the name of the file to get
|
|
606
606
|
user_id (int, optional): specific user. privileges required.
|
|
607
607
|
|
|
608
608
|
Returns:
|
|
609
|
-
File
|
|
609
|
+
List[File]: returns files that matches the given name
|
|
610
610
|
|
|
611
611
|
Example:
|
|
612
612
|
>>> from geobox import GeoboxClient
|
|
613
613
|
>>> client = GeoboxClient()
|
|
614
|
-
>>>
|
|
614
|
+
>>> files = client.get_files_by_name(name='test')
|
|
615
615
|
"""
|
|
616
|
-
return File.
|
|
616
|
+
return File.get_files_by_name(self, name, user_id)
|
|
617
617
|
|
|
618
618
|
|
|
619
619
|
def upload_file(self, path: str, user_id: int = None, scan_archive: bool = True) -> 'File':
|
|
@@ -188,9 +188,9 @@ class File(Base):
|
|
|
188
188
|
|
|
189
189
|
|
|
190
190
|
@classmethod
|
|
191
|
-
def
|
|
191
|
+
def get_files_by_name(cls, api: 'GeoboxClient', name: str, user_id: int = None) -> List['File']:
|
|
192
192
|
"""
|
|
193
|
-
Get
|
|
193
|
+
Get files by name
|
|
194
194
|
|
|
195
195
|
Args:
|
|
196
196
|
api (GeoboxClient): The GeoboxClient instance for making requests.
|
|
@@ -198,21 +198,17 @@ class File(Base):
|
|
|
198
198
|
user_id (int, optional): specific user. privileges required.
|
|
199
199
|
|
|
200
200
|
Returns:
|
|
201
|
-
File
|
|
201
|
+
List[File]: returns files that matches the given name
|
|
202
202
|
|
|
203
203
|
Example:
|
|
204
204
|
>>> from geobox import GeoboxClient
|
|
205
205
|
>>> from geobox.file import File
|
|
206
206
|
>>> client = GeoboxClient()
|
|
207
|
-
>>>
|
|
207
|
+
>>> files = File.get_file_by_name(client, name='test')
|
|
208
208
|
or
|
|
209
|
-
>>>
|
|
209
|
+
>>> files = client.get_file_by_name(name='test')
|
|
210
210
|
"""
|
|
211
|
-
|
|
212
|
-
if files and files[0].name == name:
|
|
213
|
-
return files[0]
|
|
214
|
-
else:
|
|
215
|
-
return None
|
|
211
|
+
return cls.get_files(api, q=f"name = '{name}'", user_id=user_id)
|
|
216
212
|
|
|
217
213
|
|
|
218
214
|
def _get_save_path(self, save_path: str = None) -> str:
|
|
@@ -737,7 +737,7 @@ def test_get_file(mock_file_data):
|
|
|
737
737
|
assert file.data == mock_file_data
|
|
738
738
|
|
|
739
739
|
|
|
740
|
-
def
|
|
740
|
+
def test_get_files_by_name(mock_file_data):
|
|
741
741
|
with patch('geobox.api.GeoboxClient.get_access_token') as mock_get_token, \
|
|
742
742
|
patch('geobox.api.GeoboxClient.get') as mock_get:
|
|
743
743
|
|
|
@@ -745,10 +745,10 @@ def test_get_file_by_name(mock_file_data):
|
|
|
745
745
|
mock_get.return_value = [mock_file_data]
|
|
746
746
|
|
|
747
747
|
client = GeoboxClient(username='testuser', password='testpassword')
|
|
748
|
-
|
|
748
|
+
files = client.get_files_by_name(name=mock_file_data['name'])
|
|
749
749
|
|
|
750
|
-
assert isinstance(
|
|
751
|
-
assert
|
|
750
|
+
assert isinstance(files[0], File)
|
|
751
|
+
assert files[0].data == mock_file_data
|
|
752
752
|
|
|
753
753
|
|
|
754
754
|
def test_upload_file():
|
|
@@ -108,7 +108,7 @@ def test_get_files(api):
|
|
|
108
108
|
api.get.assert_called_once_with(f"{File.BASE_ENDPOINT}?f=json&search=test&search_fields=name&return_count=False&skip=0&limit=2&shared=False")
|
|
109
109
|
|
|
110
110
|
|
|
111
|
-
def
|
|
111
|
+
def test_get_file(api, mock_file_data):
|
|
112
112
|
"""Test getting file by UUID."""
|
|
113
113
|
with patch.object(api, 'get', return_value=mock_file_data):
|
|
114
114
|
file = File.get_file(api, uuid=mock_file_data['uuid'])
|
|
@@ -118,18 +118,15 @@ def test_get_file_by_uuid(api, mock_file_data):
|
|
|
118
118
|
api.get.assert_called_once_with(f"{file.endpoint}info/?f=json")
|
|
119
119
|
|
|
120
120
|
|
|
121
|
-
def
|
|
121
|
+
def test_get_files_by_name(api, mock_file_data):
|
|
122
122
|
"""Test getting file by name."""
|
|
123
123
|
mock_response = [mock_file_data]
|
|
124
124
|
with patch.object(api, 'get', return_value=mock_response):
|
|
125
|
-
|
|
126
|
-
assert isinstance(
|
|
127
|
-
assert
|
|
128
|
-
assert
|
|
129
|
-
api.get.assert_called_once_with(f"{
|
|
130
|
-
# not found
|
|
131
|
-
file = File.get_file_by_name(api, name='not_found')
|
|
132
|
-
assert file == None
|
|
125
|
+
files = File.get_files_by_name(api, name=mock_file_data['name'])
|
|
126
|
+
assert isinstance(files[0], File)
|
|
127
|
+
assert files[0].uuid == mock_file_data['uuid']
|
|
128
|
+
assert files[0].name == mock_file_data['name']
|
|
129
|
+
api.get.assert_called_once_with(f"{files[0].BASE_ENDPOINT}?f=json&q=name+%3D+%27world_boundaries.shp%27&return_count=False&skip=0&limit=10&shared=False")
|
|
133
130
|
|
|
134
131
|
|
|
135
132
|
def test_download(api, mock_file_data):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|