Skip to content
4 changes: 0 additions & 4 deletions cassandra/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -4243,7 +4243,7 @@
self._scheduled_tasks.discard(task)
fn, args, kwargs = task
kwargs = dict(kwargs)
future = self._executor.submit(fn, *args, **kwargs)

Check failure on line 4246 in cassandra/cluster.py

View workflow job for this annotation

GitHub Actions / test libev (3.12)

cannot schedule new futures after shutdown
future.add_done_callback(self._log_if_failed)
else:
self._queue.put_nowait((run_at, i, task))
Expand Down Expand Up @@ -4316,10 +4316,8 @@
session = None
row_factory = None
message = None
default_timeout = None

_retry_policy = None
_profile_manager = None

_req_id = None
_final_result = _NOT_SET
Expand All @@ -4343,8 +4341,6 @@
_continuous_paging_session = None
_host = None

_warned_timeout = False

def __init__(self, session, message, query, timeout, metrics=None, prepared_statement=None,
retry_policy=RetryPolicy(), row_factory=None, load_balancer=None, start_time=None,
speculative_execution_plan=None, continuous_paging_state=None, host=None):
Expand Down
2 changes: 2 additions & 0 deletions cassandra/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@ def __repr__(self):


class _Frame(object):
__slots__ = ('version', 'flags', 'stream', 'opcode', 'body_offset', 'end_pos')

def __init__(self, version, flags, stream, opcode, body_offset, end_pos):
self.version = version
self.flags = flags
Expand Down
93 changes: 37 additions & 56 deletions cassandra/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -1647,38 +1647,26 @@ def escape_name(name):
class ColumnMetadata(object):
"""
A representation of a single column in a table.
"""

table = None
""" The :class:`.TableMetadata` this column belongs to. """

name = None
""" The string name of this column. """

cql_type = None
"""
The CQL type for the column.
"""

is_static = False
"""
If this column is static (available in Cassandra 2.1+), this will
be :const:`True`, otherwise :const:`False`.
"""

is_reversed = False
"""
If this column is reversed (DESC) as in clustering order
Attributes:
table: The :class:`.TableMetadata` this column belongs to.
name: The string name of this column.
cql_type: The CQL type for the column.
is_static: If this column is static (available in Cassandra 2.1+), this
will be :const:`True`, otherwise :const:`False`.
is_reversed: If this column is reversed (DESC) as in clustering order.
_cass_type: Internal cache for the cassandra type.
"""

_cass_type = None
__slots__ = ('table', 'name', 'cql_type', 'is_static', 'is_reversed', '_cass_type')

def __init__(self, table_metadata, column_name, cql_type, is_static=False, is_reversed=False):
self.table = table_metadata
self.name = column_name
self.cql_type = cql_type
self.is_static = is_static
self.is_reversed = is_reversed
self._cass_type = None

def __str__(self):
return "%s %s" % (self.name, self.cql_type)
Expand All @@ -1687,21 +1675,16 @@ def __str__(self):
class IndexMetadata(object):
"""
A representation of a secondary index on a column.
"""
keyspace_name = None
""" A string name of the keyspace. """

table_name = None
""" A string name of the table this index is on. """

name = None
""" A string name for the index. """

kind = None
""" A string representing the kind of index (COMPOSITE, CUSTOM,...). """
Attributes:
keyspace_name: A string name of the keyspace.
table_name: A string name of the table this index is on.
name: A string name for the index.
kind: A string representing the kind of index (COMPOSITE, CUSTOM, ...).
index_options: A dict of index options.
"""

index_options = {}
""" A dict of index options. """
__slots__ = ('keyspace_name', 'table_name', 'name', 'kind', 'index_options')

def __init__(self, keyspace_name, table_name, index_name, kind, index_options):
self.keyspace_name = keyspace_name
Expand Down Expand Up @@ -1746,30 +1729,18 @@ def export_as_string(self):
class TokenMap(object):
"""
Information about the layout of the ring.
"""

token_class = None
"""
A subclass of :class:`.Token`, depending on what partitioner the cluster uses.
"""

token_to_host_owner = None
"""
A map of :class:`.Token` objects to the :class:`.Host` that owns that token.
"""

tokens_to_hosts_by_ks = None
"""
A map of keyspace names to a nested map of :class:`.Token` objects to
sets of :class:`.Host` objects.
Attributes:
token_class: A subclass of :class:`.Token`, depending on what partitioner the cluster uses.
token_to_host_owner: A map of :class:`.Token` objects to the :class:`.Host` that owns that token.
tokens_to_hosts_by_ks: A map of keyspace names to a nested map of :class:`.Token` objects to sets of :class:`.Host` objects.
ring: An ordered list of :class:`.Token` instances in the ring.
_metadata: Metadata reference for internal use.
_rebuild_lock: Lock for thread-safe operations.
"""

ring = None
"""
An ordered list of :class:`.Token` instances in the ring.
"""

_metadata = None
__slots__ = ('token_class', 'token_to_host_owner', 'tokens_to_hosts_by_ks',
'ring', '_metadata', '_rebuild_lock')

def __init__(self, token_class, token_to_host_owner, all_tokens, metadata):
self.token_class = token_class
Expand Down Expand Up @@ -1832,6 +1803,8 @@ class Token(object):
Abstract class representing a token.
"""

__slots__ = ('value',)

def __init__(self, token):
self.value = token

Expand Down Expand Up @@ -1871,6 +1844,8 @@ class NoMurmur3(Exception):

class HashToken(Token):

__slots__ = ()

@classmethod
def from_string(cls, token_string):
""" `token_string` should be the string representation from the server. """
Expand All @@ -1883,6 +1858,8 @@ class Murmur3Token(HashToken):
A token for ``Murmur3Partitioner``.
"""

__slots__ = ()

@classmethod
def hash_fn(cls, key):
if murmur3 is not None:
Expand All @@ -1901,6 +1878,8 @@ class MD5Token(HashToken):
A token for ``RandomPartitioner``.
"""

__slots__ = ()

@classmethod
def hash_fn(cls, key):
if isinstance(key, str):
Expand All @@ -1913,6 +1892,8 @@ class BytesToken(Token):
A token for ``ByteOrderedPartitioner``.
"""

__slots__ = ()

@classmethod
def from_string(cls, token_string):
""" `token_string` should be the string representation from the server. """
Expand Down
Loading
Loading