Make inheritance bearable: clone one level of properties
968303
function extend(child, parent) {
        for (var property in parent) {
            if (typeof child[property] == 'undefined') {
                child[property] = parent[property];
            }
        }
        return child;
    }
638614
function cloneItree(itree, excludeKeys) {
    const clone = {};
    excludeKeys = _.castArray(excludeKeys);
    excludeKeys.push('ref');

    _.each(itree, (v, k) => {
        if (!_.includes(excludeKeys, k)) {
            clone[k] = _.cloneDeep(v);
        }
    });

    return clone;
}
1352994
def inherited(subclass)
      [:steps, :failed_steps].each do |inheritable_attribute|
        instance_var = "@#{inheritable_attribute}"
        subclass.instance_variable_set(instance_var, instance_variable_get(instance_var).dup || [])
      end
    end
358719
function clone (obj, parent) {
  let cloned = new obj.constructor()

  for (let i of Object.keys(obj || {})) {
    let value = obj[i]
    if (i === 'parent' && typeof value === 'object') {
      if (parent) {
        cloned[i] = parent
      }
    } else if (i === 'source' || i === null) {
      cloned[i] = value
    } else if (value instanceof Array) {
      cloned[i] = value.map(x => clone(x, cloned))
    } else if (i !== '_autoprefixerPrefix' && i !== '_autoprefixerValues') {
      if (typeof value === 'object' && value !== null) {
        value = clone(value, cloned)
      }
      cloned[i] = value
    }
  }

  return cloned
}
458868
def _clone_post_init(self, obj=None, **kwargs):
        
        # Initialize the extra attributes
        if obj is None or obj is self:
            # We must be asrootpy-ing a ROOT object
            # or freshly init-ing a rootpy object
            for attr, value in Plottable.EXTRA_ATTRS.items():
                # Use the default value
                setattr(self, attr, value)
        else:
            for attr, value in Plottable.EXTRA_ATTRS.items():
                setattr(self, attr, getattr(obj, attr))

        # Create aliases from deprecated to current attributes
        for depattr, newattr in Plottable.EXTRA_ATTRS_DEPRECATED.items():
            setattr(Plottable, depattr,
                    property(
                        fget=Plottable._get_attr_depr(depattr, newattr),
                        fset=Plottable._set_attr_depr(depattr, newattr)))

        if obj is None or obj is self:
            # We must be asrootpy-ing a ROOT object
            # or freshly init-ing a rootpy object
            # Initialize style attrs to style of TObject
            if isinstance(self, ROOT.TAttLine):
                self._linecolor = Color(ROOT.TAttLine.GetLineColor(self))
                self._linestyle = LineStyle(ROOT.TAttLine.GetLineStyle(self))
                self._linewidth = ROOT.TAttLine.GetLineWidth(self)
            else:  # HistStack
                self._linecolor = Color(Plottable.DEFAULT_DECOR['linecolor'])
                self._linestyle = LineStyle(Plottable.DEFAULT_DECOR['linestyle'])
                self._linewidth = Plottable.DEFAULT_DECOR['linewidth']

            if isinstance(self, ROOT.TAttFill):
                self._fillcolor = Color(ROOT.TAttFill.GetFillColor(self))
                self._fillstyle = FillStyle(ROOT.TAttFill.GetFillStyle(self))
            else:  # HistStack
                self._fillcolor = Color(Plottable.DEFAULT_DECOR['fillcolor'])
                self._fillstyle = FillStyle(Plottable.DEFAULT_DECOR['fillstyle'])

            if isinstance(self, ROOT.TAttMarker):
                self._markercolor = Color(ROOT.TAttMarker.GetMarkerColor(self))
                self._markerstyle = MarkerStyle(ROOT.TAttMarker.GetMarkerStyle(self))
                self._markersize = ROOT.TAttMarker.GetMarkerSize(self)
            else:  # HistStack
                self._markercolor = Color(Plottable.DEFAULT_DECOR['markercolor'])
                self._markerstyle = MarkerStyle(Plottable.DEFAULT_DECOR['markerstyle'])
                self._markersize = Plottable.DEFAULT_DECOR['markersize']

            if obj is None:
                # Populate defaults if we are not asrootpy-ing existing object
                decor = dict(**Plottable.DEFAULT_DECOR)
                decor.update(Plottable.EXTRA_ATTRS)
                if 'color' in kwargs:
                    decor.pop('linecolor', None)
                    decor.pop('fillcolor', None)
                    decor.pop('markercolor', None)
                decor.update(kwargs)
                self.decorate(**decor)

        else:
            # Initialize style attrs to style of the other object
            if isinstance(obj, ROOT.TAttLine):
                self.SetLineColor(obj.GetLineColor())
                self.SetLineStyle(obj.GetLineStyle())
                self.SetLineWidth(obj.GetLineWidth())
            if isinstance(obj, ROOT.TAttFill):
                self.SetFillColor(obj.GetFillColor())
                self.SetFillStyle(obj.GetFillStyle())
            if isinstance(obj, ROOT.TAttMarker):
                self.SetMarkerColor(obj.GetMarkerColor())
                self.SetMarkerStyle(obj.GetMarkerStyle())
                self.SetMarkerSize(obj.GetMarkerSize())
            if kwargs:
                self.decorate(**kwargs)
