Skip to content

Commit

Permalink
Run optimize imports
Browse files Browse the repository at this point in the history
  • Loading branch information
pnwpedro committed May 20, 2024
1 parent 3dc74c4 commit d7f80b2
Show file tree
Hide file tree
Showing 18 changed files with 34 additions and 37 deletions.
15 changes: 7 additions & 8 deletions fauna/client/client.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
from datetime import timedelta
from dataclasses import dataclass
from typing import Any, Dict, Iterator, Mapping, Optional, List, Union
from contextlib import contextmanager
from datetime import timedelta
from typing import Any, Dict, Iterator, Mapping, Optional, Union

import fauna
from fauna.client.headers import _DriverEnvironment, _Header, _Auth, Header
from fauna.client.retryable import Retryable
from fauna.client.utils import _Environment, LastTxnTs
from fauna.encoding import FaunaEncoder, FaunaDecoder
from fauna.encoding import QuerySuccess, QueryTags, QueryStats
from fauna.errors import FaunaError, ClientError, ProtocolError, \
RetryableFaunaException, NetworkError
from fauna.client.headers import _DriverEnvironment, _Header, _Auth, Header
RetryableFaunaException, NetworkError
from fauna.http.http_client import HTTPClient
from fauna.query import Query, Page, fql
from fauna.query.models import StreamToken
from fauna.client.utils import _Environment, LastTxnTs
from fauna.encoding import FaunaEncoder, FaunaDecoder
from fauna.encoding import QuerySuccess, ConstraintFailure, QueryTags, QueryStats

DefaultHttpConnectTimeout = timedelta(seconds=5)
DefaultHttpReadTimeout: Optional[timedelta] = None
Expand Down
3 changes: 1 addition & 2 deletions fauna/client/retryable.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
from time import sleep
from typing import Callable, Optional, TypeVar, Generic

from fauna.encoding import QuerySuccess
from fauna.errors import RetryableFaunaException, ClientError
from fauna.errors import RetryableFaunaException


class RetryStrategy:
Expand Down
3 changes: 2 additions & 1 deletion fauna/encoding/encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
from datetime import datetime, date
from typing import Any, Optional, List, Union

from fauna.query.models import DocumentReference, Module, Document, NamedDocument, NamedDocumentReference, NullDocument, StreamToken
from fauna.query.models import DocumentReference, Module, Document, NamedDocument, NamedDocumentReference, NullDocument, \
StreamToken
from fauna.query.query_builder import Query, Fragment, LiteralFragment, ValueFragment

