MCPcopy Create free account
hub / github.com/apache/madlib / _clean_comment

Method _clean_comment

src/madpack/upgrade_util.py:1071–1084  ·  view source on GitHub ↗

@brief Remove comments in the sql script

(self)

Source from the content-addressed store, hash-verified

1069 return self._ch
1070
1071 def _clean_comment(self):
1072 """
1073 @brief Remove comments in the sql script
1074 """
1075 pattern = re.compile(r"""(/\*(.|[\r\n])*?\*/)|(--(.*|[\r\n]))""")
1076 res = ''
1077 lines = re.split(r'[\r\n]+', self._sql)
1078 for line in lines:
1079 tmp = line
1080 if not tmp.strip().startswith("E'"):
1081 line = re.sub(pattern, '', line)
1082 res += line + '\n'
1083 self._sql = res.strip()
1084 self._sql = re.sub(pattern, '', self._sql).strip()
1085
1086 """
1087 @breif Remove "drop/create type" statements in the sql script

Callers 1

cleanupMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected