If the raw op result has a non-None name (e.g. it is an Index object) and
    the name argument is None, then passing name to the constructor will
    not be enough; we still need to override the name attribute.
192153
def _construct_result(left, result, index, name, dtype=None):
    
    out = left._constructor(result, index=index, dtype=dtype)
    out = out.__finalize__(left)
    out.name = name
    return out
966579
def SetName(obj, name):
  
  # Not doing type assertion on obj, since it may be a mock object used
  # in tests.
  precondition.AssertType(name, str)

  if PY2:
    obj.__name__ = name.encode("ascii")
  else:
    obj.__name__ = name
488684
function( target, attr ) {
    if ( typeof attr !== 'object' )  return
    var len = attr.length

    // Native `NamedNodeMap``:
    if (
      typeof attr[0] === 'object' &&
      'name' in attr[0]
    ) {
      for ( var i = 0; i < len; i++ ) {
        if ( attr[ i ].value !== undefined ) {
          target.setAttribute( attr[ i ].name, attr[ i ].value )
        }
      }

    // Plain object:
    } else {
      for ( var name in attr ) {
        if (
          attr.hasOwnProperty( name ) &&
          attr[ name ] !== undefined
        ) {
          target.setAttribute( name, attr[ name ] )
        }
      }
    }
    return target
  }
238191
def safe_repr(obj):
    
    name = getattr(obj, '__name__', getattr(obj.__class__, '__name__'))
    if name == 'ndict':
        name = 'dict'
    return name or repr(obj)
1240813
function getConstructorName(o) {
  if (o !== undefined && o !== null) {
    return o.constructor.name
  } else {
    return o
  }
}
111955
@Override
    public void propertyName(int index, String propertyName)
            throws OperationFormatException {

        // TODO this is not nice
        if(propertyName.length() > 1 && propertyName.charAt(0) == '-' && propertyName.charAt(1) == '-') {
            assertValidParameterName(propertyName.substring(2));
        } else if(propertyName.length() > 0 && propertyName.charAt(0) == '-') {
            assertValidParameterName(propertyName.substring(1));
        } else {
            assertValidParameterName(propertyName);
        }

        validatedPropertyName(index, propertyName);
    }
1044717
def name(self, name):
        
        if name is None:
            raise ValueError("Invalid value for `name`, must not be `None`")
        if name is not None and len(name) > 200:
            raise ValueError("Invalid value for `name`, length must be less than or equal to `200`")

        self._name = name
1037977
function nonenum(object, propertyName, defaultValue) {
	var value = object[propertyName];

	if (typeof value === 'undefined') {
		value = defaultValue;
		Object.defineProperty(object, propertyName, {
			enumerable: false,
			value: value
		});
	}

	return value;
}
42728
protected NamingEnumeration<?> rawSearchBaseEntry(Name searchbase,

   String filter, int limit, int timeout, String returnAttributes[])

   throws NamingException

   {

      NamingEnumeration<?> result = null;

      if (returnAttributes != null && returnAttributes.length == 0)

         returnAttributes = (new String[] {

            "objectClass" });

      SearchControls constraints = new SearchControls();

      constraints.setSearchScope(0);

      constraints.setCountLimit(limit);

      constraints.setTimeLimit(timeout);

      constraints.setReturningAttributes(returnAttributes);

      result = ctx.search(searchbase, filter, constraints);

      return result;

   }
528283
private String generateSafeMethodName(StorableInfo info, String prefix) {
        Class type = info.getStorableType();

        // Try a few times to generate a unique name. There's nothing special
        // about choosing 100 as the limit.
        int value = 0;
        for (int i = 0; i < 100; i++) {
            String name = prefix + value;
            if (!methodExists(type, name)) {
                return name;
            }
            value = name.hashCode();
        }

        throw new InternalError("Unable to create unique method name starting with: "
                + prefix);
    }
291318
function setAttr(node, name, val, asProp, initial) {
	var el = node.el;

	if (node.ns != null)
		{ el.setAttribute(name, val); }
	else if (name === "class")
		{ el.className = val; }
	else if (name === "id" || typeof val === "boolean" || asProp)
		{ el[name] = val; }
	else if (name[0] === ".")
		{ el[name.substr(1)] = val; }
	else
		{ el.setAttribute(name, val); }
}
650518
def __makeattr(self, name):
        """"""
        # print "makeattr", self.__name__, name
        target = None
        if '__onfirstaccess__' in self.__map__:
            target = self.__map__.pop('__onfirstaccess__')
            importobj(*target)()
        try:
            modpath, attrname = self.__map__[name]
        except KeyError:
            if target is not None and name != '__onfirstaccess__':
                # retry, onfirstaccess might have set attrs
                return getattr(self, name)
            raise AttributeError(name)
        else:
            result = importobj(modpath, attrname)
            setattr(self, name, result)
            try:
                del self.__map__[name]
            except KeyError:
                pass  # in a recursive-import situation a double-del can happen
            return result
418722
def newNsPropEatName(self, ns, name, value):
        
        if ns is None: ns__o = None
        else: ns__o = ns._o
        ret = libxml2mod.xmlNewNsPropEatName(self._o, ns__o, name, value)
        if ret is None:raise treeError('xmlNewNsPropEatName() failed')
        __tmp = xmlAttr(_obj=ret)
        return __tmp
398953
def get_object_name(obj):
    
    name_dispatch = {
        ast.Name: "id",
        ast.Attribute: "attr",
        ast.Call: "func",
        ast.FunctionDef: "name",
        ast.ClassDef: "name",
        ast.Subscript: "value",
    }

    # This is a new ast type in Python 3
    if hasattr(ast, "arg"):
        name_dispatch[ast.arg] = "arg"

    while not isinstance(obj, str):
        assert type(obj) in name_dispatch
        obj = getattr(obj, name_dispatch[type(obj)])

    return obj
1143614
def attribute_name(self, attribute_name):
        

        if attribute_name is None:
            raise ValueError("Invalid value for `attribute_name`, must not be `None`")
        if len(attribute_name) < 1:
            raise ValueError("Invalid value for `attribute_name`, length must be greater than or equal to `1`")

        self._attribute_name = attribute_name
105096
def method_or_name(namespace, x):
    '''
    
    '''
    if not isinstance(x, str):
        return x

    if hasattr(namespace, x):
        return getattr(namespace, x)

    attrs = [y for y in dir(namespace) if not y.startswith('_')]
    msg = '''"%s" is not available in %s.
These attributes are available: %s.''' % (x, namespace.__name__, attrs)
    raise AttributeError(msg)
1038473
private Name makeOperatorName(String name) {
        Name opName = names.fromString(name);
        operatorNames.add(opName);
        return opName;
    }