text stringlengths 185 73.3k | repo stringlengths 7 100 | path stringlengths 4 146 | language stringclasses 7
values | hash stringlengths 16 16 | score float64 7 8.5 | stars int64 0 237k |
|---|---|---|---|---|---|---|
"""
Utility functions for metadata processing and general helper functions.
This module provides functions for normalizing and encoding metadata features,
as well as general utility functions for saving/loading models and results.
"""
import numpy as np
import pandas as pd
import pickle
import json
from typing import... | melove297/reddit-factuality-detection | src/utils.py | .py | 52d3044f02f6bd6e | 7.15 | 1 |
"""
Visualization utilities for research results.
This module provides comprehensive visualization functions for analyzing
model performance, training dynamics, and Reuters alignment.
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from typing import Optional, List, Di... | melove297/reddit-factuality-detection | src/visualize_results.py | .py | 6561f30ab18eff6e | 7.15 | 1 |
#!/usr/bin/env python3
"""
Run the whole pipeline for one replicate: build -> equilibrate -> produce -> analyse.
Each stage is skipped if its output already exists, so re-running after an
interruption resumes rather than restarts. Use --force to redo a stage.
"""
from __future__ import annotations
import argparse
i... | AhmedIftikhar217/MDsimulations | bmp2_md/scripts/run_all.py | .py | d81bef20061ddc3a | 7 | 0 |
#!/usr/bin/env python3
"""
Análise completa dos top 10 markets da Polymarket
Com recomendações de investimento
"""
import sys
sys.path.insert(0, 'src')
import asyncio
import httpx
import json
from datetime import datetime
async def get_top_markets_with_analysis():
"""Busca e analisa os top 10 markets"""
prin... | Justkokosixnine/polymarket-mcp-server | analyze_top_markets.py | .py | 87a631a532c551ee | 7.35 | 4 |
#!/usr/bin/env python3
"""
ULTRA DEEP ANALYSIS - Government Shutdown Markets
Análise completa de todos os markets relacionados ao shutdown
"""
import sys
sys.path.insert(0, 'src')
import asyncio
import httpx
import json
from datetime import datetime
from collections import defaultdict
async def deep_shutdown_analysis... | Justkokosixnine/polymarket-mcp-server | shutdown_deep_analysis.py | .py | 33a6331c4f5c3346 | 7.35 | 4 |
#!/usr/bin/env python3
"""
ULTRA DEEP ANALYSIS - Government Shutdown Markets (CORRETO)
Análise dos 7 markets específicos sobre shutdown
"""
import sys
sys.path.insert(0, 'src')
import asyncio
import httpx
import json
from datetime import datetime
async def ultra_shutdown_analysis():
"""Análise ultra profunda dos ... | Justkokosixnine/polymarket-mcp-server | shutdown_ultra_analysis.py | .py | 6cfb41089a8dddd6 | 7.35 | 4 |
#!/usr/bin/env python3
"""
Smoke Test for Polymarket MCP Server
Quick validation of basic functionality (runs in ~10 seconds):
- Package imports
- Configuration loading
- API connectivity
- Basic tool execution
Returns: PASS/FAIL with details
Usage:
python smoke_test.py
"""
import sys
import os
import time
impor... | Justkokosixnine/polymarket-mcp-server | smoke_test.py | .py | e0a26cdf0dd94283 | 7.85 | 4 |
"""
Order signing utilities for Polymarket CLOB.
Handles EIP-712 signatures and order hash generation.
"""
from typing import Dict, Any, Optional
from eth_account import Account
from eth_account.messages import encode_typed_data
from eth_utils import keccak
import logging
logger = logging.getLogger(__name__)
class S... | Justkokosixnine/polymarket-mcp-server | src/polymarket_mcp/auth/signer.py | .py | 8e4cbd23a2e324c6 | 7.35 | 4 |
"""
Polymarket MCP Server - Main entry point.
Provides MCP server for Polymarket trading integration with Claude Desktop.
"""
import asyncio
import logging
from typing import Any, Dict, Optional
import mcp.server.stdio
import mcp.types as types
from mcp.server import Server
from .config import load_config, Polymarke... | Justkokosixnine/polymarket-mcp-server | src/polymarket_mcp/server.py | .py | c2662bc54cbe39b6 | 7.35 | 4 |
"""
Portfolio tools integration for server.py.
This module provides helper functions to integrate portfolio tools into the MCP server.
"""
import mcp.types as types
from .portfolio import PORTFOLIO_TOOLS
def get_portfolio_tool_definitions() -> list[types.Tool]:
"""
Get portfolio tool definitions for MCP serv... | Justkokosixnine/polymarket-mcp-server | src/polymarket_mcp/tools/portfolio_integration.py | .py | bf27541c3d67158b | 7.35 | 4 |
"""
Rate limiter implementation using token bucket algorithm.
Respects Polymarket's API rate limits across different endpoint categories.
"""
import asyncio
import time
from collections import defaultdict
from dataclasses import dataclass
from enum import Enum
from typing import Dict, Optional
import logging
logger = ... | Justkokosixnine/polymarket-mcp-server | src/polymarket_mcp/utils/rate_limiter.py | .py | 4a2d448b439b9469 | 7.35 | 4 |
"""
Safety limits and risk management for Polymarket trading.
Validates orders against configured limits before execution.
"""
from dataclasses import dataclass
from typing import Dict, List, Optional, Tuple
import logging
logger = logging.getLogger(__name__)
@dataclass
class OrderRequest:
"""Represents an order... | Justkokosixnine/polymarket-mcp-server | src/polymarket_mcp/utils/safety_limits.py | .py | 87dccaed1131979c | 7.35 | 4 |
#!/usr/bin/env python3
"""
Quick test script for the Web Dashboard.
Tests:
- FastAPI app can be imported
- Templates directory exists
- Static files exist
- API endpoints are registered
"""
import sys
from pathlib import Path
def test_imports():
"""Test that all modules can be imported"""
print("Testing impor... | Justkokosixnine/polymarket-mcp-server | test_web_dashboard.py | .py | d4d58bb47b786140 | 7.85 | 4 |
"""
Pytest configuration and fixtures for Polymarket MCP Server tests.
This file is automatically loaded by pytest and provides:
- Custom markers
- Shared fixtures
- Test configuration
"""
import pytest
import os
def pytest_configure(config):
"""Configure custom markers."""
config.addinivalue_line(
"... | Justkokosixnine/polymarket-mcp-server | tests/conftest.py | .py | e9d32792532dca2d | 7.85 | 4 |
"""
Comprehensive tests for market discovery and analysis tools.
Tests all 18 tools with real Polymarket API (no mocks).
"""
import pytest
import asyncio
from datetime import datetime, timedelta
from polymarket_mcp.tools import market_discovery, market_analysis
from polymarket_mcp.tools.market_analysis import PriceDa... | Justkokosixnine/polymarket-mcp-server | tests/test_market_tools.py | .py | 63cae808d837f287 | 7.85 | 4 |
"""Helpers for reactor kinetics: delayed neutron data and critical scaling.
The time-dependent solvers take a :class:`DelayedNeutronData` describing the
delayed neutron precursor groups. ``make_delayed_data`` builds one from compact
per-material specifications, the way ``create.make_materials`` builds a
``Materials``... | bwhewe-13/NeutronDiffusion | src/ndiffusion/kinetics.py | .py | 1f69e76c7596a3f8 | 7.24 | 2 |
"""
Tests for ndiffusion.load_gmsh.
Gated on the optional ``gmsh`` dependency (``pip install ndiffusion[mesh]``);
skipped cleanly when gmsh is not installed. Builds a small disk mesh with one
physical surface (fuel) and one physical boundary curve (vacuum), loads it via
load_gmsh, and feeds the result to the unstruct... | bwhewe-13/NeutronDiffusion | tests/test_mesh_gmsh.py | .py | 1216ac8c0c876bf2 | 7.74 | 2 |
"""Mirror the Mealie meal plan into a Radicale calendar.
Mealie owns the household meal plan; this job projects it onto the shared
family calendar so meals show up in everyone's phone calendar app next to
real events. Stateless: every event the mirror writes carries an
X-MEALIE-MIRROR property with a content hash, so ... | a-mcf/k3s-gitops | cluster/apps/radicale/mealie-mirror/app/resources/mealie_mirror.py | .py | 6f78c730f02317dd | 7.15 | 1 |
"""Mirror Proton Calendar secret ICS feeds into Radicale collections.
Proton Calendar is the household's invite intake (its iMIP handling
auto-adds emailed invitations); this job drains it into the real,
self-hosted calendar. Stateless: every event the mirror writes carries an
X-PROTON-MIRROR property with a content h... | a-mcf/k3s-gitops | cluster/apps/radicale/proton-mirror/app/resources/proton_mirror.py | .py | fe6a29725741ec0b | 7.15 | 1 |
"""Mirror the school lunch menu into a Radicale calendar.
The district publishes menus through LINQ Connect; this job projects the
lunch session onto the shared family calendar as all-day entries. Stateless
in the same way as the Mealie mirror: every event carries an
X-SCHOOL-LUNCH-MIRROR property with a content hash,... | a-mcf/k3s-gitops | cluster/apps/radicale/school-lunch-mirror/app/resources/school_lunch_mirror.py | .py | 4283ba1f2eca96f2 | 7.15 | 1 |
#!/usr/bin/env python3
"""Chart staleness audit — for every HelmRelease, compare the pinned chart
version against its HelmRepository index: versions behind, pin age, and
upstream's most recent release. Flags unreferenced HelmRepositories.
Needs: kubectl access, python3-yaml. Usage: ./hack/staleness-audit.py
"""
import ... | a-mcf/k3s-gitops | hack/staleness-audit.py | .py | ff9521537104f844 | 7.15 | 1 |
"""
The code for ExponentiatedGradientReduction wraps the source class
fairlearn.reductions.ExponentiatedGradient
available in the https://github.com/fairlearn/fairlearn library
licensed under the MIT Licencse, Copyright Microsoft Corporation
"""
from logging import warning
import pandas as pd
from aif360.algorithms ... | kidologi/AI_lForge | aif360/algorithms/inprocessing/exponentiated_gradient_reduction.py | .py | 267c7e4fa5d2aa06 | 7.15 | 1 |
# Copyright 2019 Seth V. Neel, Michael J. Kearns, Aaron L. Roth, Zhiwei Steven Wu
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | kidologi/AI_lForge | aif360/algorithms/inprocessing/gerryfair/clean.py | .py | 01e9814b98dd4055 | 7.15 | 1 |
# Copyright 2019 Seth V. Neel, Michael J. Kearns, Aaron L. Roth, Zhiwei Steven Wu
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | kidologi/AI_lForge | aif360/algorithms/inprocessing/gerryfair/heatmap.py | .py | c9715f1fa937a264 | 7.15 | 1 |
# Copyright 2019 Seth V. Neel, Michael J. Kearns, Aaron L. Roth, Zhiwei Steven Wu
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | kidologi/AI_lForge | aif360/algorithms/inprocessing/gerryfair/learner.py | .py | bafd93ca2b623e45 | 7.15 | 1 |
# Copyright 2019 Seth V. Neel, Michael J. Kearns, Aaron L. Roth, Zhiwei Steven Wu
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | kidologi/AI_lForge | aif360/algorithms/inprocessing/gerryfair/reg_oracle_class.py | .py | b74d279967400773 | 7.15 | 1 |
"""
The code for GridSearchReduction wraps the source class
fairlearn.reductions.GridSearch
available in the https://github.com/fairlearn/fairlearn library
licensed under the MIT Licencse, Copyright Microsoft Corporation
"""
from logging import warning
try:
import fairlearn.reductions as red
except ImportError as ... | kidologi/AI_lForge | aif360/algorithms/inprocessing/grid_search_reduction.py | .py | d6fec74ed64f3029 | 7.15 | 1 |
# The code for Meta-Classification-Algorithm is based on, the paper https://arxiv.org/abs/1806.06055
# See: https://github.com/vijaykeswani/FairClassification
import numpy as np
from aif360.algorithms import Transformer
from aif360.algorithms.inprocessing.celisMeta import FalseDiscovery
from aif360.algorithms.inproces... | kidologi/AI_lForge | aif360/algorithms/inprocessing/meta_fair_classifier.py | .py | 13f37d7022df3121 | 7.15 | 1 |
# Copyright (c) 2017 Niels Bantilan
# This software includes modifications made by Fujitsu Limited to the original
# software licensed under the MIT License. Modified portions of this software
# are the modification of the condition to correct target labels especially in
# functions _n_relabels, _relabel and _relabel_t... | kidologi/AI_lForge | aif360/algorithms/isf_helpers/isf_utils/relabelling.py | .py | 91d1cd2ff70a5b87 | 7.15 | 1 |
# Original work Copyright (c) 2017 Geoff Pleiss
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, p... | kidologi/AI_lForge | aif360/algorithms/postprocessing/eq_odds_postprocessing.py | .py | 13036802e3034685 | 7.15 | 1 |
import numpy as np
from aif360.algorithms import Transformer
class DisparateImpactRemover(Transformer):
"""Disparate impact remover is a preprocessing technique that edits feature
values increase group fairness while preserving rank-ordering within groups
[1]_.
References:
.. [1] M. Feldman,... | kidologi/AI_lForge | aif360/algorithms/preprocessing/disparate_impact_remover.py | .py | 9879d57505a7b624 | 7.15 | 1 |
#!/usr/bin/env python3
import sys
import hashlib
import os
# 混淆的授权检查
_x = "oipmuxel"
_y = hashlib.sha256(_x.encode()).hexdigest()
def check_license():
"""检查授权"""
try:
if not os.path.exists("license.key"):
return False
with open("license.key", "r") as f:
key = f.read().s... | KanderZamora19/fakabot | _auth_check.py | .py | 833d537e144cf703 | 7.35 | 4 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 授权检查 - 请勿删除此部分,否则程序无法运行
import _auth_check
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
离线授权验证 - 无需服务器
直接验证授权码,不需要联网
"""
import hashlib
import time
import os
import sys
from datetime import datetime
class OfflineLicenseChecker:
"""离线授权验证器"""
def __i... | KanderZamora19/fakabot | offline_license_checker.py | .py | dca4446d4262a97f | 7.35 | 4 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 授权检查 - 请勿删除此部分,否则程序无法运行
import _auth_check
#!/usr/bin/env python3
"""
支付系统核心模块 - 重构版
- 柠檬支付:使用官方标准对接
- TOKEN188 USDT:保持原有逻辑不变
"""
import time
import hashlib
import requests
from typing import Tuple, Optional
from urllib.parse import urlencode
from payments_lemzf_offici... | KanderZamora19/fakabot | payments.py | .py | 2fab46fc62e9e9d2 | 7.35 | 4 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 授权检查 - 请勿删除此部分,否则程序无法运行
import _auth_check
#!/usr/bin/env python3
"""
柠檬支付官方标准对接模块
严格按照官方文档 https://api.lemzf.com/doc.html 实现
支持页面跳转支付和API接口支付
"""
import hashlib
import requests
import time
from typing import Dict, Any, Optional, Tuple
from urllib.parse import urlencod... | KanderZamora19/fakabot | payments_lemzf_official.py | .py | a2ca8baf9bba7dd4 | 7.35 | 4 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 授权检查 - 请勿删除此部分,否则程序无法运行
import _auth_check
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
频率限制模块
防止恶意刷单、暴力攻击等
"""
import time
from typing import Optional, Tuple
from redis_cache import cache
class RateLimiter:
"""频率限制器"""
# 限制规则配置
RULES = {
... | KanderZamora19/fakabot | rate_limiter.py | .py | c7eb454867a07453 | 7.35 | 4 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 授权检查 - 请勿删除此部分,否则程序无法运行
import _auth_check
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Redis缓存模块
提供商品信息、配置、用户会话等数据的缓存功能
"""
import redis
import json
import os
from typing import Any, Optional
from functools import wraps
import time
# Redis连接配置
REDIS_HOST = os.g... | KanderZamora19/fakabot | redis_cache.py | .py | 251eb436f9b238cc | 7.35 | 4 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 授权检查 - 请勿删除此部分,否则程序无法运行
import _auth_check
# Consolidated utilities module: merged from utils/*.py
# Sections:
# - constants: STATUS_ZH, MSG
# - home: render_home
# - keyboards: build_payment_rows, row_back, row_home_admin, make_markup
# - misc: parse_date, fmt_ts, to_b... | KanderZamora19/fakabot | utils.py | .py | b0a7f325fba4fce5 | 7.35 | 4 |
"""Convert MimicKit pickle motion files to CSV format."""
import pickle
import numpy as np
import tyro
from scipy.spatial.transform import Rotation, Slerp
class FlexibleClass:
"""A class that accepts any arguments and stores them."""
def __init__(self, *args, **kwargs):
self.args = args
self.kwargs = k... | minheinchay/g1_spinkick_example | pkl_to_csv.py | .py | 77e27f2ab38a4379 | 7.35 | 4 |
import os, time, json
from datetime import datetime
from typing import List, Optional, Dict, Any
from fastapi import FastAPI, HTTPException
from pydantic import BaseModel
from prometheus_client import Counter, Histogram, Gauge, generate_latest, CONTENT_TYPE_LATEST
from fastapi.responses import Response
from retrieval.e... | hamzaideators/cinerag | app/main.py | .py | bf5e33c568acb45a | 7.3 | 3 |
"""
LLM evaluation runner for CineRAG.
"""
import os
import json
import argparse
import statistics as stats
from typing import List
from tqdm import tqdm
from retrieval.hybrid import hybrid_retrieve
from retrieval import reranker as rr
from llm import get_llm_client, generate_answer
from eval.eval_llm_metrics import ... | hamzaideators/cinerag | eval/eval_llm.py | .py | f86adc83995d1a69 | 7.3 | 3 |
import os, time, re, html, json, requests, argparse
from urllib.parse import urlencode
from dotenv import load_dotenv
from tqdm import tqdm
from dotenv import load_dotenv
load_dotenv()
TMDB_API_TOKEN = os.environ.get("TMDB_API_TOKEN")
BASE = "https://api.themoviedb.org/3"
def tmdb(path, **params):
"""Call TMD... | hamzaideators/cinerag | flows/tmdb_ingest.py | .py | 46454f7c4c4a326c | 7.3 | 3 |
"""
Internationalization (i18n) system for Solar Irradiance Analysis
Sistema de internacionalización para Análisis de Irradiación Solar
"""
# Language configurations
LANGUAGES = {
"en": {
# General terms
"analysis": "ANALYSIS",
"period": "Period",
"dimension": "Dimension",
"... | jaydenplayz123/SolarIrradianceAnalysis | src/utils/i18n.py | .py | c467323e7611f356 | 7.24 | 2 |
"""
Functions for solar irradiance data visualization
Funciones para visualización de datos de irradiación solar
"""
import matplotlib.pyplot as plt
import numpy as np
from src.analysis.analysis_functions import (
format_location_for_display,
is_combined_dataset,
)
from src.data.data_sets import get_dataset_y... | jaydenplayz123/SolarIrradianceAnalysis | src/visualization/plotting_functions.py | .py | a5e6339489445a56 | 7.24 | 2 |
import requests
from socket import getaddrinfo
class Server:
"""
server details like city, country, org
"""
def __init__(self, host: str):
self.host = host
self.city = None
self.country = None
self.org = None
self.ip = None
self.server = None
self... | KIingMaxiii6813/Silent-Snake | silent_snake/details/server.py | .py | 18de254210285ceb | 7.24 | 2 |
import requests
from bs4 import BeautifulSoup
import csv
from urllib.parse import parse_qs, urlparse, urljoin
import re
from typing import Any,List
import signal
from ssl import SSLCertVerificationError
from details import server, techs
type URL = str
type Domain = str
type Link = str
UserAgents = {
"1" : "Mozilla... | KIingMaxiii6813/Silent-Snake | silent_snake/main.py | .py | f46bc4fe074d469e | 7.24 | 2 |
"""Asynchronous Python client providing Open Data information of Antwerpen."""
from __future__ import annotations
import asyncio
import socket
from dataclasses import dataclass
from importlib import metadata
from typing import Any, Self
from aiohttp import ClientError, ClientSession
from aiohttp.hdrs import METH_GET... | klaasnicolaas/python-antwerpen | src/antwerpen/antwerpen.py | .py | 7f88c2117b5d5c3f | 7.24 | 2 |
"""Asynchronous Python client providing Open Data information of Antwerpen."""
from __future__ import annotations
from dataclasses import dataclass
from datetime import datetime
from typing import Any
import pytz
@dataclass
class DisabledParking:
"""Object representing a disabled parking."""
entry_id: int... | klaasnicolaas/python-antwerpen | src/antwerpen/models.py | .py | f3e6565637d0fdd4 | 7.24 | 2 |
from . import basics
import GameTools.Tools as Tools
import pygame
global cached_info
cached_info = {"scaleFactor":[-1,-1,-1,]}
class rectangle(basics.Entity):
def __init__(self, plane,color):
super().__init__(plane)
self.color = color
#self.cached_info=[100,100,0]
def draw(self,game)... | ArachnidAbby/GameTools | src/GameTools/Entity/shapes.py | .py | ed204b66b1cb5a3d | 7.15 | 1 |
import GameTools.Timing as timing
import pygame
from . import ProjectTemplates
pygame.init()
class game(ProjectTemplates.Pygame):
'''
Simply contains game properties for an async project
'''
def __init__(self,w,h,title, frameRate = 60, fillColor = (255,255,255)):
self.width = w
self.hei... | ArachnidAbby/GameTools | src/GameTools/Templates/FullTemplate.py | .py | 08322b3942722625 | 7.15 | 1 |
import GameTools.Timing as timing
import pygame
#pygame.init()
class Game:
'''
The game template for any renderer
Methods:
events(dt) -> programmer defined
update(dt) -> programmer defined
draw() -> programmer defined
start() -> programmer defined
start_GameLoop ->... | ArachnidAbby/GameTools | src/GameTools/Templates/ProjectTemplates.py | .py | 9cbcbe6aff059060 | 7.15 | 1 |
global messageDict
messageDict={}
def send_Message(messageName, index=None, *args,**kwargs):
'''
tells functions that are listening to this message to run with whatever args are specified
You can also specify and index if there are multiple function in that list.
usage:
send_Message("Default... | ArachnidAbby/GameTools | src/GameTools/Tools/Messaging.py | .py | edd577a195f04d60 | 7.15 | 1 |
'''
Testing project templates and other features
This is the Pygame Template
This is a pretty neet class based template
'''
from GameTools.Templates import ProjectTemplates
import GameTools, time,pygame
from GameTools import Templates, Entity,Tools
from GameTools.Tools import Math
from GameTools.Templates im... | ArachnidAbby/GameTools | src/Testing.py | .py | c66a6af2fa496716 | 7.65 | 1 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import re
from lxml import etree
from helper import get_text
def validate_title(title):
new_title=re.sub("#","", title)
return new_title
def crawler_wei_bo():
"""
爬取微博热榜
:return:
"""
url = 'https://weibo.com/ajax/statuses/hot_band'
response_h... | toolslog/hot | crawler.py | .py | 25be0c0e42e21517 | 7.35 | 4 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import time
import requests
from requests.exceptions import ConnectionError
from settings import BASE_HEADERS
def retry(max_tries=3, wait=5):
"""
获取失败,进行再次爬取
:param max_tries: 失败次数
:param wait: 每次失败时等待时间
:return:
"""
def deco(fun):
def ... | toolslog/hot | helper.py | .py | 6d04d3f2968159bd | 7.35 | 4 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import json
import os
from apscheduler.schedulers.blocking import BlockingScheduler
from concurrent.futures import ThreadPoolExecutor
from crawler import *
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
def run_crawler():
"""
多线程爬取
:return:
"""
... | toolslog/hot | main.py | .py | a8092089c7ef2978 | 7.35 | 4 |
"""AI tool signature detection logic.
This module provides the public API for detecting AI tool signatures in commit
messages. The signature data (tool definitions and patterns) lives in
:mod:`commit_check.ai_signatures_data`.
Typical usage::
from commit_check.ai_signatures import detect_ai_signatures
resu... | actions-marketplace-validations/commit-check_commit-check | commit_check/ai_signatures.py | .py | c9ff73d601144e11 | 7.15 | 1 |
"""TOML config loader and schema for commit-check."""
from __future__ import annotations
from typing import Any
from pathlib import Path
import urllib.request
import urllib.error
try:
import tomllib
toml_load = tomllib.load
except ImportError:
import tomli # type: ignore
toml_load = tomli.load
DEF... | actions-marketplace-validations/commit-check_commit-check | commit_check/config.py | .py | 9a492452c37b60ad | 7.15 | 1 |
"""Configuration merger that combines CLI args, env vars, TOML config, and defaults."""
from __future__ import annotations
import os
import argparse
from collections.abc import Callable
from typing import Any
from commit_check.config import load_config as load_toml_config
from commit_check import (
DEFAULT_COMMIT... | actions-marketplace-validations/commit-check_commit-check | commit_check/config_merger.py | .py | 1355d451821d02b4 | 7.15 | 1 |
"""Rule builder that creates validation rules from config and catalog."""
from __future__ import annotations
from typing import Any
from dataclasses import dataclass
from commit_check.rules_catalog import (
COMMIT_RULES,
BRANCH_RULES,
PUSH_RULES,
RULES_BY_CHECK,
RuleCatalogEntry,
)
from commit_chec... | actions-marketplace-validations/commit-check_commit-check | commit_check/rule_builder.py | .py | f5df7f0857cbec15 | 7.15 | 1 |
"""Tests for stable rule IDs in the rules catalog.
The checks that compared these rules against the documentation now live in
the commit-check.com repository, next to the pages they read.
"""
import re
import pytest
from commit_check.rules_catalog import (
ALL_RULES,
RULES_BY_CHECK,
BRANCH_RULES,
CO... | actions-marketplace-validations/commit-check_commit-check | tests/rules_catalog_test.py | .py | 30d765ab7680fec8 | 7.65 | 1 |
"""Tests for commit_check.__version__."""
import importlib
import pytest
from unittest.mock import patch
from importlib.metadata import PackageNotFoundError
import commit_check
class TestVersion:
"""Tests for __version__ resolution."""
@pytest.mark.benchmark
def test_version_is_string_when_installed(sel... | actions-marketplace-validations/commit-check_commit-check | tests/version_test.py | .py | 7efa762aa143d00d | 7.65 | 1 |
import numpy as np
def hex_to_uint8(hex_code):
"""Convert 6-digit hex code to triple of uint8 values
Parameters
----------
hex_code : str
Returns
-------
(red, green, blue)
"""
if len(hex_code) != 7:
raise ValueError("Hex code must be 6 digits")
value = hex_code[1:]... | astutespruce/secas-ssa | analysis/lib/colors.py | .py | c402e52dbae87a17 | 7 | 0 |
import geopandas as gp
import pandas as pd
import numpy as np
import shapely
from analysis.lib.graph import DirectedGraph
def dissolve(df, by, grid_size=None, agg=None, allow_multi=True, op="union"):
"""Dissolve a DataFrame by grouping records using "by".
Contiguous or overlapping geometries will be unioned... | astutespruce/secas-ssa | analysis/lib/geometry/aggregate.py | .py | 26cd21c3310b7802 | 7 | 0 |
import numpy as np
import shapely
# GeoJSON geometry type names
GEOJSON_TYPE = {
# -1: "", # Not a geometry
0: "Point",
1: "LineString",
2: "LinearRing", # NOTE: not valid GeoJSON, TODO: could be converted to LineString
3: "Polygon",
4: "MultiPoint",
5: "MultiLineString",
6: "MultiPol... | astutespruce/secas-ssa | analysis/lib/geometry/conversion.py | .py | 21337006f163b239 | 7 | 0 |
import pandas as pd
import numpy as np
class DirectedGraph(object):
def __init__(self, df, source, target):
"""Create DirectedGraph from data frame with source and target columns.
Parameters
----------
df : DataFrame,
source : str
name of source column
... | astutespruce/secas-ssa | analysis/lib/graph.py | .py | 28a5aef123035e07 | 7 | 0 |
from itertools import product
import math
from affine import Affine
import numba as nb
import numpy as np
import rasterio
from rasterio.enums import Resampling
from rasterio.mask import geometry_mask
from rasterio.vrt import WarpedVRT
from rasterio.windows import Window
import shapely
from analysis.constants import O... | astutespruce/secas-ssa | analysis/lib/raster.py | .py | 8d7a3071e5a38b3b | 7 | 0 |
import geopandas as gp
import numpy as np
import pandas as pd
import shapely
import rasterio
from analysis.constants import M2_ACRES, SECAS_STATES
from analysis.lib.geometry import to_dict
from analysis.lib.raster import WindowGeometryMask, get_window, get_overlapping_windows
from analysis.lib.stats.inundation_frequen... | astutespruce/secas-ssa | analysis/lib/stats/analysis_units.py | .py | d17f1e60fe811764 | 7 | 0 |
import geopandas as gp
import shapely
from analysis.constants import DATASETS
from analysis.lib.raster import detect_data
from analysis.lib.geometry import to_dict_all
from analysis.lib.stats.slr import src_dir as slr_dir
from analysis.lib.stats.landfire import src_dir as landfire_dir
from analysis.lib.stats.nlcd impo... | astutespruce/secas-ssa | analysis/lib/stats/prescreen.py | .py | 26f9310e495765e5 | 7 | 0 |
import geopandas as gp
import numpy as np
import rasterio
import shapely
from analysis.constants import (
SLR_DEPTHS,
SLR_NODATA_VALUES,
SLR_YEARS,
SLR_PROJ_COLUMNS,
SLR_PROJ_SCENARIOS,
)
from api.settings import SHARED_DATA_DIR
SLR_BINS = SLR_DEPTHS + [v["value"] for v in SLR_NODATA_VALUES]
src... | astutespruce/secas-ssa | analysis/lib/stats/slr.py | .py | 3a3d3d1eeafffb06 | 7 | 0 |
import logging
from pathlib import Path
import secrets
import shutil
import arq
from fastapi import (
APIRouter,
File,
UploadFile,
HTTPException,
Depends,
)
from fastapi.security.api_key import APIKey
from api.errors import DataError
from api.settings import REDIS, REDIS_QUEUE, TEMP_DIR, MAX_FILE_... | astutespruce/secas-ssa | api/routes/upload.py | .py | 933fb9bd5061b046 | 7 | 0 |
"""Tests for arm-disc-wrapper.sh, the udev gatekeeper in front of ARM.
Run with `python3 -m unittest discover tools/arm-disc-wrapper`.
The script under test is not a file in this directory — it lives in
`kubernetes/apps/automatic-ripping-machine/init-scripts.yaml`, because that
ConfigMap is what gets mounted into the... | DArtagan/vulcanus-proxmox | tools/arm-disc-wrapper/test_wrapper.py | .py | 092c0c1a7e072705 | 7.85 | 4 |
"""Read every .m4b under a root and emit one JSON record per book.
Runs inside the cluster, where the audio share is mounted, and writes the
manifest to stdout so nothing has to be copied in:
kubectl exec -i -n apps <pod> -- /venv/bin/python - < manifest.py > manifest.json
The Audible rips carry a tone/m4b-tool ... | DArtagan/vulcanus-proxmox | tools/mb-seed/manifest.py | .py | e98fa08e937232d9 | 7.35 | 4 |
"""
fastfuels_sdk/v1/api.py
"""
import os
from typing import Optional
from fastfuels_sdk.v1.client_library.api_client import ApiClient
from fastfuels_sdk.v1.client_library.api import (
DomainsApi,
InventoriesApi,
TreeInventoryApi,
FeaturesApi,
RoadFeatureApi,
WaterFeatureApi,
GridsApi,
... | silvxlabs/fastfuels-sdk-python | fastfuels_sdk/v1/api.py | .py | dbf5c870e4006731 | 7.35 | 4 |
# Copyright (c) 2023 Franck Nijhof <opensource@frenck.dev>
"""Asynchronous client for the PVOutput API."""
from __future__ import annotations
from dataclasses import dataclass
from datetime import UTC, date, datetime, time
from mashumaro import DataClassDictMixin
from mashumaro.config import BaseConfig
from mashumar... | frenck/python-pvoutput | src/pvo/models.py | .py | 127da9a4347fcc39 | 7.3 | 3 |
# Copyright (c) 2023 Franck Nijhof <opensource@frenck.dev>
"""Asynchronous client for the PVOutput API."""
from __future__ import annotations
import asyncio
import socket
from dataclasses import dataclass
from datetime import UTC, date, datetime, time
from typing import Any, Self
from aiohttp.client import ClientErr... | frenck/python-pvoutput | src/pvo/pvoutput.py | .py | eba73e9cd2e14fd3 | 7.3 | 3 |
# Copyright (c) 2023 Franck Nijhof <opensource@frenck.dev>
"""Test compatibility fixtures."""
from __future__ import annotations
import inspect
from types import SimpleNamespace
from typing import TYPE_CHECKING, Any
import aiohttp
import pytest
from aioresponses import core as aioresponses_core
if TYPE_CHECKING:
... | frenck/python-pvoutput | tests/conftest.py | .py | b1b2d664bd16a114 | 7.8 | 3 |
#!/usr/bin/env python3
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.
"""A Juju charm for integrating an identity broker with an external IdP."""
import logging
from typing import Any
from charms.kratos_external_idp_integrator.v1.kratos_external_provider import (
ExternalIdpProvider,
... | canonical/kratos-external-idp-integrator | src/charm.py | .py | 970392de8a2738df | 7.15 | 1 |
# Copyright 2026 Canonical Ltd.
# See LICENSE file for licensing details.
import os
import secrets
import subprocess
from contextlib import suppress
from pathlib import Path
from typing import Generator
import jubilant
import pytest
from integration.utils import juju_model_factory
def pytest_addoption(parser: pytes... | canonical/kratos-external-idp-integrator | tests/integration/conftest.py | .py | bc4e7c506400fae2 | 7.65 | 1 |
#!/usr/bin/env python3
# Copyright 2022 Canonical Ltd.
# See LICENSE file for licensing details.
import logging
from pathlib import Path
from typing import Dict
import jubilant
import pytest
from integration.constants import APP_NAME
from integration.utils import any_error, is_blocked
logger = logging.getLogger(__n... | canonical/kratos-external-idp-integrator | tests/integration/test_charm.py | .py | bfeeeb86cc47e5d4 | 7.65 | 1 |
# Copyright 2026 Canonical Ltd.
# See LICENSE file for licensing details.
import platform
from contextlib import contextmanager
from typing import Callable, Iterator
import jubilant
import yaml
from integration.constants import APP_NAME
from tenacity import retry, stop_after_attempt, wait_exponential
StatusPredicate... | canonical/kratos-external-idp-integrator | tests/integration/utils.py | .py | 758ba13923c664db | 7.65 | 1 |
"""Asynchronous Python client for the Eiswarnung API."""
from __future__ import annotations
import asyncio
import socket
from dataclasses import dataclass
from importlib import metadata
from typing import Any, Self
from aiohttp import ClientError, ClientSession
from aiohttp.hdrs import METH_GET
from yarl import URL
... | klaasnicolaas/python-eiswarnung | src/eiswarnung/eiswarnung.py | .py | 6b47c3ebc7411cbc | 7.15 | 1 |
"""Data models for the Eiswarnung API."""
from __future__ import annotations
from dataclasses import dataclass
from datetime import date, datetime
from enum import StrEnum
from typing import Any
import pytz
class ForecastType(StrEnum):
"""Enumeration representing the Eiswarnung Forecast type."""
__slots__... | klaasnicolaas/python-eiswarnung | src/eiswarnung/models.py | .py | 01de7d6821e9052c | 7.15 | 1 |
import datetime
from django.contrib import admin, messages
from django.contrib.auth.decorators import user_passes_test
from django.shortcuts import redirect, render
from django.urls import path
from django.utils.translation import gettext_lazy
from rangefilter.filter import DateRangeFilter
from .. import permissions
... | CAL-BPHC/onlineCAL | server/booking_portal/admin/slot.py | .py | 7adebcb4de135021 | 7.15 | 1 |
"""Atomic Absorption Spectroscopy"""
from booking_portal.models.instrument.requests import AAS
from django import forms
from .base import UserDetailsForm, UserRemarkForm
class AASForm(UserDetailsForm, UserRemarkForm):
title = "Atomic Absorption Spectroscopy"
subtitle = "Atomic Absorption Spectroscopy"
h... | CAL-BPHC/onlineCAL | server/booking_portal/forms/instrument_requests/aas.py | .py | e80bb67fb97740cb | 7.15 | 1 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Check websites for changes
Usage:
check_website.py --db <path-to-db-file> [--verbose] [--no-verify]
check_website.py (-h | --help)
check_website.py --version
Options:
-h, --help Show this screen.
--version Show version.
... | metaodi/website-monitor | lib/check_website.py | .py | 3c99c5dc7774da14 | 7 | 0 |
# -*- coding: utf-8 -*-
import logging
import ssl
import tempfile
from pathlib import Path
from urllib.parse import urlsplit
import certifi
import feedparser
import requests
from cryptography import x509
from cryptography.hazmat.primitives import serialization
from cryptography.x509.oid import AuthorityInformationAcce... | metaodi/website-monitor | lib/download.py | .py | eb1e7241bcbd9a7b | 7 | 0 |
# -*- coding: utf-8 -*-
"""Tests for lib/utils.py."""
import utils
class TestSanitizeLabelForFilename:
def test_simple_label(self):
assert utils.sanitize_label_for_filename("EBP Insights") == "ebp_insights"
def test_domain_name(self):
assert utils.sanitize_label_for_filename("stefanoderbolz.... | metaodi/website-monitor | tests/test_utils.py | .py | 6cc9bd49ed271e86 | 7.5 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Generate a static website and RSS feed from notification logs.
Usage:
generate_site.py [--output <output-dir>] [--base-url <base-url>] [--max-items <n>]
generate_site.py (-h | --help)
Options:
-h, --help Show this screen.
-o, --output <output... | metaodi/website-monitor | workflow/generate_site.py | .py | 11c200f35223a77d | 7 | 0 |
# Copyright (C) 2008 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | msft-mirror-aosp/git-repo | color.py | .py | be087c99cd85c70c | 7 | 0 |
# Copyright (C) 2008 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | msft-mirror-aosp/git-repo | editor.py | .py | 3abff83a9b604408 | 7 | 0 |
# Copyright (C) 2017 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | msft-mirror-aosp/git-repo | event_log.py | .py | 4cdf362065cb165e | 7 | 0 |
# Copyright (C) 2021 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | msft-mirror-aosp/git-repo | fetch.py | .py | 68ada03737e28d79 | 7 | 0 |
# Copyright (C) 2009 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | msft-mirror-aosp/git-repo | git_refs.py | .py | 3f4069643d0e59f0 | 7 | 0 |
# Copyright (C) 2020 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | msft-mirror-aosp/git-repo | git_trace2_event_log.py | .py | 8f91d5437f652363 | 7 | 0 |
# Copyright (C) 2016 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | msft-mirror-aosp/git-repo | platform_utils.py | .py | b105c0f79a5e84c0 | 7 | 0 |
# Copyright (C) 2016 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | msft-mirror-aosp/git-repo | platform_utils_win32.py | .py | 680e7dd27cda3a2f | 7 | 0 |
# Copyright (C) 2009 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | msft-mirror-aosp/git-repo | progress.py | .py | 74c50ebba9b3f983 | 7 | 0 |
#!/usr/bin/env python3
# Copyright (C) 2025 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | msft-mirror-aosp/git-repo | release/check-metadata.py | .py | f8e769f6fb4017e7 | 7 | 0 |
#!/usr/bin/env python3
# Copyright (C) 2020 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | msft-mirror-aosp/git-repo | release/sign-launcher.py | .py | e2a1e09b4f564816 | 7 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.