def get_scope_phil(self, scope_name): scope_name = self.get_full_path(scope_name) _phil_string = str_utils.StringIO() scope_objects = self.get_scope_by_name(scope_name) if isinstance(scope_objects, list): for phil_object in scope_objects: phil_object.show(out=_phil_string) else: scope_objects.show(out=_phil_string) return _phil_string.getvalue()
def get_scope_phil(self, scope_name, as_string=False): """ Override with option to get scope from master PHIL or working PHIL :param scope_name: scope name :param as_string: set to True to return a PHIL string rather than object :return: PHIL scope(s) """ scope_name = self.get_full_path(scope_name) _phil_string = str_utils.StringIO() scope_objects = self.get_scope_by_name(scope_name=scope_name) if as_string: if isinstance(scope_objects, list): for phil_object in scope_objects: phil_object.show(out=_phil_string) else : scope_objects.show(out=_phil_string) return _phil_string.getvalue() else: return scope_objects
def __init__(self, master_phil, working_phil=None, parse=None, fetch_new=False): adopt_init_args(self, locals()) self._states = [] self._full_path_index = {} self._full_text_index = {} self._template_index = {} self._multiple_scopes = {} self._multiple_defs = {} self._expert_levels = {} self._input_files = [] self._hidden = [] # XXX: not implemented here (for phenix GUI) self._phil_has_changed = False self._output_dir_path = None self._log = str_utils.StringIO() self._prefix = None if parse is None: self.parse = libtbx.phil.parse self.setup_phil(working_phil, fetch_new) self.parse_styles()