Skip to content

Commit 42e3d08

Browse files
committed
docs: update stale Python 2 comments and docstrings
1 parent 6be8556 commit 42e3d08

4 files changed

Lines changed: 13 additions & 12 deletions

File tree

cassandra/datastax/graph/graphson.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,26 +48,26 @@
4848
------------ | -------------- | -------------- | ------------
4949
text | string | string | str
5050
boolean | | | bool
51-
bigint | g:Int64 | g:Int64 | long
51+
bigint | g:Int64 | g:Int64 | int
5252
int | g:Int32 | g:Int32 | int
5353
double | g:Double | g:Double | float
5454
float | g:Float | g:Float | float
5555
uuid | g:UUID | g:UUID | UUID
5656
bigdecimal | gx:BigDecimal | gx:BigDecimal | Decimal
5757
duration | gx:Duration | N/A | timedelta (Classic graph only)
5858
DSE Duration | N/A | dse:Duration | Duration (Core graph only)
59-
inet | gx:InetAddress | gx:InetAddress | str (unicode), IPV4Address/IPV6Address (PY3)
59+
inet | gx:InetAddress | gx:InetAddress | str, IPV4Address/IPV6Address
6060
timestamp | gx:Instant | gx:Instant | datetime.datetime
6161
date | gx:LocalDate | gx:LocalDate | datetime.date
6262
time | gx:LocalTime | gx:LocalTime | datetime.time
6363
smallint | gx:Int16 | gx:Int16 | int
64-
varint | gx:BigInteger | gx:BigInteger | long
64+
varint | gx:BigInteger | gx:BigInteger | int
6565
date | gx:LocalDate | gx:LocalDate | Date
6666
polygon | dse:Polygon | dse:Polygon | Polygon
6767
point | dse:Point | dse:Point | Point
6868
linestring | dse:Linestring | dse:LineString | LineString
69-
blob | dse:Blob | dse:Blob | bytearray, buffer (PY2), memoryview (PY3), bytes (PY3)
70-
blob | gx:ByteBuffer | gx:ByteBuffer | bytearray, buffer (PY2), memoryview (PY3), bytes (PY3)
69+
blob | dse:Blob | dse:Blob | bytearray, memoryview, bytes
70+
blob | gx:ByteBuffer | gx:ByteBuffer | bytearray, memoryview, bytes
7171
list | N/A | g:List | list (Core graph only)
7272
map | N/A | g:Map | dict (Core graph only)
7373
set | N/A | g:Set | set or list (Core graph only)
@@ -969,7 +969,7 @@ def serialize(self, value, writer=None):
969969
"""
970970
serializer = self.get_serializer(value)
971971
if not serializer:
972-
raise ValueError("Unable to find a serializer for value of type: ".format(type(value)))
972+
raise ValueError("Unable to find a serializer for value of type: {}".format(type(value)))
973973

974974
val = serializer.serialize(value, writer or self)
975975
if serializer is TypeWrapperTypeIO:

cassandra/io/asyncorereactor.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,9 @@ def _maybe_log_debug(self, *args, **kwargs):
263263
try:
264264
log.debug(*args, **kwargs)
265265
except Exception:
266-
# TODO: Remove when Python 2 support is removed
267-
# PYTHON-1266. If our logger has disappeared, there's nothing we
268-
# can do, so just log nothing.
266+
# PYTHON-1266. If our logger has disappeared (e.g. during
267+
# interpreter shutdown), there's nothing we can do, so just
268+
# log nothing.
269269
pass
270270

271271
def add_timer(self, timer):

cassandra/metadata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2270,7 +2270,7 @@ def _build_table_metadata(self, row, col_rows=None, trigger_rows=None):
22702270

22712271
# Some thrift tables define names in composite types (see PYTHON-192)
22722272
if not column_aliases and hasattr(comparator, 'fieldnames'):
2273-
column_aliases = filter(None, comparator.fieldnames)
2273+
column_aliases = list(filter(None, comparator.fieldnames))
22742274
else:
22752275
is_compact = True
22762276
if column_aliases or not col_rows or is_dct_comparator:

cassandra/util.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,8 @@ def __str__(self):
810810
inet_ntop = socket.inet_ntop
811811

812812

813-
# similar to collections.namedtuple, reproduced here because Python 2.6 did not have the rename logic
813+
# similar to collections.namedtuple, reproduced here to handle invalid identifiers
814+
# by renaming them to positional names
814815
def _positional_rename_invalid_identifiers(field_names):
815816
names_out = list(field_names)
816817
for index, name in enumerate(field_names):
@@ -1498,7 +1499,7 @@ class Version(object):
14981499
Internal minimalist class to compare versions.
14991500
A valid version is: <int>.<int>.<int>.<int or str>.
15001501
1501-
TODO: when python2 support is removed, use packaging.version.
1502+
TODO: consider using packaging.version instead.
15021503
"""
15031504

15041505
_version = None

0 commit comments

Comments
 (0)