geobox 2.2.6__py3-none-any.whl → 2.4.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.
Files changed (65) hide show
  1. geobox/aio/api.py +265 -6
  2. geobox/aio/apikey.py +0 -26
  3. geobox/aio/attachment.py +5 -31
  4. geobox/aio/basemap.py +2 -30
  5. geobox/aio/dashboard.py +0 -26
  6. geobox/aio/feature.py +172 -17
  7. geobox/aio/field.py +0 -27
  8. geobox/aio/file.py +0 -26
  9. geobox/aio/layout.py +0 -26
  10. geobox/aio/log.py +0 -27
  11. geobox/aio/map.py +0 -26
  12. geobox/aio/model3d.py +0 -26
  13. geobox/aio/mosaic.py +0 -26
  14. geobox/aio/plan.py +0 -26
  15. geobox/aio/query.py +0 -26
  16. geobox/aio/raster.py +0 -26
  17. geobox/aio/scene.py +1 -26
  18. geobox/aio/settings.py +0 -28
  19. geobox/aio/table.py +1733 -0
  20. geobox/aio/task.py +0 -27
  21. geobox/aio/tile3d.py +0 -26
  22. geobox/aio/tileset.py +1 -26
  23. geobox/aio/usage.py +0 -32
  24. geobox/aio/user.py +0 -59
  25. geobox/aio/vector_tool.py +49 -0
  26. geobox/aio/vectorlayer.py +8 -34
  27. geobox/aio/version.py +1 -25
  28. geobox/aio/view.py +5 -35
  29. geobox/aio/workflow.py +0 -26
  30. geobox/api.py +265 -5
  31. geobox/apikey.py +0 -26
  32. geobox/attachment.py +0 -26
  33. geobox/basemap.py +0 -28
  34. geobox/dashboard.py +0 -26
  35. geobox/enums.py +15 -1
  36. geobox/feature.py +170 -15
  37. geobox/field.py +20 -37
  38. geobox/file.py +0 -26
  39. geobox/layout.py +0 -26
  40. geobox/log.py +0 -26
  41. geobox/map.py +0 -26
  42. geobox/model3d.py +0 -26
  43. geobox/mosaic.py +0 -26
  44. geobox/plan.py +1 -26
  45. geobox/query.py +1 -26
  46. geobox/raster.py +1 -31
  47. geobox/scene.py +1 -27
  48. geobox/settings.py +1 -29
  49. geobox/table.py +1719 -0
  50. geobox/task.py +2 -29
  51. geobox/tile3d.py +0 -26
  52. geobox/tileset.py +1 -26
  53. geobox/usage.py +2 -33
  54. geobox/user.py +1 -59
  55. geobox/vector_tool.py +49 -0
  56. geobox/vectorlayer.py +9 -36
  57. geobox/version.py +1 -26
  58. geobox/view.py +4 -34
  59. geobox/workflow.py +1 -26
  60. {geobox-2.2.6.dist-info → geobox-2.4.0.dist-info}/METADATA +2 -2
  61. geobox-2.4.0.dist-info/RECORD +74 -0
  62. {geobox-2.2.6.dist-info → geobox-2.4.0.dist-info}/WHEEL +1 -1
  63. geobox-2.2.6.dist-info/RECORD +0 -72
  64. {geobox-2.2.6.dist-info → geobox-2.4.0.dist-info}/licenses/LICENSE +0 -0
  65. {geobox-2.2.6.dist-info → geobox-2.4.0.dist-info}/top_level.txt +0 -0
geobox/aio/feature.py CHANGED
@@ -1,13 +1,12 @@
1
1
  from urllib.parse import urljoin
2
- from typing import Optional, List, Dict, Any, TYPE_CHECKING
2
+ from typing import Optional, List, Dict, Any, TYPE_CHECKING, Union
3
3
 
4
4
  from .base import AsyncBase
5
5
  from ..enums import FeatureType
6
6
 
7
7
  if TYPE_CHECKING:
