Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions cassandra/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@
import weakref
from weakref import WeakValueDictionary

from cassandra import (ConsistencyLevel, AuthenticationFailed, InvalidRequest,
OperationTimedOut, UnsupportedOperation,
from cassandra import (ConsistencyLevel, AuthenticationFailed, OperationTimedOut, UnsupportedOperation,
SchemaTargetType, DriverException, ProtocolVersion,
UnresolvableContactPoints, DependencyException)
from cassandra.auth import _proxy_execute_key, PlainTextAuthProvider
Expand Down Expand Up @@ -85,7 +84,7 @@
named_tuple_factory, dict_factory, tuple_factory, FETCH_SIZE_UNSET,
HostTargetingStatement)
from cassandra.marshal import int64_pack
from cassandra.tablets import Tablet, Tablets
from cassandra.tablets import Tablet
from cassandra.timestamps import MonotonicTimestampGenerator
from cassandra.util import _resolve_contact_points_to_string_map, Version, maybe_add_timeout_to_query

Expand Down
1 change: 0 additions & 1 deletion cassandra/concurrent.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from heapq import heappush, heappop
from itertools import cycle
from threading import Condition
import sys

from cassandra.cluster import ResultSet, EXEC_PROFILE_DEFAULT

Expand Down
2 changes: 1 addition & 1 deletion cassandra/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
RegisterMessage, ReviseRequestMessage)
from cassandra.segment import SegmentCodec, CrcException
from cassandra.util import OrderedDict
from cassandra.shard_info import ShardingInfo
from cassandra.shard_info import ShardingInfo # noqa: F401 # re-exported for cassandra.connection.ShardingInfo

log = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion cassandra/cqlengine/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import logging
import threading

from cassandra.cluster import Cluster, _ConfigMode, _NOT_SET, NoHostAvailable, UserTypeDoesNotExist, ConsistencyLevel
from cassandra.cluster import Cluster, _ConfigMode, _NOT_SET, NoHostAvailable, UserTypeDoesNotExist
from cassandra.query import SimpleStatement, dict_factory

from cassandra.cqlengine import CQLEngineException
Expand Down
2 changes: 1 addition & 1 deletion cassandra/cqlengine/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import time
from warnings import warn

from cassandra.query import SimpleStatement, BatchType as CBatchType, BatchStatement
from cassandra.query import SimpleStatement, BatchType as CBatchType
from cassandra.cqlengine import columns, CQLEngineException, ValidationError, UnicodeMixin
from cassandra.cqlengine import connection as conn
from cassandra.cqlengine.functions import Token, BaseQueryFunction, QueryValue
Expand Down
2 changes: 1 addition & 1 deletion cassandra/cqltypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
from uuid import UUID

