MCPcopy Create free account
hub / github.com/ActiveState/code / stripAxisCode

Function stripAxisCode

recipes/Python/577533_Axis_POJO_stripper/recipe-577533.py:17–40  ·  view source on GitHub ↗

copy lines from in file to out file up to first occurance of the string 'org.apache.axis', then just write closing brace. hasAxisCode detects of the file was already processed such that this is an idempotent operation.

(fileName)

Source from the content-addressed store, hash-verified

15"""
16
17def stripAxisCode(fileName):
18 """copy lines from in file to out file up to first occurance
19 of the string 'org.apache.axis', then just write closing brace.
20 hasAxisCode detects of the file was already processed such that
21 this is an idempotent operation.
22 """
23 hasAxisCode = False
24 fin = open(fileName, 'r')
25 outName = ''.join([fileName, '.tmp'])
26 fout = open(outName, 'wr')
27 for line in fin:
28 if (string.find(line, 'org.apache.axis') != -1 and
29 string.find(line, 'extends') == -1 and
30 string.find(line, 'implements') == -1):
31 hasAxisCode = True
32 break
33 else:
34 fout.write(line)
35
36 fin.close()
37 if hasAxisCode:
38 fout.write("}\n")
39 fout.close
40 shutil.move(outName, fileName)
41
42def processDirTree(tld):
43 """From the top level package dir of Axis-generated POJOs,

Callers 1

processDirTreeFunction · 0.85

Calls 6

openFunction · 0.50
joinMethod · 0.45
findMethod · 0.45
writeMethod · 0.45
closeMethod · 0.45
moveMethod · 0.45

Tested by

no test coverage detected