MCPcopy Create free account
hub / github.com/comaps/comaps / parse_file

Method parse_file

tools/python/categories_converter.py:67–85  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

65
66
67 def parse_file(self):
68 current_key = ""
69 this_line_is_key = True
70 with open(self.filepath) as infile:
71 for line in map(str.strip, infile):
72 if line.startswith("#"):
73 self.comments.append(line)
74 this_line_is_key = True
75 elif not line:
76 this_line_is_key = True
77 elif this_line_is_key:
78 self.keys_in_order.append(line)
79 current_key = line
80 this_line_is_key = False
81 else:
82 pos = line.index(':')
83 lang = line[:pos]
84 translation = line[pos + 1:]
85 self.translations[current_key][lang] = translation
86
87
88 def write_as_categories(self, outfile):

Callers 1

__init__Method · 0.95

Calls 3

mapFunction · 0.85
appendMethod · 0.45
indexMethod · 0.45

Tested by

no test coverage detected