from cassandra.marshal import (int8_pack, int8_unpack, int16_pack, int16_unpack,
uint16_pack, uint16_unpack, uint32_pack, uint32_unpack,
uint16_unpack, uint32_pack, uint32_unpack,
int32_pack, int32_unpack, int64_pack, int64_unpack,
float_pack, float_unpack, double_pack, double_unpack,
varint_pack, varint_unpack, point_be, point_le,
Expand Down
1 change: 0 additions & 1 deletion cassandra/datastax/cloud/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import os
import logging
import json
import sys
import tempfile
import shutil
from urllib.request import urlopen
Expand Down
1 change: 0 additions & 1 deletion cassandra/encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import calendar
import datetime
import math
import sys
import types
from uuid import UUID
import ipaddress
Expand Down
2 changes: 1 addition & 1 deletion cassandra/io/asyncioreactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import os
import socket
import ssl
from threading import Lock, Thread, get_ident
from threading import Lock, Thread


log = logging.getLogger(__name__)
Expand Down
1 change: 0 additions & 1 deletion cassandra/io/asyncorereactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import sys
from threading import Lock, Thread, Event
import time
import weakref
import sys
import ssl

Expand Down
2 changes: 0 additions & 2 deletions cassandra/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@
from concurrent.futures import Future
from functools import total_ordering
import logging
import socket
import time
import random
import copy
import uuid
from threading import Lock, RLock, Condition
import weakref
try:
Expand Down
19 changes: 11 additions & 8 deletions cassandra/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,17 @@
AlreadyExists, InvalidRequest, Unauthorized,
UnsupportedOperation, UserFunctionDescriptor,
UserAggregateDescriptor, SchemaTargetType)
from cassandra.cqltypes import (AsciiType, BytesType, BooleanType,
CounterColumnType, DateType, DecimalType,
DoubleType, FloatType, Int32Type,
InetAddressType, IntegerType, ListType,
LongType, MapType, SetType, TimeUUIDType,
UTF8Type, VarcharType, UUIDType, UserType,
TupleType, lookup_casstype, SimpleDateType,
TimeType, ByteType, ShortType, DurationType)
# NOTE: many of these names are not referenced directly, but are required in module
# scope because ResultMessage.type_codes resolves them dynamically via globals()[name]
# (see the type_codes mapping below). Do not remove as "unused imports".
from cassandra.cqltypes import (AsciiType, BytesType, BooleanType, # noqa: F401
CounterColumnType, DateType, DecimalType, # noqa: F401
DoubleType, FloatType, Int32Type, # noqa: F401
InetAddressType, IntegerType, ListType, # noqa: F401
LongType, MapType, SetType, TimeUUIDType, # noqa: F401
UTF8Type, VarcharType, UUIDType, UserType, # noqa: F401
TupleType, lookup_casstype, SimpleDateType, # noqa: F401
TimeType, ByteType, ShortType, DurationType) # noqa: F401
from cassandra.marshal import (int32_pack, int32_unpack, uint16_pack, uint16_unpack,
uint8_pack, int8_unpack, uint64_pack,
v3_header_pack, uint32_pack, uint32_le_unpack, uint32_le_pack)
Expand Down
1 change: 0 additions & 1 deletion tests/integration/cqlengine/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.

import os
import unittest
from cassandra import ConsistencyLevel

from cassandra.cqlengine import connection
Expand Down
1 change: 0 additions & 1 deletion tests/integration/cqlengine/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.
import unittest

import sys

from cassandra.cqlengine.connection import get_session
from cassandra.cqlengine.models import Model
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/cqlengine/connections/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from cassandra.policies import RoundRobinPolicy
from cassandra.query import dict_factory

from tests.integration import CASSANDRA_IP, PROTOCOL_VERSION, execute_with_long_wait_retry, local, TestCluster
from tests.integration import CASSANDRA_IP, execute_with_long_wait_retry, local, TestCluster
from tests.integration.cqlengine.base import BaseCassEngTestCase
from tests.integration.cqlengine import DEFAULT_KEYSPACE, setup_connection

Expand Down
1 change: 0 additions & 1 deletion tests/integration/cqlengine/management/test_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import unittest

from unittest import mock
import logging
from packaging.version import Version
from cassandra.cqlengine.connection import get_session, get_cluster
from cassandra.cqlengine import CQLEngineException
Expand Down
1 change: 0 additions & 1 deletion tests/integration/cqlengine/model/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from cassandra.cqlengine import models
from cassandra.cqlengine.models import Model, ModelDefinitionException
from uuid import uuid1
from tests.integration import pypy
from tests.integration.cqlengine.base import TestQueryUpdateModel
import pytest

Expand Down
1 change: 0 additions & 1 deletion tests/integration/cqlengine/model/test_model_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from decimal import Decimal
from operator import itemgetter

import cassandra
from cassandra.cqlengine import columns
from cassandra.cqlengine import CQLEngineException
from cassandra.cqlengine.management import sync_table
Expand Down
3 changes: 1 addition & 2 deletions tests/integration/cqlengine/query/test_named.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import unittest

