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 |
|---|---|---|---|---|---|---|
"""Observer-backed, process-local rows for the priority queue dashboard."""
from __future__ import annotations
import json
import threading
from collections.abc import Iterator, Mapping
from typing import Any
from django_queue import QueueSubscription, queue_observer
from django_queue.entries import QueueEntry, Queu... | deeprave/django-queues | demo_pq/dashboard/projection.py | .py | f3357c2f97d88f83 | 7 | 0 |
import asyncio
import logging
import math
import threading
from collections.abc import Mapping
from django.conf import settings as django_settings
from django.utils.connection import BaseConnectionHandler, ConnectionProxy
from django.utils.module_loading import import_string
from .aliases import validate_queue_alias
... | deeprave/django-queues | django_queue/__init__.py | .py | 36861d3df19e28f2 | 7 | 0 |
"""
容器类,用于储存文件、文件夹,支持 list 的操作,同时支持许多方法方便操作元素
元素类型为 namedtuple,至少拥有 name id 两个属性才能放入容器
"""
__all__ = ["FileList", "FolderList"]
class ItemList:
"""具有 name, id 属性对象的列表"""
def __init__(self):
self._items = []
def __len__(self):
return len(self._items)
def __getitem__(self, index):
... | farfarfun/fundrive-lanzou | src/fundrives/lanzou/models.py | .py | 3e49aca72d93ce49 | 7 | 0 |
"""
API 处理网页数据、数据切片时使用的工具
"""
import os
import pickle
import re
from datetime import datetime, timedelta
from random import choice, choices, sample, shuffle, uniform
from typing import Any, Tuple, Union
import requests
from funutil import getLogger
logger = getLogger("fundrive")
__all__ = [
"remove_notes",
... | farfarfun/fundrive-lanzou | src/fundrives/lanzou/utils.py | .py | 3057d57b5c3c8ce9 | 7 | 0 |
"""fundrive-lanzou 轻量冒烟测试(smoke tests)。
范围:只确认包能否正常安装 / 导入,以及真正会被使用到的核心驱动类
`LanZouCloud` 在不发起真实网络请求的情况下基本可用。不追求覆盖率,
不测试真实登录 / 上传 / 下载等需要真实蓝奏云账号的业务逻辑。
按 NAMING.md 的约定,本仓库的导入名是共享命名空间 `fundrives`
(`fundrive-alipan` / `fundrive-baidu` / `fundrive-lanzou` / `fundrive-quark`
都发布到同一个 `fundrives` 顶层包下)。经检查,本仓库源码没有 import
`fu... | farfarfun/fundrive-lanzou | tests/test_smoke.py | .py | 75d7e58ab5899dbb | 7.5 | 0 |
#!/usr/bin/env python3
"""Analyze navigation results and create heatmaps showing offset accuracy.
This program scans a results directory for metadata files, extracts the
original grid offsets from filenames, compares them to the found offsets
in the metadata, and creates heatmaps showing the U and V offset errors.
"""... | SETI/rms-spindoctor | experiments/offset_sensitivity/analyze_offset_results.py | .py | 766e675bc95d4bf8 | 7.15 | 1 |
from spindoctor.config import DEFAULT_CONFIG, Config
from spindoctor.obs import ObsSnapshot
from spindoctor.support.image import shift_array
from spindoctor.support.types import NDArrayBoolType
from .annotation_text_info import AnnotationTextInfo
class Annotation:
"""Represents an annotation for an observation i... | SETI/rms-spindoctor | src/spindoctor/annotation/annotation.py | .py | 094ebd9431ebbfdb | 7.15 | 1 |
import functools
import os
from collections import namedtuple
from typing import cast
import numpy as np
from PIL import ImageDraw, ImageFont
from spindoctor.config import DEFAULT_CONFIG
from spindoctor.support.image import draw_line_arrow
from spindoctor.support.types import NDArrayBoolType, NDArrayIntType
TEXTINFO... | SETI/rms-spindoctor | src/spindoctor/annotation/annotation_text_info.py | .py | ce042931716a5b35 | 7.15 | 1 |
from __future__ import annotations
from typing import ClassVar, cast
import numpy as np
from PIL import Image, ImageDraw
from spindoctor.config import Config
from spindoctor.obs import ObsSnapshot
from spindoctor.support.nav_base import NavBase
from spindoctor.support.types import NDArrayBoolType, NDArrayIntType
fr... | SETI/rms-spindoctor | src/spindoctor/annotation/annotations.py | .py | 41df87a04207f0cb | 7.15 | 1 |
import hashlib
from typing import Any
import numpy as np
from oops.backplane import Backplane
from oops.meshgrid import Meshgrid
from pdslogger import PdsLogger
from spindoctor.config import Config
from spindoctor.obs import ObsSnapshot
def _create_simulated_body_backplane(
snapshot: ObsSnapshot,
body_name:... | SETI/rms-spindoctor | src/spindoctor/cli/backplanes/backplanes_bodies.py | .py | f1e3fba6e7c5e4ee | 7.15 | 1 |
import hashlib
from typing import Any
import cspyce
import numpy as np
from spindoctor.obs import ObsSnapshot
def fake_naif_id(body_name: str) -> int:
"""Return a deterministic fake NAIF ID for an unknown simulated body.
The ID is derived from a hashlib digest, not ``hash()``, because str
hashing is sa... | SETI/rms-spindoctor | src/spindoctor/cli/backplanes/merge.py | .py | 973022220fa5f3c4 | 7.15 | 1 |
"""Choosing the spacecraft clock kernel a navigated image's time tags need.
A segment's time tags are encoded with ``sce2c``, which reads whichever
spacecraft clock kernel happens to be furnished. Encoding against a different
version of that kernel from the one navigation used shifts every time tag by
however much th... | SETI/rms-spindoctor | src/spindoctor/cli/ck/clocks.py | .py | 7d912c7b7e909497 | 7.15 | 1 |
"""The comment area a corrected C-kernel carries about itself.
A C-kernel that has been furnished is anonymous: it answers attitude queries
and says nothing about where the attitude came from. SPICE gives every binary
kernel a comment area for exactly that, and this module fills one -- what wrote
the file, against wh... | SETI/rms-spindoctor | src/spindoctor/cli/ck/comments.py | .py | 30271de00ab39ecc | 7.15 | 1 |
"""Refusing a kernel pool in which two frame kernels define the same frame.
The reproduction test asks the furnished pool for the attitude an image
navigated against, and it asks through the image's camera frame. That frame is
defined by a frame kernel, and a frame kernel is a text kernel: when two of them
assign the... | SETI/rms-spindoctor | src/spindoctor/cli/ck/frames.py | .py | b5e39ff6b3773289 | 7.15 | 1 |
"""Which navigated images get a corrected segment, and why the rest do not.
The generator considers every image a navigation run produced and writes a
segment for some of them. This module reads what it needs out of one image's
metadata and answers the first half of that question -- whether the image is
eligible at a... | SETI/rms-spindoctor | src/spindoctor/cli/ck/images.py | .py | e745a0e4d5ad2410 | 7.15 | 1 |
"""Writing corrected C-kernels: their segments and the comments about them.
Two things are judged here, and the difference between them is the point of the
module. :func:`check_ck_file` judges one file: everything about it that can be
decided without opening anything. :func:`check_output_paths` judges a whole
run's ... | SETI/rms-spindoctor | src/spindoctor/cli/ck/kernel_file.py | .py | 60792e3824b84660 | 7.15 | 1 |
"""The meta-kernel that loads a corrected file set in the right order.
A corrected C-kernel is an overlay: it covers only the exposures that were
navigated, and everywhere else the original it mirrors is what answers. SPICE
resolves the overlap by load order -- the C-kernel furnished last wins where
two cover the sam... | SETI/rms-spindoctor | src/spindoctor/cli/ck/metakernel.py | .py | 3eb683c739dcb20d | 7.15 | 1 |
"""The report of what became of every image a generator run considered.
A corrected C-kernel says where a camera was pointing; it does not say how well
that was measured, and it says nothing at all about the images that got no
segment. Both are what this report is for. One row per image, one file per
mission: the im... | SETI/rms-spindoctor | src/spindoctor/cli/ck/report.py | .py | 12779fcb22c792b6 | 7.15 | 1 |
import csv
import json
from pathlib import Path
from typing import Any, cast
import pdstemplate
from filecache import FCPath
from pdslogger import PdsLogger
from spindoctor.dataset.dataset import DataSet
def generate_collection_files(
bundle_results_root: FCPath,
dataset: DataSet,
logger: PdsLogger,
) -... | SETI/rms-spindoctor | src/spindoctor/cli/pds4/collections.py | .py | 81f70e6aeee8f109 | 7.15 | 1 |
"""Factory functions that build BodyMosaic / RingMosaic from parsed CLI args."""
import argparse
import math
import numpy as np
from spindoctor.reproj.bodies import BodyMosaic, BodyMosaicMergeStrategy
from spindoctor.reproj.photometric_model import (
LambertModel,
LommelSeeligerModel,
MinnaertModel,
... | SETI/rms-spindoctor | src/spindoctor/cli/reproj/factories.py | .py | 6aa752952717f0a7 | 7.15 | 1 |
"""Output-path helpers for sd_mosaic.
Conventions
-----------
Per-image reprojection file:
<output_dir>/<prefix>_<subject>_<image_stem>_reproj.<ext>
``subject`` is the mosaic body/planet name (e.g. ``MIMAS``, ``SATURN``), with
spaces, colons, and slashes replaced by underscores for safe filenames.
Per-image repr... | SETI/rms-spindoctor | src/spindoctor/cli/reproj/paths.py | .py | 36e7b3fa6bce26b4 | 7.15 | 1 |
"""Thin wrappers around BodyMosaic.reproject() and RingMosaic.reproject().
These functions translate CLI argument namespaces into keyword arguments
for the underlying reproject() calls.
"""
import argparse
import math
from collections.abc import Sequence
from typing import Any, cast
from spindoctor.cli.reproj.factor... | SETI/rms-spindoctor | src/spindoctor/cli/reproj/reproject.py | .py | c5e226f54eb3a5d7 | 7.15 | 1 |
"""Retrieving a chunk of metadata files, reading each one, and writing them.
Retrieval is batched because a cloud backend downloads a batch in parallel, so
the batch size trades peak memory and per-request concurrency against the
number of round trips. It is ``retrieve()`` that is called rather than
``get_local_path(... | SETI/rms-spindoctor | src/spindoctor/cli/results_index/chunks.py | .py | 64eb90be9d30756e | 7.15 | 1 |
import ast
from abc import ABC, abstractmethod
from funvideo.app.config import config
from funvideo.app.models import const
# Base class for state management
class BaseState(ABC):
@abstractmethod
def update_task(self, task_id: str, state: int, progress: int = 0, **kwargs):
pass
@abstractmethod
... | farfarfun/funvideo | src/funvideo/app/services/state.py | .py | 90243e21cb654da8 | 7 | 0 |
import math
import os
import random
from typing import List
import moviepy.audio.fx as afx
import moviepy.video.fx as vfx
from PIL import ImageFont
from funmaterial.font import random_font_from_zenodo
from funmaterial.song import random_song_from_zenodo
from funutil import getLogger
from funvideo.app.models import con... | farfarfun/funvideo | src/funvideo/app/services/video.py | .py | 00d33eb047d25bbe | 7 | 0 |
"""pytest 全局配置:为 funvideo 冒烟测试提供隔离的运行环境。
funvideo 在导入期间存在两个副作用,需要在测试环境中妥善处理:
1. `funvideo.app.config.core.Config` 会在模块导入时基于**当前工作目录**读取
`./config.toml`。仓库中并没有随附 `config.example.toml`,因此如果裸跑在
仓库根目录下会直接在 import 阶段抛出 ``FileNotFoundError``。
2. `funvideo.app.services.llm` 在模块导入时会直接调用
``funai.llm.get_model("deepse... | farfarfun/funvideo | tests/conftest.py | .py | 8ba877fef8e7640d | 7.5 | 0 |
"""funvideo 冒烟测试套件。
本仓库此前没有 tests/ 目录(参见 farfarfun/todo-list issue #103)。
funvideo 是一个完整的 FastAPI 短视频生成服务(src-layout,50+ 个 .py 文件),
这里只覆盖最基础的冒烟场景:
- 顶层包 / FastAPI app 对象可以被正常 import 和构建;
- 应用注册了预期的路由;
- 几个不依赖真实 LLM / TTS / 下载素材等外部服务的接口可以被 TestClient 正常调用;
- 真正需要调用大模型的接口,通过 conftest.py 里替换掉的 mock 模型来验证请求/响应
链路是通的(不发... | farfarfun/funvideo | tests/test_smoke.py | .py | da11bccedb1ecab2 | 7.5 | 0 |
from cachebox import FIFOCache, LFUCache, LRUCache, RRCache, TTLCache, VTTLCache, cached
__all__ = [
"cache",
"lru_cache",
"ttl_cache",
"vttl_cache",
"lfu_cache",
"fifo_cache",
"rr_cache",
]
def cache(func, /):
return cached(LRUCache(maxsize=1000)).__call__(func)
def vttl_cache(maxs... | farfarfun/funutil | src/funutil/cache/box.py | .py | 2e783d65be943565 | 7 | 0 |
"""Drop staged SQLite files whose only change is the header counters.
Opening a database read-write bumps SQLite's file change counter (header bytes
24-27) and version-valid-for number (bytes 92-95). That rewrites the file
without touching a single row, and committing it re-adds the whole partition as
a fresh blob. ci... | nmpowell/carbon-intensity-forecast-tracking | .github/scripts/unstage_header_only.py | .py | d82a550b13821258 | 7.35 | 4 |
"""Build the window-by-lead analysis frames the charts and README tables consume."""
from dataclasses import dataclass
from datetime import datetime
from datetime import timedelta
from datetime import timezone
from typing import Iterable
import numpy as np
import pandas as pd
import scipy.stats as st
from scipy.optim... | nmpowell/carbon-intensity-forecast-tracking | cift/analysis.py | .py | d7682847173c4d03 | 7.35 | 4 |
"""HTTP adapter for the NESO Carbon Intensity API."""
import time
from datetime import datetime
from typing import Any
from typing import Protocol
from typing import cast
import requests
from cift.api import DATETIME_FMT_STR
from cift.api import TEMPLATE_URLS
class Client(Protocol):
"""What ingestion needs fro... | nmpowell/carbon-intensity-forecast-tracking | cift/client.py | .py | 4f3709b57d1943a3 | 7.35 | 4 |
import colorsys
import os
from datetime import datetime
import matplotlib.colors as mcolors
import numpy as np
from matplotlib.colors import BoundaryNorm
from matplotlib.colors import ListedColormap
CI_BANDS_FILEPATH = os.path.join(
os.path.abspath(os.path.dirname(__file__)),
"..",
"data",
"artifacts"... | nmpowell/carbon-intensity-forecast-tracking | cift/colourmap.py | .py | 02dd3e393672d005 | 7.35 | 4 |
"""Turn raw API payloads into storage-ready observation rows. Pure: no I/O, no clock."""
from dataclasses import dataclass
from datetime import datetime
from datetime import timezone
from typing import Any
ENDPOINTS = (
"national_fw48h",
"national_pt24h",
"regional_fw48h",
"regional_pt24h",
"natio... | nmpowell/carbon-intensity-forecast-tracking | cift/parse.py | .py | d0256f59e77195b6 | 7.35 | 4 |
import json
import os
from datetime import datetime
from datetime import timezone
from pathlib import Path
from typing import Any
import pytest
# Chart tests must never open a display; conftest runs before any test module
# imports pyplot, so the backend choice lands in time.
os.environ.setdefault("MPLBACKEND", "Agg"... | nmpowell/carbon-intensity-forecast-tracking | tests/conftest.py | .py | afb36f0e37d5275c | 7.85 | 4 |
"""End-to-end analyse: store in, charts + README tables + recorded stats out."""
import sqlite3
from datetime import timedelta
from pathlib import Path
from unittest import mock
import cift.analyse
from cift.analyse import run_analyse
from cift.parse import floor_to_slot
from cift.parse import parse_snapshot
from cif... | nmpowell/carbon-intensity-forecast-tracking | tests/functional/test_analyse.py | .py | 89746c1e289bdbc2 | 7.85 | 4 |
"""Lightweight smoke tests for fundb.
These tests confirm the public API can be imported and exercised at a basic
level. Real network calls (JSONStorage) are mocked with unittest.mock.
sqlite in-memory engines are used for the sqlalchemy helpers because they
are real but fully local/ephemeral - no external DB or netwo... | farfarfun/fundb | tests/test_smoke.py | .py | 23e5e622d88bde45 | 7.5 | 0 |
# https://stackoverflow.com/a/22085679/2478637
# http://simondlevy.academic.wlu.edu/files/software/kbhit.py
from typing import Callable, Any
import os
import threading
import time
# Windows
if os.name == "nt":
import msvcrt
# Posix (Linux, OS X)
else:
import sys
import termios
import atexit
from... | farfarfun/fundrive-baidu | src/fundrives/baidu/common/keyboard.py | .py | 8415926a42cfa4b4 | 7 | 0 |
import socket
def avail_port(port: int) -> bool:
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
return s.connect_ex(("localhost", port)) != 0
def random_avail_port() -> int:
"""Find a random available port using port 0
https://www.lifewire.com/port-0-in-tcp-and-udp-818145
Port... | farfarfun/fundrive-baidu | src/fundrives/baidu/common/net.py | .py | 0283d7eff867d8eb | 7 | 0 |
import random
def crypt(data, byte_map, len_):
for i in range(len_):
data[i] = byte_map[data[i]]
class SimpleCryptography:
"""Simple Cryptography
This crypto algorithm uses a random uint8 map to transfer an uint8 to another uint8.
So, the decryption process does not depend on previous decry... | farfarfun/fundrive-baidu | src/fundrives/baidu/common/simple_cipher.py | .py | 7e3674cfe981faa5 | 7 | 0 |
"""轻量冒烟测试(smoke tests)for fundrive-baidu.
本仓库此前没有 tests/ 目录。这里只做最基础的可用性验证:
- 顶层包 / 共享命名空间包能否正常 import
- 主要驱动类能否在不触发真实网络请求 / 不需要真实百度网盘凭据的情况下完成构造
- 明确无法在不使用真实凭据的情况下验证的路径,用 pytest.skip 标注并说明原因
不追求覆盖业务逻辑正确性,只保证包本身是"可安装、可导入、基础对象可构造"的。
"""
import socket
import pytest
class _NetworkGuard:
"""在 with 块内如果发生真实 TCP conn... | farfarfun/fundrive-baidu | tests/test_smoke.py | .py | cb26e7642fbaec4e | 7.5 | 0 |
"""funapp 轻量冒烟测试(smoke test)。
覆盖范围:
- 顶层包 ``funapp`` 及各子包(``work``、``server``、``schema``、``ui``)能否正常 import。
- 对确实可以正常导入、且只包含纯声明式代码(不发起真实网络/端口/数据库调用)的
模块(如 ``funapp.ui.login``),验证 import 不抛异常。
本仓库此前没有 ``tests/`` 目录,探测过程中发现该包本身存在若干未完成/过时的
代码,均为仓库自身的 bug,不在本次冒烟测试范围内修复,以 ``pytest.skip`` 标注:
1. ``funapp/schema/__init_... | farfarfun/funapp | tests/test_smoke.py | .py | 2996dfb3171fc1f8 | 7.5 | 0 |
"""Config flow for Spot-Hinta.fi integration."""
from __future__ import annotations
from typing import Any
from spothinta_api.const import Region
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import CONF_REGION
from homeassistant.helpers.selec... | slovdahl/home-assistant-spothinta | custom_components/spothinta/config_flow.py | .py | 96aa948da98b9058 | 7.24 | 2 |
"""The Coordinator for Spot-Hinta.fi."""
from __future__ import annotations
from datetime import datetime, timedelta
import logging
from random import randint
from typing import NamedTuple
from spothinta_api import Electricity, SpotHinta, SpotHintaConnectionError
from spothinta_api.const import Region
from homeassis... | slovdahl/home-assistant-spothinta | custom_components/spothinta/coordinator.py | .py | 41ba3583beaf1595 | 7.24 | 2 |
from logging.config import fileConfig
from sqlalchemy import engine_from_config, pool
from alembic import context
from pingpong.models import Base
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
# Interpret the config file for Python lo... | comppolicylab/pingpong | alembic/env.py | .py | 2ee176153553beb5 | 7.39 | 5 |
"""Add lesson timeline bypass assistant policy
Revision ID: 0a1b2c3d4e5f
Revises: 9f1a2b3c4d5e
Create Date: 2026-06-13 00:00:00.000000
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "0a1b2c3d4e5f"
down_revision: Union[... | comppolicylab/pingpong | alembic/versions/0a1b2c3d4e5f_add_lesson_timeline_bypass.py | .py | 43ceb71356017c41 | 7.39 | 5 |
"""Add API Key name
Revision ID: 0a9e2ba4455c
Revises: 29bf10fa9462
Create Date: 2024-11-21 21:43:46.924563
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "0a9e2ba4455c"
down_revision: Union[str, None] = "dfd24880d2ac"... | comppolicylab/pingpong | alembic/versions/0a9e2ba4455c_add_api_key_name.py | .py | 2c6a44f1eae1e2ad | 7.39 | 5 |
"""add video description duration
Revision ID: 0b7a1d2e9c45
Revises: df25d20d0f3a
Create Date: 2026-04-28 00:00:00.000000
"""
from typing import Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "0b7a1d2e9c45"
down_revision: Union[str, None] = "df25d20d0... | comppolicylab/pingpong | alembic/versions/0b7a1d2e9c45_add_video_description_duration.py | .py | acb1564d7a936ae7 | 7.39 | 5 |
"""Add disable prompt randomization
Revision ID: 1dc0c8626e4a
Revises: 3d0b22f9fd11
Create Date: 2026-03-16 16:00:00.000000
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "1dc0c8626e4a"
down_revision: Union[str, None] ... | comppolicylab/pingpong | alembic/versions/1dc0c8626e4a_add_disable_prompt_randomization.py | .py | e146f9359516cb8b | 7.39 | 5 |
"""Add locked column for assistants
Revision ID: 1e252e8386de
Revises: 0a9e2ba4455c
Create Date: 2024-12-10 12:09:50.651786
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "1e252e8386de"
down_revision: Union[str, None] ... | comppolicylab/pingpong | alembic/versions/1e252e8386de_add_locked_column_for_assistants.py | .py | 5b93b078c5d2c3e5 | 7.39 | 5 |
"""add columns for assistant management options
Revision ID: 22ef0e00b450
Revises: a61dd1e1aca7
Create Date: 2024-01-17 15:30:01.690819
"""
from typing import Sequence, Union
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision: str = "22ef0e00b450"
down_revision: Union... | comppolicylab/pingpong | alembic/versions/22ef0e00b450_add_columns_for_assistant_management_.py | .py | e9d43af313ef4bd4 | 7.39 | 5 |
"""Add can_share_assistants permission
Revision ID: 2b8a809f389b
Revises: a0e423503265
Create Date: 2025-08-28 19:14:51.599247
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "2b8a809f389b"
down_revision: Union[str, Non... | comppolicylab/pingpong | alembic/versions/2b8a809f389b_add_can_share_assistants_permission.py | .py | 329d99e49260ff25 | 7.39 | 5 |
"""Migrate to Assistants API v2
Revision ID: 351f7fa9482e
Revises: 8f4b8eef881c
Create Date: 2024-06-12 16:56:58.978104
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "351f7fa9482e"
down_revision: Union[str, None] = "8... | comppolicylab/pingpong | alembic/versions/351f7fa9482e_migrate_to_assistants_api_v2.py | .py | eca96beaf9521ed0 | 7.39 | 5 |
"""Add Hide MCP Details
Revision ID: 371b3a44a211
Revises: 7a2c06fb4b7c
Create Date: 2025-12-24 23:26:28.308666
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "371b3a44a211"
down_revision: Union[str, None] = "7a2c06fb4... | comppolicylab/pingpong | alembic/versions/371b3a44a211_add_hide_mcp_details.py | .py | b74f1fc60d333ee9 | 7.39 | 5 |
"""AI Summaries
Revision ID: 392821b96cb0
Revises: 532eea36d1c6
Create Date: 2025-01-27 18:59:23.737683
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "392821b96cb0"
down_revision: Union[str, None] = "532eea36d1c6"
bra... | comppolicylab/pingpong | alembic/versions/392821b96cb0_ai_summaries.py | .py | d49907cb37732878 | 7.39 | 5 |
"""Add SSO Merging dependencies
Revision ID: 39fad082e71b
Revises: 5acfd7c7485f
Create Date: 2024-09-06 21:11:01.955910
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "39fad082e71b"
down_revision: Union[str, None] = "5a... | comppolicylab/pingpong | alembic/versions/39fad082e71b_add_sso_merging_dependencies.py | .py | c30165b194a870a9 | 7.39 | 5 |
"""Add resource_link_id in LTIClass
Revision ID: 3cc56efe20a8
Revises: a384f2bfddf4
Create Date: 2026-02-10 18:00:43.449645
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "3cc56efe20a8"
down_revision: Union[str, None] ... | comppolicylab/pingpong | alembic/versions/3cc56efe20a8_add_resource_link_id_in_lticlass.py | .py | f4930a88b7e97f6b | 7.39 | 5 |
"""Add voice_id to lecture videos
Revision ID: 3d0b22f9fd11
Revises: 86d7206db7f1
Create Date: 2026-03-14 13:00:00.000000
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "3d0b22f9fd11"
down_revision: Union[str, None] = ... | comppolicylab/pingpong | alembic/versions/3d0b22f9fd11_add_voice_id_to_lecture_videos.py | .py | 9eb2e04bc73f7ea1 | 7.39 | 5 |
"""Add Code Interpreter visibility settings
Revision ID: 3e4f5a6b7c8d
Revises: 7c1d9e2f3a4b
Create Date: 2026-06-10 00:00:00.000000
"""
from typing import Sequence, Union
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision: str = "3e4f5a6b7c8d"
down_revision: Union[str... | comppolicylab/pingpong | alembic/versions/3e4f5a6b7c8d_add_code_interpreter_visibility_settings.py | .py | 9c973c426612e0e1 | 7.39 | 5 |
"""Clean Up after migration
Revision ID: 443687e4b64c
Revises: ccc53879e832
Create Date: 2024-06-20 11:35:27.408269
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "443687e4b64c"
down_revision: Union[str, None] = "ccc5387... | comppolicylab/pingpong | alembic/versions/443687e4b64c_clean_up_after_migration.py | .py | c8711e5707bd95af | 7.39 | 5 |
"""Add private field for Classes
Revision ID: 44edbf2cecbc
Revises: 7d6dde851734
Create Date: 2024-06-25 18:51:13.610411
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "44edbf2cecbc"
down_revision: Union[str, None] = "... | comppolicylab/pingpong | alembic/versions/44edbf2cecbc_add_private_field_for_classes.py | .py | 71a011543c81d1e4 | 7.39 | 5 |
"""add realtime transcription model
Revision ID: 4a9d7c3e2f10
Revises: c6a4f8d2b901
Create Date: 2026-05-19 00:00:00.000000
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "4a9d7c3e2f10"
down_revision: Union[str, None] ... | comppolicylab/pingpong | alembic/versions/4a9d7c3e2f10_add_realtime_transcription_model.py | .py | 50299ae4dd50221b | 7.39 | 5 |
"""added lecture_video_id to threads
Revision ID: 4aed51ccae36
Revises: d4843142e8de
Create Date: 2026-02-18 15:18:06.167233
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "4aed51ccae36"
down_revision: Union[str, None]... | comppolicylab/pingpong | alembic/versions/4aed51ccae36_added_lecture_video_id_to_threads.py | .py | 5f9c2e00520d3bbc | 7.39 | 5 |
"""Add message phase for v3 assistant messages
Revision ID: 4db0bf59f8c2
Revises: 6812f442bbbb
Create Date: 2026-03-13 12:50:47.123456
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "4db0bf59f8c2"
down_revision: Union[... | comppolicylab/pingpong | alembic/versions/4db0bf59f8c2_add_message_phase.py | .py | 847720095a2aa9e3 | 7.39 | 5 |
"""Email as ExternalLogin provider
Revision ID: 532eea36d1c6
Revises: 1e252e8386de
Create Date: 2025-01-08 17:22:43.851620
"""
from typing import Sequence, Union
from alembic import op
# revision identifiers, used by Alembic.
revision: str = "532eea36d1c6"
down_revision: Union[str, None] = "1e252e8386de"
branch_l... | comppolicylab/pingpong | alembic/versions/532eea36d1c6_email_as_externallogin_provider.py | .py | 4821169ea6dfa8ed | 7.39 | 5 |
"""Store LMS Tenant in Class table
Revision ID: 58003b4b1f16
Revises: 61666311d80b
Create Date: 2025-04-10 19:25:59.152725
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "58003b4b1f16"
down_revision: Union[str, None] ... | comppolicylab/pingpong | alembic/versions/58003b4b1f16_store_lms_tenant_in_class_table.py | .py | c0ad89a8197ab6a4 | 7.39 | 5 |
"""Add LMS Sync dependencies
Revision ID: 5acfd7c7485f
Revises: 44edbf2cecbc
Create Date: 2024-08-22 22:03:08.832458
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "5acfd7c7485f"
down_revision: Union[str, None] = "44ed... | comppolicylab/pingpong | alembic/versions/5acfd7c7485f_add_lms_sync_dependencies.py | .py | 099d2e7e7b75518d | 7.39 | 5 |
"""add column for hiding prompt
Revision ID: 6095509a2761
Revises: ef79c15112d7
Create Date: 2024-01-18 16:26:57.094040
"""
from typing import Sequence, Union
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision: str = "6095509a2761"
down_revision: Union[str, None] = "e... | comppolicylab/pingpong | alembic/versions/6095509a2761_add_column_for_hiding_prompt.py | .py | 05d556f0112f3cf0 | 7.39 | 5 |
"""Assistant Interaction Modes
Revision ID: 61666311d80b
Revises: 52dfd11d4503
Create Date: 2025-03-24 10:13:39.789867
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "61666311d80b"
down_revision: Union[str, None] = "52... | comppolicylab/pingpong | alembic/versions/61666311d80b_assistant_interaction_modes.py | .py | e4e20ffe9f53d03a | 7.39 | 5 |
"""Add Azure Region
Revision ID: 6bc8a757a63f
Revises: 58003b4b1f16
Create Date: 2025-04-14 18:47:36.595165
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "6bc8a757a63f"
down_revision: Union[str, None] = "58003b4b1f16"... | comppolicylab/pingpong | alembic/versions/6bc8a757a63f_add_azure_region.py | .py | 47dcd86361d39353 | 7.39 | 5 |
"""Add run moderation
Revision ID: 6e1f8c9a4d2b
Revises: c2f4e8a9d3b1
Create Date: 2026-06-04 12:00:00.000000
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "6e1f8c9a4d2b"
down_revision: Union[str, None] = "c2f4e8a9d3b... | comppolicylab/pingpong | alembic/versions/6e1f8c9a4d2b_add_run_moderation.py | .py | e5157a0b8e052d6f | 7.39 | 5 |
"""added_video_interaction_mode
Revision ID: 700e871f0775
Revises: 5f2cb8d3f4a1
Create Date: 2026-02-13 13:41:32.001455
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "700e871f0775"
down_revision: Union[str, None] = "5... | comppolicylab/pingpong | alembic/versions/700e871f0775_added_video_interaction_mode.py | .py | f111ad260b53031a | 7.39 | 5 |
"""add columns for tracking files
Revision ID: 7bffc8dee7e3
Revises: 6095509a2761
Create Date: 2024-02-01 15:50:03.770426
"""
from typing import Sequence, Union
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision: str = "7bffc8dee7e3"
down_revision: Union[str, None] = ... | comppolicylab/pingpong | alembic/versions/7bffc8dee7e3_add_columns_for_tracking_files.py | .py | fd91a208724bb53b | 7.39 | 5 |
"""Vision support
Revision ID: 7d6dde851734
Revises: 443687e4b64c
Create Date: 2024-06-20 21:28:58.332187
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "7d6dde851734"
down_revision: Union[str, None] = "443687e4b64c"
b... | comppolicylab/pingpong | alembic/versions/7d6dde851734_vision_support.py | .py | 90d8a77e7368fee2 | 7.39 | 5 |
"""add lecture video caption stored objects
Revision ID: 7e6f23c1a9b4
Revises: 4a9d7c3e2f10
Create Date: 2026-05-21 00:00:00.000000
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "7e6f23c1a9b4"
down_revision: Union[str... | comppolicylab/pingpong | alembic/versions/7e6f23c1a9b4_add_lecture_video_caption_stored_objects.py | .py | 0a182cd845ecb5cb | 7.39 | 5 |
"""add notes field to assistant
Revision ID: 867fefaae27b
Revises: a9eb133baba4
Create Date: 2026-01-21 15:47:41.207794
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "867fefaae27b"
down_revision: Union[str, None] = "a... | comppolicylab/pingpong | alembic/versions/867fefaae27b_add_notes_field_to_assistant.py | .py | 71537d3d250528c0 | 7.39 | 5 |
import re
import pandas as pd
from pandas import DataFrame
def _is_header(extracted: list, *args, **kwargs):
"""
>>> _is_header(["---", "---"])
True
>>> _is_header([":---", "---:", ":---:"])
True
>>> _is_header([":---", "foo", "bar"])
False
>>> _is_header(["foo", "bar"])
False
... | farfarfun/funmd | src/funmd/_pandas.py | .py | 793345fde97b8ce2 | 7 | 0 |
"""Lightweight smoke tests for the ``funmd`` package.
funmd is a tiny, dependency-light utility that converts between Markdown
tables and pandas DataFrames. There is no network/DB/cloud access anywhere
in the package, so these tests exercise the real code paths directly
rather than mocking anything.
"""
import pandas... | farfarfun/funmd | tests/test_smoke.py | .py | 837d0d77947d47c9 | 7.5 | 0 |
"""Contains shared errors types that can be raised from API functions"""
class UnexpectedStatus(Exception):
"""Raised by api functions when the response status an undocumented status and Client.raise_on_unexpected_status is True"""
def __init__(self, status_code: int, content: bytes):
self.status_cod... | farfarfun/funapi-sciencedb | src/sciencedb/errors.py | .py | 80ef060662aa9923 | 7 | 0 |
"""Contains some shared types for properties"""
from http import HTTPStatus
from typing import (
BinaryIO,
Generic,
Literal,
MutableMapping,
Optional,
Tuple,
TypeVar,
)
from attrs import define
class Unset:
def __bool__(self) -> Literal[False]:
return False
UNSET: Unset = U... | farfarfun/funapi-sciencedb | src/sciencedb/types.py | .py | db151e31a07e130a | 7 | 0 |
import os
import sys
import time
import warnings
import time
import scratchattach as sa
warnings.filterwarnings('ignore', category=sa.LoginDataWarning)
warnings.filterwarnings('ignore', category=sa.GetAuthenticationWarning)
pswd = os.environ.get("PASS") #'PASS' is an env secret in the workflow, not on this device
usn... | Boss-1s/scratchattach | aesthetic_prioritizing.py | .py | 94450e7a6ab94e05 | 7.24 | 2 |
"""Lightweight smoke tests for funserver.
These tests only check that the package imports cleanly and that its public
surface (BaseServer / BaseCommandServer / server_parser and the CLI) behaves
sanely with trivial inputs. They deliberately avoid binding real network
ports, spawning real processes, or touching a user'... | farfarfun/funserver | tests/test_smoke.py | .py | 91efa7615e0445d1 | 7.5 | 0 |
import asyncio
import json
import hashlib
from datetime import datetime
from pathlib import Path
from typing import List, Set, Dict, Optional
from dataclasses import dataclass, asdict
from playwright.async_api import async_playwright
from bs4 import BeautifulSoup
import aiohttp
@dataclass
class ASNSnapshot:
"""AS... | budaobu/rules | py/cn-asn-scraper.py | .py | ff7599ef7491ebd4 | 7.24 | 2 |
"""Lightweight smoke tests for the published ``funui`` package.
IMPORTANT CONTEXT (read before extending this file):
The ``funui`` PyPI distribution's actual source lives under ``src/funui`` in
this repository. As of this writing, ``src/funui/__init__.py``,
``src/funui/module/__init__.py`` and ``src/funui/page/__init... | farfarfun/funui | tests/test_smoke.py | .py | 8d986bf4872e938e | 7.5 | 0 |
"""Shared output helpers for basic filter examples."""
def _format_position_velocity_row(step, measurement, estimate):
"""Return one formatted position/velocity estimate row."""
position, velocity = estimate
return (
f"{step:>4} {measurement:>11.2f} "
f"{float(position):>8.3f} {float(ve... | FlorianPfaff/PyRecEst | examples/basic/_filter_example_output.py | .py | 90100199ed503941 | 7.24 | 2 |
"""Custom distribution example for the public protocol seed.
The class in this example does not inherit from a PyRecEst distribution base
class. It exposes the currently public dimension protocols and uses method names
that follow common PyRecEst distribution conventions.
"""
from __future__ import annotations
from ... | FlorianPfaff/PyRecEst | examples/basic/custom_distribution_protocol.py | .py | 01b2f0ca2685745e | 7.24 | 2 |
"""Custom filter example for the public protocol seed.
The filter in this example does not inherit from a PyRecEst filter base class.
It exposes the currently public dimension protocol and follows common PyRecEst
filter naming conventions such as ``filter_state`` and ``get_point_estimate``.
"""
from __future__ import... | FlorianPfaff/PyRecEst | examples/basic/custom_filter_protocol.py | .py | 7803f360c1f04c02 | 7.24 | 2 |
"""Dirichlet-process subclustering for one extended-target measurement subset.
The RFS tracker would decide that this subset belongs to one extended target; the
DP helper then proposes target-internal measurement subclusters, such as two
scattering centers or two contour fragments, without fixing that number in
advanc... | FlorianPfaff/PyRecEst | examples/basic/dp_extended_target_subclustering.py | .py | 75b6ed9d083b3917 | 7.24 | 2 |
"""Example for multiplying multiple Gaussian distributions.
The product of normalized Gaussian densities is proportional to another
Gaussian. This script creates three two-dimensional Gaussian factors,
multiplies them with :meth:`GaussianDistribution.multiply`, and verifies the
result against the closed-form informati... | FlorianPfaff/PyRecEst | examples/basic/gaussian_multiplication.py | .py | 91da1efd101693bf | 7.24 | 2 |
"""Kalman filter example using reusable linear-Gaussian model objects."""
# pylint: disable=import-error,no-name-in-module,no-member
from _filter_example_output import print_position_velocity_estimates
from pyrecest.backend import array, diag
from pyrecest.filters import KalmanFilter
from pyrecest.models import (
... | FlorianPfaff/PyRecEst | examples/basic/kalman_filter_with_models.py | .py | 4aec5ad6b3038f87 | 7.24 | 2 |
"""Particle filter example using reusable transition and likelihood models."""
# pylint: disable=import-error,no-name-in-module,no-member
from _filter_example_output import print_position_velocity_estimates
from pyrecest.backend import array, diag
from pyrecest.distributions import GaussianDistribution
from pyrecest.f... | FlorianPfaff/PyRecEst | examples/basic/particle_filter_with_models.py | .py | a946890eb49a3035 | 7.24 | 2 |
"""Demonstrate representation conversion for common PyRecEst distributions.
This example exercises the generic representation-conversion gateway on two
small workflows:
1. approximate a Gaussian distribution by weighted Dirac particles and moment
match those particles back to a Gaussian;
2. approximate a circular ... | FlorianPfaff/PyRecEst | examples/basic/representation_conversion.py | .py | 46e5b967e2ffbe8e | 7.24 | 2 |
"""Filter an SO(3)^K time series with masks and confidence weights."""
from __future__ import annotations
import numpy as np
from pyrecest.backend import array, cos, pi, sin, stack
from pyrecest.filters import run_so3_product_sequence_filter
def z_quaternion(angle):
"""Return a scalar-last quaternion for a yaw ... | FlorianPfaff/PyRecEst | examples/basic/so3_product_sequence_filter.py | .py | bc8e320408a06660 | 7.24 | 2 |
"""Unscented Kalman filter example using additive-noise model objects."""
# pylint: disable=import-error,no-name-in-module,no-member
from _filter_example_output import print_position_velocity_estimates
from pyrecest.backend import array, diag
from pyrecest.filters import UnscentedKalmanFilter
from pyrecest.models impo... | FlorianPfaff/PyRecEst | examples/basic/ukf_with_models.py | .py | 0c2c0435b02bfda0 | 7.24 | 2 |
"""Multiply two von Mises-Fisher distributions on the unit sphere."""
# pylint: disable=no-name-in-module,no-member
from pyrecest.backend import allclose, array, linalg
from pyrecest.distributions import VonMisesFisherDistribution
def _normalize(vector):
"""Return a unit-norm copy of ``vector``."""
return v... | FlorianPfaff/PyRecEst | examples/basic/von_mises_fisher_multiplication.py | .py | 4eb721a8582d38e0 | 7.24 | 2 |
import os
from dotenv import load_dotenv # type: ignore
dotenv_path = os.path.join(os.path.dirname(__file__), '..', '..', '.env.local')
load_dotenv(dotenv_path=dotenv_path)
UPSTASH_REDIS_REST_URL = os.getenv("UPSTASH_REDIS_REST_URL")
UPSTASH_REDIS_REST_TOKEN = os.getenv("UPSTASH_REDIS_REST_TOKEN")
from upstash_redis... | WoothAmwar/Complete-Personal-Website | server/YoutubeData/youtube_queue.py | .py | 3619e88410c6c957 | 7.15 | 1 |
# -*- coding: utf-8 -*-
"""Lightweight smoke tests for fungame-sudoku.
NOTE ON SCOPE:
`sudoku_generate()` is intentionally NOT exercised anywhere in this file.
It has a known pre-existing bug: it fills the grid with no backtracking,
so on some random draws it can loop forever (see farfarfun/todo-list
issue #40). Fixin... | farfarfun/fungame-sudoku | tests/test_smoke.py | .py | 021509acb8c52305 | 7.5 | 0 |
#!/usr/bin/env python3
"""
Import Notion book notes into _books/*.md as prose.
Matches by title, strips Notion metadata, adds a disclaimer.
Skips books that already have hand-written prose.
Run: python3 import_notion.py
"""
import os
import re
from pathlib import Path
NOTION_DIR = Path(__file__).parent / "Notion"
BOO... | chris-kremer/chris-kremer.github.io | import_notion.py | .py | efccacf612f5a28a | 7 | 0 |
#!/usr/bin/env python3
"""
Generate _people/ stub files for every primary author in the Goodreads CSV.
Skips files that already exist (won't overwrite manually enriched entries).
"""
import csv
import os
import re
CSV_NAME = "goodreads_library_export(4).csv"
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
CSV... | chris-kremer/chris-kremer.github.io | import_people.py | .py | 20b2e1b1707c76f0 | 7 | 0 |
import random
from abc import ABC, abstractmethod
from typing import Any, Dict, List, Optional, Tuple
class BaseGenerator(ABC):
"""
所有生成器的抽象基类。
所有具体的生成器类(如姓名生成器、手机号生成器、请求头生成器等)都应该继承此类,
并实现 generate() 方法来定义具体的生成逻辑。
该基类提供了通用的 generate_many() 方法实现,用于批量生成不重复的结果。
子类可以根据需要重写此方法以优化性能。
"... | farfarfun/funfake | src/funfake/base.py | .py | 7069a4925cd39b18 | 7 | 0 |
"""
HTTP 请求头生成核心模块。
该模块提供了 Headers 类和 fake_header 函数,用于生成真实的 HTTP 请求头信息。
"""
from ..base import BaseGenerator
from .browsers import chrome, firefox, opera, random_browser
from .headers import make_header
from .platforms import linux, macos, random_os, windows
class Headers(BaseGenerator):
"""
HTTP 请求头生成器。
... | farfarfun/funfake | src/funfake/headers/core.py | .py | 5d9998b89967a3d9 | 7 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.