repo
stringlengths
7
90
file_url
stringlengths
81
315
file_path
stringlengths
4
228
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 14:38:15
2026-01-05 02:33:18
truncated
bool
2 classes
maxhumber/hickory
https://github.com/maxhumber/hickory/blob/637ff813685e74f89afa11c5b3b17453f464c0c3/tests/linux/test_every_systemd.py
tests/linux/test_every_systemd.py
import pytest from hickory.every_systemd import * def test_interval_to_on_calendar_strings(): intervals = ["10seconds", "10minutes", "10hours"] result = [interval_to_on_calendar_strings(i) for i in intervals] assert result == [["*:*:0/10"], ["*:0/10"], ["0/10:00:00"]] def test_fail_interval_to_on_calen...
python
MIT
637ff813685e74f89afa11c5b3b17453f464c0c3
2026-01-05T07:09:39.614467Z
false
maxhumber/hickory
https://github.com/maxhumber/hickory/blob/637ff813685e74f89afa11c5b3b17453f464c0c3/tests/linux/test_cli.py
tests/linux/test_cli.py
import os import subprocess import sys import time from pathlib import Path import pytest os.chdir("tests") def setup(): foo = """import datetime import time stamp = datetime.datetime.now().strftime("%H:%M:%S") time.sleep(5) print(f"Foo - {stamp} + 5 seconds")""" with open("foo.py", "w") as f: f.w...
python
MIT
637ff813685e74f89afa11c5b3b17453f464c0c3
2026-01-05T07:09:39.614467Z
false
maxhumber/hickory
https://github.com/maxhumber/hickory/blob/637ff813685e74f89afa11c5b3b17453f464c0c3/hickory/launchd.py
hickory/launchd.py
import plistlib import re from pathlib import Path from typing import Any, Dict, List, Optional, Union from .constants import HICKORY_SERVICE, LAUNCHD_PATH from .every_launchd import every from .format_status import format_status from .utils import run def _build_dict( label: str, working_directory: str, which_p...
python
MIT
637ff813685e74f89afa11c5b3b17453f464c0c3
2026-01-05T07:09:39.614467Z
false
maxhumber/hickory
https://github.com/maxhumber/hickory/blob/637ff813685e74f89afa11c5b3b17453f464c0c3/hickory/every_launchd.py
hickory/every_launchd.py
import re from typing import Any, Dict, List, Union from .utils import ( HickoryError, contains_number, disjoin, interval_to_tuple, strip_number, timestamp_to_tuple, ) def interval_to_seconds(interval: str) -> int: value, unit = interval_to_tuple(interval) if unit in ["s", "sec", "sec...
python
MIT
637ff813685e74f89afa11c5b3b17453f464c0c3
2026-01-05T07:09:39.614467Z
false
maxhumber/hickory
https://github.com/maxhumber/hickory/blob/637ff813685e74f89afa11c5b3b17453f464c0c3/hickory/cli.py
hickory/cli.py
import argparse import sys from pathlib import Path from uuid import uuid4 from .colors import Fore from .constants import HICKORY_SERVICE from .launchd import kill_launchd, schedule_launchd, status_launchd from .systemd import kill_systemd, schedule_systemd, status_systemd from .utils import pretty_print_exception ...
python
MIT
637ff813685e74f89afa11c5b3b17453f464c0c3
2026-01-05T07:09:39.614467Z
false
maxhumber/hickory
https://github.com/maxhumber/hickory/blob/637ff813685e74f89afa11c5b3b17453f464c0c3/hickory/constants.py
hickory/constants.py
from pathlib import Path HICKORY_SERVICE = "hickory" HOME = str(Path.home()) LAUNCHD_PATH = f"{HOME}/Library/LaunchAgents" SYSTEMD_PATH = f"{HOME}/.config/systemd/user"
python
MIT
637ff813685e74f89afa11c5b3b17453f464c0c3
2026-01-05T07:09:39.614467Z
false
maxhumber/hickory
https://github.com/maxhumber/hickory/blob/637ff813685e74f89afa11c5b3b17453f464c0c3/hickory/__main__.py
hickory/__main__.py
from .cli import main main()
python
MIT
637ff813685e74f89afa11c5b3b17453f464c0c3
2026-01-05T07:09:39.614467Z
false
maxhumber/hickory
https://github.com/maxhumber/hickory/blob/637ff813685e74f89afa11c5b3b17453f464c0c3/hickory/systemd.py
hickory/systemd.py
import io import re import subprocess import sys from configparser import ConfigParser from pathlib import Path from typing import Any, Dict, List, Tuple from .constants import HICKORY_SERVICE, SYSTEMD_PATH from .every_systemd import every from .format_status import format_status from .utils import run HOME = str(Pat...
python
MIT
637ff813685e74f89afa11c5b3b17453f464c0c3
2026-01-05T07:09:39.614467Z
false
maxhumber/hickory
https://github.com/maxhumber/hickory/blob/637ff813685e74f89afa11c5b3b17453f464c0c3/hickory/utils.py
hickory/utils.py
import re import sys import traceback import subprocess from itertools import product from typing import List, Optional, Tuple, Type from .colors import Fore, Style class HickoryError(Exception): pass def run(command: str, output: bool = True, silent: bool = False) -> Optional[str]: if silent: comma...
python
MIT
637ff813685e74f89afa11c5b3b17453f464c0c3
2026-01-05T07:09:39.614467Z
false
maxhumber/hickory
https://github.com/maxhumber/hickory/blob/637ff813685e74f89afa11c5b3b17453f464c0c3/hickory/__init__.py
hickory/__init__.py
python
MIT
637ff813685e74f89afa11c5b3b17453f464c0c3
2026-01-05T07:09:39.614467Z
false
maxhumber/hickory
https://github.com/maxhumber/hickory/blob/637ff813685e74f89afa11c5b3b17453f464c0c3/hickory/every_systemd.py
hickory/every_systemd.py
import re from typing import List from .utils import ( HickoryError, contains_number, disjoin, interval_to_tuple, strip_number, timestamp_to_tuple, ) def interval_to_on_calendar_strings(interval: str) -> List[str]: value, unit = interval_to_tuple(interval) if unit in ["s", "sec", "sec...
python
MIT
637ff813685e74f89afa11c5b3b17453f464c0c3
2026-01-05T07:09:39.614467Z
false
maxhumber/hickory
https://github.com/maxhumber/hickory/blob/637ff813685e74f89afa11c5b3b17453f464c0c3/hickory/format_status.py
hickory/format_status.py
from typing import Any, Dict, List, Union def _find_maxlens(info_dicts: List[Dict[str, Any]]) -> Dict[str, int]: keys = info_dicts[0].keys() maxlens = {key: len(key) for key in keys} for info in info_dicts: for key in keys: current = maxlens[key] new = len(str(info[key])) ...
python
MIT
637ff813685e74f89afa11c5b3b17453f464c0c3
2026-01-05T07:09:39.614467Z
false
maxhumber/hickory
https://github.com/maxhumber/hickory/blob/637ff813685e74f89afa11c5b3b17453f464c0c3/hickory/colors.py
hickory/colors.py
from typing import Tuple, Union class Color: """ A composable coloring object. RED = Color(91) RED_FOREGROUND = RED BLUE_BACKGROUND = Color(104) # Sum Colors to combine them: RED_FORE_BLUE_BACK = RED_FOREGROUND + BLUE_BACKGROUND # Apply it to strings about to be printed >>> pri...
python
MIT
637ff813685e74f89afa11c5b3b17453f464c0c3
2026-01-05T07:09:39.614467Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/train.py
train.py
import os.path import typing import typing import warnings from pprint import pprint import pytorch_lightning as pl import torch from pytorch_lightning.callbacks import RichModelSummary from pytorch_lightning.profilers import AdvancedProfiler, PyTorchProfiler from pytorch_lightning.strategies import DDPStrategy from t...
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/inference.py
inference.py
import glob import os.path from pprint import pprint import warnings import numpy as np import pytorch_lightning as pl import torch from core import LightningSystem from utils.config import read_nested_yaml torch.set_float32_matmul_precision("medium") import torchaudio as ta from typing import List, Optional, Dict, ...
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/benchmark.py
benchmark.py
import glob import json from fvcore.nn import FlopCountAnalysis, flop_count_table import os.path import typing import typing import warnings from pprint import pprint import numpy as np import pytorch_lightning as pl import torch from pytorch_lightning.callbacks import RichModelSummary from pytorch_lightning.profiler...
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/test.py
test.py
import os.path import typing import typing import warnings from pprint import pprint import pytorch_lightning as pl import torch from pytorch_lightning.callbacks import RichModelSummary from pytorch_lightning.profilers import AdvancedProfiler, PyTorchProfiler from pytorch_lightning.strategies import DDPStrategy from t...
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/utils/_types.py
utils/_types.py
from typing import Any, Dict, List, Optional, Union Primitive = Union[str, float, int, bool] DictValues = Union[Primitive, List[Primitive]] StringKeyedNestedDict = Dict[str, Optional[Union[Any, 'StringKeyedNestedDict']]]
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/utils/config.py
utils/config.py
from types import ModuleType from typing import Any, List, Union import yaml from pytorch_lightning import callbacks, loggers from utils._types import StringKeyedNestedDict import os def read_yaml(path: str) -> StringKeyedNestedDict: with open(path, "r") as f: config = yaml.safe_load(f) return confi...
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/utils/__init__.py
utils/__init__.py
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/core/__init__.py
core/__init__.py
import os.path from collections import defaultdict from itertools import chain, combinations from typing import ( Any, Dict, Iterator, Mapping, Optional, Tuple, Type, TypedDict ) import pytorch_lightning as pl import torch import torchaudio as ta import torchmetrics as tm from asteroid import l...
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/core/loss/_multistem.py
core/loss/_multistem.py
from typing import Any, Dict import torch from asteroid import losses as asteroid_losses from torch import nn from torch.nn.modules.loss import _Loss from . import snr def parse_loss(name: str, kwargs: Dict[str, Any]) -> _Loss: for module in [nn.modules.loss, snr, asteroid_losses, asteroid_losses.sdr]: ...
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/core/loss/_timefreq.py
core/loss/_timefreq.py
from typing import Any, Dict, Optional import torch from torch import nn from torch.nn.modules.loss import _Loss from core.loss._multistem import MultiStemWrapper from core.loss._complex import ReImL1Loss, ReImL2Loss, ReImLossWrapper from core.loss.snr import SignalNoisePNormRatio class TimeFreqWrapper(_Loss): d...
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/core/loss/_complex.py
core/loss/_complex.py
from typing import Any import torch from torch import nn from torch.nn.modules import loss as _loss from torch.nn.modules.loss import _Loss class ReImLossWrapper(_Loss): def __init__(self, module: _Loss) -> None: super().__init__() self.module = module def forward( self, ...
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/core/loss/snr.py
core/loss/snr.py
import torch from torch.nn.modules.loss import _Loss from torch.nn import functional as F class SignalNoisePNormRatio(_Loss): def __init__( self, p: float = 1.0, scale_invariant: bool = False, zero_mean: bool = False, take_log: bool = True, re...
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/core/loss/__init__.py
core/loss/__init__.py
from ._multistem import MultiStemWrapperFromConfig from ._timefreq import ReImL1Loss, ReImL2Loss, TimeFreqL1Loss, TimeFreqL2Loss, TimeFreqSignalNoisePNormRatioLoss
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/core/model/__init__.py
core/model/__init__.py
from .bsrnn.wrapper import ( MultiMaskMultiSourceBandSplitRNN, MultiMaskMultiSourceBandSplitTransformer, MultiMaskMultiSourceBandSplitConv, PatchingMaskMultiSourceBandSplitRNN, SingleMaskMultiSourceBandSplitRNN, SingleMaskMultiSourceBandSplitTransformer ) from .oracle.idealmask import IdealRati...
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/core/model/_spectral.py
core/model/_spectral.py
from typing import Dict, Optional import torch import torchaudio as ta from torch import nn class _SpectralComponent(nn.Module): def __init__( self, n_fft: int = 2048, win_length: Optional[int] = 2048, hop_length: int = 512, window_fn: str = "hann_windo...
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/core/model/oracle/idealmask.py
core/model/oracle/idealmask.py
from typing import Dict, List, Optional import torch from core.model._spectral import _SpectralComponent class BaseIdealMask( _SpectralComponent ): def __init__( self, stems: List[str], fs: int = 44100, n_fft: int = 2048, win_length: Optional[i...
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/core/model/demucs/hdemucs.py
core/model/demucs/hdemucs.py
from typing import Dict, List import torch from torch import nn import torchaudio as ta class HDemucsWrapper(nn.Module): def __init__( self, stems: List[str], fs: int = 44100, audio_channels: int = 1, channels: int = 48, growth: int = 2, ...
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/core/model/umx/umx.py
core/model/umx/umx.py
from typing import Dict import openunmix import openunmix as umx import torch from openunmix.filtering import wiener from torch import nn from torch.nn import functional as F from openunmix.model import Separator class OpenUnmix(nn.Module): """OpenUnmix Core spectrogram based separation module. Args: ...
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/core/model/bsrnn/bandsplit.py
core/model/bsrnn/bandsplit.py
from typing import List, Tuple import torch from torch import nn from core.model.bsrnn.utils import ( band_widths_from_specs, check_no_gap, check_no_overlap, check_nonzero_bandwidth, ) class NormFC(nn.Module): def __init__( self, emb_dim: int, bandwidth: int, ...
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/core/model/bsrnn/core.py
core/model/bsrnn/core.py
from typing import Dict, List, Optional, Tuple import torch from torch import nn from torch.nn import functional as F from core.model.bsrnn import BandsplitCoreBase from core.model.bsrnn.bandsplit import BandSplitModule from core.model.bsrnn.maskestim import ( MaskEstimationModule, OverlappingMaskEstimationMo...
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/core/model/bsrnn/utils.py
core/model/bsrnn/utils.py
import os from abc import abstractmethod from typing import Any, Callable import numpy as np import torch from librosa import hz_to_midi, midi_to_hz from torch import Tensor from torchaudio import functional as taF from spafe.fbanks import bark_fbanks from spafe.utils.converters import erb2hz, hz2bark, hz2erb from tor...
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/core/model/bsrnn/wrapper.py
core/model/bsrnn/wrapper.py
from pprint import pprint from typing import Dict, List, Optional, Tuple, Union import torch from torch import nn from core.model._spectral import _SpectralComponent from core.model.bsrnn.utils import ( BarkBandsplitSpecification, BassBandsplitSpecification, DrumBandsplitSpecification, EquivalentRectangul...
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/core/model/bsrnn/__init__.py
core/model/bsrnn/__init__.py
from abc import ABC from typing import Iterable, Mapping, Union from torch import nn from core.model.bsrnn.bandsplit import BandSplitModule from core.model.bsrnn.tfmodel import ( SeqBandModellingModule, TransformerTimeFreqModule, ) class BandsplitCoreBase(nn.Module, ABC): band_split: nn.Module tf_mo...
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/core/model/bsrnn/maskestim.py
core/model/bsrnn/maskestim.py
import warnings from typing import Dict, List, Optional, Tuple, Type import torch from torch import nn from torch.nn.modules import activation from core.model.bsrnn.utils import ( band_widths_from_specs, check_no_gap, check_no_overlap, check_nonzero_bandwidth, ) class BaseNormMLP(nn.Module): def...
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/core/model/bsrnn/tfmodel.py
core/model/bsrnn/tfmodel.py
import warnings import torch from torch import nn from torch.nn import functional as F from torch.nn.modules import rnn import torch.backends.cuda class TimeFrequencyModellingModule(nn.Module): def __init__(self) -> None: super().__init__() class ResidualRNN(nn.Module): def __init__( s...
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/core/metrics/snr.py
core/metrics/snr.py
from typing import Any, Callable import numpy as np import torch import torchmetrics as tm from torch._C import _LinAlgError from torchmetrics import functional as tmF class SafeSignalDistortionRatio(tm.SignalDistortionRatio): def __init__(self, **kwargs) -> None: super().__init__(**kwargs) def upda...
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/core/metrics/__init__.py
core/metrics/__init__.py
from .snr import ( ChunkMedianScaleInvariantSignalDistortionRatio, ChunkMedianScaleInvariantSignalNoiseRatio, ChunkMedianSignalDistortionRatio, ChunkMedianSignalNoiseRatio, SafeSignalDistortionRatio, ) # from .mushra import EstimatedMushraScore
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/core/metrics/_squim.py
core/metrics/_squim.py
from dataclasses import dataclass from torchaudio._internal import load_state_dict_from_url import math from typing import List, Optional, Tuple import torch import torch.nn as nn import torch.nn.functional as F def transform_wb_pesq_range(x: float) -> float: """The metric defined by ITU-T P.862 is often calle...
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/core/utils/audio.py
core/utils/audio.py
from collections import defaultdict from tqdm import tqdm from typing import Callable, Dict, List, Optional, Tuple import numpy as np import torch from torch import nn from torch.nn import functional as F @torch.jit.script def merge( combined: torch.Tensor, original_batch_size: int, n_channe...
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/core/utils/__init__.py
core/utils/__init__.py
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/core/data/_types.py
core/data/_types.py
from typing import Dict, Sequence, TypedDict import torch AudioDict = Dict[str, torch.Tensor] DataDict = TypedDict('DataDict', {'audio': AudioDict, 'track': str}) BatchedDataDict = TypedDict( 'BatchedDataDict', {'audio': AudioDict, 'track': Sequence[str]} ) class DataDictWithLanguage(TypedDict): ...
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/core/data/augmentation.py
core/data/augmentation.py
from abc import ABC from typing import Any, Dict, Union import torch import torch_audiomentations as tam from torch import nn from core.data._types import BatchedDataDict, DataDict class BaseAugmentor(nn.Module, ABC): def forward(self, item: Union[DataDict, BatchedDataDict]) -> Union[ DataDict, BatchedD...
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/core/data/augmented.py
core/data/augmented.py
import warnings from typing import Dict, Optional, Union import torch from torch import nn from torch.utils import data class AugmentedDataset(data.Dataset): def __init__( self, dataset: data.Dataset, augmentation: nn.Module = nn.Identity(), target_length: Optional...
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/core/data/__init__.py
core/data/__init__.py
from .dnr.datamodule import DivideAndRemasterDataModule from .musdb.datamodule import MUSDB18DataModule
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/core/data/base.py
core/data/base.py
import os from abc import ABC, abstractmethod from typing import Any, Dict, List, Optional import numpy as np import pedalboard as pb import torch import torchaudio as ta from torch.utils import data from core.data._types import AudioDict, DataDict class BaseSourceSeparationDataset(data.Dataset, ABC): def __ini...
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/core/data/musdb/datamodule.py
core/data/musdb/datamodule.py
import os.path from typing import Mapping, Optional import pytorch_lightning as pl from core.data.musdb.dataset import ( MUSDB18BaseDataset, MUSDB18FullTrackDataset, MUSDB18SadDataset, MUSDB18SadOnTheFlyAugmentedDataset ) def MUSDB18DataModule( data_root: str = "$DATA_ROOT/MUSDB18/HQ", ...
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/core/data/musdb/dataset.py
core/data/musdb/dataset.py
import os from abc import ABC from typing import List, Optional, Tuple import numpy as np import torch import torchaudio as ta from torch.utils import data from core.data._types import AudioDict, DataDict from core.data.base import BaseSourceSeparationDataset class MUSDB18BaseDataset(BaseSourceSeparationDataset, AB...
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/core/data/musdb/__init__.py
core/data/musdb/__init__.py
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/core/data/musdb/preprocess.py
core/data/musdb/preprocess.py
import glob import os import numpy as np import torch import torchaudio as ta from torch import nn from torch.nn import functional as F from tqdm.contrib.concurrent import process_map from core.data._types import DataDict from core.data.musdb.dataset import MUSDB18FullTrackDataset import pyloudnorm as pyln class Sou...
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/core/data/dnr/datamodule.py
core/data/dnr/datamodule.py
import os from typing import Mapping, Optional import pytorch_lightning as pl from .dataset import ( DivideAndRemasterDataset, DivideAndRemasterDeterministicChunkDataset, DivideAndRemasterRandomChunkDataset, DivideAndRemasterRandomChunkDatasetWithSpeechReverb ) def DivideAndRemasterDataModule( ...
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/core/data/dnr/dataset.py
core/data/dnr/dataset.py
import os from abc import ABC from typing import Any, Dict, List, Optional import numpy as np import pedalboard as pb import torch import torchaudio as ta from torch.utils import data from core.data._types import AudioDict, DataDict from core.data.base import BaseSourceSeparationDataset class DivideAndRemasterBaseD...
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/core/data/dnr/__init__.py
core/data/dnr/__init__.py
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
kwatcharasupat/bandit
https://github.com/kwatcharasupat/bandit/blob/840d5eb9ede59d64569c423244547e58cb00f647/core/data/dnr/preprocess.py
core/data/dnr/preprocess.py
import glob import os from typing import Tuple import numpy as np import torchaudio as ta from tqdm.contrib.concurrent import process_map def process_one(inputs: Tuple[str, str, int]) -> None: infile, outfile, target_fs = inputs dir = os.path.dirname(outfile) os.makedirs(dir, exist_ok=True) data, f...
python
Apache-2.0
840d5eb9ede59d64569c423244547e58cb00f647
2026-01-05T07:09:41.880199Z
false
chflame163/ComfyUI_OmniGen_Wrapper
https://github.com/chflame163/ComfyUI_OmniGen_Wrapper/blob/eef733050b60c23bf6d6010693fdb2bb04cbd0fd/__init__.py
__init__.py
import importlib.util import glob import os import sys import __main__ import shutil NODE_CLASS_MAPPINGS = {} NODE_DISPLAY_NAME_MAPPINGS = {} python = sys.executable def get_ext_dir(subpath=None, mkdir=False): dir = os.path.dirname(__file__) if subpath is not None: dir = os.path.join(dir, subpath) ...
python
MIT
eef733050b60c23bf6d6010693fdb2bb04cbd0fd
2026-01-05T07:09:44.916635Z
false
chflame163/ComfyUI_OmniGen_Wrapper
https://github.com/chflame163/ComfyUI_OmniGen_Wrapper/blob/eef733050b60c23bf6d6010693fdb2bb04cbd0fd/py/omnigen.py
py/omnigen.py
import os import sys sys.path.append(os.path.dirname(__file__)) import torch import numpy as np import random import shutil import tempfile from PIL import Image from huggingface_hub import snapshot_download import folder_paths from .OmniGen import OmniGenPipeline model_path = os.path.join(folder_paths.models_dir, "O...
python
MIT
eef733050b60c23bf6d6010693fdb2bb04cbd0fd
2026-01-05T07:09:44.916635Z
false
chflame163/ComfyUI_OmniGen_Wrapper
https://github.com/chflame163/ComfyUI_OmniGen_Wrapper/blob/eef733050b60c23bf6d6010693fdb2bb04cbd0fd/py/OmniGen/model.py
py/OmniGen/model.py
# The code is revised from DiT import os import torch import torch.nn as nn import numpy as np import math from typing import Dict import torch.nn.functional as F from diffusers.loaders import PeftAdapterMixin from timm.models.vision_transformer import PatchEmbed, Attention, Mlp from huggingface_hub import snapshot_do...
python
MIT
eef733050b60c23bf6d6010693fdb2bb04cbd0fd
2026-01-05T07:09:44.916635Z
false
chflame163/ComfyUI_OmniGen_Wrapper
https://github.com/chflame163/ComfyUI_OmniGen_Wrapper/blob/eef733050b60c23bf6d6010693fdb2bb04cbd0fd/py/OmniGen/processor.py
py/OmniGen/processor.py
import os import re from typing import Dict, List import json import torch import numpy as np import random from PIL import Image from torchvision import transforms from transformers import AutoTokenizer from huggingface_hub import snapshot_download from OmniGen.utils import ( create_logger, update_ema, r...
python
MIT
eef733050b60c23bf6d6010693fdb2bb04cbd0fd
2026-01-05T07:09:44.916635Z
false
chflame163/ComfyUI_OmniGen_Wrapper
https://github.com/chflame163/ComfyUI_OmniGen_Wrapper/blob/eef733050b60c23bf6d6010693fdb2bb04cbd0fd/py/OmniGen/utils.py
py/OmniGen/utils.py
import logging from PIL import Image import torch import numpy as np def create_logger(logging_dir): """ Create a logger that writes to a log file and stdout. """ logging.basicConfig( level=logging.INFO, format='[\033[34m%(asctime)s\033[0m] %(message)s', datefmt='%Y-%m-%d %H:%M...
python
MIT
eef733050b60c23bf6d6010693fdb2bb04cbd0fd
2026-01-05T07:09:44.916635Z
false
chflame163/ComfyUI_OmniGen_Wrapper
https://github.com/chflame163/ComfyUI_OmniGen_Wrapper/blob/eef733050b60c23bf6d6010693fdb2bb04cbd0fd/py/OmniGen/pipeline.py
py/OmniGen/pipeline.py
import os import inspect from typing import Any, Callable, Dict, List, Optional, Union import gc from PIL import Image import numpy as np import torch from huggingface_hub import snapshot_download from peft import LoraConfig, PeftModel from diffusers.models import AutoencoderKL from diffusers.utils import ( USE_PE...
python
MIT
eef733050b60c23bf6d6010693fdb2bb04cbd0fd
2026-01-05T07:09:44.916635Z
false
chflame163/ComfyUI_OmniGen_Wrapper
https://github.com/chflame163/ComfyUI_OmniGen_Wrapper/blob/eef733050b60c23bf6d6010693fdb2bb04cbd0fd/py/OmniGen/__init__.py
py/OmniGen/__init__.py
from .model import OmniGen from .processor import OmniGenProcessor from .scheduler import OmniGenScheduler from .pipeline import OmniGenPipeline
python
MIT
eef733050b60c23bf6d6010693fdb2bb04cbd0fd
2026-01-05T07:09:44.916635Z
false
chflame163/ComfyUI_OmniGen_Wrapper
https://github.com/chflame163/ComfyUI_OmniGen_Wrapper/blob/eef733050b60c23bf6d6010693fdb2bb04cbd0fd/py/OmniGen/transformer.py
py/OmniGen/transformer.py
import math import warnings from typing import List, Optional, Tuple, Union import torch import torch.utils.checkpoint from torch import nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from huggingface_hub import snapshot_download from transformers.modeling_outputs import ( BaseModelOutputWit...
python
MIT
eef733050b60c23bf6d6010693fdb2bb04cbd0fd
2026-01-05T07:09:44.916635Z
false
chflame163/ComfyUI_OmniGen_Wrapper
https://github.com/chflame163/ComfyUI_OmniGen_Wrapper/blob/eef733050b60c23bf6d6010693fdb2bb04cbd0fd/py/OmniGen/scheduler.py
py/OmniGen/scheduler.py
from tqdm import tqdm from typing import Optional, Dict, Any, Tuple, List import gc import torch from transformers.cache_utils import Cache, DynamicCache, OffloadedCache class OmniGenCache(DynamicCache): def __init__(self, num_tokens_for_img: int, offload_kv_cache: bool=False) -> None: ...
python
MIT
eef733050b60c23bf6d6010693fdb2bb04cbd0fd
2026-01-05T07:09:44.916635Z
false
chflame163/ComfyUI_OmniGen_Wrapper
https://github.com/chflame163/ComfyUI_OmniGen_Wrapper/blob/eef733050b60c23bf6d6010693fdb2bb04cbd0fd/py/OmniGen/train_helper/loss.py
py/OmniGen/train_helper/loss.py
import torch def sample_x0(x1): """Sampling x0 & t based on shape of x1 (if needed) Args: x1 - data point; [batch, *dim] """ if isinstance(x1, (list, tuple)): x0 = [torch.randn_like(img_start) for img_start in x1] else: x0 = torch.randn_like(x1) return x0 def sample_tim...
python
MIT
eef733050b60c23bf6d6010693fdb2bb04cbd0fd
2026-01-05T07:09:44.916635Z
false
chflame163/ComfyUI_OmniGen_Wrapper
https://github.com/chflame163/ComfyUI_OmniGen_Wrapper/blob/eef733050b60c23bf6d6010693fdb2bb04cbd0fd/py/OmniGen/train_helper/__init__.py
py/OmniGen/train_helper/__init__.py
from .data import DatasetFromJson, TrainDataCollator from .loss import training_losses
python
MIT
eef733050b60c23bf6d6010693fdb2bb04cbd0fd
2026-01-05T07:09:44.916635Z
false
chflame163/ComfyUI_OmniGen_Wrapper
https://github.com/chflame163/ComfyUI_OmniGen_Wrapper/blob/eef733050b60c23bf6d6010693fdb2bb04cbd0fd/py/OmniGen/train_helper/data.py
py/OmniGen/train_helper/data.py
import os import datasets from datasets import load_dataset, ClassLabel, concatenate_datasets import torch import numpy as np import random from PIL import Image import json import copy # import torchvision.transforms as T from torchvision import transforms import pickle import re from OmniGen import OmniGenProcessor...
python
MIT
eef733050b60c23bf6d6010693fdb2bb04cbd0fd
2026-01-05T07:09:44.916635Z
false
peterbe/django-fancy-cache
https://github.com/peterbe/django-fancy-cache/blob/66fc6cb5d6914ef689b72950eb404f39836e8506/setup.py
setup.py
import codecs import os import re # Prevent spurious errors during `python setup.py test`, a la # http://www.eby-sarna.com/pipermail/peak/2010-May/003357.html: try: import multiprocessing except ImportError: pass from setuptools import setup, find_packages def read(*parts): content = codecs.open( ...
python
BSD-3-Clause
66fc6cb5d6914ef689b72950eb404f39836e8506
2026-01-05T07:09:45.763132Z
false
peterbe/django-fancy-cache
https://github.com/peterbe/django-fancy-cache/blob/66fc6cb5d6914ef689b72950eb404f39836e8506/runtests.py
runtests.py
import os import sys import django from django.test.utils import get_runner from django.conf import settings def runtests(): test_dir = os.path.join(os.path.dirname(__file__), "fancy_tests/tests") sys.path.insert(0, test_dir) os.environ["DJANGO_SETTINGS_MODULE"] = "settings" django.setup() Test...
python
BSD-3-Clause
66fc6cb5d6914ef689b72950eb404f39836e8506
2026-01-05T07:09:45.763132Z
false
peterbe/django-fancy-cache
https://github.com/peterbe/django-fancy-cache/blob/66fc6cb5d6914ef689b72950eb404f39836e8506/fabfile.py
fabfile.py
""" This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. """ import os from fabric.api import local ROOT = os.path.abspath(os.path.dirname(__file__)) os.environ["PYTHONPATH"] = ...
python
BSD-3-Clause
66fc6cb5d6914ef689b72950eb404f39836e8506
2026-01-05T07:09:45.763132Z
false
peterbe/django-fancy-cache
https://github.com/peterbe/django-fancy-cache/blob/66fc6cb5d6914ef689b72950eb404f39836e8506/fancy_tests/__init__.py
fancy_tests/__init__.py
python
BSD-3-Clause
66fc6cb5d6914ef689b72950eb404f39836e8506
2026-01-05T07:09:45.763132Z
false
peterbe/django-fancy-cache
https://github.com/peterbe/django-fancy-cache/blob/66fc6cb5d6914ef689b72950eb404f39836e8506/fancy_tests/tests/views.py
fancy_tests/tests/views.py
import uuid from django.shortcuts import render from django.views.decorators.cache import never_cache from fancy_cache import cache_page def _view(request): random_string = uuid.uuid4().hex return render(request, "home.html", dict(random_string=random_string)) @cache_page(60) def home(request): return _...
python
BSD-3-Clause
66fc6cb5d6914ef689b72950eb404f39836e8506
2026-01-05T07:09:45.763132Z
false
peterbe/django-fancy-cache
https://github.com/peterbe/django-fancy-cache/blob/66fc6cb5d6914ef689b72950eb404f39836e8506/fancy_tests/tests/test_utils.py
fancy_tests/tests/test_utils.py
import time import unittest from django.core.cache import cache from fancy_cache.constants import REMEMBERED_URLS_KEY from fancy_cache.utils import filter_remembered_urls class TestUtils(unittest.TestCase): def setUp(self): expiration_time = int(time.time()) + 5 self.urls = { "/page1...
python
BSD-3-Clause
66fc6cb5d6914ef689b72950eb404f39836e8506
2026-01-05T07:09:45.763132Z
false
peterbe/django-fancy-cache
https://github.com/peterbe/django-fancy-cache/blob/66fc6cb5d6914ef689b72950eb404f39836e8506/fancy_tests/tests/test_views.py
fancy_tests/tests/test_views.py
import time import unittest import re from nose.tools import eq_, ok_ from django.test.client import RequestFactory from django.core.cache import cache, caches from unittest import mock from fancy_cache.constants import REMEMBERED_URLS_KEY from fancy_cache.memory import find_urls from . import views class TestView...
python
BSD-3-Clause
66fc6cb5d6914ef689b72950eb404f39836e8506
2026-01-05T07:09:45.763132Z
false
peterbe/django-fancy-cache
https://github.com/peterbe/django-fancy-cache/blob/66fc6cb5d6914ef689b72950eb404f39836e8506/fancy_tests/tests/models.py
fancy_tests/tests/models.py
# lonely in here
python
BSD-3-Clause
66fc6cb5d6914ef689b72950eb404f39836e8506
2026-01-05T07:09:45.763132Z
false
peterbe/django-fancy-cache
https://github.com/peterbe/django-fancy-cache/blob/66fc6cb5d6914ef689b72950eb404f39836e8506/fancy_tests/tests/test_command.py
fancy_tests/tests/test_command.py
import time from django.test import TestCase from nose.tools import ok_ from django.core.cache import cache from django.core.management import call_command from io import StringIO from fancy_cache.constants import REMEMBERED_URLS_KEY class TestBaseCommand(TestCase): def setUp(self): expiration_time = int...
python
BSD-3-Clause
66fc6cb5d6914ef689b72950eb404f39836e8506
2026-01-05T07:09:45.763132Z
false
peterbe/django-fancy-cache
https://github.com/peterbe/django-fancy-cache/blob/66fc6cb5d6914ef689b72950eb404f39836e8506/fancy_tests/tests/settings.py
fancy_tests/tests/settings.py
import os BASE_DIR = os.path.dirname(os.path.dirname(__file__)) SECRET_KEY = "anything" ALLOWED_HOSTS = ("testserver",) DATABASES = { "default": { "NAME": ":memory:", "ENGINE": "django.db.backends.sqlite3", } } CACHES = { "default": { "BACKEND": "django.core.cache.backends.locme...
python
BSD-3-Clause
66fc6cb5d6914ef689b72950eb404f39836e8506
2026-01-05T07:09:45.763132Z
false
peterbe/django-fancy-cache
https://github.com/peterbe/django-fancy-cache/blob/66fc6cb5d6914ef689b72950eb404f39836e8506/fancy_tests/tests/test_memory.py
fancy_tests/tests/test_memory.py
import json import mock import time import unittest import zlib from nose.tools import eq_, ok_ from django.core.cache import cache, caches from unittest import mock from fancy_cache.constants import REMEMBERED_URLS_KEY from fancy_cache.memory import find_urls class TestMemory(unittest.TestCase): def setUp(self...
python
BSD-3-Clause
66fc6cb5d6914ef689b72950eb404f39836e8506
2026-01-05T07:09:45.763132Z
false
peterbe/django-fancy-cache
https://github.com/peterbe/django-fancy-cache/blob/66fc6cb5d6914ef689b72950eb404f39836e8506/fancy_tests/tests/__init__.py
fancy_tests/tests/__init__.py
python
BSD-3-Clause
66fc6cb5d6914ef689b72950eb404f39836e8506
2026-01-05T07:09:45.763132Z
false
peterbe/django-fancy-cache
https://github.com/peterbe/django-fancy-cache/blob/66fc6cb5d6914ef689b72950eb404f39836e8506/fancy_tests/tests/urls.py
fancy_tests/tests/urls.py
from django.urls import path from . import views urlpatterns = [path("", views.home, name="home")]
python
BSD-3-Clause
66fc6cb5d6914ef689b72950eb404f39836e8506
2026-01-05T07:09:45.763132Z
false
peterbe/django-fancy-cache
https://github.com/peterbe/django-fancy-cache/blob/66fc6cb5d6914ef689b72950eb404f39836e8506/docs/conf.py
docs/conf.py
# -*- coding: utf-8 -*- # # django-fancy-cache documentation build configuration file, created by # sphinx-quickstart on Sun Feb 10 16:18:37 2013. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated fi...
python
BSD-3-Clause
66fc6cb5d6914ef689b72950eb404f39836e8506
2026-01-05T07:09:45.763132Z
false
peterbe/django-fancy-cache
https://github.com/peterbe/django-fancy-cache/blob/66fc6cb5d6914ef689b72950eb404f39836e8506/example/manage.py
example/manage.py
#!/usr/bin/env python import os import sys # make sure we're running the fancy_cache here and not anything installed parent = os.path.normpath(os.path.join(__file__, "../..")) sys.path.insert(0, parent) if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "example.settings") from django...
python
BSD-3-Clause
66fc6cb5d6914ef689b72950eb404f39836e8506
2026-01-05T07:09:45.763132Z
false
peterbe/django-fancy-cache
https://github.com/peterbe/django-fancy-cache/blob/66fc6cb5d6914ef689b72950eb404f39836e8506/example/example/settings.py
example/example/settings.py
# Django settings for example project. FANCY_REMEMBER_ALL_URLS = True FANCY_REMEMBER_STATS_ALL_URLS = True DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', 'your_email@example.com'), ) MANAGERS = ADMINS DATABASES = { "default": { "ENGINE": "django.db.backends.sqlite3", "NAME":...
python
BSD-3-Clause
66fc6cb5d6914ef689b72950eb404f39836e8506
2026-01-05T07:09:45.763132Z
false
peterbe/django-fancy-cache
https://github.com/peterbe/django-fancy-cache/blob/66fc6cb5d6914ef689b72950eb404f39836e8506/example/example/__init__.py
example/example/__init__.py
python
BSD-3-Clause
66fc6cb5d6914ef689b72950eb404f39836e8506
2026-01-05T07:09:45.763132Z
false
peterbe/django-fancy-cache
https://github.com/peterbe/django-fancy-cache/blob/66fc6cb5d6914ef689b72950eb404f39836e8506/example/example/wsgi.py
example/example/wsgi.py
""" WSGI config for example project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover this application via the ``WSGI_APPLICATION`` ...
python
BSD-3-Clause
66fc6cb5d6914ef689b72950eb404f39836e8506
2026-01-05T07:09:45.763132Z
false
peterbe/django-fancy-cache
https://github.com/peterbe/django-fancy-cache/blob/66fc6cb5d6914ef689b72950eb404f39836e8506/example/example/urls.py
example/example/urls.py
from django.urls import include, path urlpatterns = [ path("", include("example.app.urls")), path("fancy-cache", include("fancy_cache.urls")), ]
python
BSD-3-Clause
66fc6cb5d6914ef689b72950eb404f39836e8506
2026-01-05T07:09:45.763132Z
false
peterbe/django-fancy-cache
https://github.com/peterbe/django-fancy-cache/blob/66fc6cb5d6914ef689b72950eb404f39836e8506/example/example/app/views.py
example/example/app/views.py
import time from django.shortcuts import render, redirect from fancy_cache import cache_page from fancy_cache.memory import find_urls def home(request): remembered_urls = find_urls([]) return render(request, "home.html", {"remembered_urls": remembered_urls}) def commafy(s): r = [] for i, c in enum...
python
BSD-3-Clause
66fc6cb5d6914ef689b72950eb404f39836e8506
2026-01-05T07:09:45.763132Z
false
peterbe/django-fancy-cache
https://github.com/peterbe/django-fancy-cache/blob/66fc6cb5d6914ef689b72950eb404f39836e8506/example/example/app/models.py
example/example/app/models.py
from django.db import models # Create your models here.
python
BSD-3-Clause
66fc6cb5d6914ef689b72950eb404f39836e8506
2026-01-05T07:09:45.763132Z
false
peterbe/django-fancy-cache
https://github.com/peterbe/django-fancy-cache/blob/66fc6cb5d6914ef689b72950eb404f39836e8506/example/example/app/__init__.py
example/example/app/__init__.py
python
BSD-3-Clause
66fc6cb5d6914ef689b72950eb404f39836e8506
2026-01-05T07:09:45.763132Z
false
peterbe/django-fancy-cache
https://github.com/peterbe/django-fancy-cache/blob/66fc6cb5d6914ef689b72950eb404f39836e8506/example/example/app/tests.py
example/example/app/tests.py
""" This file demonstrates writing tests using the unittest module. These will pass when you run "manage.py test". Replace this with more appropriate tests for your application. """ from django.test import TestCase class SimpleTest(TestCase): def test_basic_addition(self): """ Tests that 1 + 1 a...
python
BSD-3-Clause
66fc6cb5d6914ef689b72950eb404f39836e8506
2026-01-05T07:09:45.763132Z
false
peterbe/django-fancy-cache
https://github.com/peterbe/django-fancy-cache/blob/66fc6cb5d6914ef689b72950eb404f39836e8506/example/example/app/urls.py
example/example/app/urls.py
from django.urls import path from . import views urlpatterns = [ path("", views.home, name="home"), path("page1.html", views.page1, name="page1"), path("page2.html", views.page2, name="page2"), path("page3.html", views.page3, name="page3"), path("page4.html", views.page4, name="page4"), path("p...
python
BSD-3-Clause
66fc6cb5d6914ef689b72950eb404f39836e8506
2026-01-05T07:09:45.763132Z
false
peterbe/django-fancy-cache
https://github.com/peterbe/django-fancy-cache/blob/66fc6cb5d6914ef689b72950eb404f39836e8506/fancy_cache/views.py
fancy_cache/views.py
from django.shortcuts import render from django.conf import settings from fancy_cache.memory import find_urls def home(request): data = { "found": find_urls([]), "remember_all_urls_setting": getattr( settings, "FANCY_REMEMBER_ALL_URLS", False ), "remember_stats_all_url...
python
BSD-3-Clause
66fc6cb5d6914ef689b72950eb404f39836e8506
2026-01-05T07:09:45.763132Z
false
peterbe/django-fancy-cache
https://github.com/peterbe/django-fancy-cache/blob/66fc6cb5d6914ef689b72950eb404f39836e8506/fancy_cache/middleware.py
fancy_cache/middleware.py
""" Middleware based on Django's cache middleware. See https://github.com/django/django/blob/main/django/middleware/cache.py """ import functools import json import logging import time import typing import zlib from django.conf import settings from django.core.cache import DEFAULT_CACHE_ALIAS, caches from django.middl...
python
BSD-3-Clause
66fc6cb5d6914ef689b72950eb404f39836e8506
2026-01-05T07:09:45.763132Z
false
peterbe/django-fancy-cache
https://github.com/peterbe/django-fancy-cache/blob/66fc6cb5d6914ef689b72950eb404f39836e8506/fancy_cache/constants.py
fancy_cache/constants.py
REMEMBERED_URLS_KEY = "fancy-urls" LONG_TIME = 60 * 60 * 24 * 30
python
BSD-3-Clause
66fc6cb5d6914ef689b72950eb404f39836e8506
2026-01-05T07:09:45.763132Z
false
peterbe/django-fancy-cache
https://github.com/peterbe/django-fancy-cache/blob/66fc6cb5d6914ef689b72950eb404f39836e8506/fancy_cache/memory.py
fancy_cache/memory.py
import json import logging import re import typing import zlib from django.conf import settings from django.core.cache import cache from fancy_cache.constants import LONG_TIME, REMEMBERED_URLS_KEY from fancy_cache.middleware import USE_MEMCACHED_CAS from fancy_cache.utils import md5, filter_remembered_urls __all__ =...
python
BSD-3-Clause
66fc6cb5d6914ef689b72950eb404f39836e8506
2026-01-05T07:09:45.763132Z
false
peterbe/django-fancy-cache
https://github.com/peterbe/django-fancy-cache/blob/66fc6cb5d6914ef689b72950eb404f39836e8506/fancy_cache/utils.py
fancy_cache/utils.py
import hashlib import time import typing def md5(x) -> str: return hashlib.md5(x.encode("utf-8")).hexdigest() def filter_remembered_urls( remembered_urls: typing.Dict[str, typing.Tuple[str, int]], ) -> typing.Dict[str, typing.Tuple[str, int]]: """ Filter out any expired URLs from Fancy Cache's remem...
python
BSD-3-Clause
66fc6cb5d6914ef689b72950eb404f39836e8506
2026-01-05T07:09:45.763132Z
false
peterbe/django-fancy-cache
https://github.com/peterbe/django-fancy-cache/blob/66fc6cb5d6914ef689b72950eb404f39836e8506/fancy_cache/__init__.py
fancy_cache/__init__.py
from .cache_page import cache_page # NOQA __version__ = "1.3.1"
python
BSD-3-Clause
66fc6cb5d6914ef689b72950eb404f39836e8506
2026-01-05T07:09:45.763132Z
false
peterbe/django-fancy-cache
https://github.com/peterbe/django-fancy-cache/blob/66fc6cb5d6914ef689b72950eb404f39836e8506/fancy_cache/cache_page.py
fancy_cache/cache_page.py
import typing from django.utils.decorators import decorator_from_middleware_with_args from .middleware import FancyCacheMiddleware def cache_page( timeout: typing.Optional[float], *, cache: str = None, key_prefix: str = None, **kwargs ) -> typing.Callable: return decorator_from_middleware_wi...
python
BSD-3-Clause
66fc6cb5d6914ef689b72950eb404f39836e8506
2026-01-05T07:09:45.763132Z
false
peterbe/django-fancy-cache
https://github.com/peterbe/django-fancy-cache/blob/66fc6cb5d6914ef689b72950eb404f39836e8506/fancy_cache/urls.py
fancy_cache/urls.py
from django.urls import path from . import views urlpatterns = [ path("", views.home, name="home"), ]
python
BSD-3-Clause
66fc6cb5d6914ef689b72950eb404f39836e8506
2026-01-05T07:09:45.763132Z
false