Fixed comments bug with obi head and obi tail
This commit is contained in:
2
python/obitools3/commands/head.pyx
Normal file → Executable file
2
python/obitools3/commands/head.pyx
Normal file → Executable file
@ -65,7 +65,7 @@ def run(config):
|
|||||||
|
|
||||||
# Save command config in View comments
|
# Save command config in View comments
|
||||||
command_line = " ".join(sys.argv[1:])
|
command_line = " ".join(sys.argv[1:])
|
||||||
comments = View.print_config(config, "head", command_line, input_dms_name=[i_dms.name], input_view_name=[i_view.name])
|
comments = View.get_config_dict(config, "head", command_line, input_dms_name=[i_dms.name], input_view_name=[i_view.name])
|
||||||
|
|
||||||
# Create output view with the line selection
|
# Create output view with the line selection
|
||||||
try:
|
try:
|
||||||
|
2
python/obitools3/commands/tail.pyx
Normal file → Executable file
2
python/obitools3/commands/tail.pyx
Normal file → Executable file
@ -65,7 +65,7 @@ def run(config):
|
|||||||
|
|
||||||
# Save command config in View comments
|
# Save command config in View comments
|
||||||
command_line = " ".join(sys.argv[1:])
|
command_line = " ".join(sys.argv[1:])
|
||||||
comments = View.print_config(config, "tail", command_line, input_dms_name=[i_dms.name], input_view_name=[i_view.name])
|
comments = View.get_config_dict(config, "tail", command_line, input_dms_name=[i_dms.name], input_view_name=[i_view.name])
|
||||||
|
|
||||||
# Create output view with the line selection
|
# Create output view with the line selection
|
||||||
try:
|
try:
|
||||||
|
11
python/obitools3/dms/view/view.pyx
Normal file → Executable file
11
python/obitools3/dms/view/view.pyx
Normal file → Executable file
@ -399,6 +399,15 @@ cdef class View(OBIWrapper) :
|
|||||||
return str2bytes(comments_json)
|
return str2bytes(comments_json)
|
||||||
|
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_config_dict(dict config, str command_name, str command_line, list input_str=None, list input_dms_name=None, list input_view_name=None):
|
||||||
|
config_dict = View._config_to_dict(config, command_name, command_line, \
|
||||||
|
input_str=input_str, input_dms_name=input_dms_name, input_view_name=input_view_name)
|
||||||
|
# Clean virtually empty values
|
||||||
|
config_dict = clean_empty_values_from_object(config_dict, exclude=[View_comments.KEEP_KEYS])
|
||||||
|
return config_dict
|
||||||
|
|
||||||
|
|
||||||
@OBIWrapper.checkIsActive
|
@OBIWrapper.checkIsActive
|
||||||
def write_config(self, dict config, str command_name, str command_line, list input_str=None, list input_dms_name=None, list input_view_name=None):
|
def write_config(self, dict config, str command_name, str command_line, list input_str=None, list input_dms_name=None, list input_view_name=None):
|
||||||
self.comments = View._config_to_dict(config, command_name, command_line, \
|
self.comments = View._config_to_dict(config, command_name, command_line, \
|
||||||
@ -611,7 +620,7 @@ cdef class View_comments(dict): # Not thread safe
|
|||||||
comments_json = <bytes> view_p.infos.comments
|
comments_json = <bytes> view_p.infos.comments
|
||||||
comments_json_str = bytes2str(comments_json)
|
comments_json_str = bytes2str(comments_json)
|
||||||
comments_dict = json.loads(comments_json_str)
|
comments_dict = json.loads(comments_json_str)
|
||||||
str2bytes_object(comments_dict)
|
comments_dict = str2bytes_object(comments_dict)
|
||||||
super(View_comments, self).update(comments_dict)
|
super(View_comments, self).update(comments_dict)
|
||||||
|
|
||||||
def __getitem__(self, object key):
|
def __getitem__(self, object key):
|
||||||
|
Reference in New Issue
Block a user