Skip to content

Commit

Permalink
CircleCI config (#9)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
apetenchea authored Jul 28, 2024
1 parent 962c35f commit 41a9bda
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ executors:
- image: cimg/python:3.12
python-vm:
machine:
- image: ubuntu-2204:current
image: ubuntu-2204:current

workflows:
ci:
Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
name: Setup ArangoDB
command: |
chmod +x starter.sh
./starter.sh ${{ matrix.arangodb_config }} ${{ matrix.arangodb_license }} ${{ matrix.arangodb_version }}
./starter.sh << parameters.arangodb_config >> << parameters.arangodb_license >> << parameters.arangodb_version >>
- restore_cache:
key: pip-and-local-cache
- run:
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
# See https://pre-commit.com/hooks.html
# See https://pre-commit.com/hooks.html
hooks:
- id: check-case-conflict
- id: check-executables-have-shebangs
Expand Down
2 changes: 1 addition & 1 deletion arangoasync/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ async def send_request(
url=str(response.real_url),
headers=response.headers,
status_code=response.status,
status_text=response.reason,
status_text=str(response.reason),
raw_body=raw_body,
)

Expand Down
10 changes: 5 additions & 5 deletions arangoasync/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from enum import Enum, auto
from typing import Optional

from arangoasync.typings import Headers, Params
from arangoasync.typings import Params, RequestHeaders
from arangoasync.version import __version__


Expand Down Expand Up @@ -52,18 +52,18 @@ def __init__(
self,
method: Method,
endpoint: str,
headers: Optional[Headers] = None,
headers: Optional[RequestHeaders] = None,
params: Optional[Params] = None,
data: Optional[str] = None,
) -> None:
self.method: Method = method
self.endpoint: str = endpoint
self.headers: Headers = self._normalize_headers(headers)
self.headers: RequestHeaders = self._normalize_headers(headers)
self.params: Params = self._normalize_params(params)
self.data: Optional[str] = data

@staticmethod
def _normalize_headers(headers: Optional[Headers]) -> Headers:
def _normalize_headers(headers: Optional[RequestHeaders]) -> RequestHeaders:
"""Normalize request headers.
Parameters:
Expand All @@ -73,7 +73,7 @@ def _normalize_headers(headers: Optional[Headers]) -> Headers:
dict: Normalized request headers.
"""
driver_header = f"arangoasync/{__version__}"
normalized_headers: Headers = {
normalized_headers: RequestHeaders = {
"charset": "utf-8",
"content-type": "application/json",
"x-arango-driver": driver_header,
Expand Down
10 changes: 5 additions & 5 deletions arangoasync/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from typing import Optional

from arangoasync.request import Method
from arangoasync.typings import Headers
from arangoasync.typings import ResponseHeaders


class Response:
Expand All @@ -14,15 +14,15 @@ class Response:
Parameters:
method (Method): HTTP method.
url (str): API URL.
headers (dict | None): Response headers.
headers (dict): Response headers.
status_code (int): Response status code.
status_text (str): Response status text.
raw_body (bytes): Raw response body.
Attributes:
method (Method): HTTP method.
url (str): API URL.
headers (dict | None): Response headers.
headers (dict): Response headers.
status_code (int): Response status code.
status_text (str): Response status text.
raw_body (bytes): Raw response body.
Expand All @@ -47,14 +47,14 @@ def __init__(
self,
method: Method,
url: str,
headers: Headers,
headers: ResponseHeaders,
status_code: int,
status_text: str,
raw_body: bytes,
) -> None:
self.method: Method = method
self.url: str = url
self.headers: Headers = headers
self.headers: ResponseHeaders = headers
self.status_code: int = status_code
self.status_text: str = status_text
self.raw_body: bytes = raw_body
Expand Down
12 changes: 8 additions & 4 deletions arangoasync/typings.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
__all__ = [
"Headers",
"RequestHeaders",
"ResponseHeaders",
"Params",
]

from typing import MutableMapping

from multidict import MultiDict
from multidict import CIMultiDictProxy, MultiDict

Headers = MutableMapping[str, str] | MultiDict[str]
Headers.__doc__ = """Type definition for HTTP headers"""
RequestHeaders = MutableMapping[str, str] | MultiDict[str]
RequestHeaders.__doc__ = """Type definition for request HTTP headers"""

ResponseHeaders = MutableMapping[str, str] | MultiDict[str] | CIMultiDictProxy[str]
ResponseHeaders.__doc__ = """Type definition for response HTTP headers"""

Params = MutableMapping[str, bool | int | str]
Params.__doc__ = """Type definition for URL (query) parameters"""
2 changes: 0 additions & 2 deletions tests/test_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ async def test_AioHTTPClient_simple_request(url):
request = Request(
method=Method.GET,
endpoint="/_api/version",
deserialize=False,
)
response = await client.send_request(session, request)
assert response.method == Method.GET
Expand All @@ -28,7 +27,6 @@ async def test_AioHTTPClient_auth_pass(url, root, password):
request = Request(
method=Method.GET,
endpoint="/_api/version",
deserialize=False,
)
response = await client.send_request(session, request)
assert response.method == Method.GET
Expand Down

0 comments on commit 41a9bda

Please sign in to comment.