Skip to content

Commit ef176a5

Browse files
authored
Fix spelling issues in python code comments and messages (#1231)
1 parent d7f4541 commit ef176a5

22 files changed

+78
-78
lines changed

cassandra/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def emit(self, record):
2828

2929
class ConsistencyLevel(object):
3030
"""
31-
Spcifies how many replicas must respond for an operation to be considered
31+
Specifies how many replicas must respond for an operation to be considered
3232
a success. By default, ``ONE`` is used for all operations.
3333
"""
3434

@@ -247,7 +247,7 @@ def has_checksumming_support(cls, version):
247247

248248
class WriteType(object):
249249
"""
250-
For usage with :class:`.RetryPolicy`, this describe a type
250+
For usage with :class:`.RetryPolicy`, this describes a type
251251
of write operation.
252252
"""
253253

@@ -272,7 +272,7 @@ class WriteType(object):
272272
COUNTER = 3
273273
"""
274274
A counter write (for one or multiple partition keys). Such writes should
275-
not be replayed in order to avoid overcount.
275+
not be replayed in order to avoid over counting.
276276
"""
277277

278278
BATCH_LOG = 4
@@ -283,7 +283,7 @@ class WriteType(object):
283283

284284
CAS = 5
285285
"""
286-
A lighweight-transaction write, such as "DELETE ... IF EXISTS".
286+
A lightweight-transaction write, such as "DELETE ... IF EXISTS".
287287
"""
288288

289289
VIEW = 6

cassandra/auth.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class Authenticator(object):
7777
7878
3) When the server indicates that authentication is successful,
7979
:meth:`~.on_authentication_success` will be called a token string that
80-
that the server may optionally have sent.
80+
the server may optionally have sent.
8181
8282
The exact nature of the negotiation between the client and server is specific
8383
to the authentication mechanism configured server-side.
@@ -90,7 +90,7 @@ class Authenticator(object):
9090

9191
def initial_response(self):
9292
"""
93-
Returns an message to send to the server to initiate the SASL handshake.
93+
Returns a message to send to the server to initiate the SASL handshake.
9494
:const:`None` may be returned to send an empty message.
9595
"""
9696
return None

cassandra/cluster.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
from cassandra.io.eventletreactor import EventletConnection
102102
# PYTHON-1364
103103
#
104-
# At the moment eventlet initialization is chucking AttributeErrors due to it's dependence on pyOpenSSL
104+
# At the moment eventlet initialization is chucking AttributeErrors due to its dependence on pyOpenSSL
105105
# and some changes in Python 3.12 which have some knock-on effects there.
106106
except (ImportError, AttributeError):
107107
EventletConnection = None
@@ -174,7 +174,7 @@ def _connection_reduce_fn(val,import_fn):
174174
DefaultConnection = conn_class
175175

176176
# Forces load of utf8 encoding module to avoid deadlock that occurs
177-
# if code that is being imported tries to import the module in a seperate
177+
# if code that is being imported tries to import the module in a separate
178178
# thread.
179179
# See http://bugs.python.org/issue10923
180180
"".encode('utf8')
@@ -1024,7 +1024,7 @@ def default_retry_policy(self, policy):
10241024

10251025
application_version = ''
10261026
"""
1027-
A string identifiying this application's version to Insights
1027+
A string identifying this application's version to Insights
10281028
"""
10291029

10301030
cloud = None
@@ -1154,7 +1154,7 @@ def __init__(self,
11541154
column_encryption_policy=None):
11551155
"""
11561156
``executor_threads`` defines the number of threads in a pool for handling asynchronous tasks such as
1157-
extablishing connection pools or refreshing metadata.
1157+
establishing connection pools or refreshing metadata.
11581158
11591159
Any of the mutable Cluster attributes may be set as keyword arguments to the constructor.
11601160
"""
@@ -1461,7 +1461,7 @@ def register_user_type(self, keyspace, user_type, klass):
14611461
for.
14621462
14631463
`klass` should be a class with attributes whose names match the
1464-
fields of the user-defined type. The constructor must accepts kwargs
1464+
fields of the user-defined type. The constructor must accept kwargs
14651465
for each of the fields in the UDT.
14661466
14671467
This method should only be called after the type has been created
@@ -3168,7 +3168,7 @@ def prepare_on_all_hosts(self, query, excluded_host, keyspace=None):
31683168
continue
31693169

