python-arango-async 0.0.2__py3-none-any.whl → 0.0.3__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.
arangoasync/aql.py CHANGED
@@ -238,6 +238,11 @@ class AQL:
238
238
  """Return the name of the current database."""
239
239
  return self._executor.db_name
240
240
 
241
+ @property
242
+ def context(self) -> str:
243
+ """Return the current API execution context."""
244
+ return self._executor.context
245
+
241
246
  @property
242
247
  def serializer(self) -> Serializer[Json]:
243
248
  """Return the serializer."""
arangoasync/client.py CHANGED
@@ -139,7 +139,9 @@ class ArangoClient:
139
139
 
140
140
  async def close(self) -> None:
141
141
  """Close HTTP sessions."""
142
- await asyncio.gather(*(session.close() for session in self._sessions))
142
+ await asyncio.gather(
143
+ *(self._http_client.close_session(session) for session in self._sessions)
144
+ )
143
145
 
144
146
  async def db(
145
147
  self,
arangoasync/collection.py CHANGED
@@ -251,6 +251,15 @@ class Collection(Generic[T, U, V]):
251
251
  """
252
252
  return self._name
253
253
 
254
+ @property
255
+ def context(self) -> str:
256
+ """Return the context of the collection.
257
+
258
+ Returns:
259
+ str: Context.
260
+ """
261
+ return self._executor.context
262
+
254
263
  @property
255
264
  def db_name(self) -> str:
256
265
  """Return the name of the current database.
@@ -270,9 +279,17 @@ class Collection(Generic[T, U, V]):
270
279
  """Return the deserializer."""
271
280
  return self._executor.deserializer
272
281
 
273
- async def indexes(self) -> Result[List[IndexProperties]]:
282
+ async def indexes(
283
+ self,
284
+ with_stats: Optional[bool] = None,
285
+ with_hidden: Optional[bool] = None,
286
+ ) -> Result[List[IndexProperties]]:
274
287
  """Fetch all index descriptions for the given collection.
275
288
 
289
+ Args:
290
+ with_stats (bool | None): Whether to include figures and estimates in the result.
291
+ with_hidden (bool | None): Whether to include hidden indexes in the result.
292
+
276
293
  Returns:
277
294
  list: List of index properties.
278
295
 
@@ -282,10 +299,16 @@ class Collection(Generic[T, U, V]):
282
299
  References:
283
300
  - `list-all-indexes-of-a-collection <https://docs.arangodb.com/stable/develop/http-api/indexes/#list-all-indexes-of-a-collection>`__
284
301
  """ # noqa: E501
302
+ params: Params = dict(collection=self._name)
303
+ if with_stats is not None:
304
+ params["withStats"] = with_stats
305
+ if with_hidden is not None:
306
+ params["withHidden"] = with_hidden
307
+
285
308
  request = Request(
286
309
  method=Method.GET,
287
310
  endpoint="/_api/index",
288
- params=dict(collection=self._name),
311
+ params=params,
289
312
  )
290
313
 
291
314
  def response_handler(resp: Response) -> List[IndexProperties]:
@@ -564,6 +587,7 @@ class StandardCollection(Collection[T, U, V]):
564
587
  Raises:
565
588
  DocumentRevisionError: If the revision is incorrect.
566
589
  DocumentGetError: If retrieval fails.
590
+ DocumentParseError: If the document is malformed.
567
591
 
568
592
  References:
569
593
  - `get-a-document <https://docs.arangodb.com/stable/develop/http-api/documents/#get-a-document>`__
@@ -707,6 +731,7 @@ class StandardCollection(Collection[T, U, V]):
707
731
 
708
732
  Raises:
709
733
  DocumentInsertError: If insertion fails.
734
+ DocumentParseError: If the document is malformed.
710
735
 
711
736
  References:
712
737
  - `create-a-document <https://docs.arangodb.com/stable/develop/http-api/documents/#create-a-document>`__
arangoasync/connection.py CHANGED
@@ -177,6 +177,9 @@ class BaseConnection(ABC):
177
177
  host_index = self._host_resolver.get_host_index()
178
178
  for tries in range(self._host_resolver.max_tries):
179
179
  try:
180
+ logger.debug(
181
+ f"Sending request to host {host_index} ({tries}): {request}"
182
+ )
180
183
  resp = await self._http_client.send_request(
181
184
  self._sessions[host_index], request
182
185
  )
arangoasync/database.py CHANGED
@@ -596,7 +596,6 @@ class Database:
596
596
  )
