MCPcopy Index your code
hub / github.com/python/cpython / from_row

Method from_row

Tools/c-analyzer/c_parser/info.py:265–287  ·  view source on GitHub ↗
(cls, row, columns=None)

Source from the content-addressed store, hash-verified

263
264 @classmethod
265 def from_row(cls, row, columns=None):
266 if not columns:
267 colnames = 'filename funcname name kind data'.split()
268 else:
269 colnames = list(columns)
270 for i, column in enumerate(colnames):
271 if column == 'file':
272 colnames[i] = 'filename'
273 elif column == 'funcname':
274 colnames[i] = 'parent'
275 if len(row) != len(set(colnames)):
276 raise NotImplementedError(columns, row)
277 kwargs = {}
278 for column, value in zip(colnames, row):
279 if column == 'filename':
280 kwargs['file'] = FileInfo.from_raw(value)
281 elif column == 'kind':
282 kwargs['kind'] = KIND(value)
283 elif column in cls._fields:
284 kwargs[column] = value
285 else:
286 raise NotImplementedError(column)
287 return cls(**kwargs)
288
289 @property
290 def id(self):

Callers

nothing calls this directly

Calls 7

listClass · 0.85
enumerateFunction · 0.85
setFunction · 0.85
KINDClass · 0.85
clsClass · 0.50
splitMethod · 0.45
from_rawMethod · 0.45

Tested by

no test coverage detected