Skip to content

Commit 41a9bda

Browse files
authored
CircleCI config (#9)
* Adjusting documentation * RTD theme version * Adding circle ci config * Install rtd requirements * requirements.txt no longer needed * Fixing circleci config * Fixing circleci config * Typo fix * Typo fix * Fixing mypy * Fixing test
1 parent 962c35f commit 41a9bda

File tree

7 files changed

+22
-20
lines changed

7 files changed

+22
-20
lines changed

.circleci/config.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ executors:
66
- image: cimg/python:3.12
77
python-vm:
88
machine:
9-
- image: ubuntu-2204:current
9+
image: ubuntu-2204:current
1010

1111
workflows:
1212
ci:
@@ -59,7 +59,7 @@ jobs:
5959
name: Setup ArangoDB
6060
command: |
6161
chmod +x starter.sh
62-
./starter.sh ${{ matrix.arangodb_config }} ${{ matrix.arangodb_license }} ${{ matrix.arangodb_version }}
62+
./starter.sh << parameters.arangodb_config >> << parameters.arangodb_license >> << parameters.arangodb_version >>
6363
- restore_cache:
6464
key: pip-and-local-cache
6565
- run:

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
33
rev: v4.4.0
4-
# See https://pre-commit.com/hooks.html
4+
# See https://pre-commit.com/hooks.html
55
hooks:
66
- id: check-case-conflict
77
- id: check-executables-have-shebangs

arangoasync/http.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ async def send_request(
156156
url=str(response.real_url),
157157
headers=response.headers,
158158
status_code=response.status,
159-
status_text=response.reason,
159+
status_text=str(response.reason),
160160
raw_body=raw_body,
161161
)
162162

arangoasync/request.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from enum import Enum, auto
77
from typing import Optional
88

9-
from arangoasync.typings import Headers, Params
9+
from arangoasync.typings import Params, RequestHeaders
1010
from arangoasync.version import __version__
1111

1212

@@ -52,18 +52,18 @@ def __init__(
5252
self,
5353
method: Method,
5454
endpoint: str,
55-
headers: Optional[Headers] = None,
55+
headers: Optional[RequestHeaders] = None,
5656
params: Optional[Params] = None,
5757
data: Optional[str] = None,
5858
) -> None:
5959
self.method: Method = method
6060
self.endpoint: str = endpoint
61-
self.headers: Headers = self._normalize_headers(headers)
61+
self.headers: RequestHeaders = self._normalize_headers(headers)
6262
self.params: Params = self._normalize_params(params)
6363
self.data: Optional[str] = data
6464

6565
@staticmethod
66-
def _normalize_headers(headers: Optional[Headers]) -> Headers:
66+
def _normalize_headers(headers: Optional[RequestHeaders]) -> RequestHeaders:
6767
"""Normalize request headers.
6868
6969
Parameters:
@@ -73,7 +73,7 @@ def _normalize_headers(headers: Optional[Headers]) -> Headers:
7373
dict: Normalized request headers.
7474
"""
7575
driver_header = f"arangoasync/{__version__}"
76-
normalized_headers: Headers = {
76+
normalized_headers: RequestHeaders = {
7777
"charset": "utf-8",
7878
"content-type": "application/json",
7979
"x-arango-driver": driver_header,

arangoasync/response.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from typing import Optional
66

77
from arangoasync.request import Method
8-
from arangoasync.typings import Headers
8+
from arangoasync.typings import ResponseHeaders
99

1010

1111
class Response:
@@ -14,15 +14,15 @@ class Response:
1414
Parameters:
1515
method (Method): HTTP method.
1616
url (str): API URL.
17-
headers (dict | None): Response headers.
17+
headers (dict): Response headers.
1818
status_code (int): Response status code.
1919
status_text (str): Response status text.
2020
raw_body (bytes): Raw response body.
2121
2222
Attributes:
2323
method (Method): HTTP method.
2424
url (str): API URL.
25-
headers (dict | None): Response headers.
25+
headers (dict): Response headers.
2626
status_code (int): Response status code.
2727
status_text (str): Response status text.
2828
raw_body (bytes): Raw response body.
@@ -47,14 +47,14 @@ def __init__(
4747
self,
4848
method: Method,
4949
url: str,
50-
headers: Headers,
50+
headers: ResponseHeaders,
5151
status_code: int,
5252
status_text: str,
5353
raw_body: bytes,
5454
) -> None:
5555
self.method: Method = method
5656
self.url: str = url
57-
self.headers: Headers = headers
57+
self.headers: ResponseHeaders = headers
5858
self.status_code: int = status_code
5959
self.status_text: str = status_text
6060
self.raw_body: bytes = raw_body

arangoasync/typings.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
__all__ = [
2-
"Headers",
2+
"RequestHeaders",
3+
"ResponseHeaders",
34
"Params",
45
]
56

67
from typing import MutableMapping
78

8-
from multidict import MultiDict
9+
from multidict import CIMultiDictProxy, MultiDict
910

10-
Headers = MutableMapping[str, str] | MultiDict[str]
11-
Headers.__doc__ = """Type definition for HTTP headers"""
11+
RequestHeaders = MutableMapping[str, str] | MultiDict[str]
12+
RequestHeaders.__doc__ = """Type definition for request HTTP headers"""
13+
14+
ResponseHeaders = MutableMapping[str, str] | MultiDict[str] | CIMultiDictProxy[str]
15+
ResponseHeaders.__doc__ = """Type definition for response HTTP headers"""
1216

1317
Params = MutableMapping[str, bool | int | str]
1418
Params.__doc__ = """Type definition for URL (query) parameters"""

tests/test_http.py

-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ async def test_AioHTTPClient_simple_request(url):
1212
request = Request(
1313
method=Method.GET,
1414
endpoint="/_api/version",
15-
deserialize=False,
1615
)
1716
response = await client.send_request(session, request)
1817
assert response.method == Method.GET
@@ -28,7 +27,6 @@ async def test_AioHTTPClient_auth_pass(url, root, password):
2827
request = Request(
2928
method=Method.GET,
3029
endpoint="/_api/version",
31-
deserialize=False,
3230
)
3331
response = await client.send_request(session, request)
3432
assert response.method == Method.GET

0 commit comments

Comments
 (0)