repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
serena
src/solidlsp/language_servers/common.py
.py
from __future__ import annotations import logging import os import pathlib import platform import subprocess from collections.abc import Iterable, Mapping, Sequence from dataclasses import dataclass, replace from typing import Any, cast from solidlsp.ls_utils import FileUtils, PlatformUtils from solidlsp.util import ...
194
8,086
serena
src/solidlsp/language_servers/erlang_language_server.py
.py
"""Erlang Language Server implementation using Erlang LS.""" import logging import os import shutil import subprocess import threading import time from collections.abc import Hashable from overrides import override from solidlsp.ls import RawDocumentSymbol, SolidLanguageServer from solidlsp.ls_config import Language...
255
10,699
serena
src/solidlsp/language_servers/vts_language_server.py
.py
""" Language Server implementation for TypeScript/JavaScript using https://github.com/yioneko/vtsls, which provides TypeScript language server functionality via VSCode's TypeScript extension (contrary to typescript-language-server, which uses the TypeScript compiler directly). """ import logging import os import shuti...
274
12,113
serena
src/solidlsp/language_servers/haskell_language_server.py
.py
""" Provides Haskell specific instantiation of the LanguageServer class. Contains various configurations and settings specific to Haskell. """ import logging import os import shutil import time from typing import Any from overrides import override from solidlsp.ls import SolidLanguageServer from solidlsp.ls_config i...
370
17,127
serena
src/solidlsp/language_servers/cue_language_server.py
.py
""" Provides CUE-specific instantiation of the LanguageServer class, using the LSP mode of the ``cue`` CLI (``cue lsp``) from the official CUE distribution. """ from __future__ import annotations import logging import os import threading from overrides import override from solidlsp.ls import LanguageServerDependenc...
260
11,906
serena
src/solidlsp/language_servers/marksman.py
.py
""" Provides Markdown specific instantiation of the LanguageServer class using marksman. Contains various configurations and settings specific to Markdown. """ import logging import os from collections.abc import Hashable from overrides import override from solidlsp.ls import ( DocumentSymbols, LanguageServe...
261
11,849
serena
src/solidlsp/language_servers/gopls.py
.py
import hashlib import json import logging import os import re from collections.abc import Hashable from typing import Any from overrides import override from solidlsp import ls_types from solidlsp.ls import DocumentSymbols, LSPFileBuffer, RawDocumentSymbol, SolidLanguageServer, SymbolBodyFactory from solidlsp.ls_conf...
329
15,375
serena
src/solidlsp/language_servers/rust_analyzer.py
.py
""" Provides Rust specific instantiation of the LanguageServer class. Contains various configurations and settings specific to Rust. """ import logging import os import pathlib import platform import shutil import subprocess import threading from overrides import override from solidlsp import ls_types from solidlsp....
786
38,215
serena
src/solidlsp/language_servers/scala_language_server.py
.py
""" Provides Scala specific instantiation of the LanguageServer class. Contains various configurations and settings specific to Scala. """ import logging import os import shutil import subprocess import threading import time from enum import Enum from overrides import override from solidlsp.initialize_params import ...
795
35,509
serena
src/solidlsp/language_servers/lean4_language_server.py
.py
""" Provides Lean 4 specific instantiation of the LanguageServer class. Uses the built-in Lean 4 language server (lean --server). """ import logging import shutil from overrides import override from solidlsp.ls import LanguageServerDependencyProvider, LanguageServerDependencyProviderSinglePath, SolidLanguageServer f...
162
6,873
serena
src/solidlsp/language_servers/terraform_ls.py
.py
import logging import os import shutil from overrides import override from solidlsp.ls import SolidLanguageServer from solidlsp.ls_config import LanguageServerConfig, LanguageServerId from solidlsp.ls_utils import PlatformUtils from solidlsp.lsp_protocol_handler.server import ProcessLaunchInfo from solidlsp.settings ...
274
12,628
serena
src/solidlsp/language_servers/bsl_language_server.py
.py
""" Provides BSL (1C:Enterprise) specific instantiation of the LanguageServer class using bsl-language-server by 1c-syntax. Supports .bsl and .os files. Requires Java 21+ on PATH (bsl-language-server v0.29.0 is built with ``targetCompatibility = JavaVersion.VERSION_21``). You can configure the following options in ls_...
218
8,780
serena
src/solidlsp/language_servers/crystal_language_server.py
.py
""" Provides Crystal specific instantiation of the LanguageServer class using Crystalline. """ import logging import shutil import time from solidlsp.ls import SolidLanguageServer from solidlsp.ls_config import LanguageServerConfig from solidlsp.lsp_protocol_handler.server import ProcessLaunchInfo from solidlsp.setti...
153
6,059
serena
src/solidlsp/language_servers/some_sass_language_server.py
.py
""" Provides SCSS / Sass / CSS instantiation of the LanguageServer class using the ``some-sass-language-server`` npm package (https://github.com/wkillerud/some-sass). Some Sass is the dedicated, actively maintained SCSS LSP. It also accepts plain ``.css`` files via the same ``vscode-css-languageservice`` engine that p...
227
10,500
serena
src/solidlsp/language_servers/nixd_ls.py
.py
# type: ignore """ Provides Nix specific instantiation of the LanguageServer class using nixd (Nix Language Server). Note: Windows is not supported as Nix itself doesn't support Windows natively. """ import json import logging import platform import shutil import subprocess from copy import deepcopy from pathlib impo...
427
18,217
serena
src/solidlsp/language_servers/vue_language_server.py
.py
""" Vue Language Server implementation using @vue/language-server (Volar) with companion TypeScript LS. Operates in hybrid mode: Vue LS handles .vue files, TypeScript LS handles .ts/.js files. """ import logging import os import pathlib import shutil import threading from collections.abc import Callable from pathlib i...
954
42,731
serena
src/solidlsp/language_servers/luau_lsp.py
.py
""" Provides Luau specific instantiation of the LanguageServer class using luau-lsp. Luau is the programming language used by Roblox, derived from Lua 5.1 with additional features like type annotations, string interpolation, and more. This uses JohnnyMorganz/luau-lsp as the language server backend. Requirements: ...
375
16,364
serena
src/solidlsp/language_servers/jedi_server.py
.py
""" Provides Python specific instantiation of the LanguageServer class. Contains various configurations and settings specific to Python. """ import logging import threading from overrides import override from solidlsp.ls import SolidLanguageServer from solidlsp.ls_config import LanguageServerConfig from solidlsp.lsp...
181
8,531
serena
src/solidlsp/language_servers/elixir_tools/elixir_tools.py
.py
import logging import os import pathlib import stat import threading from collections.abc import Hashable from typing import Any from overrides import override from solidlsp.ls import RawDocumentSymbol, SolidLanguageServer from solidlsp.ls_config import LanguageServerConfig, LanguageServerId from solidlsp.ls_utils im...
422
19,107
serena
src/solidlsp/util/zip.py
.py
import fnmatch import logging import os import sys import zipfile from pathlib import Path from typing import Optional log = logging.getLogger(__name__) class SafeZipExtractor: """ A utility class for extracting ZIP archives safely. Features: - Handles long file paths on Windows - Skips files th...
129
4,302
serena
src/solidlsp/util/metals_db_utils.py
.py
""" Utilities for detecting and managing Scala Metals H2 database state. This module provides functions to detect existing Metals LSP instances by checking the H2 database lock file, and to clean up stale locks from crashed processes. Metals uses H2 AUTO_SERVER mode (enabled by default) to support multiple concurrent...
281
8,890
serena
src/solidlsp/util/subprocess_util.py
.py
import logging import os import platform import queue import signal import subprocess import threading from collections.abc import Callable from typing import IO, TYPE_CHECKING, Any, Generic, TypeVar, cast import oslex import psutil from sensai.util.string import ToStringMixin if TYPE_CHECKING: import ctypes ...
385
15,965
serena
src/solidlsp/util/cache.py
.py
import logging from typing import Any, Optional from sensai.util.pickle import dump_pickle, load_pickle log = logging.getLogger(__name__) def load_cache(path: str, version: Any) -> Optional[Any]: data = load_pickle(path) if not isinstance(data, dict) or "__cache_version" not in data: log.info("Cache...
24
795
serena
src/serena/task_executor.py
.py
import concurrent.futures import threading import time from collections.abc import Callable from concurrent.futures import Future from dataclasses import dataclass from threading import Thread from typing import Generic, TypeVar from sensai.util import logging from sensai.util.logging import LogTime from sensai.util.s...
244
11,035
serena
src/serena/ls_manager.py
.py
import logging import os.path import threading from collections.abc import Iterator from pathlib import Path from typing import TYPE_CHECKING from sensai.util.logging import LogTime from serena.config.serena_config import ProjectConfig, SerenaPaths from solidlsp import SolidLanguageServer from solidlsp.ls_config impo...
372
17,314
serena
src/serena/symbol.py
.py
import copy import json import logging import os from abc import ABC, abstractmethod from collections import OrderedDict from collections.abc import Callable, Iterable, Iterator, Sequence from contextlib import contextmanager from dataclasses import asdict, dataclass from time import perf_counter from typing import Any...
1,382
60,539
serena
src/serena/analytics.py
.py
from __future__ import annotations import logging import threading from abc import ABC, abstractmethod from collections import defaultdict from copy import copy from dataclasses import asdict, dataclass from enum import Enum from anthropic.types import MessageParam, MessageTokensCount from dotenv import load_dotenv ...
175
6,285
serena
src/serena/project_server.py
.py
import json import logging import threading from typing import TYPE_CHECKING import requests as requests_lib from flask import Flask, request from pydantic import BaseModel from sensai.util.logging import LogTime from serena.config.serena_config import LanguageBackend, SerenaConfig from serena.constants import Serena...
198
8,295
serena
src/serena/mcp.py
.py
""" The Serena Model Context Protocol (MCP) Server """ import sys from collections.abc import AsyncIterator, Iterator from contextlib import asynccontextmanager from copy import deepcopy from dataclasses import dataclass from typing import Any, Literal, cast import docstring_parser from mcp.server.fastmcp import serv...
424
19,583
serena
src/serena/code_editor.py
.py
import json import logging import os from abc import ABC, abstractmethod from collections.abc import Iterable, Iterator, Reversible from contextlib import contextmanager from typing import Generic, TypeVar, cast from serena.jetbrains.jetbrains_plugin_client import JetBrainsPluginClient from serena.symbol import JetBra...
494
22,454
serena
src/serena/__init__.py
.py
__version__ = "1.7.1.dev0" import logging log = logging.getLogger(__name__) def serena_version() -> str: """ :return: the version of the package, including git status if available. """ from serena.util.git import get_git_status version = __version__ try: git_status = get_git_status(...
36
771
serena
src/serena/hooks.py
.py
import json import os import pickle import shutil import sys from abc import ABC, abstractmethod from dataclasses import dataclass from datetime import datetime from enum import Enum from pathlib import Path from typing import Literal, Self import click from serena.util.cli_util import AutoRegisteringGroup # copied ...
635
28,074
serena
src/serena/gui_log_viewer.py
.py
import logging import queue import sys import threading import tkinter as tk import traceback from collections.abc import Callable from enum import Enum, auto from pathlib import Path from typing import Literal from serena import constants from serena.util.logging import MemoryLogHandler log = logging.getLogger(__nam...
417
15,676
serena
src/serena/constants.py
.py
from pathlib import Path _repo_root_path = Path(__file__).parent.parent.parent.resolve() _serena_pkg_path = Path(__file__).parent.resolve() _resources_path = _serena_pkg_path / "resources" SERENA_MANAGED_DIR_NAME = ".serena" # TODO: Path-related constants should be moved to SerenaPaths; don't add further constants h...
44
1,930
serena
src/serena/dashboard.py
.py
import json import multiprocessing import os import socket import subprocess import sys import threading import time import urllib.error import urllib.request from collections.abc import Callable from dataclasses import dataclass from html import escape from pathlib import Path from typing import TYPE_CHECKING, Any, Op...
1,342
54,882
serena
src/serena/agno.py
.py
import argparse import logging import os import threading from pathlib import Path from typing import Any from agno.agent import Agent from agno.db.sqlite import SqliteDb from agno.memory import MemoryManager from agno.models.base import Model from agno.tools.function import Function from agno.tools.toolkit import Too...
144
5,929
serena
src/serena/project.py
.py
import logging import os import threading from collections.abc import Callable from pathlib import Path from typing import TYPE_CHECKING, Any, Optional import pathspec from sensai.util.logging import LogTime from sensai.util.string import TextBuilder, ToStringMixin from serena.config.serena_config import ( Langua...
627
30,807
serena
src/serena/prompt_factory.py
.py
import os from serena.config.serena_config import SerenaPaths from serena.constants import PROMPT_TEMPLATES_DIR_INTERNAL from serena.generated.generated_prompt_factory import PromptFactory class SerenaPromptFactory(PromptFactory): """ A class for retrieving and rendering prompt templates and prompt lists. ...
17
573
serena
src/serena/cli.py
.py
import collections import glob import json import os import shutil import subprocess import sys import time from collections.abc import Iterator, Sequence from logging import Logger from pathlib import Path from typing import TYPE_CHECKING, Any, Literal import click from sensai.util import logging from sensai.util.log...
1,520
69,901
serena
src/serena/agent.py
.py
""" The Serena Model Context Protocol (MCP) Server """ import json import multiprocessing import os import platform import signal import subprocess import threading from collections import defaultdict from collections.abc import Callable, Iterator, Sequence from contextlib import contextmanager from dataclasses import...
1,521
73,290
serena
src/serena/tools/query_project_tools.py
.py
import json from serena.config.serena_config import LanguageBackend from serena.jetbrains.jetbrains_plugin_client import JetBrainsPluginClientManager from serena.project_server import ProjectServerClient from serena.tools import Tool, ToolMarkerDoesNotRequireActiveProject, ToolMarkerOptional class ListQueryableProje...
78
3,955
serena
src/serena/tools/symbol_tools.py
.py
""" Language server-related tools """ import copy import os from collections import Counter, defaultdict from collections.abc import Sequence from typing import Any from serena.symbol import LanguageServerSymbol, LanguageServerSymbolDictGrouper from serena.tools import ( SUCCESS_RESULT, EditingToolWithDiagnos...
739
34,548
serena
src/serena/tools/tools_base.py
.py
import inspect import json from abc import ABC from collections.abc import Callable, Iterable from dataclasses import dataclass from functools import cached_property from types import TracebackType from typing import TYPE_CHECKING, Any, Optional, Protocol, Self, TypeVar, cast from mcp import Implementation from mcp.se...
694
28,773
serena
src/serena/tools/cmd_tools.py
.py
""" Tools supporting the execution of (external) commands """ import os.path from serena.tools import Tool, ToolMarkerCanEdit from serena.util.shell import execute_shell_command class ExecuteShellCommandTool(Tool, ToolMarkerCanEdit): """ Executes a shell command. """ def apply( self, ...
53
2,084
serena
src/serena/tools/memory_tools.py
.py
import logging from typing import Literal from serena.tools import Tool, ToolMarkerCanEdit log = logging.getLogger(__name__) class WriteMemoryTool(Tool, ToolMarkerCanEdit): """ Write some information (utf-8-encoded) about this project that can be useful for future tasks to a memory in md format. The mem...
123
4,735
serena
src/serena/tools/jetbrains_tools.py
.py
import logging from collections import Counter from typing import Any, Literal import serena.jetbrains.jetbrains_types as jb from serena.code_editor import JetBrainsCodeEditor from serena.jetbrains.jetbrains_plugin_client import JetBrainsPluginClient from serena.jetbrains.jetbrains_types import SymbolDTO, SymbolDTOUti...
697
33,743
serena
src/serena/tools/workflow_tools.py
.py
""" Tools supporting the general workflow of the agent """ import platform from serena.tools import Tool, ToolMarkerDoesNotRequireActiveProject, ToolMarkerOptional, WriteMemoryTool class OnboardingTool(Tool): """ Performs onboarding (identifying the project structure and essential tasks, e.g. for testing or...
64
2,631
serena
src/serena/tools/file_tools.py
.py
""" File and file system-related tools, specifically for * listing directory contents * reading files * creating files * editing at the file level """ import os from collections import defaultdict from fnmatch import fnmatch from pathlib import Path from typing import Literal from serena.tools import SUCCESS_...
664
32,244
serena
src/serena/tools/config_tools.py
.py
from sensai.util.helper import mark_used from serena.tools import Tool, ToolMarkerDoesNotRequireActiveProject, ToolMarkerOptional class OpenDashboardTool(Tool, ToolMarkerOptional, ToolMarkerDoesNotRequireActiveProject): """ Opens the Serena web dashboard in the default web browser. The dashboard provides...
67
2,545
serena
src/serena/memories/memory_manager.py
.py
import logging import os import re import shutil from collections.abc import Iterator, Sequence from pathlib import Path from typing import Literal from serena.config.serena_config import ( SerenaPaths, ) from serena.constants import SERENA_FILE_ENCODING from serena.util.text_utils import ContentReplacer from .me...
439
20,642
serena
src/serena/memories/memory_reference_analysis.py
.py
""" Memory reference matching, similarity scoring, and integrity reporting. This module contains the pure helpers and data types used by :class:`serena.project.MemoriesManager` to (a) detect and rank references between memories, and (b) report referential integrity issues. The :class:`MemoryReferenceAnalyzer` class dr...
781
38,818
serena
src/serena/config/serena_config.py
.py
""" The Serena Model Context Protocol (MCP) Server """ import dataclasses import os import re import shutil import threading from collections.abc import Iterator, Sequence from copy import deepcopy from dataclasses import dataclass, field from datetime import UTC, datetime from enum import Enum from functools import c...
1,472
67,240
serena
src/serena/config/context_mode.py
.py
""" Context and Mode configuration loader """ import os from dataclasses import dataclass, field from pathlib import Path from typing import TYPE_CHECKING, Self import yaml from sensai.util import logging from sensai.util.string import ToStringMixin from serena.config.serena_config import SerenaPaths, ToolInclusionD...
283
11,302
serena
src/serena/config/client_setup.py
.py
from abc import ABC, abstractmethod import click from serena.util.shell import execute_shell_command class ClientSetupHandler(ABC): def __init__(self, name: str) -> None: self.name = name @abstractmethod def is_applicable(self) -> bool: """ :return: whether the client setup can ...
147
5,237
serena
src/serena/jetbrains/jetbrains_plugin_client.py
.py
""" Client for the Serena JetBrains Plugin """ import concurrent import json import logging import re import threading from concurrent.futures.thread import ThreadPoolExecutor from dataclasses import dataclass from pathlib import Path from typing import Any, Literal, Optional, Self, TypeVar, cast import requests from...
755
32,031
serena
src/serena/jetbrains/jetbrains_types.py
.py
from typing import Literal, NotRequired, TypedDict JB_EXTERNAL_FILE_PREFIX = "<ext:" """ Prefix used for in relative paths of symbols that are from external libraries (i.e., not defined in the user's codebase). """ def is_external_path(relative_path: str): """ :param relative_path: a relative path (e.g., fro...
111
3,056
serena
src/serena/util/file_system.py
.py
import logging import os import re from collections.abc import Callable, Iterator from dataclasses import dataclass, field from pathlib import Path from typing import NamedTuple import pathspec from pathspec import PathSpec from sensai.util.logging import LogTime log = logging.getLogger(__name__) # Characters meanin...
398
17,008
serena
src/serena/util/gui.py
.py
import os import platform def system_has_usable_display() -> bool: system = platform.system() # macOS and native Windows: assume display is available for desktop usage if system == "Darwin" or system == "Windows": return True # Other systems, assumed to be Unix-like (Linux, FreeBSD, Cygwin/M...
23
726
serena
src/serena/util/logging.py
.py
import queue import threading from collections.abc import Callable from dataclasses import dataclass from typing import Optional from sensai.util import logging from serena.constants import LOG_MESSAGES_BUFFER_SIZE, SERENA_LOG_FORMAT lg = logging @dataclass class LogMessages: messages: list[str] """ th...
153
5,532
serena
src/serena/util/cli_util.py
.py
import click def ask_yes_no(question: str, default: bool | None = None) -> bool: default_prompt = "Y/n" if default else "y/N" while True: answer = input(f"{question} [{default_prompt}] ").strip().lower() if answer == "" and default is not None: return default if answer in ...
37
1,323
serena
src/serena/util/inspection.py
.py
import logging import os from collections.abc import Callable, Iterator from typing import TypeVar from serena.util.file_system import find_all_non_ignored_files from solidlsp.ls_config import LanguageServerId T = TypeVar("T") log = logging.getLogger(__name__) def iter_subclasses( cls: type[T], recursive: bool...
75
2,950
serena
src/serena/util/text_utils.py
.py
import hashlib import logging import re from collections.abc import Callable from dataclasses import dataclass, field from enum import StrEnum from typing import Any, Literal, Self from bs4 import BeautifulSoup from joblib import Parallel, delayed from sensai.util.string import ToStringMixin from serena.util.file_pro...
677
29,404
serena
src/serena/util/dataclass.py
.py
from dataclasses import MISSING, Field from typing import Any, cast def get_dataclass_default(cls: type, field_name: str) -> Any: """ Gets the default value of a dataclass field. :param cls: The dataclass type. :param field_name: The name of the field. :return: The default value of the field (eit...
22
701
serena
src/serena/util/exception.py
.py
import os import sys from serena.agent import log def is_headless_environment() -> bool: """ Detect if we're running in a headless environment where GUI operations would fail. Returns True if: - No DISPLAY variable on Linux/Unix - Running in SSH session - Running in WSL without X server ...
66
2,223
serena
src/serena/util/thread.py
.py
import threading from collections.abc import Callable from enum import Enum from typing import Generic, TypeVar from sensai.util.string import ToStringMixin class TimeoutException(Exception): def __init__(self, message: str, timeout: float) -> None: super().__init__(message) self.timeout = timeou...
69
2,097
serena
src/serena/util/version.py
.py
class Version: """ Represents a version, specifically the numeric components of a version string. Suffixes like "rc1" or "-dev" are ignored, i.e. for a version string like "1.2.3rc1", the components are [1, 2, 3]. """ def __init__(self, package_or_version: object | str): """ :p...
86
3,658
serena
src/serena/util/pypi.py
.py
"""Utilities for querying package information from the Python Package Index (PyPI).""" import requests class PyPIPackageInfo: """Provider of information on a package hosted on the Python Package Index (PyPI). Information is retrieved on demand via PyPI's JSON API. """ JSON_API_URL_TEMPLATE = "https...
33
1,180
serena
src/serena/util/file_proxy.py
.py
import logging import os from abc import ABC, abstractmethod from collections.abc import Iterator from typing import TYPE_CHECKING, Self from serena.jetbrains import jetbrains_types as jb if TYPE_CHECKING: from serena.project import Project log = logging.getLogger(__name__) class FileProxy(ABC): @abstractm...
132
4,791
serena
src/serena/util/git.py
.py
import logging from sensai.util.git import GitStatus from ..constants import REPO_ROOT from .shell import subprocess_check_output log = logging.getLogger(__name__) def get_git_status() -> GitStatus | None: try: cwd = REPO_ROOT commit_hash = subprocess_check_output(["git", "rev-parse", "HEAD"], ...
23
833
serena
src/serena/util/class_decorators.py
.py
from typing import Any # duplicate of interprompt.class_decorators # We don't want to depend on interprompt for this in serena, so we duplicate it here def singleton(cls: type[Any]) -> Any: instance = None def get_instance(*args: Any, **kwargs: Any) -> Any: nonlocal instance if instance is No...
16
432
serena
src/serena/util/ls_diagnostics.py
.py
import json from collections.abc import Iterable from dataclasses import dataclass from typing import TYPE_CHECKING, Any from solidlsp import ls_types from solidlsp.lsp_protocol_handler.lsp_types import DiagnosticSeverity if TYPE_CHECKING: from serena.symbol import LanguageServerSymbolRetriever @dataclass(froze...
204
7,977
serena
src/serena/util/dotnet.py
.py
import logging import platform import re import shutil import subprocess import urllib from pathlib import Path from serena.util.version import Version from solidlsp.ls_exceptions import SolidLSPException from solidlsp.util.subprocess_util import subprocess_run log = logging.getLogger(__name__) class DotNETUtil: ...
158
7,165
serena
src/serena/util/pywebview.py
.py
import logging import os import sys import threading import time from typing import Any import psutil import webview from PIL import Image log = logging.getLogger(__name__) class WebViewWithTray: """ Web view window with optional system tray. """ DEBUG = False def __init__( self, ...
234
8,001
serena
src/serena/util/yaml.py
.py
import logging import os import tempfile import time from collections.abc import Sequence from enum import Enum from typing import Any from ruamel.yaml import YAML, CommentedSeq, CommentToken, StreamMark from ruamel.yaml.comments import CommentedMap from serena.constants import SERENA_FILE_ENCODING log = logging.get...
322
15,326
serena
src/serena/util/shell.py
.py
import os import subprocess from pydantic import BaseModel from solidlsp.util.subprocess_util import subprocess_kwargs class ShellCommandResult(BaseModel): stdout: str return_code: int cwd: str stderr: str | None = None def execute_shell_command(command: str, cwd: str | None = None, capture_stderr...
54
1,626
serena
src/interprompt/__init__.py
.py
from .prompt_factory import autogenerate_prompt_factory_module __all__ = ["autogenerate_prompt_factory_module"]
4
113
serena
src/interprompt/jinja_template.py
.py
from typing import Any import jinja2 import jinja2.meta import jinja2.nodes import jinja2.visitor from jinja2.sandbox import SandboxedEnvironment from .util.class_decorators import singleton class ParameterizedTemplateInterface: def get_parameters(self) -> list[str]: ... @singleton class _JinjaEnvProvider: ...
48
1,621
serena
src/interprompt/multilang_prompt.py
.py
import logging import os from enum import Enum from typing import Any, Generic, Literal, TypeVar import yaml from sensai.util.string import ToStringMixin from .jinja_template import JinjaTemplate, ParameterizedTemplateInterface log = logging.getLogger(__name__) class PromptTemplate(ToStringMixin, ParameterizedTemp...
395
17,594
serena
src/interprompt/util/class_decorators.py
.py
from typing import Any def singleton(cls: type[Any]) -> Any: instance = None def get_instance(*args: Any, **kwargs: Any) -> Any: nonlocal instance if instance is None: instance = cls(*args, **kwargs) return instance return get_instance
14
288
locust
generate_changelog.py
.py
#!/usr/bin/env python3 import os import subprocess import sys github_api_token = os.getenv("CHANGELOG_GITHUB_TOKEN") or input("Enter Github API token: ") if len(sys.argv) < 2: raise Exception("Provide a version number as parameter (--future-release argument)") version = sys.argv[1] cmd = [ "github_changelo...
36
805
locust
hatch_build.py
.py
import os import subprocess from typing import Any from hatchling.builders.hooks.plugin.interface import BuildHookInterface # type: ignore class BuildFrontend(BuildHookInterface): def initialize(self, version: str, build_data: dict[str, Any]) -> None: # Only build the front end once, in the source dist,...
21
975
locust
locust/web.py
.py
from __future__ import annotations import csv import itertools import json import logging import mimetypes import os.path from functools import wraps from io import StringIO from json import dumps from typing import TYPE_CHECKING, Any, TypedDict import gevent from flask import ( Blueprint, Flask, Response...
784
32,279
locust
locust/main.py
.py
from __future__ import annotations import locust from locust.opentelemetry import setup_opentelemetry import atexit import errno import gc import inspect import itertools import logging import os import signal import sys import time import traceback import webbrowser from typing import TYPE_CHECKING import gevent f...
696
28,805
locust
locust/stats.py
.py
from __future__ import annotations import csv import hashlib import json import logging import os import signal import sys import time from abc import abstractmethod from collections import OrderedDict, defaultdict, namedtuple from copy import copy from itertools import chain from typing import TYPE_CHECKING, Protocol...
1,297
49,966
locust
locust/clients.py
.py
from __future__ import annotations from locust.event import EventHook import os import re import sys import time from contextlib import contextmanager from typing import TYPE_CHECKING, cast from urllib.parse import urlparse, urlunparse import requests from packaging.version import Version from requests import Respon...
546
23,474
locust
locust/__main__.py
.py
from .main import main main()
4
31
locust
locust/__init__.py
.py
import os if os.getenv("LOCUST_PLAYWRIGHT", None): print("LOCUST_PLAYWRIGHT setting is no longer needed (because locust-plugins no longer installs trio)") print("Uninstall trio package and remove the setting.") try: # preserve backwards compatibility for now import trio # noqa: F401 ex...
65
1,876
locust
locust/exception.py
.py
class LocustError(Exception): pass class ResponseError(Exception): pass class CatchResponseError(Exception): pass class MissingWaitTimeError(LocustError): pass class InterruptTaskSet(Exception): """ Exception that will interrupt a User when thrown inside a task """ def __init__(...
90
2,054
locust
locust/input_events.py
.py
from __future__ import annotations import collections import logging import os import sys from collections.abc import Callable import gevent if os.name == "nt": import pywintypes from win32api import STD_INPUT_HANDLE from win32console import ( ENABLE_ECHO_INPUT, ENABLE_LINE_INPUT, ...
120
3,323
locust
locust/debug.py
.py
from __future__ import annotations import locust import locust.log from locust import argument_parser from locust.env import Environment from locust.exception import CatchResponseError, RescheduleTask import inspect import os from datetime import datetime, timezone from typing import TYPE_CHECKING if TYPE_CHECKING: ...
166
5,109
locust
locust/html.py
.py
import os from itertools import chain from jinja2 import Environment as JinjaEnvironment from jinja2 import FileSystemLoader from . import stats from .runners import STATE_STOPPED, STATE_STOPPING, MasterRunner from .user.inspectuser import get_ratio from .util.date import format_duration, format_utc_timestamp PERCEN...
110
4,076
locust
locust/opentelemetry.py
.py
from locust import events import logging import os import socket from urllib.parse import urlparse from ._version import __version__ logger = logging.getLogger(__name__) MAX_REQUEST_NAMES = 20 request_names: set[str] = set() def setup_opentelemetry(locustfile: str, profile: str | None) -> bool: try: fr...
273
11,035
locust
locust/event.py
.py
from __future__ import annotations import logging import time import traceback from collections.abc import Generator from contextlib import contextmanager from typing import Any from . import log from .exception import InterruptTaskSet, RescheduleTask, RescheduleTaskImmediately, StopTest, StopUser class EventHook: ...
298
9,084
locust
locust/log.py
.py
import logging import logging.config import re import socket from collections import deque HOSTNAME = re.sub(r"\..*", "", socket.gethostname()) # Global flag that we set to True if any unhandled exception occurs in a greenlet # Used by main.py to set the process return code to non-zero unhandled_greenlet_exception = ...
107
3,455
locust
locust/dispatch.py
.py
from __future__ import annotations import contextlib import itertools import math import time from collections import defaultdict from collections.abc import Iterator from heapq import heapify, heapreplace from math import log2 from operator import attrgetter from typing import TYPE_CHECKING import gevent if TYPE_CH...
398
16,202
locust
locust/runners.py
.py
from __future__ import annotations from locust import __version__ import functools import inspect import json import logging import os import re import socket import sys import time import traceback from abc import abstractmethod from collections import defaultdict from collections.abc import Callable, Iterator, Muta...
1,532
71,808
locust
locust/env.py
.py
from __future__ import annotations from collections.abc import Callable from operator import methodcaller from typing import TypeVar from configargparse import Namespace from .dispatch import UsersDispatcher from .event import Events from .exception import RunnerAlreadyExistsError from .runners import LocalRunner, M...
308
13,203
locust
locust/argument_parser.py
.py
from __future__ import annotations import locust from locust import runners from locust.rpc import Message, zmqrpc import argparse import ast import atexit import difflib import json import os import platform import socket import sys import tempfile import textwrap from collections import OrderedDict from typing impo...
956
34,607
locust
locust/shape.py
.py
from __future__ import annotations import time from abc import ABCMeta, abstractmethod from typing import TYPE_CHECKING, ClassVar from .runners import Runner if TYPE_CHECKING: from . import User class LoadTestShapeMeta(ABCMeta): """ Meta class for the main User class. It's used to allow User classes to...
70
1,973
locust
locust/test/fake_module1_for_env_test.py
.py
"""Module for locust.test.test_env.TestEnvironment.test_user_classes_with_same_name_is_error""" from locust import User class MyUserWithSameName(User): pass
8
164