Collapse the child values into a dictionary. This is intended to be
           called by child classes to fix up the fullName->name conversions.
964029
def collectChildProperties(self, kwargs, properties, collector, **kw):
        """"""

        childProperties = {}
        for field in self.fields:  # pylint: disable=not-an-iterable
            yield collector.collectValidationErrors(field.fullName,
                                                    field.updateFromKwargs,
                                                    kwargs=kwargs,
                                                    properties=childProperties,
                                                    collector=collector,
                                                    **kw)
        kwargs[self.fullName] = childProperties
609118
def to_tree_widget_items(self, definitions, to_collapse=None):
        
        def flatten(definitions):
            """
            Flattens the document structure tree as a simple sequential list.
            """
            ret_val = []
            for de in definitions:
                ret_val.append(de)
                for sub_d in de.children:
                    ret_val.append(sub_d)
                    ret_val += flatten(sub_d.children)
            return ret_val

        def convert(name, editor, to_collapse):
            ti = QtWidgets.QTreeWidgetItem()
            ti.setText(0, name.name)
            if isinstance(name.icon, list):
                icon = QtGui.QIcon.fromTheme(
                    name.icon[0], QtGui.QIcon(name.icon[1]))
            else:
                icon = QtGui.QIcon(name.icon)
            ti.setIcon(0, icon)
            name.block = editor.document().findBlockByNumber(name.line)
            ti.setData(0, QtCore.Qt.UserRole, name)
            ti.setToolTip(0, name.description)
            name.tree_item = ti
            block_data = name.block.userData()
            if block_data is None:
                block_data = TextBlockUserData()
                name.block.setUserData(block_data)
            block_data.tree_item = ti

            if to_collapse is not None and \
                    TextBlockHelper.is_collapsed(name.block):
                to_collapse.append(ti)

            for ch in name.children:
                ti_ch, to_collapse = convert(ch, editor, to_collapse)
                if ti_ch:
                    ti.addChild(ti_ch)
            return ti, to_collapse

        self._definitions = definitions
        self._flattened_defs = flatten(self._definitions)

        items = []
        for d in definitions:
            value, to_collapse = convert(d, self._editor, to_collapse)
            items.append(value)
        if to_collapse is not None:
            return items, to_collapse

        return items
1057702
def _collapse_author(s):
    
    logger_ts.info("enter collapse_author")
    l = []
    authors = s.split(';')
    for author in authors:
        l.append({'name': author})
    return l
156538
def collapse_all(self):
        """"""

        def aux(item):
            self.item(item, open=False)
            children = self.get_children(item)
            for c in children:
                aux(c)

        children = self.get_children("")
        for c in children:
            aux(c)
1361323
def _compact(*args):
    """"""
    ret = {}
    if len(args) == 1:
        args = args[0]
        if isinstance(args, ListValue):
            args = args.value
        if isinstance(args, dict):
            for i, item in args.items():
                if bool(item):
                    ret[i] = item
        elif bool(args):
            ret[0] = args
    else:
        for i, item in enumerate(args):
            if bool(item):
                ret[i] = item
    return ListValue(ret)
862169
def _collapse_default(self, entry):
        
        if isinstance(entry, tuple) or isinstance(entry, list):
            sets = []
            i = 0
            while i < len(entry):
                if isinstance(entry[i], str) and i+1 < len(entry) and isinstance(entry[i+1], list):
                    sets.append((entry[i], entry[i+1]))
                    i += 2
                elif isinstance(entry[i], str) and entry[i] == ",":
                    i += 1
                else:
                    sets.append((entry[i],))
                    i += 1

            result = []
            for s in sets:
                if isinstance(s[0], str):
                    name = s[0].strip(",")
                elif len(s) == 1:
                    name = self._collapse_default(s[0])
                    
                if len(s) > 1:
                    args = self._collapse_default(s[1])
                else:
                    args = []
                if len(args) > 0:
                    result.append("{}({})".format(name, args))
                else:
                    result.append(name)

            return ', '.join(result)
        else:
            if "," in entry:
                return entry.split(",")[0].strip()
            else:
                return entry.strip()
1288244
function collapseItem(data) {
    let parentExpansions = findExpansion.call(this, data.parent).expansions;

    let index = parentExpansions.findIndex((expansion) => {
        return expansion.id === data.id;
    });

    parentExpansions.splice(index, 1);
}
805185
def normalize_keys(self, value):
        
        return dict((self.normalize_name(k), v) for k, v in value.items())
