MCPcopy Create free account
hub / github.com/OpenDDS/OpenDDS / read_file

Function read_file

tools/scripts/android/matrix.py:513–533  ·  view source on GitHub ↗
(kind)

Source from the content-addressed store, hash-verified

511
512
513def read_file(kind):
514 kind = Kind(kind)
515 begin = get_comment(kind, 'BEGIN MATRIX') + '\n'
516 end = get_comment(kind, 'END MATRIX') + '\n'
517 mode = 0
518 before = []
519 after = []
520 filename = kind.value[0]
521 with open(filename) as file:
522 for line in file:
523 if mode == 0:
524 before.append(line)
525 if line == begin:
526 mode = 1
527 elif mode == 1:
528 if line == end:
529 after.append(line)
530 mode = 2
531 else:
532 after.append(line)
533 return (filename, before, after)
534
535
536class NullContext:

Callers 1

matrix.pyFile · 0.70

Calls 4

get_commentFunction · 0.85
openFunction · 0.85
KindClass · 0.70
appendMethod · 0.45

Tested by

no test coverage detected