31703170
if request_id is None:
3171-
# the error has already been logged by ResponsFuture
3171+
# the error has already been logged by ResponseFuture
31723172
log.debug("Failed to prepare query for host %s: %r",
31733173
host, future._errors.get(host))
31743174
continue
@@ -3965,7 +3965,7 @@ def _handle_status_change(self, event):
39653965
elif change_type == "DOWN":
39663966
# Note that there is a slight risk we can receive the event late and thus
39673967
# mark the host down even though we already had reconnected successfully.
3968-
# But it is unlikely, and don't have too much consequence since we'll try reconnecting
3968+
# This is unlikely, and will not have much consequence because we'll try reconnecting
39693969
# right away, so we favor the detection to make the Host.is_up more accurate.
39703970
if host is not None:
39713971
# this will be run by the scheduler
@@ -4447,7 +4447,7 @@ def _on_speculative_execute(self):
44474447
# PYTHON-836, the speculative queries must be after
44484448
# the query is sent from the main thread, otherwise the
44494449
# query from the main thread may raise NoHostAvailable
4450-
# if the _query_plan has been exhausted by the specualtive queries.
4450+
# if the _query_plan has been exhausted by the speculative queries.
44514451
# This also prevents a race condition accessing the iterator.
44524452
# We reschedule this call until the main thread has succeeded
44534453
# making a query
@@ -4559,7 +4559,7 @@ def warnings(self):
45594559
45604560
Ensure the future is complete before trying to access this property
45614561
(call :meth:`.result()`, or after callback is invoked).
4562-
Otherwise it may throw if the response has not been received.
4562+
Otherwise, it may throw if the response has not been received.
45634563
"""
45644564
# TODO: When timers are introduced, just make this wait
45654565
if not self._event.is_set():
@@ -4575,7 +4575,7 @@ def custom_payload(self):
45754575
45764576
Ensure the future is complete before trying to access this property
45774577
(call :meth:`.result()`, or after callback is invoked).
4578-
Otherwise it may throw if the response has not been received.
4578+
Otherwise, it may throw if the response has not been received.
45794579
45804580
:return: :ref:`custom_payload`.
45814581
"""
@@ -5285,7 +5285,7 @@ def cancel_continuous_paging(self):
52855285
try:
52865286
self.response_future._continuous_paging_session.cancel()
52875287
except AttributeError:
5288-
raise DriverException("Attempted to cancel paging with no active session. This is only for requests with ContinuousdPagingOptions.")
5288+
raise DriverException("Attempted to cancel paging with no active session. This is only for requests with ContinuousPagingOptions.")
52895289

