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 |
|---|---|---|---|---|---|---|
"""
操作系统平台信息生成模块。
该模块提供了常见操作系统的平台信息字符串生成功能,用于构建完整的 User-Agent。
支持的操作系统:
- Windows: Windows NT 6.0-10.0,支持 WOW64 和 Win64; x64 架构
- macOS: Mac OS X 10.10-10.14
- Linux: 支持 x86_64、i686 架构
"""
import random
from random import randint as rint
def windows() -> str:
"""
生成 Windows 操作系统的平台信息字符串。
Returns:
... | farfarfun/funfake | src/funfake/headers/platforms.py | .py | 4ed4a7786273eb56 | 7 | 0 |
"""
手机号码生成模块。
该模块提供了中国和美国手机号码的生成功能,支持:
- 中国手机号:11位,支持移动、联通、电信三大运营商
- 美国手机号:10位,支持带/不带连字符格式
- 运营商权重控制(中国移动用户最多)
- 批量生成不重复的手机号码
"""
import random
from typing import List, Optional
from ..base import BaseGenerator
class ChinesePhone(BaseGenerator):
"""
中国手机号码生成器。
生成符合中国手机号码格式的11位号码,支持三大运营商的真实号段。
... | farfarfun/funfake | src/funfake/phones/core.py | .py | 3ca13e6f4baddab5 | 7 | 0 |
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../..")))
from updates.subscribe import get_channels_by_subscribe_urls
from utils.driver.tools import get_soup_driver
from utils.config import config
import utils.constants as constants
from utils.channel import format_ch... | alexyanghx/TV | updates/multicast/update_tmp.py | .py | e744bab388232861 | 7.24 | 2 |
from .request import get_proxy_list, get_proxy_list_with_test
proxy_list = []
proxy_list_test = []
proxy_index = 0
async def get_proxy(url=None, best=False, with_test=False):
"""
Get the proxy
"""
global proxy_list, proxy_list_test, proxy_index
if not proxy_list:
proxy_list = get_proxy_list(3)
if not p... | alexyanghx/TV | updates/proxy/__init__.py | .py | 23847cf984a8d740 | 7.24 | 2 |
from asyncio import Semaphore
from concurrent.futures import ThreadPoolExecutor
from tqdm import tqdm
from tqdm.asyncio import tqdm_asyncio
from utils.config import config
from utils.driver.tools import get_soup_driver
from utils.requests.tools import get_soup_requests, close_session
from utils.retry import retry_fun... | alexyanghx/TV | updates/proxy/request.py | .py | b6823087de1e1e4e | 7.24 | 2 |
import re
from time import sleep
from bs4 import BeautifulSoup
from utils.config import config
from utils.retry import (
retry_func,
locate_element_with_retry,
find_clickable_element_with_retry,
)
if config.open_driver:
try:
from selenium.webdriver.common.by import By
except:
pass... | alexyanghx/TV | utils/driver/tools.py | .py | 3646ce691ed34e49 | 7.24 | 2 |
import socket
from urllib.parse import urlparse
import ipdb
from utils.tools import resource_path
class IPChecker:
def __init__(self):
self.db = ipdb.City(resource_path("utils/ip_checker/data/qqwry.ipdb"))
self.url_host = {}
self.host_ip = {}
self.host_ipv_type = {}
def get_... | alexyanghx/TV | utils/ip_checker/ip_checker.py | .py | 2cd7aa08eefea5ca | 7.24 | 2 |
import re
import requests
from bs4 import BeautifulSoup
headers = {
"Accept": "*/*",
"Connection": "keep-alive",
"Accept-Language": "zh-CN,zh;q=0.8",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
}
session = requests.S... | alexyanghx/TV | utils/requests/tools.py | .py | d5ebd020c67cc0ea | 7.24 | 2 |
from time import sleep
from utils.config import config
if config.open_driver:
try:
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException
except:
pass
max_r... | alexyanghx/TV | utils/retry.py | .py | dc4ef3a67beb5313 | 7.24 | 2 |
import logging
import os
import sys
import threading
import structlog
logging_setup_called = False
def setup_logging(name="<app>", level=None):
"""
Setup logging. Returns a struct-logger.
Usage:
```
log = setup_logging()
log.warn("This is a warning!", some_value=679)
```
"""
glo... | toelke/rewe-lieferung-home-assistant | log.py | .py | f1699c8f13209a1d | 7.24 | 2 |
import os
import util
from util import logger
from weibo2 import Weibo
import datetime # 新增,用于处理日期相关操作
import requests
import json
import re
import time
def fasong(cont):
#print(cont)
pattern = r'\[([^]]*(南京|无锡|徐州|常州|苏州|南通|连云港|淮安|盐城|扬州|镇江|泰州|宿迁|江苏|鼓楼)[^]]*)\]'
# 使用findall方法查找所有匹配的内容
matches = re.finda... | REZALIU/wrh | main.py | .py | 3e1c5b4a4923b0e3 | 7.15 | 1 |
import contextlib
import requests
from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry
from util import logger
HOT_SEARCH_URL = "https://m.weibo.cn/api/container/getIndex"
HEADERS = {
'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, l... | REZALIU/wrh | weibo2.py | .py | 6074805eb8e99295 | 7.15 | 1 |
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../..")))
from updates.subscribe import get_channels_by_subscribe_urls
from utils.driver.tools import get_soup_driver
from utils.config import config
import utils.constants as constants
from utils.channel import format_ch... | xzhuzhu999/TV | updates/multicast/update_tmp.py | .py | 43f2356de90a16f0 | 7 | 0 |
from asyncio import Semaphore
from concurrent.futures import ThreadPoolExecutor
from tqdm import tqdm
from tqdm.asyncio import tqdm_asyncio
from utils.config import config
from utils.driver.tools import get_soup_driver
from utils.requests.tools import get_soup_requests
from utils.retry import retry_func
from utils.sp... | xzhuzhu999/TV | updates/proxy/request.py | .py | b94041fc1c2fc2ee | 7 | 0 |
import re
import requests
from bs4 import BeautifulSoup
headers = {
"Accept": "*/*",
"Connection": "keep-alive",
"Accept-Language": "zh-CN,zh;q=0.8",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
}
def get_source_requ... | xzhuzhu999/TV | utils/requests/tools.py | .py | 05c480c3e990a583 | 7 | 0 |
import socket
from urllib.parse import urlparse
import ipdb
from utils.tools import resource_path
class IPChecker:
def __init__(self):
self.db = ipdb.City(resource_path("utils/ip_checker/data/qqwry.ipdb"))
self.url_host = {}
self.host_ip = {}
self.host_ipv_type = {}
def get_... | victoriajrorie/iptv-api | utils/ip_checker/ip_checker.py | .py | 152eac526fdb8523 | 7 | 0 |
import asyncio
import discord
from typing import List
from models.player import Player
from helpers import get_question, check
from config import COLORS
from utils.helpers import player_in_list
class TossupGame:
"""Manages text-based tossup quiz sessions."""
def __init__(self, client, channel, categories:... | jasonydog9/SpeechQBPublic | game_modes/tossup_game.py | .py | 5e1f997e62106250 | 7.24 | 2 |
class Player:
"""Represents a quiz participant with scoring capabilities."""
def __init__(self, name: str, user_id: int):
self.name = name
self.id = user_id
self.points = 0
self.powers = 0
self.tens = 0
self.negs = 0
def increase_points(self):
... | jasonydog9/SpeechQBPublic | models/player.py | .py | 5b9bdded6e1abe4f | 7.24 | 2 |
import re
from typing import List
from models.player import Player
def player_in_list(user_id: int, player_list: List[Player]) -> bool:
"""Check if a player is already in the player list."""
return any(player.get_id() == user_id for player in player_list)
def get_category_key(val: str, categories: dict) -> st... | jasonydog9/SpeechQBPublic | utils/helpers.py | .py | caf52955673a8b4a | 7.24 | 2 |
from asyncio import Semaphore
from concurrent.futures import ThreadPoolExecutor
from tqdm import tqdm
from tqdm.asyncio import tqdm_asyncio
from utils.config import config
from utils.driver.tools import get_soup_driver
from utils.requests.tools import get_soup_requests
from utils.retry import retry_func
from utils.sp... | kashihukari/TV | updates/proxy/request.py | .py | d3e985e26e18f000 | 7 | 0 |
import re
import requests
from bs4 import BeautifulSoup
headers = {
"Accept": "*/*",
"Connection": "keep-alive",
"Accept-Language": "zh-CN,zh;q=0.8",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
}
def get_requests(ur... | kashihukari/TV | utils/requests/tools.py | .py | 40486cea906fc4d0 | 7 | 0 |
from mcp.server.fastmcp import FastMCP
from netbox_client import NetBoxRestClient
import os
# Mapping of simple object names to API endpoints
NETBOX_OBJECT_TYPES = {
# DCIM (Device and Infrastructure)
"cables": "dcim/cables",
"console-ports": "dcim/console-ports",
"console-server-ports": "dcim/console-... | xrs444/flux | apps/mcpjungle/custom-image/netbox-mcp-rw/server.py | .py | bf9a96c6e8856d7a | 7 | 0 |
#!/usr/bin/env python3
"""
Scanopy Client Library
REST client for Scanopy's API (https://scanopy.xrs444.net/api/v1/). Modeled directly on
netbox_client.py's NetBoxRestClient — same shape, adapted for real differences confirmed
live against the deployed instance:
- Auth header is "Authorization: Bearer {token}" (a S... | xrs444/flux | apps/mcpjungle/custom-image/scanopy-mcp-rw/scanopy_client.py | .py | 9a0dc0c6a660d525 | 7 | 0 |
import os
import utils.constants as constants
from utils.tools import get_real_path, resource_path, format_name
class Alias:
def __init__(self):
self.primary_to_aliases: dict[str, set[str]] = {}
self.alias_to_primary: dict[str, str] = {}
real_path = get_real_path(resource_path(constants.... | laijinsheng/TV | utils/alias.py | .py | 4c5daf2957f1cc5a | 7 | 0 |
#!/usr/bin/env python3
"""Redeem a WeatherNet enrollment token.
Generates this probe's mTLS and WireGuard keypairs locally (neither
private key ever leaves this device), exchanges the token for a signed
client certificate and an assigned WireGuard tunnel IP, and writes
everything weathernet-probe and wg-quick@wg0 need... | falberti/weathernet | probe/scripts/enroll.py | .py | 6696b87d4edb3718 | 7 | 0 |
import struct
import time
import pytest
from weathernet_probe.sensors import sps30
from weathernet_probe.sensors.base import SensorReadError
from weathernet_probe.sensors.sps30 import (
SPS30PM1_0Sensor,
SPS30PM2_5Sensor,
SPS30PM4_0Sensor,
SPS30PM10Sensor,
)
class _FakeSps30Device:
"""Stands in ... | falberti/weathernet | probe/tests/test_sps30.py | .py | ad39771b649a3526 | 7.5 | 0 |
import logging
import re
import subprocess
import time
from dataclasses import dataclass
from pathlib import Path
from typing import Optional
import psutil
logger = logging.getLogger(__name__)
# Standard sysfs path for the SoC thermal zone on Raspberry Pi OS (and
# most Linux SBCs). Reports millidegrees Celsius as p... | falberti/weathernet | probe/weathernet_probe/health.py | .py | 689cdc0d6043f4a5 | 7 | 0 |
from abc import ABC, abstractmethod
from typing import Optional
class SensorReadError(Exception):
"""Raised by a Sensor when it fails to produce a reading.
A failed sensor must not crash the reporting cycle -- callers catch
this (and log it) per-sensor and carry on with the rest.
"""
class Sensor(A... | falberti/weathernet | probe/weathernet_probe/sensors/base.py | .py | d1af0aa13459a724 | 7 | 0 |
"""Real BME680 driver (temperature, humidity, pressure, gas resistance)
over I2C.
Requires the sensor wired for I2C mode and I2C enabled on the Pi -- see
the top-level README's wiring section. Uses Pimoroni's `bme680`
library, which handles the chip's factory calibration/compensation
internally; reimplementing that by... | falberti/weathernet | probe/weathernet_probe/sensors/bme680.py | .py | ec5e89db54b5e4c5 | 7 | 0 |
"""Real BMP280 driver (temperature, pressure) over I2C.
Requires the sensor wired for I2C mode -- see the top-level README's
wiring section. Uses Pimoroni's `bmp280` library (same author and style
as the `bme680` package bme680.py already depends on), which handles
the chip's factory calibration/compensation internall... | falberti/weathernet | probe/weathernet_probe/sensors/bmp280.py | .py | dac6bcd7d06f44c6 | 7 | 0 |
"""Real HTU21D-F driver (temperature, humidity) over I2C.
Unlike BME680/BMP280, no third-party PyPI package for this chip is both
current and reliably maintained -- Adafruit's is CircuitPython/Blinka
based, a heavier and differently-styled dependency than the smbus2-direct
approach the rest of this project's real driv... | falberti/weathernet | probe/weathernet_probe/sensors/htu21d.py | .py | 30a8dac908f12c2a | 7 | 0 |
"""Real SPS30 driver (particulate matter mass concentration) over UART.
Uses Sensirion's own maintained `sensirion-uart-sps30` package (plus its
`sensirion-shdlc-driver` / `sensirion-driver-adapters` dependencies)
rather than a hand-rolled SHDLC protocol implementation -- same
reasoning as bme680.py.
UART instead of ... | falberti/weathernet | probe/weathernet_probe/sensors/sps30.py | .py | a90e92806d975fdc | 7 | 0 |
import logging
import requests
logger = logging.getLogger(__name__)
class TransportError(Exception):
"""Raised on any send failure: network error, timeout, or non-2xx.
Callers treat all of these the same way -- spool the reading and
retry next cycle -- so this error type deliberately doesn't
distin... | falberti/weathernet | probe/weathernet_probe/transport.py | .py | 942632940ce1b47b | 7 | 0 |
"""
Django settings for the WeatherNet server.
Configuration is read from environment variables (populated from
server/.env by docker-compose) rather than hardcoded, so the same image
can be deployed with different secrets/hosts without a code change.
"""
import os
from pathlib import Path
BASE_DIR = Path(__file__).r... | falberti/weathernet | server/django_app/config/settings.py | .py | c779f151a63cb862 | 7 | 0 |
"""Air quality index calculations.
Two independent sources feed into the public-facing
`air_quality_index`, in preference order:
1. A real, EPA-standard AQI computed from SPS30 particulate matter
readings (compute_pm25_aqi/compute_pm10_aqi below) -- unlike the
heuristic this project shipped with initially, this... | falberti/weathernet | server/django_app/probes/aqi.py | .py | 2f8c89658c0eecd7 | 7 | 0 |
"""CSR signing helpers for zero-touch probe enrollment.
Loads the internal CA's key and certificate from the files bind-mounted
read-only into this container (see config/settings.py CA_KEY_PATH /
CA_CERT_PATH and docker-compose.yml) and uses them to sign a
probe-submitted CSR, forcing the certificate's CN to the newly... | falberti/weathernet | server/django_app/probes/ca.py | .py | 432400a9757da49a | 7 | 0 |
from django.core.management.base import BaseCommand
from probes.models import Probe
from probes.wireguard import render_peer
class Command(BaseCommand):
"""Print one WireGuard [Peer] stanza per probe registered for
WireGuard access. Used by server/wireguard/sync-peers.sh to build
/etc/wireguard/wg0.conf ... | falberti/weathernet | server/django_app/probes/management/commands/generate_wireguard_peers.py | .py | 193996e5790de6af | 7 | 0 |
import uuid
from datetime import timedelta
from django.conf import settings
from django.db import models
from django.utils import timezone
class Probe(models.Model):
"""The probe registry.
This is the authoritative source of truth for which probes may
report data: the ingestion view rejects any request ... | falberti/weathernet | server/django_app/probes/models.py | .py | b99bfcc70d44cda9 | 7 | 0 |
import hashlib
import hmac
import logging
import uuid
from datetime import timedelta
from django.conf import settings
from django.db import transaction
from django.db.models import Max
from django.utils import timezone
from rest_framework.response import Response
from rest_framework.views import APIView
from telemetr... | falberti/weathernet | server/django_app/probes/views.py | .py | 6e91eb1be7d0b52a | 7 | 0 |
"""
Example: Register and use a custom spectral index.
PaRaVis allows you to define your own indices via the
@register_index decorator.
"""
import numpy as np
from paravis.core.indices.registry import register_index, compute_custom_index
# Register a custom index — a simple ratio
@register_index(name="SR", bands=["N... | mmadrz/PaRaVis | examples/custom_index.py | .py | 63094a46d608b09a | 7.39 | 5 |
"""
Public API for spectral index computation.
Convenience wrappers around paravis.core.indices with sensible defaults.
"""
from typing import Dict, List, Optional, Union
import numpy as np
from paravis.core.raster import read_raster
from paravis.core.indices import (
compute_index as _compute_index,
compute... | mmadrz/PaRaVis | paravis/api/indices.py | .py | 87ab8312e67d400d | 7.39 | 5 |
"""
Public API for raster visualization.
Provides quick-plot functions for use in scripts and notebooks.
"""
from typing import Optional, List, Tuple
import numpy as np
from paravis.core.raster import read_raster, normalize_data
def plot_raster(
raster_path: str,
title: Optional[str] = None,
cmap: str =... | mmadrz/PaRaVis | paravis/api/visualization.py | .py | a9b916091b0badc5 | 7.39 | 5 |
"""
Constants management for spectral index computation.
Handles default values from spyndex and user overrides.
"""
from typing import Dict, Optional
import spyndex
def get_default_constants() -> Dict[str, float]:
"""Return all default constant values from spyndex.
Returns
-------
Dict[str, float]... | mmadrz/PaRaVis | paravis/core/indices/constants.py | .py | 7cbdf5ed965dc428 | 7.39 | 5 |
"""
Data models for spectral index definitions and band mapping.
"""
from dataclasses import dataclass, field
from typing import Dict, List, Optional
@dataclass
class SpectralIndex:
"""Definition of a spectral index."""
name: str
formula: str
bands: List[str]
constants: List[str] = field(default_f... | mmadrz/PaRaVis | paravis/core/indices/models.py | .py | b3527905e02d888d | 7.39 | 5 |
"""
Custom index registry — allows users to register new spectral indices.
Usage:
from paravis.core.indices import register_index
@register_index(name="CUSTOM_VI", bands=["N", "R"])
def custom_vi(nir, red):
return (nir - red) / (nir + red + 0.5)
"""
from typing import Callable, Dict, List, Optiona... | mmadrz/PaRaVis | paravis/core/indices/registry.py | .py | 8fd03b2b272ca193 | 7.39 | 5 |
"""
Shared data models used across core sub-packages.
"""
from dataclasses import dataclass, field
from typing import Dict, List, Optional, Tuple
@dataclass
class RasterProfile:
"""Metadata for a loaded raster file."""
path: str
shape: Tuple[int, int]
crs: Optional[str] = None
transform: Optional[... | mmadrz/PaRaVis | paravis/core/models.py | .py | c7a9f15d907902bc | 7.39 | 5 |
"""
Data models for Rao's Q computation configuration and results.
"""
from dataclasses import dataclass, field
from typing import Optional
import numpy as np
@dataclass
class RaoQConfig:
"""Configuration for Rao's Q computation."""
window_size: int = 15
step_size: int = 1
na_tolerance: float = 0.3
... | mmadrz/PaRaVis | paravis/core/raoq/models.py | .py | 785271ee1bac2ad9 | 7.39 | 5 |
"""
Memory-efficient raster reading and data normalization.
These functions have zero Qt dependency — usable in any Python context.
"""
from typing import Optional, Tuple
import numpy as np
import rasterio
def read_raster(
file_path: str,
max_pixels: int = 1_000_000,
band: Optional[int] = None,
) -> Tup... | mmadrz/PaRaVis | paravis/core/raster/reader.py | .py | 9a335f96fe45639a | 7.39 | 5 |
"""
Raster utility functions — coordinate conversion, colormap helpers.
"""
from typing import Optional, Tuple
def decimal_degrees_to_dms(dd: float) -> Tuple[int, int, float]:
"""Convert decimal degrees to degrees-minutes-seconds.
Parameters
----------
dd : float
Decimal degrees value.
R... | mmadrz/PaRaVis | paravis/core/raster/utils.py | .py | cf27f26e1d44b5a6 | 7.39 | 5 |
"""
Application entry point — QApplication factory and main().
Usage:
python -m paravis.gui.app
# or after pip install: paravis
"""
import os
import sys
from PySide6.QtCore import Qt
from PySide6.QtWidgets import QApplication
from paravis.__version__ import __version__
from .main_window import MainWindow
fr... | mmadrz/PaRaVis | paravis/gui/app.py | .py | ab1a1f5bc5e6ce78 | 7.39 | 5 |
"""
Matplotlib canvas widget for embedding plots in the GUI.
"""
from matplotlib.figure import Figure
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
class MplCanvas(FigureCanvas):
"""Simple Matplotlib canvas widget for PySide6.
Parameters
----------
parent : QWidget,... | mmadrz/PaRaVis | paravis/gui/components/mpl_canvas.py | .py | 64a48a72450f2ebe | 7.39 | 5 |
"""
Recent files menu — dynamic menu showing recently opened files.
"""
import os
from typing import Callable, Optional
from PySide6.QtWidgets import QMenu
from PySide6.QtGui import QAction
from paravis.utils.settings import AppSettings
class RecentFilesMenu(QMenu):
"""Dynamic menu showing recently opened raste... | mmadrz/PaRaVis | paravis/gui/components/recent_files.py | .py | 4721eb4121bdc770 | 7.39 | 5 |
"""
GUI-level worker threads for plot generation and file processing.
These wrap the core workers with GUI-specific features (progress bars,
status updates).
"""
from PySide6.QtCore import QThread, Signal
from paravis.workers.base_worker import BaseWorker
class PlotWorker(BaseWorker):
"""Worker for generating m... | mmadrz/PaRaVis | paravis/gui/components/workers.py | .py | 5920724e81729f55 | 7.39 | 5 |
"""
Band mapping configuration dialog.
"""
from PySide6.QtWidgets import (
QDialog, QVBoxLayout, QHBoxLayout, QPushButton, QTableWidget,
QTableWidgetItem, QHeaderView, QDialogButtonBox,
)
from PySide6.QtCore import Qt
from paravis.core.indices import get_default_band_mapping
from paravis.gui.models.delegates i... | mmadrz/PaRaVis | paravis/gui/dialogs/band_mapping.py | .py | 56ad5b498b05e3f6 | 7.39 | 5 |
"""
Constants editor dialog — view/edit default constants for spectral indices.
Faithful port of v1 ConstantsEditorDialog with Reset All / Clear All buttons,
tooltips on every item, and proper int/float conversion in get_constants().
"""
import spyndex
from PySide6.QtWidgets import (
QDialog, QVBoxLayout, QHBoxLa... | mmadrz/PaRaVis | paravis/gui/dialogs/constants_editor.py | .py | b674dc5ec6e55949 | 7.39 | 5 |
"""
Settings dialog — application preferences.
"""
from multiprocessing import cpu_count
from PySide6.QtWidgets import (
QDialog, QVBoxLayout, QHBoxLayout, QLabel, QPushButton, QTabWidget,
QWidget, QFormLayout, QSpinBox, QCheckBox,
)
from paravis.utils.settings import AppSettings
class SettingsDialog(QDialo... | mmadrz/PaRaVis | paravis/gui/dialogs/settings.py | .py | daa04e44e0105c90 | 7.39 | 5 |
"""
CodeDelegate — QStyledItemDelegate for spectral code dropdowns (v1 exact port).
"""
from PySide6.QtWidgets import QStyledItemDelegate, QComboBox
from PySide6.QtCore import Qt
class CodeDelegate(QStyledItemDelegate):
"""v1: QComboBox editor with addItem("") + addItem(code, code), findData."""
def __init__... | mmadrz/PaRaVis | paravis/gui/models/delegates.py | .py | 96cf441ff2e0b44e | 7.39 | 5 |
"""
IndexTableProxyModel — QSortFilterProxyModel for text-search only.
Faithful port of v1 IndexTableProxyModel with setFilterText().
Computable filtering is done by the widget via setRowHidden (v1 style).
"""
from PySide6.QtCore import Qt, QSortFilterProxyModel
class IndexTableProxyModel(QSortFilterProxyModel):
... | mmadrz/PaRaVis | paravis/gui/models/proxy_model.py | .py | ac6d662a93d0d750 | 7.39 | 5 |
"""
Logging configuration for PaRaVis.
Sets up a consistent logger with console and optional file output.
"""
import logging
import sys
from pathlib import Path
from typing import Optional
def setup_logging(
level: int = logging.INFO,
log_file: Optional[str] = None,
name: str = "paravis",
) -> logging.Lo... | mmadrz/PaRaVis | paravis/utils/logging.py | .py | 2759b7c58eb3b093 | 7.39 | 5 |
"""
System profiler — detect CPU, RAM, and GPU hardware.
Pure Python; Qt-free hardware detection.
"""
import math
import os
import platform
from multiprocessing import cpu_count
from typing import Dict, Optional
class SystemProfiler:
"""Detect and report system hardware information."""
@staticmethod
def... | mmadrz/PaRaVis | paravis/utils/system.py | .py | b86ea29971bd7966 | 7.39 | 5 |
import logging
import os
from functools import cache
from typing import Any, Optional
import pystac
import requests
from requests import Session
LOGGER = logging.getLogger(__name__)
@cache
def stac_host_catalog_info(url: str, session: Optional[Session] = None) -> dict:
"""Return information about the catalog at... | crim-ca/stac-populator | STACpopulator/api_requests.py | .py | 0985f1bcf6c832ab | 7.3 | 3 |
from __future__ import annotations
import abc
import inspect
import logging
from http import cookiejar
from typing import Any, Optional, Type
from requests import PreparedRequest, Response
from requests.auth import AuthBase, HTTPBasicAuth, HTTPDigestAuth, HTTPProxyAuth
from requests.structures import CaseInsensitiveD... | crim-ca/stac-populator | STACpopulator/auth/handlers.py | .py | 5532da424e295b43 | 7.3 | 3 |
import inspect
import logging
from typing import Any, Type, Union
import requests
from requests import Response
from STACpopulator.request.typedefs import RequestMethod
LOGGER = logging.getLogger(__name__)
def make_request(
method: RequestMethod,
url: str,
ssl_verify: bool = True,
**request_kwargs:... | crim-ca/stac-populator | STACpopulator/auth/utils.py | .py | ce5eb752778c518c | 7.3 | 3 |
import argparse
import re
from typing import Any, Dict, Optional, Sequence, Type, Union
from requests.auth import AuthBase
from STACpopulator.auth.handlers import (
AuthHandler,
BasicAuthHandler,
BearerAuthHandler,
CookieAuthHandler,
CookieJarAuthHandler,
DigestAuthHandler,
ProxyAuthHandle... | crim-ca/stac-populator | STACpopulator/auth/validators.py | .py | 3fa43d199b5c465a | 7.3 | 3 |
import logging
from collections.abc import Iterable
from datetime import datetime
from typing import Literal, TypeAlias
import pystac
import requests
from pystac_client.stac_api_io import StacApiIO
from STACpopulator.api_requests import post_stac_collection
LOGGER = logging.getLogger(__name__)
UpdateModes: TypeAlia... | crim-ca/stac-populator | STACpopulator/collection_update.py | .py | 5fa0fa4c1f53a586 | 7.3 | 3 |
import json
import logging
import os
import pathlib
import re
import time
from typing import Iterable, cast
import pystac
import pystac_client
import pystac_client.client
import pystac_client.exceptions
import requests
from pystac_client.stac_api_io import StacApiIO
LOGGER = logging.getLogger(__name__)
class Duplic... | crim-ca/stac-populator | STACpopulator/export.py | .py | a3f9d2b816f4fd80 | 7.3 | 3 |
"""
Base classes for STAC extensions.
What we have:
- `Loader`, which returns attributes.
- An external json schema describing a subset of the attributes returned by the Loader. This schema might preclude
additional properties, so it cannot be applied wholesale to the Loader's output. (maybe overkill since not a... | crim-ca/stac-populator | STACpopulator/extensions/base.py | .py | d3ec2ff25c63fde4 | 7.3 | 3 |
"""CF Extension Module."""
from __future__ import annotations
import functools
from typing import (
Any,
Dict,
Generic,
Iterable,
List,
Literal,
Optional,
TypeVar,
Union,
cast,
get_args,
)
import pystac
from pydantic import BaseModel
from pystac.extensions import item_asse... | crim-ca/stac-populator | STACpopulator/extensions/cf.py | .py | 4317e35f565fc4fe | 7.3 | 3 |
import json
from datetime import datetime
from typing import (
Any,
Generic,
Iterable,
List,
Literal,
MutableMapping,
Optional,
TypeVar,
Union,
cast,
get_args,
)
import pystac
from pydantic import (
AnyHttpUrl,
BaseModel,
ConfigDict,
Field,
ValidationInfo... | crim-ca/stac-populator | STACpopulator/extensions/cmip6.py | .py | 3dead2077222e322 | 7.3 | 3 |
from __future__ import annotations
from datetime import datetime
from pathlib import Path
from pydantic import FilePath, model_validator
from STACpopulator.extensions.base import ExtensionHelper
from STACpopulator.extensions.thredds import THREDDSCatalogDataModel
from STACpopulator.extensions.xscen import Xscen
# ... | crim-ca/stac-populator | STACpopulator/extensions/cordex6.py | .py | c6d6af7f2bc80119 | 7.3 | 3 |
"""FileHelper module."""
import functools
import logging
from typing import Dict, Optional, TypeVar
import pystac
import requests
from pydantic import ConfigDict, Field
from pystac.extensions.file import FileExtension
from requests import Session
from STACpopulator.extensions.base import ExtensionHelper
# Constants... | crim-ca/stac-populator | STACpopulator/extensions/file.py | .py | db1e73b0623d148f | 7.3 | 3 |
from __future__ import annotations
import inspect
from typing import Generic, TypeVar, Union, cast
import pystac
from pydantic import ConfigDict, model_validator
from pystac.extensions.base import (
ExtensionManagementMixin,
PropertiesExtension,
)
from STACpopulator.extensions.base import BaseSTAC, Helper
fr... | crim-ca/stac-populator | STACpopulator/extensions/thredds.py | .py | 4afdea5fae749fcd | 7.3 | 3 |
import json
import logging
from typing import Any, MutableMapping, Union
from pystac import STACValidationError
from pystac.extensions.datacube import DatacubeExtension
from STACpopulator.extensions.cmip6 import CMIP6Helper, CMIP6Properties
from STACpopulator.extensions.datacube import DataCubeHelper
from STACpopulat... | crim-ca/stac-populator | STACpopulator/implementations/CMIP6_UofT/add_CMIP6.py | .py | 64c3af8e686fe911 | 7.3 | 3 |
import logging
from typing import Any
from STACpopulator.extensions.cordex6 import Cordex6DataModel
from STACpopulator.populators import THREDDSPopulator
LOGGER = logging.getLogger(__name__)
class CORDEX_STAC_Populator(THREDDSPopulator):
"""Populator that creates STAC objects representing CORDEX data from a THR... | crim-ca/stac-populator | STACpopulator/implementations/CORDEXCMIP6_Ouranos/add_CORDEX6.py | .py | acf348ea4369f1db | 7.3 | 3 |
import argparse
import inspect
import logging
import os.path
from typing import Any, Iterable, MutableMapping, Optional
import requests
from requests.sessions import Session
from STACpopulator.collection_update import UpdateModesOptional
from STACpopulator.input import STACDirectoryLoader
from STACpopulator.models im... | crim-ca/stac-populator | STACpopulator/implementations/DirectoryLoader/crawl_directory.py | .py | 347fa0210c6e9512 | 7.3 | 3 |
import logging
from typing import Any
from STACpopulator.extensions.hrdps import HRDPSDataModel
from STACpopulator.populators import THREDDSPopulator
LOGGER = logging.getLogger(__name__)
class HRDPSpopulator(THREDDSPopulator):
"""Populator that creates STAC objects representing HRDPS data from a THREDDS catalog... | crim-ca/stac-populator | STACpopulator/implementations/HRDPS_CRIM/add_HRDPS.py | .py | 9eba15b145ec8d8f | 7.3 | 3 |
import logging
from typing import Any
from STACpopulator.extensions.rdps import RDPSDataModel
from STACpopulator.populators import THREDDSPopulator
LOGGER = logging.getLogger(__name__)
class RDPSpopulator(THREDDSPopulator):
"""Populator that creates STAC objects representing RDPS data from a THREDDS catalog."""... | crim-ca/stac-populator | STACpopulator/implementations/RDPS_CRIM/add_RDPS.py | .py | e40a1948690439e6 | 7.3 | 3 |
import json
import logging
import os
import pathlib
import queue
import re
from abc import ABC, abstractmethod
from typing import Any, Iterator, Literal, MutableMapping, Optional, Tuple
from urllib.parse import urlparse
from xml.etree import ElementTree
import pystac
import requests
import xncml
from requests.sessions... | crim-ca/stac-populator | STACpopulator/input.py | .py | b1239715d8d25437 | 7.3 | 3 |
import argparse
import datetime as dt
import json
import logging.config
LOG_RECORD_BUILTIN_ATTRS = {
"args",
"asctime",
"created",
"exc_info",
"exc_text",
"filename",
"funcName",
"levelname",
"levelno",
"lineno",
"module",
"msecs",
"message",
"msg",
"name",
... | crim-ca/stac-populator | STACpopulator/log.py | .py | 26fe0c1a89ee2bb1 | 7.3 | 3 |
from typing import List, Literal, Union
from pydantic import (
BaseModel,
)
class Geometry(BaseModel):
"""GeoJSON geometry."""
type: str
coordinates: List
class GeoJSONPoint(Geometry):
"""GeoJSON Point geometry."""
type: Literal["Point"]
coordinates: List[float]
class GeoJSONMultiPo... | crim-ca/stac-populator | STACpopulator/models.py | .py | e3a25361280de1c8 | 7.3 | 3 |
from __future__ import annotations
import argparse
import functools
import inspect
import json
import logging
import os
from abc import ABC, abstractmethod
from datetime import datetime
from typing import Any, Callable, Dict, Iterable, List, MutableMapping, Optional, Union, get_args
import pystac
import requests
from... | crim-ca/stac-populator | STACpopulator/populators.py | .py | 909c6b6a140cc779 | 7.3 | 3 |
from __future__ import annotations
import logging
import os
import re
from enum import Enum
from functools import cached_property
from typing import Any, List, Literal, MutableMapping, Type, TypedDict, Union
import numpy as np
import pyproj
import pyproj.crs
import pystac
import yaml
from pydantic import ConfigDict, ... | crim-ca/stac-populator | STACpopulator/stac_utils.py | .py | 60080c2e98403057 | 7.3 | 3 |
import json
import requests
import xncml
from siphon.catalog import TDSCatalog
from STACpopulator.stac_utils import np2py
"""
Run this script to fetch metadata attributes from the PAVICS THREDDS catalog.
This avoids making requests to the server during tests.
The results are commited to the repository, so this scri... | crim-ca/stac-populator | tests/data/update_data.py | .py | 0f9e1ae30bae181c | 7.8 | 3 |
"""Test the creation of extensions."""
from __future__ import annotations
import datetime as dt
from STACpopulator.extensions.base import BaseSTAC, ExtensionHelper
class ExTest(ExtensionHelper):
f: float
n: float
_prefix: str = "ex"
# Customize the THREDDSCatalogDataModel
class _TestDataModel(BaseSTA... | crim-ca/stac-populator | tests/test_base.py | .py | eaf5fc1840b1074d | 7.8 | 3 |
import inspect
import os
import re
import subprocess
import tempfile
from typing import Mapping
import pytest
from STACpopulator import implementations
from STACpopulator.cli import populators
def run_cli(*args: str, **kwargs: Mapping) -> subprocess.CompletedProcess:
return subprocess.run(args, stderr=subproces... | crim-ca/stac-populator | tests/test_cli.py | .py | ce7b596df2932906 | 7.8 | 3 |
from typing import TypedDict, Literal, Union, NotRequired
OriginType = Literal["live", "hls", "local", "whitelist", "subscribe", "hotel", "multicast", "online_search"]
IPvType = Literal["ipv4", "ipv6", None]
class ChannelData(TypedDict):
"""
Channel data types, including url, date, resolution, origin and ipv... | 53404366/iptv-api | utils/types.py | .py | c13f8ac1370a2a28 | 7 | 0 |
"""
Pulsarity server entry point
"""
import asyncio
import logging
import os
import signal
import sys
from pathlib import Path
from typing import TYPE_CHECKING
import granian
import pulsarity_localization
from granian.constants import Interfaces
from granian.log import LogLevels
from granian.server.embed import Serve... | i-am-grub/pulsarity | src/pulsarity/__main__.py | .py | d9660c9eb700ae37 | 7 | 0 |
"""
ORM classes for heat data
"""
from __future__ import annotations
import asyncio
from typing import TYPE_CHECKING, Self
from tortoise import fields
from pulsarity._protobuf import database_pb2
from pulsarity.database._base import PulsarityMessageBase as _PulsarityMessageBase
from pulsarity.database._base import ... | i-am-grub/pulsarity | src/pulsarity/database/heat.py | .py | cbef743cb50c720f | 7 | 0 |
"""
ORM classes for event data
"""
from __future__ import annotations
from typing import TYPE_CHECKING
from tortoise import fields
from pulsarity.database._base import PulsarityBase as _PulsarityBase
if TYPE_CHECKING:
from pulsarity.database.slot import Slot
class LapAttribute[ATTRIBUTE](_PulsarityBase):
... | i-am-grub/pulsarity | src/pulsarity/database/lap.py | .py | d8785bd4ac683a93 | 7 | 0 |
"""
ORM classes for Permission data
"""
from __future__ import annotations
from enum import StrEnum, auto, unique
from typing import TYPE_CHECKING
from tortoise import fields
from pulsarity.database._base import PulsarityBase as _PulsarityBase
if TYPE_CHECKING:
from pulsarity.database.role import Role
class ... | i-am-grub/pulsarity | src/pulsarity/database/permission.py | .py | 2b50cb1bf7f907f9 | 7 | 0 |
"""
ORM classes for race class data
"""
from __future__ import annotations
import asyncio
from typing import TYPE_CHECKING, Self
from tortoise import fields
from tortoise.functions import Max
from pulsarity._protobuf import database_pb2
from pulsarity.database._base import PulsarityMessageBase as _PulsarityMessageB... | i-am-grub/pulsarity | src/pulsarity/database/raceclass.py | .py | 3229aee1a90fa804 | 7 | 0 |
"""
ORM classes for event data
"""
from __future__ import annotations
from typing import TYPE_CHECKING, Self
from google.protobuf import timestamp_pb2
from tortoise import fields
from tortoise.functions import Max
from pulsarity._protobuf import database_pb2
from pulsarity.database._base import PulsarityMessageBase... | i-am-grub/pulsarity | src/pulsarity/database/raceevent.py | .py | 3c1cd1f147fb1850 | 7 | 0 |
"""
ORM classes for Format data
"""
from tortoise import fields
from pulsarity._protobuf import database_pb2
from pulsarity.database._base import PulsarityBase as _PulsarityBase
from pulsarity.database._base import PulsarityMessageBase as _PulsarityMessageBase
class RulesetField[ATTRIBUTE](_PulsarityMessageBase):
... | i-am-grub/pulsarity | src/pulsarity/database/raceformat.py | .py | e48ee4dbbc9940d6 | 7 | 0 |
"""
ORM classes for Role data
"""
from __future__ import annotations
from typing import TYPE_CHECKING
from tortoise import fields
from pulsarity.database._base import PulsarityBase as _PulsarityBase
from pulsarity.database.permission import Permission, SystemDefaultPerms
if TYPE_CHECKING:
from pulsarity.databa... | i-am-grub/pulsarity | src/pulsarity/database/role.py | .py | fcaeb8253b8efa34 | 7 | 0 |
"""
ORM classes for round data
"""
from __future__ import annotations
import asyncio
from typing import TYPE_CHECKING, Self
from tortoise import fields
from tortoise.functions import Max
from pulsarity._protobuf import database_pb2
from pulsarity.database._base import PulsarityMessageBase as _PulsarityMessageBase
f... | i-am-grub/pulsarity | src/pulsarity/database/round.py | .py | c1276db4ecf93f9d | 7 | 0 |
"""
ORM classes for signal data
"""
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Self, TypeVar
from google.protobuf.message import Message
from tortoise import Model, fields
from pulsarity._protobuf import database_pb2
from pulsarity.database._base import PulsarityBase as _PulsarityBase... | i-am-grub/pulsarity | src/pulsarity/database/signal.py | .py | 6a9f23170a2bc467 | 7 | 0 |
"""
ORM classes for slot data
"""
from __future__ import annotations
from typing import TYPE_CHECKING
from tortoise import fields
from pulsarity.database._base import PulsarityBase as _PulsarityBase
if TYPE_CHECKING:
from pulsarity.database.heat import Heat
from pulsarity.database.lap import Lap
from p... | i-am-grub/pulsarity | src/pulsarity/database/slot.py | .py | 15a71ef1ddc3c549 | 7 | 0 |
"""
Most laps implementation
"""
from collections import defaultdict
from itertools import count
from typing import TYPE_CHECKING
from pulsarity.race.ruleset import (
CombinedMetrics,
LapsManager,
RaceRuleset,
RulesetFieldData,
SafeRaceFormat,
SlotResult,
SoloResultData,
register_rules... | i-am-grub/pulsarity | src/pulsarity/defaults/rulesets/most_laps.py | .py | afc7707a8d2e9f03 | 7 | 0 |
"""
System event broker
"""
import asyncio
import bisect
import copy
import functools
import itertools
import logging
from collections import defaultdict
from dataclasses import asdict, dataclass, field
from typing import TYPE_CHECKING, Any, ClassVar, Self
from pulsarity.events.server import EvtPriority, SystemEventD... | i-am-grub/pulsarity | src/pulsarity/events/broker.py | .py | 44d15a5ca3be87a9 | 7 | 0 |
"""
Enums for system events
"""
from dataclasses import dataclass
from enum import Enum, unique
from pulsarity._protobuf import websocket_pb2
from pulsarity.events import server
@dataclass(frozen=True)
class _EvtData:
"""
The dataclass used to define event enums
"""
event_id: websocket_pb2.EventID
... | i-am-grub/pulsarity | src/pulsarity/events/enums.py | .py | be9143a3fd8da773 | 7 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.