8
- from .vectorlayer import VectorLayer
9
- from ..api import GeoboxClient
10
- from ..feature import Feature
8
+ from .vectorlayer import VectorLayer, AsyncVectorLayer
9
+ from .table import AsyncTable, AsyncTableRow, AsyncRelationship
11
10
 
12
11
 
13
12
  class AsyncFeature(AsyncBase):
@@ -522,26 +521,182 @@ class AsyncFeature(AsyncBase):
522
521
  return self
523
522
 
524
523
 
525
- def to_sync(self, sync_client: 'GeoboxClient') -> 'Feature':
524
+ async def _get_other_side_of_relationship(
525
+ self,
526
+ relationship: 'AsyncRelationship',
527
+ ) -> Union['AsyncTable', 'AsyncVectorLayer']:
526
528
  """
527
- [async] Switch to sync version of the feature instance to have access to the sync methods
529
+ [async] Determine which side of a relationship this table is on and return the opposite side.
530
+
531
+ Used internally to navigate bidirectional relationships.
532
+
533
+ Args:
534
+ relationship (AsyncRelationship): The relationship to examine.
535
+
536
+ Returns:
537
+ AsyncTable | AsyncVectorLayer: The endpoint (table or layer) on the opposite side
538
+ of the relationship from this table.
539
+
540
+ Raises:
541
+ ValueError: If this table is not part of the given relationship.
542
+
543
+ Note:
544
+ This method assumes the table is either the source or target,
545
+ not the relation table in Many-to-Many relationships.
546
+ """
547
+ if relationship.source_id == self.layer.id:
548
+ return await relationship.get_target()
549
+
550
+ if relationship.target_id == self.layer.id:
551
+ return await relationship.get_source()
528
552
 
