Tests whether the global jasmine object is available yet and if so, inject the source for the ConsoleReporter.
162081
function checkJasmineStatus() {
  // Only inject the source once.
  if (jasmineFound) {
    return;
  }

  var found = page.evaluate(function () {
    return "jasmine" in window && jasmine.getEnv;
  });

  if (!found) {
    return;
  }

  jasmineFound = true;

  injectReporter();
}
570568
def _detect(self):
        
        results = []
        for c in self.slither.contracts_derived:
            ret = self.detect_uninitialized(c)
            for variable, functions in ret:
                info = "{}.{} ({}) is never initialized. It is used in:\n"
                info = info.format(variable.contract.name,
                                   variable.name,
                                   variable.source_mapping_str)
                for f in functions:
                    info += "\t- {} ({})\n".format(f.name, f.source_mapping_str)

                source = [variable.source_mapping]
                source += [f.source_mapping for f in functions]

                json = self.generate_json_result(info)
                self.add_variable_to_json(variable, json)
                self.add_functions_to_json(functions, json)
                results.append(json)

        return results
1124797
function () {
        var self = this;
        if (typeof this._isIntercepted === 'undefined') {
          // Got through all injector objects
          each(res.injectors, function (obj) {
            if (obj.when(req, res)) {
              self._isIntercepted = true;
              obj.active = true;
            }
          });

          if (!this._isIntercepted) {
            this._isIntercepted = false;
          }
          debug('first time _interceptCheck ran', this._isIntercepted);
        }
        return this._isIntercepted;
      }
868792
@Override
	public Scriptable createThreadScope(Context cx, Scriptable protoScope) {
		final String sourceMethod = "createThreadScope"; //$NON-NLS-1$
		final boolean isTraceLogging = log.isLoggable(Level.FINER);
		if (isTraceLogging) {
			log.entering(sourceClass, sourceMethod, new Object[]{cx, protoScope});
		}
		Scriptable threadScope = super.createThreadScope(cx, protoScope);
		for (Script script : lessJsScript) {
			script.exec(cx, threadScope);
		};
		compilerScript.exec(cx, threadScope);
		ReadFileExtFunction readFileFn = new ReadFileExtFunction(threadScope, getAggregator());
		ScriptableObject.putProperty(threadScope, ReadFileExtFunction.FUNCTION_NAME, readFileFn);


		if (isTraceLogging) {
			log.exiting(sourceMethod, sourceMethod, threadScope);
		}
		return threadScope;
	}
121653
function globalEval(code) {
        var script;

        code = code.replace(/^\s+/, '').replace(/\s+$/, '');

        if (code) {
            if (code.indexOf('use strict') === 1) {
                script = document.createElement('script');
                script.text = code;
                head.appendChild(script).parentNode.removeChild(script);
            }
            else {
                eval(code);
            }
        }
    }
114844
function toHaveBeenDone() {
  var getErrorMsg = jasmine.formatErrorMsg('<toHaveBeenDone>', 'expect(<scopeObj>).toHaveBeenDone()');
  var pp = jasmine.pp;

  return {
    compare: function (actual) {
      var result = { pass: false };

      if (!actual.isDone) {
        throw new Error(getErrorMsg('Expected a nock scope, but got ' + pp(actual) + '.'));
      }

      if (actual.basePath) {
        var key = actual.interceptors[0]._key;
        if (actual.isDone()) {
          result.pass = true;
          result.message = 'Expected nock scope expectation "' + key + '" not to have been done but it was.';
        } else {
          result.message = 'Expected nock scope expectation "' + key + '" to have been done but it was never done.';
        }

        return result;
      }

      if (actual.isDone()) {
        result.pass = true;
        result.message = 'Expected nock expectations to have not been done but they were done.';
      } else {
        result.message = 'Expected nock expectations to have been done but they were never done.';
      }

      return result;
    }
  };
}
1118432
function createAdapterUtilitiesMock() {
   const utilities = {};
   [ 'unknownWidget', 'unknownInjection', 'activityAccessingDom' ].forEach( method => {
      utilities[ method ] = jasmine.createSpy( method ).and.returnValue( new Error() );
   } );
   return utilities;
}
788289
function(name) {
      if (debuggers[name]) {
        return debuggers[name];
      }
      var dbg = function(fmt) {
        // if this debugger is not enabled, do nothing.
        // Check it every time so we can enable or disable a debugger at runtime.
        // It won't be slow.
        if (!enableStatus[this._name]) {
          return;
        }

        fmt = coerce.apply(this, arguments);

        var curr = +new Date();  // IE8 don't have `Date.now()`
        var ms = curr - (this._timestamp || curr);
        this._timestamp = curr;

        if (isChrome) {
          fmt = '%c' + name + '%c ' + fmt + ' %c+' + humanize(ms);
          w.global.console.log(fmt, this._style, this._msgStyle, this._style);
        } else {
          fmt = name + ' ' + fmt + ' +' + humanize(ms);
          if (w.global.console && w.global.console.log) {
            w.global.console.log(fmt);
          }
          // Any one want to alert debug message? I think it's annoying.
        }
      };
      dbg._name = name;
      dbg._msgStyle = styles[0];
      dbg._style = style();
      enableStatus[name] = debug.enabled(name);
      debuggers[name] = dbg.bind(dbg);
      return debuggers[name];
    }
