repo_full_name stringlengths 6 93 | repo_url stringlengths 25 112 | repo_api_url stringclasses 28
values | owner stringclasses 28
values | repo_name stringclasses 28
values | description stringclasses 28
values | stars int64 617 98.8k | forks int64 31 355 ⌀ | watchers int64 990 999 ⌀ | license stringclasses 2
values | default_branch stringclasses 2
values | repo_created_at timestamp[s]date 2012-07-24 23:12:50 2025-06-16 08:07:28 ⌀ | repo_updated_at timestamp[s]date 2026-02-23 15:23:15 2026-05-03 18:52:12 ⌀ | repo_topics listlengths 0 13 ⌀ | repo_languages unknown | is_fork bool 1
class | open_issues int64 3 104 ⌀ | file_path stringlengths 3 208 | file_name stringclasses 509
values | file_extension stringclasses 1
value | file_size_bytes int64 101 84k ⌀ | file_url stringclasses 627
values | file_raw_url stringclasses 627
values | file_sha stringclasses 624
values | language stringclasses 8
values | parsed_at stringdate 2026-05-04 01:12:36 2026-05-04 19:41:55 | text stringlengths 100 102k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
keon/algorithms | https://github.com/keon/algorithms | null | null | null | null | 25,439 | null | null | mit | null | null | null | null | null | null | null | algorithms/bit_manipulation/binary_gap.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:48.285638 | """
Binary Gap
Given a positive integer N, find and return the longest distance between two
consecutive 1-bits in the binary representation of N. If there are not two
consecutive 1-bits, return 0.
Reference: https://en.wikipedia.org/wiki/Hamming_distance
Complexity:
Time: O(log n) where n is the input integer
... |
keon/algorithms | https://github.com/keon/algorithms | null | null | null | null | 25,439 | null | null | mit | null | null | null | null | null | null | null | algorithms/backtracking/generate_parenthesis.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:48.508739 | """
Generate Parentheses
Given n pairs of parentheses, generate all combinations of well-formed
parentheses.
Reference: https://leetcode.com/problems/generate-parentheses/
Complexity:
Time: O(4^n / sqrt(n)) — the n-th Catalan number
Space: O(n) recursion depth
"""
from __future__ import annotations
def g... |
keon/algorithms | https://github.com/keon/algorithms | null | null | null | null | 25,439 | null | null | mit | null | null | null | null | null | null | null | algorithms/backtracking/letter_combination.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:48.509318 | """
Letter Combinations of a Phone Number
Given a digit string, return all possible letter combinations that the
number could represent using a telephone keypad mapping.
Reference: https://leetcode.com/problems/letter-combinations-of-a-phone-number/
Complexity:
Time: O(4^n) where n is the number of digits
S... |
keon/algorithms | https://github.com/keon/algorithms | null | null | null | null | 25,439 | null | null | mit | null | null | null | null | null | null | null | algorithms/backtracking/minimax.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:48.544821 | """Minimax — game-tree search with alpha-beta pruning.
The minimax algorithm finds the optimal move for a two-player zero-sum
game. Alpha-beta pruning reduces the search space by eliminating branches
that cannot influence the final decision.
Inspired by PR #860 (DD2480-group16).
"""
from __future__ import annotation... |
keon/algorithms | https://github.com/keon/algorithms | null | null | null | null | 25,439 | null | null | mit | null | null | null | null | null | null | null | algorithms/backtracking/palindrome_partitioning.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:48.558032 | """
Palindrome Partitioning
Given a string, find all ways to partition it into palindromic substrings.
There is always at least one way since single characters are palindromes.
Reference: https://leetcode.com/problems/palindrome-partitioning/
Complexity:
Time: O(n * 2^n) where n is the string length
Space: ... |
keon/algorithms | https://github.com/keon/algorithms | null | null | null | null | 25,439 | null | null | mit | null | null | null | null | null | null | null | algorithms/bit_manipulation/bit_operation.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:48.559800 | """
Fundamental Bit Operations
Basic bit manipulation operations: get, set, clear, and update individual
bits at a specific position in an integer.
Reference: https://en.wikipedia.org/wiki/Bit_manipulation
Complexity:
Time: O(1) for all operations
Space: O(1)
"""
from __future__ import annotations
def ge... |
keon/algorithms | https://github.com/keon/algorithms | null | null | null | null | 25,439 | null | null | mit | null | null | null | null | null | null | null | algorithms/backtracking/pattern_match.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:48.589863 | """
Pattern Matching
Given a pattern and a string, determine if the string follows the same
pattern. A full match means a bijection between each letter in the pattern
and a non-empty substring in the string.
Reference: https://leetcode.com/problems/word-pattern-ii/
Complexity:
Time: O(n^m) where n is string len... |
keon/algorithms | https://github.com/keon/algorithms | null | null | null | null | 25,439 | null | null | mit | null | null | null | null | null | null | null | algorithms/bit_manipulation/bytes_int_conversion.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:48.979340 | """
Bytes-Integer Conversion
Convert between Python integers and raw byte sequences in both big-endian
and little-endian byte orders.
Reference: https://en.wikipedia.org/wiki/Endianness
Complexity:
Time: O(b) where b is the number of bytes in the representation
Space: O(b)
"""
from __future__ import annota... |
keon/algorithms | https://github.com/keon/algorithms | null | null | null | null | 25,439 | null | null | mit | null | null | null | null | null | null | null | algorithms/bit_manipulation/count_flips_to_convert.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:49.091732 | """
Count Flips to Convert
Determine the minimal number of bits you would need to flip to convert
integer A to integer B. Uses XOR to find differing bits and Brian
Kernighan's algorithm to count them.
Reference: https://en.wikipedia.org/wiki/Hamming_distance
Complexity:
Time: O(k) where k is the number of diffe... |
keon/algorithms | https://github.com/keon/algorithms | null | null | null | null | 25,439 | null | null | mit | null | null | null | null | null | null | null | algorithms/bit_manipulation/count_ones.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:49.127913 | """
Count Ones (Hamming Weight)
Count the number of 1-bits in the binary representation of an unsigned
integer using Brian Kernighan's algorithm.
Reference: https://en.wikipedia.org/wiki/Hamming_weight
Complexity:
Time: O(k) where k is the number of set bits
Space: O(1) iterative / O(k) recursive (call stac... |
keon/algorithms | https://github.com/keon/algorithms | null | null | null | null | 25,439 | null | null | mit | null | null | null | null | null | null | null | algorithms/bit_manipulation/find_missing_number.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:49.137064 | """
Find Missing Number
Given a sequence of unique integers in the range [0..n] with one value
missing, find and return that missing number. Two approaches are provided:
XOR-based and summation-based.
Reference: https://en.wikipedia.org/wiki/Exclusive_or
Complexity:
Time: O(n)
Space: O(1)
"""
from __future... |
keon/algorithms | https://github.com/keon/algorithms | null | null | null | null | 25,439 | null | null | mit | null | null | null | null | null | null | null | algorithms/bit_manipulation/flip_bit_longest_sequence.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:49.143534 | """
Flip Bit Longest Sequence
Given an integer, find the length of the longest sequence of 1-bits you
can create by flipping exactly one 0-bit to a 1-bit.
Reference: https://en.wikipedia.org/wiki/Bit_manipulation
Complexity:
Time: O(b) where b is the number of bits in the integer
Space: O(1)
"""
from __fut... |
keon/algorithms | https://github.com/keon/algorithms | null | null | null | null | 25,439 | null | null | mit | null | null | null | null | null | null | null | algorithms/bit_manipulation/gray_code.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:49.180059 | """Gray code — generate n-bit Gray code sequences.
A Gray code is an ordering of binary numbers such that successive values
differ in exactly one bit. Used in error correction and rotary encoders.
Inspired by PR #932 (Simranstha045).
"""
from __future__ import annotations
def gray_code(n: int) -> list[int]:
""... |
keon/algorithms | https://github.com/keon/algorithms | null | null | null | null | 25,439 | null | null | mit | null | null | null | null | null | null | null | algorithms/backtracking/permute.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:49.202610 | """
Permutations
Given a collection of distinct elements, return all possible permutations.
Reference: https://en.wikipedia.org/wiki/Permutation
Complexity:
Time: O(n * n!) where n is the number of elements
Space: O(n * n!) to store all permutations
"""
from __future__ import annotations
from collections.... |
keon/algorithms | https://github.com/keon/algorithms | null | null | null | null | 25,439 | null | null | mit | null | null | null | null | null | null | null | algorithms/backtracking/permute_unique.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:49.237030 | """
Unique Permutations
Given a collection of numbers that might contain duplicates, return all
possible unique permutations.
Reference: https://leetcode.com/problems/permutations-ii/
Complexity:
Time: O(n * n!) worst case
Space: O(n * n!) to store all unique permutations
"""
from __future__ import annotat... |
keon/algorithms | https://github.com/keon/algorithms | null | null | null | null | 25,439 | null | null | mit | null | null | null | null | null | null | null | algorithms/bit_manipulation/has_alternative_bit.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:49.758152 | """
Has Alternating Bits
Check whether a positive integer has alternating bits, meaning no two
adjacent bits share the same value.
Reference: https://en.wikipedia.org/wiki/Bit_manipulation
Complexity:
has_alternative_bit: O(number of bits)
has_alternative_bit_fast: O(1)
"""
from __future__ import annot... |
keon/algorithms | https://github.com/keon/algorithms | null | null | null | null | 25,439 | null | null | mit | null | null | null | null | null | null | null | algorithms/array/three_sum.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:51.464791 | """
Three Sum
Given an array of integers, find all unique triplets that sum to zero
using the two-pointer technique.
Reference: https://leetcode.com/problems/3sum/
Complexity:
Time: O(n^2)
Space: O(n) for the result set
"""
from __future__ import annotations
def three_sum(array: list[int]) -> set[tuple[i... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/ats_vit.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:53.691005 | import torch
import torch.nn.functional as F
from torch.nn.utils.rnn import pad_sequence
from torch import nn, einsum
from einops import rearrange, repeat
from einops.layers.torch import Rearrange
# helpers
def exists(val):
return val is not None
def pair(t):
return t if isinstance(t, tuple) else (t, t)
# ... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/cct_3d.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:53.692561 | import torch
from torch import nn, einsum
import torch.nn.functional as F
from einops import rearrange, repeat
# helpers
def exists(val):
return val is not None
def default(val, d):
return val if exists(val) else d
def pair(t):
return t if isinstance(t, tuple) else (t, t)
# CCT Models
__all__ = ['cct... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | tests/test_vit.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:53.693439 | import torch
from vit_pytorch import ViT
def test_vit():
v = ViT(
image_size = 256,
patch_size = 32,
num_classes = 1000,
dim = 1024,
depth = 6,
heads = 16,
mlp_dim = 2048,
dropout = 0.1,
emb_dropout = 0.1
)
img = torch.randn(1, 3, 256... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:53.695252 | from vit_pytorch.vit import ViT
from vit_pytorch.simple_vit import SimpleViT
from vit_pytorch.mae import MAE
from vit_pytorch.dino import Dino
|
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/cct.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:53.697367 | import torch
from torch import nn, einsum
import torch.nn.functional as F
from einops import rearrange, repeat
# helpers
def exists(val):
return val is not None
def default(val, d):
return val if exists(val) else d
def pair(t):
return t if isinstance(t, tuple) else (t, t)
# CCT Models
__all__ = ['cct... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/crossformer.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:53.701110 | import torch
from torch import nn, einsum
from einops import rearrange
from einops.layers.torch import Rearrange, Reduce
import torch.nn.functional as F
# helpers
def cast_tuple(val, length = 1):
return val if isinstance(val, tuple) else ((val,) * length)
# cross embed layer
class CrossEmbedLayer(nn.Module):
... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/cait.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:53.703290 | from random import randrange
import torch
from torch import nn, einsum
import torch.nn.functional as F
from einops import rearrange, repeat
from einops.layers.torch import Rearrange
# helpers
def exists(val):
return val is not None
def dropout_layers(layers, dropout):
if dropout == 0:
return layers
... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/accept_video_wrapper.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:53.704428 | from contextlib import nullcontext
import torch
from torch import is_tensor, randn
from torch.nn import Module, Linear, Parameter
from torch.utils._pytree import tree_flatten, tree_unflatten
from einops import rearrange, repeat
# helper functions
def exists(v):
return v is not None
def default(v, d):
retur... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | train_vit_decorr.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:53.705412 | # /// script
# dependencies = [
# "accelerate",
# "vit-pytorch",
# "wandb"
# ]
# ///
import torch
import torch.nn.functional as F
from torch.utils.data import DataLoader
import torchvision.transforms as T
from torchvision.datasets import CIFAR100
# constants
BATCH_SIZE = 32
LEARNING_RATE = 3e-4
EPOCHS = 10
DE... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/cross_vit.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:53.732327 | import torch
from torch import nn, einsum
import torch.nn.functional as F
from einops import rearrange, repeat
from einops.layers.torch import Rearrange
# helpers
def exists(val):
return val is not None
def default(val, d):
return val if exists(val) else d
# feedforward
class FeedForward(nn.Module):
d... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/efficient.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:54.324511 | import torch
from torch import nn
from einops import rearrange, repeat
from einops.layers.torch import Rearrange
def pair(t):
return t if isinstance(t, tuple) else (t, t)
class ViT(nn.Module):
def __init__(self, *, image_size, patch_size, num_classes, dim, transformer, pool = 'cls', channels = 3):
sup... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/dino.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:54.329270 | import copy
import random
from functools import wraps, partial
import torch
from torch import nn
import torch.nn.functional as F
from torchvision import transforms as T
# helper functions
def exists(val):
return val is not None
def default(val, default):
return val if exists(val) else default
def singleto... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/distill.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:54.339898 | import torch
from torch import nn
from torch.nn import Module
import torch.nn.functional as F
from vit_pytorch.vit import ViT
from vit_pytorch.t2t import T2TViT
from vit_pytorch.efficient import ViT as EfficientViT
from einops import rearrange, repeat
# helpers
def exists(val):
return val is not None
def defau... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/deepvit.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:54.344298 | import torch
from torch import nn, einsum
import torch.nn.functional as F
from einops import rearrange, repeat
from einops.layers.torch import Rearrange
class FeedForward(nn.Module):
def __init__(self, dim, hidden_dim, dropout = 0.):
super().__init__()
self.net = nn.Sequential(
nn.Laye... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/cvt.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:54.345482 | import torch
from torch import nn, einsum
import torch.nn.functional as F
from einops import rearrange, repeat
from einops.layers.torch import Rearrange
# helper methods
def group_dict_by_key(cond, d):
return_val = [dict(), dict()]
for key in d.keys():
match = bool(cond(key))
ind = int(not ma... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/jumbo_vit.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:54.348021 | # Simpler Fast Vision Transformers with a Jumbo CLS Token
# https://arxiv.org/abs/2502.15021
import torch
from torch import nn
from torch.nn import Module, ModuleList
from einops import rearrange, repeat, reduce, pack, unpack
from einops.layers.torch import Rearrange
# helpers
def pair(t):
return t if isinstanc... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/extractor.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:54.351394 | import torch
from torch import nn
def exists(val):
return val is not None
def identity(t):
return t
def clone_and_detach(t):
return t.clone().detach()
def apply_tuple_or_single(fn, val):
if isinstance(val, tuple):
return tuple(map(fn, val))
return fn(val)
class Extractor(nn.Module):
... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/learnable_memory_vit.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:54.351962 | import torch
from torch import nn
import torch.nn.functional as F
from einops import rearrange, repeat
from einops.layers.torch import Rearrange
# helpers
def exists(val):
return val is not None
def pair(t):
return t if isinstance(t, tuple) else (t, t)
# controlling freezing of layers
def set_module_requi... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/es_vit.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:54.360072 | import copy
import random
from functools import wraps, partial
import torch
from torch import nn, einsum
import torch.nn.functional as F
from torchvision import transforms as T
from einops import rearrange, reduce, repeat
# helper functions
def exists(val):
return val is not None
def default(val, default):
... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/lejepa.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:54.387189 | import random
from functools import wraps
import torch
from torch import nn
from torch.nn import Module
import torch.nn.functional as F
from torchvision import transforms as T
from einops import rearrange
# helper functions
def exists(val):
return val is not None
def default(val, d):
return val if exists(v... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/levit.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:55.348540 | from math import ceil
import torch
from torch import nn, einsum
import torch.nn.functional as F
from einops import rearrange, repeat
from einops.layers.torch import Rearrange
# helpers
def exists(val):
return val is not None
def default(val, d):
return val if exists(val) else d
def cast_tuple(val, l = 3):... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/na_vit.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:55.379094 | from __future__ import annotations
from functools import partial, lru_cache
from typing import List
import torch
import torch.nn.functional as F
from torch import nn, Tensor
from torch.nn.utils.rnn import pad_sequence as orig_pad_sequence
from einops import rearrange, repeat
# helpers
def exists(val):
return v... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/max_vit_with_registers.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:56.433671 | from functools import partial
import torch
from torch import nn, einsum
import torch.nn.functional as F
from torch.nn import Module, ModuleList, Sequential
from einops import rearrange, repeat, reduce, pack, unpack
from einops.layers.torch import Rearrange, Reduce
# helpers
def exists(val):
return val is not No... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/mobile_vit.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:56.435132 | import torch
import torch.nn as nn
from einops import rearrange
from einops.layers.torch import Reduce
# helpers
def conv_1x1_bn(inp, oup):
return nn.Sequential(
nn.Conv2d(inp, oup, 1, 1, 0, bias=False),
nn.BatchNorm2d(oup),
nn.SiLU()
)
def conv_nxn_bn(inp, oup, kernel_size=3, stride... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/max_vit.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:56.436454 | from functools import partial
import torch
from torch import nn, einsum
from einops import rearrange, repeat
from einops.layers.torch import Rearrange, Reduce
# helpers
def exists(val):
return val is not None
def default(val, d):
return val if exists(val) else d
def cast_tuple(val, length = 1):
return... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/mpp.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:56.437416 | import math
import torch
from torch import nn
import torch.nn.functional as F
from einops import rearrange, repeat, reduce
# helpers
def exists(val):
return val is not None
def prob_mask_like(t, prob):
batch, seq_length, _ = t.shape
return torch.zeros((batch, seq_length)).float().uniform_(0, 1) < prob
... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/mae.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:56.442230 | import torch
from torch import nn
import torch.nn.functional as F
from einops import repeat
from vit_pytorch.vit import Transformer
class MAE(nn.Module):
def __init__(
self,
*,
encoder,
decoder_dim,
masking_ratio = 0.75,
decoder_depth = 1,
decoder_heads = 8,... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/mp3.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:56.454069 | import torch
from torch import nn, einsum
import torch.nn.functional as F
from einops import rearrange, repeat
from einops.layers.torch import Rearrange
# helpers
def exists(val):
return val is not None
def default(val, d):
return val if exists(val) else d
def pair(t):
return t if isinstance(t, tuple) ... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/local_vit.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:56.474059 | from math import sqrt
import torch
from torch import nn, einsum
import torch.nn.functional as F
from einops import rearrange, repeat
from einops.layers.torch import Rearrange
# classes
class Residual(nn.Module):
def __init__(self, fn):
super().__init__()
self.fn = fn
def forward(self, x, **k... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/na_vit_nested_tensor_3d.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:56.475348 | from __future__ import annotations
from typing import List
from functools import partial
import torch
import packaging.version as pkg_version
from torch import nn, Tensor
import torch.nn.functional as F
from torch.nn import Module, ModuleList
from torch.nested import nested_tensor
from einops import rearrange
from ... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/look_vit.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:56.476837 | import torch
from torch import nn
import torch.nn.functional as F
from torch.nn import Module, ModuleList
from einops import einsum, rearrange, repeat, reduce
from einops.layers.torch import Rearrange
# helpers
def exists(val):
return val is not None
def default(val, d):
return val if exists(val) else d
de... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/parallel_vit.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:57.521280 | import torch
from torch import nn
from einops import rearrange, repeat
from einops.layers.torch import Rearrange
# helpers
def pair(t):
return t if isinstance(t, tuple) else (t, t)
# classes
class Parallel(nn.Module):
def __init__(self, *fns):
super().__init__()
self.fns = nn.ModuleList(fns... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/recorder.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:57.523502 | from functools import wraps
import torch
from torch import nn
from vit_pytorch.vit import Attention
def find_modules(nn_module, type):
return [module for module in nn_module.modules() if isinstance(module, type)]
class Recorder(nn.Module):
def __init__(self, vit, device = None):
super().__init__()
... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/nest.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:57.525540 | from functools import partial
import torch
from torch import nn, einsum
from einops import rearrange
from einops.layers.torch import Rearrange, Reduce
# helpers
def cast_tuple(val, depth):
return val if isinstance(val, tuple) else ((val,) * depth)
# classes
class LayerNorm(nn.Module):
def __init__(self, di... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/regionvit.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:57.526675 | import torch
from torch import nn, einsum
from einops import rearrange
from einops.layers.torch import Rearrange, Reduce
import torch.nn.functional as F
# helpers
def exists(val):
return val is not None
def default(val, d):
return val if exists(val) else d
def cast_tuple(val, length = 1):
return val if ... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/scalable_vit.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:57.528418 | from functools import partial
import torch
from torch import nn
from einops import rearrange, repeat
from einops.layers.torch import Rearrange, Reduce
# helpers
def exists(val):
return val is not None
def default(val, d):
return val if exists(val) else d
def pair(t):
return t if isinstance(t, tuple) el... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/pit.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:57.550476 | from math import sqrt
import torch
from torch import nn, einsum
import torch.nn.functional as F
from einops import rearrange, repeat
from einops.layers.torch import Rearrange
# helpers
def cast_tuple(val, num):
return val if isinstance(val, tuple) else (val,) * num
def conv_output_size(image_size, kernel_size,... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/sep_vit.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:58.255938 | from functools import partial
import torch
from torch import nn, einsum
from einops import rearrange, repeat
from einops.layers.torch import Rearrange, Reduce
# helpers
def cast_tuple(val, length = 1):
return val if isinstance(val, tuple) else ((val,) * length)
# helper classes
class ChanLayerNorm(nn.Module):... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/rvt.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:58.430880 | from math import sqrt, pi, log
import torch
from torch import nn, einsum
import torch.nn.functional as F
from torch.amp import autocast
from einops import rearrange, repeat
from einops.layers.torch import Rearrange
# rotary embeddings
@autocast('cuda', enabled = False)
def rotate_every_two(x):
x = rearrange(x, ... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/simple_uvit.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:59.061929 | import torch
from torch import nn
from torch.nn import Module, ModuleList
from einops import rearrange, repeat, pack, unpack
from einops.layers.torch import Rearrange
# helpers
def pair(t):
return t if isinstance(t, tuple) else (t, t)
def exists(v):
return v is not None
def divisible_by(num, den):
retu... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/simmim.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:59.062843 | import torch
from torch import nn
import torch.nn.functional as F
from einops import repeat
class SimMIM(nn.Module):
def __init__(
self,
*,
encoder,
masking_ratio = 0.5
):
super().__init__()
assert masking_ratio > 0 and masking_ratio < 1, 'masking ratio must be k... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/simple_flash_attn_vit.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:59.064066 | from collections import namedtuple
from packaging import version
import torch
import torch.nn.functional as F
from torch import nn
from einops import rearrange
from einops.layers.torch import Rearrange
# constants
Config = namedtuple('FlashAttentionConfig', ['enable_flash', 'enable_math', 'enable_mem_efficient'])
... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/simple_vit.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:59.064979 | import torch
from torch import nn
from einops import rearrange
from einops.layers.torch import Rearrange
# helpers
def pair(t):
return t if isinstance(t, tuple) else (t, t)
def posemb_sincos_2d(h, w, dim, temperature: int = 10000, dtype = torch.float32):
y, x = torch.meshgrid(torch.arange(h), torch.arange(w... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/simple_flash_attn_vit_3d.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:59.065757 | from packaging import version
from collections import namedtuple
import torch
from torch import nn
import torch.nn.functional as F
from torch.nn import Module, ModuleList
from einops import rearrange
from einops.layers.torch import Rearrange
# constants
Config = namedtuple('FlashAttentionConfig', ['enable_flash', '... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/normalized_vit.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:59.109189 | import torch
from torch import nn
from torch.nn import Module, ModuleList
import torch.nn.functional as F
import torch.nn.utils.parametrize as parametrize
from einops import rearrange, reduce
from einops.layers.torch import Rearrange
# functions
def exists(v):
return v is not None
def default(v, d):
return ... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/simple_vit_3d.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:59.313268 | import torch
import torch.nn.functional as F
from torch import nn
from einops import rearrange
from einops.layers.torch import Rearrange
# helpers
def pair(t):
return t if isinstance(t, tuple) else (t, t)
def posemb_sincos_3d(patches, temperature = 10000, dtype = torch.float32):
_, f, h, w, dim, device, dty... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/simple_vit_orthog_residual_update.py | null | null | null | null | null | null | Python | 2026-05-04T02:26:59.699684 | # Revisiting Residual Connections: Orthogonal Updates for Stable and Efficient Deep Networks
# Giyeong Oh et al. https://arxiv.org/abs/2505.11881
import torch
from torch import nn
import torch.nn.functional as F
from torch.nn import Module, ModuleList
from einops import rearrange
from einops.layers.torch import Rearr... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/na_vit_nested_tensor.py | null | null | null | null | null | null | Python | 2026-05-04T02:27:02.640445 | from __future__ import annotations
from typing import List
from functools import partial
import torch
import packaging.version as pkg_version
from torch import nn, Tensor
import torch.nn.functional as F
from torch.nn import Module, ModuleList
from torch.nested import nested_tensor
from einops import rearrange
from ... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/simple_vit_1d.py | null | null | null | null | null | null | Python | 2026-05-04T02:27:03.457830 | import torch
from torch import nn
from einops import rearrange
from einops.layers.torch import Rearrange
# helpers
def posemb_sincos_1d(patches, temperature = 10000, dtype = torch.float32):
_, n, dim, device, dtype = *patches.shape, patches.device, patches.dtype
n = torch.arange(n, device = device)
asse... |
lucidrains/vit-pytorch | https://github.com/lucidrains/vit-pytorch | null | null | null | null | 25,141 | null | null | mit | null | null | null | null | null | null | null | vit_pytorch/simple_vit_attn_residual.py | null | null | null | null | null | null | Python | 2026-05-04T02:27:04.193052 | from __future__ import annotations
import torch
from torch import nn, Tensor
from torch.nn import Module, ModuleList
from einops import rearrange, repeat
from einops.layers.torch import Rearrange
# helpers
def exists(v):
return v is not None
def default(v, d):
return v if exists(v) else d
def last(arr):
... |
pypa/pipenv | https://github.com/pypa/pipenv | null | null | null | null | 25,077 | null | null | mit | null | null | null | null | null | null | null | benchmarks/benchmark.py | null | null | null | null | null | null | Python | 2026-05-04T02:27:06.602798 | #!/usr/bin/env python3
"""
Pipenv benchmark runner based on python-package-manager-shootout.
"""
from __future__ import annotations
import argparse
import csv
import json
import os
import shutil
import statistics
import subprocess
import sys
import time
import urllib.request
from dataclasses import asdict, dataclass
... |
pypa/pipenv | https://github.com/pypa/pipenv | null | null | null | null | 25,077 | null | null | mit | null | null | null | null | null | null | null | pipenv/cmdparse.py | null | null | null | null | null | null | Python | 2026-05-04T02:27:06.630263 | import itertools
import re
import shlex
from pipenv.vendor import tomlkit
class ScriptEmptyError(ValueError):
pass
class ScriptParseError(ValueError):
pass
# Matches a shell-style inline environment variable assignment such as
# ``FOO=bar`` or ``MY_VAR=hello world`` (after shlex has stripped quotes).
# T... |
pypa/pipenv | https://github.com/pypa/pipenv | null | null | null | null | 25,077 | null | null | mit | null | null | null | null | null | null | null | pipenv/environment.py | null | null | null | null | null | null | Python | 2026-05-04T02:27:06.633912 | from __future__ import annotations
import contextlib
import importlib.metadata as importlib_metadata
import importlib.util
import json
import os
import site
import sys
import tempfile
import typing
from collections.abc import Iterable
from functools import cached_property
from itertools import chain
from pathlib impor... |
pypa/pipenv | https://github.com/pypa/pipenv | null | null | null | null | 25,077 | null | null | mit | null | null | null | null | null | null | null | pipenv/__version__.py | null | null | null | null | null | null | Python | 2026-05-04T02:27:06.644188 | # ___ ( ) ___ ___ __
# // ) ) / / // ) ) //___) ) // ) ) || / /
# //___/ / / / //___/ / // // / / || / /
# // / / // ((____ // / / ||/ /
__version__ = "2026.6.1"
|
pypa/pipenv | https://github.com/pypa/pipenv | null | null | null | null | 25,077 | null | null | mit | null | null | null | null | null | null | null | pipenv/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:27:06.645686 | import importlib.util
import os
import sys
import warnings
from pathlib import Path
# This has to come before imports of pipenv
PIPENV_ROOT = Path(__file__).resolve().parent.absolute()
PIP_ROOT = str(PIPENV_ROOT / "patched" / "pip")
sys.path.insert(0, str(PIPENV_ROOT))
sys.path.insert(0, PIP_ROOT)
# Load patched pip ... |
pypa/pipenv | https://github.com/pypa/pipenv | null | null | null | null | 25,077 | null | null | mit | null | null | null | null | null | null | null | pipenv/cli/options.py | null | null | null | null | null | null | Python | 2026-05-04T02:27:06.663872 | import argparse
import os
import re
from pathlib import Path
from pipenv.project import Project
from pipenv.utils.internet import is_valid_url
# Use SUPPRESS as default for options shared between the root parser and
# subparsers. This prevents subparser defaults from overwriting values
# already parsed by the root p... |
pypa/pipenv | https://github.com/pypa/pipenv | null | null | null | null | 25,077 | null | null | mit | null | null | null | null | null | null | null | pipenv/cli/command.py | null | null | null | null | null | null | Python | 2026-05-04T02:27:06.681796 | import argparse
import os
import sys
from pathlib import Path
from pipenv import environments
from pipenv.cli.options import (
apply_default_categories,
apply_env_vars,
build_parser,
build_state,
)
from pipenv.utils import console, err
from pipenv.utils.environment import load_dot_env
from pipenv.utils... |
pypa/pipenv | https://github.com/pypa/pipenv | null | null | null | null | 25,077 | null | null | mit | null | null | null | null | null | null | null | pipenv/patched/pip/_internal/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:27:07.609838 | from __future__ import annotations
from pipenv.patched.pip._internal.utils import _log
# init_logging() must be called before any call to logging.getLogger()
# which happens at import of most modules.
_log.init_logging()
def main(args: list[str] | None = None) -> int:
"""This is preserved for old console script... |
pypa/pipenv | https://github.com/pypa/pipenv | null | null | null | null | 25,077 | null | null | mit | null | null | null | null | null | null | null | pipenv/installers.py | null | null | null | null | null | null | Python | 2026-05-04T02:27:07.610783 | import json
import operator
import os
import re
import sys
from abc import ABCMeta, abstractmethod
from dataclasses import dataclass, field
from typing import Optional
from pipenv.utils.processes import subprocess_run
from pipenv.utils.shell import find_windows_executable
@dataclass
class Version:
major: int
... |
pypa/pipenv | https://github.com/pypa/pipenv | null | null | null | null | 25,077 | null | null | mit | null | null | null | null | null | null | null | pipenv/patched/pip/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:27:07.612617 | from __future__ import annotations
__version__ = "26.1"
def main(args: list[str] | None = None) -> int:
"""This is an internal API only meant for use by pip's own console scripts.
For additional details, see https://github.com/pypa/pip/issues/7498.
"""
from pipenv.patched.pip._internal.utils.entrypo... |
pypa/pipenv | https://github.com/pypa/pipenv | null | null | null | null | 25,077 | null | null | mit | null | null | null | null | null | null | null | pipenv/help.py | null | null | null | null | null | null | Python | 2026-05-04T02:27:07.617326 | import os
import pprint
import sys
import pipenv
from pipenv.pep508checker import lookup
from pipenv.vendor import pythonfinder
def get_pipenv_diagnostics(project):
print("<details><summary>$ pipenv --support</summary>")
print("")
print(f"Pipenv version: `{pipenv.__version__!r}`")
print("")
print... |
pypa/pipenv | https://github.com/pypa/pipenv | null | null | null | null | 25,077 | null | null | mit | null | null | null | null | null | null | null | pipenv/environments.py | null | null | null | null | null | null | Python | 2026-05-04T02:27:07.618655 | import glob
import os
import re
import sys
from pathlib import Path
from pipenv.patched.pip._vendor.platformdirs import user_cache_dir
from pipenv.utils.fileutils import normalize_drive
from pipenv.utils.shell import env_to_bool, is_env_truthy, isatty
# HACK: avoid resolver.py uses the wrong byte code files.
# I hope... |
pypa/pipenv | https://github.com/pypa/pipenv | null | null | null | null | 25,077 | null | null | mit | null | null | null | null | null | null | null | pipenv/patched/pip/__main__.py | null | null | null | null | null | null | Python | 2026-05-04T02:27:07.629462 | import os
import sys
# Remove '' and current working directory from the first entry
# of sys.path, if present to avoid using current directory
# in pip commands check, freeze, install, list and show,
# when invoked as python -m pip <command>
if sys.path[0] in ("", os.getcwd()):
sys.path.pop(0)
# If we are running... |
pypa/pipenv | https://github.com/pypa/pipenv | null | null | null | null | 25,077 | null | null | mit | null | null | null | null | null | null | null | pipenv/exceptions.py | null | null | null | null | null | null | Python | 2026-05-04T02:27:07.659188 | import itertools
import sys
from collections import namedtuple
from traceback import format_tb
from pipenv.patched.pip._vendor.rich.console import Console
from pipenv.patched.pip._vendor.rich.text import Text
from pipenv.utils import err
class _ClickException(Exception):
"""Minimal ClickException replacement dur... |
pypa/pipenv | https://github.com/pypa/pipenv | null | null | null | null | 25,077 | null | null | mit | null | null | null | null | null | null | null | pipenv/patched/pip/_internal/cli/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:27:08.218513 | """Subpackage containing all of pip's command line interface related code"""
# This file intentionally does not import submodules
|
pypa/pipenv | https://github.com/pypa/pipenv | null | null | null | null | 25,077 | null | null | mit | null | null | null | null | null | null | null | pipenv/patched/pip/_internal/cache.py | null | null | null | null | null | null | Python | 2026-05-04T02:27:08.228020 | """Cache Management"""
from __future__ import annotations
import hashlib
import json
import logging
import os
from pathlib import Path
from typing import Any
from pipenv.patched.pip._vendor.packaging.tags import Tag, interpreter_name, interpreter_version
from pipenv.patched.pip._vendor.packaging.utils import canonic... |
pypa/pipenv | https://github.com/pypa/pipenv | null | null | null | null | 25,077 | null | null | mit | null | null | null | null | null | null | null | pipenv/patched/pip/_internal/cli/autocompletion.py | null | null | null | null | null | null | Python | 2026-05-04T02:27:08.232418 | """Logic that powers autocompletion installed by ``pip completion``."""
from __future__ import annotations
import optparse
import os
import sys
from collections.abc import Iterable
from itertools import chain
from typing import Any
from pipenv.patched.pip._internal.cli.main_parser import create_main_parser
from pipe... |
pypa/pipenv | https://github.com/pypa/pipenv | null | null | null | null | 25,077 | null | null | mit | null | null | null | null | null | null | null | pipenv/patched/pip/_internal/cli/base_command.py | null | null | null | null | null | null | Python | 2026-05-04T02:27:08.234472 | """Base Command class, and related routines"""
from __future__ import annotations
import contextlib
import logging
import logging.config
import optparse
import os
import sys
import traceback
from collections.abc import Iterator
from optparse import Values
from typing import Callable
from pipenv.patched.pip._vendor.r... |
pypa/pipenv | https://github.com/pypa/pipenv | null | null | null | null | 25,077 | null | null | mit | null | null | null | null | null | null | null | pipenv/patched/pip/_internal/cli/command_context.py | null | null | null | null | null | null | Python | 2026-05-04T02:27:08.238191 | from collections.abc import Generator
from contextlib import AbstractContextManager, ExitStack, contextmanager
from typing import TypeVar
_T = TypeVar("_T", covariant=True)
class CommandContextMixIn:
def __init__(self) -> None:
super().__init__()
self._in_main_context = False
self._main_c... |
pypa/pipenv | https://github.com/pypa/pipenv | null | null | null | null | 25,077 | null | null | mit | null | null | null | null | null | null | null | pipenv/patched/pip/_internal/cli/cmdoptions.py | null | null | null | null | null | null | Python | 2026-05-04T02:27:08.243032 | """
shared options and groups
The principle here is to define options once, but *not* instantiate them
globally. One reason being that options with action='append' can carry state
between parses. pip parses general options twice internally, and shouldn't
pass on state. To be consistent, all options will follow this de... |
pypa/pipenv | https://github.com/pypa/pipenv | null | null | null | null | 25,077 | null | null | mit | null | null | null | null | null | null | null | pipenv/patched/pip/_internal/cli/index_command.py | null | null | null | null | null | null | Python | 2026-05-04T02:27:08.319550 | """
Contains command classes which may interact with an index / the network.
Unlike its sister module, req_command, this module still uses lazy imports
so commands which don't always hit the network (e.g. list w/o --outdated or
--uptodate) don't need waste time importing PipSession and friends.
"""
from __future__ im... |
pypa/pipenv | https://github.com/pypa/pipenv | null | null | null | null | 25,077 | null | null | mit | null | null | null | null | null | null | null | pipenv/patched/pip/_internal/cli/main.py | null | null | null | null | null | null | Python | 2026-05-04T02:27:08.416306 | """Primary application entrypoint."""
from __future__ import annotations
import locale
import logging
import os
import sys
import warnings
logger = logging.getLogger(__name__)
# Do not import and use main() directly! Using it directly is actively
# discouraged by pip's maintainers. The name, location and behavior ... |
pypa/pipenv | https://github.com/pypa/pipenv | null | null | null | null | 25,077 | null | null | mit | null | null | null | null | null | null | null | pipenv/patched/pip/_internal/build_env.py | null | null | null | null | null | null | Python | 2026-05-04T02:27:08.417849 | """Build Environment used for isolation during sdist building"""
from __future__ import annotations
import logging
import os
import pathlib
import site
import sys
import textwrap
from collections import OrderedDict
from collections.abc import Iterable, Sequence
from contextlib import AbstractContextManager as Context... |
pypa/pipenv | https://github.com/pypa/pipenv | null | null | null | null | 25,077 | null | null | mit | null | null | null | null | null | null | null | pipenv/patched/pip/__pip-runner__.py | null | null | null | null | null | null | Python | 2026-05-04T02:27:08.506553 | """Execute exactly this copy of pip, within a different environment.
This file is named as it is, to ensure that this module can't be imported via
an import statement.
"""
# /!\ This version compatibility check section must be Python 2 compatible. /!\
import sys
# Copied from pyproject.toml
PYTHON_REQUIRES = (3, 10... |
pypa/pipenv | https://github.com/pypa/pipenv | null | null | null | null | 25,077 | null | null | mit | null | null | null | null | null | null | null | pipenv/patched/pip/_internal/cli/main_parser.py | null | null | null | null | null | null | Python | 2026-05-04T02:27:08.829110 | """A single place for constructing and exposing the main parser"""
from __future__ import annotations
import os
import subprocess
import sys
from pipenv.patched.pip._vendor.rich.markup import escape
from pipenv.patched.pip._internal.build_env import get_runnable_pip
from pipenv.patched.pip._internal.cli import cmdo... |
pypa/pipenv | https://github.com/pypa/pipenv | null | null | null | null | 25,077 | null | null | mit | null | null | null | null | null | null | null | pipenv/patched/pip/_internal/cli/spinners.py | null | null | null | null | null | null | Python | 2026-05-04T02:27:08.854157 | from __future__ import annotations
import contextlib
import itertools
import logging
import sys
import time
from collections.abc import Generator
from typing import IO, Final
from pipenv.patched.pip._vendor.rich.console import (
Console,
ConsoleOptions,
RenderableType,
RenderResult,
)
from pipenv.patc... |
pypa/pipenv | https://github.com/pypa/pipenv | null | null | null | null | 25,077 | null | null | mit | null | null | null | null | null | null | null | pipenv/patched/pip/_internal/cli/req_command.py | null | null | null | null | null | null | Python | 2026-05-04T02:27:08.854791 | """Contains the RequirementCommand base class.
This class is in a separate module so the commands that do not always
need PackageFinder capability don't unnecessarily import the
PackageFinder machinery and all its vendored dependencies, etc.
"""
from __future__ import annotations
import logging
import os
from functo... |
pypa/pipenv | https://github.com/pypa/pipenv | null | null | null | null | 25,077 | null | null | mit | null | null | null | null | null | null | null | pipenv/patched/pip/_internal/cli/parser.py | null | null | null | null | null | null | Python | 2026-05-04T02:27:08.857026 | """Base option parser setup"""
from __future__ import annotations
import logging
import optparse
import os
import re
import shutil
import sys
import textwrap
from collections.abc import Generator
from contextlib import suppress
from typing import Any, NoReturn
from pipenv.patched.pip._vendor.rich.markup import escap... |
pypa/pipenv | https://github.com/pypa/pipenv | null | null | null | null | 25,077 | null | null | mit | null | null | null | null | null | null | null | pipenv/patched/pip/_internal/cli/progress_bars.py | null | null | null | null | null | null | Python | 2026-05-04T02:27:08.885301 | from __future__ import annotations
import functools
import sys
from collections.abc import Generator, Iterable, Iterator
from typing import Any, Callable, Literal, TypeVar
from pipenv.patched.pip._vendor.rich.progress import (
BarColumn,
DownloadColumn,
FileSizeColumn,
MofNCompleteColumn,
Progress... |
pypa/pipenv | https://github.com/pypa/pipenv | null | null | null | null | 25,077 | null | null | mit | null | null | null | null | null | null | null | pipenv/patched/pip/_internal/commands/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:27:08.906751 | """
Package containing all pip commands
"""
from __future__ import annotations
import importlib
from collections import namedtuple
from typing import Any
from pipenv.patched.pip._internal.cli.base_command import Command
CommandInfo = namedtuple("CommandInfo", "module_path, class_name, summary")
# This dictionary d... |
pypa/pipenv | https://github.com/pypa/pipenv | null | null | null | null | 25,077 | null | null | mit | null | null | null | null | null | null | null | pipenv/patched/pip/_internal/cli/status_codes.py | null | null | null | null | null | null | Python | 2026-05-04T02:27:08.907646 | SUCCESS = 0
ERROR = 1
UNKNOWN_ERROR = 2
VIRTUALENV_NOT_FOUND = 3
PREVIOUS_BUILD_DIR_ERROR = 4
NO_MATCHES_FOUND = 23
|
pypa/pipenv | https://github.com/pypa/pipenv | null | null | null | null | 25,077 | null | null | mit | null | null | null | null | null | null | null | pipenv/patched/pip/_internal/commands/cache.py | null | null | null | null | null | null | Python | 2026-05-04T02:27:08.989213 | import os
import textwrap
from optparse import Values
from typing import Callable
from pipenv.patched.pip._internal.cli.base_command import Command
from pipenv.patched.pip._internal.cli.status_codes import ERROR, SUCCESS
from pipenv.patched.pip._internal.exceptions import CommandError, PipError
from pipenv.patched.pip... |
pypa/pipenv | https://github.com/pypa/pipenv | null | null | null | null | 25,077 | null | null | mit | null | null | null | null | null | null | null | pipenv/patched/pip/_internal/commands/check.py | null | null | null | null | null | null | Python | 2026-05-04T02:27:09.029461 | import logging
from optparse import Values
from pipenv.patched.pip._internal.cli.base_command import Command
from pipenv.patched.pip._internal.cli.status_codes import ERROR, SUCCESS
from pipenv.patched.pip._internal.metadata import get_default_environment
from pipenv.patched.pip._internal.operations.check import (
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.