private static boolean isAvailable(final @NotNull Location location, final @Nullable PsiFile script) {
    if (script == null || script.getFileType() != PythonFileType.INSTANCE ||
        !script.getViewProvider().getBaseLanguage().isKindOf(PythonLanguage.INSTANCE)) {
      return false;
    }
    final Module module = ModuleUtilCore.findModuleForPsiElement(script);
    if (module != null) {
      for (RunnableScriptFilter f : RunnableScriptFilter.EP_NAME.getExtensionList()) {
        // Configuration producers always called by user
        if (f.isRunnableScript(script, module, location, TypeEvalContext.userInitiated(location.getProject(), null))) {
          return false;
        }
      }
    }
    return true;
  }
private static boolean isAvailable(final @NotNull Location location, final @Nullable PsiFile script)