401472
function checkForGlobal(node) {
				var scope = context.getScope(),
					parserOptions = context.parserOptions,
					ecmaFeatures = parserOptions.ecmaFeatures || {};

				// Nodejs env or modules has a special scope.
				if (ecmaFeatures.globalReturn || node.sourceType === "module") {
					findVariablesInScope(scope.childScopes[0]);
				} else {
					findVariablesInScope(scope);
				}
			}
976064
function (name, object) {
    if (global[name] && this.env !== 'test') {
      debug(format('global "%s" already exists', name));
    }
    return (global[name] = object);
  }
1061271
function globalEval (js, url) {
  if (typeof js === T_STRING) {
    var
      node = mkEl('script'),
      root = document.documentElement;

    // make the source available in the "(no domain)" tab
    // of Chrome DevTools, with a .js extension
    if (url) { js += '\n//# sourceURL=' + url + '.js'; }

    node.text = js;
    root.appendChild(node);
    root.removeChild(node);
  }
}
1016389
function shouldPreferGlobalPromise(implementation){
  if(implementation){
    return implementation === 'global.Promise'
  } else if(typeof global.Promise !== 'undefined'){
    // Load global promise if implementation not specified
    // Versions < 0.11 did not have global Promise
    // Do not use for version < 0.12 as version 0.11 contained buggy versions
    var version = (/v(\d+)\.(\d+)\.(\d+)/).exec(process.version)
    return !(version && +version[1] == 0 && +version[2] < 12)
  }

  // do not have global.Promise or another implementation was specified
  return false
}
1134980
function () {
                    var i, len;

                    // eval scripts.
                    if (data.scripts && data.scripts.length) {
                        for (i = 0, len = data.scripts.length; i < len; i++) {
                            Util.globalEval(data.scripts[i]);
                        }
                    }

                    callback && callback(data);
                }
1352559
private Object evalSource(Object source, ScriptContext scriptContext) throws ScriptException {
        try {
            Interpreter bsh = getInterpreter();
            NameSpace contextNameSpace = getEngineNameSpace(scriptContext);
            bsh.setNameSpace(contextNameSpace);

            bsh.setOut(toPrintStream(scriptContext.getWriter()));
            bsh.setErr(toPrintStream(scriptContext.getErrorWriter()));


            if (source instanceof Reader) {
                return bsh.eval((Reader) source);
            } else {
                return bsh.eval((String) source);
            }
        } catch (ParseException e) {
            // explicit parsing error
            throw new ScriptException(e.toString(), e.getErrorSourceFile(), e.getErrorLineNumber());
        } catch (TargetError e) {
            // The script threw an application level exception
            ScriptException se = new ScriptException(e.toString(), e.getErrorSourceFile(), e.getErrorLineNumber());
            se.initCause(e.getTarget());
            throw se;
        } catch (EvalError e) {
            // The script couldn't be evaluated properly
            throw new ScriptException(e.toString(), e.getErrorSourceFile(), e.getErrorLineNumber());
        } catch (IOException e) {
            throw new ScriptException(e.toString());
        }
    }
681738
function Injector(obj){
  var services = {};
  var get = name => {
    if(!(name in services)){
      const err = new Error(`[injector] service "${name}" not found`);
      return Promise.reject(err);
    }
    return services[name];
  };
  if(typeof obj === 'object')
    services = obj;
  if(typeof obj === 'function')
    get = obj;
  function resolve(name) {
    let service = get(name);
    if(typeof service === 'function')
      service = invoke(service);
    return service;
  };
  function invoke(fn, that){
    return Promise
    .all(getParameterNames(fn).map(resolve))
    .then(params => fn.apply(that, params));
  }
  return invoke;
}
87803
def isdefined(obj, force_import=False, namespace=None):
    """"""
    if namespace is None:
        namespace = locals()
    attr_list = obj.split('.')
    base = attr_list.pop(0)
    if len(base) == 0:
        return False
    if base not in builtins.__dict__ and base not in namespace:
        if force_import:
            try:
                module = __import__(base, globals(), namespace)
                if base not in globals():
                    globals()[base] = module
                namespace[base] = module
            except Exception:
                return False
        else:
            return False
    for attr in attr_list:
        try:
            attr_not_found = not hasattr(eval(base, namespace), attr)
        except (SyntaxError, AttributeError):
            return False
        if attr_not_found:
            if force_import:
                try:
                    __import__(base+'.'+attr, globals(), namespace)
                except (ImportError, SyntaxError):
                    return False
            else:
                return False
        base += '.'+attr
    return True
1218596
static Scriptable checkDynamicScope(Scriptable possibleDynamicScope,
                                        Scriptable staticTopScope)
    {
        // Return cx.topCallScope if scope
        if (possibleDynamicScope == staticTopScope) {
            return possibleDynamicScope;
        }
        Scriptable proto = possibleDynamicScope;
        for (;;) {
            proto = proto.getPrototype();
            if (proto == staticTopScope) {
                return possibleDynamicScope;
            }
            if (proto == null) {
                return staticTopScope;
            }
        }
    }