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,285,100 | train.py | dajuric_dark/dark-3/samples/1.1-Func-optimization/dark/train.py | import dark
from util import *
def eval_func(x):
fx = dark.add(dark.mul(2, dark.pow(x, 2)), 5) #2*x^2 + 5
return fx
x = dark.Parameter(10.0)
for _ in range(15):
print(f"Value of x is: {x.data.item():2.1f}")
fx = eval_func(x)
fx.backward() #calc gradient
plot(lambda x: eval_func(x).dat... | 445 | Python | .py | 14 | 27.142857 | 61 | 0.609524 | dajuric/dark | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:47:43 PM (Europe/Amsterdam) |
2,285,101 | __init__.py | dajuric_dark/dark-3/dark/__init__.py | from .core.operations import *
from .core.autodiff import *
from .utils.serialization import save, load | 103 | Python | .py | 3 | 33.666667 | 43 | 0.811881 | dajuric/dark | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:47:43 PM (Europe/Amsterdam) |
2,285,102 | optimizers.py | dajuric_dark/dark-3/dark/optim/optimizers.py | import dark.tensor as dt
class Optimizer():
def __init__(self, parameters):
self.parameters = parameters
def step(self):
raise NotImplementedError()
def zero_grad(self):
for p in self.parameters:
p.zero_grad()
class SGD(Optimizer):
def __init__(self, parameters, ... | 2,225 | Python | .py | 54 | 31.259259 | 115 | 0.551643 | dajuric/dark | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:47:43 PM (Europe/Amsterdam) |
2,285,103 | serialization.py | dajuric_dark/dark-3/dark/utils/serialization.py | import os
import pickle
from copy import deepcopy
from .. import tensor as dt
def _dt_to_numpy(obj):
if "cupy.ndarray" in str(obj.__class__):
return obj.get()
return obj
def _numpy_to_dt(obj):
if "numpy.ndarray" in str(obj.__class__):
return dt.asarray(obj)
return obj
def ... | 1,143 | Python | .py | 36 | 25.555556 | 67 | 0.616022 | dajuric/dark | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:47:43 PM (Europe/Amsterdam) |
2,285,104 | ops.py | dajuric_dark/dark-3/dark/tensor/ops.py | from numpy import *
seterr(over='raise')
def unsqueeze(x, axis):
return expand_dims(x, axis)
def sigmoid(x):
return 1 / (1 + exp(-x)) | 147 | Python | .py | 6 | 21.333333 | 31 | 0.669118 | dajuric/dark | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:47:43 PM (Europe/Amsterdam) |
2,285,105 | autodiff.py | dajuric_dark/dark-3/dark/core/autodiff.py | import dark.tensor as dt
class Node():
op = None
inputs = []
data = None
requires_grad = True
_grad = None
def __init__(self, val):
self.data = dt.asarray(val)
if len(self.data.shape) == 0: self.data = self.data.reshape((1, 1))
def backward(self):
if self.grad is ... | 2,807 | Python | .py | 89 | 21.876404 | 112 | 0.545593 | dajuric/dark | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:47:43 PM (Europe/Amsterdam) |
2,285,106 | utils.py | dajuric_dark/dark-3/dark/core/utils.py | import dark.tensor as dt
import numpy as np
def reduce_sum(result, target_shape):
dim_diff = result.ndim - len(target_shape)
if dim_diff < 0:
return result.reshape(target_shape)
# sum all leading dimensions
# except leading dimensions, sum all axis that are equal to 1, count from right
... | 553 | Python | .py | 13 | 37.384615 | 93 | 0.70566 | dajuric/dark | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:47:43 PM (Europe/Amsterdam) |
2,285,107 | operations.py | dajuric_dark/dark-3/dark/core/operations.py | from .autodiff import Operation
from .utils import *
import dark.tensor as dt
# ------ scalar ------
class AbsoluteValue(Operation):
def forward(self, x):
return dt.abs(x)
def backward(self, dldy, y, x):
gz = (x > 0)
lz = dt.logical_not(gz)
return [dldy * gz - dldy * lz]
clas... | 5,357 | Python | .py | 169 | 25.402367 | 89 | 0.601347 | dajuric/dark | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:47:43 PM (Europe/Amsterdam) |
2,285,108 | module.py | dajuric_dark/dark-3/dark/nn/module.py | from dark import Parameter, Node, Constant
class Module():
def __init__(self):
self._modules = {}
self._parameters = {}
def forward(self, *x):
pass
def __call__(self, *x):
x = [(Constant(p) if not isinstance(p, Node) else p) for p in x]
return self.forward(*x)
... | 2,248 | Python | .py | 69 | 23.478261 | 74 | 0.550257 | dajuric/dark | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:47:43 PM (Europe/Amsterdam) |
2,285,109 | init.py | dajuric_dark/dark-3/dark/nn/init.py | import dark.tensor as dt
import dark.nn as nn
from dark import *
def random_uniform_(tensor, a, b):
t_shape = tensor.data.shape
tensor.data = (b - a) * dt.random.rand(*t_shape) + a
def default_init_weights(m):
if isinstance(m, nn.Linear):
stdv = 1. / dt.sqrt(m.weights.data.shape[1])
rando... | 399 | Python | .py | 11 | 31.818182 | 56 | 0.65544 | dajuric/dark | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:47:43 PM (Europe/Amsterdam) |
2,285,110 | __init__.py | dajuric_dark/dark-3/dark/nn/__init__.py | from .init import *
from .module import *
from .modules import *
from .losses import * | 88 | Python | .py | 4 | 21.25 | 22 | 0.741176 | dajuric/dark | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:47:43 PM (Europe/Amsterdam) |
2,285,111 | losses.py | dajuric_dark/dark-3/dark/nn/losses.py | import dark
from .module import Module
from .modules import Sigmoid, Softmax
class MSELoss(Module):
def __init__(self):
super().__init__()
def forward(self, predictions, targets):
loss = dark.subtract(predictions, targets)
loss = dark.pow(loss, 2)
loss = dark.mean(loss)
... | 1,191 | Python | .py | 32 | 29.84375 | 107 | 0.6295 | dajuric/dark | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:47:43 PM (Europe/Amsterdam) |
2,285,112 | modules.py | dajuric_dark/dark-3/dark/nn/modules.py | import dark.tensor as dt
from dark import Parameter, Node, Constant
import dark
from .module import *
class ZeroParam(Parameter):
def __init__(self, *shape):
val = dt.zeros(shape)
super().__init__(val)
class Flatten(Module):
def __init__(self):
super().__init__()
pass
def... | 1,815 | Python | .py | 54 | 26.851852 | 147 | 0.601495 | dajuric/dark | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:47:43 PM (Europe/Amsterdam) |
2,285,113 | setup.py | anxkhn_OpynGPT/setup.py | from setuptools import find_packages, setup
setup(
name="opyngpt",
version="0.4.0",
packages=find_packages(),
install_requires=[
"requests",
],
description="Supercharge your projects with LLMs. No API keys required.",
entry_points={"console_scripts": ["opyngpt = opyngpt.chat:main"]}... | 5,355 | Python | .py | 135 | 37.237037 | 83 | 0.719652 | anxkhn/OpynGPT | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,114 | standalone.py | anxkhn_OpynGPT/standalone.py | import json
import requests
def get_user_input():
return input("Enter your input message: ")
def prompt(user_input):
url = "https://https.extension.phind.com/agent/"
headers = {
"Content-Type": "application/json",
"User-Agent": "",
"Accept": "*/*",
"Accept-Encoding": "Ide... | 1,881 | Python | .py | 54 | 27.425926 | 69 | 0.604523 | anxkhn/OpynGPT | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,115 | chat.py | anxkhn_OpynGPT/opyngpt/chat.py | import json
import sys
import requests
def prompt(input_message):
url = "https://https.extension.phind.com/agent/"
headers = {
"Content-Type": "application/json",
"User-Agent": "",
"Accept": "*/*",
"Accept-Encoding": "Identity",
}
payload = {
"additional_exten... | 4,086 | Python | .py | 104 | 29.240385 | 132 | 0.567145 | anxkhn/OpynGPT | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,116 | setup.py | alexisInSAR_EGMStoolkit/setup.py | #! /usr/bin/env python3
# -*- coding: iso-8859-1 -*-
"""EGMS-toolkit setuptools configuration
"""
from setuptools import setup, find_packages
with open('requirements.txt') as f:
required = f.read().splitlines()
with open("README.rst", "r") as readme_file:
readme = readme_file.read()
setup(name='EGMStoolki... | 1,256 | Python | .py | 35 | 30.571429 | 76 | 0.657072 | alexisInSAR/EGMStoolkit | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,117 | constants.py | alexisInSAR_EGMStoolkit/src/EGMStoolkit/constants.py | #! /usr/bin/env python3
# -*- coding: iso-8859-1 -*-
"""
Module from the `EGMStoolkit` constants
The module stores the different `EGMStoolkit` constants.
(From `EGMStoolkit` package)
Attributes:
__name__ (str): Name of the Python package
__author__ (str): Main authors of `EGMStoolkit`
__copyrig... | 1,969 | Python | .py | 41 | 45.268293 | 148 | 0.507837 | alexisInSAR/EGMStoolkit | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,118 | EGMStoolkitapp.py | alexisInSAR_EGMStoolkit/src/EGMStoolkit/EGMStoolkitapp.py | #! /usr/bin/env python3
# -*- coding: iso-8859-1 -*-
"""
Wrapper of EGMS-toolkit
(From `EGMStoolkit` package)
Changelog:
* 0.2.9: Fix regarding the Track_user, Pass_user options and the cropping of L3 data, Apr. 2024, Alexis Hrysiewicz
* 0.2.8: Fix regarding the force option for removerawdata, Apr. ... | 17,391 | Python | .py | 290 | 47.22069 | 256 | 0.565325 | alexisInSAR/EGMStoolkit | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,119 | __init__.py | alexisInSAR_EGMStoolkit/src/EGMStoolkit/__init__.py | """EGMS toolkit.
"""
__namePackage__ = 'EGMStoolkit'
"""str: Name of the Python package.
"""
__authorPackage__ = 'Alexis Hrysiewicz (UCD / iCRAG)'
"""str: Name and afflilation of the main author
"""
__copyrightPackage__ = "Copyright 2024, UCD / iCRAG"
"""str: Copyright of the Python package
"""
__versionPackage__... | 386 | Python | .py | 14 | 26.285714 | 53 | 0.692935 | alexisInSAR/EGMStoolkit | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,120 | usermessage.py | alexisInSAR_EGMStoolkit/src/EGMStoolkit/usermessage.py | #! /usr/bin/env python3
# -*- coding: iso-8859-1 -*-
"""
Module to generate the EGMS-toolkit message
The module allows to generate the different user messages
(e.g., error, warning, verbose).
(From `EGMStoolkit` package)
Changelog:
* 0.2.6: Small update, Feb. 2024
* 0.2.0: Initial version, ... | 5,263 | Python | .py | 128 | 33.789063 | 153 | 0.555863 | alexisInSAR/EGMStoolkit | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,121 | egmsapitools.py | alexisInSAR_EGMStoolkit/src/EGMStoolkit/functions/egmsapitools.py | #! /usr/bin/env python3
# -*- coding: iso-8859-1 -*-
"""
Module to add some functions to **`EGMStoolkit`**
The module adds some functions, required by to run `EGMStoolkit`.
(From `EGMStoolkit` package)
Changelog:
* 0.2.1: Remove the duplicate points for L2 datasets, Feb. 2024, Alexis Hrysiewicz
* 0.2.0:... | 2,006 | Python | .py | 51 | 33.529412 | 140 | 0.553214 | alexisInSAR/EGMStoolkit | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,122 | esa2egmsburstID.py | alexisInSAR_EGMStoolkit/src/EGMStoolkit/functions/esa2egmsburstID.py | #! /usr/bin/env python3
# -*- coding: iso-8859-1 -*-
"""
Module to get the EGMS-burst IDs**
The module contains some functions to get the EGMS-burst IDs , required by to run `EGMStoolkit`.
(From `EGMStoolkit` package)
The code is from `HERE <https://land.copernicus.eu/en/technical-library/egms-product-descri... | 3,149 | Python | .py | 64 | 44.875 | 131 | 0.692182 | alexisInSAR/EGMStoolkit | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,123 | __init__.py | alexisInSAR_EGMStoolkit/src/EGMStoolkit/functions/__init__.py | """
Function components of **EGMS toolkit**
The module contains the different functions required by `EGMStoolkit`.
Changelog:
* 0.2.10: Fix regarding the input and output directory for data gridding, Aug. 2024, Alexis Hrysiewicz
* 0.2.6: Bug fixes regarding the windows system, Feb. 2024, Alexis Hrysie... | 1,059 | Python | .py | 14 | 69.357143 | 163 | 0.711409 | alexisInSAR/EGMStoolkit | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,124 | egmsdatatools.py | alexisInSAR_EGMStoolkit/src/EGMStoolkit/functions/egmsdatatools.py | #! /usr/bin/env python3
# -*- coding: iso-8859-1 -*-
"""
Module to add some functions post-process the data from EGMS, with **`EGMStoolkit`**
The module adds some functions, required by `EGMStoolkit` to post-process the EGMS data.
(From `EGMStoolkit` package)
Changelog:
* 0.2.11: Fix regarding the input an... | 48,805 | Python | .py | 868 | 44.640553 | 453 | 0.559735 | alexisInSAR/EGMStoolkit | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,125 | EGMSS1ROIapi.py | alexisInSAR_EGMStoolkit/src/EGMStoolkit/classes/EGMSS1ROIapi.py | #! /usr/bin/env python3
# -*- coding: iso-8859-1 -*-
"""
Classe compoment of **EGMS toolkit**
The module contains the classe and the methods to detect the tile regarding a user ROI, required by to run `EGMStoolkit`.
(From `EGMStoolkit` package)
Changelog:
* 0.2.7: Add the Folium package in order to create t... | 32,668 | Python | .py | 565 | 41.460177 | 185 | 0.513616 | alexisInSAR/EGMStoolkit | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,126 | EGMSS1burstIDapi.py | alexisInSAR_EGMStoolkit/src/EGMStoolkit/classes/EGMSS1burstIDapi.py | #! /usr/bin/env python3
# -*- coding: iso-8859-1 -*-
"""
Classe compoment of **EGMS toolkit**
The module contains the classe and the methods to manage the Sentinel-1 Burst-ID maps required by to run `EGMStoolkit`.
(From `EGMStoolkit` package)
Changelog:
* 0.2.0: Script structuring, Jan. 2024, Alexis Hrysiew... | 7,852 | Python | .py | 140 | 45.707143 | 158 | 0.552837 | alexisInSAR/EGMStoolkit | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,127 | __init__.py | alexisInSAR_EGMStoolkit/src/EGMStoolkit/classes/__init__.py | """
Classe components of **EGMS toolkit**
The module contains the different classes required by `EGMStoolkit`.
Changelog:
* 0.2.0: Initial version, Jan. 2024
""" | 173 | Python | .py | 6 | 26 | 68 | 0.72561 | alexisInSAR/EGMStoolkit | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,128 | EGMSdownloaderapi.py | alexisInSAR_EGMStoolkit/src/EGMStoolkit/classes/EGMSdownloaderapi.py | #! /usr/bin/env python3
# -*- coding: iso-8859-1 -*-
"""
Classe compoment of **EGMS toolkit**
The module contains the classe and the methods to download the tile regarding a user ROI, required by to run `EGMStoolkit`.
(From `EGMStoolkit` package)
Changelog:
* 0.2.0: Script structuring, Jan. 2024, Alexis Hry... | 20,800 | Python | .py | 358 | 44.796089 | 175 | 0.540715 | alexisInSAR/EGMStoolkit | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,129 | example.ipynb | alexisInSAR_EGMStoolkit/docs/build/doctrees/nbsphinx/example/example.ipynb | {
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Example of EGMS toolkit in Python environment\n",
"*Date: 26 Jan. 2024 by Alexis Hrysiewicz*"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Import the required modules\n",
"\n",
"As a... | 44,485 | Python | .py | 1,115 | 34.607175 | 7,654 | 0.584556 | alexisInSAR/EGMStoolkit | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,130 | example.ipynb.txt | alexisInSAR_EGMStoolkit/docs/build/html/_sources/example/example.ipynb.txt | {
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Example of EGMS toolkit in Python environment\n",
"*Date: 26 Jan. 2024 by Alexis Hrysiewicz*"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Import the required modules\n",
"\n",
"As a... | 44,485 | Python | .py | 1,115 | 34.607175 | 7,654 | 0.584556 | alexisInSAR/EGMStoolkit | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,131 | example.ipynb | alexisInSAR_EGMStoolkit/docs/build/html/example/example.ipynb | {
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Example of EGMS toolkit in Python environment\n",
"*Date: 26 Jan. 2024 by Alexis Hrysiewicz*"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Import the required modules\n",
"\n",
"As a... | 44,485 | Python | .py | 1,115 | 34.607175 | 7,654 | 0.584556 | alexisInSAR/EGMStoolkit | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,132 | conf.py | alexisInSAR_EGMStoolkit/docs/src/conf.py | #! /usr/bin/env python3
# -*- coding: iso-8859-1 -*-
import os
import subprocess
import pathlib
copyright = '2024, UCD / iCRAG'
version = '0.2.11 Beta'
project = 'EGMS-toolkit'
author = 'Alexis Hrysiewicz University College Dublin / iCRAG'
extensions = [
"sphinx_rtd_theme",
"sphinx.ext.intersphinx",
"pyd... | 1,814 | Python | .py | 57 | 27.912281 | 99 | 0.660367 | alexisInSAR/EGMStoolkit | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,133 | example.ipynb | alexisInSAR_EGMStoolkit/docs/src/example/example.ipynb | {
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Example of EGMS toolkit in Python environment\n",
"*Date: 26 Jan. 2024 by Alexis Hrysiewicz*"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Import the required modules\n",
"\n",
"As a... | 44,485 | Python | .py | 1,115 | 34.607175 | 7,654 | 0.584556 | alexisInSAR/EGMStoolkit | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,134 | ddos.py | Nambel12_ToolDDoS/ddos.py | #!/usr/bin/env python3
from concurrent.futures import ThreadPoolExecutor, as_completed
from contextlib import suppress
from itertools import cycle
from json import load
from logging import basicConfig, getLogger, shutdown
from math import log2, trunc
from multiprocessing import RawValue
from os import urandom as rand... | 72,006 | Python | .py | 1,527 | 31.636542 | 261 | 0.493674 | Nambel12/ToolDDoS | 8 | 3 | 2 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,135 | user_animations.py | calico-cat-3333_calicocat-keyboard/code/user_animations.py | from kmk.keys import make_key
from kmk.extensions.RGB import AnimationModes
from kmk.modules import Module
from gettime import get_time
# 将电路上的rgb排列转换为更常见的排列
rgb_led_map = [
[15,14,13,12,11,10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0],
[16,17,18,19,20,21,22,23,24,25,26,27,28,29,30],
[45,44,43,42,41,40,39,38,37,36,35... | 8,999 | Python | .py | 220 | 29.477273 | 111 | 0.603757 | calico-cat-3333/calicocat-keyboard | 8 | 3 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,136 | gettime.py | calico-cat-3333_calicocat-keyboard/code/gettime.py | import supervisor
def get_time(f):
def inner(*arg, **kwarg):
s_time = supervisor.ticks_ms()
res = f(*arg, **kwarg)
e_time = supervisor.ticks_ms()
print('timeuse: {}'.format(e_time - s_time))
return res
return inner
| 264 | Python | .py | 9 | 22.888889 | 52 | 0.57874 | calico-cat-3333/calicocat-keyboard | 8 | 3 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,137 | calculator.py | calico-cat-3333_calicocat-keyboard/code/calculator.py | import board
import terminalio
import displayio
from math import *
# 导入 decimal 供高精度计算使用
# 占用内存过大,故放弃
#import jepler_udecimal as decimal
#import jepler_udecimal.utrig
# bitmap_label 不工作,因为这将导致 pystack exhausted 堆栈溢出。
# from adafruit_display_text import bitmap_label as label
from adafruit_display_text import label
from... | 11,023 | Python | .py | 239 | 31.916318 | 157 | 0.561607 | calico-cat-3333/calicocat-keyboard | 8 | 3 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,138 | boot.py | calico-cat-3333_calicocat-keyboard/code/boot.py | import board
from kmk.bootcfg import bootcfg
# 目前 boot_device 似乎不正常工作
# 个人测试结果为只有关闭 nkro 并把 boot_device 设置为 0 才能操作 grub
bootcfg(
# required:
sense = board.GP27,
# optional:
source = board.GP15,
boot_device = 0,
cdc_console = False,
cdc_data = False,
midi = False,
nkro = False,
... | 398 | Python | .py | 16 | 17.5625 | 49 | 0.672897 | calico-cat-3333/calicocat-keyboard | 8 | 3 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,139 | lcd.py | calico-cat-3333_calicocat-keyboard/code/lcd.py | import board
import displayio
import busio
# 兼容 circuitpython 8 和 circuitpython 9
try:
from fourwire import FourWire
print('use fourwire module on circuitpython 9')
except:
from displayio import FourWire
print('use displayio module on circuitpython 8')
from adafruit_st7789 import ST7789
from kmk.exte... | 3,183 | Python | .py | 83 | 28.951807 | 92 | 0.669614 | calico-cat-3333/calicocat-keyboard | 8 | 3 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,140 | statuslcd.py | calico-cat-3333_calicocat-keyboard/code/statuslcd.py | import board
import displayio
from kmk.extensions.lock_status import LockStatus
from kmk.extensions import Extension
from gettime import get_time
bitmap = displayio.OnDiskBitmap("spritemap.bmp")
palette = bitmap.pixel_shader
palette.make_transparent(0)
class LCDLockStatus(LockStatus):
def __init__(self, lcd):
... | 3,937 | Python | .py | 89 | 33.325843 | 105 | 0.598224 | calico-cat-3333/calicocat-keyboard | 8 | 3 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,141 | main.py | calico-cat-3333_calicocat-keyboard/code/main.py | print("Starting")
import microcontroller
# 超频到 150Mhz 或者也可以超频到 180Mhz
# 网上一些人声称可以超频到 250Mhz 但是我比较保守,暂时只打算超频到 150Mhz
# 警告:超频可能导致树莓派 pico 损坏,请注意小心
microcontroller.cpu.frequency = 150000000
# microcontroller.cpu.frequency = 180000000
import board
import os
from kb import KMKKeyboard
from kmk.keys import KC
from kmk.mo... | 4,679 | Python | .py | 79 | 54.303797 | 180 | 0.605938 | calico-cat-3333/calicocat-keyboard | 8 | 3 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,142 | rgbstatuslcd.py | calico-cat-3333_calicocat-keyboard/code/rgbstatuslcd.py | import board
import terminalio
import displayio
from adafruit_display_text import bitmap_label as label
from kmk.extensions import Extension
from kmk.extensions.RGB import AnimationModes
import user_animations
from gettime import get_time
# 部分灯效的hue值经常改变,导致屏幕刷新过于频繁占用很多时间,并导致操作延迟
# 此列表中的灯效不会经常改变的hue
hue_whitelist = [... | 5,754 | Python | .py | 116 | 38.155172 | 135 | 0.609996 | calico-cat-3333/calicocat-keyboard | 8 | 3 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,143 | kb.py | calico-cat-3333_calicocat-keyboard/code/kb.py | import board
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
from kmk.scanners import DiodeOrientation
from kmk.scanners.encoder import RotaryioEncoder
from kmk.scanners.keypad import MatrixScanner
class KMKKeyboard(_KMKKeyboard):
extensions = []
col_pins = [board.GP27, board.GP26, board.GP22, boar... | 1,414 | Python | .py | 31 | 36.322581 | 131 | 0.57589 | calico-cat-3333/calicocat-keyboard | 8 | 3 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,144 | models.py | jiluoQAQ_Pokemon/Pokemon/pokemon_duel/models.py | from dataclasses import dataclass
from typing import List, Tuple, Union, Protocol
class Func(Protocol):
async def __call__(self, jineng, myinfo, diinfo, myzhuangtai, dizhuangtai, changdi, **kwargs):
...
@dataclass
class Jinengfunc:
keywords: Tuple[str, ...]
func: Func
| 293 | Python | .py | 9 | 28.888889 | 98 | 0.721429 | jiluoQAQ/Pokemon | 8 | 2 | 1 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,145 | pokeconfg.py | jiluoQAQ_Pokemon/Pokemon/pokemon_duel/pokeconfg.py | import asyncio
import os
import random
import math
import textwrap
import json
from PIL import Image, ImageDraw
import copy
from async_timeout import timeout
from .pokemon import *
from .pmconfig import *
from gsuid_core.message_models import Button
from .until import *
from pathlib import Path
from gsuid... | 159,719 | Python | .py | 4,023 | 22.927666 | 218 | 0.439912 | jiluoQAQ/Pokemon | 8 | 2 | 1 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,146 | until.py | jiluoQAQ_Pokemon/Pokemon/pokemon_duel/until.py | import re
import random
import math
from .pokeconfg import *
async def get_shuxing_xiuzheng(atkshux, myshux):
shuxinglist = re.split(',', myshux)
xiuzheng = 1
if atkshux in shuxinglist:
xiuzheng = 1.5
return xiuzheng
async def get_shanghai_beilv(atkshux, dishux):
kezhilist... | 68,045 | Python | .py | 1,407 | 35.574271 | 117 | 0.593865 | jiluoQAQ/Pokemon | 8 | 2 | 1 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,147 | data_source.py | jiluoQAQ_Pokemon/Pokemon/pokemon_duel/data_source.py | from typing import List, Union
from .models import Jinengfunc
from .until import *
jinengfuncs = [
Jinengfunc(("普通伤害",), get_shanghai_pt),
Jinengfunc(("状态伤害",), get_shanghai_zt),
Jinengfunc(("连续伤害",), get_lxshanghai_pt),
Jinengfunc(("一击必杀",), get_bisha),
Jinengfunc(("必中要害",), get_shanghai_pt_yh),
... | 1,938 | Python | .py | 43 | 35.976744 | 117 | 0.659848 | jiluoQAQ/Pokemon | 8 | 2 | 1 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,148 | pmconfig.py | jiluoQAQ_Pokemon/Pokemon/pokemon_duel/pmconfig.py | RESET_HOUR = 0 # 每日使用次数的重置时间,0代表凌晨0点,1代表凌晨1点,以此类推
WORK_NUM = 2 #每日打工次数
random_egg_buy = 50 #每日随机蛋购买次数
TS_FIGHT = 20 #探索野外训练师对战概率
TS_PROP = 10 #探索道具发现概率
TS_POKEMON = 70 #探索野生宝可梦遭遇概率
WIN_EGG = 18 #野生宝可梦精灵蛋掉落概率
WIN_PROP = 15 #野生宝可梦学习机掉落概率
DALIANG_POKE = 30 #当前地点大量出现的宝可梦遭遇概率
QUN_POKE = 15 #野生宝可梦群... | 6,620 | Python | .py | 235 | 17.148936 | 651 | 0.534728 | jiluoQAQ/Pokemon | 8 | 2 | 1 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,149 | fightconfig.py | jiluoQAQ_Pokemon/Pokemon/pokemon_duel/fightconfig.py | import asyncio
import os
import random
import math
import textwrap
import json
from PIL import Image, ImageDraw
import copy
from async_timeout import timeout
from .pokemon import *
from .pokeconfg import *
from gsuid_core.message_models import Button
from .until import *
from pathlib import Path
from gsuid_core.utils.i... | 48,075 | Python | .py | 993 | 30.652568 | 270 | 0.503403 | jiluoQAQ/Pokemon | 8 | 2 | 1 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,150 | nameconfig.py | jiluoQAQ_Pokemon/Pokemon/pokemon_duel/nameconfig.py | # 野外训练家称号
Call_Name = [
'OL',
'宝可梦培育家',
'宝可梦巡护员',
'暴走族',
'背包客',
'比基尼姐姐',
'飙车族',
'捕虫少年',
'超能力者',
'趁火打劫者',
'垂钓者',
'大姐姐',
'登山男',
'电工大叔',
'电气摇滚团',
'赌徒',
'短裤小子',
'对战少女',
'工人',
'怪兽狂',
'光头男',
'和尚',
'护士',
'滑... | 2,184 | Python | .py | 152 | 4.960526 | 15 | 0.202429 | jiluoQAQ/Pokemon | 8 | 2 | 1 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,151 | custom_poke.py | jiluoQAQ_Pokemon/Pokemon/pokemon_duel/custom_poke.py | # 自定义宝可梦设置:
# 宝可梦的名称,和其他的别称叫法写入CUSTOM_CHARA_NAME,具体参考demo
# 宝可梦的种族值,属性,进化信息写入CUSTOM_POKEMON_LIST,具体参考注释
# 宝可梦升级可以学习的技能写入CUSTOM_LEVEL_JINENG_LIST,具体参考注释
# 宝可梦通过学习机学习的技能写入CUSTOM_POKEMON_XUEXI
# 宝可梦的描述吸入CUSTOM_POKEMON_CONTENT
# 宝可梦立绘需要2张png图,图片长宽比为4:3
# 普通立绘一张,为[名称.png]放入gsuid_core\data\Pokemon\resource\icon下
# 闪光... | 1,854 | Python | .py | 42 | 22.904762 | 78 | 0.646568 | jiluoQAQ/Pokemon | 8 | 2 | 1 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,152 | fight.py | jiluoQAQ_Pokemon/Pokemon/pokemon_duel/fight.py | import copy
import json
import math
import random
import pytz
import datetime
from pathlib import Path
from gsuid_core.sv import SV
from PIL import Image, ImageDraw
from gsuid_core.models import Event
from gsuid_core.utils.image.convert import convert_img
from .until import *
from .pokemon import *
from .p... | 56,838 | Python | .py | 1,339 | 27.168783 | 350 | 0.545707 | jiluoQAQ/Pokemon | 8 | 2 | 1 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,153 | __init__.py | jiluoQAQ_Pokemon/Pokemon/pokemon_duel/__init__.py | import os
import re
import math
from gsuid_core.sv import SV
from gsuid_core.models import Event
from gsuid_core.message_models import Button
from gsuid_core.segment import MessageSegment
from gsuid_core.utils.image.convert import convert_img
from .map import *
from .prop import *
from .race import *
from ... | 54,001 | Python | .py | 1,069 | 41.372311 | 626 | 0.540438 | jiluoQAQ/Pokemon | 8 | 2 | 1 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,154 | race.py | jiluoQAQ_Pokemon/Pokemon/pokemon_duel/race.py | import math
from gsuid_core.sv import SV
from gsuid_core.models import Event
from gsuid_core.message_models import Button
import json
import pytz
import time
from .pokeconfg import *
from .until import *
from pathlib import Path
from datetime import datetime
from gsuid_core.gss import gss
from gsuid_core.lo... | 7,289 | Python | .py | 154 | 34.967532 | 199 | 0.623318 | jiluoQAQ/Pokemon | 8 | 2 | 1 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,155 | pokemon.py | jiluoQAQ_Pokemon/Pokemon/pokemon_duel/pokemon.py | CHARA_NAME = {
1: ['妙蛙种子', 'Bulbasaur', '蒜头王八'],
2: ['妙蛙草', 'Ivysaur'],
3: ['妙蛙花', 'Venusaur'],
4: ['小火龙', 'Charmander'],
5: ['火恐龙', 'Charmeleon'],
6: ['喷火龙', 'Charizard', '老喷'],
7: ['杰尼龟', 'Squirtle', '憨八龟'],
8: ['卡咪龟', 'Wartortle'],
9: ['水箭龟', 'Blastoise'],
10: ['绿毛虫'... | 1,643,462 | Python | .py | 33,066 | 24.052017 | 1,384 | 0.342217 | jiluoQAQ/Pokemon | 8 | 2 | 1 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,156 | map.py | jiluoQAQ_Pokemon/Pokemon/pokemon_duel/map.py | import re
import random
import math
import copy
import time
from PIL import Image, ImageDraw
from gsuid_core.sv import SV
from gsuid_core.models import Event
import pytz
from collections import Counter
from gsuid_core.segment import MessageSegment
from gsuid_core.gss import gss
from gsuid_core.utils.image.c... | 86,920 | Python | .py | 1,995 | 30.842105 | 231 | 0.485424 | jiluoQAQ/Pokemon | 8 | 2 | 1 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,157 | prop.py | jiluoQAQ_Pokemon/Pokemon/pokemon_duel/prop.py | import math
from gsuid_core.sv import SV
from gsuid_core.models import Event
from gsuid_core.message_models import Button
import json
import pytz
import time
from .pokeconfg import *
from collections import Counter
from .until import *
from pathlib import Path
from datetime import datetime
from gsuid_core.g... | 50,095 | Python | .py | 1,050 | 37.673333 | 227 | 0.521504 | jiluoQAQ/Pokemon | 8 | 2 | 1 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,158 | draw_image.py | jiluoQAQ_Pokemon/Pokemon/pokemon_duel/draw_image.py | import re
import math
from pathlib import Path
from PIL import Image, ImageDraw
from gsuid_core.utils.image.convert import convert_img
from .pmconfig import *
from .pokeconfg import *
from ..utils.resource.RESOURCE_PATH import CHAR_ICON_PATH, CHAR_ICON_S_PATH
from ..utils.fonts.starrail_fonts import sr_font_1... | 22,634 | Python | .py | 636 | 25.591195 | 102 | 0.489945 | jiluoQAQ/Pokemon | 8 | 2 | 1 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,159 | poke_data.py | jiluoQAQ_Pokemon/Pokemon/pokemon_whois/poke_data.py | """角色名称
遵照格式: id: [台服官译简体, 日文原名, 英文名(罗马音), B服官译, 常见别称, 带错别字的别称等] (<-依此顺序)
若暂无台服官译则用日文原名占位,台日用全角括号,英文用半角括号
"""
CHARA_NAME = {
1: ['妙蛙种子', 'Bulbasaur'],
2: ['妙蛙草', 'Ivysaur'],
3: ['妙蛙花', 'Venusaur'],
4: ['小火龙', 'Charmander'],
5: ['火恐龙', 'Charmeleon'],
6: ['喷火龙', 'Charizard', '老喷'],
... | 43,976 | Python | .py | 1,114 | 25.992819 | 66 | 0.46748 | jiluoQAQ/Pokemon | 8 | 2 | 1 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,160 | __init__.py | jiluoQAQ_Pokemon/Pokemon/pokemon_whois/__init__.py | import random
import asyncio
import importlib
from os import path
import math
import pygtrie
from gsuid_core.sv import SV
from gsuid_core.bot import Bot
from async_timeout import timeout
from gsuid_core.models import Event
from PIL import Image, ImageDraw, ImageFont
from gsuid_core.message_models import Butt... | 35,293 | Python | .py | 799 | 31.050063 | 287 | 0.501371 | jiluoQAQ/Pokemon | 8 | 2 | 1 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,161 | error_reply.py | jiluoQAQ_Pokemon/Pokemon/utils/error_reply.py | from typing import Union
UID_HINT = '你还没有绑定过uid哦!\n请使用[sr绑定uid123456]命令绑定!'
MYS_HINT = '你还没有绑定过mysid哦!\n请使用[绑定mys1234]命令绑定!'
CK_HINT = """你还没有绑定过Cookie哦!发送【ck帮助】获取帮助!
警告:绑定Cookie可能会带来未知的账号风险,请确保信任机器人管理员"""
CHAR_HINT = '您的支援/星海同行角色没有{}的数据哦!\n请先把{}放入支援/星海同行中再使用【sr强制刷新】命令来缓存数据进行查询! !'
VERIFY_HINT = """出现验证码!
如已绑定CK: 请至米游... | 2,243 | Python | .py | 44 | 27.681818 | 78 | 0.656023 | jiluoQAQ/Pokemon | 8 | 2 | 1 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,162 | api.py | jiluoQAQ_Pokemon/Pokemon/utils/api.py | from gsuid_core.utils.database.api import DBSqla
class SRDBSqla(DBSqla):
def __init__(self) -> None:
super().__init__(is_sr=True)
srdbsqla = SRDBSqla()
get_sqla = srdbsqla.get_sqla
| 207 | Python | .py | 6 | 29.166667 | 49 | 0.673575 | jiluoQAQ/Pokemon | 8 | 2 | 1 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,163 | convert.py | jiluoQAQ_Pokemon/Pokemon/utils/convert.py | from collections import defaultdict
from datetime import datetime, timedelta
import pytz
from .dbbase.ScoreCounter import RecordDAO
class DailyNumberLimiter:
tz = pytz.timezone('Asia/Shanghai')
def __init__(self, max_num):
self.today = -1
self.count = defaultdict(int)
... | 3,084 | Python | .py | 83 | 27.349398 | 61 | 0.572496 | jiluoQAQ/Pokemon | 8 | 2 | 1 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,164 | PokeCounter.py | jiluoQAQ_Pokemon/Pokemon/utils/dbbase/PokeCounter.py | import os
import asyncio
import sqlite3
import aiosqlite
from ..resource.RESOURCE_PATH import MAIN_PATH
DB_PATH = os.path.expanduser(MAIN_PATH / 'pokemon.db')
class PokeCounter:
def __init__(self):
os.makedirs(os.path.dirname(DB_PATH), exist_ok=True)
self._create_table()
self... | 56,878 | Python | .py | 1,261 | 30.088025 | 234 | 0.537275 | jiluoQAQ/Pokemon | 8 | 2 | 1 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,165 | ScoreCounter.py | jiluoQAQ_Pokemon/Pokemon/utils/dbbase/ScoreCounter.py | import os
import asyncio
import sqlite3
import aiosqlite
from ..resource.RESOURCE_PATH import MAIN_PATH
DB_PATH = os.path.expanduser(MAIN_PATH / 'pokemon.db')
class SCORE_DB:
def __init__(self):
os.makedirs(os.path.dirname(DB_PATH), exist_ok=True)
self._create_table()
def _conn... | 5,970 | Python | .py | 158 | 24.639241 | 121 | 0.5194 | jiluoQAQ/Pokemon | 8 | 2 | 1 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,166 | GameCounter.py | jiluoQAQ_Pokemon/Pokemon/utils/dbbase/GameCounter.py | import os
import asyncio
import sqlite3
import aiosqlite
from ..resource.RESOURCE_PATH import MAIN_PATH
DB_PATH = os.path.expanduser(MAIN_PATH / 'pokemon.db')
class GAME_DB:
def __init__(self):
os.makedirs(os.path.dirname(DB_PATH), exist_ok=True)
self._create_table()
def _conne... | 2,301 | Python | .py | 54 | 29.148148 | 124 | 0.545371 | jiluoQAQ/Pokemon | 8 | 2 | 1 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,167 | convert.py | jiluoQAQ_Pokemon/Pokemon/utils/image/convert.py | from io import BytesIO
from pathlib import Path
from base64 import b64encode
from typing import Union, overload
import aiofiles
from PIL import Image, ImageFont
@overload
async def convert_img(img: Image.Image, is_base64: bool = False) -> bytes:
...
@overload
async def convert_img(img: Image.Image, is_base64: ... | 2,705 | Python | .py | 91 | 21.692308 | 74 | 0.540239 | jiluoQAQ/Pokemon | 8 | 2 | 1 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,168 | image_tools.py | jiluoQAQ_Pokemon/Pokemon/utils/image/image_tools.py | from pathlib import Path
from typing import Union, Optional
from PIL import Image
from gsuid_core.utils.image.image_tools import TEXT_PATH, CustomizeImage
from ..resource.RESOURCE_PATH import CU_BG_PATH
from ...starrailuid_config.sr_config import srconfig
BG_PATH = Path(__file__).parent / 'bg'
NM_BG_PATH = BG_PATH /... | 1,569 | Python | .py | 46 | 29.173913 | 75 | 0.636724 | jiluoQAQ/Pokemon | 8 | 2 | 1 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,169 | first_world.py | jiluoQAQ_Pokemon/Pokemon/utils/fonts/first_world.py | from pathlib import Path
from PIL import ImageFont
FONT_ORIGIN_PATH = Path(__file__).parent / 'FirstWorld.ttf'
def first_word_origin(size: int) -> ImageFont.FreeTypeFont:
return ImageFont.truetype(str(FONT_ORIGIN_PATH), size=size)
fw_font_12 = first_word_origin(12)
fw_font_24 = first_word_origin(24)
fw_font_2... | 417 | Python | .py | 10 | 39.7 | 63 | 0.758105 | jiluoQAQ/Pokemon | 8 | 2 | 1 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,170 | starrail_fonts.py | jiluoQAQ_Pokemon/Pokemon/utils/fonts/starrail_fonts.py | from pathlib import Path
from PIL import ImageFont
FONT_ORIGIN_PATH = Path(__file__).parent / 'starrail_origin.ttf'
def starrail_font_origin(size: int) -> ImageFont.FreeTypeFont:
return ImageFont.truetype(str(FONT_ORIGIN_PATH), size=size)
sr_font_12 = starrail_font_origin(12)
sr_font_14 = starrail_font_origin... | 1,199 | Python | .py | 30 | 38.633333 | 64 | 0.760963 | jiluoQAQ/Pokemon | 8 | 2 | 1 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,171 | RESOURCE_PATH.py | jiluoQAQ_Pokemon/Pokemon/utils/resource/RESOURCE_PATH.py | import sys
from gsuid_core.data_store import get_res_path
MAIN_PATH = get_res_path() / 'Pokemon'
sys.path.append(str(MAIN_PATH))
PLAYER_PATH = MAIN_PATH / 'players'
RESOURCE_PATH = MAIN_PATH / 'resource'
CHAR_ICON_PATH = RESOURCE_PATH / 'icon'
CHAR_ICON_S_PATH = RESOURCE_PATH / 'staricon'
def init_d... | 530 | Python | .py | 18 | 23.444444 | 47 | 0.637097 | jiluoQAQ/Pokemon | 8 | 2 | 1 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,172 | download_from_cos.py | jiluoQAQ_Pokemon/Pokemon/utils/resource/download_from_cos.py | from gsuid_core.utils.download_resource.download_core import download_all_file
from .RESOURCE_PATH import CHAR_ICON_PATH, CHAR_ICON_S_PATH
async def check_use():
await download_all_file(
'Pokemon',
{
'resource/icon': CHAR_ICON_PATH,
'resource/staricon': CHAR_ICON... | 391 | Python | .py | 11 | 26.090909 | 79 | 0.631285 | jiluoQAQ/Pokemon | 8 | 2 | 1 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,173 | __init__.py | jiluoQAQ_Pokemon/Pokemon/pokemon_start/__init__.py | import asyncio
import threading
from gsuid_core.logger import logger
from ..utils.api import get_sqla
from ..pokemon_resource import startup
async def all_start():
try:
get_sqla('TEMP')
await startup()
except Exception as e:
logger.exception(e)
threading.Thread(tar... | 380 | Python | .py | 12 | 26 | 79 | 0.707865 | jiluoQAQ/Pokemon | 8 | 2 | 1 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,174 | __init__.py | jiluoQAQ_Pokemon/Pokemon/pokemon_resource/__init__.py | from gsuid_core.sv import SV
from gsuid_core.bot import Bot
from gsuid_core.models import Event
from ..utils.resource.download_from_cos import check_use
sv_sr_download_config = SV('pm下载资源', pm=1)
@sv_sr_download_config.on_fullmatch('pm下载全部资源')
async def send_download_resource_msg(bot: Bot, ev: Event):
... | 512 | Python | .py | 12 | 34.166667 | 59 | 0.730594 | jiluoQAQ/Pokemon | 8 | 2 | 1 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,175 | export.py | Jisencc_yolov5_dual_weighting/export.py | # YOLOv5 üöÄ by Ultralytics, AGPL-3.0 license
"""
Export a YOLOv5 PyTorch model to other formats. TensorFlow exports authored by https://github.com/zldrobit
Format | `export.py --include` | Model
--- | --- | ---
PyTorch ... | 41,275 | Python | .py | 741 | 46.978408 | 147 | 0.627363 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,176 | loss_dw.py | Jisencc_yolov5_dual_weighting/loss_dw.py | # YOLOv5 🚀 by Ultralytics, AGPL-3.0 license
"""
Loss functions
"""
import torch
import torch.nn as nn
from utils.metrics import bbox_iou
from utils.torch_utils import de_parallel
def smooth_BCE(eps=0.1): # https://github.com/ultralytics/yolov3/issues/238#issuecomment-598028441
# return positive, negative la... | 11,365 | Python | .py | 216 | 40.439815 | 119 | 0.525804 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,177 | train.py | Jisencc_yolov5_dual_weighting/train.py | # YOLOv5 üöÄ by Ultralytics, AGPL-3.0 license
"""
Train a YOLOv5 model on a custom dataset.
Models and datasets download automatically from the latest YOLOv5 release.
Usage - Single-GPU training:
$ python train.py --data coco128.yaml --weights yolov5s.pt --img 640 # from pretrained (recommended)
$ python tra... | 33,882 | Python | .py | 574 | 46.620209 | 149 | 0.567324 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,178 | detect.py | Jisencc_yolov5_dual_weighting/detect.py | # YOLOv5 🚀 by Ultralytics, AGPL-3.0 license
"""
Run YOLOv5 detection inference on images, videos, directories, globs, YouTube, webcam, streams, etc.
Usage - sources:
$ python detect.py --weights yolov5s.pt --source 0 # webcam
img... | 15,364 | Python | .py | 250 | 48.468 | 120 | 0.566019 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,179 | yolo.py | Jisencc_yolov5_dual_weighting/models/yolo.py | # YOLOv5 🚀 by Ultralytics, AGPL-3.0 license
"""
YOLO-specific modules
Usage:
$ python models/yolo.py --cfg yolov5s.yaml
"""
import argparse
import contextlib
import os
import platform
import sys
from copy import deepcopy
from pathlib import Path
FILE = Path(__file__).resolve()
ROOT = FILE.parents[1] # YOLOv5... | 17,785 | Python | .py | 337 | 43.356083 | 120 | 0.569104 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,180 | experimental.py | Jisencc_yolov5_dual_weighting/models/experimental.py | # YOLOv5 🚀 by Ultralytics, AGPL-3.0 license
"""
Experimental modules
"""
import math
import numpy as np
import torch
import torch.nn as nn
from utils.downloads import attempt_download
class Sum(nn.Module):
# Weighted sum of 2 or more layers https://arxiv.org/abs/1911.09070
def __init__(self, n, weight=Fa... | 4,277 | Python | .py | 91 | 38.791209 | 116 | 0.588814 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,181 | common.py | Jisencc_yolov5_dual_weighting/models/common.py | # YOLOv5 🚀 by Ultralytics, AGPL-3.0 license
"""
Common modules
"""
import ast
import contextlib
import json
import math
import platform
import warnings
import zipfile
from collections import OrderedDict, namedtuple
from copy import copy
from pathlib import Path
from urllib.parse import urlparse
import cv2
import n... | 42,048 | Python | .py | 769 | 43.452536 | 120 | 0.562687 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,182 | tf.py | Jisencc_yolov5_dual_weighting/models/tf.py | # YOLOv5 🚀 by Ultralytics, AGPL-3.0 license
"""
TensorFlow, Keras and TFLite versions of YOLOv5
Authored by https://github.com/zldrobit in PR https://github.com/ultralytics/yolov5/pull/1127
Usage:
$ python models/tf.py --weights yolov5s.pt
Export:
$ python export.py --weights yolov5s.pt --include saved_mod... | 27,021 | Python | .py | 509 | 42.24165 | 120 | 0.560898 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,183 | general.py | Jisencc_yolov5_dual_weighting/utils/general.py | # YOLOv5 🚀 by Ultralytics, AGPL-3.0 license
"""
General utils
"""
import contextlib
import glob
import inspect
import logging
import logging.config
import math
import os
import platform
import random
import re
import signal
import subprocess
import sys
import time
import urllib
from copy import deepcopy
from dateti... | 45,711 | Python | .py | 907 | 43.059537 | 134 | 0.601911 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,184 | dataloaders.py | Jisencc_yolov5_dual_weighting/utils/dataloaders.py | # YOLOv5 üöÄ by Ultralytics, AGPL-3.0 license
"""
Dataloaders and dataset utils
"""
import contextlib
import glob
import hashlib
import json
import math
import os
import random
import shutil
import time
from itertools import repeat
from multiprocessing.pool import Pool, ThreadPool
from pathlib import Path
from thread... | 55,813 | Python | .py | 1,068 | 39.955056 | 123 | 0.547819 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,185 | torch_utils.py | Jisencc_yolov5_dual_weighting/utils/torch_utils.py | # YOLOv5 🚀 by Ultralytics, AGPL-3.0 license
"""
PyTorch utils
"""
import math
import os
import platform
import subprocess
import time
import warnings
from contextlib import contextmanager
from copy import deepcopy
from pathlib import Path
import torch
import torch.distributed as dist
import torch.nn as nn
import t... | 19,644 | Python | .py | 361 | 46.022161 | 120 | 0.621747 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,186 | autoanchor.py | Jisencc_yolov5_dual_weighting/utils/autoanchor.py | # YOLOv5 🚀 by Ultralytics, AGPL-3.0 license
"""
AutoAnchor utils
"""
import random
import numpy as np
import torch
import yaml
from tqdm import tqdm
from utils import TryExcept
from utils.general import LOGGER, TQDM_BAR_FORMAT, colorstr
PREFIX = colorstr('AutoAnchor: ')
def check_anchor_order(m):
# Check a... | 7,421 | Python | .py | 143 | 44.447552 | 124 | 0.603558 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,187 | augmentations.py | Jisencc_yolov5_dual_weighting/utils/augmentations.py | # YOLOv5 🚀 by Ultralytics, AGPL-3.0 license
"""
Image augmentation functions
"""
import math
import random
import cv2
import numpy as np
import torch
import torchvision.transforms as T
import torchvision.transforms.functional as TF
from utils.general import LOGGER, check_version, colorstr, resample_segments, segm... | 17,032 | Python | .py | 324 | 43.885802 | 118 | 0.579982 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,188 | plots.py | Jisencc_yolov5_dual_weighting/utils/plots.py | # YOLOv5 🚀 by Ultralytics, AGPL-3.0 license
"""
Plotting utils
"""
import contextlib
import math
import os
from copy import copy
from pathlib import Path
import cv2
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sn
import torch
from PIL import Image, Imag... | 18,717 | Python | .py | 385 | 40.758442 | 120 | 0.580975 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,189 | loss_dw.py | Jisencc_yolov5_dual_weighting/utils/loss_dw.py | # YOLOv5 🚀 by Ultralytics, AGPL-3.0 license
"""
Loss functions
"""
import torch
import torch.nn as nn
from utils.metrics import bbox_iou
from utils.torch_utils import de_parallel
def smooth_BCE(eps=0.1): # https://github.com/ultralytics/yolov3/issues/238#issuecomment-598028441
# return positive, negative la... | 11,365 | Python | .py | 216 | 40.439815 | 119 | 0.525804 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,190 | metrics.py | Jisencc_yolov5_dual_weighting/utils/metrics.py | # YOLOv5 üöÄ by Ultralytics, AGPL-3.0 license
"""
Model validation metrics
"""
import math
import warnings
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
import torch
from utils import TryExcept, threaded
def fitness(x):
# Model fitness as a weighted combination of metrics
w =... | 14,569 | Python | .py | 296 | 41.047297 | 120 | 0.573439 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,191 | downloads.py | Jisencc_yolov5_dual_weighting/utils/downloads.py | # YOLOv5 🚀 by Ultralytics, AGPL-3.0 license
"""
Download utils
"""
import logging
import subprocess
import urllib
from pathlib import Path
import requests
import torch
def is_url(url, check=True):
# Check if string is URL and check if URL exists
try:
url = str(url)
result = urllib.parse.u... | 4,948 | Python | .py | 107 | 37.635514 | 119 | 0.604024 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,192 | __init__.py | Jisencc_yolov5_dual_weighting/utils/__init__.py | # YOLOv5 🚀 by Ultralytics, AGPL-3.0 license
"""
utils/initialization
"""
import contextlib
import platform
import threading
def emojis(str=''):
# Return platform-dependent emoji-safe version of string
return str.encode().decode('ascii', 'ignore') if platform.system() == 'Windows' else str
class TryExcep... | 2,554 | Python | .py | 64 | 33.5 | 113 | 0.660454 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,193 | triton.py | Jisencc_yolov5_dual_weighting/utils/triton.py | # YOLOv5 🚀 by Ultralytics, AGPL-3.0 license
""" Utils to interact with the Triton Inference Server
"""
import typing
from urllib.parse import urlparse
import torch
class TritonRemoteModel:
""" A wrapper over a model served by the Triton Inference Server. It can
be configured to communicate over GRPC or H... | 3,635 | Python | .py | 69 | 42.637681 | 120 | 0.638028 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,194 | loss.py | Jisencc_yolov5_dual_weighting/utils/loss.py | # YOLOv5 🚀 by Ultralytics, AGPL-3.0 license
"""
Loss functions
"""
import numpy as np
import torch
import torch.nn as nn
from utils.metrics import bbox_iou
from utils.torch_utils import de_parallel
def smooth_BCE(eps=0.1): # https://github.com/ultralytics/yolov3/issues/238#issuecomment-598028441
# return pos... | 13,056 | Python | .py | 246 | 39.955285 | 129 | 0.512027 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,195 | activations.py | Jisencc_yolov5_dual_weighting/utils/activations.py | # YOLOv5 🚀 by Ultralytics, AGPL-3.0 license
"""
Activation functions
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
class SiLU(nn.Module):
# SiLU activation https://arxiv.org/pdf/1606.08415.pdf
@staticmethod
def forward(x):
return x * torch.sigmoid(x)
class Hardswish(... | 3,450 | Python | .py | 80 | 36.2875 | 106 | 0.615477 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,196 | autobatch.py | Jisencc_yolov5_dual_weighting/utils/autobatch.py | # YOLOv5 üöÄ by Ultralytics, AGPL-3.0 license
"""
Auto-batch utils
"""
from copy import deepcopy
import numpy as np
import torch
from utils.general import LOGGER, colorstr
from utils.torch_utils import profile
def check_train_batch_size(model, imgsz=640, amp=True):
# Check YOLOv5 training batch size
with ... | 2,990 | Python | .py | 60 | 44.433333 | 124 | 0.660041 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,197 | callbacks.py | Jisencc_yolov5_dual_weighting/utils/callbacks.py | # YOLOv5 🚀 by Ultralytics, AGPL-3.0 license
"""
Callback utils
"""
import threading
class Callbacks:
""""
Handles all registered callbacks for YOLOv5 Hooks
"""
def __init__(self):
# Define the available callbacks
self._callbacks = {
'on_pretrain_routine_start': [],
... | 2,663 | Python | .py | 65 | 30.938462 | 106 | 0.565906 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,198 | example_request.py | Jisencc_yolov5_dual_weighting/utils/flask_rest_api/example_request.py | # YOLOv5 🚀 by Ultralytics, AGPL-3.0 license
"""
Perform test request
"""
import pprint
import requests
DETECTION_URL = 'http://localhost:5000/v1/object-detection/yolov5s'
IMAGE = 'zidane.jpg'
# Read image
with open(IMAGE, 'rb') as f:
image_data = f.read()
response = requests.post(DETECTION_URL, files={'imag... | 369 | Python | .py | 13 | 26.615385 | 75 | 0.748571 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,199 | restapi.py | Jisencc_yolov5_dual_weighting/utils/flask_rest_api/restapi.py | # YOLOv5 🚀 by Ultralytics, AGPL-3.0 license
"""
Run a Flask REST API exposing one or more YOLOv5s models
"""
import argparse
import io
import torch
from flask import Flask, request
from PIL import Image
app = Flask(__name__)
models = {}
DETECTION_URL = '/v1/object-detection/<model>'
@app.route(DETECTION_URL, m... | 1,440 | Python | .py | 35 | 35.885714 | 120 | 0.658046 | Jisencc/yolov5_dual_weighting | 8 | 3 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |