Skip to content

Commit

Permalink
Frames read only, remove metadata printing
Browse files Browse the repository at this point in the history
  • Loading branch information
Enteee committed Nov 24, 2018
1 parent 444502d commit dac77ec
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 93 deletions.
8 changes: 0 additions & 8 deletions pdml2flow/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,6 @@ def add_arguments_cb(argparser):
Conf.FRAMES_ARRAY
)
)
argparser.add_argument(
'-m',
dest='METADATA',
action='store_true',
help='Appends flow metadata [default: {}]'.format(
Conf.METADATA
)
)
argparser.add_argument(
'-d',
dest='DEBUG',
Expand Down
1 change: 0 additions & 1 deletion pdml2flow/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ def get_version():
FRAMES_ARRAY = False
FRAME_TIME = ['frame', 'time_epoch', 'raw', 0]
DEBUG = False
METADATA = False
PARSE_SOURCE = sys.stdin
SUPPORTED_PLUGIN_INTERFACES = [Plugin2]
PLUGINS = []
Expand Down
14 changes: 10 additions & 4 deletions pdml2flow/flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,19 @@ def __eq__(self, other):
def frames(self):
# clean the frame data
if Conf.FRAMES_ARRAY:
self.__frames = [ f.clean_empty() for f in self.__frames ]
self.__frames = [
f.clean_empty()
for f in self.__frames
]
ret = [
f.cast_dicts(dict)
for f in self.__frames
]
else:
self.__frames = self.__frames.clean_empty()
ret = self.__frames.cast_dicts(dict)

if Conf.METADATA:
return self.__dict__
return self.__frames
return ret

@property
def first_frame_time(self):
Expand Down
27 changes: 27 additions & 0 deletions test/flow_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,33 @@ def test_frames(self):
f0.merge(f1)
)

def test_frames_returns_copy(self):
Conf.FRAME_TIME = [ 't' ]
Conf.FLOW_DEF = [ ['def1'] ]
f = Flow(
AutoVivification({
't' : 0,
'def1': 1,
'unimportant': 1,
})
)
f.add_frame(
AutoVivification({
't' : 0,
'def1': 1,
'unimportant': 1,
})
)

frames_before_add = f.frames
f.frames['add'] = 'something'

self.assertEqual(
frames_before_add,
f.frames,
)


def test_first_frame_time(self):
Conf.FRAME_TIME = [ 't' ]
Conf.FLOW_DEF = [ ['def1'] ]
Expand Down
1 change: 0 additions & 1 deletion test/pdml2flow_tests/base_meta/args

This file was deleted.

26 changes: 0 additions & 26 deletions test/pdml2flow_tests/base_meta/stdin

This file was deleted.

53 changes: 0 additions & 53 deletions test/pdml2flow_tests/base_meta/stdout

This file was deleted.

0 comments on commit dac77ec

Please sign in to comment.