Skip to content

Commit

Permalink
STAR-497 fix pycodestyle (apache#123)
Browse files Browse the repository at this point in the history
(cherry picked from commit d36c110)
(cherry picked from commit f1eb25c)
(cherry picked from commit cf20551)
(cherry picked from commit 813359d)
(cherry picked from commit 5294ca8)
  • Loading branch information
jtgrabowski authored and jacek-lewandowski committed May 27, 2022
1 parent c1129a3 commit 9c927fb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pylib/cqlshlib/geotypes.py
Expand Up @@ -84,6 +84,7 @@ def _patch_get_converters(klass):
when using prepared statements to batch load
"""
original_method = klass._get_converter

def new_method(self, cql_type):
if cql_type.typename == 'PointType':
return _convert_point
Expand All @@ -102,12 +103,13 @@ def _patch_init(klass):
when making queries with string literal values
"""
original_method = klass.__init__

def new_method(self, *args, **kwargs):
original_method(self, *args, **kwargs)
ptypes = zip(self.protectors, self.coltypes)
clean = lambda t: re.sub("[\W]", "", t.split('.')[-1]) # discard java package names and ' characters
clean = lambda t: re.sub("[\\W]", "", t.split('.')[-1]) # discard java package names and ' characters
gtypes = {'PointType', 'LineStringType', 'PolygonType'}
self.protectors = [protect_value if clean(t) in gtypes else p for p,t in ptypes]
self.protectors = [protect_value if clean(t) in gtypes else p for p, t in ptypes]
klass.__init__ = new_method


Expand Down

0 comments on commit 9c927fb

Please sign in to comment.