93 |
93 |
94 if codestring and codestring[-1] != '\n': |
94 if codestring and codestring[-1] != '\n': |
95 codestring = codestring + '\n' |
95 codestring = codestring + '\n' |
96 |
96 |
97 return codestring |
97 return codestring |
|
98 |
|
99 |
|
100 def extractLineFlags(line, startComment="#", endComment=""): |
|
101 """ |
|
102 Function to extract flags starting and ending with '__' from a line comment. |
98 |
103 |
|
104 @param line line to extract flags from (string) |
|
105 @keyparam startComment string identifying the start of the comment (string) |
|
106 @keyparam endComment string identifying the end of a comment (string) |
|
107 @return list containing the extracted flags (list of strings) |
|
108 """ |
|
109 flags = [] |
|
110 |
|
111 pos = line.rindex(startComment) |
|
112 if pos >= 0: |
|
113 comment = line[pos + len(startComment):].strip() |
|
114 if endComment: |
|
115 comment = comment.replace("endComment", "") |
|
116 flags = [f.strip() for f in comment.split() |
|
117 if (f.startswith("__") and f.endswith("__"))] |
|
118 return flags |
|
119 |
99 # |
120 # |
100 # eflag: FileType = Python2 |
121 # eflag: FileType = Python2 |