Return DebuggableScript instance if any associated with the script.
If callable supports DebuggableScript implementation, the method
returns it. Otherwise null is returned.
161641
public static DebuggableScript getDebuggableView(Script script)
    {
        if (script instanceof NativeFunction) {
            return ((NativeFunction)script).getDebuggableView();
        }
        return null;
    }
310741
function getCurrentScript() {
        if ( currentlyAddingScript ) {
            return currentlyAddingScript;
        }
        else if (
            interactiveScript
            && interactiveScript.readyState === 'interactive'
        ) {
            return interactiveScript;
        }
        else {
            var scripts = document.getElementsByTagName( 'script' );
            var scriptLen = scripts.length;
            while ( scriptLen-- ) {
                var script = scripts[ scriptLen ];
                if ( script.readyState === 'interactive' ) {
                    interactiveScript = script;
                    return script;
                }
            }
        }
    }
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;
            }
        }
    }
420639
@RequestMapping(value = "/api/scripts/{scriptIdentifier}", method = RequestMethod.GET)
    public
    @ResponseBody
    Script getScript(Model model, @PathVariable String scriptIdentifier) throws Exception {
        return ScriptService.getInstance().getScript(Integer.parseInt(scriptIdentifier));
    }
939273
private Object getObjectPropertyImpl(Context cx, Object object,
                                           Object id) {
        Scriptable scriptable = (Scriptable)object;
        Object result;
        if (id instanceof String) {
            String name = (String)id;
            if (name.equals("this")) {
                result = scriptable;
            } else if (name.equals("__proto__")) {
                result = scriptable.getPrototype();
            } else if (name.equals("__parent__")) {
                result = scriptable.getParentScope();
            } else {
                result = ScriptableObject.getProperty(scriptable, name);
                if (result == ScriptableObject.NOT_FOUND) {
                    result = Undefined.instance;
                }
            }
        } else {
            int index = ((Integer)id).intValue();
            result = ScriptableObject.getProperty(scriptable, index);
            if (result == ScriptableObject.NOT_FOUND) {
                result = Undefined.instance;
            }
        }
        return result;
    }
629053
@EnsuresNonNull("fn")
  private Function getCompiledScript()
  {
    // JavaScript configuration should be checked when it's actually used because someone might still want Druid
    // nodes to be able to deserialize JavaScript-based objects even though JavaScript is disabled.
    Preconditions.checkState(config.isEnabled(), "JavaScript is disabled");

    Function syncedFn = fn;
    if (syncedFn == null) {
      synchronized (config) {
        syncedFn = fn;
        if (syncedFn == null) {
          syncedFn = compile(function);
          fn = syncedFn;
        }
      }
    }
    return syncedFn;
  }
339627
@Deprecated
    public static Scriptable toObjectOrNull(Context cx, Object obj)
    {
        if (obj instanceof Scriptable) {
            return (Scriptable)obj;
        } else if (obj != null && obj != Undefined.instance) {
            return toObject(cx, getTopCallScope(cx), obj);
        }
        return null;
    }
1097274
def debugger():
    """"""
    sdb = _current[0]
    if sdb is None or not sdb.active:
        sdb = _current[0] = Sdb()
    return sdb
1171326
public static Debug getInstance(String option, String prefix)
    {
        if (isOn(option)) {
            Debug d = new Debug(prefix);
            return d;
        } else {
            return null;
        }
    }
241076
private IScriptReporter getParentScriptReporter()
    {
        Tag parent = getParent();
        if (parent == null)
            return null;
        return (IScriptReporter) SimpleTagSupport.findAncestorWithClass(parent, IScriptReporter.class);
    }
1298220
@Override
    public Object call(Context cx, Scriptable scope, Scriptable thisObj,
                       Object[] args)
    {
        return Undefined.instance;
    }
