id int64 0 458k | file_name stringlengths 4 119 | file_path stringlengths 14 227 | content stringlengths 24 9.96M | size int64 24 9.96M | language stringclasses 1
value | extension stringclasses 14
values | total_lines int64 1 219k | avg_line_length float64 2.52 4.63M | max_line_length int64 5 9.91M | alphanum_fraction float64 0 1 | repo_name stringlengths 7 101 | repo_stars int64 100 139k | repo_forks int64 0 26.4k | repo_open_issues int64 0 2.27k | repo_license stringclasses 12
values | repo_extraction_date stringclasses 433
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2,286,400 | test-rag.py | yousefmrashad_bookipedia/api/test-rag.py | import requests
url = "http://localhost:8000/chat_response/1"
# Parameters
body = {
"user_prompt": "what is their mathematical basis?",
"chat_summary": "user discussed positional encodings in transformers",
"chat": """
User: Hi! I've been reading about transformers and positional encodings. Can you ex... | 1,483 | Python | .py | 31 | 44.193548 | 233 | 0.741379 | yousefmrashad/bookipedia | 8 | 2 | 0 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,401 | test-add.py | yousefmrashad_bookipedia/api/test-add.py | import requests
url = "http://localhost:8000/add_document/5"
params = {
"url": "https://arxiv.org/pdf/2309.12871",
"lib_doc": "false"
}
response = requests.post(url, params=params) | 190 | Python | .py | 7 | 24.857143 | 46 | 0.692308 | yousefmrashad/bookipedia | 8 | 2 | 0 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,402 | root_config.py | yousefmrashad_bookipedia/api/root_config.py | # -- Setup directory for utils package -- #
import sys, os
root_path = os.path.dirname(os.path.dirname(__file__))
sys.path.append(root_path)
# =================================================== # | 200 | Python | .py | 5 | 38.4 | 55 | 0.505102 | yousefmrashad/bookipedia | 8 | 2 | 0 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,403 | api.py | yousefmrashad_bookipedia/api/api.py | # Utils
from root_config import *
from utils.init import *
# API
from fastapi import FastAPI, BackgroundTasks, Query
from fastapi.responses import StreamingResponse
from pydantic import BaseModel
import uvicorn
# TTS
from piper import PiperVoice
from utils.db_config import DB
from preprocessing.document import Docum... | 10,953 | Python | .py | 205 | 45.209756 | 302 | 0.61183 | yousefmrashad/bookipedia | 8 | 2 | 0 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,404 | test-summary.py | yousefmrashad_bookipedia/api/test-summary.py | import requests
url = "http://localhost:8000/summarize_pages/1"
params = {
"start_page":34,
"end_page":36
}
# Print response content
response = requests.get(url, params=params, stream=True)
for line in response.iter_lines():
print(line.decode('utf-8')) | 267 | Python | .py | 10 | 24.3 | 56 | 0.721569 | yousefmrashad/bookipedia | 8 | 2 | 0 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,405 | test-audio.py | yousefmrashad_bookipedia/api/test-audio.py | import pyaudio
import requests
url = "http://localhost:8000/tts"
url1 = "http://localhost:8000/tts_pages/1"
# Parameters
body = {
"text": "The dominant sequence transduction models are based on complex recurrent or convolutional neural networks that include an encoder and a decoder. The best performing models... | 1,325 | Python | .py | 43 | 24.651163 | 252 | 0.647244 | yousefmrashad/bookipedia | 8 | 2 | 0 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,406 | ac_controller.py | Jurredr_ACRL/standalone/ac_controller.py | import time
import vgamepad
import keyboard
import numpy as np
class ACController:
"""
A virtual controller for Assetto Corsa.
This class uses the vgamepad library to send inputs to the game.
"""
def __init__(self, steer_scale=[-360, 360]):
"""
Initialize the virtual controller.
... | 1,931 | Python | .py | 53 | 28.528302 | 79 | 0.625 | Jurredr/ACRL | 8 | 1 | 1 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,407 | graphs.py | Jurredr_ACRL/standalone/graphs.py | import numpy as np
import matplotlib.pyplot as plt
def plot_learning_curve(n_games, scores, figure_file):
"""
Plot the learning curve of the agent.
:param n_games: The number of games played.
:param scores: The scores of the games.
:param figure_file: The file to save the figure to.
"""
x ... | 606 | Python | .py | 16 | 33.25 | 61 | 0.676871 | Jurredr/ACRL | 8 | 1 | 1 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,408 | ac_socket.py | Jurredr_ACRL/standalone/ac_socket.py | import socket
from sac.utils.logx import colorize
class ACSocket:
"""
Socket connection with the Assetto Corsa app.
This is used to get real-time data from the game and send it to the RL model.
"""
sock = None
conn = None
addr = None
data = None
def __init__(self, host: str = "1... | 2,338 | Python | .py | 61 | 29.262295 | 93 | 0.580062 | Jurredr/ACRL | 8 | 1 | 1 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,409 | main.py | Jurredr_ACRL/standalone/main.py | import os
import numpy as np
from ac_socket import ACSocket
from gymnasium.wrappers import TimeLimit
from sac.ac_environment import AcEnv
from sac.utils.logx import colorize
from sac.sac import SacAgent
def main():
"""
The main function of the standalone application.
It will initialize the environment an... | 2,652 | Python | .py | 69 | 31.072464 | 114 | 0.616822 | Jurredr/ACRL | 8 | 1 | 1 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,410 | ac_environment.py | Jurredr_ACRL/standalone/sac/ac_environment.py | import math
from typing import Optional
import numpy as np
import gymnasium as gym
from gymnasium import spaces
from ac_controller import ACController
from ac_socket import ACSocket
from sac.utils.logx import colorize
from sac.utils.track_spline import get_heading_error, get_distance_to_center_line
class AcEnv(gym.... | 12,702 | Python | .py | 260 | 39.507692 | 177 | 0.619448 | Jurredr/ACRL | 8 | 1 | 1 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,411 | core.py | Jurredr_ACRL/standalone/sac/core.py | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions.normal import Normal
def combined_shape(length, shape=None):
"""
Helper functions that combines shape and length.
"""
if shape is None:
return (length,)
return (length, shape) if... | 4,635 | Python | .py | 107 | 35.140187 | 92 | 0.625834 | Jurredr/ACRL | 8 | 1 | 1 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,412 | sac.py | Jurredr_ACRL/standalone/sac/sac.py | from copy import deepcopy
import itertools
from gymnasium import Env
import numpy as np
import torch
from torch.optim import Adam
import time
import sac.core as core
from sac.utils.logx import EpisodeLogger, colorize
class ReplayBuffer:
"""
A simple FIFO experience replay buffer for SAC agents.
"""
d... | 15,903 | Python | .py | 326 | 36.693252 | 150 | 0.579192 | Jurredr/ACRL | 8 | 1 | 1 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,413 | logx.py | Jurredr_ACRL/standalone/sac/utils/logx.py | """
Some simple logging functionality, inspired by rllab's logging.
Logs to a tab-separated-values file (path/to/output_directory/progress.txt)
"""
import json
import joblib
import numpy as np
import torch
import os.path as osp
import time
import atexit
import os
import warnings
from sac.utils.mpi_tools import proc_... | 15,017 | Python | .py | 337 | 33.655786 | 131 | 0.583567 | Jurredr/ACRL | 8 | 1 | 1 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,414 | track_spline.py | Jurredr_ACRL/standalone/sac/utils/track_spline.py | import numpy as np
def _get_closest_spline_point(spline_points, x, y):
"""
Get the index of the closest point on the spline to the car.
"""
# First, calculate the distance to every point on the center line
distances = np.sqrt(
(x - spline_points[0])**2 + (y - spline_points[1])**2)
# F... | 1,916 | Python | .py | 44 | 37.727273 | 124 | 0.674018 | Jurredr/ACRL | 8 | 1 | 1 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,415 | mpi_tools.py | Jurredr_ACRL/standalone/sac/utils/mpi_tools.py | from mpi4py import MPI
import os
import subprocess
import sys
import numpy as np
def mpi_fork(n, bind_to_core=False):
"""
Re-launches the current script with workers linked by MPI.
Also, terminates the original process that launched it.
Taken almost without modification from the Baselines function o... | 2,716 | Python | .py | 74 | 30.513514 | 97 | 0.622273 | Jurredr/ACRL | 8 | 1 | 1 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,416 | plot.py | Jurredr_ACRL/standalone/sac/utils/plot.py | import seaborn as sns
import pandas as pd
import matplotlib.pyplot as plt
import json
import os
import os.path as osp
import numpy as np
DIV_LINE_WIDTH = 50
# Global vars for tracking and labeling data at load time.
exp_idx = 0
units = dict()
def plot_data(data, xaxis='Epoch', value="AverageEpRet", condition="Condi... | 9,519 | Python | .py | 203 | 37.847291 | 101 | 0.626428 | Jurredr/ACRL | 8 | 1 | 1 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,417 | serialization_utils.py | Jurredr_ACRL/standalone/sac/utils/serialization_utils.py | import json
def convert_json(obj):
"""
Convert obj to a version which can be serialized with JSON.
"""
if is_json_serializable(obj):
return obj
else:
if isinstance(obj, dict):
return {convert_json(k): convert_json(v)
for k, v in obj.items()}
... | 1,018 | Python | .py | 31 | 23.935484 | 73 | 0.548057 | Jurredr/ACRL | 8 | 1 | 1 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,418 | ACRL.py | Jurredr_ACRL/ACRL/ACRL.py | import sys
import os
import platform
import socket
import threading
import ac_api.car_info as ci
import ac_api.input_info as ii
import ac_api.lap_info as li
# The name of the app (ACRL: Assetto Corsa Reinforcement Learning)
APP_NAME = 'ACRL'
# Add the third party libraries to the path
try:
if platform.architectur... | 6,673 | Python | .py | 191 | 28.769634 | 323 | 0.627445 | Jurredr/ACRL | 8 | 1 | 1 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,419 | IS_ACUtil.pyc | Jurredr_ACRL/ACRL/third_party/IS_ACUtil.pyc | ž
ˆGYYÁ c @ sç d d l Z d d l Z d d l Z d d l Z e j ƒ d d k r\ e j j d d ƒ n e j j d d ƒ d d l Td d l m Z d d l
Z
d d l Z d d „ Z d d
„ Z
d a e j e j e j ƒ a d
d „ Z d S( i Nu 64bitu# apps/python/IS_AddShortcu... | 2,127 | Python | .py | 9 | 235.222222 | 1,191 | 0.537046 | Jurredr/ACRL | 8 | 1 | 1 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,420 | sim_info.py | Jurredr_ACRL/ACRL/third_party/sim_info.py | import mmap
import functools
import ctypes
from ctypes import c_int32, c_float, c_wchar
AC_STATUS = c_int32
AC_OFF = 0
AC_REPLAY = 1
AC_LIVE = 2
AC_PAUSE = 3
AC_SESSION_TYPE = c_int32
AC_UNKNOWN = -1
AC_PRACTICE = 0
AC_QUALIFY = 1
AC_RACE = 2
AC_HOTLAP = 3
AC_TIME_ATTACK = 4
AC_DRIFT = 5
AC_DRAG = 6
AC_FLAG_TYPE = c_i... | 6,092 | Python | .py | 185 | 25.448649 | 94 | 0.546164 | Jurredr/ACRL | 8 | 1 | 1 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,421 | _ctypes.pyd | Jurredr_ACRL/ACRL/third_party/stdlib64/_ctypes.pyd | MZ� ÿÿ ¸ @ º ´ Í!¸LÍ!This program cannot be run in DOS mode.
$ SÊëv¤¸v¤¸v¤¸x 8¸v¤¸x :¸v¤¸x ¸v¤¸x ¸v¤¸ë8¸v¤¸'¸v¤¸7¸v¤¸v¥¸Øv¤¸ë:¸v¤¸ë
¸v¤¸ë?¸v¤¸ë9¸v¤¸Richv¤¸ PE d† Ø5S ğ "
ì ¶ |ö ... | 108,032 | Python | .py | 490 | 219.232653 | 6,625 | 0.432183 | Jurredr/ACRL | 8 | 1 | 1 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,422 | _ctypes.pyd | Jurredr_ACRL/ACRL/third_party/stdlib/_ctypes.pyd | MZ� ÿÿ ¸ @ ğ º ´ Í!¸LÍ!This program cannot be run in DOS mode.
$ …±º²ÁĞÔáÁĞÔáÁĞÔᮦJáÆĞÔᮦ~áÊĞÔᮦáÃĞÔᮦHáÅĞÔáȨWáÀĞÔáȨGáÆĞÔáÁĞÕáĞÔᮦzáÈĞÔᮦOáÀĞÔᮦIáÀĞÔáRichÁĞÔá PE L ¯·fP à !
Ò z !Û ğ ... | 84,992 | Python | .py | 92 | 921.630435 | 7,004 | 0.496243 | Jurredr/ACRL | 8 | 1 | 1 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,423 | lap_info.py | Jurredr_ACRL/ACRL/ac_api/lap_info.py | import os
import sys
import platform
APP_NAME = 'ACRL'
# Add the third party libraries to the path
try:
if platform.architecture()[0] == "64bit":
sysdir = "stdlib64"
else:
sysdir = "stdlib"
sys.path.insert(
len(sys.path), 'apps/python/{}/third_party'.format(APP_NAME))
os.enviro... | 4,715 | Python | .py | 134 | 29.313433 | 105 | 0.645211 | Jurredr/ACRL | 8 | 1 | 1 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,424 | tyre_info.py | Jurredr_ACRL/ACRL/ac_api/tyre_info.py | import os
import sys
import platform
APP_NAME = 'ACRL'
# Add the third party libraries to the path
try:
if platform.architecture()[0] == "64bit":
sysdir = "stdlib64"
else:
sysdir = "stdlib"
sys.path.insert(
len(sys.path), 'apps/python/{}/third_party'.format(APP_NAME))
os.enviro... | 3,804 | Python | .py | 110 | 30.363636 | 110 | 0.669594 | Jurredr/ACRL | 8 | 1 | 1 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,425 | session_info.py | Jurredr_ACRL/ACRL/ac_api/session_info.py | import os
import sys
import platform
APP_NAME = 'ACRL'
# Add the third party libraries to the path
try:
if platform.architecture()[0] == "64bit":
sysdir = "stdlib64"
else:
sysdir = "stdlib"
sys.path.insert(
len(sys.path), 'apps/python/{}/third_party'.format(APP_NAME))
os.enviro... | 3,933 | Python | .py | 120 | 28.541667 | 117 | 0.688847 | Jurredr/ACRL | 8 | 1 | 1 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,426 | input_info.py | Jurredr_ACRL/ACRL/ac_api/input_info.py | import os
import sys
import platform
APP_NAME = 'ACRL'
# Add the third party libraries to the path
try:
if platform.architecture()[0] == "64bit":
sysdir = "stdlib64"
else:
sysdir = "stdlib"
sys.path.insert(
len(sys.path), 'apps/python/{}/third_party'.format(APP_NAME))
os.enviro... | 1,768 | Python | .py | 51 | 30.254902 | 81 | 0.655314 | Jurredr/ACRL | 8 | 1 | 1 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,427 | car_info.py | Jurredr_ACRL/ACRL/ac_api/car_info.py | import os
import sys
import platform
APP_NAME = 'ACRL'
# Add the third party libraries to the path
try:
if platform.architecture()[0] == "64bit":
sysdir = "stdlib64"
else:
sysdir = "stdlib"
sys.path.insert(
len(sys.path), 'apps/python/{}/third_party'.format(APP_NAME))
os.enviro... | 8,574 | Python | .py | 247 | 28.639676 | 117 | 0.618886 | Jurredr/ACRL | 8 | 1 | 1 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,428 | car_stats.py | Jurredr_ACRL/ACRL/ac_api/car_stats.py | import os
import sys
import platform
APP_NAME = 'ACRL'
# Add the third party libraries to the path
try:
if platform.architecture()[0] == "64bit":
sysdir = "stdlib64"
else:
sysdir = "stdlib"
sys.path.insert(
len(sys.path), 'apps/python/{}/third_party'.format(APP_NAME))
os.enviro... | 1,796 | Python | .py | 60 | 25.35 | 79 | 0.649622 | Jurredr/ACRL | 8 | 1 | 1 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,429 | path.py | Jurredr_ACRL/track_data/path.py | from cmath import cos, sin
from math import degrees
from matplotlib.animation import FuncAnimation
from scipy.interpolate import splprep, splev
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
# In this file, we are going to create a smooth path out of location data.
# The location data is stored... | 4,450 | Python | .py | 93 | 43.806452 | 104 | 0.704835 | Jurredr/ACRL | 8 | 1 | 1 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,430 | compare_vectors.py | Jurredr_ACRL/track_data/compare_vectors.py | from matplotlib import pyplot as plt
from matplotlib.animation import FuncAnimation
import numpy as np
data_str = """0.99967045 0.025671951 0.9975158692901073 0.07044210753804547 2.568293114027549 -117.48955 -828.05023
0.99778175 0.06656922 0.9975021177363425 0.07063657063810402 0.23437615366579392 -117.484276 -828.0... | 69,786 | Python | .py | 718 | 96.016713 | 180 | 0.840256 | Jurredr/ACRL | 8 | 1 | 1 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,431 | main.py | Jurredr_ACRL/track_data/main.py | import csv
world_data = []
velocity_data = []
lap_data = []
# Read car.csv
with open('car.csv', 'r') as car_file:
car_reader = csv.reader(car_file)
next(car_reader) # Skip the header row
for row in car_reader:
# Get the world location (second to last value)
world_location = row[-2]
... | 1,319 | Python | .py | 34 | 33.882353 | 81 | 0.658594 | Jurredr/ACRL | 8 | 1 | 1 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,432 | test_juniward.py | uibk-uncover_conseal/test/test_juniward.py | import conseal as cl
import jpeglib
import logging
from parameterized import parameterized
import unittest
import numpy as np
from scipy.io import loadmat
from . import defs
# from .defs import ASSETS_DIR
STEGO_DIR = defs.ASSETS_DIR / 'juniward'
class TestJUNIWARD(unittest.TestCase):
"""Test suite for J-UNIWARD ... | 14,266 | Python | .py | 210 | 58.938095 | 158 | 0.682029 | uibk-uncover/conseal | 8 | 0 | 0 | MPL-2.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,433 | test_lsb.py | uibk-uncover_conseal/test/test_lsb.py |
import conseal as cl
import jpeglib
import logging
import numpy as np
import os
from PIL import Image
from parameterized import parameterized
import sys
import tempfile
import time
import unittest
from . import defs
STEGO_DIR = defs.ASSETS_DIR / 'lsb'
class TestLSB(unittest.TestCase):
"""Test suite for LSB embe... | 4,021 | Python | .py | 111 | 28.216216 | 119 | 0.60652 | uibk-uncover/conseal | 8 | 0 | 0 | MPL-2.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,434 | test_hugo.py | uibk-uncover_conseal/test/test_hugo.py | import conseal as cl
import logging
import numpy as np
import os
from parameterized import parameterized
from PIL import Image
import scipy.io
import tempfile
import unittest
from . import defs
COST_DIR = defs.ASSETS_DIR / 'hugo' / 'costmap_matlab'
STEGO_DIR = defs.ASSETS_DIR / 'hugo' / 'stego_matlab'
class TestHUG... | 2,183 | Python | .py | 57 | 30.982456 | 84 | 0.619678 | uibk-uncover/conseal | 8 | 0 | 0 | MPL-2.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,435 | test_uerd.py | uibk-uncover_conseal/test/test_uerd.py | """
Author: Martin Benes, Benedikt Lorch
Affiliation: University of Innsbruck
"""
import conseal as cl
import jpeglib
import logging
import numpy as np
from parameterized import parameterized
import unittest
from . import defs
STEGO_DIR = defs.ASSETS_DIR / 'uerd'
class TestUERD(unittest.TestCase):
"""Test suit... | 4,312 | Python | .py | 95 | 36.768421 | 178 | 0.621274 | uibk-uncover/conseal | 8 | 0 | 0 | MPL-2.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,436 | defs.py | uibk-uncover_conseal/test/defs.py | import pathlib
ASSETS_DIR = pathlib.Path('test/assets')
COVER_DIR = ASSETS_DIR / 'cover'
COVER_UNCOMPRESSED_GRAY_DIR = COVER_DIR / 'uncompressed_gray'
COVER_UNCOMPRESSED_COLOR_DIR = COVER_DIR / 'uncompressed_color'
COVER_COMPRESSED_GRAY_DIR = COVER_DIR / 'jpeg_75_gray'
COVER_COMPRESSED_COLOR_DIR = COVER_DIR / 'jpeg_75... | 451 | Python | .py | 17 | 23.529412 | 63 | 0.68287 | uibk-uncover/conseal | 8 | 0 | 0 | MPL-2.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,437 | test_simulate.py | uibk-uncover_conseal/test/test_simulate.py | """
Author: Martin Benes
Affiliation: University of Innsbruck
"""
import conseal as cl
import logging
import numpy as np
import os
from parameterized import parameterized
import tempfile
import unittest
class TestSimulate(unittest.TestCase):
"""Test suite for simulate module."""
_logger = logging.getLogger(... | 1,952 | Python | .py | 56 | 27.678571 | 76 | 0.607105 | uibk-uncover/conseal | 8 | 0 | 0 | MPL-2.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,438 | test_hill.py | uibk-uncover_conseal/test/test_hill.py |
import conseal as cl
import logging
import numpy as np
import os
from parameterized import parameterized
from PIL import Image
import sys
import tempfile
import unittest
from . import defs
class TestHILL(unittest.TestCase):
"""Test suite for HILL embedding."""
_logger = logging.getLogger(__name__)
def ... | 1,906 | Python | .py | 50 | 31.06 | 83 | 0.641734 | uibk-uncover/conseal | 8 | 0 | 0 | MPL-2.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,439 | test_ebs.py | uibk-uncover_conseal/test/test_ebs.py |
import conseal as cl
import jpeglib
import logging
import numpy as np
import os
from parameterized import parameterized
import scipy.io
import tempfile
import unittest
from . import defs
# STEGO_DIR = defs.ASSETS_DIR / 'ebs'
class TestEBS(unittest.TestCase):
"""Test suite for EBS embedding."""
_logger = log... | 2,087 | Python | .py | 54 | 32.685185 | 99 | 0.617253 | uibk-uncover/conseal | 8 | 0 | 0 | MPL-2.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,440 | test_nsF5.py | uibk-uncover_conseal/test/test_nsF5.py | """
Author: Martin Benes, Benedikt Lorch
Affiliation: University of Innsbruck
"""
import conseal as cl
import jpeglib
import logging
import numpy as np
from parameterized import parameterized
import tempfile
import unittest
from . import defs
STEGO_DIR = defs.ASSETS_DIR / 'nsF5'
class TestnsF5(unittest.TestCase):... | 2,477 | Python | .py | 57 | 35.491228 | 99 | 0.616313 | uibk-uncover/conseal | 8 | 0 | 0 | MPL-2.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,441 | __init__.py | uibk-uncover_conseal/conseal/__init__.py |
import pkg_resources
#
from . import simulate
from . import tools
# spatial
from . import hill
from . import hugo
from . import lsb # can be also used for JPEG
# JPEG
from . import ebs
from . import juniward
from . import nsF5
from . import uerd
# abbreviations of enum
JUNIWARD_ORIGINAL = juniward.Implementation.... | 1,022 | Python | .py | 42 | 21.547619 | 73 | 0.720452 | uibk-uncover/conseal | 8 | 0 | 0 | MPL-2.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,442 | _simulate.py | uibk-uncover_conseal/conseal/juniward/_simulate.py | """
Author: Benedikt Lorch, Martin Benes
Affiliation: University of Innsbruck
"""
import numpy as np
from ._costmap import compute_cost_adjusted, Implementation
from .. import simulate
from .. import tools
def simulate_single_channel(
cover_spatial: np.ndarray,
cover_dct_coeffs: np.ndarray,
quantizatio... | 4,107 | Python | .py | 91 | 39.549451 | 127 | 0.705176 | uibk-uncover/conseal | 8 | 0 | 0 | MPL-2.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,443 | __init__.py | uibk-uncover_conseal/conseal/juniward/__init__.py | """
Author: Benedikt Lorch, Martin Benes
Affiliation: University of Innsbruck
"""
# costmap
from ._costmap import compute_cost_adjusted, evaluate_distortion, Implementation
# simulate
from . import _simulate
from ._simulate import simulate_single_channel
# abbreviations of enum
JUNIWARD_ORIGINAL = Implementation.JU... | 614 | Python | .py | 22 | 25.227273 | 80 | 0.756388 | uibk-uncover/conseal | 8 | 0 | 0 | MPL-2.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,444 | _costmap.py | uibk-uncover_conseal/conseal/juniward/_costmap.py | """
Implementation of the J-UNIWARD steganography method as described in
V. Holub, J. Fridrich, T. Denemark
"Universal distortion function for steganography in an arbitrary domain"
EURASIP Journal on Information Security, 2014
http://www.ws.binghamton.edu/fridrich/research/uniward-eurasip-final.pdf
Author: Benedikt L... | 15,510 | Python | .py | 278 | 49.553957 | 893 | 0.67827 | uibk-uncover/conseal | 8 | 0 | 0 | MPL-2.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,445 | _ternary.py | uibk-uncover_conseal/conseal/simulate/_ternary.py | """
Author: Martin Benes, Benedikt Lorch
Affiliation: University of Innsbruck
This implementation builds on the Matlab implementation provided by the DDE lab. Please find that license of the original implementation below.
-------------------------------------------------------------------------
Copyright (c) 2013 DDE... | 11,062 | Python | .py | 252 | 38.051587 | 893 | 0.648377 | uibk-uncover/conseal | 8 | 0 | 0 | MPL-2.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,446 | __init__.py | uibk-uncover_conseal/conseal/simulate/__init__.py | """
Author: Martin Benes, Benedikt Lorch
Affiliation: University of Innsbruck
"""
import numpy as np
import typing
from ._defs import get_p
from . import _ternary
from ._ternary import ternary
def simulate(
rho: typing.Union[np.ndarray, typing.Tuple[np.ndarray]],
alpha: float,
n: int,
seed: int = N... | 4,226 | Python | .py | 128 | 27.101563 | 103 | 0.608919 | uibk-uncover/conseal | 8 | 0 | 0 | MPL-2.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,447 | _defs.py | uibk-uncover_conseal/conseal/simulate/_defs.py | """
The equation is from
P. Bas, et al. "Break Our Steganographic System: The Ins and Outs of Organizing BOSS", IH 2011.
Originally described in the STC paper by
T. Filler, et al. "Minimizing Additive Distortion in Steganography Using Syndrome-Trellis Codes", TIFS 2011.
Author: Martin Benes, Benedikt Lorch
Affilia... | 1,216 | Python | .py | 32 | 33.75 | 117 | 0.713311 | uibk-uncover/conseal | 8 | 0 | 0 | MPL-2.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,448 | decompress.py | uibk-uncover_conseal/conseal/tools/decompress.py | import numpy as np
from .dct import block_idct2
def decompress_channel(dct_coeffs, quantization_table=None):
"""
Decompress a single channel
:param dct_coeffs: quantized DCT coefficients of shape [num_vertical_blocks, num_horizontal_blocks, 8, 8]
:param quantization_table: quantization table of shape ... | 1,350 | Python | .py | 26 | 45.346154 | 184 | 0.695057 | uibk-uncover/conseal | 8 | 0 | 0 | MPL-2.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,449 | dct.py | uibk-uncover_conseal/conseal/tools/dct.py | """
Author: Martin Benes, Benedikt Lorch
Affiliation: University of Innsbruck
"""
import numpy as np
import scipy.fftpack
from .common import entropy
def nzAC(dct: np.ndarray) -> int:
"""Computes number of non-zero DCT AC coefficients from 4D DCT tensor.
:param dct: array of shape [num_vertical_blocks, nu... | 7,037 | Python | .py | 173 | 35.398844 | 125 | 0.650206 | uibk-uncover/conseal | 8 | 0 | 0 | MPL-2.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,450 | __init__.py | uibk-uncover_conseal/conseal/tools/__init__.py | """
Author: Martin Benes, Benedikt Lorch
Affiliation: University of Innsbruck
"""
# globals
from .common import entropy, inv_entropy, _entropy, EPS
from .dct import nzAC, AC
from .decompress import decompress_channel
# modules
from . import dct
from . import spatial
__all__ = [
'entropy',
'inv_entropy',
... | 395 | Python | .py | 21 | 16.047619 | 55 | 0.680217 | uibk-uncover/conseal | 8 | 0 | 0 | MPL-2.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,451 | spatial.py | uibk-uncover_conseal/conseal/tools/spatial.py | """
Author: Martin Benes, Benedikt Lorch
Affiliation: University of Innsbruck
"""
import numpy as np
import typing
from .common import entropy
def embeddable_pixels(
x: np.ndarray = None,
wet: typing.Tuple = tuple()
) -> int:
"""Get number of embeddable pixels."""
# wet elements
excluded = sum(... | 2,328 | Python | .py | 80 | 23.4375 | 68 | 0.601342 | uibk-uncover/conseal | 8 | 0 | 0 | MPL-2.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,452 | common.py | uibk-uncover_conseal/conseal/tools/common.py | """
Author: Martin Benes, Benedikt Lorch
Affiliation: University of Innsbruck
"""
import numpy as np
import scipy.optimize
EPS = np.finfo(np.float64).eps
"""small numerical constant"""
def _entropy(*ps) -> float:
"""Computes n-ary entropy.
:param ps: Probability tensors.
:type ps:
:return: Entropy... | 1,668 | Python | .py | 58 | 23.810345 | 98 | 0.619887 | uibk-uncover/conseal | 8 | 0 | 0 | MPL-2.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,453 | _simulate.py | uibk-uncover_conseal/conseal/lsb/_simulate.py | """
Author: Benedikt Lorch, Martin Benes
Affiliation: University of Innsbruck
"""
import numpy as np
import typing
from . import _costmap
from ._costmap import Change
from ..simulate import _ternary
def simulate(
cover: np.ndarray,
embedding_rate: float,
*,
modify: Change = Change.LSB_REPLACEMENT,
... | 2,669 | Python | .py | 76 | 29.986842 | 101 | 0.671312 | uibk-uncover/conseal | 8 | 0 | 0 | MPL-2.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,454 | __init__.py | uibk-uncover_conseal/conseal/lsb/__init__.py | """
Author: Martin Benes, Benedikt Lorch
Affiliation: University of Innsbruck
"""
# simulate
from ._simulate import simulate
from ._costmap import compute_cost_adjusted, Change
#
from . import _simulate
from . import _costmap
__all__ = [
'_simulate',
'_costmap',
'compute_cost_adjusted',
'simulate_si... | 351 | Python | .py | 17 | 18.235294 | 51 | 0.718182 | uibk-uncover/conseal | 8 | 0 | 0 | MPL-2.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,455 | _costmap.py | uibk-uncover_conseal/conseal/lsb/_costmap.py | """
Implementation of simulated LSB steganography.
Unlike other methods, here we do not have a reference code,
and test visually and using known attacks and weaknesses of LSB.
Author: Martin Benes
Affiliation: University of Innsbruck
""" # noqa: E501
import enum
import numpy as np
import typing
from .. import simu... | 6,264 | Python | .py | 163 | 31.96319 | 101 | 0.647641 | uibk-uncover/conseal | 8 | 0 | 0 | MPL-2.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,456 | _simulate.py | uibk-uncover_conseal/conseal/nsF5/_simulate.py | """
Implementation of the nsF5 steganography method as described in
J. Fridrich, T. Pevny, and J. Kodovsky.
"Statistically undetectable JPEG steganography: Dead ends, challenges, and opportunities"
Multimedia & Security, 2007
http://dde.binghamton.edu/kodovsky/pdf/Fri07-ACM.pdf
Author: Benedikt Lorch, Martin Benes
Af... | 6,221 | Python | .py | 116 | 48.25 | 155 | 0.713084 | uibk-uncover/conseal | 8 | 0 | 0 | MPL-2.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,457 | __init__.py | uibk-uncover_conseal/conseal/nsF5/__init__.py | """
Author: Martin Benes, Benedikt Lorch
Affiliation: University of Innsbruck
"""
#
from ._simulate import simulate_single_channel
#
from . import _simulate
from . import _costmap
__all__ = [
'_simulate',
'_costmap',
'simulate_single_channel',
]
| 262 | Python | .py | 14 | 16.571429 | 46 | 0.717213 | uibk-uncover/conseal | 8 | 0 | 0 | MPL-2.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,458 | _costmap.py | uibk-uncover_conseal/conseal/nsF5/_costmap.py | """
Implementation of the nsF5 steganography method as described in
J. Fridrich, T. Pevny, and J. Kodovsky.
"Statistically undetectable JPEG steganography: Dead ends, challenges, and opportunities"
Multimedia & Security, 2007
http://dde.binghamton.edu/kodovsky/pdf/Fri07-ACM.pdf
Author: Benedikt Lorch, Martin Benes
A... | 1,885 | Python | .py | 47 | 35.574468 | 112 | 0.696703 | uibk-uncover/conseal | 8 | 0 | 0 | MPL-2.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,459 | _simulate.py | uibk-uncover_conseal/conseal/hill/_simulate.py | """
Implementation of HILL steganographic embedding as described in:
Author: Martin Benes, Benedikt Lorch
Affiliation: University of Innsbruck
"""
import numpy as np
from scipy.signal import convolve2d
from . import _costmap
from ..simulate import _ternary
from .. import tools
def simulate_single_channel(
cove... | 1,565 | Python | .py | 51 | 25.568627 | 109 | 0.673537 | uibk-uncover/conseal | 8 | 0 | 0 | MPL-2.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,460 | __init__.py | uibk-uncover_conseal/conseal/hill/__init__.py | """
Author: Martin Benes, Benedikt Lorch
Affiliation: University of Innsbruck
"""
# distortion
from . import _costmap
from ._costmap import compute_cost_adjusted
# simulation
from . import _simulate
from ._simulate import simulate_single_channel
__all__ = [
'_costmap',
'_simulate',
'compute_cost_adjuste... | 357 | Python | .py | 16 | 20.0625 | 46 | 0.74184 | uibk-uncover/conseal | 8 | 0 | 0 | MPL-2.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,461 | _costmap.py | uibk-uncover_conseal/conseal/hill/_costmap.py | #!/usr/bin/env python3
"""
Implementation of HILL steganographic embedding.
Code inspired by https://github.com/daniellerch/stegolab.
A New Cost Function for Spatial Image Steganography
B. Li, M. Wang, J. Huang, X. Li.
"""
import numpy as np
import scipy.signal
import typing
from .. import tools
def compute_cost(... | 2,628 | Python | .py | 77 | 29.103896 | 109 | 0.646501 | uibk-uncover/conseal | 8 | 0 | 0 | MPL-2.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,462 | _simulate.py | uibk-uncover_conseal/conseal/uerd/_simulate.py | """Simulation of the UERD steganography method.
We thank Patrick Bas for sharing his implementation of UERD with us.
Author: Martin Benes, Benedikt Lorch
Affiliation: University of Innsbruck
"""
import numpy as np
from ._costmap import compute_cost_adjusted
from ..simulate import _ternary
from .. import tools
def... | 3,242 | Python | .py | 79 | 35.455696 | 118 | 0.689348 | uibk-uncover/conseal | 8 | 0 | 0 | MPL-2.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,463 | __init__.py | uibk-uncover_conseal/conseal/uerd/__init__.py | """
Author: Martin Benes, Benedikt Lorch
Affiliation: University of Innsbruck
"""
# distortion
from . import _costmap
from ._costmap import compute_cost_adjusted
# simulation
from . import _simulate
from ._simulate import simulate_single_channel
__all__ = [
'_costmap',
'_simulate',
'compute_cost_adjuste... | 357 | Python | .py | 16 | 20.0625 | 46 | 0.74184 | uibk-uncover/conseal | 8 | 0 | 0 | MPL-2.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,464 | _costmap.py | uibk-uncover_conseal/conseal/uerd/_costmap.py | """Implementation of the UERD steganography method as described in
L. Guo, J. Ni, W. Su, C. Tang and Y.-Q. Shi
"Using Statistical Image Model for JPEG Steganography: Uniform Embedding Revisited"
IEEE Transactions on Information Forensics and Security, 2015
https://ieeexplore.ieee.org/document/7225122
The idea of unif... | 5,758 | Python | .py | 108 | 48.453704 | 158 | 0.71085 | uibk-uncover/conseal | 8 | 0 | 0 | MPL-2.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,465 | _simulate.py | uibk-uncover_conseal/conseal/ebs/_simulate.py | """
Author:Martin Benes, Benedikt Lorch
Affiliation: University of Innsbruck
"""
import numpy as np
from ._costmap import compute_cost_adjusted, Implementation
from .. import simulate
from .. import tools
def simulate_single_channel(
cover_dct_coeffs: np.ndarray,
quantization_table: np.ndarray,
embeddi... | 3,615 | Python | .py | 84 | 37.488095 | 114 | 0.702303 | uibk-uncover/conseal | 8 | 0 | 0 | MPL-2.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,466 | __init__.py | uibk-uncover_conseal/conseal/ebs/__init__.py | """
Author: Martin Benes
Affiliation: University of Innsbruck
"""
# costmap
from ._costmap import compute_cost_adjusted, Implementation
# simulate
from . import _simulate
from ._simulate import simulate_single_channel
# abbreviations of enum
EBS_ORIGINAL = Implementation.EBS_ORIGINAL
EBS_FIX_WET = Implementation.EB... | 499 | Python | .py | 21 | 21.190476 | 59 | 0.739958 | uibk-uncover/conseal | 8 | 0 | 0 | MPL-2.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,467 | _costmap.py | uibk-uncover_conseal/conseal/ebs/_costmap.py | """
Author: Martin Benes
Affiliation: University of Innsbruck
"""
import enum
import numpy as np
class Implementation(enum.Enum):
"""EBS implementation to choose from."""
EBS_ORIGINAL = enum.auto()
"""Original EBS implementation by Remi Cogranne."""
EBS_FIX_WET = enum.auto()
"""EBS implementati... | 5,713 | Python | .py | 139 | 34.94964 | 114 | 0.64515 | uibk-uncover/conseal | 8 | 0 | 0 | MPL-2.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,468 | _simulate.py | uibk-uncover_conseal/conseal/hugo/_simulate.py | """
Implementation of the HUGO steganography method as described in
T. Pevny, T. Filler, P. Bas
"Using High-Dimensional Image Models to Perform Highly Undetectable Steganography"
ACM Information Hiding 2010
https://hal.science/hal-00541353/document
Author: Benedikt Lorch, Martin Benes
Affiliation: University of Innsb... | 3,113 | Python | .py | 51 | 56.882353 | 893 | 0.721548 | uibk-uncover/conseal | 8 | 0 | 0 | MPL-2.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,469 | __init__.py | uibk-uncover_conseal/conseal/hugo/__init__.py | """
Author: Martin Benes, Benedikt Lorch
Affiliation: University of Innsbruck
"""
# distortion
from . import _costmap
from ._costmap import compute_cost_adjusted
# simulation
from . import _simulate
from ._simulate import simulate_single_channel
__all__ = [
'_costmap',
'_simulate',
'compute_cost_adjuste... | 357 | Python | .py | 16 | 20.0625 | 46 | 0.74184 | uibk-uncover/conseal | 8 | 0 | 0 | MPL-2.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,470 | _costmap.py | uibk-uncover_conseal/conseal/hugo/_costmap.py | #!/usr/bin/env python3
"""
Implementation of HUGO steganographic embedding.
Code inspired by Holub's Matlab implementation: https://dde.binghamton.edu/download/stego_algorithms/
Using High-Dimensional Image Models to Perform Highly Undetectable Steganography.
T. Pevny, T. Filler and P. Bas. https://hal.science/hal-00... | 5,691 | Python | .py | 134 | 36.432836 | 116 | 0.651757 | uibk-uncover/conseal | 8 | 0 | 0 | MPL-2.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,471 | conf.py | uibk-uncover_conseal/docs/conf.py | # Configuration file for the Sphinx documentation builder.
# -- Project information
project = 'conseal'
copyright = '2023, Martin Benes & Benedikt Lorch, University of Innsbruck'
author = 'Martin Benes, Benedikt Lorch'
release = '2024.06'
version = '2023.06'
# -- General configuration
extensions = [
'sphinx.ext... | 1,023 | Python | .py | 34 | 27.323529 | 74 | 0.700306 | uibk-uncover/conseal | 8 | 0 | 0 | MPL-2.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,472 | app.py | rcarrat-AI_hftgi-llms/inference/app.py | import argparse
import requests
import json
from langchain.llms import HuggingFaceTextGenInference
import warnings
# Suppress specific Pydantic UserWarnings
warnings.filterwarnings("ignore", message="Field \"model_id\" has conflict with protected namespace")
def get_info(url):
response = requests.get(f"{url}/inf... | 1,823 | Python | .py | 46 | 35.913043 | 101 | 0.738122 | rcarrat-AI/hftgi-llms | 8 | 6 | 0 | AGPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,473 | filters.py | rabilrbl_chatgpt-bot/chatgpt_bot/filters.py | import os
from telegram import Update
from telegram.ext.filters import UpdateFilter
from dotenv import load_dotenv
load_dotenv()
AUTHORIZED_USERS = [i.strip() for i in os.getenv("AUTHORIZED_USERS", "").split(",") if i.strip()]
class AuthorizedUserFilter(UpdateFilter):
def filter(self, update: Update):
if ... | 490 | Python | .py | 11 | 40.545455 | 124 | 0.753138 | rabilrbl/chatgpt-bot | 8 | 1 | 2 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,474 | handlers.py | rabilrbl_chatgpt-bot/chatgpt_bot/handlers.py | import asyncio
import typing as ty
from telegram import Update
from telegram.ext import (
ContextTypes,
)
from telegram.error import NetworkError, BadRequest
from telegram.constants import ChatAction, ParseMode
from chatgpt_bot.chatgpt import chatgpt, generate_response
from chatgpt_bot.html_format import format_mes... | 3,522 | Python | .py | 82 | 33.573171 | 137 | 0.642205 | rabilrbl/chatgpt-bot | 8 | 1 | 2 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,475 | html_format.py | rabilrbl_chatgpt-bot/chatgpt_bot/html_format.py | import re
def escape_html(text: str) -> str:
"""Escapes HTML special characters in a string.
Replaces &, <, > with HTML entities to prevent them
from being interpreted as HTML tags when output.
Args:
text (str): The text to escape.
Returns:
str: The text with HTML characters esc... | 5,461 | Python | .py | 139 | 33.496403 | 99 | 0.642938 | rabilrbl/chatgpt-bot | 8 | 1 | 2 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,476 | bot.py | rabilrbl_chatgpt-bot/chatgpt_bot/bot.py | import os, asyncio
from telegram import Update
from telegram.ext import Application, CommandHandler, MessageHandler, filters
from chatgpt_bot.handlers import start, help_command, handle_message, newchat_command, init_chatgpt
from chatgpt_bot.filters import AuthorizedUserFilter
def start_bot():
loop = asyncio.get_e... | 969 | Python | .py | 17 | 52.529412 | 110 | 0.774813 | rabilrbl/chatgpt-bot | 8 | 1 | 2 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,477 | chatgpt.py | rabilrbl_chatgpt-bot/chatgpt_bot/chatgpt.py | import os, sys, asyncio
from re_gpt import AsyncChatGPT
from dotenv import load_dotenv
load_dotenv()
session_token = os.getenv("SESSION_TOKEN")
if sys.version_info >= (3, 8) and sys.platform.lower().startswith("win"):
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
async def chatgpt... | 811 | Python | .py | 19 | 37.368421 | 75 | 0.726343 | rabilrbl/chatgpt-bot | 8 | 1 | 2 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,478 | _old_cmd_script.py | Cooooldwind_163ListDownloader_NexT/_old_cmd_script.py | '''
ncmlistdownloader/cmd_script.py
Core.Ver.1.0.0.240309a1
Author: CooooldWind_
'''
import time
import pprint
import multiprocessing
import ncmlistdownloader as nld
def main():
print("163ListDownloader CMD Ver.")
print("Core.Ver.1.0.0.240309a1 / Made by CooooldWind_")
print("Warning: It's an Alpha Version... | 893 | Python | .py | 30 | 24.9 | 65 | 0.645423 | Cooooldwind/163ListDownloader_NexT | 8 | 1 | 0 | AGPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,479 | setup.py | Cooooldwind_163ListDownloader_NexT/setup.py | from setuptools import setup, find_packages
# from ncmlistdownloader.common.global_args import CORE_VERSION_SETUP
setup(
classifiers=[
# 发展时期
# 'Development Status :: 3 - Alpha',
# 'Development Status :: 4 - Beta',
"Development Status :: 5 - Production/Stable",
# 开发的目标用户
... | 1,796 | Python | .py | 47 | 28.723404 | 93 | 0.599028 | Cooooldwind/163ListDownloader_NexT | 8 | 1 | 0 | AGPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,480 | login.py | Cooooldwind_163ListDownloader_NexT/ncmlistdownloader/login.py | """
ncmlistdownloader/login.py
Ver.1.3.0.240707
Author: CooooldWind_
"""
import pyqrcode
import tkinter
import time
from ncmlistdownloader.common.encode_sec_key import NeteaseParams
def login():
unikey_url = "https://music.163.com/weapi/login/qrcode/unikey?csrf_token="
np = NeteaseParams(url = unikey_url, enc... | 1,723 | Python | .py | 50 | 26.9 | 91 | 0.612923 | Cooooldwind/163ListDownloader_NexT | 8 | 1 | 0 | AGPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,481 | __init__.py | Cooooldwind_163ListDownloader_NexT/ncmlistdownloader/__init__.py | """
ncmlistdownloader/__init__.py
Ver.1.3.2.240707
Author: CooooldWind_
"""
from pathlib import Path
import time
from ncmlistdownloader.playlist import *
from ncmlistdownloader.common import *
from ncmlistdownloader.common.global_args import *
from ncmlistdownloader.editer import cover_compress
from ncmlistdownloader.... | 3,398 | Python | .py | 93 | 29.623656 | 108 | 0.554377 | Cooooldwind/163ListDownloader_NexT | 8 | 1 | 0 | AGPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,482 | __init__.py | Cooooldwind_163ListDownloader_NexT/ncmlistdownloader/song/__init__.py | """
ncmlistdownloader/song/__init__.py
Core.Ver.1.1.3.240630
Author: CooooldWind_
"""
from ncmlistdownloader.common import *
from ncmlistdownloader.common.encode_sec_key import *
from ncmlistdownloader.common.thread_test import best_thread
from ncmlistdownloader.downloader import *
from ncmlistdownloader.common.global... | 9,452 | Python | .py | 264 | 23.852273 | 148 | 0.523915 | Cooooldwind/163ListDownloader_NexT | 8 | 1 | 0 | AGPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,483 | thread_test.py | Cooooldwind_163ListDownloader_NexT/ncmlistdownloader/common/thread_test.py | """
ncmlistdownloader/common/thread_test.py
Core.Ver.1.0.5.240429
Author: CooooldWind_
Copied from: https://python-parallel-programmning-cookbook.readthedocs.io/zh-cn/latest/chapter2/13_Evaluating_the_performance_of_multithread_applications.html
"""
from threading import Thread
class threads_object(Thread):
def ... | 1,719 | Python | .py | 54 | 26.12963 | 158 | 0.624772 | Cooooldwind/163ListDownloader_NexT | 8 | 1 | 0 | AGPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,484 | encode_sec_key.py | Cooooldwind_163ListDownloader_NexT/ncmlistdownloader/common/encode_sec_key.py | """
网易云WeAPI解码
Core.Ver.1.3.2.240707
Author: CooooldWind_, 半岛的孤城
References:
1. 网易云解参数(获取网易云歌词,获取评论同理)[https://www.bilibili.com/read/cv12754897/]
"""
import random
import json
from base64 import b64encode
import requests
from Crypto.Cipher import AES
from ncmlistdownloader.common.global_args import FUNC_F, SEC_KEY
... | 2,251 | Python | .py | 64 | 25.90625 | 120 | 0.595017 | Cooooldwind/163ListDownloader_NexT | 8 | 1 | 0 | AGPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,485 | __init__.py | Cooooldwind_163ListDownloader_NexT/ncmlistdownloader/common/__init__.py | """
ncmlistdownloader/Common/__init__.py
存储常用函数。
Core.Ver.1.0.5.240429
Author: CooooldWind_
"""
import os
def url_split(url=str()) -> str:
"""
把id从url里面提取出来
----------
参数:
1. `url`(必填): 需要转换的url
"""
id_return = url.split("?id=")[-1].split("&")[0]
return id_return
def artist_turn_str... | 2,755 | Python | .py | 92 | 22.195652 | 85 | 0.546015 | Cooooldwind/163ListDownloader_NexT | 8 | 1 | 0 | AGPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,486 | version.py | Cooooldwind_163ListDownloader_NexT/ncmlistdownloader/common/version.py | """
list_downloader/global_args.py
Core.Ver.1.3.2.240707
Author: CooooldWind_
"""
CMD_VERSION = "Ver.1.3.2.240707"
CORE_VERSION_SETUP = "1.3.2.240707"
CORE_VERSION = "Core.Ver." + CORE_VERSION_SETUP | 199 | Python | .py | 8 | 23.875 | 47 | 0.732984 | Cooooldwind/163ListDownloader_NexT | 8 | 1 | 0 | AGPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,487 | global_args.py | Cooooldwind_163ListDownloader_NexT/ncmlistdownloader/common/global_args.py | """
list_downloader/global_args.py
Core.Ver.1.3.1.240707
Author: CooooldWind_, 是青旨啊
"""
from ncmlistdownloader.common.version import *
FUNC_F_PART = [
"00e0b509f6259df8642dbc35662901477df22677ec152b5ff68ace615bb7",
"b725152b3ab17a876aea8a5aa76d2e417629ec4ee341f56135fccf695280",
"104e0312ecbda92557c93870114a... | 1,886 | Python | .py | 44 | 39.681818 | 81 | 0.754635 | Cooooldwind/163ListDownloader_NexT | 8 | 1 | 0 | AGPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,488 | __init__.py | Cooooldwind_163ListDownloader_NexT/ncmlistdownloader/editer/__init__.py | """
ncmlistdownloader/Editer/__init__.py
Core.Ver.1.0.8.240501
Author: CooooldWind_
"""
from PIL import Image
from mutagen.flac import FLAC, Picture
from mutagen.id3 import ID3, APIC, USLT, Encoding
from mutagen.easyid3 import EasyID3
from mutagen.mp3 import MP3
from ncmlistdownloader.common import get_type, artist_tu... | 3,912 | Python | .py | 112 | 26.732143 | 85 | 0.600386 | Cooooldwind/163ListDownloader_NexT | 8 | 1 | 0 | AGPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,489 | __init__.py | Cooooldwind_163ListDownloader_NexT/ncmlistdownloader/downloader/__init__.py | """
ncmlistdownloader/Downloader/__init__.py
Core.Ver.1.0.5.240429
Author: CooooldWind_
"""
import random
import time
import threading
import requests
from requests.adapters import HTTPAdapter
from ncmlistdownloader.common import *
from ncmlistdownloader.common.encode_sec_key import *
def calc_divisional_range(total... | 6,041 | Python | .py | 175 | 23.822857 | 86 | 0.53611 | Cooooldwind/163ListDownloader_NexT | 8 | 1 | 0 | AGPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,490 | json_list_io.py | Cooooldwind_163ListDownloader_NexT/ncmlistdownloader/downloader/json_list_io.py | """
ncmlistdownloader/Downloader/__init__.py
Core.Ver.1.1.0.240430a1
Author: CooooldWind_
"""
import json
from ncmlistdownloader.song import *
"""
d = {
"type": "downloading_list_ncmld",
"global_config": GLOBAL_CONFIG_MODEL,
"track": [{
"type": "song",
"info": {
"title": i.titl... | 1,067 | Python | .py | 37 | 21.297297 | 66 | 0.529297 | Cooooldwind/163ListDownloader_NexT | 8 | 1 | 0 | AGPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,491 | __init__.py | Cooooldwind_163ListDownloader_NexT/ncmlistdownloader/playlist/__init__.py | """
ncmlistdownloader/playlist/__init__.py
Core.Ver.1.0.5.240429
Author: CooooldWind_
"""
from ncmlistdownloader.common import *
from ncmlistdownloader.common.encode_sec_key import *
from ncmlistdownloader.common.global_args import *
from ncmlistdownloader.song import *
import threading
class Playlist:
def __ini... | 2,223 | Python | .py | 65 | 25.569231 | 71 | 0.573488 | Cooooldwind/163ListDownloader_NexT | 8 | 1 | 0 | AGPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,492 | manage.py | emmertex_chore_app/manage.py | #!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'chore_app.settings')
try:
from django.core.management import execute_from_command_line
except Im... | 665 | Python | .py | 18 | 31.055556 | 73 | 0.676516 | emmertex/chore_app | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,493 | models.py | emmertex_chore_app/chore_app/models.py | from django.contrib.auth.models import AbstractUser
from django.db import models
class User(AbstractUser):
role = models.CharField(max_length=10, choices=(
('Parent', 'Parent'), ('Child', 'Child')))
points_balance = models.IntegerField(default=0)
pocket_money = models.IntegerField(default=0)
p... | 2,427 | Python | .py | 48 | 46 | 122 | 0.749578 | emmertex/chore_app | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,494 | settings.py | emmertex_chore_app/chore_app/settings.py | """
Django settings for chore_app project.
Generated by 'django-admin startproject' using Django 5.0.
For more information on this file, see
https://docs.djangoproject.com/en/5.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/5.0/ref/settings/
"""
from pathlib... | 3,513 | Python | .py | 100 | 30.75 | 91 | 0.716188 | emmertex/chore_app | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,495 | cron.py | emmertex_chore_app/chore_app/cron.py | import logging
from django_cron import CronJobBase, Schedule
from django.db.models import F, Q, Sum
import chore_app.models as models
import chore_app.views as views
from datetime import datetime
class NightlyAction(CronJobBase):
logging.basicConfig(
level=logging.WARNING,
format='%(asctime)s %(le... | 8,633 | Python | .py | 165 | 43.915152 | 192 | 0.670355 | emmertex/chore_app | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,496 | asgi.py | emmertex_chore_app/chore_app/asgi.py | """
ASGI config for chore_app project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/5.0/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SET... | 395 | Python | .py | 10 | 37.9 | 78 | 0.799472 | emmertex/chore_app | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,497 | urls.py | emmertex_chore_app/chore_app/urls.py | """
URL configuration for chore_app project.
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/5.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='ho... | 2,948 | Python | .py | 55 | 48.909091 | 82 | 0.688627 | emmertex/chore_app | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,498 | wsgi.py | emmertex_chore_app/chore_app/wsgi.py | """
WSGI config for chore_app project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/5.0/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SET... | 395 | Python | .py | 10 | 37.9 | 78 | 0.799472 | emmertex/chore_app | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |
2,286,499 | forms.py | emmertex_chore_app/chore_app/forms.py | from django import forms
from chore_app.models import Chore, ChoreClaim, PointLog, Settings, User, Text
class ChoreForm(forms.ModelForm):
class Meta:
model = Chore
fields = ['name', 'comment', 'points', 'available',
'daily', 'persistent', 'earlyBonus', 'availableTime']
l... | 3,715 | Python | .py | 97 | 28.463918 | 115 | 0.546741 | emmertex/chore_app | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:48:01 PM (Europe/Amsterdam) |