553
+ raise ValueError("Relationship does not involve this table.")
554
+
555
+
556
+ async def _fetch_related_from_target(
557
+ self,
558
+ target: Union['AsyncTable', 'AsyncVectorLayer'],
559
+ relationship_uuid: str,
560
+ ) -> Union[List['AsyncTableRow'], List['AsyncFeature']]:
561
+ """
562
+ [async] Fetch related rows/features from a relationship target.
563
+
564
+ Internal helper that dispatches to the appropriate API method
565
+ based on target type.
566
+
529
567
  Args:
530
- sync_client (GeoboxClient): The sync version of the GeoboxClient instance for making requests.
568
+ target (AsyncTable | AsyncVectorLayer): The target endpoint (Table or VectorLayer) to query.
569
+ relationship_uuid (str): UUID of the relationship to traverse.
570
+
571
+ Raises:
572
+ TypeError: If target is not a Table or VectorLayer.
531
573
 
532
574
  Returns:
533
- Feature: the sync instance of the feature.
575
+ List[AsyncTableRow] | List[AsyncFeature]: Related rows or features.
576
+ """
577
+ from .table import AsyncTable
578
+ from .vectorlayer import AsyncVectorLayer
579
+
580
+ if isinstance(target, AsyncTable):
581
+ return await target.get_rows(
582
+ relationship_uuid=relationship_uuid,
583
+ related_record_id=self.id,
584
+ )
585
+
586
+ if isinstance(target, AsyncVectorLayer):
587
+ return await target.get_features(
588
+ relationship_uuid=relationship_uuid,
589
+ related_record_id=self.id,
590
+ )
591
+
592
+ raise TypeError(f"Unsupported target type: {type(target)}")
593
+
594
+
595
+ async def get_related_records(self,
596
+ relationship_uuid: str,
597
+ ) -> Union[List['AsyncTableRow'], List['AsyncFeature']]:
598
+ """
599
+ [async] Get the related records on the *other side* of the relationship that are linked to this row
600
+
601
+ Args:
602
+ relationship_uuid (str): The uuid of relationship
603
+
604
+ Returns:
605
+ List[AsyncTableRow] | List[AsyncFeature]: a list of the related records
606
+
607
+ Raises:
608
+ ValueError:
609
+ If the given relationship does not involve the current table
610
+ (i.e., this row is neither the source nor the target of the relationship).
611
+
612
+ TypeError:
613
+ If the relationship target type is not supported for fetching
614
+ related records.
534
615
 
535
616
  Example:
536
- >>> from geobox import Geoboxclient
537
617
  >>> from geobox.aio import AsyncGeoboxClient
538
- >>> client = GeoboxClient()
539
- >>> async with AsyncGeoboxClient() as async_client:
540
- >>> layer = await async_client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
541
- >>> feature = await layer.get_feature(id=1, srid=3857)
542
- >>> sync_feature = feature.to_sync(client)
618
+ >>> async with AsyncGeoboxClient() as client:
619
+ >>> layer = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
620
+ >>> feature = await layer.get_feature(feature_id=1)
621
+ >>> related_records = await feature.get_related_records(relationship_uuid="12345678-1234-5678-1234-567812345678")
622
+ """
623
+ relationship = await self.api.get_relationship(relationship_uuid)
624
+
625
+ other_side = await self._get_other_side_of_relationship(relationship)
626
+
627
+ return await self._fetch_related_from_target(
628
+ target=other_side,
629
+ relationship_uuid=relationship_uuid,
630
+ )
631
+
632
+
633
+ async def associate_with(
634
+ self,
635
+ relationship_uuid: str,
636
+ *,
637
+ target_ids: Optional[List[int]] = None,
638
+ q: Optional[str] = None,
639
+ ) -> Dict:
543
640
  """
544
- from ..feature import Feature
641
+ [async] Create relationships between the source record and target records
642
+
643
+ Args:
644
+ relationship_uuid (str): the relationship uuid
645
+ target_ids (List[int], optional): a list of target record ids to be associated with the current record
646
+ q (str, optional): query filter on target layer or table to select which target features or rows that are going to be related to the current record
647
+
648
+ Returns:
649
+ Dict: the record association result
545
650
 
546
- sync_layer = self.layer.to_sync(sync_client=sync_client)
547
- return Feature(layer=sync_layer, srid=self.srid, data=self.data)
651
+ Example:
652
+ >>> from geobox.aio import AsyncGeoboxClient
653
+ >>> async with AsyncGeoboxClient() as client:
654
+ >>> layer = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
655
+ >>> feature = await layer.get_feature(feature_id=1)
656
+ >>> await feature.associate_with(
657
+ ... relationship_uuid="12345678-1234-5678-1234-567812345678",
658
+ ... target_ids=[1, 2, 3],
659
+ ... )
660
+ """
661
+ relationship = await self.api.get_relationship(uuid=relationship_uuid)
662
+ return await relationship.associate_records(
663
+ source_id=self.id,
664
+ target_ids=target_ids,
665
+ q=q,
666
+ )
667
+
668
+
669
+ async def disassociate_with(
670
+ self,
671
+ relationship_uuid: str,
672
+ *,
673
+ target_ids: Optional[List[int]] = None,
674
+ q: Optional[str] = None,
675
+ ) -> Dict:
676
+ """
677
+ [async] Remove relationships between the source record and target records
678
+
679
+ Args:
680
+ relationship_uuid (str): the relationship uuid
681
+ target_ids (List[int], optional): a list of target record ids to be disassociated with the current record
682
+ q (str, optional): query filter on target layer or table to select which target features or rows that are going to be related to the current record
683
+
684
+ Returns:
685
+ Dict: the record association result
686
+
687
+ Example:
688
+ >>> from geobox.aio import AsyncGeoboxClient
689
+ >>> async with AsyncGeoboxClient() as client:
690
+ >>> layer = await client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
691
+ >>> feature = await layer.get_feature(feature_id=1)
692
+ >>> await feature.disassociate_with(
693
+ ... relationship_uuid="12345678-1234-5678-1234-567812345678",
694
+ ... target_ids=[1, 2, 3],
695
+ ... )
696
+ """
697
+ relationship = await self.api.get_relationship(uuid=relationship_uuid)
698
+ return await relationship.disassociate_records(
699
+ source_id=self.id,
700
+ target_ids=target_ids,
701
+ q=q,
702
+ )
geobox/aio/field.py CHANGED
@@ -8,8 +8,6 @@ from ..enums import FieldType
8
8
  if TYPE_CHECKING:
9
9
  from .api import AsyncGeoboxClient
10
10
  from .vectorlayer import VectorLayer
11
- from ..api import GeoboxClient
12
- from ..field import Field
13
11
 
14
12
 
15
13
  class AsyncField(AsyncBase):
@@ -288,28 +286,3 @@ class AsyncField(AsyncBase):
288
286
 
289
287
  await self.save()
290
288
  return self.domain
291
-
292
-
293
- def to_sync(self, sync_client: 'GeoboxClient') -> 'Field':
294
- """
295
- Switch to sync version of the field instance to have access to the sync methods
296
-
297
- Args:
298
- sync_client (GeoboxClient): The sync version of the GeoboxClient instance for making requests.
299
-
300
- Returns:
301
- Field: the sync instance of the field.
302
-
303
- Example:
304
- >>> from geobox import Geoboxclient
305
- >>> from geobox.aio import AsyncGeoboxClient
306
- >>> client = GeoboxClient()
307
- >>> async with AsyncGeoboxClient() as async_client:
308
- >>> layer = await async_client.get_vector(uuid="12345678-1234-5678-1234-567812345678")
309
- >>> field = await layer.get_field(name='test')
310
- >>> sync_field = field.to_sync(client)
311
- """
312
- from ..field import Field
313
-
314
- sync_layer = self.layer.to_sync(sync_client=sync_client)
315
- return Field(layer=sync_layer, data_type=self.data_type, field_id=self.field_id, data=self.data)
geobox/aio/file.py CHANGED
@@ -16,8 +16,6 @@ from ..exception import ApiRequestError
16
16
  if TYPE_CHECKING:
17
17
  from . import AsyncGeoboxClient
18
18
  from .user import AsyncUser
19
- from ..api import GeoboxClient
20
- from ..file import File
21
19
 
22
20
 
23
21
  class AsyncFile(AsyncBase):
@@ -496,27 +494,3 @@ class AsyncFile(AsyncBase):
496
494
  'limit': limit
497
495
  }
498
496
  return await super()._get_shared_users(self.endpoint, params)
499
-
500
-
501
- def to_sync(self, sync_client: 'GeoboxClient') -> 'File':
502
- """
503
- Switch to sync version of the file instance to have access to the sync methods
504
-
505
- Args:
506
- sync_client (GeoboxClient): The sync version of the GeoboxClient instance for making requests.
507
-
508
- Returns:
509
- File: the async instance of the file.
510
-
511
- Example:
512
- >>> from geobox import Geoboxclient
513
- >>> from geobox.aio import AsyncGeoboxClient
514
- >>> from geobox.aio.file import AsyncFile
515
- >>> client = GeoboxClient()
516
- >>> async with AsyncGeoboxClient() as async_client:
517
- >>> file = await AsyncFile.get_file(async_client, uuid="12345678-1234-5678-1234-567812345678")
518
- >>> sync_file = file.to_sync(client)
519
- """
520
- from ..file import File
521
-
522
- return File(api=sync_client, uuid=self.uuid, data=self.data)
geobox/aio/layout.py CHANGED
@@ -5,8 +5,6 @@ from .base import AsyncBase
5
5
  if TYPE_CHECKING:
6
6
  from . import AsyncGeoboxClient
7
7
  from .user import AsyncUser
8
- from ..api import GeoboxClient
9
- from ..layout import Layout
10
8
 
11
9
 
12
10
  class AsyncLayout(AsyncBase):
@@ -314,27 +312,3 @@ class AsyncLayout(AsyncBase):
314
312
  'limit': limit
315
313
  }