52905290
@property
52915291
def was_applied(self):
@@ -5296,7 +5296,7 @@ def was_applied(self):
52965296
a :class:`.query.BatchStatement` containing LWT. In the latter case either all the batch
52975297
succeeds or fails.
52985298
5299-
Only valid when one of the of the internal row factories is in use.
5299+
Only valid when one of the internal row factories is in use.
53005300
"""
53015301
if self.response_future.row_factory not in (named_tuple_factory, dict_factory, tuple_factory):
53025302
raise RuntimeError("Cannot determine LWT result with row factory %s" % (self.response_future.row_factory,))

cassandra/connection.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,7 @@ def initialize_reactor(cls):
825825
@classmethod
826826
def handle_fork(cls):
827827
"""
828-
Called after a forking. This should cleanup any remaining reactor state
828+
Called after a forking. This should clean up any remaining reactor state
829829
from the parent process.
830830
"""
831831
pass
@@ -862,7 +862,7 @@ def _build_ssl_context_from_options(self):
862862
ssl_context_opt_names = ['ssl_version', 'cert_reqs', 'check_hostname', 'keyfile', 'certfile', 'ca_certs', 'ciphers']
863863
opts = {k:self.ssl_options.get(k, None) for k in ssl_context_opt_names if k in self.ssl_options}
864864

865-
# Python >= 3.10 requires either PROTOCOL_TLS_CLIENT or PROTOCOL_TLS_SERVER so we'll get ahead of things by always
865+
# Python >= 3.10 requires either PROTOCOL_TLS_CLIENT or PROTOCOL_TLS_SERVER, so we'll get ahead of things by always
866866
# being explicit
867867
ssl_version = opts.get('ssl_version', None) or ssl.PROTOCOL_TLS_CLIENT
868868
cert_reqs = opts.get('cert_reqs', None) or ssl.CERT_REQUIRED
@@ -891,7 +891,7 @@ def _wrap_socket_from_context(self):
891891
opts = {k:self.ssl_options.get(k, None) for k in wrap_socket_opt_names if k in self.ssl_options}
892892

893893
# PYTHON-1186: set the server_hostname only if the SSLContext has
894-
# check_hostname enabled and it is not already provided by the EndPoint ssl options
894+
# check_hostname enabled, and it is not already provided by the EndPoint ssl options
895895
#opts['server_hostname'] = self.endpoint.address
896896
if (self.ssl_context.check_hostname and 'server_hostname' not in opts):
897897
server_hostname = self.endpoint.address
@@ -1210,11 +1210,11 @@ def process_io_buffer(self):
12101210

12111211
if not self._current_frame or pos < self._current_frame.end_pos:
12121212
if self._is_checksumming_enabled and self._io_buffer.readable_io_bytes():
1213-
# We have a multi-segments message and we need to read more
1213+
# We have a multi-segments message, and we need to read more
12141214
# data to complete the current cql frame
12151215
continue
12161216

1217-
# we don't have a complete header yet or we
1217+
# we don't have a complete header yet, or we
12181218
# already saw a header, but we don't have a
12191219
# complete message yet
12201220
return
@@ -1713,7 +1713,7 @@ def run(self):
17131713
else:
17141714
log.debug("Cannot send heartbeat message on connection (%s) to %s",
17151715
id(connection), connection.endpoint)
1716-
# make sure the owner sees this defunt/closed connection
1716+
# make sure the owner sees this defunct/closed connection
17171717
owner.return_connection(connection)
17181718
self._raise_if_stopped()
17191719

cassandra/cqlengine/connection.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def from_session(cls, name, session):
8888
return instance
8989

9090
def setup(self):
91-
"""Setup the connection"""
91+
"""Set up the connection"""
9292
global cluster, session
9393

9494
if 'username' in self.cluster_options or 'password' in self.cluster_options:
@@ -134,7 +134,7 @@ def setup_session(self):
134134

135135
def handle_lazy_connect(self):
136136

137-
# if lazy_connect is False, it means the cluster is setup and ready
137+
# if lazy_connect is False, it means the cluster is set up and ready
138138
# No need to acquire the lock
139139
if not self.lazy_connect:
140140
return
@@ -280,7 +280,7 @@ def set_session(s):
280280
try:
281281
conn = get_connection()
282282
except CQLEngineException:
283-
# no default connection set; initalize one
283+
# no default connection set; initialize one
284284
register_connection('default', session=s, default=True)
285285
conn = get_connection()
286286
else:
@@ -316,7 +316,7 @@ def setup(
316316
retry_connect=False,
317317
**kwargs):
318318
"""
319-
Setup a the driver connection used by the mapper
319+
Set up the driver connection used by the mapper
320320
321321
:param list hosts: list of hosts, (``contact_points`` for :class:`cassandra.cluster.Cluster`)
322322
:param str default_keyspace: The default keyspace to use

cassandra/cqlengine/management.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ def _drop_table(model, connection=None):
525525

526526
connection = connection or model._get_connection()
527527

528-
# don't try to delete non existant tables
528+
# don't try to delete non existent tables
529529
meta = get_cluster(connection).metadata
530530

531531
ks_name = model._get_keyspace()

cassandra/cqlengine/models.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def __call__(self, *args, **kwargs):
183183

184184
class IfNotExistsDescriptor(object):
185185
"""
186-
return a query set descriptor with a if_not_exists flag specified
186+
return a query set descriptor with an if_not_exists flag specified
187187
"""
188188
def __get__(self, instance, model):
189189
if instance:
@@ -201,7 +201,7 @@ def __call__(self, *args, **kwargs):
201201

202202
class IfExistsDescriptor(object):
203203
"""
204-
return a query set descriptor with a if_exists flag specified
204+
return a query set descriptor with an if_exists flag specified
205205
"""
206206
def __get__(self, instance, model):
207207
if instance:
@@ -398,7 +398,7 @@ def __init__(self, **values):
398398
self._values = {}
399399
for name, column in self._columns.items():
400400
# Set default values on instantiation. Thanks to this, we don't have
401-
# to wait anylonger for a call to validate() to have CQLengine set
401+
# to wait any longer for a call to validate() to have CQLengine set
402402
# default columns values.
403403
column_default = column.get_default() if column.has_default else None
404404
value = values.get(name, column_default)

cassandra/cqlengine/query.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,7 @@ def fetch_size(self, v):
938938