1248619
private ScriptPluginProvider getPlugin(
            final PluginMeta pluginMeta,
            final File file,
            final ProviderDef pluginDef,
            final ProviderIdent ident
    ) throws
            ProviderLoaderException, PluginException
    {
        if (null == fileExpandedDir) {
            final File dir;
            try {
                dir = expandScriptPlugin(file);
            } catch (IOException e) {
                throw new ProviderLoaderException(e, ident.getService(), ident.getProviderName());
            }
            fileExpandedDir = dir;
            if (pluginDef.getPluginType().equals("script")) {

                final File script = new File(fileExpandedDir, pluginDef.getScriptFile());
                //set executable bit for script-file of the provider
                try {
                    ScriptfileUtils.setExecutePermissions(script);
                } catch (IOException e) {
                    log.warn("Unable to set executable bit for script file: " + script + ": " + e.getMessage());
                }
            }
            debug("expanded plugin dir! " + fileExpandedDir);
        } else {
            debug("expanded plugin dir: " + fileExpandedDir);
        }
        if (pluginDef.getPluginType().equals("script")) {
            final File script = new File(fileExpandedDir, pluginDef.getScriptFile());
            if (!script.exists() || !script.isFile()) {
                throw new PluginException("Script file was not found: " + script.getAbsolutePath());
            }
        }
        return new ScriptPluginProviderImpl(pluginMeta, pluginDef, file, fileExpandedDir);
    }
932417
public static Object callMethod(Context cx, Scriptable obj,
                                    String methodName,
                                    Object[] args)
    {
        Object funObj = getProperty(obj, methodName);
        if (!(funObj instanceof Function)) {
            throw ScriptRuntime.notFunctionError(obj, methodName);
        }
        Function fun = (Function)funObj;
        // XXX: What should be the scope when calling funObj?
        // The following favor scope stored in the object on the assumption
        // that is more useful especially under dynamic scope setup.
        // An alternative is to check for dynamic scope flag
        // and use ScriptableObject.getTopLevelScope(fun) if the flag is not
        // set. But that require access to Context and messy code
        // so for now it is not checked.
        Scriptable scope = ScriptableObject.getTopLevelScope(obj);
        if (cx != null) {
            return fun.call(cx, scope, obj, args);
        }
        return Context.call(null, fun, scope, obj, args);
    }
1305785
public static Object callMethod(Scriptable obj, String methodName,
                                    Object[] args)
    {
        return callMethod(null, obj, methodName, args);
    }
6527
@Override
    public ScriptType getOutputScriptType() {
        int version = getWitnessVersion();
        checkState(version == 0);
        int programLength = getWitnessProgram().length;
        if (programLength == WITNESS_PROGRAM_LENGTH_PKH)
            return ScriptType.P2WPKH;
        if (programLength == WITNESS_PROGRAM_LENGTH_SH)
            return ScriptType.P2WSH;
        throw new IllegalStateException("Cannot happen.");
    }
349386
public com.google.protobuf.ByteString
      getScriptBytes() {
    java.lang.Object ref = script_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      script_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }
880491
def callable_name(callable_obj):
    
    try:
        if (isinstance(callable_obj, type)
            and issubclass(callable_obj, param.ParameterizedFunction)):
            return callable_obj.__name__
        elif (isinstance(callable_obj, param.Parameterized)
              and 'operation' in callable_obj.params()):
            return callable_obj.operation.__name__
        elif isinstance(callable_obj, partial):
            return str(callable_obj)
        elif inspect.isfunction(callable_obj):  # functions and staticmethods
            return callable_obj.__name__
        elif inspect.ismethod(callable_obj):    # instance and class methods
            meth = callable_obj
            if sys.version_info < (3,0):
                owner =  meth.im_class if meth.im_self is None else meth.im_self
            else:
                owner =  meth.__self__
            if meth.__name__ == '__call__':
                return type(owner).__name__
            return '.'.join([owner.__name__, meth.__name__])
        elif isinstance(callable_obj, types.GeneratorType):
            return callable_obj.__name__
        else:
            return type(callable_obj).__name__
    except:
        return str(callable_obj)