@@ -27,7 +27,7 @@ def __init__(self, index, column_text, comments=None):
2727 logger = getLogger (LOGGER_NAME )
2828
2929 self .index = index
30- self .column_text = sub ("\s\s+" , " " , column_text .strip ())
30+ self .column_text = sub (r "\s\s+" , " " , column_text .strip ())
3131
3232 """
3333
@@ -112,7 +112,7 @@ def __init__(self, index, column_text, comments=None):
112112 raise MasterSchemaRowParsingError (log_message )
113113
114114 # Update the parsed column text replacing any whitespace with a single " " character and stripping it
115- parsed_column_text = sub ("\s\s+" , " " , parsed_column_text .strip ())
115+ parsed_column_text = sub (r "\s\s+" , " " , parsed_column_text .strip ())
116116
117117 # Check the comments sent in for validity
118118 if comments :
@@ -188,7 +188,7 @@ def __init__(self, index, column_text, comments=None):
188188 # Get the next segment
189189 segment = remaining_column_text [:segment_index + 1 ]
190190
191- if (len (segment ) == len (remaining_column_text ) or match ("\w" , remaining_column_text [segment_index + 1 ])) \
191+ if (len (segment ) == len (remaining_column_text ) or match (r "\w" , remaining_column_text [segment_index + 1 ])) \
192192 and ColumnDefinition ._is_column_constraint_preface (segment ):
193193
194194 """
@@ -222,8 +222,8 @@ def __init__(self, index, column_text, comments=None):
222222
223223 """
224224
225- segment = sub ("\s*\(\s*" , "(" , segment )
226- segment = sub ("\s*\)\s*" , ")" , segment )
225+ segment = sub (r "\s*\(\s*" , "(" , segment )
226+ segment = sub (r "\s*\)\s*" , ")" , segment )
227227 segment = segment .strip ()
228228
229229 # Convert it to all uppercase for the derived data type name
@@ -325,7 +325,7 @@ def _get_column_name_and_remaining_sql(index, column_text):
325325 elif column_text [0 ] == "[" :
326326
327327 # The column name is surrounded by brackets
328- match_object = match ("^\[(.*?)\]" , column_text )
328+ match_object = match (r "^\[(.*?)\]" , column_text )
329329
330330 if not match_object :
331331 log_message = "No bracket match found for sql column definition: {} with text: {}."
@@ -427,15 +427,15 @@ def _get_data_type(derived_data_type):
427427 derived_data_type = derived_data_type .upper ()
428428
429429 # Remove any parenthesis along with numerical values
430- derived_data_type = sub ("\(.*\)$" , "" , derived_data_type )
430+ derived_data_type = sub (r "\(.*\)$" , "" , derived_data_type )
431431
432432 # Replace spaces with underscores
433433 derived_data_type = derived_data_type .replace (" " , "_" )
434434
435435 for data_type in DATA_TYPE :
436436
437437 # We remove any numerical values from the end since sqlite does not recognize them in the data types
438- if sub ("_\d+.*$" , "" , data_type ) == derived_data_type :
438+ if sub (r "_\d+.*$" , "" , data_type ) == derived_data_type :
439439 return data_type
440440
441441 # If no data type was found we return an invalid data type
@@ -544,15 +544,15 @@ def _is_column_constraint_preface(segment):
544544 Note: When the check is done on the segment, we check the next character is not one of the allowed
545545 characters in a column name, data type, etc. to make sure the constraint preface is not the
546546 beginning of a longer name where it is not actually a constraint preface (example: primaryEmail).
547- The "\w" regular expression when no LOCALE and UNICODE flags are set will be equivalent to the set:
547+ The regular expression when no LOCALE and UNICODE flags are set will be equivalent to the set:
548548 [a-zA-Z0-9_].
549549
550550 """
551551
552552 # Check to see if the segment starts with the column constraint preface
553553 if segment .upper ().startswith (column_constraint_preface ):
554554 if not (len (column_constraint_preface ) + 1 <= len (segment )
555- and match ("\w" , segment [len (column_constraint_preface )])):
555+ and match (r "\w" , segment [len (column_constraint_preface )])):
556556 return True
557557
558558 return False
0 commit comments