597
597
 
598
598
  def response_handler(resp: Response) -> StandardCollection[T, U, V]:
599
- nonlocal doc_serializer, doc_deserializer
600
599
  if not resp.is_success:
601
600
  raise CollectionCreateError(resp, request)
602
601
  if doc_serializer is None:
@@ -648,7 +647,6 @@ class Database:
648
647
  )
649
648
 
650
649
  def response_handler(resp: Response) -> bool:
651
- nonlocal ignore_missing
652
650
  if resp.is_success:
653
651
  return True
654
652
  if resp.status_code == HTTP_NOT_FOUND and ignore_missing:
@@ -1001,7 +999,6 @@ class Database:
1001
999
  )
1002
1000
 
1003
1001
  def response_handler(resp: Response) -> bool:
1004
- nonlocal ignore_failure
1005
1002
  if resp.is_success:
1006
1003
  return True
1007
1004
  if ignore_failure:
@@ -1046,7 +1043,6 @@ class Database:
1046
1043
  )
1047
1044
 
1048
1045
  def response_handler(resp: Response) -> bool:
1049
- nonlocal ignore_failure
1050
1046
  if resp.is_success:
1051
1047
  return True
1052
1048
  if ignore_failure:
arangoasync/http.py CHANGED
@@ -33,6 +33,8 @@ class HTTPClient(ABC): # pragma: no cover
33
33
  class MyCustomHTTPClient(HTTPClient):
34
34
  def create_session(self, host):
35
35
  pass
36
+ async def close_session(self, session):
37
+ pass
36
38
  async def send_request(self, session, request):
37
39
  pass
38
40
  """
@@ -52,6 +54,18 @@ class HTTPClient(ABC): # pragma: no cover
52
54
  """
53
55
  raise NotImplementedError
54
56
 
57
+ @abstractmethod
58
+ async def close_session(self, session: Any) -> None:
59
+ """Close the session.
60
+
61
+ Note:
62
+ This method must be overridden by the user.
63
+
64
+ Args:
65
+ session (Any): Client session object.
66
+ """
67
+ raise NotImplementedError
68
+
55
69
  @abstractmethod
56
70
  async def send_request(
57
71
  self,
@@ -129,6 +143,14 @@ class AioHTTPClient(HTTPClient):
129
143
  read_bufsize=self._read_bufsize,
130
144
  )
131
145
 
