linq-python 0.2.3__tar.gz → 0.2.4__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 (189) hide show
  1. linq_python-0.2.4/.release-please-manifest.json +3 -0
  2. {linq_python-0.2.3 → linq_python-0.2.4}/CHANGELOG.md +18 -0
  3. {linq_python-0.2.3 → linq_python-0.2.4}/PKG-INFO +1 -1
  4. {linq_python-0.2.3 → linq_python-0.2.4}/pyproject.toml +1 -1
  5. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/_files.py +53 -3
  6. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/_utils/__init__.py +0 -1
  7. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/_utils/_utils.py +3 -17
  8. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/_version.py +1 -1
  9. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/resources/chats/typing.py +38 -12
  10. {linq_python-0.2.3 → linq_python-0.2.4}/tests/test_extract_files.py +9 -0
  11. linq_python-0.2.4/tests/test_files.py +148 -0
  12. linq_python-0.2.3/.release-please-manifest.json +0 -3
  13. linq_python-0.2.3/tests/test_deepcopy.py +0 -58
  14. linq_python-0.2.3/tests/test_files.py +0 -51
  15. {linq_python-0.2.3 → linq_python-0.2.4}/.gitignore +0 -0
  16. {linq_python-0.2.3 → linq_python-0.2.4}/CONTRIBUTING.md +0 -0
  17. {linq_python-0.2.3 → linq_python-0.2.4}/LICENSE +0 -0
  18. {linq_python-0.2.3 → linq_python-0.2.4}/README.md +0 -0
  19. {linq_python-0.2.3 → linq_python-0.2.4}/SECURITY.md +0 -0
  20. {linq_python-0.2.3 → linq_python-0.2.4}/api.md +0 -0
  21. {linq_python-0.2.3 → linq_python-0.2.4}/bin/check-release-environment +0 -0
  22. {linq_python-0.2.3 → linq_python-0.2.4}/bin/publish-pypi +0 -0
  23. {linq_python-0.2.3 → linq_python-0.2.4}/examples/.keep +0 -0
  24. {linq_python-0.2.3 → linq_python-0.2.4}/release-please-config.json +0 -0
  25. {linq_python-0.2.3 → linq_python-0.2.4}/requirements-dev.lock +0 -0
  26. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/__init__.py +0 -0
  27. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/_base_client.py +0 -0
  28. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/_client.py +0 -0
  29. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/_compat.py +0 -0
  30. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/_constants.py +0 -0
  31. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/_exceptions.py +0 -0
  32. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/_models.py +0 -0
  33. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/_qs.py +0 -0
  34. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/_resource.py +0 -0
  35. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/_response.py +0 -0
  36. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/_streaming.py +0 -0
  37. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/_types.py +0 -0
  38. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/_utils/_compat.py +0 -0
  39. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/_utils/_datetime_parse.py +0 -0
  40. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/_utils/_json.py +0 -0
  41. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/_utils/_logs.py +0 -0
  42. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/_utils/_path.py +0 -0
  43. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/_utils/_proxy.py +0 -0
  44. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/_utils/_reflection.py +0 -0
  45. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/_utils/_resources_proxy.py +0 -0
  46. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/_utils/_streams.py +0 -0
  47. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/_utils/_sync.py +0 -0
  48. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/_utils/_transform.py +0 -0
  49. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/_utils/_typing.py +0 -0
  50. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/lib/.keep +0 -0
  51. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/pagination.py +0 -0
  52. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/py.typed +0 -0
  53. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/resources/__init__.py +0 -0
  54. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/resources/attachments.py +0 -0
  55. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/resources/capability.py +0 -0
  56. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/resources/chats/__init__.py +0 -0
  57. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/resources/chats/chats.py +0 -0
  58. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/resources/chats/messages.py +0 -0
  59. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/resources/chats/participants.py +0 -0
  60. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/resources/contact_card.py +0 -0
  61. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/resources/messages.py +0 -0
  62. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/resources/phone_numbers.py +0 -0
  63. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/resources/phonenumbers.py +0 -0
  64. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/resources/webhook_events.py +0 -0
  65. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/resources/webhook_subscriptions.py +0 -0
  66. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/resources/webhooks.py +0 -0
  67. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/__init__.py +0 -0
  68. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/attachment_create_params.py +0 -0
  69. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/attachment_create_response.py +0 -0
  70. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/attachment_retrieve_response.py +0 -0
  71. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/capability_check_RCS_params.py +0 -0
  72. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/capability_check_i_message_params.py +0 -0
  73. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/chat.py +0 -0
  74. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/chat_create_params.py +0 -0
  75. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/chat_create_response.py +0 -0
  76. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/chat_created_webhook_event.py +0 -0
  77. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/chat_group_icon_update_failed_webhook_event.py +0 -0
  78. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/chat_group_icon_updated_webhook_event.py +0 -0
  79. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/chat_group_name_update_failed_webhook_event.py +0 -0
  80. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/chat_group_name_updated_webhook_event.py +0 -0
  81. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/chat_leave_chat_response.py +0 -0
  82. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/chat_list_chats_params.py +0 -0
  83. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/chat_send_voicememo_params.py +0 -0
  84. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/chat_send_voicememo_response.py +0 -0
  85. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/chat_typing_indicator_started_webhook_event.py +0 -0
  86. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/chat_typing_indicator_stopped_webhook_event.py +0 -0
  87. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/chat_update_params.py +0 -0
  88. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/chat_update_response.py +0 -0
  89. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/chats/__init__.py +0 -0
  90. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/chats/message_list_params.py +0 -0
  91. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/chats/message_send_params.py +0 -0
  92. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/chats/message_send_response.py +0 -0
  93. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/chats/participant_add_params.py +0 -0
  94. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/chats/participant_add_response.py +0 -0
  95. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/chats/participant_remove_params.py +0 -0
  96. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/chats/participant_remove_response.py +0 -0
  97. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/chats/sent_message.py +0 -0
  98. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/contact_card_create_params.py +0 -0
  99. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/contact_card_retrieve_params.py +0 -0
  100. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/contact_card_retrieve_response.py +0 -0
  101. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/contact_card_update_params.py +0 -0
  102. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/events_webhook_event.py +0 -0
  103. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/handle_check_response.py +0 -0
  104. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/link_part_param.py +0 -0
  105. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/media_part_param.py +0 -0
  106. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/message.py +0 -0
  107. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/message_add_reaction_params.py +0 -0
  108. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/message_add_reaction_response.py +0 -0
  109. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/message_content_param.py +0 -0
  110. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/message_delivered_webhook_event.py +0 -0
  111. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/message_edited_webhook_event.py +0 -0
  112. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/message_effect.py +0 -0
  113. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/message_effect_param.py +0 -0
  114. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/message_event_v2.py +0 -0
  115. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/message_failed_webhook_event.py +0 -0
  116. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/message_list_messages_thread_params.py +0 -0
  117. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/message_read_webhook_event.py +0 -0
  118. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/message_received_webhook_event.py +0 -0
  119. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/message_sent_webhook_event.py +0 -0
  120. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/message_update_params.py +0 -0
  121. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/participant_added_webhook_event.py +0 -0
  122. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/participant_removed_webhook_event.py +0 -0
  123. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/phone_number_list_response.py +0 -0
  124. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/phone_number_status_updated_webhook_event.py +0 -0
  125. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/phonenumber_list_response.py +0 -0
  126. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/reaction_added_webhook_event.py +0 -0
  127. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/reaction_event_base.py +0 -0
  128. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/reaction_removed_webhook_event.py +0 -0
  129. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/reply_to.py +0 -0
  130. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/reply_to_param.py +0 -0
  131. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/schemas_media_part_response.py +0 -0
  132. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/schemas_message_effect.py +0 -0
  133. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/schemas_text_part_response.py +0 -0
  134. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/set_contact_card.py +0 -0
  135. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/shared/__init__.py +0 -0
  136. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/shared/chat_handle.py +0 -0
  137. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/shared/link_part_response.py +0 -0
  138. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/shared/media_part_response.py +0 -0
  139. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/shared/reaction.py +0 -0
  140. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/shared/reaction_type.py +0 -0
  141. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/shared/service_type.py +0 -0
  142. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/shared/text_decoration.py +0 -0
  143. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/shared/text_part_response.py +0 -0
  144. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/shared_params/__init__.py +0 -0
  145. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/shared_params/reaction_type.py +0 -0
  146. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/shared_params/service_type.py +0 -0
  147. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/shared_params/text_decoration.py +0 -0
  148. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/supported_content_type.py +0 -0
  149. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/text_part_param.py +0 -0
  150. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/webhook_event_list_response.py +0 -0
  151. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/webhook_event_type.py +0 -0
  152. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/webhook_subscription.py +0 -0
  153. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/webhook_subscription_create_params.py +0 -0
  154. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/webhook_subscription_create_response.py +0 -0
  155. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/webhook_subscription_list_response.py +0 -0
  156. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq/types/webhook_subscription_update_params.py +0 -0
  157. {linq_python-0.2.3 → linq_python-0.2.4}/src/linq_api_v3/lib/.keep +0 -0
  158. {linq_python-0.2.3 → linq_python-0.2.4}/tests/__init__.py +0 -0
  159. {linq_python-0.2.3 → linq_python-0.2.4}/tests/api_resources/__init__.py +0 -0
  160. {linq_python-0.2.3 → linq_python-0.2.4}/tests/api_resources/chats/__init__.py +0 -0
  161. {linq_python-0.2.3 → linq_python-0.2.4}/tests/api_resources/chats/test_messages.py +0 -0
  162. {linq_python-0.2.3 → linq_python-0.2.4}/tests/api_resources/chats/test_participants.py +0 -0
  163. {linq_python-0.2.3 → linq_python-0.2.4}/tests/api_resources/chats/test_typing.py +0 -0
  164. {linq_python-0.2.3 → linq_python-0.2.4}/tests/api_resources/test_attachments.py +0 -0
  165. {linq_python-0.2.3 → linq_python-0.2.4}/tests/api_resources/test_capability.py +0 -0
  166. {linq_python-0.2.3 → linq_python-0.2.4}/tests/api_resources/test_chats.py +0 -0
  167. {linq_python-0.2.3 → linq_python-0.2.4}/tests/api_resources/test_contact_card.py +0 -0
  168. {linq_python-0.2.3 → linq_python-0.2.4}/tests/api_resources/test_messages.py +0 -0
  169. {linq_python-0.2.3 → linq_python-0.2.4}/tests/api_resources/test_phone_numbers.py +0 -0
  170. {linq_python-0.2.3 → linq_python-0.2.4}/tests/api_resources/test_phonenumbers.py +0 -0
  171. {linq_python-0.2.3 → linq_python-0.2.4}/tests/api_resources/test_webhook_events.py +0 -0
  172. {linq_python-0.2.3 → linq_python-0.2.4}/tests/api_resources/test_webhook_subscriptions.py +0 -0
  173. {linq_python-0.2.3 → linq_python-0.2.4}/tests/api_resources/test_webhooks.py +0 -0
  174. {linq_python-0.2.3 → linq_python-0.2.4}/tests/conftest.py +0 -0
  175. {linq_python-0.2.3 → linq_python-0.2.4}/tests/sample_file.txt +0 -0
  176. {linq_python-0.2.3 → linq_python-0.2.4}/tests/test_client.py +0 -0
  177. {linq_python-0.2.3 → linq_python-0.2.4}/tests/test_models.py +0 -0
  178. {linq_python-0.2.3 → linq_python-0.2.4}/tests/test_qs.py +0 -0
  179. {linq_python-0.2.3 → linq_python-0.2.4}/tests/test_required_args.py +0 -0
  180. {linq_python-0.2.3 → linq_python-0.2.4}/tests/test_response.py +0 -0
  181. {linq_python-0.2.3 → linq_python-0.2.4}/tests/test_streaming.py +0 -0
  182. {linq_python-0.2.3 → linq_python-0.2.4}/tests/test_transform.py +0 -0
  183. {linq_python-0.2.3 → linq_python-0.2.4}/tests/test_utils/test_datetime_parse.py +0 -0
  184. {linq_python-0.2.3 → linq_python-0.2.4}/tests/test_utils/test_json.py +0 -0
  185. {linq_python-0.2.3 → linq_python-0.2.4}/tests/test_utils/test_path.py +0 -0
  186. {linq_python-0.2.3 → linq_python-0.2.4}/tests/test_utils/test_proxy.py +0 -0
  187. {linq_python-0.2.3 → linq_python-0.2.4}/tests/test_utils/test_typing.py +0 -0
  188. {linq_python-0.2.3 → linq_python-0.2.4}/tests/utils.py +0 -0
  189. {linq_python-0.2.3 → linq_python-0.2.4}/uv.lock +0 -0
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.2.4"
3
+ }
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.4 (2026-04-18)
4
+
5
+ Full Changelog: [v0.2.3...v0.2.4](https://github.com/linq-team/linq-python/compare/v0.2.3...v0.2.4)
6
+
7
+ ### Bug Fixes
8
+
9
+ * ensure file data are only sent as 1 parameter ([0e5a821](https://github.com/linq-team/linq-python/commit/0e5a8217fcab667939e6a211e4f3b9abab7acfca))
10
+
11
+
12
+ ### Performance Improvements
13
+
14
+ * **client:** optimize file structure copying in multipart requests ([2d5ebac](https://github.com/linq-team/linq-python/commit/2d5ebacb793aa7f2f86b9e820db6e8f01b71605d))
15
+
16
+
17
+ ### Documentation
18
+
19
+ * **openapi:** document typing indicator behavior and limitations ([3ea2cea](https://github.com/linq-team/linq-python/commit/3ea2ceaf47fd3a340a58e7334e58375f950862fc))
20
+
3
21
  ## 0.2.3 (2026-04-08)
4
22
 
5
23
  Full Changelog: [v0.2.2...v0.2.3](https://github.com/linq-team/linq-python/compare/v0.2.2...v0.2.3)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: linq-python
3
- Version: 0.2.3
3
+ Version: 0.2.4
4
4
  Summary: The official Python library for the linq-api-v3 API
5
5
  Project-URL: Homepage, https://github.com/linq-team/linq-python
6
6
  Project-URL: Repository, https://github.com/linq-team/linq-python
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "linq-python"
3
- version = "0.2.3"
3
+ version = "0.2.4"
4
4
  description = "The official Python library for the linq-api-v3 API"
5
5
  dynamic = ["readme"]
6
6
  license = "Apache-2.0"
@@ -3,8 +3,8 @@ from __future__ import annotations
3
3
  import io
4
4
  import os
5
5
  import pathlib
6
- from typing import overload
7
- from typing_extensions import TypeGuard
6
+ from typing import Sequence, cast, overload
7
+ from typing_extensions import TypeVar, TypeGuard
8
8
 
9
9
  import anyio
10
10
 
@@ -17,7 +17,9 @@ from ._types import (
17
17
  HttpxFileContent,
18
18
  HttpxRequestFiles,
19
19
  )
20
- from ._utils import is_tuple_t, is_mapping_t, is_sequence_t
20
+ from ._utils import is_list, is_mapping, is_tuple_t, is_mapping_t, is_sequence_t
21
+
22
+ _T = TypeVar("_T")
21
23
 
22
24
 
23
25
  def is_base64_file_input(obj: object) -> TypeGuard[Base64FileInput]:
@@ -121,3 +123,51 @@ async def async_read_file_content(file: FileContent) -> HttpxFileContent:
121
123
  return await anyio.Path(file).read_bytes()
122
124
 
123
125
  return file
126
+
127
+
128
+ def deepcopy_with_paths(item: _T, paths: Sequence[Sequence[str]]) -> _T:
129
+ """Copy only the containers along the given paths.
130
+
131
+ Used to guard against mutation by extract_files without copying the entire structure.
132
+ Only dicts and lists that lie on a path are copied; everything else
133
+ is returned by reference.
134
+
135
+ For example, given paths=[["foo", "files", "file"]] and the structure:
136
+ {
137
+ "foo": {
138
+ "bar": {"baz": {}},
139
+ "files": {"file": <content>}
140
+ }
141
+ }
142
+ The root dict, "foo", and "files" are copied (they lie on the path).
143
+ "bar" and "baz" are returned by reference (off the path).
144
+ """
145
+ return _deepcopy_with_paths(item, paths, 0)
146
+
147
+
148
+ def _deepcopy_with_paths(item: _T, paths: Sequence[Sequence[str]], index: int) -> _T:
149
+ if not paths:
150
+ return item
151
+ if is_mapping(item):
152
+ key_to_paths: dict[str, list[Sequence[str]]] = {}
153
+ for path in paths:
154
+ if index < len(path):
155
+ key_to_paths.setdefault(path[index], []).append(path)
156
+
157
+ # if no path continues through this mapping, it won't be mutated and copying it is redundant
158
+ if not key_to_paths:
159
+ return item
160
+
161
+ result = dict(item)
162
+ for key, subpaths in key_to_paths.items():
163
+ if key in result:
164
+ result[key] = _deepcopy_with_paths(result[key], subpaths, index + 1)
165
+ return cast(_T, result)
166
+ if is_list(item):
167
+ array_paths = [path for path in paths if index < len(path) and path[index] == "<array>"]
168
+
169
+ # if no path expects a list here, nothing will be mutated inside it - return by reference
170
+ if not array_paths:
171
+ return cast(_T, item)
172
+ return cast(_T, [_deepcopy_with_paths(entry, array_paths, index + 1) for entry in item])
173
+ return item
@@ -24,7 +24,6 @@ from ._utils import (
24
24
  coerce_integer as coerce_integer,
25
25
  file_from_path as file_from_path,
26
26
  strip_not_given as strip_not_given,
27
- deepcopy_minimal as deepcopy_minimal,
28
27
  get_async_library as get_async_library,
29
28
  maybe_coerce_float as maybe_coerce_float,
30
29
  get_required_header as get_required_header,
@@ -86,8 +86,9 @@ def _extract_items(
86
86
  index += 1
87
87
  if is_dict(obj):
88
88
  try:
89
- # We are at the last entry in the path so we must remove the field
90
- if (len(path)) == index:
89
+ # Remove the field if there are no more dict keys in the path,
90
+ # only "<array>" traversal markers or end.
91
+ if all(p == "<array>" for p in path[index:]):
91
92
  item = obj.pop(key)
92
93
  else:
93
94
  item = obj[key]
@@ -176,21 +177,6 @@ def is_iterable(obj: object) -> TypeGuard[Iterable[object]]:
176
177
  return isinstance(obj, Iterable)
177
178
 
178
179
 
179
- def deepcopy_minimal(item: _T) -> _T:
180
- """Minimal reimplementation of copy.deepcopy() that will only copy certain object types:
181
-
182
- - mappings, e.g. `dict`
183
- - list
184
-
185
- This is done for performance reasons.
186
- """
187
- if is_mapping(item):
188
- return cast(_T, {k: deepcopy_minimal(v) for k, v in item.items()})
189
- if is_list(item):
190
- return cast(_T, [deepcopy_minimal(entry) for entry in item])
191
- return item
192
-
193
-
194
180
  # copied from https://github.com/Rapptz/RoboDanny
195
181
  def human_join(seq: Sequence[str], *, delim: str = ", ", final: str = "or") -> str:
196
182
  size = len(seq)
@@ -1,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "linq"
4
- __version__ = "0.2.3" # x-release-please-version
4
+ __version__ = "0.2.4" # x-release-please-version
@@ -71,8 +71,20 @@ class TypingResource(SyncAPIResource):
71
71
  """
72
72
  Send a typing indicator to show that someone is typing in the chat.
73
73
 
74
- **Note:** Group chat typing indicators are not currently supported. Attempting
75
- to start a typing indicator in a group chat will return a `403` error.
74
+ ## Behavior & Limitations
75
+
76
+ Typing indicators are best-effort signals with the following limitations:
77
+
78
+ - **Active conversations only:** The recipient must have sent or received a
79
+ message in this chat within the **last 5 minutes**. If the chat is inactive,
80
+ the request is still accepted (`204`) but the indicator will not reach the
81
+ recipient's device.
82
+
83
+ - **No delivery guarantee:** Even for active chats, a `204` response only
84
+ indicates the request was accepted for processing.
85
+
86
+ - **Group chats not supported:** Attempting to start a typing indicator in a
87
+ group chat will return a `403` error.
76
88
 
77
89
  Args:
78
90
  extra_headers: Send extra headers
@@ -108,11 +120,12 @@ class TypingResource(SyncAPIResource):
108
120
  """
109
121
  Stop the typing indicator for the chat.
110
122
 
111
- **Note:** Typing indicators are automatically stopped when a message is sent, so
112
- calling this endpoint after sending a message is unnecessary.
123
+ Typing indicators are automatically stopped when a message is sent, so calling
124
+ this endpoint after sending a message is unnecessary.
125
+
126
+ See the `POST` endpoint above for behavior details and limitations.
113
127
 
114
- **Note:** Group chat typing indicators are not currently supported. Attempting
115
- to stop a typing indicator in a group chat will return a `403` error.
128
+ **Note:** Group chats are not supported and will return a `403` error.
116
129
 
117
130
  Args:
118
131
  extra_headers: Send extra headers
@@ -187,8 +200,20 @@ class AsyncTypingResource(AsyncAPIResource):
187
200
  """
188
201
  Send a typing indicator to show that someone is typing in the chat.
189
202
 
190
- **Note:** Group chat typing indicators are not currently supported. Attempting
191
- to start a typing indicator in a group chat will return a `403` error.
203
+ ## Behavior & Limitations
204
+
205
+ Typing indicators are best-effort signals with the following limitations:
206
+
207
+ - **Active conversations only:** The recipient must have sent or received a
208
+ message in this chat within the **last 5 minutes**. If the chat is inactive,
209
+ the request is still accepted (`204`) but the indicator will not reach the
210
+ recipient's device.
211
+
212
+ - **No delivery guarantee:** Even for active chats, a `204` response only
213
+ indicates the request was accepted for processing.
214
+
215
+ - **Group chats not supported:** Attempting to start a typing indicator in a
216
+ group chat will return a `403` error.
192
217
 
193
218
  Args:
194
219
  extra_headers: Send extra headers
@@ -224,11 +249,12 @@ class AsyncTypingResource(AsyncAPIResource):
224
249
  """
225
250
  Stop the typing indicator for the chat.
226
251
 
227
- **Note:** Typing indicators are automatically stopped when a message is sent, so
228
- calling this endpoint after sending a message is unnecessary.
252
+ Typing indicators are automatically stopped when a message is sent, so calling
253
+ this endpoint after sending a message is unnecessary.
254
+
255
+ See the `POST` endpoint above for behavior details and limitations.
229
256
 
230
- **Note:** Group chat typing indicators are not currently supported. Attempting
231
- to stop a typing indicator in a group chat will return a `403` error.
257
+ **Note:** Group chats are not supported and will return a `403` error.
232
258
 
233
259
  Args:
234
260
  extra_headers: Send extra headers
@@ -35,6 +35,15 @@ def test_multiple_files() -> None:
35
35
  assert query == {"documents": [{}, {}]}
36
36
 
37
37
 
38
+ def test_top_level_file_array() -> None:
39
+ query = {"files": [b"file one", b"file two"], "title": "hello"}
40
+ assert extract_files(query, paths=[["files", "<array>"]]) == [
41
+ ("files[]", b"file one"),
42
+ ("files[]", b"file two"),
43
+ ]
44
+ assert query == {"title": "hello"}
45
+
46
+
38
47
  @pytest.mark.parametrize(
39
48
  "query,paths,expected",
40
49
  [
@@ -0,0 +1,148 @@
1
+ from pathlib import Path
2
+
3
+ import anyio
4
+ import pytest
5
+ from dirty_equals import IsDict, IsList, IsBytes, IsTuple
6
+
7
+ from linq._files import to_httpx_files, deepcopy_with_paths, async_to_httpx_files
8
+ from linq._utils import extract_files
9
+
10
+ readme_path = Path(__file__).parent.parent.joinpath("README.md")
11
+
12
+
13
+ def test_pathlib_includes_file_name() -> None:
14
+ result = to_httpx_files({"file": readme_path})
15
+ print(result)
16
+ assert result == IsDict({"file": IsTuple("README.md", IsBytes())})
17
+
18
+
19
+ def test_tuple_input() -> None:
20
+ result = to_httpx_files([("file", readme_path)])
21
+ print(result)
22
+ assert result == IsList(IsTuple("file", IsTuple("README.md", IsBytes())))
23
+
24
+
25
+ @pytest.mark.asyncio
26
+ async def test_async_pathlib_includes_file_name() -> None:
27
+ result = await async_to_httpx_files({"file": readme_path})
28
+ print(result)
29
+ assert result == IsDict({"file": IsTuple("README.md", IsBytes())})
30
+
31
+
32
+ @pytest.mark.asyncio
33
+ async def test_async_supports_anyio_path() -> None:
34
+ result = await async_to_httpx_files({"file": anyio.Path(readme_path)})
35
+ print(result)
36
+ assert result == IsDict({"file": IsTuple("README.md", IsBytes())})
37
+
38
+
39
+ @pytest.mark.asyncio
40
+ async def test_async_tuple_input() -> None:
41
+ result = await async_to_httpx_files([("file", readme_path)])
42
+ print(result)
43
+ assert result == IsList(IsTuple("file", IsTuple("README.md", IsBytes())))
44
+
45
+
46
+ def test_string_not_allowed() -> None:
47
+ with pytest.raises(TypeError, match="Expected file types input to be a FileContent type or to be a tuple"):
48
+ to_httpx_files(
49
+ {
50
+ "file": "foo", # type: ignore
51
+ }
52
+ )
53
+
54
+
55
+ def assert_different_identities(obj1: object, obj2: object) -> None:
56
+ assert obj1 == obj2
57
+ assert obj1 is not obj2
58
+
59
+
60
+ class TestDeepcopyWithPaths:
61
+ def test_copies_top_level_dict(self) -> None:
62
+ original = {"file": b"data", "other": "value"}
63
+ result = deepcopy_with_paths(original, [["file"]])
64
+ assert_different_identities(result, original)
65
+
66
+ def test_file_value_is_same_reference(self) -> None:
67
+ file_bytes = b"contents"
68
+ original = {"file": file_bytes}
69
+ result = deepcopy_with_paths(original, [["file"]])
70
+ assert_different_identities(result, original)
71
+ assert result["file"] is file_bytes
72
+
73
+ def test_list_popped_wholesale(self) -> None:
74
+ files = [b"f1", b"f2"]
75
+ original = {"files": files, "title": "t"}
76
+ result = deepcopy_with_paths(original, [["files", "<array>"]])
77
+ assert_different_identities(result, original)
78
+ result_files = result["files"]
79
+ assert isinstance(result_files, list)
80
+ assert_different_identities(result_files, files)
81
+
82
+ def test_nested_array_path_copies_list_and_elements(self) -> None:
83
+ elem1 = {"file": b"f1", "extra": 1}
84
+ elem2 = {"file": b"f2", "extra": 2}
85
+ original = {"items": [elem1, elem2]}
86
+ result = deepcopy_with_paths(original, [["items", "<array>", "file"]])
87
+ assert_different_identities(result, original)
88
+ result_items = result["items"]
89
+ assert isinstance(result_items, list)
90
+ assert_different_identities(result_items, original["items"])
91
+ assert_different_identities(result_items[0], elem1)
92
+ assert_different_identities(result_items[1], elem2)
93
+
94
+ def test_empty_paths_returns_same_object(self) -> None:
95
+ original = {"foo": "bar"}
96
+ result = deepcopy_with_paths(original, [])
97
+ assert result is original
98
+
99
+ def test_multiple_paths(self) -> None:
100
+ f1 = b"file1"
101
+ f2 = b"file2"
102
+ original = {"a": f1, "b": f2, "c": "unchanged"}
103
+ result = deepcopy_with_paths(original, [["a"], ["b"]])
104
+ assert_different_identities(result, original)
105
+ assert result["a"] is f1
106
+ assert result["b"] is f2
107
+ assert result["c"] is original["c"]
108
+
109
+ def test_extract_files_does_not_mutate_original_top_level(self) -> None:
110
+ file_bytes = b"contents"
111
+ original = {"file": file_bytes, "other": "value"}
112
+
113
+ copied = deepcopy_with_paths(original, [["file"]])
114
+ extracted = extract_files(copied, paths=[["file"]])
115
+
116
+ assert extracted == [("file", file_bytes)]
117
+ assert original == {"file": file_bytes, "other": "value"}
118
+ assert copied == {"other": "value"}
119
+
120
+ def test_extract_files_does_not_mutate_original_nested_array_path(self) -> None:
121
+ file1 = b"f1"
122
+ file2 = b"f2"
123
+ original = {
124
+ "items": [
125
+ {"file": file1, "extra": 1},
126
+ {"file": file2, "extra": 2},
127
+ ],
128
+ "title": "example",
129
+ }
130
+
131
+ copied = deepcopy_with_paths(original, [["items", "<array>", "file"]])
132
+ extracted = extract_files(copied, paths=[["items", "<array>", "file"]])
133
+
134
+ assert extracted == [("items[][file]", file1), ("items[][file]", file2)]
135
+ assert original == {
136
+ "items": [
137
+ {"file": file1, "extra": 1},
138
+ {"file": file2, "extra": 2},
139
+ ],
140
+ "title": "example",
141
+ }
142
+ assert copied == {
143
+ "items": [
144
+ {"extra": 1},
145
+ {"extra": 2},
146
+ ],
147
+ "title": "example",
148
+ }
@@ -1,3 +0,0 @@
1
- {
2
- ".": "0.2.3"
3
- }
@@ -1,58 +0,0 @@
1
- from linq._utils import deepcopy_minimal
2
-
3
-
4
- def assert_different_identities(obj1: object, obj2: object) -> None:
5
- assert obj1 == obj2
6
- assert id(obj1) != id(obj2)
7
-
8
-
9
- def test_simple_dict() -> None:
10
- obj1 = {"foo": "bar"}
11
- obj2 = deepcopy_minimal(obj1)
12
- assert_different_identities(obj1, obj2)
13
-
14
-
15
- def test_nested_dict() -> None:
16
- obj1 = {"foo": {"bar": True}}
17
- obj2 = deepcopy_minimal(obj1)
18
- assert_different_identities(obj1, obj2)
19
- assert_different_identities(obj1["foo"], obj2["foo"])
20
-
21
-
22
- def test_complex_nested_dict() -> None:
23
- obj1 = {"foo": {"bar": [{"hello": "world"}]}}
24
- obj2 = deepcopy_minimal(obj1)
25
- assert_different_identities(obj1, obj2)
26
- assert_different_identities(obj1["foo"], obj2["foo"])
27
- assert_different_identities(obj1["foo"]["bar"], obj2["foo"]["bar"])
28
- assert_different_identities(obj1["foo"]["bar"][0], obj2["foo"]["bar"][0])
29
-
30
-
31
- def test_simple_list() -> None:
32
- obj1 = ["a", "b", "c"]
33
- obj2 = deepcopy_minimal(obj1)
34
- assert_different_identities(obj1, obj2)
35
-
36
-
37
- def test_nested_list() -> None:
38
- obj1 = ["a", [1, 2, 3]]
39
- obj2 = deepcopy_minimal(obj1)
40
- assert_different_identities(obj1, obj2)
41
- assert_different_identities(obj1[1], obj2[1])
42
-
43
-
44
- class MyObject: ...
45
-
46
-
47
- def test_ignores_other_types() -> None:
48
- # custom classes
49
- my_obj = MyObject()
50
- obj1 = {"foo": my_obj}
51
- obj2 = deepcopy_minimal(obj1)
52
- assert_different_identities(obj1, obj2)
53
- assert obj1["foo"] is my_obj
54
-
55
- # tuples
56
- obj3 = ("a", "b")
57
- obj4 = deepcopy_minimal(obj3)
58
- assert obj3 is obj4
@@ -1,51 +0,0 @@
1
- from pathlib import Path
2
-
3
- import anyio
4
- import pytest
5
- from dirty_equals import IsDict, IsList, IsBytes, IsTuple
6
-
7
- from linq._files import to_httpx_files, async_to_httpx_files
8
-
9
- readme_path = Path(__file__).parent.parent.joinpath("README.md")
10
-
11
-
12
- def test_pathlib_includes_file_name() -> None:
13
- result = to_httpx_files({"file": readme_path})
14
- print(result)
15
- assert result == IsDict({"file": IsTuple("README.md", IsBytes())})
16
-
17
-
18
- def test_tuple_input() -> None:
19
- result = to_httpx_files([("file", readme_path)])
20
- print(result)
21
- assert result == IsList(IsTuple("file", IsTuple("README.md", IsBytes())))
22
-
23
-
24
- @pytest.mark.asyncio
25
- async def test_async_pathlib_includes_file_name() -> None:
26
- result = await async_to_httpx_files({"file": readme_path})
27
- print(result)
28
- assert result == IsDict({"file": IsTuple("README.md", IsBytes())})
29
-
30
-
31
- @pytest.mark.asyncio
32
- async def test_async_supports_anyio_path() -> None:
33
- result = await async_to_httpx_files({"file": anyio.Path(readme_path)})
34
- print(result)
35
- assert result == IsDict({"file": IsTuple("README.md", IsBytes())})
36
-
37
-
38
- @pytest.mark.asyncio
39
- async def test_async_tuple_input() -> None:
40
- result = await async_to_httpx_files([("file", readme_path)])
41
- print(result)
42
- assert result == IsList(IsTuple("file", IsTuple("README.md", IsBytes())))
43
-
44
-
45
- def test_string_not_allowed() -> None:
46
- with pytest.raises(TypeError, match="Expected file types input to be a FileContent type or to be a tuple"):
47
- to_httpx_files(
48
- {
49
- "file": "foo", # type: ignore
50
- }
51
- )
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes