superannotate 4.4.31.dev2__tar.gz → 4.4.32__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.
Files changed (146) hide show
  1. {superannotate-4.4.31.dev2/src/superannotate.egg-info → superannotate-4.4.32}/PKG-INFO +1 -1
  2. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/__init__.py +1 -1
  3. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/interface/sdk_interface.py +20 -0
  4. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/core/serviceproviders.py +8 -0
  5. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/core/usecases/annotations.py +1 -1
  6. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/core/usecases/items.py +46 -0
  7. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/infrastructure/annotation_adapter.py +1 -1
  8. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/infrastructure/controller.py +14 -0
  9. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/infrastructure/services/explore.py +23 -0
  10. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/infrastructure/stream_data_handler.py +58 -41
  11. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/infrastructure/utils.py +2 -2
  12. {superannotate-4.4.31.dev2 → superannotate-4.4.32/src/superannotate.egg-info}/PKG-INFO +1 -1
  13. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/LICENSE +0 -0
  14. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/MANIFEST.in +0 -0
  15. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/README.rst +0 -0
  16. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/requirements.txt +0 -0
  17. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/setup.cfg +0 -0
  18. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/setup.py +0 -0
  19. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/__init__.py +0 -0
  20. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/__init__.py +0 -0
  21. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/analytics/__init__.py +0 -0
  22. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/analytics/aggregators.py +0 -0
  23. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/analytics/common.py +0 -0
  24. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/bin/__init__.py +0 -0
  25. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/bin/superannotate.py +0 -0
  26. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/common.py +0 -0
  27. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/exceptions.py +0 -0
  28. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/helpers.py +0 -0
  29. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/__init__.py +0 -0
  30. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/conversion.py +0 -0
  31. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/__init__.py +0 -0
  32. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/baseStrategy.py +0 -0
  33. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/coco_converters/__init__.py +0 -0
  34. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/coco_converters/coco_api.py +0 -0
  35. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/coco_converters/coco_converter.py +0 -0
  36. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/coco_converters/coco_strategies.py +0 -0
  37. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/coco_converters/coco_to_sa_pixel.py +0 -0
  38. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/coco_converters/coco_to_sa_vector.py +0 -0
  39. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/coco_converters/sa_pixel_to_coco.py +0 -0
  40. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/coco_converters/sa_vector_to_coco.py +0 -0
  41. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/converters.py +0 -0
  42. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/dataloop_converters/__init__.py +0 -0
  43. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/dataloop_converters/dataloop_helper.py +0 -0
  44. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/dataloop_converters/dataloop_strategies.py +0 -0
  45. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/dataloop_converters/dataloop_to_sa_vector.py +0 -0
  46. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/googlecloud_converters/__init__.py +0 -0
  47. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/googlecloud_converters/googlecloud_strategies.py +0 -0
  48. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/googlecloud_converters/googlecloud_to_sa_vector.py +0 -0
  49. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/labelbox_converters/__init__.py +0 -0
  50. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/labelbox_converters/labelbox_helper.py +0 -0
  51. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/labelbox_converters/labelbox_strategies.py +0 -0
  52. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/labelbox_converters/labelbox_to_sa_pixel.py +0 -0
  53. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/labelbox_converters/labelbox_to_sa_vector.py +0 -0
  54. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/sa_json_helper.py +0 -0
  55. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/sagemaker_converters/__init__.py +0 -0
  56. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/sagemaker_converters/sagemaker_strategies.py +0 -0
  57. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/sagemaker_converters/sagemaker_to_sa_pixel.py +0 -0
  58. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/sagemaker_converters/sagemaker_to_sa_vector.py +0 -0
  59. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/supervisely_converters/__init__.py +0 -0
  60. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/supervisely_converters/supervisely_helper.py +0 -0
  61. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/supervisely_converters/supervisely_strategies.py +0 -0
  62. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/supervisely_converters/supervisely_to_sa_pixel.py +0 -0
  63. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/supervisely_converters/supervisely_to_sa_vector.py +0 -0
  64. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/vgg_converters/__init__.py +0 -0
  65. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/vgg_converters/vgg_helper.py +0 -0
  66. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/vgg_converters/vgg_strategies.py +0 -0
  67. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/vgg_converters/vgg_to_sa_vector.py +0 -0
  68. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/voc_converters/__init__.py +0 -0
  69. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/voc_converters/voc_helper.py +0 -0
  70. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/voc_converters/voc_strategies.py +0 -0
  71. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/voc_converters/voc_to_sa_pixel.py +0 -0
  72. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/voc_converters/voc_to_sa_vector.py +0 -0
  73. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/vott_converters/__init__.py +0 -0
  74. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/vott_converters/vott_strategies.py +0 -0
  75. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/vott_converters/vott_to_sa_vector.py +0 -0
  76. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/yolo_converters/__init__.py +0 -0
  77. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/yolo_converters/yolo_strategies.py +0 -0
  78. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/converters/yolo_converters/yolo_to_sa_vector.py +0 -0
  79. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/export_from_sa_conversions.py +0 -0
  80. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/import_to_sa_conversions.py +0 -0
  81. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/input_converters/sa_conversion.py +0 -0
  82. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/interface/__init__.py +0 -0
  83. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/interface/base_interface.py +0 -0
  84. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/interface/cli_interface.py +0 -0
  85. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/interface/sdk/__init__.py +0 -0
  86. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/interface/sdk/folders.py +0 -0
  87. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/interface/sdk/project.py +0 -0
  88. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/interface/types.py +0 -0
  89. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/app/serializers.py +0 -0
  90. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/core/__init__.py +0 -0
  91. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/core/base_usecases.py +0 -0
  92. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/core/conditions.py +0 -0
  93. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/core/config.py +0 -0
  94. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/core/entities/__init__.py +0 -0
  95. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/core/entities/base.py +0 -0
  96. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/core/entities/classes.py +0 -0
  97. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/core/entities/filters.py +0 -0
  98. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/core/entities/folder.py +0 -0
  99. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/core/entities/integrations.py +0 -0
  100. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/core/entities/items.py +0 -0
  101. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/core/entities/project.py +0 -0
  102. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/core/entities/project_entities.py +0 -0
  103. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/core/entities/work_managament.py +0 -0
  104. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/core/enums.py +0 -0
  105. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/core/exceptions.py +0 -0
  106. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/core/jsx_conditions.py +0 -0
  107. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/core/plugin.py +0 -0
  108. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/core/pydantic_v1.py +0 -0
  109. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/core/reporter.py +0 -0
  110. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/core/repositories.py +0 -0
  111. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/core/response.py +0 -0
  112. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/core/service_types.py +0 -0
  113. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/core/types.py +0 -0
  114. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/core/usecases/__init__.py +0 -0
  115. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/core/usecases/base.py +0 -0
  116. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/core/usecases/classes.py +0 -0
  117. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/core/usecases/custom_fields.py +0 -0
  118. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/core/usecases/folders.py +0 -0
  119. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/core/usecases/images.py +0 -0
  120. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/core/usecases/integrations.py +0 -0
  121. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/core/usecases/models.py +0 -0
  122. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/core/usecases/projects.py +0 -0
  123. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/core/utils.py +0 -0
  124. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/core/video_convertor.py +0 -0
  125. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/infrastructure/__init__.py +0 -0
  126. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/infrastructure/custom_entities.py +0 -0
  127. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/infrastructure/helpers.py +0 -0
  128. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/infrastructure/query_builder.py +0 -0
  129. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/infrastructure/repositories.py +0 -0
  130. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/infrastructure/serviceprovider.py +0 -0
  131. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/infrastructure/services/__init__.py +0 -0
  132. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/infrastructure/services/annotation.py +0 -0
  133. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/infrastructure/services/annotation_class.py +0 -0
  134. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/infrastructure/services/folder.py +0 -0
  135. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/infrastructure/services/http_client.py +0 -0
  136. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/infrastructure/services/integration.py +0 -0
  137. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/infrastructure/services/item.py +0 -0
  138. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/infrastructure/services/item_service.py +0 -0
  139. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/infrastructure/services/project.py +0 -0
  140. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/infrastructure/services/work_management.py +0 -0
  141. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate/lib/infrastructure/validators.py +0 -0
  142. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate.egg-info/SOURCES.txt +0 -0
  143. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate.egg-info/dependency_links.txt +0 -0
  144. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate.egg-info/entry_points.txt +0 -0
  145. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate.egg-info/requires.txt +0 -0
  146. {superannotate-4.4.31.dev2 → superannotate-4.4.32}/src/superannotate.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: superannotate
