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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
automatic-ripping-machine/automatic-ripping-machine | https://github.com/automatic-ripping-machine/automatic-ripping-machine | null | null | null | null | 4,776 | null | null | mit | null | null | null | null | null | null | null | arm/models/system_drives.py | null | null | null | null | null | null | Python | 2026-05-04T01:53:56.145385 | """Database Model for Drive Information on the System
"""
import enum
import fcntl
import logging
import os
import re
from subprocess import CalledProcessError
from arm.ripper.ProcessHandler import arm_subprocess
from arm.ui import db
class CDS(enum.Enum):
"""CD Status
ioctl defines may (not very likely) c... |
automatic-ripping-machine/automatic-ripping-machine | https://github.com/automatic-ripping-machine/automatic-ripping-machine | null | null | null | null | 4,776 | null | null | mit | null | null | null | null | null | null | null | arm/ripper/ProcessHandler.py | null | null | null | null | null | null | Python | 2026-05-04T01:53:56.519805 | """
Function definition
Wrapper for the python subprocess module
"""
import logging
import subprocess
from typing import Optional, List, Union
def arm_subprocess(cmd: Union[str, List[str]], shell=False, check=False) -> Optional[str]:
"""
Spawn blocking subprocess
:param cmd: Command to run
:param ... |
automatic-ripping-machine/automatic-ripping-machine | https://github.com/automatic-ripping-machine/automatic-ripping-machine | null | null | null | null | 4,776 | null | null | mit | null | null | null | null | null | null | null | arm/models/system_info.py | null | null | null | null | null | null | Python | 2026-05-04T01:53:56.521505 | import platform
import psutil
import re
import subprocess
import logging
from arm.ui import db
class SystemInfo(db.Model):
"""
Class to hold the system (server) information
"""
id = db.Column(db.Integer, index=True, primary_key=True)
name = db.Column(db.String(100))
cpu = db.Column(db.String(... |
automatic-ripping-machine/automatic-ripping-machine | https://github.com/automatic-ripping-machine/automatic-ripping-machine | null | null | null | null | 4,776 | null | null | mit | null | null | null | null | null | null | null | arm/models/ui_settings.py | null | null | null | null | null | null | Python | 2026-05-04T01:53:56.522820 | from arm.ui import db
class UISettings(db.Model):
"""
Class to hold the A.R.M ui settings
"""
id = db.Column(db.Integer, autoincrement=True, primary_key=True)
use_icons = db.Column(db.Boolean)
save_remote_images = db.Column(db.Boolean)
bootstrap_skin = db.Column(db.String(64))
language... |
automatic-ripping-machine/automatic-ripping-machine | https://github.com/automatic-ripping-machine/automatic-ripping-machine | null | null | null | null | 4,776 | null | null | mit | null | null | null | null | null | null | null | arm/models/user.py | null | null | null | null | null | null | Python | 2026-05-04T01:53:56.523982 | from flask_login import UserMixin
from arm.ui import db
class User(db.Model, UserMixin):
"""
Class to hold admin users
"""
user_id = db.Column(db.Integer, index=True, primary_key=True)
email = db.Column(db.String(64))
password = db.Column(db.String(128))
hash = db.Column(db.String(256))
... |
automatic-ripping-machine/automatic-ripping-machine | https://github.com/automatic-ripping-machine/automatic-ripping-machine | null | null | null | null | 4,776 | null | null | mit | null | null | null | null | null | null | null | arm/ripper/apprise_bulk.py | null | null | null | null | null | null | Python | 2026-05-04T01:53:56.856868 | """File to hold all functions pertaining to apprise"""
import logging
import yaml
import apprise
# TODO: Refactor this to leverage apprise_config stored in config.py
def build_apprise_sent(cfg):
"""
Build dict for processing
:param cfg: apprise.yaml loaded as dict
:return: dict with key -> link
""... |
automatic-ripping-machine/automatic-ripping-machine | https://github.com/automatic-ripping-machine/automatic-ripping-machine | null | null | null | null | 4,776 | null | null | mit | null | null | null | null | null | null | null | arm/ripper/ARMInfo.py | null | null | null | null | null | null | Python | 2026-05-04T01:53:56.970690 | """
Class definition
ARM system information and version numbers
"""
import os
import sys
import re
import getpass # noqa E402
import logging # noqa: E402
import sqlite3
from alembic.script import ScriptDirectory
from alembic.config import Config
from arm.ripper import ProcessHandler
class ARMInfo:
arm_version... |
automatic-ripping-machine/automatic-ripping-machine | https://github.com/automatic-ripping-machine/automatic-ripping-machine | null | null | null | null | 4,776 | null | null | mit | null | null | null | null | null | null | null | arm/ripper/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:53:56.971476 | #!/usr/bin/env python3
# """ Allows us to import from arm.ripper folder"""
from arm.ripper import logger, utils, makemkv, handbrake, identify, ARMInfo # noqa F401
|
automatic-ripping-machine/automatic-ripping-machine | https://github.com/automatic-ripping-machine/automatic-ripping-machine | null | null | null | null | 4,776 | null | null | mit | null | null | null | null | null | null | null | arm/models/track.py | null | null | null | null | null | null | Python | 2026-05-04T01:53:57.083296 | from arm.ui import db
class Track(db.Model):
""" Holds all the individual track details for each job """
track_id = db.Column(db.Integer, primary_key=True)
job_id = db.Column(db.Integer, db.ForeignKey('job.job_id'))
track_number = db.Column(db.String(4))
length = db.Column(db.Integer)
aspect_r... |
automatic-ripping-machine/automatic-ripping-machine | https://github.com/automatic-ripping-machine/automatic-ripping-machine | null | null | null | null | 4,776 | null | null | mit | null | null | null | null | null | null | null | arm/ripper/main.py | null | null | null | null | null | null | Python | 2026-05-04T01:53:57.083912 | #!/usr/bin/env python3
"""
The main runner for Automatic Ripping Machine
For help please visit https://github.com/automatic-ripping-machine/automatic-ripping-machine
"""
import argparse # noqa: E402
import logging # noqa: E402
import sys
import time # noqa: E402
import datetime # noqa: E402
import re # noqa: E402... |
automatic-ripping-machine/automatic-ripping-machine | https://github.com/automatic-ripping-machine/automatic-ripping-machine | null | null | null | null | 4,776 | null | null | mit | null | null | null | null | null | null | null | arm/ui/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:53:57.324671 | """Main arm ui file"""
import sys # noqa: F401
import os # noqa: F401
from getpass import getpass # noqa: F401
from logging.config import dictConfig
from flask import Flask, logging, current_app # noqa: F401
from flask.logging import default_handler # noqa: F401
from flask_sqlalchemy import SQLAlchemy
from flask_m... |
automatic-ripping-machine/automatic-ripping-machine | https://github.com/automatic-ripping-machine/automatic-ripping-machine | null | null | null | null | 4,776 | null | null | mit | null | null | null | null | null | null | null | arm/runui.py | null | null | null | null | null | null | Python | 2026-05-04T01:53:57.675333 | # pylint: disable=wrong-import-position
"""Main run page for armui"""
import os
import sys
import signal
# set the PATH to /arm/arm, so we can handle imports properly
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."))
import arm.config.config as cfg # noqa E402
import arm.ui.routes # no... |
automatic-ripping-machine/automatic-ripping-machine | https://github.com/automatic-ripping-machine/automatic-ripping-machine | null | null | null | null | 4,776 | null | null | mit | null | null | null | null | null | null | null | arm/ripper/utils.py | null | null | null | null | null | null | Python | 2026-05-04T01:53:57.851494 | #!/usr/bin/env python3
"""Collection of utility functions"""
import datetime
import os
import logging
import subprocess
import shutil
import time
import random
import re
from logging import Logger
from pathlib import Path, PurePath
from math import ceil
import bcrypt
import requests
import apprise
import psutil
from ... |
automatic-ripping-machine/automatic-ripping-machine | https://github.com/automatic-ripping-machine/automatic-ripping-machine | null | null | null | null | 4,776 | null | null | mit | null | null | null | null | null | null | null | arm/ripper/music_brainz.py | null | null | null | null | null | null | Python | 2026-05-04T01:53:57.932797 | #!/usr/bin/env python3
"""Module to connect to A.R.M to MusicBrainz API"""
import logging
import re
import musicbrainzngs as mb
import werkzeug
from discid import read, Disc
import arm.config.config as cfg
from arm.ripper import utils as u
werkzeug.cached_property = werkzeug.utils.cached_property
def main(disc):
... |
automatic-ripping-machine/automatic-ripping-machine | https://github.com/automatic-ripping-machine/automatic-ripping-machine | null | null | null | null | 4,776 | null | null | mit | null | null | null | null | null | null | null | arm/ripper/makemkv.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:01.930621 | #!/usr/bin/env python3
"""
Main file for dealing with connecting to MakeMKV and handling errors
Reference:
- https://www.makemkv.com/developers/usage.txt
- https://github.com/automatic-ripping-machine/automatic-ripping-machine/wiki/MakeMKV-Codes
"""
import collections
import dataclasses
import enum
import itertools
i... |
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | data_gen/tts/txt_processors/zh_g2pM.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:04.306293 | import re
import jieba
from pypinyin import pinyin, Style
from data_gen.tts.data_gen_utils import PUNCS
from data_gen.tts.txt_processors import zh
from g2pM import G2pM
ALL_SHENMU = ['zh', 'ch', 'sh', 'b', 'p', 'm', 'f', 'd', 't', 'n', 'l', 'g', 'k', 'h', 'j',
'q', 'x', 'r', 'z', 'c', 's', 'y', 'w']
ALL_... |
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | data_gen/tts/txt_processors/zh.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:04.311031 | import re
from pypinyin import pinyin, Style
from data_gen.tts.data_gen_utils import PUNCS
from data_gen.tts.txt_processors.base_text_processor import BaseTxtProcessor
from utils.text_norm import NSWNormalizer
class TxtProcessor(BaseTxtProcessor):
table = {ord(f): ord(t) for f, t in zip(
u':,。!?【】()%#@&12... |
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | data_gen/tts/txt_processors/base_text_processor.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:04.321433 | class BaseTxtProcessor:
@staticmethod
def sp_phonemes():
return ['|']
@classmethod
def process(cls, txt, pre_align_args):
raise NotImplementedError
|
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | data_gen/tts/base_binarizer.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:04.325683 | import os
os.environ["OMP_NUM_THREADS"] = "1"
from utils.multiprocess_utils import chunked_multiprocess_run
import random
import traceback
import json
from resemblyzer import VoiceEncoder
from tqdm import tqdm
from data_gen.tts.data_gen_utils import get_mel2ph, get_pitch, build_phone_encoder
from utils.hparams import ... |
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | data_gen/tts/txt_processors/en.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:04.326300 | import re
from data_gen.tts.data_gen_utils import PUNCS
from g2p_en import G2p
import unicodedata
from g2p_en.expand import normalize_numbers
from nltk import pos_tag
from nltk.tokenize import TweetTokenizer
from data_gen.tts.txt_processors.base_text_processor import BaseTxtProcessor
class EnG2p(G2p):
word_token... |
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | data_gen/singing/binarize.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:04.336038 | import os
import random
from copy import deepcopy
import pandas as pd
import logging
from tqdm import tqdm
import json
import glob
import re
from resemblyzer import VoiceEncoder
import traceback
import numpy as np
import pretty_midi
import librosa
from scipy.interpolate import interp1d
import torch
from textgrid import... |
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | data_gen/tts/bin/binarize.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:04.349015 | import os
os.environ["OMP_NUM_THREADS"] = "1"
import importlib
from utils.hparams import set_hparams, hparams
def binarize():
binarizer_cls = hparams.get("binarizer_cls", 'data_gen.tts.base_binarizer.BaseBinarizer')
pkg = ".".join(binarizer_cls.split(".")[:-1])
cls_name = binarizer_cls.split(".")[-1]
... |
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | inference/svs/base_svs_infer.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:04.350521 | import os
import torch
import numpy as np
from modules.hifigan.hifigan import HifiGanGenerator
from vocoders.hifigan import HifiGAN
from inference.svs.opencpop.map import cpop_pinyin2ph_func
from utils import load_ckpt
from utils.hparams import set_hparams, hparams
from utils.text_encoder import TokenTextEncoder
from... |
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | data_gen/tts/binarizer_zh.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:04.364503 | import os
os.environ["OMP_NUM_THREADS"] = "1"
from data_gen.tts.txt_processors.zh_g2pM import ALL_SHENMU
from data_gen.tts.base_binarizer import BaseBinarizer, BinarizationError
from data_gen.tts.data_gen_utils import get_mel2ph
from utils.hparams import set_hparams, hparams
import numpy as np
class ZhBinarizer(Bas... |
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | data_gen/tts/data_gen_utils.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:04.366205 | import warnings
warnings.filterwarnings("ignore")
import parselmouth
import os
import torch
from skimage.transform import resize
from utils.text_encoder import TokenTextEncoder
from utils.pitch_utils import f0_to_coarse
import struct
import webrtcvad
from scipy.ndimage.morphology import binary_dilation
import librosa... |
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | inference/svs/opencpop/map.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:04.906610 | def cpop_pinyin2ph_func():
# In the README file of opencpop dataset, they defined a "pinyin to phoneme mapping table"
pinyin2phs = {'AP': 'AP', 'SP': 'SP'}
with open('inference/svs/opencpop/cpop_pinyin2ph.txt') as rf:
for line in rf.readlines():
elements = [x.strip() for x in line.split(... |
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | inference/svs/gradio/infer.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:04.934530 | import importlib
import re
import gradio as gr
import yaml
from gradio.inputs import Textbox
from inference.svs.base_svs_infer import BaseSVSInfer
from utils.hparams import set_hparams
from utils.hparams import hparams as hp
import numpy as np
class GradioInfer:
def __init__(self, exp_name, inference_cls, title... |
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | inference/svs/ds_cascade.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:04.936220 | import torch
# from inference.tts.fs import FastSpeechInfer
# from modules.tts.fs2_orig import FastSpeech2Orig
from inference.svs.base_svs_infer import BaseSVSInfer
from utils import load_ckpt
from utils.hparams import hparams
from usr.diff.shallow_diffusion_tts import GaussianDiffusion
from usr.diffsinger_task import ... |
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | modules/commons/espnet_positional_embedding.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:04.962158 | import math
import torch
class PositionalEncoding(torch.nn.Module):
"""Positional encoding.
Args:
d_model (int): Embedding dimension.
dropout_rate (float): Dropout rate.
max_len (int): Maximum input length.
reverse (bool): Whether to reverse the input position.
"""
def... |
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | inference/svs/ds_e2e.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:04.970428 | import torch
# from inference.tts.fs import FastSpeechInfer
# from modules.tts.fs2_orig import FastSpeech2Orig
from inference.svs.base_svs_infer import BaseSVSInfer
from utils import load_ckpt
from utils.hparams import hparams
from usr.diff.shallow_diffusion_tts import GaussianDiffusion
from usr.diffsinger_task import ... |
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | modules/diffsinger_midi/fs2.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:04.971504 | from modules.commons.common_layers import *
from modules.commons.common_layers import Embedding
from modules.fastspeech.tts_modules import FastspeechDecoder, DurationPredictor, LengthRegulator, PitchPredictor, \
EnergyPredictor, FastspeechEncoder
from utils.cwt import cwt2f0
from utils.hparams import hparams
from u... |
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | modules/commons/ssim.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:04.979724 | # '''
# https://github.com/One-sixth/ms_ssim_pytorch/blob/master/ssim.py
# '''
#
# import torch
# import torch.jit
# import torch.nn.functional as F
#
#
# @torch.jit.script
# def create_window(window_size: int, sigma: float, channel: int):
# '''
# Create 1-D gauss kernel
# :param window_size: the size of ga... |
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | modules/commons/common_layers.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:04.990306 | import math
import torch
from torch import nn
from torch.nn import Parameter
import torch.onnx.operators
import torch.nn.functional as F
import utils
class Reshape(nn.Module):
def __init__(self, *args):
super(Reshape, self).__init__()
self.shape = args
def forward(self, x):
return x.v... |
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | modules/fastspeech/fs2.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:05.019348 | from modules.commons.common_layers import *
from modules.commons.common_layers import Embedding
from modules.fastspeech.tts_modules import FastspeechDecoder, DurationPredictor, LengthRegulator, PitchPredictor, \
EnergyPredictor, FastspeechEncoder
from utils.cwt import cwt2f0
from utils.hparams import hparams
from u... |
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | modules/fastspeech/pe.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:06.172508 | from modules.commons.common_layers import *
from utils.hparams import hparams
from modules.fastspeech.tts_modules import PitchPredictor
from utils.pitch_utils import denorm_f0
class Prenet(nn.Module):
def __init__(self, in_dim=80, out_dim=256, kernel=5, n_layers=3, strides=None):
super(Prenet, self).__ini... |
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | modules/fastspeech/tts_modules.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:06.182801 | import logging
import math
import torch
import torch.nn as nn
from torch.nn import functional as F
from modules.commons.espnet_positional_embedding import RelPositionalEncoding
from modules.commons.common_layers import SinusoidalPositionalEmbedding, Linear, EncSALayer, DecSALayer, BatchNorm1dTBC
from utils.hparams im... |
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | modules/hifigan/mel_utils.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:06.188724 | import numpy as np
import torch
import torch.utils.data
from librosa.filters import mel as librosa_mel_fn
from scipy.io.wavfile import read
MAX_WAV_VALUE = 32768.0
def load_wav(full_path):
sampling_rate, data = read(full_path)
return data, sampling_rate
def dynamic_range_compression(x, C=1, clip_val=1e-5):... |
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | modules/hifigan/hifigan.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:06.191315 | import torch
import torch.nn.functional as F
import torch.nn as nn
from torch.nn import Conv1d, ConvTranspose1d, AvgPool1d, Conv2d
from torch.nn.utils import weight_norm, remove_weight_norm, spectral_norm
from modules.parallel_wavegan.layers import UpsampleNetwork, ConvInUpsampleNetwork
from modules.parallel_wavegan.m... |
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | modules/parallel_wavegan/layers/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:06.197761 | from .causal_conv import * # NOQA
from .pqmf import * # NOQA
from .residual_block import * # NOQA
from modules.parallel_wavegan.layers.residual_stack import * # NOQA
from .upsample import * # NOQA
|
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | modules/parallel_wavegan/layers/causal_conv.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:06.198930 | # -*- coding: utf-8 -*-
# Copyright 2020 Tomoki Hayashi
# MIT License (https://opensource.org/licenses/MIT)
"""Causal convolusion layer modules."""
import torch
class CausalConv1d(torch.nn.Module):
"""CausalConv1d module with customized initialization."""
def __init__(self, in_channels, out_channels, ke... |
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | modules/parallel_wavegan/layers/residual_stack.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:06.783185 | # -*- coding: utf-8 -*-
# Copyright 2020 Tomoki Hayashi
# MIT License (https://opensource.org/licenses/MIT)
"""Residual stack module in MelGAN."""
import torch
from . import CausalConv1d
class ResidualStack(torch.nn.Module):
"""Residual stack module introduced in MelGAN."""
def __init__(self,
... |
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | modules/parallel_wavegan/layers/pqmf.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:06.793147 | # -*- coding: utf-8 -*-
# Copyright 2020 Tomoki Hayashi
# MIT License (https://opensource.org/licenses/MIT)
"""Pseudo QMF modules."""
import numpy as np
import torch
import torch.nn.functional as F
from scipy.signal import kaiser
def design_prototype_filter(taps=62, cutoff_ratio=0.15, beta=9.0):
"""Design pr... |
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | modules/parallel_wavegan/layers/residual_block.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:06.963183 | # -*- coding: utf-8 -*-
"""Residual block module in WaveNet.
This code is modified from https://github.com/r9y9/wavenet_vocoder.
"""
import math
import torch
import torch.nn.functional as F
class Conv1d(torch.nn.Conv1d):
"""Conv1d module with customized initialization."""
def __init__(self, *args, **kwa... |
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | modules/parallel_wavegan/losses/stft_loss.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:06.968939 | # -*- coding: utf-8 -*-
# Copyright 2019 Tomoki Hayashi
# MIT License (https://opensource.org/licenses/MIT)
"""STFT-based Loss modules."""
import torch
import torch.nn.functional as F
def stft(x, fft_size, hop_size, win_length, window):
"""Perform STFT and convert to magnitude spectrogram.
Args:
... |
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | modules/parallel_wavegan/layers/tf_layers.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:06.969947 | # -*- coding: utf-8 -*-
# Copyright 2020 MINH ANH (@dathudeptrai)
# MIT License (https://opensource.org/licenses/MIT)
"""Tensorflow Layer modules complatible with pytorch."""
import tensorflow as tf
class TFReflectionPad1d(tf.keras.layers.Layer):
"""Tensorflow ReflectionPad1d module."""
def __init__(self... |
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | modules/parallel_wavegan/layers/upsample.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:06.971288 | # -*- coding: utf-8 -*-
"""Upsampling module.
This code is modified from https://github.com/r9y9/wavenet_vocoder.
"""
import numpy as np
import torch
import torch.nn.functional as F
from . import Conv1d
class Stretch2d(torch.nn.Module):
"""Stretch2d module."""
def __init__(self, x_scale, y_scale, mode="... |
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | modules/parallel_wavegan/models/parallel_wavegan.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:06.972426 | # -*- coding: utf-8 -*-
# Copyright 2019 Tomoki Hayashi
# MIT License (https://opensource.org/licenses/MIT)
"""Parallel WaveGAN Modules."""
import logging
import math
import torch
from torch import nn
from modules.parallel_wavegan.layers import Conv1d
from modules.parallel_wavegan.layers import Conv1d1x1
from mod... |
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | modules/parallel_wavegan/models/melgan.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:06.979386 | # -*- coding: utf-8 -*-
# Copyright 2020 Tomoki Hayashi
# MIT License (https://opensource.org/licenses/MIT)
"""MelGAN Modules."""
import logging
import numpy as np
import torch
from modules.parallel_wavegan.layers import CausalConv1d
from modules.parallel_wavegan.layers import CausalConvTranspose1d
from modules.p... |
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | modules/parallel_wavegan/models/source.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:07.373542 | import torch
import numpy as np
import sys
import torch.nn.functional as torch_nn_func
class SineGen(torch.nn.Module):
""" Definition of sine generator
SineGen(samp_rate, harmonic_num = 0,
sine_amp = 0.1, noise_std = 0.003,
voiced_threshold = 0,
flag_for_pulse=False)
s... |
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | modules/parallel_wavegan/stft_loss.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:07.578166 | # -*- coding: utf-8 -*-
# Copyright 2019 Tomoki Hayashi
# MIT License (https://opensource.org/licenses/MIT)
"""STFT-based Loss modules."""
import librosa
import torch
from modules.parallel_wavegan.losses import LogSTFTMagnitudeLoss, SpectralConvergengeLoss, stft
class STFTLoss(torch.nn.Module):
"""STFT loss m... |
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | modules/parallel_wavegan/optimizers/radam.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:07.578707 | # -*- coding: utf-8 -*-
"""RAdam optimizer.
This code is drived from https://github.com/LiyuanLucasLiu/RAdam.
"""
import math
import torch
from torch.optim.optimizer import Optimizer
class RAdam(Optimizer):
"""Rectified Adam optimizer."""
def __init__(self, params, lr=1e-3, betas=(0.9, 0.999), eps=1e-8, ... |
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | modules/parallel_wavegan/utils/utils.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:07.581549 | # -*- coding: utf-8 -*-
# Copyright 2019 Tomoki Hayashi
# MIT License (https://opensource.org/licenses/MIT)
"""Utility functions."""
import fnmatch
import logging
import os
import sys
import h5py
import numpy as np
def find_files(root_dir, query="*.wav", include_root_dir=True):
"""Find files recursively.
... |
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | tasks/base_task.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:07.603282 | import glob
import re
import subprocess
from datetime import datetime
import matplotlib
matplotlib.use('Agg')
from utils.hparams import hparams, set_hparams
import random
import sys
import numpy as np
import torch.distributed as dist
from pytorch_lightning.loggers import TensorBoardLogger
from utils.pl_utils import ... |
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | tasks/tts/fs2.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:07.604122 | import matplotlib
matplotlib.use('Agg')
from utils import audio
import matplotlib.pyplot as plt
from data_gen.tts.data_gen_utils import get_pitch
from tasks.tts.fs2_utils import FastSpeechDataset
from utils.cwt import cwt2f0
from utils.pl_utils import data_loader
import os
from multiprocessing.pool import Pool
from t... |
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | tasks/run.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:07.641581 | import importlib
from utils.hparams import set_hparams, hparams
def run_task():
assert hparams['task_cls'] != ''
pkg = ".".join(hparams["task_cls"].split(".")[:-1])
cls_name = hparams["task_cls"].split(".")[-1]
task_cls = getattr(importlib.import_module(pkg), cls_name)
task_cls.start()
if __name... |
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | tasks/tts/fs2_utils.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:07.670869 | import matplotlib
matplotlib.use('Agg')
import glob
import importlib
from utils.cwt import get_lf0_cwt
import os
import torch.optim
import torch.utils.data
from utils.indexed_datasets import IndexedDataset
from utils.pitch_utils import norm_interp_f0
import numpy as np
from tasks.base_task import BaseDataset
import t... |
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | tasks/tts/tts.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:07.986693 | from multiprocessing.pool import Pool
import matplotlib
from utils.pl_utils import data_loader
from utils.training_utils import RSQRTSchedule
from vocoders.base_vocoder import get_vocoder_cls, BaseVocoder
from modules.fastspeech.pe import PitchExtractor
matplotlib.use('Agg')
import os
import numpy as np
from tqdm im... |
MoonInTheRiver/DiffSinger | https://github.com/MoonInTheRiver/DiffSinger | null | null | null | null | 4,775 | null | null | mit | null | null | null | null | null | null | null | tasks/tts/pe.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:07.990302 | import matplotlib
matplotlib.use('Agg')
import torch
import numpy as np
import os
from tasks.base_task import BaseDataset
from tasks.tts.fs2 import FastSpeech2Task
from modules.fastspeech.pe import PitchExtractor
import utils
from utils.indexed_datasets import IndexedDataset
from utils.hparams import hparams
from uti... |
diafygi/acme-tiny | https://github.com/diafygi/acme-tiny | null | null | null | null | 4,767 | null | null | mit | null | null | null | null | null | null | null | tests/test_install.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:10.525626 | import unittest
import os
import sys
import tempfile
import shutil
import subprocess
class TestInstall(unittest.TestCase):
def setUp(self):
self.tempdir = tempfile.mkdtemp()
venv_cmd = ["virtualenv"] if sys.version_info[0] == 2 else ["python", "-m", "venv"]
subprocess.check_call(venv_cmd +... |
diafygi/acme-tiny | https://github.com/diafygi/acme-tiny | null | null | null | null | 4,767 | null | null | mit | null | null | null | null | null | null | null | tests/utils.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:10.526695 | import os
import sys
import json
import time
from tempfile import NamedTemporaryFile, mkdtemp
from subprocess import Popen
try:
from urllib.request import urlopen # Python 3
except ImportError: # pragma: no cover
from urllib2 import urlopen # Python 2
def gen_keys(domain):
""" Generate test account and dom... |
diafygi/acme-tiny | https://github.com/diafygi/acme-tiny | null | null | null | null | 4,767 | null | null | mit | null | null | null | null | null | null | null | acme_tiny.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:10.527345 | #!/usr/bin/env python3
# Copyright Daniel Roesler, under MIT license, see LICENSE at github.com/diafygi/acme-tiny
import argparse, subprocess, json, os, sys, base64, binascii, time, hashlib, re, copy, textwrap, logging
try:
from urllib.request import urlopen, Request # Python 3
except ImportError: # pragma: no cove... |
diafygi/acme-tiny | https://github.com/diafygi/acme-tiny | null | null | null | null | 4,767 | null | null | mit | null | null | null | null | null | null | null | tests/test_module.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:10.709079 | import os
import sys
import json
import time
import shutil
import logging
import unittest
import tempfile
from subprocess import Popen, PIPE
try:
from urllib.request import urlopen, Request # Python 3
except ImportError: # pragma: no cover
from urllib2 import urlopen, Request # Python 2
try:
from StringIO... |
miguelgrinberg/microblog | https://github.com/miguelgrinberg/microblog | null | null | null | null | 4,765 | null | null | mit | null | null | null | null | null | null | null | app/api/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:13.368880 | from flask import Blueprint
bp = Blueprint('api', __name__)
from app.api import users, errors, tokens
|
miguelgrinberg/microblog | https://github.com/miguelgrinberg/microblog | null | null | null | null | 4,765 | null | null | mit | null | null | null | null | null | null | null | app/auth/email.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:13.596146 | from flask import render_template, current_app
from flask_babel import _
from app.email import send_email
def send_password_reset_email(user):
token = user.get_reset_password_token()
send_email(_('[Microblog] Reset Your Password'),
sender=current_app.config['ADMINS'][0],
recipien... |
miguelgrinberg/microblog | https://github.com/miguelgrinberg/microblog | null | null | null | null | 4,765 | null | null | mit | null | null | null | null | null | null | null | app/api/tokens.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:13.727079 | from app import db
from app.api import bp
from app.api.auth import basic_auth, token_auth
@bp.route('/tokens', methods=['POST'])
@basic_auth.login_required
def get_token():
token = basic_auth.current_user().get_token()
db.session.commit()
return {'token': token}
@bp.route('/tokens', methods=['DELETE'])
... |
miguelgrinberg/microblog | https://github.com/miguelgrinberg/microblog | null | null | null | null | 4,765 | null | null | mit | null | null | null | null | null | null | null | app/auth/routes.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:13.792016 | from flask import render_template, redirect, url_for, flash, request
from urllib.parse import urlsplit
from flask_login import login_user, logout_user, current_user
from flask_babel import _
import sqlalchemy as sa
from app import db
from app.auth import bp
from app.auth.forms import LoginForm, RegistrationForm, \
... |
miguelgrinberg/microblog | https://github.com/miguelgrinberg/microblog | null | null | null | null | 4,765 | null | null | mit | null | null | null | null | null | null | null | app/api/auth.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:13.810497 | import sqlalchemy as sa
from flask_httpauth import HTTPBasicAuth, HTTPTokenAuth
from app import db
from app.models import User
from app.api.errors import error_response
basic_auth = HTTPBasicAuth()
token_auth = HTTPTokenAuth()
@basic_auth.verify_password
def verify_password(username, password):
user = db.session... |
miguelgrinberg/microblog | https://github.com/miguelgrinberg/microblog | null | null | null | null | 4,765 | null | null | mit | null | null | null | null | null | null | null | app/cli.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:14.008883 | import os
from flask import Blueprint
import click
bp = Blueprint('cli', __name__, cli_group=None)
@bp.cli.group()
def translate():
"""Translation and localization commands."""
pass
@translate.command()
@click.argument('lang')
def init(lang):
"""Initialize a new language."""
if os.system('pybabel e... |
miguelgrinberg/microblog | https://github.com/miguelgrinberg/microblog | null | null | null | null | 4,765 | null | null | mit | null | null | null | null | null | null | null | app/email.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:14.133518 | from threading import Thread
from flask import current_app
from flask_mail import Message
from app import mail
def send_async_email(app, msg):
with app.app_context():
mail.send(msg)
def send_email(subject, sender, recipients, text_body, html_body,
attachments=None, sync=False):
msg = ... |
miguelgrinberg/microblog | https://github.com/miguelgrinberg/microblog | null | null | null | null | 4,765 | null | null | mit | null | null | null | null | null | null | null | app/errors/handlers.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:14.326964 | from flask import render_template, request
from app import db
from app.errors import bp
from app.api.errors import error_response as api_error_response
def wants_json_response():
return request.accept_mimetypes['application/json'] >= \
request.accept_mimetypes['text/html']
@bp.app_errorhandler(404)
def ... |
miguelgrinberg/microblog | https://github.com/miguelgrinberg/microblog | null | null | null | null | 4,765 | null | null | mit | null | null | null | null | null | null | null | app/main/forms.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:14.381736 | from flask import request
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, TextAreaField
from wtforms.validators import ValidationError, DataRequired, Length
import sqlalchemy as sa
from flask_babel import _, lazy_gettext as _l
from app import db
from app.models import User
class EditProf... |
miguelgrinberg/microblog | https://github.com/miguelgrinberg/microblog | null | null | null | null | 4,765 | null | null | mit | null | null | null | null | null | null | null | app/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:14.528096 | import logging
from logging.handlers import SMTPHandler, RotatingFileHandler
import os
from flask import Flask, request, current_app
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from flask_login import LoginManager
from flask_mail import Mail
from flask_moment import Moment
from flask_babel... |
miguelgrinberg/microblog | https://github.com/miguelgrinberg/microblog | null | null | null | null | 4,765 | null | null | mit | null | null | null | null | null | null | null | app/auth/forms.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:14.555887 | from flask_wtf import FlaskForm
from flask_babel import _, lazy_gettext as _l
from wtforms import StringField, PasswordField, BooleanField, SubmitField
from wtforms.validators import ValidationError, DataRequired, Email, EqualTo
import sqlalchemy as sa
from app import db
from app.models import User
class LoginForm(Fl... |
miguelgrinberg/microblog | https://github.com/miguelgrinberg/microblog | null | null | null | null | 4,765 | null | null | mit | null | null | null | null | null | null | null | app/api/users.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:14.576432 | import sqlalchemy as sa
from flask import request, url_for, abort
from app import db
from app.models import User
from app.api import bp
from app.api.auth import token_auth
from app.api.errors import bad_request
@bp.route('/users/<int:id>', methods=['GET'])
@token_auth.login_required
def get_user(id):
return db.ge... |
miguelgrinberg/microblog | https://github.com/miguelgrinberg/microblog | null | null | null | null | 4,765 | null | null | mit | null | null | null | null | null | null | null | app/main/routes.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:14.593879 | from datetime import datetime, timezone
from flask import render_template, flash, redirect, url_for, request, g, \
current_app
from flask_login import current_user, login_required
from flask_babel import _, get_locale
import sqlalchemy as sa
from langdetect import detect, LangDetectException
from app import db
from... |
miguelgrinberg/microblog | https://github.com/miguelgrinberg/microblog | null | null | null | null | 4,765 | null | null | mit | null | null | null | null | null | null | null | app/api/errors.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:14.658502 | from werkzeug.http import HTTP_STATUS_CODES
from werkzeug.exceptions import HTTPException
from app.api import bp
def error_response(status_code, message=None):
payload = {'error': HTTP_STATUS_CODES.get(status_code, 'Unknown error')}
if message:
payload['message'] = message
return payload, status_c... |
miguelgrinberg/microblog | https://github.com/miguelgrinberg/microblog | null | null | null | null | 4,765 | null | null | mit | null | null | null | null | null | null | null | app/models.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:14.706922 | from datetime import datetime, timezone, timedelta
from hashlib import md5
import json
import secrets
from time import time
from typing import Optional
import sqlalchemy as sa
import sqlalchemy.orm as so
from flask import current_app, url_for
from flask_login import UserMixin
from werkzeug.security import generate_pass... |
miguelgrinberg/microblog | https://github.com/miguelgrinberg/microblog | null | null | null | null | 4,765 | null | null | mit | null | null | null | null | null | null | null | app/tasks.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:15.063281 | import json
import sys
import time
import sqlalchemy as sa
from flask import render_template
from rq import get_current_job
from app import create_app, db
from app.models import User, Post, Task
from app.email import send_email
app = create_app()
app.app_context().push()
def _set_task_progress(progress):
job = g... |
miguelgrinberg/microblog | https://github.com/miguelgrinberg/microblog | null | null | null | null | 4,765 | null | null | mit | null | null | null | null | null | null | null | app/search.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:15.233275 | from flask import current_app
def add_to_index(index, model):
if not current_app.elasticsearch:
return
payload = {}
for field in model.__searchable__:
payload[field] = getattr(model, field)
current_app.elasticsearch.index(index=index, id=model.id, document=payload)
def remove_from_in... |
miguelgrinberg/microblog | https://github.com/miguelgrinberg/microblog | null | null | null | null | 4,765 | null | null | mit | null | null | null | null | null | null | null | config.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:15.405942 | import os
from dotenv import load_dotenv
basedir = os.path.abspath(os.path.dirname(__file__))
load_dotenv(os.path.join(basedir, '.env'))
class Config:
SECRET_KEY = os.environ.get('SECRET_KEY') or 'you-will-never-guess'
SERVER_NAME = os.environ.get('SERVER_NAME')
SQLALCHEMY_DATABASE_URI = os.environ.get('... |
miguelgrinberg/microblog | https://github.com/miguelgrinberg/microblog | null | null | null | null | 4,765 | null | null | mit | null | null | null | null | null | null | null | app/translate.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:15.581254 | import requests
from flask import current_app
from flask_babel import _
def translate(text, source_language, dest_language):
if 'MS_TRANSLATOR_KEY' not in current_app.config or \
not current_app.config['MS_TRANSLATOR_KEY']:
return _('Error: the translation service is not configured.')
auth... |
miguelgrinberg/microblog | https://github.com/miguelgrinberg/microblog | null | null | null | null | 4,765 | null | null | mit | null | null | null | null | null | null | null | tests.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:17.546239 | #!/usr/bin/env python
from datetime import datetime, timezone, timedelta
import unittest
from app import create_app, db
from app.models import User, Post
from config import Config
class TestConfig(Config):
TESTING = True
SQLALCHEMY_DATABASE_URI = 'sqlite://'
ELASTICSEARCH_URL = None
class UserModelCase(... |
miguelgrinberg/microblog | https://github.com/miguelgrinberg/microblog | null | null | null | null | 4,765 | null | null | mit | null | null | null | null | null | null | null | microblog.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:25.102640 | import sqlalchemy as sa
import sqlalchemy.orm as so
from app import create_app, db
from app.models import User, Post, Message, Notification, Task
app = create_app()
@app.shell_context_processor
def make_shell_context():
return {'sa': sa, 'so': so, 'db': db, 'User': User, 'Post': Post,
'Message': Mess... |
miguelgrinberg/microblog | https://github.com/miguelgrinberg/microblog | null | null | null | null | 4,765 | null | null | mit | null | null | null | null | null | null | null | migrations/env.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:25.113191 | from __future__ import with_statement
from alembic import context
from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig
import logging
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
# Interpret the config ... |
jazzband/tablib | https://github.com/jazzband/tablib | null | null | null | null | 4,750 | null | null | mit | null | null | null | null | null | null | null | src/tablib/_vendor/dbfpy/header.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:27.569087 | import datetime
import io
import struct
import sys
from . import fields
from .utils import getDate
__version__ = "$Revision: 1.6 $"[11:-2]
__date__ = "$Date: 2010/09/16 05:06:39 $"[7:-2]
__all__ = ["DbfHeader"]
"""DBF header definition.
TODO:
- handle encoding of the character fields
(encoding information s... |
jazzband/tablib | https://github.com/jazzband/tablib | null | null | null | null | 4,750 | null | null | mit | null | null | null | null | null | null | null | src/tablib/_vendor/dbfpy/fields.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:27.572757 | import datetime
import struct
from functools import total_ordering
from . import utils
__version__ = "$Revision: 1.14 $"[11:-2]
__date__ = "$Date: 2009/05/26 05:16:51 $"[7:-2]
__all__ = ["lookupFor"] # field classes added at the end of the module
"""DBF fields definitions.
TODO:
- make memos work
"""
"""Histor... |
jazzband/tablib | https://github.com/jazzband/tablib | null | null | null | null | 4,750 | null | null | mit | null | null | null | null | null | null | null | src/tablib/_vendor/dbfpy/dbfnew.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:27.583121 | #!/usr/bin/python
__version__ = "$Revision: 1.4 $"[11:-2]
__date__ = "$Date: 2006/07/04 08:18:18 $"[7:-2]
__all__ = ["dbf_new"]
from .dbf import Dbf
from .fields import (
DbfCharacterFieldDef,
DbfDateFieldDef,
DbfDateTimeFieldDef,
DbfLogicalFieldDef,
DbfNumericFieldDef,
)
from .header import DbfH... |
jazzband/tablib | https://github.com/jazzband/tablib | null | null | null | null | 4,750 | null | null | mit | null | null | null | null | null | null | null | src/tablib/_vendor/dbfpy/dbf.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:27.584353 | #! /usr/bin/env python
from . import header, record
from .utils import INVALID_VALUE
__version__ = "$Revision: 1.7 $"[11:-2]
__date__ = "$Date: 2007/02/11 09:23:13 $"[7:-2]
__author__ = "Jeff Kunce <kuncej@mail.conservation.state.mo.us>"
__all__ = ["Dbf"]
"""DBF accessing helpers.
FIXME: more documentation needed
... |
jazzband/tablib | https://github.com/jazzband/tablib | null | null | null | null | 4,750 | null | null | mit | null | null | null | null | null | null | null | src/tablib/_vendor/dbfpy/record.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:27.599448 | import sys
from . import utils
__version__ = "$Revision: 1.7 $"[11:-2]
__date__ = "$Date: 2007/02/11 09:05:49 $"[7:-2]
__all__ = ["DbfRecord"]
"""DBF record definition.
"""
"""History (most recent first):
11-feb-2007 [als] __repr__: added special case for invalid field values
10-feb-2007 [als] added .rawFromS... |
jazzband/tablib | https://github.com/jazzband/tablib | null | null | null | null | 4,750 | null | null | mit | null | null | null | null | null | null | null | src/tablib/_vendor/dbfpy/utils.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:28.132281 | import datetime
import time
__version__ = "$Revision: 1.4 $"[11:-2]
__date__ = "$Date: 2007/02/11 08:57:17 $"[7:-2]
"""String utilities.
TODO:
- allow strings in getDateTime routine;
"""
"""History (most recent first):
11-feb-2007 [als] added INVALID_VALUE
10-feb-2007 [als] allow date strings padded with spac... |
jazzband/tablib | https://github.com/jazzband/tablib | null | null | null | null | 4,750 | null | null | mit | null | null | null | null | null | null | null | src/tablib/formats/_csv.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:28.199057 | """ Tablib - *SV Support.
"""
import csv
from io import StringIO
class CSVFormat:
title = 'csv'
extensions = ('csv',)
DEFAULT_DELIMITER = ','
@classmethod
def export_stream_set(cls, dataset, **kwargs):
"""Returns CSV representation of Dataset as file-like."""
stream = StringIO()... |
jazzband/tablib | https://github.com/jazzband/tablib | null | null | null | null | 4,750 | null | null | mit | null | null | null | null | null | null | null | src/tablib/exceptions.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:28.213579 | class TablibException(Exception):
"""Tablib common exception."""
class InvalidDatasetType(TablibException, TypeError):
"""Only Datasets can be added to a Databook."""
class InvalidDimensions(TablibException, ValueError):
"""The size of the column or row doesn't fit the table dimensions."""
class Inval... |
jazzband/tablib | https://github.com/jazzband/tablib | null | null | null | null | 4,750 | null | null | mit | null | null | null | null | null | null | null | src/tablib/formats/_dbf.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:28.216248 | """ Tablib - DBF Support.
"""
import io
import os
import tempfile
from .._vendor.dbfpy import dbf, dbfnew
from .._vendor.dbfpy import record as dbfrecord
class DBFFormat:
title = 'dbf'
extensions = ('csv',)
DEFAULT_ENCODING = 'utf-8'
@classmethod
def export_set(cls, dataset):
"""Returns... |
jazzband/tablib | https://github.com/jazzband/tablib | null | null | null | null | 4,750 | null | null | mit | null | null | null | null | null | null | null | src/tablib/formats/_html.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:28.226271 | """ Tablib - HTML export support.
"""
from html.parser import HTMLParser
from xml.etree import ElementTree as ET
class HTMLFormat:
BOOK_ENDINGS = 'h3'
title = 'html'
extensions = ('html', )
@classmethod
def export_set(cls, dataset):
"""HTML representation of a Dataset."""
table ... |
jazzband/tablib | https://github.com/jazzband/tablib | null | null | null | null | 4,750 | null | null | mit | null | null | null | null | null | null | null | src/tablib/formats/_df.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:28.227801 | """ Tablib - DataFrame Support.
"""
try:
from pandas import DataFrame
except ImportError:
DataFrame = None
class DataFrameFormat:
title = 'df'
extensions = ('df',)
@classmethod
def detect(cls, stream):
"""Returns True if given stream is a DataFrame."""
if DataFrame is None:
... |
jazzband/tablib | https://github.com/jazzband/tablib | null | null | null | null | 4,750 | null | null | mit | null | null | null | null | null | null | null | src/tablib/formats/_jira.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:28.235126 | """Tablib - Jira table export support.
Generates a Jira table from the dataset.
"""
class JIRAFormat:
title = 'jira'
@classmethod
def export_set(cls, dataset):
"""Formats the dataset according to the Jira table syntax:
||heading 1||heading 2||heading 3||
|col A1|col A2|col A3... |
jazzband/tablib | https://github.com/jazzband/tablib | null | null | null | null | 4,750 | null | null | mit | null | null | null | null | null | null | null | src/tablib/formats/_cli.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:28.251918 | """Tablib - Command-line Interface table export support.
Generates a representation for CLI from the dataset.
Wrapper for tabulate library.
"""
from tabulate import tabulate as Tabulate
class CLIFormat:
""" Class responsible to export to CLI Format """
title = 'cli'
DEFAULT_FMT = 'plain'
@clas... |
jazzband/tablib | https://github.com/jazzband/tablib | null | null | null | null | 4,750 | null | null | mit | null | null | null | null | null | null | null | src/tablib/formats/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:28.253556 | """ Tablib - formats
"""
from functools import partialmethod
from importlib import import_module
from importlib.util import find_spec
from ..exceptions import UnsupportedFormat
from ..utils import normalize_input
from ._csv import CSVFormat
from ._json import JSONFormat
from ._tsv import TSVFormat
uninstalled_format_... |
jazzband/tablib | https://github.com/jazzband/tablib | null | null | null | null | 4,750 | null | null | mit | null | null | null | null | null | null | null | src/tablib/core.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:28.270653 | """
tablib.core
~~~~~~~~~~~
This module implements the central Tablib objects.
:copyright: (c) 2016 by Kenneth Reitz. 2019 Jazzband.
:license: MIT, see LICENSE for more details.
"""
from copy import copy
from operator import itemgetter
from .exceptions import (
HeadersNeeded,
InvalidData... |
jazzband/tablib | https://github.com/jazzband/tablib | null | null | null | null | 4,750 | null | null | mit | null | null | null | null | null | null | null | src/tablib/formats/_json.py | null | null | null | null | null | null | Python | 2026-05-04T01:54:28.746102 | """ Tablib - JSON Support
"""
import decimal
import json
from uuid import UUID
import tablib
def serialize_objects_handler(obj):
if isinstance(obj, (decimal.Decimal, UUID)):
return str(obj)
elif hasattr(obj, 'isoformat'):
return obj.isoformat()
else:
return obj
class JSONFormat:... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.