from cassandra import ConsistencyLevel
from cassandra.cqlengine import operators
Expand All @@ -22,7 +21,7 @@
from cassandra.concurrent import execute_concurrent_with_args
from cassandra.cqlengine import models

from tests.integration.cqlengine import setup_connection, execute_count
from tests.integration.cqlengine import execute_count
from tests.integration.cqlengine.base import BaseCassEngTestCase
from tests.integration.cqlengine.query.test_queryset import BaseQuerySetUsage

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import unittest

from cassandra.cqlengine.columns import Column
from cassandra.cqlengine.statements import SelectStatement, WhereClause
from cassandra.cqlengine.statements import SelectStatement
from cassandra.cqlengine.operators import *

class SelectStatementTests(unittest.TestCase):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@

from cassandra.cqlengine.columns import Column, Set, List, Text
from cassandra.cqlengine.operators import *
from cassandra.cqlengine.statements import (UpdateStatement, WhereClause,
AssignmentClause, SetUpdateClause,
ListUpdateClause)
from cassandra.cqlengine.statements import (UpdateStatement)


class UpdateStatementTests(unittest.TestCase):
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/cqlengine/test_connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
from cassandra.cqlengine import columns, CQLEngineException
from cassandra.cqlengine import connection as conn
from cassandra.cqlengine.management import drop_keyspace, sync_table, drop_table, create_keyspace_simple
from cassandra.cqlengine.models import Model, QuerySetDescriptor
from cassandra.cqlengine.models import Model
from cassandra.cqlengine.query import ContextQuery, BatchQuery, ModelQuerySet
from tests.integration.cqlengine import setup_connection, DEFAULT_KEYSPACE
from tests.integration.cqlengine.base import BaseCassEngTestCase
from tests.integration.cqlengine.query import test_queryset
from tests.integration import local, CASSANDRA_IP, TestCluster
from tests.integration import CASSANDRA_IP, TestCluster
import pytest


Expand Down
2 changes: 1 addition & 1 deletion tests/integration/cqlengine/test_ifexists.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from cassandra.cqlengine import columns
from cassandra.cqlengine.management import sync_table, drop_table
from cassandra.cqlengine.models import Model
from cassandra.cqlengine.query import BatchQuery, BatchType, LWTException, IfExistsWithCounterColumn
from cassandra.cqlengine.query import BatchQuery, LWTException, IfExistsWithCounterColumn

from tests.integration.cqlengine.base import BaseCassEngTestCase
from tests.integration import PROTOCOL_VERSION
Expand Down
3 changes: 1 addition & 2 deletions tests/integration/cqlengine/test_ttl.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.


import unittest

from packaging.version import Version

Expand All @@ -25,7 +24,7 @@
from cassandra.cqlengine import columns
from unittest import mock
from cassandra.cqlengine.connection import get_session
from tests.integration import CASSANDRA_VERSION, greaterthancass20
from tests.integration import CASSANDRA_VERSION


class TestTTLModel(Model):
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/long/test_large_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from cassandra.cluster import ExecutionProfile, EXEC_PROFILE_DEFAULT
from cassandra.query import dict_factory
from cassandra.query import SimpleStatement
from tests.integration import use_singledc, PROTOCOL_VERSION, TestCluster
from tests.integration import use_singledc, TestCluster
from tests.integration.long.utils import create_schema

import unittest
Expand Down
1 change: 0 additions & 1 deletion tests/integration/simulacron/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
clear_queries,
start_and_prime_singledc,
stop_simulacron,
start_and_prime_cluster_defaults,
)

from cassandra.cluster import Cluster
Expand Down
7 changes: 2 additions & 5 deletions tests/integration/simulacron/test_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,12 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest

import logging
from packaging.version import Version

import cassandra
from tests.integration.simulacron import SimulacronCluster, SimulacronBase
from tests.integration.simulacron import SimulacronCluster
from tests.integration import (requiressimulacron, PROTOCOL_VERSION, MockLoggingHandler)
from tests.integration.simulacron.utils import prime_query, start_and_prime_singledc
from tests.integration.simulacron.utils import prime_query

from cassandra import (WriteTimeout, WriteType,
ConsistencyLevel, UnresolvableContactPoints)
Expand Down
1 change: 0 additions & 1 deletion tests/integration/simulacron/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest

import logging
import time
Expand Down
2 changes: 0 additions & 2 deletions tests/integration/simulacron/test_empty_column.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest

from collections import namedtuple, OrderedDict

from cassandra import ProtocolVersion
from cassandra.cluster import Cluster, EXEC_PROFILE_DEFAULT
from cassandra.query import (named_tuple_factory, tuple_factory,
dict_factory, ordered_dict_factory)
Expand Down
1 change: 0 additions & 1 deletion tests/integration/simulacron/test_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest

from functools import total_ordering

Expand Down
1 change: 0 additions & 1 deletion tests/integration/simulacron/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import json
import subprocess
import time
from urllib.request import build_opener, Request, HTTPHandler

from cassandra.metadata import SchemaParserV4, SchemaParserDSE68
Expand Down
1 change: 0 additions & 1 deletion tests/integration/standard/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import pytest
import logging

# Cluster topology groups for test ordering.
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/standard/test_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
import pytest

import cassandra
from cassandra.cluster import NoHostAvailable, ExecutionProfile, EXEC_PROFILE_DEFAULT, ControlConnection, Cluster
from cassandra.cluster import NoHostAvailable, ExecutionProfile, EXEC_PROFILE_DEFAULT, Cluster
from cassandra.concurrent import execute_concurrent
from cassandra.policies import (RoundRobinPolicy, ExponentialReconnectionPolicy,
RetryPolicy, SimpleConvictionPolicy, HostDistance,
SimpleConvictionPolicy, HostDistance,
AddressTranslator, TokenAwarePolicy, HostFilterPolicy)
from cassandra import ConsistencyLevel

Expand All @@ -43,7 +43,7 @@
from tests.integration import use_cluster, get_server_versions, CASSANDRA_VERSION, \
execute_until_pass, execute_with_long_wait_retry, get_node, MockLoggingHandler, get_unsupported_lower_protocol, \
get_unsupported_upper_protocol, local, CASSANDRA_IP, greaterthanorequalcass30, \
lessthanorequalcass40, TestCluster, PROTOCOL_VERSION, xfail_scylla, incorrect_test
lessthanorequalcass40, TestCluster, PROTOCOL_VERSION, incorrect_test
from tests.integration.util import assert_quiescent_pool_state
from tests.util import assertListEqual
import sys
Expand Down
1 change: 0 additions & 1 deletion tests/integration/standard/test_concurrent.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
ReadFailure, WriteFailure
from cassandra.cluster import ExecutionProfile, EXEC_PROFILE_DEFAULT
from cassandra.concurrent import execute_concurrent, execute_concurrent_with_args, ExecutionResult
from cassandra.policies import HostDistance
from cassandra.query import dict_factory, tuple_factory, SimpleStatement

from tests.integration import use_singledc, PROTOCOL_VERSION, TestCluster
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
import logging
import unittest

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/standard/test_custom_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from cassandra.cluster import NoHostAvailable
from tests.integration import use_singledc, get_cluster, remove_cluster, local, TestCluster
from tests.util import wait_until, wait_until_not_raised
from tests.util import wait_until

import unittest
import pytest
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/standard/test_custom_payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

from cassandra.query import (SimpleStatement, BatchStatement, BatchType)

from tests.integration import (use_singledc, PROTOCOL_VERSION, local, TestCluster,
from tests.integration import (use_singledc, local, TestCluster,
requires_custom_payload)
import pytest

Expand Down
Loading
Loading