3
- Version: 4.4.31.dev2
3
+ Version: 4.4.32
4
4
  Summary: Python SDK to SuperAnnotate platform
5
5
  Home-page: https://github.com/superannotateai/superannotate-python-sdk
6
6
  Author: SuperAnnotate AI
@@ -3,7 +3,7 @@ import os
3
3
  import sys
4
4
 
5
5
 
6
- __version__ = "4.4.31dev2"
6
+ __version__ = "4.4.32"
7
7
 
8
8
  os.environ.update({"sa_version": __version__})
9
9
  sys.path.append(os.path.split(os.path.realpath(__file__))[0])
@@ -461,6 +461,16 @@ class SAClient(BaseInterfaceFacade, metaclass=TrackableMeta):
461
461
  def pause_user_activity(
462
462
  self, pk: Union[int, str], projects: Union[List[int], List[str], Literal["*"]]
463
463
  ):
464
+ """
465
+ Block the team contributor from requesting items from the projects.
466
+
467
+ :param pk: The email address or user ID of the team contributor.
468
+ :type pk: str or int
469
+
470
+ :param projects: A list of project names or IDs from which the user should be blocked.
471
+ The special value "*" means block access to all projects
472
+ :type projects: Union[List[int], List[str], Literal["*"]]
473
+ """
464
474
  user = self.controller.work_management.get_user_metadata(pk=pk)
465
475
  if user.role is not WMUserTypeEnum.Contributor:
466
476
  raise AppException("User must have a contributor role to pause activity.")
@@ -474,6 +484,16 @@ class SAClient(BaseInterfaceFacade, metaclass=TrackableMeta):
474
484
  def resume_user_activity(
475
485
  self, pk: Union[int, str], projects: Union[List[int], List[str], Literal["*"]]
476
486
  ):
487
+ """
488
+ Resume the team contributor from requesting items from the projects.
489
+
490
+ :param pk: The email address or user ID of the team contributor.
491
+ :type pk: str or int
492
+
493
+ :param projects: A list of project names or IDs from which the user should be resumed.
494
+ The special value "*" means resume access to all projects
495
+ :type projects: Union[List[int], List[str], Literal["*"]]
496
+ """
477
497
  user = self.controller.work_management.get_user_metadata(pk=pk)
478
498
  if user.role is not WMUserTypeEnum.Contributor:
479
499
  raise AppException("User must have a contributor role to resume activity.")
@@ -672,6 +672,14 @@ class BaseExploreService(SuperannotateServiceProvider):
672
672
  ) -> ServiceResponse:
673
673
  raise NotImplementedError
674
674
 
675
+ @abstractmethod
676
+ def query_item_count(
677
+ self,
678
+ project: entities.ProjectEntity,
679
+ query: str = None,
680
+ ) -> ServiceResponse:
681
+ raise NotImplementedError
682
+
675
683
 
676
684
  class BaseServiceProvider:
677
685
  projects: BaseProjectService
@@ -2046,7 +2046,7 @@ class UploadMultiModalAnnotationsUseCase(BaseReportableUseCase):
2046
2046
  f"annotations to the project {self._project.name}."
2047
2047
  )
2048
2048
  if not self._root_folder.is_root:
2049
- if len(distributed_items) > 1 or None not in distributed_items:
2049
+ if len(distributed_items) > 1 or "" not in distributed_items:
2050
2050
  raise AppException(
2051
2051
  "You can't include a folder when uploading from within a folder."
2052
2052
  )
@@ -163,6 +163,52 @@ class QueryEntitiesUseCase(BaseReportableUseCase):
163
163
  return self._response
164
164
 
165
165
 
166
+ class QueryEntitiesCountUseCase(BaseReportableUseCase):
167
+ def __init__(
168
+ self,
169
+ reporter: Reporter,
170
+ project: ProjectEntity,
171
+ service_provider: BaseServiceProvider,
172
+ query: str,
173
+ ):
174
+ super().__init__(reporter)
175
+ self._project = project
176
+ self._service_provider = service_provider
177
+ self._query = query
178
+
179
+ def validate_arguments(self):
180
+ if self._query:
181
+ response = self._service_provider.explore.validate_saqul_query(
182
+ project=self._project, query=self._query
183
+ )
184
+
185
+ if not response.ok:
186
+ raise AppException(response.error)
187
+ if response.data["isValidQuery"]:
188
+ self._query = response.data["parsedQuery"]
189
+ else:
190
+ raise AppException("Incorrect query.")
191
+ else:
192
+ response = self._service_provider.explore.validate_saqul_query(
193
+ self._project, "-"
194
+ )
195
+ if not response.ok:
196
+ raise AppException(response.error)
197
+
198
+ def execute(self) -> Response:
199
+ if self.is_valid():
200
+ query_kwargs = {"query": self._query}
201
+ service_response = self._service_provider.explore.query_item_count(
202
+ self._project,
203
+ **query_kwargs,
204
+ )
205
+ if service_response.ok:
206
+ self._response.data = service_response.data
207
+ else:
208
+ self._response.errors = service_response.data
209
+ return self._response
210
+
211
+
166
212
  class AssignItemsUseCase(BaseUseCase):
167
213
  CHUNK_SIZE = 500
