id int64 0 190k | prompt stringlengths 21 13.4M | docstring stringlengths 1 12k ⌀ |
|---|---|---|
151,965 | import os
from transformers import CLIPTokenizer
import comfy.ops
import torch
import traceback
import zipfile
from . import model_management
import comfy.clip_model
import json
import logging
def unescape_important(text):
text = text.replace("\0\1", ")")
text = text.replace("\0\2", "(")
return text | null |
151,966 | import os
from transformers import CLIPTokenizer
import comfy.ops
import torch
import traceback
import zipfile
from . import model_management
import comfy.clip_model
import json
import logging
def safe_load_embed_zip(embed_path):
with zipfile.ZipFile(embed_path) as myzip:
names = list(filter(lambda a: "data... | null |
151,967 | import json
from urllib import request, parse
import random
def queue_prompt(prompt):
p = {"prompt": prompt}
data = json.dumps(p).encode('utf-8')
req = request.Request("http://127.0.0.1:8188/prompt", data=data)
request.urlopen(req) | null |
151,968 | import websocket
import uuid
import json
import urllib.request
import urllib.parse
def queue_prompt(prompt):
p = {"prompt": prompt, "client_id": client_id}
data = json.dumps(p).encode('utf-8')
req = urllib.request.Request("http://{}/prompt".format(server_address), data=data)
return json.loads(urllib.re... | null |
151,969 | import torch
import os
import sys
import json
import hashlib
import traceback
import math
import time
import random
import logging
from PIL import Image, ImageOps, ImageSequence
from PIL.PngImagePlugin import PngInfo
import numpy as np
import safetensors.torch
import comfy.diffusers_load
import comfy.samplers
import co... | null |
151,970 | import torch
import os
import sys
import json
import hashlib
import traceback
import math
import time
import random
import logging
from PIL import Image, ImageOps, ImageSequence
from PIL.PngImagePlugin import PngInfo
import numpy as np
import safetensors.torch
import comfy.diffusers_load
import comfy.samplers
import co... | null |
151,971 | import torch
import os
import sys
import json
import hashlib
import traceback
import math
import time
import random
import logging
from PIL import Image, ImageOps, ImageSequence
from PIL.PngImagePlugin import PngInfo
import numpy as np
import safetensors.torch
import comfy.diffusers_load
import comfy.samplers
import co... | null |
151,972 | import torch
import os
import sys
import json
import hashlib
import traceback
import math
import time
import random
import logging
from PIL import Image, ImageOps, ImageSequence
from PIL.PngImagePlugin import PngInfo
import numpy as np
import safetensors.torch
import comfy.diffusers_load
import comfy.samplers
import co... | null |
151,973 | import logging
import time
import cachetools
import openai
from openai.openai_object import OpenAIObject
from robusta.api import *
class ChatGPTTokenParams(ActionParams):
"""
:var chat_gpt_token: ChatGPT auth token
"""
chat_gpt_token: str
class ChatGPTParams(ChatGPTTokenParams):
"""
:var search_... | Add a button to the alert - clicking it will ask chat gpt to help find a solution. |
151,974 | from pathlib import Path
import sys
import os
import time
from functools import partial
from typing import Tuple
import lightning as L
from lightning.fabric.strategies import FSDPStrategy
import torch
from torch.distributed.fsdp.wrap import transformer_auto_wrap_policy
import numpy as np
from lit_llama.model import Blo... | null |
151,975 | import os
import sys
import math
import glob
import time
from functools import partial
from pathlib import Path
from typing import Tuple, Optional
import lightning as L
from lightning.fabric.strategies import FSDPStrategy
import torch
from torch.utils.data import DataLoader
from torch.distributed.fsdp.wrap import trans... | null |
151,976 | import math
import sys
import time
from pathlib import Path
from typing import Optional
import lightning as L
import torch
import tqdm
from lit_llama import LLaMA, Tokenizer
from lit_llama.utils import EmptyInitOnDevice
from datasets import load_dataset
def load_eval_data(dataset_name: str) -> str:
# this mimics g... | null |
151,977 | import math
import sys
import time
from pathlib import Path
from typing import Optional
import lightning as L
import torch
import tqdm
from lit_llama import LLaMA, Tokenizer
from lit_llama.utils import EmptyInitOnDevice, lazy_load, llama_model_lookup
from lit_llama.lora import lora
from scripts.prepare_alpaca import ge... | null |
151,978 | import math
import sys
import time
from pathlib import Path
from typing import Optional
import lightning as L
import torch
import tqdm
from lit_llama import Tokenizer
from lit_llama.adapter import LLaMA
from lit_llama.utils import EmptyInitOnDevice, lazy_load, llama_model_lookup
from lit_llama.adapter_v2 import add_ada... | null |
151,979 | import math
import sys
import time
from pathlib import Path
from typing import Optional
import lightning as L
import torch
import tqdm
from lit_llama import Tokenizer
from lit_llama.adapter import LLaMA
from lit_llama.utils import EmptyInitOnDevice, lazy_load, llama_model_lookup
from scripts.prepare_alpaca import gener... | null |
151,980 | import sys
from pathlib import Path
import os
import time
from functools import partial
import lightning as L
from lightning.fabric.strategies import FSDPStrategy
import numpy as np
import torch
from torch.distributed.fsdp.wrap import transformer_auto_wrap_policy
from generate import generate
from lit_llama.model impor... | null |
151,981 | import sys
from pathlib import Path
import os
import time
import lightning as L
import numpy as np
import torch
from generate import generate
from lit_llama.lora import mark_only_lora_as_trainable, lora, lora_state_dict
from lit_llama.model import LLaMA, LLaMAConfig
from lit_llama.tokenizer import Tokenizer
from script... | null |
151,982 | import os
import sys
import time
from pathlib import Path
import shutil
import lightning as L
import numpy as np
import torch
import torch.nn as nn
from generate import generate
from lit_llama.adapter import LLaMA, LLaMAConfig
from lit_llama.adapter_v2 import (
mark_only_adapter_v2_as_trainable,
add_adapter_v2_... | null |
151,983 | import os
import sys
import time
from pathlib import Path
import shutil
import lightning as L
import numpy as np
import torch
from generate import generate
from lit_llama.adapter import LLaMA, LLaMAConfig, mark_only_adapter_as_trainable, adapter_state_from_state_dict
from lit_llama.tokenizer import Tokenizer
from scrip... | null |
151,984 | import functools
import pickle
import warnings
from io import BytesIO
from pathlib import Path
from contextlib import contextmanager
import torch
import torch.utils._device
from lightning.fabric.strategies import DeepSpeedStrategy, FSDPStrategy
from torch.distributed.fsdp import FullStateDictConfig
from torch.distribut... | Returns the LLaMA model name from the checkpoint. Checks the width of the lm_head.weight matrix, as these uniquely identify the model. |
151,985 | import functools
import pickle
import warnings
from io import BytesIO
from pathlib import Path
from contextlib import contextmanager
import torch
import torch.utils._device
from lightning.fabric.strategies import DeepSpeedStrategy, FSDPStrategy
from torch.distributed.fsdp import FullStateDictConfig
from torch.distribut... | null |
151,986 | import functools
import pickle
import warnings
from io import BytesIO
from pathlib import Path
from contextlib import contextmanager
import torch
import torch.utils._device
from lightning.fabric.strategies import DeepSpeedStrategy, FSDPStrategy
from torch.distributed.fsdp import FullStateDictConfig
from torch.distribut... | null |
151,987 | import os
from contextlib import contextmanager
import warnings
import math
import torch
try:
import triton # noqa: E402
import triton.language as tl # noqa: E402
except:
triton = None
if triton is not None:
# This is adapted from the OpenAI Triton matmul example.
configs=[
triton.... | null |
151,988 | import math
from dataclasses import dataclass
from typing import List, Optional, Tuple, Union
import torch
import torch.nn as nn
from torch.nn import functional as F
from typing_extensions import Self
from lit_llama.utils import find_multiple
RoPECache = torch.Tensor
The provided code snippet includes necessary depend... | Enhanced Transformer with Rotary Position Embedding. Derived from: https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/master/labml_nn/ transformers/rope/__init__.py. MIT License: https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/master/license. |
151,989 | import math
from dataclasses import dataclass
from typing import List, Optional, Tuple, Union
import torch
import torch.nn as nn
from torch.nn import functional as F
from typing_extensions import Self
from lit_llama.utils import find_multiple
RoPECache = torch.Tensor
def apply_rope(x: torch.Tensor, rope_cache: RoPECac... | null |
151,990 | import torch
import torch.nn as nn
import torch.nn.functional as F
import math
from typing import Dict, List
import lit_llama.model as llama
from contextlib import contextmanager
from dataclasses import dataclass
class LoRALayer():
def __init__(
self,
r: int,
lora_alpha: int,
lora... | Freeze all modules except LoRA's and depending on 'bias' value unfreezes bias weights. Args: model: model with LoRA layers bias: ``"none"``: all bias weights will be frozen, ``"lora_only"``: only bias weight for LoRA layers will be unfrozen, ``"all"``: all bias weights will be unfrozen. Raises: NotImplementedError: if ... |
151,991 | import torch
import torch.nn as nn
import torch.nn.functional as F
import math
from typing import Dict, List
import lit_llama.model as llama
from contextlib import contextmanager
from dataclasses import dataclass
class LoRAConfig:
r: float = 0.0
alpha: float = 1.0
dropout: float = 0.0
class CausalSelfAttent... | Apply context manager under which you can instantiate the model with LoRA. In a nutshell the code inside this function forces to use LoRA variant of causal self-attention instead of the original one (without LoRA). Args: r: rank of the weight update matrices. To make sense of using LoRA the rank should be smaller than ... |
151,992 | import os
import struct
import random
import numpy as np
import torch
from torch.utils.data import IterableDataset, get_worker_info
dtypes = {
1: np.uint8,
2: np.int8,
3: np.int16,
4: np.int32,
5: np.int64,
6: np.float32,
7: np.float64,
8: np.uint16,
}
def code(dtype):
for k in dtyp... | null |
151,993 | import torch
from torch import Tensor
import torch.nn as nn
from torch.nn import functional as F
from lit_llama.adapter import LLaMA
def get_adapter_substrings():
substrings = ["adapter_wte", "gating_factor"] # regular adapter v1 parameters
substrings.extend(["adapter_scale", "adapter_bias"]) # adapter v2: ne... | Sets `requires_grad=False` for all non-adapter weights. |
151,994 | import torch
from torch import Tensor
import torch.nn as nn
from torch.nn import functional as F
from lit_llama.adapter import LLaMA
def adapter_v2_linear_with_bias_and_scale(layer):
layer.adapter_bias = torch.nn.Parameter(torch.zeros(layer.weight.shape[0]), requires_grad=True)
layer.adapter_scale = torch.nn.Pa... | null |
151,995 | from dataclasses import dataclass
from typing import Optional, Tuple, List, Union
import torch
import torch.nn as nn
from torch.nn import functional as F
import lit_llama.model as llama
from lit_llama.model import build_rope_cache, apply_rope, RMSNorm, MLP, KVCache, RoPECache
class LLaMA(llama.LLaMA):
"""The implem... | Sets `requires_grad=False` for all non-adapter weights. |
151,996 | import collections
import contextlib
import gc
import json
import shutil
import sys
from pathlib import Path
import torch
from lit_llama.model import LLaMA, LLaMAConfig
from lit_llama.utils import EmptyInitOnDevice, lazy_load, incremental_save
class LLaMAConfig:
block_size: int = 2048
vocab_size: int = 32000
... | Perform the reverse operation of: https://github.com/huggingface/transformers/blob/main/src/transformers/models/llama/convert_llama_weights_to_hf.py |
151,997 | import gc
import shutil
from pathlib import Path
from typing import Dict
import torch
from tqdm import tqdm
def convert_state_dict(state_dict: Dict[str, torch.Tensor], dtype: torch.dtype = torch.float32) -> Dict[str, torch.Tensor]:
converted = {}
converted["transformer.wte.weight"] = state_dict["tok_embeddings.... | null |
151,998 | import sys
from pathlib import Path
import torch
import requests
import json
from torch.utils.data import random_split
from lit_llama.tokenizer import Tokenizer
from tqdm import tqdm
DATA_FILE_NAME = "alpaca_data_cleaned_archive.json"
def download(file_path: Path):
"""Downloads the raw json data file and saves it i... | Prepare the Alpaca dataset for instruction tuning. The output is a training and validation dataset saved as `train.pt` and `val.pt`, which stores the preprocessed and tokenized prompts and labels. |
151,999 | import sys
from pathlib import Path
import torch
import requests
import json
from torch.utils.data import random_split
from lit_llama.tokenizer import Tokenizer
from tqdm import tqdm
DATA_FILE_NAME = "dolly_data_cleaned.json"
def download(file_path: Path):
"""Downloads the raw json data file and saves it in the giv... | Prepare the Dolly dataset for instruction tuning. The output is a training and validation dataset saved as `train.pt` and `val.pt`, which stores the preprocessed and tokenized prompts and labels. |
152,000 | import json
import glob
import os
from pathlib import Path
import sys
import numpy as np
from tqdm import tqdm
from lit_llama import Tokenizer
import lit_llama.packed_dataset as packed_dataset
def prepare_sample(
source_path: Path,
tokenizer_path: Path,
destination_path: Path,
chunk_size: int,
match... | Prepare the "Red Pajama" dataset. We assume tokenizer has been trained (i.e. we reuse LLaMA's tokenizer model). |
152,001 | import os
from typing import Optional
from urllib.request import urlretrieve
files = {
"original_model.py": "https://gist.githubusercontent.com/lantiga/fd36849fb1c498da949a0af635318a7b/raw/7dd20f51c2a1ff2886387f0e25c1750a485a08e1/llama_model.py",
"original_adapter.py": "https://gist.githubusercontent.com/awaelc... | null |
152,002 | import os
from typing import Optional
from urllib.request import urlretrieve
def download_from_hub(repo_id: Optional[str] = None, local_dir: str = "checkpoints/hf-llama/7B") -> None:
if repo_id is None:
raise ValueError("Please pass `--repo_id=...`. You can try googling 'huggingface hub llama' for options.... | null |
152,003 | import sys
import time
from pathlib import Path
from typing import Optional
import lightning as L
import torch
import torch.nn as nn
from lit_llama import LLaMA
from lit_llama.utils import EmptyInitOnDevice, lazy_load, llama_model_lookup
from lit_llama.lora import lora
def del_lora_state_dict(model: nn.Module):
ba... | null |
152,004 | import sys
import time
from pathlib import Path
from typing import Optional
import lightning as L
import torch
import torch.nn as nn
from lit_llama import LLaMA
from lit_llama.utils import EmptyInitOnDevice, lazy_load, llama_model_lookup
from lit_llama.lora import lora
The provided code snippet includes necessary depe... | Returns the LoRA rank from the adapter checkpoint. |
152,005 | import sys
from pathlib import Path
import numpy as np
import requests
The provided code snippet includes necessary dependencies for implementing the `prepare` function. Write a Python function `def prepare(destination_path: Path = Path("data/shakespeare")) -> None` to solve the following problem:
Prepare the "Tiny Sh... | Prepare the "Tiny Shakespeare" dataset. |
152,006 | import sys
from pathlib import Path
import torch
import requests
import json
from torch.utils.data import random_split
from lit_llama.tokenizer import Tokenizer
from tqdm import tqdm
DATA_FILE_NAME = "input.txt"
def prepare_line(line: str, tokenizer: Tokenizer, max_length: int):
"""Processes a single sample.
Th... | Prepare any dataset for finetuning (akin to Shakespheare full tuning). The output is a training and validation dataset saved as `train.pt` and `val.pt`, which stores the preprocessed and tokenized prompts and labels. |
152,007 | import gc
import sys
import time
from pathlib import Path
from typing import Optional
import torch
from datasets import load_dataset
from lit_llama import LLaMA, Tokenizer
from lit_llama.quantization import GPTQQuantizer
from lit_llama.utils import EmptyInitOnDevice, llama_model_lookup
def get_sample_data():
train... | null |
152,008 | import gc
import sys
import time
from pathlib import Path
from typing import Optional
import torch
from datasets import load_dataset
sys.path.append(str(wd))
from lit_llama import LLaMA, Tokenizer
from lit_llama.quantization import GPTQQuantizer
from lit_llama.utils import EmptyInitOnDevice, llama_model_lookup
class G... | This is the classic post-training quantization of all linear layers. We quantize in order, i.e. when observing the inputs, we use the outputs of the previously quantized layers rather than doing them all at once. |
152,009 | from __future__ import annotations
import argparse
import dataclasses
import io
import json
import os
import platform
import re
import shutil
import site
import subprocess
import sys
import urllib.request
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Sequence
if sys.version_info < ... | null |
152,010 | from __future__ import annotations
import argparse
import dataclasses
import io
import json
import os
import platform
import re
import shutil
import site
import subprocess
import sys
import urllib.request
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Sequence
def _get_win_folder_w... | null |
152,011 | from __future__ import annotations
import argparse
import dataclasses
import io
import json
import os
import platform
import re
import shutil
import site
import subprocess
import sys
import urllib.request
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Sequence
The provided code sni... | This is a fallback technique at best. I'm not sure if using the registry for this guarantees us the correct answer for all CSIDL_* names. |
152,012 | from __future__ import annotations
import argparse
import dataclasses
import io
import json
import os
import platform
import re
import shutil
import site
import subprocess
import sys
import urllib.request
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Sequence
def _remove_path_wind... | null |
152,013 | from __future__ import annotations
import argparse
import dataclasses
import io
import json
import os
import platform
import re
import shutil
import site
import subprocess
import sys
import urllib.request
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Sequence
WINDOWS = _plat == "Wi... | null |
152,014 | from __future__ import annotations
import os
import re
import shlex
from functools import cached_property
from pathlib import Path
from pdm.environments.base import BaseEnvironment
from pdm.utils import pdm_scheme
The provided code snippet includes necessary dependencies for implementing the `_get_shebang_path` functi... | Get the interpreter path in the shebang line The launcher can just use the command as-is. Otherwise if the path contains whitespace or is too long, both distlib and installer use a clever hack to make the shebang after ``/bin/sh``, where the interpreter path is quoted. |
152,015 | from __future__ import annotations
import os
import re
import shlex
from functools import cached_property
from pathlib import Path
from pdm.environments.base import BaseEnvironment
from pdm.utils import pdm_scheme
def _is_console_script(content: bytes) -> bool:
import io
import zipfile
if os.name == "nt": ... | Replace the python executable from the shebeng line, which can be in two forms: 1. #!python_executable 2. #!/bin/sh '''exec' '/path to/python' "$0" "$@" ' ''' |
152,016 | from __future__ import annotations
import abc
import functools
import os
import re
import shutil
import subprocess
import sys
import tempfile
import weakref
from contextlib import contextmanager
from functools import cached_property, partial
from pathlib import Path
from threading import local
from typing import TYPE_C... | null |
152,017 | from __future__ import annotations
from pdm.environments import BaseEnvironment
from pdm.installers.synchronizers import BaseSynchronizer
from pdm.models.requirements import Requirement
from pdm.models.specifiers import PySpecSet
from pdm.resolver.core import resolve
class BaseSynchronizer:
"""Synchronize the work... | Resolve and install the given requirements into the environment. |
152,018 | from __future__ import annotations
import json
import os
import stat
from functools import cached_property
from pathlib import Path
from typing import TYPE_CHECKING, Iterator
from installer import install as _install
from installer._core import _process_WHEEL_file
from installer.destinations import SchemeDictionaryDest... | Only create .pth files referring to the cached package. If the cache doesn't exist, create one. |
152,019 | from __future__ import annotations
import json
import os
import stat
from functools import cached_property
from pathlib import Path
from typing import TYPE_CHECKING, Iterator
from installer import install as _install
from installer._core import _process_WHEEL_file
from installer.destinations import SchemeDictionaryDest... | Install a wheel into the environment, return the .dist-info path |
152,020 | from __future__ import annotations
import abc
import glob
import os
import shutil
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import TYPE_CHECKING, Iterable, NewType, TypeVar, cast
from pdm import termui
from pdm.exceptions import UninstallError
from pdm.models.cached_package import Cac... | Like os.renames(), but handles renaming across devices. |
152,021 | from __future__ import annotations
import abc
import glob
import os
import shutil
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import TYPE_CHECKING, Iterable, NewType, TypeVar, cast
from pdm import termui
from pdm.exceptions import UninstallError
from pdm.models.cached_package import Cac... | Returns a set containing the paths that need to be renamed. This set may include directories when the original sequence of paths included every file on disk. |
152,022 | from __future__ import annotations
import abc
import glob
import os
import shutil
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import TYPE_CHECKING, Iterable, NewType, TypeVar, cast
from pdm import termui
from pdm.exceptions import UninstallError
from pdm.models.cached_package import Cac... | null |
152,023 | from __future__ import annotations
import abc
import glob
import os
import shutil
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import TYPE_CHECKING, Iterable, NewType, TypeVar, cast
from pdm import termui
from pdm.exceptions import UninstallError
from pdm.models.cached_package import Cac... | null |
152,024 | from __future__ import annotations
import abc
import glob
import os
import shutil
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import TYPE_CHECKING, Iterable, NewType, TypeVar, cast
from pdm import termui
from pdm.exceptions import UninstallError
from pdm.models.cached_package import Cac... | null |
152,025 | from __future__ import annotations
import abc
import glob
import os
import shutil
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import TYPE_CHECKING, Iterable, NewType, TypeVar, cast
from pdm import termui
from pdm.exceptions import UninstallError
from pdm.models.cached_package import Cac... | null |
152,026 | from __future__ import annotations
import dataclasses
import functools
import multiprocessing
import traceback
from concurrent.futures import Future, ThreadPoolExecutor
from functools import cached_property
from types import SimpleNamespace
from typing import TYPE_CHECKING, Any, Callable, Collection, TypeVar
from rich.... | Return a candidate for `editables` package |
152,027 | from __future__ import annotations
import atexit
import contextlib
import functools
import json
import os
import re
import shutil
import subprocess
import sys
import sysconfig
import tempfile
import urllib.parse as parse
import warnings
from os import name as os_name
from pathlib import Path
from typing import TYPE_CHE... | null |
152,028 | from __future__ import annotations
import atexit
import contextlib
import functools
import json
import os
import re
import shutil
import subprocess
import sys
import sysconfig
import tempfile
import urllib.parse as parse
import warnings
from os import name as os_name
from pathlib import Path
from typing import TYPE_CHE... | Parse the project sources and return the trusted hosts |
152,029 | from __future__ import annotations
import atexit
import contextlib
import functools
import json
import os
import re
import shutil
import subprocess
import sys
import sysconfig
import tempfile
import urllib.parse as parse
import warnings
from os import name as os_name
from pathlib import Path
from typing import TYPE_CHE... | null |
152,030 | from __future__ import annotations
import atexit
import contextlib
import functools
import json
import os
import re
import shutil
import subprocess
import sys
import sysconfig
import tempfile
import urllib.parse as parse
import warnings
from os import name as os_name
from pathlib import Path
from typing import TYPE_CHE... | null |
152,031 | from __future__ import annotations
import atexit
import contextlib
import functools
import json
import os
import re
import shutil
import subprocess
import sys
import sysconfig
import tempfile
import urllib.parse as parse
import warnings
from os import name as os_name
from pathlib import Path
from typing import TYPE_CHE... | Recursively find a `pyproject.toml` at given path or current working directory. |
152,032 | from __future__ import annotations
import atexit
import contextlib
import functools
import json
import os
import re
import shutil
import subprocess
import sys
import sysconfig
import tempfile
import urllib.parse as parse
import warnings
from os import name as os_name
from pathlib import Path
from typing import TYPE_CHE... | Get username and email from git config. Return empty if not configured or git is not found. |
152,033 | from __future__ import annotations
import atexit
import contextlib
import functools
import json
import os
import re
import shutil
import subprocess
import sys
import sysconfig
import tempfile
import urllib.parse as parse
import warnings
from os import name as os_name
from pathlib import Path
from typing import TYPE_CHE... | Cleans VCS uris from pip format |
152,034 | from __future__ import annotations
import atexit
import contextlib
import functools
import json
import os
import re
import shutil
import subprocess
import sys
import sysconfig
import tempfile
import urllib.parse as parse
import warnings
from os import name as os_name
from pathlib import Path
from typing import TYPE_CHE... | null |
152,035 | from __future__ import annotations
import atexit
import contextlib
import functools
import json
import os
import re
import shutil
import subprocess
import sys
import sysconfig
import tempfile
import urllib.parse as parse
import warnings
from os import name as os_name
from pathlib import Path
from typing import TYPE_CHE... | Safely replace the pattern in a path with given string. :param pattern: the pattern to match :param replace_with: the string to replace with :param dest: the path to replace :return the replaced path |
152,036 | from __future__ import annotations
import atexit
import contextlib
import functools
import json
import os
import re
import shutil
import subprocess
import sys
import sysconfig
import tempfile
import urllib.parse as parse
import warnings
from os import name as os_name
from pathlib import Path
from typing import TYPE_CHE... | Check if the given interpreter path is from a virtualenv, and return two values: the root path and whether it's a conda env. |
152,037 | from __future__ import annotations
import atexit
import contextlib
import functools
import json
import os
import re
import shutil
import subprocess
import sys
import sysconfig
import tempfile
import urllib.parse as parse
import warnings
from os import name as os_name
from pathlib import Path
from typing import TYPE_CHE... | Find a python interpreter from the given path, the input argument could be: - A valid path to the interpreter - A Python root directory that contains the interpreter |
152,038 | from __future__ import annotations
import atexit
import contextlib
import functools
import json
import os
import re
import shutil
import subprocess
import sys
import sysconfig
import tempfile
import urllib.parse as parse
import warnings
from os import name as os_name
from pathlib import Path
from typing import TYPE_CHE... | Get the rev part from the VCS URL. |
152,039 | from __future__ import annotations
import atexit
import contextlib
import functools
import json
import os
import re
import shutil
import subprocess
import sys
import sysconfig
import tempfile
import urllib.parse as parse
import warnings
from os import name as os_name
from pathlib import Path
from typing import TYPE_CHE... | Check if the distribution is installed in editable mode |
152,040 | from __future__ import annotations
import atexit
import contextlib
import functools
import json
import os
import re
import shutil
import subprocess
import sys
import sysconfig
import tempfile
import urllib.parse as parse
import warnings
from os import name as os_name
from pathlib import Path
from typing import TYPE_CHE... | Return a PEP 582 style install scheme |
152,041 | from __future__ import annotations
import atexit
import contextlib
import functools
import json
import os
import re
import shutil
import subprocess
import sys
import sysconfig
import tempfile
import urllib.parse as parse
import warnings
from os import name as os_name
from pathlib import Path
from typing import TYPE_CHE... | Check if the given string is a URL |
152,042 | from __future__ import annotations
import atexit
import contextlib
import functools
import json
import os
import re
import shutil
import subprocess
import sys
import sysconfig
import tempfile
import urllib.parse as parse
import warnings
from os import name as os_name
from pathlib import Path
from typing import TYPE_CHE... | Show a deprecation warning with the given message and raise an error after a specified version. |
152,043 | from __future__ import annotations
import atexit
import contextlib
import functools
import json
import os
import re
import shutil
import subprocess
import sys
import sysconfig
import tempfile
import urllib.parse as parse
import warnings
from os import name as os_name
from pathlib import Path
from typing import TYPE_CHE... | Check the given python version is compatible with the pip installed |
152,044 | from __future__ import annotations
import atexit
import contextlib
import functools
import json
import os
import re
import shutil
import subprocess
import sys
import sysconfig
import tempfile
import urllib.parse as parse
import warnings
from os import name as os_name
from pathlib import Path
from typing import TYPE_CHE... | Remove egg fragment from path |
152,045 | from __future__ import annotations
import atexit
import contextlib
import functools
import json
import os
import re
import shutil
import subprocess
import sys
import sysconfig
import tempfile
import urllib.parse as parse
import warnings
from os import name as os_name
from pathlib import Path
from typing import TYPE_CHE... | Check if the current process is running in a zipapp |
152,046 | from __future__ import annotations
import atexit
import contextlib
import functools
import json
import os
import re
import shutil
import subprocess
import sys
import sysconfig
import tempfile
import urllib.parse as parse
import warnings
from os import name as os_name
from pathlib import Path
from typing import TYPE_CHE... | null |
152,047 | from __future__ import annotations
import atexit
import contextlib
import functools
import json
import os
import re
import shutil
import subprocess
import sys
import sysconfig
import tempfile
import urllib.parse as parse
import warnings
from os import name as os_name
from pathlib import Path
from typing import TYPE_CHE... | Check if the project name is valid or not |
152,048 | from __future__ import annotations
import atexit
import contextlib
import functools
import json
import os
import re
import shutil
import subprocess
import sys
import sysconfig
import tempfile
import urllib.parse as parse
import warnings
from os import name as os_name
from pathlib import Path
from typing import TYPE_CHE... | Sanitize the project name and remove all illegal characters |
152,049 | from __future__ import annotations
import atexit
import contextlib
import functools
import json
import os
import re
import shutil
import subprocess
import sys
import sysconfig
import tempfile
import urllib.parse as parse
import warnings
from os import name as os_name
from pathlib import Path
from typing import TYPE_CHE... | null |
152,050 | from __future__ import annotations
import atexit
import contextlib
import functools
import json
import os
import re
import shutil
import subprocess
import sys
import sysconfig
import tempfile
import urllib.parse as parse
import warnings
from os import name as os_name
from pathlib import Path
from typing import TYPE_CHE... | Get matching sources based on the index attribute. |
152,051 | from __future__ import annotations
import atexit
import contextlib
import functools
import json
import os
import re
import shutil
import subprocess
import sys
import sysconfig
import tempfile
import urllib.parse as parse
import warnings
from os import name as os_name
from pathlib import Path
from typing import TYPE_CHE... | Calculate the hash of a file with the given algorithm |
152,052 | from pdm.compat import importlib_metadata, resources_read_text
def read_version() -> str:
try:
return importlib_metadata.version(__package__ or "pdm")
except importlib_metadata.PackageNotFoundError:
return resources_read_text("pdm.models", "VERSION").strip() | null |
152,053 | from __future__ import annotations
from typing import Iterable, Iterator, Mapping, cast
from pdm.models.candidates import Candidate
from pdm.models.requirements import NamedRequirement, Requirement
from pdm.models.specifiers import PySpecSet
class PythonRequirement(NamedRequirement):
def from_pyspec_set(cls, spec: ... | All requires-python except for the first one(must come from the project) must be superset of the first one. |
152,054 | from __future__ import annotations
from typing import Iterable, Iterator, Mapping, cast
from pdm.models.candidates import Candidate
from pdm.models.requirements import NamedRequirement, Requirement
from pdm.models.specifiers import PySpecSet
class Candidate:
def __init__(
self,
req: Requir... | null |
152,055 | from __future__ import annotations
import logging
from typing import TYPE_CHECKING
from resolvelib import BaseReporter
from pdm import termui
logger = logging.getLogger("pdm.termui")
def log_title(title: str) -> None:
logger.info("=" * 8 + " " + title + " " + "=" * 8) | null |
152,056 | from __future__ import annotations
import inspect
import os
from typing import TYPE_CHECKING, Callable
from packaging.specifiers import InvalidSpecifier, SpecifierSet
from packaging.version import InvalidVersion, Version
from resolvelib import AbstractProvider, RequirementsConflicted
from resolvelib.resolvers import Cr... | null |
152,057 | from __future__ import annotations
import inspect
import os
from typing import TYPE_CHECKING, Callable
from packaging.specifiers import InvalidSpecifier, SpecifierSet
from packaging.version import InvalidVersion, Version
from resolvelib import AbstractProvider, RequirementsConflicted
from resolvelib.resolvers import Cr... | null |
152,058 | from __future__ import annotations
import inspect
import os
from typing import TYPE_CHECKING, Callable
from packaging.specifiers import InvalidSpecifier, SpecifierSet
from packaging.version import InvalidVersion, Version
from resolvelib import AbstractProvider, RequirementsConflicted
from resolvelib.resolvers import Cr... | null |
152,059 | from __future__ import annotations
import functools
import operator
import os
import re
from pathlib import Path
from typing import TYPE_CHECKING, Any, Iterable, Mapping, cast
from pdm.compat import tomllib
from pdm.formats.base import (
MetaConverter,
Unset,
convert_from,
make_array,
make_inline_ta... | null |
152,060 | from __future__ import annotations
import functools
import operator
import os
import re
from pathlib import Path
from typing import TYPE_CHECKING, Any, Iterable, Mapping, cast
from pdm.compat import tomllib
from pdm.formats.base import (
MetaConverter,
Unset,
convert_from,
make_array,
make_inline_ta... | null |
152,061 | from __future__ import annotations
import functools
import operator
import os
import re
from pathlib import Path
from typing import TYPE_CHECKING, Any, Iterable, Mapping, cast
from pdm.compat import tomllib
from pdm.formats.base import (
MetaConverter,
Unset,
convert_from,
make_array,
make_inline_ta... | null |
152,062 | from __future__ import annotations
import functools
import operator
import os
import re
from pathlib import Path
from typing import TYPE_CHECKING, Any, Iterable, Mapping, cast
from pdm.compat import tomllib
from pdm.formats.base import (
MetaConverter,
Unset,
convert_from,
make_array,
make_inline_ta... | null |
152,063 | 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,064 | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.