MCPcopy Create free account
hub / github.com/apache/cloudberry / strip

Method strip

src/test/unit/mock/mocker.py:58–72  ·  view source on GitHub ↗

strip comments in the content

(self, content)

Source from the content-addressed store, hash-verified

56 return i_path
57
58 def strip(self, content):
59 """strip comments in the content
60 """
61 content = CFile.m_comment_pat.sub('', content)
62 # backend/libpq/be-secure.c contains private key with '//'
63 if 'be-secure' not in self.path and 'guc_gp.c' not in self.path:
64 content = CFile.s_comment_pat.sub('', content)
65 content = CFile.attribute_pat.sub('', content)
66 # .c files included in other .c files can generally not be found from
67 # where the mock files are located which leads to compilation failure.
68 # Since we thus far arent interested in handling this anyways, let's
69 # skip this for now except for the guc special case
70 if 'guc' not in self.path:
71 content = CFile.include_c_pat.sub('', content)
72 return content
73
74 def skip_func_body(self, content, index):
75 """Skip function body by finding a line starting with a closing brace.

Callers 15

__init__Method · 0.95
run_commandFunction · 0.80
get_package_infoFunction · 0.80
get_package_dependenciesFunction · 0.80
process_binaryFunction · 0.80
run_commandFunction · 0.80
get_package_infoFunction · 0.80
process_binaryFunction · 0.80
print_or_insert_rowFunction · 0.80
get_xerces_sourceFunction · 0.80
exec_global_shellMethod · 0.80
queryMethod · 0.80

Calls

no outgoing calls

Tested by 15

exec_global_shellMethod · 0.64
queryMethod · 0.64
forkMethod · 0.64
process_commandMethod · 0.64
exec_global_shellMethod · 0.64
queryMethod · 0.64
forkMethod · 0.64
process_commandMethod · 0.64
getPortCoordinatorOnlyFunction · 0.64