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,300 | test_TreeBoxes.py | weecology_MillionTrees/tests/test_TreeBoxes.py | from milliontrees.datasets.TreeBoxes import TreeBoxesDataset
from milliontrees.common.data_loaders import get_train_loader, get_eval_loader
import torch
import pytest
import os
import pandas as pd
import numpy as np
# Check if running on hipergator
if os.path.exists("/orange"):
on_hipergator = True
else:
on_h... | 4,663 | Python | .py | 107 | 36.607477 | 98 | 0.646018 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,301 | test_TreePoints.py | weecology_MillionTrees/tests/test_TreePoints.py | from milliontrees.datasets.TreePoints import TreePointsDataset
import os
import pytest
import torchvision.transforms.v2 as transforms
# Check if running on hipergator
if os.path.exists("/orange"):
on_hipergator = True
else:
on_hipergator = False
# Test structure without real annotation data to ensure format i... | 2,391 | Python | .py | 58 | 34.87931 | 124 | 0.694444 | weecology/MillionTrees | 8 | 2 | 7 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,302 | CVE-2023-22518.py | davidfortytwo_CVE-2023-22518/CVE-2023-22518.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Author: David Espejo (Fortytwo Security)
import os
import json
import argparse
import requests
import logging
from rich import print
from alive_progress import alive_bar
HEADERS = {
"X-Atlassian-Token": "no-check",
"User-Agent": "Mozilla/5.0 (Linux; U; Android ... | 7,881 | Python | .py | 161 | 40.086957 | 212 | 0.657381 | davidfortytwo/CVE-2023-22518 | 8 | 2 | 1 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,303 | decorator.py | Aues6uen11Z_Zafkiel/zafkiel/decorator.py | from typing import Callable, Generic, TypeVar
T = TypeVar("T")
def run_once(f):
"""
From https://github.com/LmeSzinc/StarRailCopilot/blob/master/module/base/decorator.py
Run a function only once, no matter how many times it has been called.
Examples:
@run_once
def my_function(foo, ba... | 1,946 | Python | .py | 58 | 25.517241 | 94 | 0.604925 | Aues6uen11Z/Zafkiel | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,304 | config.py | Aues6uen11Z_Zafkiel/zafkiel/config.py | from airtest.core.settings import Settings
class Config:
ST = Settings
ST.CVSTRATEGY = ["tpl", "akaze"]
ST.THRESHOLD = 0.8
| 137 | Python | .py | 5 | 23.6 | 42 | 0.7 | Aues6uen11Z/Zafkiel | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,305 | exception.py | Aues6uen11Z_Zafkiel/zafkiel/exception.py | class NotRunningError(Exception):
pass
class PageUnknownError(Exception):
pass
class ScriptError(Exception):
pass
class LoopError(Exception):
pass
| 168 | Python | .py | 8 | 17.375 | 34 | 0.793548 | Aues6uen11Z/Zafkiel | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,306 | report.py | Aues6uen11Z_Zafkiel/zafkiel/report.py | import os
import shutil
import traceback
from PIL import Image
from airtest.aircv import imread, FileNotExistError, get_resolution
from airtest.report.report import LogToHtml, LOGGING, HTML_FILE, DEFAULT_LOG_DIR, DEFAULT_LOG_FILE, HTML_TPL
from airtest.utils.compat import script_dir_name
from zafkiel.config import C... | 3,786 | Python | .py | 83 | 33.686747 | 120 | 0.579846 | Aues6uen11Z/Zafkiel | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,307 | utils.py | Aues6uen11Z_Zafkiel/zafkiel/utils.py | import cv2
import numpy as np
from PIL import Image
def random_rectangle_point(center, h, w, n=3):
"""
From https://github.com/LmeSzinc/StarRailCopilot/blob/master/module/base/utils/utils.py
Choose a random point in an area.
Args:
center: coordinate of the area center
h: height of the... | 4,133 | Python | .py | 99 | 35.737374 | 110 | 0.666001 | Aues6uen11Z/Zafkiel | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,308 | __init__.py | Aues6uen11Z_Zafkiel/zafkiel/__init__.py | from airtest.core.helper import G
from zafkiel.config import Config
from zafkiel.device.api import *
from zafkiel.device.template import Template
from zafkiel.device.win import WindowsPlatform
from zafkiel.timer import Timer
from zafkiel.report import simple_report
from zafkiel.logger import logger
__version__ = '0.2... | 368 | Python | .py | 10 | 35.4 | 46 | 0.847458 | Aues6uen11Z/Zafkiel | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,309 | logger.py | Aues6uen11Z_Zafkiel/zafkiel/logger.py | import logging
import sys
from loguru import logger
airtest_logger = logging.getLogger("airtest")
airtest_logger.setLevel(logging.ERROR)
logger.remove()
logger.add(sys.stdout, format="<green>{time:YYYY-MM-DD HH:mm:ss.SSS}</green> | "
"<level>{level: <7}</level> | "
... | 372 | Python | .py | 10 | 28.6 | 80 | 0.596639 | Aues6uen11Z/Zafkiel | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,310 | timer.py | Aues6uen11Z_Zafkiel/zafkiel/timer.py | import time
from zafkiel import logger
class Timer:
def __init__(self, limit, count=0):
"""
From https://github.com/LmeSzinc/StarRailCopilot/blob/master/module/base/timer.py
Args:
limit (int, float): Timer limit
count (int): Timer reach confirm count. Default to 0... | 2,503 | Python | .py | 79 | 21.632911 | 110 | 0.529314 | Aues6uen11Z/Zafkiel | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,311 | ui.py | Aues6uen11Z_Zafkiel/zafkiel/ui/ui.py | from zafkiel import exists, Template, app_is_running, touch, screenshot
from zafkiel.logger import logger
from zafkiel.ocr.ocr import Ocr
from zafkiel.ui.page import Page
from zafkiel.decorator import run_once
from zafkiel.exception import NotRunningError, PageUnknownError, ScriptError
from zafkiel.timer import Timer
f... | 9,036 | Python | .py | 243 | 24.666667 | 112 | 0.529728 | Aues6uen11Z/Zafkiel | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,312 | page.py | Aues6uen11Z_Zafkiel/zafkiel/ui/page.py | from __future__ import annotations
import traceback
from zafkiel.device.template import ImageTemplate as Template
from zafkiel.ui.switch import Switch
class Page:
"""
Main code comes from https://github.com/LmeSzinc/StarRailCopilot/blob/master/tasks/base/page.py
"""
# Key: str, page name like "page_... | 2,391 | Python | .py | 66 | 26.80303 | 99 | 0.582936 | Aues6uen11Z/Zafkiel | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,313 | switch.py | Aues6uen11Z_Zafkiel/zafkiel/ui/switch.py | from zafkiel.device.template import ImageTemplate as Template
from zafkiel.exception import ScriptError
class Switch:
"""
A wrapper to handle switches in game, switch among states with retries.
Main code comes from https://github.com/LmeSzinc/StarRailCopilot/blob/master/module/ui/switch.py
Examples:
... | 2,118 | Python | .py | 54 | 29.703704 | 104 | 0.584308 | Aues6uen11Z/Zafkiel | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,314 | __init__.py | Aues6uen11Z_Zafkiel/zafkiel/ui/__init__.py | from zafkiel.ui.page import Page
from zafkiel.ui.switch import Switch
from zafkiel.ui.ui import UI
| 99 | Python | .py | 3 | 32 | 36 | 0.84375 | Aues6uen11Z/Zafkiel | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,315 | template.py | Aues6uen11Z_Zafkiel/zafkiel/device/template.py | import os
import types
from functools import cached_property
from pathlib import Path
import cv2
from airtest.core.cv import Template, MATCHING_METHODS
from airtest.core.error import InvalidMatchingMethodError
from airtest.core.helper import G, logwrap
from airtest.utils.transform import TargetPos
from numpy import nd... | 7,563 | Python | .py | 160 | 36.88125 | 133 | 0.60456 | Aues6uen11Z/Zafkiel | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,316 | api.py | Aues6uen11Z_Zafkiel/zafkiel/device/api.py | from typing import Optional, Tuple, Type, Callable, Union, List
from airtest.core.api import *
from airtest.core.cv import try_log_screen
from airtest.core.error import TargetNotFoundError
from airtest.core.helper import G, logwrap, delay_after_operation, set_logdir
from airtest.core.settings import Settings as ST
fro... | 13,483 | Python | .py | 326 | 33.521472 | 118 | 0.637447 | Aues6uen11Z/Zafkiel | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,317 | win.py | Aues6uen11Z_Zafkiel/zafkiel/device/win.py | from typing import Tuple
from airtest.core.win import Windows
from pyautogui import dragTo, moveTo
from pytweening import easeOutQuad
import win32gui
class WindowsPlatform(Windows):
def app_is_running(self) -> bool:
state = self.app.is_process_running()
return state
def stop_app(self, pid: ... | 1,386 | Python | .py | 37 | 28.918919 | 103 | 0.609118 | Aues6uen11Z/Zafkiel | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,318 | cv.py | Aues6uen11Z_Zafkiel/zafkiel/device/cv.py | import time
from airtest.core.cv import try_log_screen
from airtest.core.error import TargetNotFoundError
from airtest.core.helper import logwrap, G
from airtest.core.settings import Settings as ST
from zafkiel.logger import logger
from zafkiel.ocr.ocr import Ocr
from zafkiel.utils import is_color_similar, crop
@lo... | 3,014 | Python | .py | 68 | 33.735294 | 118 | 0.618609 | Aues6uen11Z/Zafkiel | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,319 | models.py | Aues6uen11Z_Zafkiel/zafkiel/ocr/models.py | from pponnxcr import TextSystem as TextSystem_
from zafkiel.decorator import cached_property
from zafkiel.exception import ScriptError
DIC_LANG_TO_MODEL = {
'cn': 'zhs',
'en': 'en',
'jp': 'ja',
'tw': 'zht',
}
def lang2model(lang: str) -> str:
"""
Args:
lang: In-game language name, de... | 1,731 | Python | .py | 57 | 23.842105 | 79 | 0.621148 | Aues6uen11Z/Zafkiel | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,320 | ocr.py | Aues6uen11Z_Zafkiel/zafkiel/ocr/ocr.py | import re
import time
from datetime import timedelta
from difflib import SequenceMatcher
from typing import Optional
from pponnxcr.predict_system import BoxedResult
from zafkiel.logger import logger
from zafkiel.config import Config
from zafkiel.decorator import cached_property
from zafkiel.device.template import Ima... | 12,938 | Python | .py | 338 | 28.14497 | 115 | 0.575561 | Aues6uen11Z/Zafkiel | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,321 | keyword.py | Aues6uen11Z_Zafkiel/zafkiel/ocr/keyword.py | import re
from dataclasses import dataclass
from functools import cached_property
from typing import ClassVar
from zafkiel.config import Config
from zafkiel.exception import ScriptError
REGEX_PUNCTUATION = re.compile(r'[ ,.\'"“”,。::!!??·•\-—/\\\n\t()\[\]()「」『』【】《》[]]')
def parse_name(n):
n = REGEX_PUNCTUATION.s... | 4,613 | Python | .py | 139 | 23.071942 | 101 | 0.541676 | Aues6uen11Z/Zafkiel | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,322 | utils.py | Aues6uen11Z_Zafkiel/zafkiel/ocr/utils.py | import itertools
import numpy as np
from pponnxcr.predict_system import BoxedResult
def area_cross_area(area1, area2, thres_x=20, thres_y=20):
"""
Args:
area1: (upper_left_x, upper_left_y, bottom_right_x, bottom_right_y).
area2: (upper_left_x, upper_left_y, bottom_right_x, bottom_right_y).
... | 5,507 | Python | .py | 139 | 32.827338 | 93 | 0.633189 | Aues6uen11Z/Zafkiel | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,323 | __init__.py | Aues6uen11Z_Zafkiel/zafkiel/ocr/__init__.py | """
This OCR module is from https://github.com/LmeSzinc/StarRailCopilot/tree/master/module/ocr,
only modified to fit the project and:
delete some methods
add Ocr.ocr_match_keyword()
"""
from zafkiel.ocr.keyword import Keyword
from zafkiel.ocr.ocr import Ocr, Digit, DigitCounter, Duration, OcrResultButton
| 306 | Python | .py | 8 | 37.25 | 91 | 0.815436 | Aues6uen11Z/Zafkiel | 8 | 1 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,324 | main.py | usexhs_xhs-link/src/main.py | import os
import re
import logging
from flask import Flask, redirect, request, send_file, render_template
from urllib.parse import unquote
import requests
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
# import lib.redis_handler # WIP
from lib import sql_handler
... | 7,049 | Python | .py | 152 | 41.072368 | 108 | 0.692342 | usexhs/xhs-link | 8 | 0 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,325 | sql_handler.py | usexhs_xhs-link/src/lib/sql_handler.py | import os
import psycopg2
# from datetime import datetime
# Set up PostgreSQL
pg_host = os.environ.get('POSTGRES_HOST', 'postgres')
pg_port = os.environ.get('POSTGRES_PORT', '5432')
pg_user = os.environ.get('POSTGRES_USER', 'xhslink')
pg_password = os.environ.get('POSTGRES_PASSWORD', 'xhslink-password')
# pg_database ... | 1,882 | Python | .py | 57 | 26.701754 | 91 | 0.645465 | usexhs/xhs-link | 8 | 0 | 0 | AGPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,326 | main.py | activate-sh_Rubika-Group-Management/main.py | from rubpy import Client, Message, handlers
from rubpy import models, methods, exceptions
from rich.console import Console
from datetime import datetime
from asyncio import run
admins = [] # No need to edit this list
groups = [
'', # group one
'', # group two
# and...
]
filters = [
'@',
'joinc',
... | 19,614 | Python | .py | 370 | 27.035135 | 104 | 0.40988 | activate-sh/Rubika-Group-Management | 8 | 0 | 0 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,327 | dlc2adpt.py | tangguoling_ADPT/data/dlc2adpt.py | # -*- coding: utf-8 -*-
"""
Created on Wed Nov 16 10:36:10 2022
@author: tang
"""
import cv2
import glob
import pandas as pd
import json
import h5py
csvs = glob.glob('D:/ADPT/data/mouse/labeled-data/*/CollectedData_*.csv')
f = open('mouse.json','w')
all_data = []
for csv in csvs:
data = pd.read_cs... | 1,456 | Python | .py | 46 | 22.478261 | 74 | 0.51787 | tangguoling/ADPT | 8 | 0 | 1 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,328 | predict.py | tangguoling_ADPT/code/predict.py | # -*- coding: utf-8 -*-
"""
Created on Mon Jan 8 18:49:52 2024
@author: tang
"""
import warnings
warnings.filterwarnings('ignore')
from core.predict import predict
import yaml
from config.config_training import configuration
from config.config_predicting import configuration_predict
if __name__ == '__ma... | 1,881 | Python | .py | 31 | 54.741935 | 339 | 0.700883 | tangguoling/ADPT | 8 | 0 | 1 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,329 | train.py | tangguoling_ADPT/code/train.py | # -*- coding: utf-8 -*-
"""
Created on Mon Jan 8 18:49:52 2024
@author: tang
"""
import warnings
warnings.filterwarnings('ignore')
from core.train import train
from core.data_aug import data_augmentation
import yaml
from config.config_training import configuration
if __name__ == '__main__':
print('... | 1,637 | Python | .py | 27 | 55.296296 | 367 | 0.701511 | tangguoling/ADPT | 8 | 0 | 1 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,330 | config_predicting.py | tangguoling_ADPT/code/config/config_predicting.py | # -*- coding: utf-8 -*-
"""
Created on Tue Jan 2 21:45:08 2024
@author: tang
"""
import glob
def configuration_predict(result_predict):
videos = glob.glob(result_predict['Video_path']+ '/*.' + result_predict['Video_type'])
save_video = result_predict['save_predicted_video']
# shuffle_num = 1... | 534 | Python | .py | 14 | 33.857143 | 91 | 0.679612 | tangguoling/ADPT | 8 | 0 | 1 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,331 | config_training.py | tangguoling_ADPT/code/config/config_training.py | # -*- coding: utf-8 -*-
"""
Created on Mon Jan 8 16:21:36 2024
@author: tang
"""
import glob
from matplotlib import pyplot as plt
import yaml
def configuration(result):
IMG_DIR = result['IMG_DIR']
JSON = result['JSON']
IMG_SIZE_H_ori, IMG_SIZE_W_ori = result['IMG_SIZE_H_ori'],result['IMG_SIZ... | 1,660 | Python | .py | 33 | 44.424242 | 304 | 0.676286 | tangguoling/ADPT | 8 | 0 | 1 | GPL-3.0 | 9/5/2024, 10:47:52 PM (Europe/Amsterdam) |
2,285,332 | predict.cp39-win_amd64.pyd | tangguoling_ADPT/code/core/predict.cp39-win_amd64.pyd | MZ� ÿÿ ¸ @ º ´ Í!¸LÍ!This program cannot be run in DOS mode.
$ ÖIÊ4’(¤g’(¤g’(¤g›P7g�(¤g”©¥f�(¤gÙP¥f�(¤g”©¡fŸ(¤g”© fš(¤g”©§f–(¤g1A¥f‘(¤g’(¥g!(¤gÿ©¬f“(¤gÿ©¤f“(¤gÿ©[g“(¤gÿ©¦f“(¤gRich’(¤g PE d† R”ªe ğ " & |