316
314
  return await super()._get_shared_users(self.endpoint, params)
317
-
318
-
319
- def to_sync(self, sync_client: 'GeoboxClient') -> 'Layout':
320
- """
321
- Switch to sync version of the layout instance to have access to the sync methods
322
-
323
- Args:
324
- sync_client (GeoboxClient): The sync version of the GeoboxClient instance for making requests.
325
-
326
- Returns:
327
- Layout: the sync instance of the layout.
328
-
329
- Example:
330
- >>> from geobox import Geoboxclient
331
- >>> from geobox.aio import AsyncGeoboxClient
332
- >>> from geobox.aio.layout import AsyncLayout
333
- >>> client = GeoboxClient()
334
- >>> async with AsyncGeoboxClient() as async_client:
335
- >>> layout = await AsyncLayout.get_layout(async_client, uuid="12345678-1234-5678-1234-567812345678")
336
- >>> sync_layout = layout.to_sync(client)
337
- """
338
- from ..layout import Layout
339
-
340
- return Layout(api=sync_client, uuid=self.uuid, data=self.data)
geobox/aio/log.py CHANGED
@@ -5,8 +5,6 @@ from .base import AsyncBase
5
5
  if TYPE_CHECKING:
6
6
  from . import AsyncGeoboxClient
7
7
  from .user import AsyncUser
8
- from ..api import GeoboxClient
9
- from ..log import Log
10
8
 
11
9
 
12
10
  class AsyncLog(AsyncBase):
@@ -118,28 +116,3 @@ class AsyncLog(AsyncBase):
118
116
  >>> await log.user
