recursive open struct
428685
def to_hash
      ret = {}
      @hash.dup.each_pair do |key, val|
        ret[key] = self.convert_value_from_ostruct(val)
      end
      ret
    end
637201
def _handle_struct(self, node, scope, ctxt, stream):
        
        self._dlog("handling struct")

        if node.args is not None:
            for param in node.args.params:
                param.is_func_param = True

        # it's actually being defined
        if node.decls is not None:
            struct_cls = StructUnionDef("struct", self, node)

            if node.name is not None:
                scope.add_type_class(node.name, struct_cls)

            return struct_cls

        # it's declaring a struct field. E.g.
        #    struct IFD subDir;
        else:
            return scope.get_type(node.name)
448495
def STRUCT_DECL(self, cursor, num=None):
        
        return self._record_decl(cursor, typedesc.Structure, num)
210497
def unpack(self, struc):
        
        buf, offset = readall_fast(self, struc.size)
        return struc.unpack_from(buf, offset)
1270507
def depth_first_recurse(node = nil, depth = 0, &block)
      node = self if node == nil
      yield node, depth
      node.children.each do |child|
        depth_first_recurse(child, depth+1, &block)
      end
    end
850500
def read_struct(self, struct_class):
        """"""
        struct = struct_class.unpack_from(bytearray_to_buff(self._data), self._offset)
        self.skip(struct_class.size)
        return struct
379767
def read_structs(fstream):
    
    struct = read_struct(fstream)
    while struct is not None:
        yield struct
        struct = read_struct(fstream)
491687
function recursive (node, depth, index) {
    let hashLeft
    let hashRight
    let summingBuffer

    // case with single node in tree
    if (depth === 0 && node.val !== undefined) {
      return getHash(node.val, depth, index * 2)
    }

    if (node.left === undefined) {
      throw new Error('Left node is missed.')
    }
    if (typeof node.left === 'string') {
      if (!validateHexadecimal(node.left)) {
        throw new TypeError('Tree element of wrong type is passed. Hexadecimal expected.')
      }
      hashLeft = node.left
    } else {
      if (!isObject(node.left)) {
        throw new TypeError('Invalid type of left node.')
      }
      if (node.left.val !== undefined) {
        hashLeft = getHash(node.left.val, depth, index * 2)
      } else {
        hashLeft = recursive(node.left, depth + 1, index * 2)
      }
    }

    if (depth === 0) {
      rootBranch = 'right'
    }

    if (node.right !== undefined) {
      if (typeof node.right === 'string') {
        if (!validateHexadecimal(node.right)) {
          throw new TypeError('Tree element of wrong type is passed. Hexadecimal expected.')
        }
        hashRight = node.right
      } else {
        if (!isObject(node.right)) {
          throw new TypeError('Invalid type of right node.')
        }

        if (node.right.val !== undefined) {
          hashRight = getHash(node.right.val, depth, index * 2 + 1)
        } else {
          hashRight = recursive(node.right, depth + 1, index * 2 + 1)
        }
      }

      summingBuffer = new Uint8Array(64)
      summingBuffer.set(hexadecimalToUint8Array(hashLeft))
      summingBuffer.set(hexadecimalToUint8Array(hashRight), 32)
      return hash(summingBuffer)
    }

    if (depth === 0 || rootBranch === 'left') {
      throw new Error('Right leaf is missed in left branch of tree.')
    }
    summingBuffer = hexadecimalToUint8Array(hashLeft)
    return hash(summingBuffer)
  }
775544
def decode_struct_tree(self, data_type, obj):
        
        subtype = self.determine_struct_tree_subtype(data_type, obj)
        return self.decode_struct(subtype, obj)
784409
def visit_raise(self, node, parent):
        """"""
        newnode = nodes.Raise(node.lineno, node.col_offset, parent)
        # pylint: disable=too-many-function-args
        newnode.postinit(
            _visit_or_none(node, "type", self, newnode),
            _visit_or_none(node, "inst", self, newnode),
            _visit_or_none(node, "tback", self, newnode),
        )
        return newnode
86247
def visit_Slice(self, node: ast.Slice) -> slice:
        """"""
        lower = None  # type: Optional[int]
        if node.lower is not None:
            lower = self.visit(node=node.lower)

        upper = None  # type: Optional[int]
        if node.upper is not None:
            upper = self.visit(node=node.upper)

        step = None  # type: Optional[int]
        if node.step is not None:
            step = self.visit(node=node.step)

        result = slice(lower, upper, step)

        self.recomputed_values[node] = result
        return result
1350852
def flatten(struct):
    
    if isinstance(struct, dict):
        return flatten(struct.values())
    elif isinstance(struct, (list, tuple, set)) or is_lazy_iterable(struct):
        objs = []
        for obj in struct:
            objs.extend(flatten(obj))
        return objs
    else:
        return [struct]
495000
def _get_struct_rect(self):
        """"""
        bc = BitConsumer(self._src)
        nbits = bc.u_get(5)
        if self._read_twips:
            return tuple(bc.s_get(nbits) for _ in range(4))
        else:
            return tuple(bc.s_get(nbits) / 20.0 for _ in range(4))
1181315
def _recursive_overwrite(self, src, dest):
        
        if os.path.isdir(src):
            if not os.path.isdir(dest):
                os.makedirs(dest)
            files = os.listdir(src)
            for f in files:
                self._recursive_overwrite(os.path.join(src, f),
                                          os.path.join(dest, f))
        else:
            shutil.copyfile(src, dest, follow_symlinks=False)
429893
function depthFirst(node, parent) {
  var results = [];
  if (node && (typeof node === 'object')) {

    // valid node so push it to the list and set new parent
    //  don't overwrite parent if one was not given
    if ('type' in node) {
      if (parent !== undefined) {
        node.parent = parent;
      }
      parent = node;
      results.push(node);
    }

    // recurse object members using nested function call
    for (var key in node) {
      if (WHITE_LIST.test(key)) {
        var value = node[key];
        if (value && (typeof value === 'object')) {
          results.push.apply(results, depthFirst(value, parent));
        }
      }
    }
  }
  return results;
}
845869
def bsp_split_recursive(
    node: tcod.bsp.BSP,
    randomizer: Optional[tcod.random.Random],
    nb: int,
    minHSize: int,
    minVSize: int,
    maxHRatio: int,
    maxVRatio: int,
) -> None:
    
    node.split_recursive(
        nb, minHSize, minVSize, maxHRatio, maxVRatio, randomizer
    )
414247
private Struct toStruct(Attributes att) {
	int len = att.getLength();
	Struct sct = new StructImpl();
	for (int i = 0; i < len; i++) {
	    sct.setEL(att.getQName(i), att.getValue(i));
	}
	return sct;
    }