Tests whether an object should be simply returned when being wrapped
771719
def should_exclude(type_or_instance, exclusion_list):
    
    if type_or_instance in exclusion_list: # Check class definition
        return True
    if type(type_or_instance) in exclusion_list: # Check instance type
        return True
    try:
        if type_or_instance.__class__ in exclusion_list: # Check instance class
            return True
    except:
        pass

    return False
1234192
boolean expectObject(Node n, JSType type, String msg) {
    if (!type.matchesObjectContext()) {
      mismatch(n, msg, type, OBJECT_TYPE);
      return false;
    }
    return true;
  }
611002
def object_isinstance(node, class_or_seq, context=None):
    
    obj_type = object_type(node, context)
    if obj_type is util.Uninferable:
        return util.Uninferable
    return _object_type_is_subclass(obj_type, class_or_seq, context=context)
425032
def ensure_contexted(func):
        
        @wraps(func)
        def wrapped(self, *args, **kwargs):
            if self._buf is None:
                raise TypeError("An Evtx object must be used with"
                                " a context (see the `with` statement).")
            else:
                return func(self, *args, **kwargs)
        return wrapped
888728
def _checkReturnValueEpytext(self, node, linenoDocstring):
        
        # Getter properties don't need to document their return value,
        # but then need to have a return value.
        if 'property' in _getDecoratorsName(node):
            if self._hasReturnValue(node):
                # Getter properties don't need a docstring.
                return

        # Check for return value.
        if self._hasReturnValue(node):
            if node.name.startswith('test_'):
                # Ignore return documentation for test methods.
                return
            if not re.search(r"@return[s]{0,1}\s*:", node.doc):
                self.add_message('W9204', line=linenoDocstring, node=node)
            if not re.search(r"@rtype\s*:", node.doc):
                self.add_message('W9205', line=linenoDocstring, node=node)
181558
def wrap_iterable(obj):
    
    was_scalar = not isiterable(obj)
    wrapped_obj = [obj] if was_scalar else obj
    return wrapped_obj, was_scalar
1227835
function throwUnexpected (attr, obj) {
  var e = Unexpected(attr, obj);
  Error.captureStackTrace(e, throwUnexpected);
  throw e;
}
1206619
function isRefObject (thing) {
  if (thing && typeof thing === 'object' && !Array.isArray(thing)) {
    const keys = Object.keys(thing)
    return keys.length === 1 && keys[0] === '$ref' && typeof thing.$ref === 'string'
  }
  return false
}
434282
function( obj ) {
					if ( obj == null ) {
						obj = promise;
					} else {
						for ( var key in promise ) {
							obj[ key ] = promise[ key ];
						}
					}
					return obj;
				}
181283
def isroutine(object):
    """"""
    return (isbuiltin(object)
            or isfunction(object)
            or ismethod(object)
            or ismethoddescriptor(object))
1310895
function isEmptyObject(obj) {
    if (obj === null) {
        return true;
    }
    if (!isObject(obj)) {
        return false;
    }

    for (var key in obj) {
        if (obj.hasOwnProperty(key) && obj[key]) {
            return false;
        }
    }

    return true;
}
100008
def wrap(self, value, session=None):
        '''  '''
        self.validate_wrap(value)
        if isinstance(value, bytes) or isinstance(value, basestring):
            return ObjectId(value)
        return value
19130
function once(fn) {
  var called, value;

  if (typeof fn !== 'function') {
    throw new Error('expected a function but got ' + fn);
  }

  return function wrap() {
    if (called) {
      return value;
    }
    called = true;
    value = fn.apply(this, arguments);
    fn = undefined;
    return value;
  };
}
664183
function wrap(factory) {
  var out = {};

  methods.forEach(function (method) {
    out[method] = function () {
      var test = factory[method].apply(factory, arguments);
      test.then = createPromiseMethod("then");
      test.catch = createPromiseMethod("catch");
      return test;
    };
  });

  return out;
}
1347790
@Override
    public boolean isWrapperFor(ServletResponse wrapped) {
        final ServletResponse response = getHttpServletResponse();

        if (response == wrapped) {
            return true;
        } else if (response instanceof ServletResponseWrapper) {
            return ((ServletResponseWrapper) response).isWrapperFor(wrapped);
        } else {
            return false;
        }
    }
1124423
def infer_returned_object(pyfunction, args):
    """"""
    object_info = pyfunction.pycore.object_info
    result = object_info.get_exact_returned(pyfunction, args)
    if result is not None:
        return result
    result = _infer_returned(pyfunction, args)
    if result is not None:
        if args and pyfunction.get_module().get_resource() is not None:
            params = args.get_arguments(
                pyfunction.get_param_names(special_args=False))
            object_info.function_called(pyfunction, params, result)
        return result
    result = object_info.get_returned(pyfunction, args)
    if result is not None:
        return result
    hint_return = get_type_hinting_factory(pyfunction.pycore.project).make_return_provider()
    type_ = hint_return(pyfunction)
    if type_ is not None:
        return rope.base.pyobjects.PyObject(type_)
1248443
def maybe_thenable(obj, on_resolve):
    
    if isawaitable(obj) and not isinstance(obj, Promise):
        return await_and_execute(obj, on_resolve)

    if is_thenable(obj):
        return Promise.resolve(obj).then(on_resolve)

    # If it's not awaitable not a Promise, return
    # the function executed over the object
    return on_resolve(obj)