112957
def full_name
      the_name = []
      the_name << parent.full_name if parent&.full_name
      the_name << name
      the_name.join(" ")
    end
518864
def to_internal_value(self, data):
        
        if html.is_html_input(data):
            data = html.parse_html_dict(data)
        if not isinstance(data, dict):
            self.fail('not_a_dict', input_type=type(data).__name__)
        return {
            six.text_type(key): self.child.run_validation(value)
            for key, value in data.items()
        }
410469
def flatten_dict(dic, parent_key='', sep='.'):
    
    items = []
    for key, value in dic.items():
        new_key = parent_key + sep + key if parent_key else key
        if isinstance(value, collections.MutableMapping):
            items.extend(flatten_dict(value, new_key, sep=sep).items())
        elif isinstance(value, list):
            for idx, elt in enumerate(value):
                items.extend(
                    flatten_dict(elt, new_key + sep + str(idx), sep=sep).items()
                )
        else:
            items.append((new_key, value))
    return dict(items)
1008551
def serialize(self, null_values=False):
    
    ret = {}
    property_dict = dict(self.__class__.__dict__)  # contain view definition defaults
    property_dict.update(self.__dict__)  # overrides done at runtime

    for k in property_dict.keys():
      if k[:1] == "_" or (property_dict[k] is None and not null_values):
        continue

      v = property_dict[k]

      if isinstance(v, list):
        v_items = []
        for v_item in v:
          if self._isclass(v_item.__class__, BaseView):
            v_item_val = v_item.serialize(null_values=null_values)
            if not null_values and len(v_item_val) == 0:
              continue
            v_items.append(v_item_val)
          elif self._isclass(v_item, BaseView):  # when were passed Class instead of instance
            pass
          else:
            v_items.append(v_item)

        ret[k] = v_items
      elif self._isclass(v.__class__, BaseView):
        ret[k] = v.serialize(null_values=null_values)
      elif self._isclass(v, BaseView):  # when were passed Class instead of instance
        pass
      else:
        ret[k] = v

    return ret
27481
def finalize(self):
        

        self.global_scope.close()
        name_generator = NameGenerator(skip=self.reserved_keywords)
        self.global_scope.build_remap_symbols(
            name_generator,
            children_only=not self.obfuscate_globals,
        )
903509
def create_from_name_and_dictionary(self, name, datas):
        
        parameter = ObjectParameter()
        self.set_common_datas(parameter, name, datas)

        if "optional" in datas:
            parameter.optional = to_boolean(datas["optional"])
        if "type" in datas:
            parameter.type = str(datas["type"])
        if "generic" in datas:
            parameter.generic = to_boolean(datas["generic"])

        return parameter
962944
def to_representation(self, value):
        
        return {
            six.text_type(key): self.child.to_representation(val)
            for key, val in value.items()
        }
1101032
def _flatten_dict(self, dict_):
        
        flattened_dict = {}
        for (key, value) in dict_.iteritems():
            if isinstance(value, dict):
                flattened_dict.update(self._flatten_dict(value))
            else:
                flattened_dict[key] = value
        return flattened_dict
1190186
def as_dict(self):
        
        out = dict({})
        for key in self.keys():
            if self._has_delimiter(key):
                pk, ck = key.split(self._delimiter, 1)
                if self._has_delimiter(ck):
                    ck = ck.split(self._delimiter, 1)[0]
                if isinstance(self._values[pk], FlatterDict) and pk not in out:
                    out[pk] = dict()
                if isinstance(self._values[pk][ck], FlatterDict):
                    if self._values[pk][ck].original_type == tuple:
                        out[pk][ck] = tuple(self._child_as_list(pk, ck))
                    elif self._values[pk][ck].original_type == list:
                        out[pk][ck] = self._child_as_list(pk, ck)
                    elif self._values[pk][ck].original_type == set:
                        out[pk][ck] = set(self._child_as_list(pk, ck))
                    elif self._values[pk][ck].original_type == dict:
                        out[pk][ck] = self._values[pk][ck].as_dict()
                else:
                    out[pk][ck] = self._values[pk][ck]
            else:
                out[key] = self._values[key]
        return out