168
214
 
@@ -44,7 +44,7 @@ class BaseMultimodalAnnotationAdapter(ABC):
44
44
  return None
45
45
 
46
46
  def set_component_value(self, component_id: str, value: Any):
47
- self.annotation["data"][component_id] = {"value": value}
47
+ self.annotation.setdefault("data", {}).setdefault(component_id, {})["value"] = value
48
48
  return self
49
49
 
50
50
 
@@ -1678,3 +1678,17 @@ class Controller(BaseController):
1678
1678
  return ItemManager.process_response(
1679
1679
  self.service_provider, items, project, folder, map_fields=False
1680
1680
  )
1681
+
1682
+ def query_items_count(self, project_name: str, query: str = None) -> int:
1683
+ project = self.get_project(project_name)
1684
+
1685
+ use_case = usecases.QueryEntitiesCountUseCase(
1686
+ reporter=self.get_default_reporter(),
1687
+ project=project,
1688
+ query=query,
1689
+ service_provider=self.service_provider,
1690
+ )
1691
+ response = use_case.execute()
1692
+ if response.errors:
1693
+ raise AppException(response.errors)
1694
+ return response.data["count"]
@@ -10,6 +10,7 @@ from lib.core.service_types import ServiceResponse
10
10
  from lib.core.service_types import SubsetListResponse
11
11
  from lib.core.service_types import UploadCustomFieldValuesResponse
12
12
  from lib.core.serviceproviders import BaseExploreService
13
+ from superannotate import AppException
13
14
 
14
15
 
15
16
  class ExploreService(BaseExploreService):
@@ -25,6 +26,7 @@ class ExploreService(BaseExploreService):
25
26
  URL_UPLOAD_CUSTOM_VALUE = "custom/metadata/item"
26
27
  URL_SAQUL_QUERY = "items/search"
27
28
  URL_VALIDATE_SAQUL_QUERY = "items/parse/query"
29
+ URL_QUERY_COUNT = "items/count"
28
30
 
29
31
  @property
30
32
  def explore_service_url(self):
@@ -201,3 +203,24 @@ class ExploreService(BaseExploreService):
201
203
  else:
202
204
  response = ServiceResponse(status=200, res_data=[])
203
205
  return response
206
+
207
+ def query_item_count(
208
+ self,
209
+ project: entities.ProjectEntity,
210
+ query: str = None,
211
+ ) -> ServiceResponse:
212
+
213
+ params = {
214
+ "project_id": project.id,
215
+ "includeFolderNames": True,
216
+ }
217
+ data = {"query": query}
218
+ response = self.client.request(
219
+ urljoin(self.explore_service_url, self.URL_QUERY_COUNT),
220
+ "post",
221
+ params=params,
222
+ data=data,
223
+ )
224
+ if not response.ok:
225
+ raise AppException(response.error)
226
+ return response
@@ -2,7 +2,10 @@ import copy
2
2
  import json
3
3
  import logging
4
4
  import os
5
+ import threading
6
+ import time
5
7
  import typing
8
+ from functools import lru_cache
6
9
  from typing import Callable
7
10
 
8
11
  import aiohttp
@@ -24,6 +27,7 @@ logger = logging.getLogger("sa")
24
27
  class StreamedAnnotations:
25
28
  DELIMITER = "\\n;)\\n"
26
29
  DELIMITER_LEN = len(DELIMITER)
30
+ VERIFY_SSL = False
27
31
 
28
32
  def __init__(
29
33
  self,
@@ -50,7 +54,6 @@ class StreamedAnnotations:
50
54
  async def fetch(
51
55
  self,
52
56
  method: str,
53
- session: AIOHttpSession,
54
57
  url: str,
55
58
  data: dict = None,
56
59
  params: dict = None,
@@ -58,7 +61,9 @@ class StreamedAnnotations:
58
61
  kwargs = {"params": params, "json": data}
59
62
  if data:
60
63
  kwargs["json"].update(data)
61
- response = await session.request(method, url, **kwargs, timeout=TIMEOUT) # noqa
64
+ response = await self.get_session().request(
65
+ method, url, **kwargs, timeout=TIMEOUT
66
+ ) # noqa
62
67
  if not response.ok:
63
68
  logger.error(response.text)
64
69
  buffer = ""
@@ -86,6 +91,7 @@ class StreamedAnnotations:
86
91
  "Invalid JSON detected in small annotations stream process."
87
92
  )
88
93
  else:
94
+ self.rest_session()
89
95
  raise BackendError(
90
96
  "Invalid JSON detected at the start of the small annotations stream process."
91
97
  )
@@ -103,33 +109,47 @@ class StreamedAnnotations:
103
109
  )