146
+ async def close_session(self, session: ClientSession) -> None:
147
+ """Close the session.
148
+
149
+ Args:
150
+ session (Any): Client session object.
151
+ """
152
+ await session.close()
153
+
132
154
  async def send_request(
133
155
  self,
134
156
  session: ClientSession,
arangoasync/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.0.2"
1
+ __version__ = "0.0.3"
@@ -1,45 +1,23 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-arango-async
3
- Version: 0.0.2
3
+ Version: 0.0.3
4
4
  Summary: Async Python Driver for ArangoDB
5
5
  Author-email: Alexandru Petenchea <alexandru.petenchea@arangodb.com>, Anthony Mahanna <anthony.mahanna@arangodb.com>
6
6
  Maintainer-email: Alexandru Petenchea <alexandru.petenchea@arangodb.com>, Anthony Mahanna <anthony.mahanna@arangodb.com>
7
- License: MIT License
8
-
9
- Copyright (c) 2024 ArangoDB
10
-
11
- Permission is hereby granted, free of charge, to any person obtaining a copy
12
- of this software and associated documentation files (the "Software"), to deal
13
- in the Software without restriction, including without limitation the rights
14
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
- copies of the Software, and to permit persons to whom the Software is
16
- furnished to do so, subject to the following conditions:
17
-
18
- The above copyright notice and this permission notice shall be included in all
19
- copies or substantial portions of the Software.
20
-
21
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
- SOFTWARE.
28
-
7
+ License-Expression: MIT
29
8
  Project-URL: homepage, https://github.com/arangodb/python-arango-async
30
9
  Keywords: arangodb,python,driver,async
31
10
  Classifier: Intended Audience :: Developers
32
- Classifier: License :: OSI Approved :: MIT License
33
11
  Classifier: Natural Language :: English
34
12
  Classifier: Operating System :: OS Independent
35
13
  Classifier: Programming Language :: Python :: 3
36
- Classifier: Programming Language :: Python :: 3.9
37
14
  Classifier: Programming Language :: Python :: 3.10
38
15
  Classifier: Programming Language :: Python :: 3.11
39
16
  Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
40
18
  Classifier: Topic :: Documentation :: Sphinx
41
19
  Classifier: Typing :: Typed
42
- Requires-Python: >=3.9
20
+ Requires-Python: >=3.10
43
21
  Description-Content-Type: text/markdown
44
22
  License-File: LICENSE
45
23
  Requires-Dist: packaging>=23.1
@@ -68,7 +46,7 @@ Dynamic: license-file
68
46
  [![Last commit](https://img.shields.io/github/last-commit/arangodb/python-arango-async)](https://github.com/arangodb/python-arango-async/commits/main)
69
47
 
70
48
  [![PyPI version badge](https://img.shields.io/pypi/v/python-arango-async?color=3775A9&style=for-the-badge&logo=pypi&logoColor=FFD43B)](https://pypi.org/project/python-arango-async/)
71
- [![Python versions badge](https://img.shields.io/badge/3.9%2B-3776AB?style=for-the-badge&logo=python&logoColor=FFD43B&label=Python)](https://pypi.org/project/python-arango-async/)
49
+ [![Python versions badge](https://img.shields.io/badge/3.10%2B-3776AB?style=for-the-badge&logo=python&logoColor=FFD43B&label=Python)](https://pypi.org/project/python-arango-async/)
72
50
 
73
51
  [![License](https://img.shields.io/github/license/arangodb/python-arango?color=9E2165&style=for-the-badge)](https://github.com/arangodb/python-arango/blob/main/LICENSE)
74
52
  [![Code style: black](https://img.shields.io/static/v1?style=for-the-badge&label=code%20style&message=black&color=black)](https://github.com/psf/black)
@@ -80,7 +58,7 @@ Dynamic: license-file
80
58
  Python driver for [ArangoDB](https://www.arangodb.com), a scalable multi-model
81
59
  database natively supporting documents, graphs and search.
82
60
 
83
- This is the _asyncio_ alternative of the officially supported [python-arango](https://github.com/arangodb/python-arango)
61
+ This is the _asyncio_ alternative of the [python-arango](https://github.com/arangodb/python-arango)
84
62
  driver.
85
63
 
86
64
  **Note: This project is still in active development, features might be added or removed.**
@@ -88,7 +66,7 @@ driver.
88
66
  ## Requirements
89
67
 
90
68
  - ArangoDB version 3.11+
91
- - Python version 3.9+
69
+ - Python version 3.10+
92
70
 
93
71
  ## Installation
94
72
 
@@ -1,16 +1,16 @@
1
1
  arangoasync/__init__.py,sha256=HEJ7_q_pRcS9Gco3poa89jLQr_zDrDrHAXCEJMgjUFI,196
2
- arangoasync/aql.py,sha256=LetOQO5rzoER_dyTJhbEqPScifZRtgLA4y09K5RgQIY,28897
2
+ arangoasync/aql.py,sha256=wof_53c0qvjjo470Q7o8mJzh3mZ7b79BF3LROd5PXf0,29036
3
3
  arangoasync/auth.py,sha256=MM13-S06zBU22v1Y978URMBOBgb1O1HLIANL7HKv9cA,2989
4
- arangoasync/client.py,sha256=WoYcQJrppzNGf73a6OuCyfnSdMZ-hywCPUyqa2MAbOc,9871
5
- arangoasync/collection.py,sha256=AB7GwN2BzkhfYCPnNZOA6TqjybvEdn-zNn4WCD2reVc,67915
4
+ arangoasync/client.py,sha256=0h98YyZCuRPtWz3S7nVOXrRJaPRsFEjoQr9px-z7S9Y,9918
5
+ arangoasync/collection.py,sha256=zL2UqBIx5xFMyR_ySNACcfBZpoJZsrXuaJXJVtv9zSY,68722
6
6
  arangoasync/compression.py,sha256=vMhcg5nQPkbgplk48vxARUnJ6YeIwrCLC6pDCVJSwo0,3804
7
- arangoasync/connection.py,sha256=4JEbbeBPhlSSbhvNfwSKD9jKDrhvbLqM29UhPr5eszY,17236
7
+ arangoasync/connection.py,sha256=Md7vOVDEJRG0kYOSsYJtJxW54sqdTfAyfZkbM-KzeBc,17365
8
8
  arangoasync/cursor.py,sha256=GUnfjIuA4nmfk5GMi3WR5MXCaqHr_eyRmGWBG6ZuqLM,8446
9
- arangoasync/database.py,sha256=iHIAZO4gp5TEALmuqGEk-bWQkrgaab_hAlFjzjOlpAg,58927
9
+ arangoasync/database.py,sha256=wYfthDHzpieelm_l359mzANnSbM21W4RnPo3y7gd7P0,58765
10
10
  arangoasync/errno.py,sha256=4oKY9IyyzjOitbywhjH8S214qeNtpDlQg7JsHENJNoU,25245
11
11
  arangoasync/exceptions.py,sha256=7YFm9pqTsnLyp_AcOT-nn0tV7YesgYek9ll-Ydn2PIM,9320
12
12
  arangoasync/executor.py,sha256=eRUfWQc4eHgJr15nPnDju8oSK0408x6yB8XEGk7YhPY,4740
13
- arangoasync/http.py,sha256=Ang6gAwmrkbfZm32OtXylyoFvEb4o-w8aLP098jNE5I,5578
13
+ arangoasync/http.py,sha256=xkxnLMbqFBEngmqGCuBOgRuXgQSBUk9-dzYXB1yrL98,6154
14
14
  arangoasync/job.py,sha256=Lr6BiMywq_iIJYtU8SQ3unhlAa0j1sfNngTm4LFF9ek,7441
15
15
  arangoasync/logger.py,sha256=Ui4n-ELcYM4fujpZV6myU4by82L_70S1cfG0bhEhf-Q,58
16
16
  arangoasync/request.py,sha256=3-C5bFJiihrAEo7pIQX-CSX6nF-x783G_TVLiepz13s,2845
@@ -19,9 +19,9 @@ arangoasync/response.py,sha256=xw8fHODyd8dYc2Cvvk8xhOQ4AynufRE7-qSTHunfBIw,1764
19
19
  arangoasync/result.py,sha256=NVwFxpYUDujHNRCqCZIBOlGLzB7XsiSmjWPFhUgRS6k,233
20
20
  arangoasync/serialization.py,sha256=ExRqrEpbk11Hb3AfFUJGqPlGBD3dbvwQg_xsZUsrm6I,2910
21
21
  arangoasync/typings.py,sha256=JRiHUeZg7GBendgrnw3cedFbMIOXNxx5EM-bgfSJTuU,54801
22
- arangoasync/version.py,sha256=QvlVh4JTl3JL7jQAja76yKtT-IvF4631ASjWY1wS6AQ,22
23
- python_arango_async-0.0.2.dist-info/licenses/LICENSE,sha256=6zoGhJon2tcnvzmycirNjLNBZ6rlLJtYDdVGO76RXVM,1065
24
- python_arango_async-0.0.2.dist-info/METADATA,sha256=cklad_innyaCHLPensB2ouevOCLoCTKIEe6aB9-mIcc,6413
25
- python_arango_async-0.0.2.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
26
- python_arango_async-0.0.2.dist-info/top_level.txt,sha256=uabwJ6t-MiIaZQXGUvYikeSbZDcF0RK37GzikBnDz5k,12
27
- python_arango_async-0.0.2.dist-info/RECORD,,
22
+ arangoasync/version.py,sha256=4GZKi13lDTD25YBkGakhZyEQZWTER_OWQMNPoH_UM2c,22
23
+ python_arango_async-0.0.3.dist-info/licenses/LICENSE,sha256=6zoGhJon2tcnvzmycirNjLNBZ6rlLJtYDdVGO76RXVM,1065
24
+ python_arango_async-0.0.3.dist-info/METADATA,sha256=CerksE9Dkn97BmP7T1QjqXDsxtwl7SzrbkXBCvISzEY,5126
25
+ python_arango_async-0.0.3.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
26
+ python_arango_async-0.0.3.dist-info/top_level.txt,sha256=uabwJ6t-MiIaZQXGUvYikeSbZDcF0RK37GzikBnDz5k,12
27
+ python_arango_async-0.0.3.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (78.1.0)
2
+ Generator: setuptools (80.4.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5