939939
def allow_filtering(self):
940940
"""
941-
Enables the (usually) unwise practive of querying on a clustering key without also defining a partition key
941+
Enables the (usually) unwise practice of querying on a clustering key without also defining a partition key
942942
"""
943943
clone = copy.deepcopy(self)
944944
clone._allow_filtering = True
@@ -1417,7 +1417,7 @@ def update(self):
14171417
prior to calling this.
14181418
"""
14191419
if self.instance is None:
1420-
raise CQLEngineException("DML Query intance attribute is None")
1420+
raise CQLEngineException("DML Query instance attribute is None")
14211421
assert type(self.instance) == self.model
14221422
null_clustering_key = False if len(self.instance._clustering_keys) == 0 else True
14231423
static_changed_only = True
@@ -1429,7 +1429,7 @@ def update(self):
14291429
updated_columns = set()
14301430
# get defined fields and their column names
14311431
for name, col in self.model._columns.items():
1432-
# if clustering key is null, don't include non static columns
1432+
# if clustering key is null, don't include non-static columns
14331433
if null_clustering_key and not col.static and not col.partition_key:
14341434
continue
14351435
if not col.is_primary_key:
@@ -1448,7 +1448,7 @@ def update(self):
14481448

14491449
if statement.assignments:
14501450
for name, col in self.model._primary_keys.items():
1451-
# only include clustering key if clustering key is not null, and non static columns are changed to avoid cql error
1451+
# only include clustering key if clustering key is not null, and non-static columns are changed to avoid cql error
14521452
if (null_clustering_key or static_changed_only) and (not col.partition_key):
14531453
continue
14541454
statement.add_where(col, EqualsOperator(), getattr(self.instance, name))
@@ -1468,7 +1468,7 @@ def save(self):
14681468
prior to calling this.
14691469
"""
14701470
if self.instance is None:
1471-
raise CQLEngineException("DML Query intance attribute is None")
1471+
raise CQLEngineException("DML Query instance attribute is None")
14721472
assert type(self.instance) == self.model
14731473

14741474
nulled_fields = set()

cassandra/cqlengine/statements.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ def get_context(self):
550550

551551
def add_conditional_clause(self, clause):
552552
"""
553-
Adds a iff clause to this statement
553+
Adds an iff clause to this statement
554554
555555
:param clause: The clause that will be added to the iff statement
556556
:type clause: ConditionalClause
@@ -575,7 +575,7 @@ def update_context_id(self, i):
575575
@property
576576
def timestamp_normalized(self):
577577
"""
578-
we're expecting self.timestamp to be either a long, int, a datetime, or a timedelta
578+
We're expecting self.timestamp to be either a long, int, a datetime, or a timedelta
579579
:return:
580580
"""
581581
if not self.timestamp:

cassandra/marshal.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ def vints_pack(values):
122122
num_extra_bytes = 0
123123
num_bits = v.bit_length()
124124
# We need to reserve (num_extra_bytes+1) bits in the first byte
125-
# ie. with 1 extra byte, the first byte needs to be something like '10XXXXXX' # 2 bits reserved
126-
# ie. with 8 extra bytes, the first byte needs to be '11111111' # 8 bits reserved
125+
# i.e. with 1 extra byte, the first byte needs to be something like '10XXXXXX' # 2 bits reserved
126+
# i.e. with 8 extra bytes, the first byte needs to be '11111111' # 8 bits reserved
127127
reserved_bits = num_extra_bytes + 1
128128
while num_bits > (8-(reserved_bits)):
129129
num_extra_bytes += 1
@@ -167,8 +167,8 @@ def uvint_pack(val):
167167
num_extra_bytes = 0
168168
num_bits = v.bit_length()
169169
# We need to reserve (num_extra_bytes+1) bits in the first byte
170-
# ie. with 1 extra byte, the first byte needs to be something like '10XXXXXX' # 2 bits reserved
171-
# ie. with 8 extra bytes, the first byte needs to be '11111111' # 8 bits reserved
170+
# i.e. with 1 extra byte, the first byte needs to be something like '10XXXXXX' # 2 bits reserved
171+
# i.e. with 8 extra bytes, the first byte needs to be '11111111' # 8 bits reserved
172172
reserved_bits = num_extra_bytes + 1
173173
while num_bits > (8-(reserved_bits)):
174174
num_extra_bytes += 1

cassandra/metrics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def get_stats(self):
185185
def set_stats_name(self, stats_name):
186186
"""
187187
Set the metrics stats name.
188-
The stats_name is a string used to access the metris through scales: scales.getStats()[<stats_name>]
188+
The stats_name is a string used to access the metrics through scales: scales.getStats()[<stats_name>]
189189
Default is 'cassandra-<num>'.
190190
"""
191191

0 commit comments

Comments
 (0)