119
117
  """
120
118
  return await self.api.get_user(self.owner_id)
121
-
122
-
123
- def to_sync(self, sync_client: 'GeoboxClient') -> 'Log':
124
- """
125
- Switch to sync version of the log instance to have access to the sync methods
126
-
127
- Args:
128
- sync_client (GeoboxClient): The sync version of the GeoboxClient instance for making requests.
129
-
130
- Returns:
131
- Log: the sync instance of the log.
132
-
133
- Example:
134
- >>> from geobox import Geoboxclient
135
- >>> from geobox.aio import AsyncGeoboxClient
136
- >>> from geopox.aio.log import AsyncLog
137
- >>> client = GeoboxClient()
138
- >>> async with AsyncGeoboxClient() as async_client:
139
- >>> logs = await AsyncLog.get_logs(async_client)
140
- >>> log = logs[0]
141
- >>> sync_log = log.to_sync(client)
142
- """
143
- from ..log import Log
144
-
145
- return Log(api=sync_client, log_id=self.log_id, data=self.data)
geobox/aio/map.py CHANGED
@@ -12,8 +12,6 @@ if TYPE_CHECKING:
12
12
  from .user import AsyncUser
13
13
  from .task import AsyncTask
14
14
  from .attachment import AsyncAttachment
15
- from ..api import GeoboxClient
16
- from ..map import Map
17
15
 
18
16
 
19
17
  class AsyncMap(AsyncBase):
@@ -1007,27 +1005,3 @@ class AsyncMap(AsyncBase):
1007
1005
  feature=feature,
1008
1006
  display_name=display_name,
1009
1007
  description=description)
1010
-
1011
-
1012
- def to_sync(self, sync_client: 'GeoboxClient') -> 'Map':
1013
- """
1014
- Switch to sync version of the map instance to have access to the sync methods
1015
-
1016
- Args:
1017
- sync_client (GeoboxClient): The sync version of the GeoboxClient instance for making requests.
1018
-
1019
- Returns:
1020
- Map: the sync instance of the map.
1021
-
1022
- Example:
1023
- >>> from geobox import Geoboxclient
1024
- >>> from geobox.aio import AsyncGeoboxClient
1025
- >>> from geobox.aio.map import AsyncMap
1026
- >>> client = GeoboxClient()
1027
- >>> async with AsyncGeoboxClient() as async_client:
1028
- >>> map = await AsyncMap.get_map(async_client, uuid="12345678-1234-5678-1234-567812345678")
1029
- >>> sync_map = map.to_sync(client)
1030
- """
1031
- from ..map import Map
1032
-
1033
- return Map(api=sync_client, uuid=self.uuid, data=self.data)
geobox/aio/model3d.py CHANGED
@@ -11,8 +11,6 @@ from ..utils import get_save_path
11
11
  if TYPE_CHECKING:
12
12
  from . import AsyncGeoboxClient
13
13
  from .user import AsyncUser
14
- from ..api import GeoboxClient
15
- from ..model3d import Model
16
14
 
17
15
 
18
16
  class AsyncModel(AsyncBase):
@@ -389,27 +387,3 @@ class AsyncModel(AsyncBase):
389
387
  'limit': limit
390
388
  }
391
389
  return await super()._get_shared_users(self.endpoint, params)
392
-
393
-
394
- def to_sync(self, sync_client: 'GeoboxClient') -> 'Model':
395
- """
396
- Switch to sync version of the 3d model instance to have access to the sync methods
397
-
398
- Args:
399
- sync_client (GeoboxClient): The sync version of the GeoboxClient instance for making requests.
400
-
401
- Returns:
402
- Model: the sync instance of the 3d model.
403
-
404
- Example:
405
- >>> from geobox import Geoboxclient
406
- >>> from geobox.aio import AsyncGeoboxClient
407
- >>> from geobox.aio.model3d import AsyncModel
408
- >>> client = GeoboxClient()
409
- >>> async with AsyncGeoboxClient() as async_client:
410
- >>> model = await AsyncModel.get_model(async_client, uuid="12345678-1234-5678-1234-567812345678")
411
- >>> sync_model = model.to_sync(client)
412
- """
413
- from ..model3d import Model
414
-
415
- return Model(api=sync_client, uuid=self.uuid, data=self.data)
geobox/aio/mosaic.py CHANGED
@@ -8,8 +8,6 @@ if TYPE_CHECKING:
8
8
  from . import AsyncGeoboxClient
9
9
  from .user import AsyncUser
10
10
  from .task import AsyncTask
11
- from ..api import GeoboxClient
12
- from ..mosaic import Mosaic
13
11
 
14
12
 
15
13
  class AsyncMosaic(AsyncRaster):
@@ -670,27 +668,3 @@ class AsyncMosaic(AsyncRaster):
670
668
  >>> await mosaic.cache_size
671
669
  """
672
670
  return await super().cache_size
673
-
674
-
675
- def to_sync(self, sync_client: 'GeoboxClient') -> 'Mosaic':
676
- """
677
- Switch to sync version of the mosaic instance to have access to the sync methods
678
-
679
- Args:
680
- sync_client (GeoboxClient): The sync version of the GeoboxClient instance for making requests.
681
-
682
- Returns:
683
- Mosiac: the sync instance of the mosaic.
684
-
685
- Example:
686
- >>> from geobox import Geoboxclient
687
- >>> from geobox.aio import AsyncGeoboxClient
688
- >>> from geobox.aio.mosaic import AsyncMosaic
689
- >>> client = GeoboxClient()
690
- >>> async with AsyncGeoboxClient() as async_client:
691
- >>> mosaic = await AsyncMosaic.get_mosaic(async_client, uuid="12345678-1234-5678-1234-567812345678")
692
- >>> sync_mosaic = mosaic.to_sync(client)
693
- """
694
- from ..mosaic import Mosaic
695
-
696
- return Mosaic(api=sync_client, uuid=self.uuid, data=self.data)
geobox/aio/plan.py CHANGED
@@ -5,8 +5,6 @@ from .base import AsyncBase
5
5
 
6
6
  if TYPE_CHECKING:
7
7
  from . import AsyncGeoboxClient
8
- from ..api import GeoboxClient
9
- from ..plan import Plan
10
8
 
11
9
 
12
10
  class AsyncPlan(AsyncBase):