104
110
  break
105
111
 
112
+ @lru_cache(maxsize=32)
113
+ def _get_session(self, thread_id, ttl=None): # noqa
114
+ del ttl
115
+ del thread_id
116
+ return AIOHttpSession(
117
+ headers=self._headers,
118
+ timeout=TIMEOUT,
119
+ connector=aiohttp.TCPConnector(
120
+ ssl=self.VERIFY_SSL, keepalive_timeout=2**32
121
+ ),
122
+ raise_for_status=True,
123
+ )
124
+
125
+ def get_session(self):
126
+ return self._get_session(
127
+ thread_id=threading.get_ident(), ttl=round(time.time() / 360)
128
+ )
129
+
130
+ def rest_session(self):
131
+ self._get_session.cache_clear()
132
+
106
133
  async def list_annotations(
107
134
  self,
108
135
  method: str,
109
136
  url: str,
110
137
  data: typing.List[int] = None,
111
138
  params: dict = None,
112
- verify_ssl=False,
113
139
  ):
114
140
  params = copy.copy(params)
115
141
  params["limit"] = len(data)
116
142
  annotations = []
117
- async with AIOHttpSession(
118
- headers=self._headers,
119
- timeout=TIMEOUT,
120
- connector=aiohttp.TCPConnector(ssl=verify_ssl, keepalive_timeout=2**32),
121
- raise_for_status=True,
122
- ) as session:
123
- async for annotation in self.fetch(
124
- method,
125
- session,
126
- url,
127
- self._process_data(data),
128
- params=copy.copy(params),
129
- ):
130
- annotations.append(
131
- self._callback(annotation) if self._callback else annotation
132
- )
143
+
144
+ async for annotation in self.fetch(
145
+ method,
146
+ url,
147
+ self._process_data(data),
148
+ params=copy.copy(params),
149
+ ):
150
+ annotations.append(
151
+ self._callback(annotation) if self._callback else annotation
152
+ )
133
153
 
134
154
  return annotations
135
155
 
@@ -143,28 +163,22 @@ class StreamedAnnotations:
143
163
  ):
144
164
  params = copy.copy(params)
145
165
  params["limit"] = len(data)
146
- async with AIOHttpSession(
147
- headers=self._headers,
148
- timeout=TIMEOUT,
149
- connector=aiohttp.TCPConnector(ssl=False, keepalive_timeout=2**32),
150
- raise_for_status=True,
151
- ) as session:
152
- async for annotation in self.fetch(
153
- method,
154
- session,
155
- url,
156
- self._process_data(data),
157
- params=params,
158
- ):
159
- self._annotations.append(
160
- self._callback(annotation) if self._callback else annotation
161
- )
162
- self._store_annotation(
163
- download_path,
164
- annotation,
165
- self._callback,
166
- )
167
- self._items_downloaded += 1
166
+
167
+ async for annotation in self.fetch(
168
+ method,
169
+ url,
170
+ self._process_data(data),
171
+ params=params,
172
+ ):
173
+ self._annotations.append(
174
+ self._callback(annotation) if self._callback else annotation
175
+ )
176
+ self._store_annotation(
177
+ download_path,
178
+ annotation,
179
+ self._callback,
180
+ )
181
+ self._items_downloaded += 1
168
182
 
169
183
  @staticmethod
170
184
  def _store_annotation(path, annotation: dict, callback: Callable = None):
@@ -177,3 +191,6 @@ class StreamedAnnotations:
177
191
  if data and self._map_function:
178
192
  return self._map_function(data)
179
193
  return data
194
+
195
+ def __del__(self):
196
+ self.rest_session()
@@ -149,11 +149,11 @@ class RoleCache(BaseCachedWorkManagementRepository):
149
149
  self._K_V_map[project.id] = {
150
150
  "role_name_id_map": {
151
151
  **{role["role"]["name"]: role["role_id"] for role in roles},
152
- "ProjectAdmin": 3
152
+ "ProjectAdmin": 3,
153
153
  },
154
154
  "role_id_name_map": {
155
155
  **{role["role_id"]: role["role"]["name"] for role in roles},
156
- 3: "ProjectAdmin"
156
+ 3: "ProjectAdmin",
157
157
  },
158
158
  }
159
159
  self._update_cache_timestamp(project.id)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: superannotate
3
- Version: 4.4.31.dev2
3
+ Version: 4.4.32
4
4
  Summary: Python SDK to SuperAnnotate platform
5
5
  Home-page: https://github.com/superannotateai/superannotate-python-sdk
6
6
  Author: SuperAnnotate AI