id int64 0 190k | prompt stringlengths 21 13.4M | docstring stringlengths 1 12k ⌀ |
|---|---|---|
152,065 | from __future__ import annotations
import functools
import operator
import os
from typing import TYPE_CHECKING, Any
from packaging.markers import default_environment
from pdm.compat import tomllib
from pdm.formats.base import make_array
from pdm.models.markers import Marker, get_marker
from pdm.models.requirements impo... | null |
152,066 | from __future__ import annotations
import argparse
import hashlib
import shlex
import urllib.parse
from pathlib import Path
from typing import TYPE_CHECKING, Any, Mapping
from pdm.exceptions import PdmUsageError
from pdm.formats.base import make_array
from pdm.models.requirements import FileRequirement, Requirement, pa... | null |
152,067 | from __future__ import annotations
import argparse
import hashlib
import shlex
import urllib.parse
from pathlib import Path
from typing import TYPE_CHECKING, Any, Mapping
from pdm.exceptions import PdmUsageError
from pdm.formats.base import make_array
from pdm.models.requirements import FileRequirement, Requirement, pa... | null |
152,068 | from __future__ import annotations
import argparse
import hashlib
import shlex
import urllib.parse
from pathlib import Path
from typing import TYPE_CHECKING, Any, Mapping
from pdm.exceptions import PdmUsageError
from pdm.formats.base import make_array
from pdm.models.requirements import FileRequirement, Requirement, pa... | null |
152,069 | from __future__ import annotations
import re
from typing import Any, Callable, Mapping, TypeVar, cast
import tomlkit
from pdm import termui
_T = TypeVar("_T", bound=Callable)
def convert_from(field: str | None = None, name: str | None = None) -> Callable[[_T], _T]:
def wrapper(func: _T) -> _T:
func._conver... | null |
152,070 | from __future__ import annotations
import re
from typing import Any, Callable, Mapping, TypeVar, cast
import tomlkit
from pdm import termui
NAME_EMAIL_RE = re.compile(r"(?P<name>[^,]+?)\s*(?:<(?P<email>.+)>)?\s*$")
def array_of_inline_tables(value: list[Mapping], multiline: bool = True) -> list[str]:
return make_ar... | null |
152,071 | from __future__ import annotations
import ast
import os
from pathlib import Path
from typing import TYPE_CHECKING, Any, List, Mapping, cast
from pdm.compat import tomllib
from pdm.formats.base import (
MetaConverter,
Unset,
array_of_inline_tables,
convert_from,
make_array,
make_inline_table,
)
f... | null |
152,072 | from __future__ import annotations
import ast
import os
from pathlib import Path
from typing import TYPE_CHECKING, Any, List, Mapping, cast
from pdm.compat import tomllib
from pdm.formats.base import (
MetaConverter,
Unset,
array_of_inline_tables,
convert_from,
make_array,
make_inline_table,
)
f... | null |
152,073 | from __future__ import annotations
import ast
import os
from pathlib import Path
from typing import TYPE_CHECKING, Any, List, Mapping, cast
from pdm.compat import tomllib
from pdm.formats.base import (
MetaConverter,
Unset,
array_of_inline_tables,
convert_from,
make_array,
make_inline_table,
)
f... | This function is borrowed from flit's implementation, but does not attempt to import that file. If docstring or version can't be retrieved by this function, they are just left empty. |
152,074 | from __future__ import annotations
import ast
import os
from pathlib import Path
from typing import TYPE_CHECKING, Any, List, Mapping, cast
from pdm.compat import tomllib
from pdm.formats.base import (
MetaConverter,
Unset,
array_of_inline_tables,
convert_from,
make_array,
make_inline_table,
)
f... | null |
152,075 | from __future__ import annotations
import ast
import os
from pathlib import Path
from typing import TYPE_CHECKING, Any, List, Mapping, cast
from pdm.compat import tomllib
from pdm.formats.base import (
MetaConverter,
Unset,
array_of_inline_tables,
convert_from,
make_array,
make_inline_table,
)
f... | null |
152,076 | from __future__ import annotations
import os
from pathlib import Path
from typing import TYPE_CHECKING, Any, Mapping
from pdm.formats.base import array_of_inline_tables, make_array, make_inline_table
def check_fingerprint(project: Project, filename: Path) -> bool:
return os.path.basename(filename) in ("setup.py", ... | null |
152,077 | from __future__ import annotations
import os
from pathlib import Path
from typing import TYPE_CHECKING, Any, Mapping
from pdm.formats.base import array_of_inline_tables, make_array, make_inline_table
def make_inline_table(data: Mapping) -> dict:
"""Create an inline table from the given data."""
table = cast(di... | null |
152,078 | from __future__ import annotations
import os
from pathlib import Path
from typing import TYPE_CHECKING, Any, Mapping
from pdm.formats.base import array_of_inline_tables, make_array, make_inline_table
def export(project: Project, candidates: list, options: Any | None) -> str:
raise NotImplementedError() | null |
152,079 | from __future__ import annotations
import argparse
from typing import TYPE_CHECKING
from packaging.version import Version
from pdm.cli.commands.base import BaseCommand
from pdm.cli.options import venv_option
from pdm.exceptions import PdmUsageError
from pdm.models.candidates import Candidate
from pdm.models.project_inf... | null |
152,080 | from __future__ import annotations
import base64
import hashlib
import typing as t
from pathlib import Path
from findpython import BaseProvider, PythonVersion
from pdm.exceptions import PdmUsageError
from pdm.models.venv import VirtualEnv
from pdm.project import Project
The provided code snippet includes necessary dep... | Return an iterable of all managed venvs and their paths. |
152,081 | from __future__ import annotations
import argparse
import itertools
import os
import re
import shlex
import signal
import subprocess
import sys
from pathlib import Path
from types import FrameType
from typing import TYPE_CHECKING, Mapping, NamedTuple, Sequence, cast
from rich import print_json
from pdm import termui
fr... | null |
152,082 | from __future__ import annotations
import argparse
import itertools
import os
import re
import shlex
import signal
import subprocess
import sys
from pathlib import Path
from types import FrameType
from typing import TYPE_CHECKING, Mapping, NamedTuple, Sequence, cast
from rich import print_json
from pdm import termui
fr... | Interpolate the `{args:[defaults]} placeholder in a string |
152,083 | from __future__ import annotations
import argparse
import itertools
import os
import re
import shlex
import signal
import subprocess
import sys
from pathlib import Path
from types import FrameType
from typing import TYPE_CHECKING, Mapping, NamedTuple, Sequence, cast
from rich import print_json
from pdm import termui
fr... | null |
152,084 | from __future__ import annotations
import argparse
import itertools
import os
import re
import shlex
import signal
import subprocess
import sys
from pathlib import Path
from types import FrameType
from typing import TYPE_CHECKING, Mapping, NamedTuple, Sequence, cast
from rich import print_json
from pdm import termui
fr... | Helper to create a signal handler to run specific script |
152,085 | from __future__ import annotations
import email
import email.message
import email.policy
import hashlib
import io
import os
import re
import subprocess
from dataclasses import dataclass
from typing import IO, Any, cast
from pdm.exceptions import PdmUsageError, ProjectError
from pdm.termui import logger
The provided co... | Note that this function will close fp. See https://github.com/python/cpython/issues/65562. |
152,086 | from __future__ import annotations
import argparse
import shlex
import subprocess
import sys
from typing import Any
from packaging.version import parse
from pdm import termui
from pdm.cli.actions import get_latest_pdm_version_from_pypi
from pdm.cli.commands.base import BaseCommand
from pdm.cli.options import verbose_op... | null |
152,087 | from __future__ import annotations
import argparse
import shlex
import subprocess
import sys
from typing import Any
from packaging.version import parse
from pdm import termui
from pdm.cli.actions import get_latest_pdm_version_from_pypi
from pdm.cli.commands.base import BaseCommand
from pdm.cli.options import verbose_op... | null |
152,088 | import argparse
import os
from pathlib import Path
from typing import Iterable
from pdm import termui
from pdm.cli.commands.base import BaseCommand
from pdm.cli.options import verbose_option
from pdm.exceptions import PdmUsageError
from pdm.project import Project
def file_size(file: Path) -> int:
if file.is_symlink... | null |
152,089 | import argparse
import os
from pathlib import Path
from typing import Iterable
from pdm import termui
from pdm.cli.commands.base import BaseCommand
from pdm.cli.options import verbose_option
from pdm.exceptions import PdmUsageError
from pdm.project import Project
def format_size(size: float) -> str:
if size > 1000... | null |
152,090 | import argparse
import os
from pathlib import Path
from typing import Iterable
from pdm import termui
from pdm.cli.commands.base import BaseCommand
from pdm.cli.options import verbose_option
from pdm.exceptions import PdmUsageError
from pdm.project import Project
def find_files(parent: Path, pattern: str) -> Iterable[P... | null |
152,091 | from __future__ import annotations
import argparse
import sys
import textwrap
from shutil import get_terminal_size
from pdm import termui
from pdm._types import SearchResult
from pdm.cli.commands.base import BaseCommand
from pdm.cli.options import verbose_option
from pdm.environments import BareEnvironment
from pdm.mod... | null |
152,092 | from __future__ import annotations
import argparse
import csv
import io
import json
import re
from collections import defaultdict
from fnmatch import fnmatch
from typing import Iterable, Mapping, Sequence
from pdm.cli import actions
from pdm.cli.commands.base import BaseCommand
from pdm.cli.options import venv_option
f... | null |
152,093 | from __future__ import annotations
import argparse
import csv
import io
import json
import re
from collections import defaultdict
from fnmatch import fnmatch
from typing import Iterable, Mapping, Sequence
from pdm.cli import actions
from pdm.cli.commands.base import BaseCommand
from pdm.cli.options import venv_option
f... | Parse a CLI comma separated string. Apply optional lowercase transformation and if the value given is "*" then return a list of pre-defined values (`asterisk_values`). |
152,094 | from __future__ import annotations
import contextlib
import datetime
import hashlib
import json
import os
import sys
import textwrap
import warnings
from typing import Collection, Iterable, cast
from resolvelib.reporters import BaseReporter
from resolvelib.resolvers import ResolutionImpossible, ResolutionTooDeep, Resol... | Performs the locking process and update lockfile. |
152,095 | from __future__ import annotations
import contextlib
import datetime
import hashlib
import json
import os
import sys
import textwrap
import warnings
from typing import Collection, Iterable, cast
from resolvelib.reporters import BaseReporter
from resolvelib.resolvers import ResolutionImpossible, ResolutionTooDeep, Resol... | Check if the lock file exists and is up to date. Return the lock strategy. |
152,096 | from __future__ import annotations
import contextlib
import datetime
import hashlib
import json
import os
import sys
import textwrap
import warnings
from typing import Collection, Iterable, cast
from resolvelib.reporters import BaseReporter
from resolvelib.resolvers import ResolutionImpossible, ResolutionTooDeep, Resol... | Synchronize project |
152,097 | from __future__ import annotations
import contextlib
import datetime
import hashlib
import json
import os
import sys
import textwrap
import warnings
from typing import Collection, Iterable, cast
from resolvelib.reporters import BaseReporter
from resolvelib.resolvers import ResolutionImpossible, ResolutionTooDeep, Resol... | Show possible importable files and ask user to decide |
152,098 | from __future__ import annotations
import contextlib
import datetime
import hashlib
import json
import os
import sys
import textwrap
import warnings
from typing import Collection, Iterable, cast
from resolvelib.reporters import BaseReporter
from resolvelib.resolvers import ResolutionImpossible, ResolutionTooDeep, Resol... | Check if there is a new version of PDM available |
152,099 | from __future__ import annotations
import argparse
import dataclasses as dc
import json
import os
import re
import sys
from collections import ChainMap, OrderedDict
from concurrent.futures import ThreadPoolExecutor
from fnmatch import fnmatch
from gettext import gettext as _
from json import dumps
from pathlib import P... | Build a dependency graph from locked result. |
152,100 | from __future__ import annotations
import argparse
import dataclasses as dc
import json
import os
import re
import sys
from collections import ChainMap, OrderedDict
from concurrent.futures import ThreadPoolExecutor
from fnmatch import fnmatch
from gettext import gettext as _
from json import dumps
from pathlib import P... | null |
152,101 | from __future__ import annotations
import argparse
import dataclasses as dc
import json
import os
import re
import sys
from collections import ChainMap, OrderedDict
from concurrent.futures import ThreadPoolExecutor
from fnmatch import fnmatch
from gettext import gettext as _
from json import dumps
from pathlib import P... | Rewrite the version specifiers according to the resolved result and save strategy :param requirements: the requirements to be updated :param resolved: the resolved mapping :param save_strategy: compatible/wildcard/exact |
152,102 | from __future__ import annotations
import argparse
import dataclasses as dc
import json
import os
import re
import sys
from collections import ChainMap, OrderedDict
from concurrent.futures import ThreadPoolExecutor
from fnmatch import fnmatch
from gettext import gettext as _
from json import dumps
from pathlib import P... | Merge the input dict with the target while preserving the existing values properly. This will update the target dictionary in place. List values will be extended, but only if the value is not already in the list. |
152,103 | from __future__ import annotations
import argparse
import dataclasses as dc
import json
import os
import re
import sys
from collections import ChainMap, OrderedDict
from concurrent.futures import ThreadPoolExecutor
from fnmatch import fnmatch
from gettext import gettext as _
from json import dumps
from pathlib import P... | null |
152,104 | from __future__ import annotations
import argparse
import dataclasses as dc
import json
import os
import re
import sys
from collections import ChainMap, OrderedDict
from concurrent.futures import ThreadPoolExecutor
from fnmatch import fnmatch
from gettext import gettext as _
from json import dumps
from pathlib import P... | null |
152,105 | from __future__ import annotations
import argparse
import dataclasses as dc
import json
import os
import re
import sys
from collections import ChainMap, OrderedDict
from concurrent.futures import ThreadPoolExecutor
from fnmatch import fnmatch
from gettext import gettext as _
from json import dumps
from pathlib import P... | null |
152,106 | from __future__ import annotations
import argparse
import os
import sys
from functools import partial
from typing import TYPE_CHECKING, cast
dest="build_isolation",
The provided code snippet includes necessary dependencies for implementing the `split_lists` function. Write a Python function `def split_lists(separa... | Works the same as `append` except each argument is considered a `separator`-separated list. |
152,107 | from __future__ import annotations
import argparse
import os
import sys
from functools import partial
from typing import TYPE_CHECKING, cast
The provided code snippet includes necessary dependencies for implementing the `from_splitted_env` function. Write a Python function `def from_splitted_env(name: str, separator: ... | Parse a `separator`-separated list from a `name` environment variable if present. |
152,108 | from __future__ import annotations
import argparse
import os
import sys
from functools import partial
from typing import TYPE_CHECKING, cast
def frozen_lockfile_option(
project: Project,
namespace: argparse.Namespace,
values: str | Sequence[Any] | None,
option_string: str | None = None,
) -> None:
... | null |
152,109 | from __future__ import annotations
import argparse
import os
import sys
from functools import partial
from typing import TYPE_CHECKING, cast
def print_pep582_command(project: Project, shell: str = "AUTO") -> None:
"""Print the export PYTHONPATH line to be evaluated by the shell."""
import shellingham
pep5... | null |
152,110 | from __future__ import annotations
import argparse
import os
import sys
from functools import partial
from typing import TYPE_CHECKING, cast
def no_isolation_option(
project: Project,
namespace: argparse.Namespace,
values: str | Sequence[Any] | None,
option_string: str | None = None,
) -> None:
os.... | null |
152,111 | from __future__ import annotations
import argparse
import os
import sys
from functools import partial
from typing import TYPE_CHECKING, cast
def ignore_python_option(
project: Project,
namespace: argparse.Namespace,
values: str | Sequence[Any] | None,
option_string: str | None = None,
) -> None:
os... | null |
152,112 | import importlib.resources
import sys
from pathlib import Path
from typing import BinaryIO, ContextManager
def resources_read_text(package: str, resource: str, encoding: str = "utf-8", errors: str = "strict") -> str:
with (importlib.resources.files(package) / resource).open("r", encoding=encoding, errors=error... | null |
152,113 | import importlib.resources
import sys
from pathlib import Path
from typing import BinaryIO, ContextManager
def resources_path(package: str, resource: str) -> ContextManager[Path]:
return importlib.resources.as_file(importlib.resources.files(package) / resource) | null |
152,114 | from __future__ import annotations
import logging
import os
import shutil
import subprocess
import textwrap
import threading
from logging import Logger
from pathlib import Path
from typing import TYPE_CHECKING, Any, ClassVar, Iterable, cast
from pyproject_hooks import BuildBackendHookCaller
from pdm.compat import tomll... | null |
152,115 | from __future__ import annotations
import hashlib
import json
import warnings
from typing import Any, Mapping
from tomlkit import TOMLDocument, items
from pdm import termui
from pdm.project.toml_file import TOMLBase
def _remove_empty_tables(doc: dict) -> None:
for k, v in list(doc.items()):
if isinstance(v... | null |
152,116 | from __future__ import annotations
import collections
import dataclasses
import os
from functools import cached_property
from pathlib import Path
from typing import Any, Callable, ClassVar, Iterator, Mapping, MutableMapping, cast
import platformdirs
import rich.theme
import tomlkit
from pdm import termui
from pdm._type... | Load a nested TOML document into key-value pairs E.g. ["python"]["use_venv"] will be loaded as "python.use_venv" key. |
152,117 | from __future__ import annotations
import collections
import dataclasses
import os
from functools import cached_property
from pathlib import Path
from typing import Any, Callable, ClassVar, Iterator, Mapping, MutableMapping, cast
import platformdirs
import rich.theme
import tomlkit
from pdm import termui
from pdm._type... | Coerce a string value to a boolean value |
152,118 | from __future__ import annotations
import collections
import dataclasses
import os
from functools import cached_property
from pathlib import Path
from typing import Any, Callable, ClassVar, Iterator, Mapping, MutableMapping, cast
import platformdirs
import rich.theme
import tomlkit
from pdm import termui
from pdm._type... | Split a string value by comma |
152,119 | from __future__ import annotations
import contextlib
import enum
import logging
import os
import tempfile
import warnings
from typing import TYPE_CHECKING
import rich
from rich.box import ROUNDED
from rich.console import Console
from rich.progress import Progress, ProgressColumn
from rich.prompt import Confirm, IntProm... | Check if the terminal is run under interactive mode |
152,120 | from __future__ import annotations
import contextlib
import enum
import logging
import os
import tempfile
import warnings
from typing import TYPE_CHECKING
import rich
from rich.box import ROUNDED
from rich.console import Console
from rich.progress import Progress, ProgressColumn
from rich.prompt import Confirm, IntProm... | Legacy Windows renderer may have problem rendering emojis |
152,121 | from __future__ import annotations
import contextlib
import enum
import logging
import os
import tempfile
import warnings
from typing import TYPE_CHECKING
import rich
from rich.box import ROUNDED
from rich.console import Console
from rich.progress import Progress, ProgressColumn
from rich.prompt import Confirm, IntProm... | null |
152,122 | import os
import site
import sys
from pathlib import Path
def get_pypackages_path():
def find_pypackage(path, version):
if not path.exists():
return None
packages_name = f"__pypackages__/{version}/lib"
files = list(path.glob(packages_name))
if files:
return ... | null |
152,123 | import os
import site
import sys
from pathlib import Path
def load_next_sitecustomize_py2():
import imp
try:
f, pathname, desc = imp.find_module("sitecustomize", sys.path)
try:
imp.load_module("another_sitecustomize", f, pathname, desc)
finally:
f.close()
ex... | null |
152,124 | import os
import site
import sys
from pathlib import Path
def load_next_sitecustomize_py3():
import importlib.util
old_module = sys.modules.pop("sitecustomize", None)
spec = importlib.util.find_spec("sitecustomize")
if spec is not None:
module = importlib.util.module_from_spec(spec)
sp... | null |
152,125 | import os
import site
import sys
from pathlib import Path
The provided code snippet includes necessary dependencies for implementing the `patch_sysconfig` function. Write a Python function `def patch_sysconfig(libpath)` to solve the following problem:
This is a hack to make sure that the sysconfig.get_paths() returns ... | This is a hack to make sure that the sysconfig.get_paths() returns PEP 582 scheme. |
152,126 | from __future__ import annotations
import itertools
import sys
from collections import ChainMap
from pathlib import Path
from typing import Iterable, Iterator, Mapping
from pdm.compat import importlib_metadata as im
from pdm.utils import normalize_name
class EgglinkFinder(im.DistributionFinder):
def find_distributi... | Find distributions in the paths. Similar to `importlib.metadata`'s implementation but with the ability to discover egg-links. |
152,127 | from __future__ import annotations
import dataclasses
import fnmatch
import itertools
import posixpath
import re
import sys
import warnings
from functools import wraps
from typing import TYPE_CHECKING, Collection, Generator, TypeVar, cast
from pdm import termui
from pdm.exceptions import CandidateInfoNotFound, Candidat... | null |
152,128 | from __future__ import annotations
import functools
import sys
from pathlib import Path
from typing import IO, TYPE_CHECKING, Any, Mapping
from cachecontrol import CacheControlAdapter as BaseCCAdapter
from cachecontrol.serialize import Serializer
from requests import Request
from requests_toolbelt.utils import user_age... | null |
152,129 | from __future__ import annotations
import abc
import os
import urllib.parse
from pathlib import Path
from typing import TYPE_CHECKING
from pdm.utils import expand_env_vars, path_to_url
class BuildBackend(metaclass=abc.ABCMeta):
"""A build backend that does not support dynamic values in dependencies"""
def __ini... | Get the build backend class by name |
152,130 | from __future__ import annotations
import abc
import os
import urllib.parse
from pathlib import Path
from typing import TYPE_CHECKING
from pdm.utils import expand_env_vars, path_to_url
class BuildBackend(metaclass=abc.ABCMeta):
"""A build backend that does not support dynamic values in dependencies"""
def __ini... | Get the build backend class by specification. The parameter passed in is the 'build-system' section in pyproject.toml. |
152,131 | from __future__ import annotations
import operator
from dataclasses import dataclass
from functools import reduce
from typing import Any, overload
from dep_logic.markers import (
BaseMarker,
InvalidMarker,
MarkerExpression,
MarkerUnion,
MultiMarker,
from_pkg_marker,
parse_marker,
)
from pack... | null |
152,132 | from __future__ import annotations
import dataclasses as dc
import sys
from functools import cached_property
from pathlib import Path
from pdm.models.in_process import get_sys_config_paths
from pdm.utils import find_python_in_path, get_venv_like_prefix
IS_WIN = sys.platform == "win32"
BIN_DIR = "Scripts" if IS_WIN else... | Get the interpreter path inside the given venv. |
152,133 | from __future__ import annotations
import dataclasses as dc
import sys
from functools import cached_property
from pathlib import Path
from pdm.models.in_process import get_sys_config_paths
from pdm.utils import find_python_in_path, get_venv_like_prefix
def is_conda_venv(root: Path) -> bool:
return (root / "conda-m... | null |
152,134 | from __future__ import annotations
import contextlib
import dataclasses
import hashlib
import json
import os
import stat
from functools import lru_cache
from pathlib import Path
from typing import TYPE_CHECKING, BinaryIO, Generic, Iterable, TypeVar, cast
from cachecontrol.cache import SeparateBodyBaseCache
from cacheco... | null |
152,135 | from __future__ import annotations
import dataclasses
import functools
import inspect
import json
import os
import posixpath
import re
import secrets
import urllib.parse as urlparse
from pathlib import Path
from typing import TYPE_CHECKING, Any, Sequence, TypeVar, cast
from packaging.requirements import InvalidRequirem... | null |
152,136 | from __future__ import annotations
import dataclasses
import itertools
import json
import re
import warnings
from functools import lru_cache
from operator import attrgetter
from typing import Any, Iterable, Match, cast
from dep_logic.specifiers import (
BaseSpecifier,
EmptySpecifier,
RangeSpecifier,
Uni... | null |
152,137 | from __future__ import annotations
import dataclasses
import itertools
import json
import re
import warnings
from functools import lru_cache
from operator import attrgetter
from typing import Any, Iterable, Match, cast
from dep_logic.specifiers import (
BaseSpecifier,
EmptySpecifier,
RangeSpecifier,
Uni... | null |
152,138 | from __future__ import annotations
import dataclasses
import itertools
import json
import re
import warnings
from functools import lru_cache
from operator import attrgetter
from typing import Any, Iterable, Match, cast
from dep_logic.specifiers import (
BaseSpecifier,
EmptySpecifier,
RangeSpecifier,
Uni... | If the upper bound is 4.0, replace it with unlimited. |
152,139 | from __future__ import annotations
import dataclasses
import hashlib
import os
import re
import warnings
from functools import cached_property
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import TYPE_CHECKING, Any, cast, no_type_check
from zipfile import ZipFile
from packaging.utils impo... | Extract the metadata from a wheel. Fallback for when the build backend does not define the 'get_wheel_metadata' hook. |
152,140 | from __future__ import annotations
import dataclasses
import hashlib
import os
import re
import warnings
from functools import cached_property
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import TYPE_CHECKING, Any, cast, no_type_check
from zipfile import ZipFile
from packaging.utils impo... | Return a new dict without None values |
152,141 | from __future__ import annotations
import dataclasses
import hashlib
import os
import re
import warnings
from functools import cached_property
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import TYPE_CHECKING, Any, cast, no_type_check
from zipfile import ZipFile
from packaging.utils impo... | Get the best matching link for a requirement |
152,142 | import json
import os
import sys
import sysconfig
def running_under_virtualenv():
"""Return True if we're running inside a virtualenv, False otherwise."""
return _running_under_venv() or _running_under_regular_virtualenv()
def _get_user_scheme():
if os.name == "nt":
return "nt_user"
if sys.platf... | null |
152,143 | import json
import sys
import sysconfig
import _imp
def _normalize_string(string):
return string.replace(".", "_").replace("-", "_").replace(" ", "_")
def _cpython_abis(py_version):
py_version = tuple(py_version) # To allow for version comparison.
abis = []
version = _version_nodot(py_version[:2])
... | Return the ABI tag based on EXT_SUFFIX. |
152,144 | import json
import sys
import sysconfig
import _imp
INTERPRETER_SHORT_NAMES = {
"python": "py", # Generic.
"cpython": "cp",
"pypy": "pp",
"ironpython": "ip",
"jython": "jy",
}
The provided code snippet includes necessary dependencies for implementing the `interpreter_name` function. Write a Python... | Returns the name of the running interpreter. Some implementations have a reserved, two-letter abbreviation which will be returned when appropriate. |
152,145 | import os
import sys
from typing import Any, Dict
def _parse_setup_cfg(path: str) -> Dict[str, Any]:
import configparser
setup_cfg = configparser.ConfigParser()
setup_cfg.read(path, encoding="utf-8")
result: Dict[str, Any] = {}
if not setup_cfg.has_section("metadata"):
return result
meta... | null |
152,146 | import os
import sys
from typing import Any, Dict
def json_default(o):
return "<unserializable object>" | null |
152,147 | import json
import os
import platform
import sys
def format_full_version(info):
version = "{0.major}.{0.minor}.{0.micro}".format(info)
kind = info.releaselevel
if kind != "final":
version += kind[0] + str(info.serial)
return version
def default_environment():
if hasattr(sys, "implementation... | null |
152,148 | from __future__ import annotations
import dataclasses as dc
import re
from typing import TYPE_CHECKING, Any, Dict, List, NamedTuple, Tuple, TypeVar, Union
def _normalize_pattern(pattern: str) -> str:
return re.sub(r"[^A-Za-z0-9?*\[\]-]+", "-", pattern).lower() | null |
152,149 | import os
import streamlit as st
from llama_index.core import Settings, SimpleDirectoryReader, VectorStoreIndex
from llama_index.embeddings.openai import OpenAIEmbedding
from llama_index.llms.openai import OpenAI
st.set_page_config(
page_title="Chat with the PDM docs, powered by LlamaIndex",
page_icon="📝",
... | null |
152,150 | import argparse
import subprocess
import sys
from pathlib import Path
from typing import Any
import parver
from rich.console import Console
def echo(*args: str, err: bool = False, **kwargs: Any):
if err:
_err_console.print(*args, **kwargs)
else:
_console.print(*args, **kwargs)
def bump_version(p... | null |
152,151 | import argparse
import subprocess
import sys
from pathlib import Path
from typing import Any
import parver
from rich.console import Console
def parse_args(argv=None):
parser = argparse.ArgumentParser("release.py")
parser.add_argument("--dry-run", action="store_true", help="Dry run mode")
parser.add_argume... | null |
152,152 | from __future__ import annotations
import json
from html.parser import HTMLParser
from pathlib import Path
import requests
class PythonVersionParser(HTMLParser):
def __init__(self, *, convert_charrefs: bool = True) -> None:
super().__init__(convert_charrefs=convert_charrefs)
self._parsing_release_nu... | null |
152,154 | import random
import json
def random_sport():
def get_other_sport(sport):
def random_player(sport):
def random_action(sport):
def game(sport):
def construct_example():
positive = random.choice([True, False])
sport = random_sport()
player = random_player(sport)
score = None
if not positive:
... | null |
152,155 | import random
from automatic_prompt_engineer import generate, evaluate, config, template, data, llm
def get_simple_prompt_gen_template(prompt_gen_template, prompt_gen_mode):
if prompt_gen_template is None:
if prompt_gen_mode == 'forward':
prompt_gen_template = "I gave a friend an instruction. Ba... | Function that wraps the find_prompts function to make it easier to use. Design goals: include default values for most parameters, and automatically fill out the config dict for the user in a way that fits almost all use cases. The main shortcuts this function takes are: - Uses the same dataset for prompt generation, ev... |
152,156 | import random
from automatic_prompt_engineer import generate, evaluate, config, template, data, llm
The provided code snippet includes necessary dependencies for implementing the `simple_eval` function. Write a Python function `def simple_eval(dataset, prompts, eval_template='Instructio... | Function that wraps the evaluate_prompts function to make it easier to use. Parameters: dataset: The dataset to use for evaluation. prompts: The list of prompts to evaluate. eval_template: The template for the evaluation queries. demos_template: The template for the demos. eval_model: The model to use for evaluation. R... |
152,157 | import random
from automatic_prompt_engineer import generate, evaluate, config, template, data, llm
def get_simple_prompt_gen_template(prompt_gen_template, prompt_gen_mode):
def estimate_cost(eval_template,
demos_template,
prompt_gen_data,
eval_data,
... | null |
152,158 | import random
import fire
from automatic_prompt_engineer import ape, data
from experiments.data.instruction_induction.load_data import load_data, tasks
from experiments.evaluation.instruction_induction.exec_accuracy import exec_accuracy_evaluator
tasks = [f.split('.')[0] for f in os.listdir(induce_data_path)]
def lo... | null |
152,159 | from automatic_prompt_engineer import ape, data
from experiments.data.TruthfulQA.load_data import load_data
from experiments.evaluation.TruthfulQA.fine_tuned_gpt_eval import fine_tuned_gpt_evaluator
def indented_print(s, indent=2):
s = s.replace('\n', '\n' + ' ' * indent)
print(' ' * indent + s)
def utility_com... | null |
152,160 | import openai
import numpy as np
import pandas as pd
import gradio as gr
from experiments.data.instruction_induction.load_data import load_data
from automatic_prompt_engineer.ape import get_simple_prompt_gen_template
from automatic_prompt_engineer import ape, evaluate, config, template, llm
def prompt_overview():
... | null |
152,161 | import openai
import numpy as np
import pandas as pd
import gradio as gr
from experiments.data.instruction_induction.load_data import load_data
from automatic_prompt_engineer.ape import get_simple_prompt_gen_template
from automatic_prompt_engineer import ape, evaluate, config, template, llm
model_types = ['text-ada-001... | null |
152,162 | import functools
import inspect
import logging
import os
import threading
import time
from optscale_client.config_client.client import Client as ConfigClient
from etcd import EtcdEventIndexCleared
from influxdb import InfluxDBClient
optscale_meter = Meter()
def get_class_that_defined_method(meth):
if isinstance(met... | null |
152,163 | from datetime import datetime
from functools import wraps
from googleapiclient import discovery
from googleapiclient.errors import HttpError
from google.oauth2.service_account import Credentials
class CalendarException(Exception):
def wrap_http_error(func):
@wraps(func)
def func_wrapper(*args, **kwargs):
... | null |
152,164 | import json
import requests
import yaml
import sys
import inspect
from requests.packages.urllib3.exceptions import InsecureRequestWarning
from optscale_client.rest_api_client.client_v2 import Client as RestClient
from optscale_client.auth_client.client_v2 import Client as AuthClient
from optscale_client.report_client.c... | null |
152,165 | import json
from rest_api.rest_api_server.exceptions import Err
from rest_api.rest_api_server.handlers.v1.base import BaseAuthHandler
from rest_api.rest_api_server.handlers.v1.base_async import (
BaseAsyncCollectionHandler, BaseAsyncItemHandler)
from rest_api.rest_api_server.controllers.profiling.dataset import (
... | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.