@@ -289,27 +287,3 @@ class AsyncPlan(AsyncBase):
289
287
  """
290
288
  await super()._delete(self.endpoint)
291
289
  self.plan_id = None
292
-
293
-
294
- def to_sync(self, sync_client: 'GeoboxClient') -> 'Plan':
295
- """
296
- Switch to sync version of the plan instance to have access to the sync methods
297
-
298
- Args:
299
- sync_client (GeoboxClient): The sync version of the GeoboxClient instance for making requests.
300
-
301
- Returns:
302
- Plan: the sync instance of the plan.
303
-
304
- Example:
305
- >>> from geobox import Geoboxclient
306
- >>> from geobox.aio import AsyncGeoboxClient
307
- >>> from geobox.aio.plan import AsyncPlan
308
- >>> client = GeoboxClient()
309
- >>> async with AsyncGeoboxClient() as async_client:
310
- >>> plan = await AsyncPlan.get_plan(async_client, plan_id=1)
311
- >>> sync_plan = plan.to_sync(client)
312
- """
313
- from ..plan import Plan as SyncPlan
314
-
315
- return SyncPlan(api=sync_client, plan_id=self.plan_id, data=self.data)
geobox/aio/query.py CHANGED
@@ -9,8 +9,6 @@ from ..enums import QueryResultType, QueryGeometryType, QueryParamType
9
9
  if TYPE_CHECKING:
10
10
  from . import AsyncGeoboxClient
11
11
  from .user import AsyncUser
12
- from ..api import GeoboxClient
13
- from ..query import Query
14
12
 
15
13
 
16
14
  class AsyncQuery(AsyncBase):
@@ -667,27 +665,3 @@ class AsyncQuery(AsyncBase):
667
665
  response = await self.api.post(endpoint, data)
668
666
  task = await AsyncTask.get_task(self.api, response.get('task_id'))
669
667
  return task
670
-
671
-
672
- def to_sync(self, sync_client: 'GeoboxClient') -> 'Query':
673
- """
674
- Switch to sync version of the query instance to have access to the sync methods
675
-
676
- Args:
677
- sync_client (GeoboxClient): The sync version of the GeoboxClient instance for making requests.
678
-
679
- Returns:
680
- Query: the sync instance of the query.
681
-
682
- Example:
683
- >>> from geobox import Geoboxclient
684
- >>> from geobox.aio import AsyncGeoboxClient
685
- >>> from geobox.aio.query import AsyncQuery
686
- >>> client = GeoboxClient()
687
- >>> async with AsyncGeoboxClient() as async_client:
688
- >>> query = await AsyncQuery.get_query(async_client, uuid="12345678-1234-5678-1234-567812345678")
689
- >>> sync_query = query.to_sync(client)
690
- """
691
- from ..query import Query
692
-
693
- return Query(api=sync_client, uuid=self.uuid, data=self.data)
geobox/aio/raster.py CHANGED
@@ -12,8 +12,6 @@ from ..utils import clean_data, join_url_params
12
12
  if TYPE_CHECKING:
13
13
  from . import AsyncGeoboxClient
14
14
  from .user import AsyncUser
15
- from ..api import GeoboxClient
16
- from ..raster import Raster
17
15
 
18
16
 
19
17
  class AsyncRaster(AsyncBase):
@@ -844,30 +842,6 @@ class AsyncRaster(AsyncBase):
844
842
  return await super()._cache_size(self.endpoint)
845
843
 
846
844
 
847
- def to_sync(self, sync_client: 'GeoboxClient') -> 'Raster':
848
- """
849
- Switch to sync version of the raster instance to have access to the sync methods
850
-
851
- Args:
852
- sync_client (GeoboxClient): The sync version of the GeoboxClient instance for making requests.
853
-
854
- Returns:
855
- Raster: the sync instance of the raster.
856
-
857
- Example:
858
- >>> from geobox import Geoboxclient
859
- >>> from geobox.aio import AsyncGeoboxClient
860
- >>> from geobox.aio.raster import AsyncRaster
861
- >>> client = GeoboxClient()
862
- >>> async with AsyncGeoboxClient() as async_client:
863
- >>> raster = await AsyncRaster.get_raster(async_client, uuid="12345678-1234-5678-1234-567812345678")
864
- >>> sync_raster = raster.to_sync(client)
865
- """
866
- from ..raster import Raster
867
-
868
- return Raster(api=sync_client, uuid=self.uuid, data=self.data)
869
-
870
-
871
845
  async def profile(self,
872
846
  polyline: List,
873
847
  number_of_samples: int = 100,
geobox/aio/scene.py CHANGED
@@ -5,8 +5,7 @@ from .base import AsyncBase
5
5
  if TYPE_CHECKING:
6
6
  from . import AsyncGeoboxClient
7
7
  from .user import AsyncUser
8
- from ..api import GeoboxClient
9
- from ..scene import Scene
8
+
10
9
 
11
10
  class AsyncScene(AsyncBase):
12
11
 
@@ -314,27 +313,3 @@ class AsyncScene(AsyncBase):
314
313
  'limit': limit
315
314
  }
316
315
  return await super()._get_shared_users(self.endpoint, params)
317
-
318
-
319
- def to_sync(self, sync_client: 'GeoboxClient') -> 'Scene':
320
- """
321
- Switch to sync version of the scene instance to have access to the sync methods
322
-
323
- Args:
324
- sync_client (GeoboxClient): The sync version of the GeoboxClient instance for making requests.
325
-
326
- Returns:
327
- Scene: the sync instance of the scene.
328
-
329
- Example:
330
- >>> from geobox import Geoboxclient
331
- >>> from geobox.aio import AsyncGeoboxClient
332
- >>> from geobox.aio.scene import AsyncScene
333
- >>> client = GeoboxClient()
334
- >>> async with AsyncGeoboxClient() as async_client:
335
- >>> scene = await AsyncScene.get_scene(async_client, uuid="12345678-1234-5678-1234-567812345678")
336
- >>> sync_scene = scene.to_sync(client)
337
- """
338
- from ..scene import Scene
339
-
340
- return Scene(api=sync_client, uuid=self.uuid, data=self.data)
geobox/aio/settings.py CHANGED
@@ -7,8 +7,6 @@ from ..enums import MaxLogPolicy, InvalidDataPolicy, LoginFailurePolicy, MaxConc
7
7
 
8
8
  if TYPE_CHECKING:
9
9
  from . import AsyncGeoboxClient
10
- from ..api import GeoboxClient
11
- from ..settings import SystemSettings
12
10
 
13
11
 
14
12
  class AsyncSystemSettings(AsyncBase):
@@ -166,29 +164,3 @@ class AsyncSystemSettings(AsyncBase):
166
164
 
167
165
  }
168
166
  return await super()._update(self.BASE_ENDPOINT, data)
169
-
170
-
171
- def to_sync(self, sync_client: 'GeoboxClient') -> 'SystemSettings':
172
- """
173
- Switch to sync version of the system settings instance to have access to the sync methods
174
-
175
- Args:
176
- sync_client (GeoboxClient): The sync version of the GeoboxClient instance for making requests.
177
-
178
- Returns:
179
- SystemSettings: the sync instance of the system settings.
180
-
181
- Example:
182
- >>> from geobox import Geoboxclient
183
- >>> from geobox.aio import AsyncGeoboxClient
184
- >>> from geobox.aio.setting import AsyncSystemSettings
185
- >>> client = GeoboxClient()
186
- >>> async with AsyncGeoboxClient() as async_client:
187
- >>> settings = await AsyncSystemSetting.get_system_settings(async_client)
188
- or
189
- >>> settings = await async_client.get_system_settings()
190
- >>> sync_settings = settings.to_sync(client)
191
- """
192
- from ..task import Task as SyncTask
193
-
194
- return SyncTask(api=sync_client, uuid=self.uuid, data=self.data)