_RESERVED_TAGS = [
Expand Down
8 changes: 4 additions & 4 deletions fauna/errors/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from .errors import FaunaException
from .errors import AuthenticationError, AuthorizationError, QueryCheckError, QueryRuntimeError, \
QueryTimeoutError, ServiceInternalError, ServiceTimeoutError, ThrottlingError, ContendedTransactionError, \
InvalidRequestError, AbortError, RetryableFaunaException
from .errors import ClientError, FaunaError, NetworkError
from .errors import FaunaException
from .errors import ProtocolError, ServiceError
from .errors import AuthenticationError, AuthorizationError, QueryCheckError, QueryRuntimeError, \
QueryTimeoutError, ServiceInternalError, ServiceTimeoutError, ThrottlingError, ContendedTransactionError, \
InvalidRequestError, AbortError, RetryableFaunaException
3 changes: 1 addition & 2 deletions fauna/http/http_client.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import abc
import contextlib

from typing import Iterator, Mapping, Any, Optional
from dataclasses import dataclass
from typing import Iterator, Mapping, Any


@dataclass(frozen=True)
Expand Down
2 changes: 1 addition & 1 deletion fauna/http/httpx_client.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json
from contextlib import contextmanager
from json import JSONDecodeError
from typing import Mapping, Any, Optional, Iterator
from contextlib import contextmanager

import httpx

Expand Down
2 changes: 1 addition & 1 deletion fauna/query/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from .query_builder import fql, Query
from .models import Document, DocumentReference, NamedDocument, NamedDocumentReference, NullDocument, Module, Page
from .query_builder import fql, Query
2 changes: 1 addition & 1 deletion fauna/query/template.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from typing import Optional, Tuple, Iterator, Match
import re as _re
from typing import Optional, Tuple, Iterator, Match


class FaunaTemplate:
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/test_client.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from datetime import timedelta
import pytest
from fauna.client.client import QueryOptions

from fauna.errors import ClientError
import pytest

from fauna import fql
from fauna.client import Client
from fauna.client.client import QueryOptions
from fauna.errors import ClientError


def test_client_tracks_last_txn_ts(a_collection):
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_client_with_query_limits.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
from multiprocessing.pool import ThreadPool
from typing import Optional
import os

import pytest

Expand Down
1 change: 0 additions & 1 deletion tests/integration/test_data_type_roundtrips.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import base64
from datetime import datetime, timezone, timedelta

from fauna import fql, Document, NamedDocument
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_query.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from datetime import timedelta
import json
from datetime import timedelta
from types import SimpleNamespace

import pytest

from fauna import fql, Page, NullDocument, Module
from fauna.client import Client, QueryOptions
from fauna.errors import QueryCheckError, QueryRuntimeError, AbortError, ClientError, QueryTimeoutError
from fauna.encoding import ConstraintFailure
from fauna.errors import QueryCheckError, QueryRuntimeError, AbortError, ClientError, QueryTimeoutError


def test_query_smoke_test(subtests, client):
Expand Down
7 changes: 4 additions & 3 deletions tests/integration/test_stream.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import threading
import time
import pytest

import httpx
import fauna
import pytest

from fauna import fql
from fauna.client import Client, StreamOptions
from fauna.http.httpx_client import HTTPXClient
from fauna.errors import NetworkError, RetryableFaunaException, QueryRuntimeError
from fauna.http.httpx_client import HTTPXClient


def test_stream(scoped_client):
Expand Down
5 changes: 2 additions & 3 deletions tests/unit/test_client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import json
from datetime import timedelta
from typing import Dict, List, Any
from typing import Dict

import httpx
import pytest
Expand All @@ -11,8 +10,8 @@
from fauna import fql
from fauna.client import Client, Header, QueryOptions, Endpoints, StreamOptions
from fauna.errors import QueryCheckError, ProtocolError, QueryRuntimeError, NetworkError, AbortError
from fauna.query.models import StreamToken
from fauna.http import HTTPXClient
from fauna.query.models import StreamToken


def test_client_defaults(monkeypatch):
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from fauna import fql
from fauna.encoding import FaunaEncoder, FaunaDecoder
from fauna.query.models import DocumentReference, NamedDocumentReference, Document, NamedDocument, Module, Page, \
NullDocument, StreamToken
NullDocument, StreamToken

fixed_datetime = datetime.fromisoformat("2023-03-17T00:00:00+00:00")

Expand Down
1 change: 0 additions & 1 deletion tests/unit/test_httpx_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import pytest
from pytest_httpx import HTTPXMock, IteratorStream

from fauna.client import Client
from fauna.http import HTTPXClient


Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import datetime

from fauna.query.models import Document, Module, NamedDocument, BaseReference, DocumentReference, \
NamedDocumentReference, Page
NamedDocumentReference, Page

fixed_datetime = datetime.datetime.fromisoformat("2023-03-17")

Expand Down
3 changes: 2 additions & 1 deletion tests/unit/test_retryable.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pytest
from typing import List, Optional

import pytest

from fauna.client.retryable import Retryable, ExponentialBackoffStrategy
from fauna.encoding import QuerySuccess, QueryStats
from fauna.errors import ThrottlingError, ServiceError
Expand Down

0 comments on commit d7f80b2

Please sign in to comment.