339342
function copyNonHalProperties(unparsed, resource) {
  Object.keys(unparsed).forEach(function(key) {
    if (key !== '_links' && key !== '_embedded') {
      resource[key] = unparsed[key];
    }
  });
}
888609
function clone(object) {
  if (object === null || typeof object != "object") {
    return object;
  }
  const copy = object.constructor();
  for (const attr in object) {
    if (Object.prototype.hasOwnProperty.call(object, attr)) {
      copy[attr] = object[attr];
    }
  }

  return copy;
}
1321791
def make_inheritable(token):
    ''''''
    return win32api.DuplicateHandle(
        win32api.GetCurrentProcess(),
        token,
        win32api.GetCurrentProcess(),
        0,
        1,
        win32con.DUPLICATE_SAME_ACCESS
    )
447498
private QueryTreeNode cloneTrunk(QueryTreeNode stop, QueryTreeNode stopClone) {
		QueryTreeNode node1 = null;
		if (n1 != null) {
			node1 = (n1 == stop ? stopClone : n1.cloneBranch());
		}
		QueryTreeNode node2 = null;
		if (n2 != null) {
			node2 = n2 == stop ? stopClone : n2.cloneBranch();
		}
		
		QueryTreeNode ret = cloneSingle(node1, t1, node2, t2);
		if (p != null) {
			p.cloneTrunk(this, ret);
		}
		ret.relateToChildren();
		return ret;
	}
778070
function inheritFrom(target, propsInSyncWithParent) {
  var this$1 = this;

  each(Object.keys(target), function (k) {
    // some properties must be always in sync with the parent tag
    var mustSync = !isReservedName(k) && contains(propsInSyncWithParent, k);

    if (isUndefined(this$1[k]) || mustSync) {
      // track the property to keep in sync
      // so we can keep it updated
      if (!mustSync) { propsInSyncWithParent.push(k); }
      this$1[k] = target[k];
    }
  });
}
612787
public static void copyProperties(@Nullable Drawable to, @Nullable Drawable from) {
    if (from == null || to == null || to == from) {
      return;
    }

    to.setBounds(from.getBounds());
    to.setChangingConfigurations(from.getChangingConfigurations());
    to.setLevel(from.getLevel());
    to.setVisible(from.isVisible(), /* restart */ false);
    to.setState(from.getState());
  }
799099
def p_inheritance(self, p):
        """"""
        if p[1]:
            if p[2].nullable:
                msg = 'Reference cannot be nullable.'
                self.errors.append((msg, p.lineno(1), self.path))
            else:
                p[0] = p[2]
746532
def deep_clone
      cl = clone()
      each do |child|
        if child.kind_of? Parent
          cl << child.deep_clone
        else
          cl << child.clone
        end
      end
      cl
    end
939511
function (source, target) {
        var tmp;
        target = target || {};
        for (var i in source) {
            if (source.hasOwnProperty(i)) {
                tmp = source[i];
                if (typeof tmp == 'object') {
                    target[i] = utils.isArray(tmp) ? [] : {};
                    utils.clone(source[i], target[i])
                } else {
                    target[i] = tmp;
                }
            }
        }
        return target;
    }
788812
def clone(self, opts):
        '''
        
        '''
        topt = self.opts.copy()
        topt.update(opts)
        return self.__class__(self.modl, self.name, self.info, topt)
240090
def _build_inheritance_chain(cls, bases, *names, merge=False):
        """"""
        result = []
        for name in names:
            maps = []
            for base in bases:
                bmap = getattr(base, name, None)
                if bmap is not None:
                    assert isinstance(bmap, (dict, ChainMap))
                    if len(bmap):
                        if isinstance(bmap, ChainMap):
                            maps.extend(bmap.maps)
                        else:
                            maps.append(bmap)
            result.append(ChainMap({}, *maps))
        if merge:
            result = [dict(map) for map in result]
        if len(names) == 1:
            return result[0]
        return result
752806
def inheritance_patch(attrs):
    """"""
    for key, obj in attrs.items():
        if isinstance(obj, attribute):
            if getattr(obj, 'attr_write', None) == AttrWriteType.READ_WRITE:
                if not getattr(obj, 'fset', None):
                    method_name = obj.write_method_name or "write_" + key
                    obj.fset = attrs.get(method_name)