repo_full_name stringlengths 6 93 | repo_url stringlengths 25 112 | repo_api_url stringclasses 28
values | owner stringclasses 28
values | repo_name stringclasses 28
values | description stringclasses 28
values | stars int64 617 98.8k | forks int64 31 355 ⌀ | watchers int64 990 999 ⌀ | license stringclasses 2
values | default_branch stringclasses 2
values | repo_created_at timestamp[s]date 2012-07-24 23:12:50 2025-06-16 08:07:28 ⌀ | repo_updated_at timestamp[s]date 2026-02-23 15:23:15 2026-05-03 18:52:12 ⌀ | repo_topics listlengths 0 13 ⌀ | repo_languages unknown | is_fork bool 1
class | open_issues int64 3 104 ⌀ | file_path stringlengths 3 208 | file_name stringclasses 509
values | file_extension stringclasses 1
value | file_size_bytes int64 101 84k ⌀ | file_url stringclasses 627
values | file_raw_url stringclasses 627
values | file_sha stringclasses 624
values | language stringclasses 8
values | parsed_at stringdate 2026-05-04 01:12:36 2026-05-04 19:41:55 | text stringlengths 100 102k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
russellromney/honker | https://github.com/russellromney/honker | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | packages/honker/python/honker/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:31.075558 | from honker._honker import (
Database,
Event,
Job,
Listener,
LockHeld,
Notification,
Outbox,
Queue,
Retryable,
Stream,
open,
)
from honker._scheduler import (
CronSchedule,
Scheduler,
crontab,
every_s,
)
from honker._tasks import (
TaskResult,
UnknownT... |
russellromney/honker | https://github.com/russellromney/honker | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | packages/honker/examples/worker.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:31.076077 | """End-to-end worker loop.
Enqueues a few jobs, runs an async worker loop that drains them via
the long-lived `claim()` iterator (wakes on every database update, no
polling), and exits when the queue is empty.
This is the idiomatic Python worker shape: one async iterator, one
try/except per job, retry on failure, ack... |
russellromney/honker | https://github.com/russellromney/honker | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | packages/honker/test_basic.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:31.084509 | import asyncio
import honker
import os
async def main():
if os.path.exists("test.db"):
os.remove("test.db")
db = honker.open("test.db")
with db.transaction() as tx:
tx.execute("CREATE TABLE orders (id INTEGER PRIMARY KEY, total REAL)")
async def listener():
count = 0
... |
russellromney/honker | https://github.com/russellromney/honker | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | packages/honker/python/honker/_tasks.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:31.086015 | """Huey-style task decorators on top of honker.Queue.
import honker
db = honker.open("app.db")
default = db.queue("default")
@default.task(retries=3)
def send_email(to: str, subject: str) -> dict:
...
return {"sent_at": time.time()}
# Caller side — looks synchronous, isn't.
... |
russellromney/honker | https://github.com/russellromney/honker | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | packages/honker/python/honker/_honker.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:31.087178 | import asyncio
import json
import time
import traceback
import uuid
from collections import deque
from typing import Any, AsyncIterator, Callable, Optional
def _core_open(path, max_readers, watcher_backend=None):
from honker._honker_native import open as _open
return _open(path, max_readers=max_readers, watch... |
russellromney/honker | https://github.com/russellromney/honker | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | packages/honker/python/honker/_worker.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:31.112734 | """Shared worker-side task execution.
`run_task` is called by every framework plugin's worker loop to
execute one claimed job. It centralizes the behaviors that the
`@task(...)` decorator knobs configure:
- `timeout=N` : wall-clock bound on handler execution.
- `retries=N` : max attempt count before the j... |
russellromney/honker | https://github.com/russellromney/honker | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | scripts/proof_fcntl_vs_pragma.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:31.589577 | #!/usr/bin/env python3
"""
proof_fcntl_vs_pragma.py — KEPT AS A RECORD OF AN INCORRECT INITIAL CONCLUSION.
This script was written to prove that `SQLITE_FCNTL_DATA_VERSION` is
per-pager and that `PRAGMA data_version` is global. The print
statements still say so.
That is wrong, in two different ways:
1. The "expect... |
russellromney/honker | https://github.com/russellromney/honker | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/test_cross_process_wake_latency.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:31.650007 | """Cross-process wake-latency regression test.
The README's pitch is 'sub-millisecond to low-single-digit-ms wake
latency, bounded by the 1 ms update-watcher cadence, for commits in OTHER
processes.' This test pins that story in CI so it can't silently
regress.
Strategy: parent spawns a subprocess that opens the same... |
russellromney/honker | https://github.com/russellromney/honker | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | scripts/test_sqlite_versions.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:31.653646 | #!/usr/bin/env python3
"""
Investigates when SQLITE_FCNTL_DATA_VERSION misses cross-connection commits.
Tests multiple SQLite paths: system lib, Homebrew, bundled with Python, etc.
"""
import ctypes
import ctypes.util
import os
import subprocess
import sys
import tempfile
def find_sqlite_libs():
"""Find all sqli... |
russellromney/honker | https://github.com/russellromney/honker | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/conftest.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:31.679923 | import gc
import os
import sys
import tempfile
import pytest
# Put packages/ on sys.path so the `honker` package is importable in
# tests without needing a `pip install -e`.
_REPO_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
_PACKAGES_ROOT = os.path.join(_REPO_ROOT, "packages")
_HONKER_PYTHON_RO... |
russellromney/honker | https://github.com/russellromney/honker | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/test_extension_interop.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:31.686301 | """Cross-binding interop: the SQLite loadable extension and the Python
binding must agree on schema and ack semantics. Root-caused an earlier
bug where the extension had a 6-column ``_honker_dead`` while Python
expected 10, and where ``honker_ack_batch`` UPDATEd rows to state='done'
while Python DELETEd them. Both now ... |
russellromney/honker | https://github.com/russellromney/honker | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/test_crash_recovery.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:31.688525 | """SIGKILL mid-transaction crash recovery.
The "my worker box got rebooted" story. We spawn a real Python subprocess,
let it open the DB and hold a `BEGIN IMMEDIATE` with pending writes, then
`os.kill(pid, SIGKILL)` before COMMIT. A fresh process then opens the DB
and verifies:
* the file is not corrupt (`PRAGMA in... |
russellromney/honker | https://github.com/russellromney/honker | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/test_joblite.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:31.723406 | """Tests for the honker Python package.
Covers the six must-pass tests from PLAN.md plus ordering, delayed run_at,
max_attempts→dead, rollback-drops-enqueue, and worker-wakes-on-NOTIFY.
"""
import asyncio
import json
import os
import queue as queue_mod
import subprocess
import sys
import threading
import time
import... |
russellromney/honker | https://github.com/russellromney/honker | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/test_fault_injection.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:31.734492 | """Fault injection — disk / permission / corruption failures.
Silent failure is the worst-case outcome for a persistence library:
a queue that drops jobs without an error, or a listener that
freezes on an unwritable WAL. These tests prove that each failure
mode raises a clear, propagated error that a caller can handle... |
russellromney/honker | https://github.com/russellromney/honker | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/test_litenotify.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:31.755372 | """Tests for the honker Python binding.
Covers: param type fidelity, connection pool release under success/rollback/
exception, listener channel isolation, fanout, slow-listener non-blocking,
and the BEGIN IMMEDIATE concurrency story.
"""
import asyncio
import gc
import sqlite3
import threading
import time
import py... |
russellromney/honker | https://github.com/russellromney/honker | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/test_multiprocess.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:32.143635 | """Multi-process durability tests.
These run actual Python subprocesses that open the same .db file, which is
the real deployment story for WSGI/ASGI apps with multiple workers. Every
single-process test we have relies on in-process lock cooperation; these
tests prove the disk-level story (BEGIN IMMEDIATE across conne... |
russellromney/honker | https://github.com/russellromney/honker | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/test_outbox.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:32.248152 | """Tests for honker.outbox."""
import asyncio
import pytest
import honker
async def test_outbox_delivery_called_and_acked(db_path):
db = honker.open(db_path)
delivered = []
async def deliver(payload):
delivered.append(payload)
outbox = db.outbox("webhook", delivery=deliver)
outbox.enq... |
russellromney/honker | https://github.com/russellromney/honker | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/test_real_app_example.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:32.251778 | import importlib.util
import sys
def _load_example():
spec = importlib.util.spec_from_file_location(
"honker_real_app_example",
"packages/honker/examples/real_app.py",
)
module = importlib.util.module_from_spec(spec)
assert spec.loader is not None
sys.modules[spec.name] = module
... |
russellromney/honker | https://github.com/russellromney/honker | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/test_rate_limit.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:32.268479 | """Tests for db.try_rate_limit() / db.sweep_rate_limits().
Fixed-window rate limiter. Good enough for "don't hammer this endpoint
past X per Y seconds"; at window boundaries the counter resets.
"""
import time
import pytest
import honker
def test_rate_limit_allows_under_limit(db_path):
db = honker.open(db_pat... |
russellromney/honker | https://github.com/russellromney/honker | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/test_performance_floors.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:32.282005 | """Performance floor tests.
These pin a loose throughput floor for hot paths so a 10x+ regression
(unindexed query, lost `prepare_cached`, extra JSON round-trip per
row) trips CI instead of shipping silently.
Thresholds are set ~3-5x below measured throughput on an M-series
laptop so they don't flake on slower CI har... |
russellromney/honker | https://github.com/russellromney/honker | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/test_real_e2e_scenarios.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:32.307943 | """Real user-shaped end-to-end scenarios.
These tests use separate Python processes that share one SQLite file.
That is the deployment shape Honker is trying to make boring: an app
process commits data, sleeping workers/listeners wake, and all state is
in the same database file.
"""
from __future__ import annotations... |
russellromney/honker | https://github.com/russellromney/honker | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/test_scheduler.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:32.314593 | """Tests for honker.Scheduler and the Rust-backed crontab parser.
Scheduler has two separate concerns:
1. Cron parsing + next-boundary (pure Rust; tested via the Python
facade). Low-level parser tests live alongside the Rust
implementation (`honker-core/src/cron.rs`); here we only
exercise the Python-... |
russellromney/honker | https://github.com/russellromney/honker | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/test_resource_bounds.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:32.316051 | """Resource bounds: make sure bridge threads and memory don't balloon.
Guard against subscriber leaks in the shared update watcher: every
`db.update_events()` unsubscribes via `Drop` on the underlying binding,
and the bridge thread exits when its channel disconnects. If those
teardown paths regress, thread count grows... |
russellromney/honker | https://github.com/russellromney/honker | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/test_ruby_python_interop.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:32.316987 | """Cross-binding interop between Ruby and Python.
Ruby is currently an extension-backed binding rather than a core
watcher binding. This test still matters: both packages must agree on
the on-disk schema, queue semantics, and notification payload format.
"""
import json
import os
import shutil
import subprocess
from ... |
russellromney/honker | https://github.com/russellromney/honker | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/test_scheduler_boundaries.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:32.354147 | """Real-time scheduler boundary tests.
The unit tests in `test_scheduler.py` mock `now_unix` and tick
`honker_scheduler_tick(now)` with fabricated timestamps — fast, but
they don't prove the live scheduler loop gets the sleep math right.
If `_main_loop` sleeps one second too long or
`honker_scheduler_soonest()` return... |
russellromney/honker | https://github.com/russellromney/honker | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/test_schema_migration.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:32.712170 | """Schema migration tests.
Users upgrading from a pre-refactor `honker` release have a `.db`
file with old schemas on disk. Opening it with current code must
not crash, silently corrupt data, or leave the user stuck. These
tests build legacy schemas directly via sqlite3, then open the
file with honker and assert the u... |
russellromney/honker | https://github.com/russellromney/honker | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/test_subscribe_race.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:32.829312 | """Regression tests for the "subscribe-after-first-read" race.
Consumers that (a) snapshot some state and (b) wait on the update watcher
must subscribe to update_events BEFORE the snapshot. Otherwise a commit
landing in the window between snapshot and subscribe fires its update tick
to no subscriber, and the consumer ... |
russellromney/honker | https://github.com/russellromney/honker | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/test_soak.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:32.856067 | """Sustained-load soak tests.
`test_resource_bounds.py` already guards against thread leaks on
listener churn; those tests are seconds-scale. This file runs
minute-scale soak to catch slow memory and disk-usage leaks that
wouldn't show up in a fast test: statement-cache bloat, missing
WAL checkpoint, bridge-thread acc... |
russellromney/honker | https://github.com/russellromney/honker | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/test_task_expiration.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:32.877306 | """Tests for task expiration.
Jobs enqueued with `expires=N` become unclaimable N seconds after
enqueue. The claim path filters expired rows; `queue.sweep_expired()`
moves them into `_honker_dead`.
"""
import time
import honker
def test_expired_job_not_claimable(db_path):
db = honker.open(db_path)
q = db.q... |
russellromney/honker | https://github.com/russellromney/honker | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/test_task_locking.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:32.892107 | """Tests for db.lock() / honker.LockHeld.
Named advisory locks backed by the `_honker_locks` table. Main use
case: cron-like tasks that shouldn't overlap with themselves.
"""
import time
import pytest
import honker
def test_lock_acquire_and_release(db_path):
db = honker.open(db_path)
with db.lock("backup... |
russellromney/honker | https://github.com/russellromney/honker | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/test_tasks.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:32.893992 | """Task decorator + worker loop tests.
Covers the Huey-style `@queue.task()` + `@queue.periodic_task()` API:
envelope round-trip, result storage, retry/timeout/fail paths,
worker dispatch of unknown tasks, and the `db.run_workers()` helper.
"""
import asyncio
import pytest
import honker
# The registry is process-... |
russellromney/honker | https://github.com/russellromney/honker | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/test_time_triggers_e2e.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:32.910480 | """Deployment-shaped end-to-end tests for time-triggered work.
These tests exercise the realistic user shape:
* one process registers schedules / seeds delayed jobs,
* one long-running scheduler process enqueues due scheduled jobs,
* one long-running worker process drains the queue with a large
`idle_poll_s`... |
russellromney/honker | https://github.com/russellromney/honker | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/test_stream.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:32.918775 | """Tests for honker.stream."""
import asyncio
import pytest
import honker
def test_publish_and_read_back(db_path):
db = honker.open(db_path)
s = db.stream("events")
s.publish({"a": 1})
s.publish({"a": 2}, key="k")
rows = db.query(
"SELECT offset, topic, key, payload FROM _honker_stream ... |
russellromney/honker | https://github.com/russellromney/honker | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/test_watcher_backends.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:32.941249 | """Cross-language proof for the experimental watcher backends.
These tests prove that the optional kernel-watcher and shm-fast-path
backends behave the same as the default polling backend on the public
Python wake/listen surface. They run against the real Python binding
(the maturin-built `_honker_native` cdylib), not... |
russellromney/honker | https://github.com/russellromney/honker | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/test_task_results.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:32.941891 | """Tests for task result storage: save / get / wait / sweep.
Paired with extension interop tests (`test_extension_interop.py`) that
verify `honker_result_save` / `honker_result_get` / `honker_result_sweep` operate
on the same `_honker_results` table and produce the same behavior.
"""
import asyncio
import time
impor... |
Cartucho/OpenLabeling | https://github.com/Cartucho/OpenLabeling | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | object_detection/tf_object_detection.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:35.285551 | import numpy as np
import tensorflow as tf
class ObjectDetector(object):
def __init__(self, graph_path, score_threshold, objIds):
self.detection_graph = self._load_graph(graph_path)
self.input_tensor, self.tensor_dict = self._get_input_output_tensors(self.detection_graph)
self.sess = tf.Se... |
Cartucho/OpenLabeling | https://github.com/Cartucho/OpenLabeling | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | main/dasiamrpn.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:35.330010 | """
Author : Will Stone
Date : 190407
Desc : Wrapper class for the DaSiamRPN tracking method. This class has the
methods required to interface with the tracking class implemented
in main.py within the OpenLabeling package.
"""
import torch
import numpy as np
import sys
from os.path import realpath... |
Cartucho/OpenLabeling | https://github.com/Cartucho/OpenLabeling | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | main/main.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:35.341523 | #!/bin/python
import argparse
import glob
import json
import os
import re
import cv2
import numpy as np
from tqdm import tqdm
from lxml import etree
import xml.etree.cElementTree as ET
DELAY = 20 # keyboard delay (in milliseconds)
WITH_QT = False
try:
cv2.namedWindow('Test')
cv2.displayOverlay('Test', 'Test... |
Cartucho/OpenLabeling | https://github.com/Cartucho/OpenLabeling | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | main/main_auto.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:35.435265 | '''
\Description Using object detection and tracker to automatically label data
\Brief Algorithm
Step 1. Using Object Detection to find objects in the current frame
1.1 If do not detect any object in the frame, then skip this frame and GO BACK TO STEP 1 with next frame
1.2 If there is any found object ... |
Cartucho/OpenLabeling | https://github.com/Cartucho/OpenLabeling | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | object_detection/utils.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:35.541084 | def format_results(boxes, scores, image_id, cat_id):
results = []
for box, score in zip(boxes, scores):
r = {
"image_id": image_id,
"category_id": cat_id,
"bbox": [float(i) for i in box],
"score": float(score),
}
results.append(r)
retur... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | GCL/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:38.541032 | import GCL.losses
import GCL.augmentors
import GCL.eval
import GCL.models
import GCL.utils
__version__ = '0.1.2'
__all__ = [
'__version__',
'losses',
'augmentors',
'eval',
'models',
'utils'
]
|
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | GCL/augmentors/edge_adding.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:38.542056 | from __future__ import annotations
from GCL.augmentors.augmentor import PyGGraph, Augmentor
from GCL.augmentors.functional import add_edge
class EdgeAdding(Augmentor):
"""Augment the graph by adding edges."""
def __init__(self, pe: float):
"""
Args:
pe: Probability of adding an e... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | GCL/augmentors/edge_attr_masking.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:38.543147 | from __future__ import annotations
from GCL.augmentors.augmentor import PyGGraph, Augmentor
from GCL.augmentors.functional import drop_feature
class EdgeAttrMasking(Augmentor):
def __init__(self, pf: float):
"""
This augmentor masks the edge attributes with probability pf.
Args:
... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | GCL/augmentors/feature_dropout.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:38.544351 | from __future__ import annotations
from GCL.augmentors.augmentor import PyGGraph, Augmentor
from GCL.augmentors.functional import dropout_feature
class FeatureDropout(Augmentor):
def __init__(self, pf: float):
"""
This augmentor drops out feature dimensions of the graph with probability pf.
... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | GCL/augmentors/edge_removing.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:38.554495 | from __future__ import annotations
from GCL.augmentors.augmentor import PyGGraph, Augmentor
from GCL.augmentors.functional import dropout_adj
class EdgeRemoving(Augmentor):
def __init__(self, pe: float):
"""This augmentor removes edges from the graph.
Args:
pe (float): Probability of... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | GCL/augmentors/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:38.556219 | from .augmentor import Augmentor, Compose, RandomChoice, PyGAugmentor, DGLAugmentor
from .identity import Identity
from .rw_sampling import RWSampling
from .ppr_diffusion import PPRDiffusion
from .markov_diffusion import MarkovDiffusion
from .edge_adding import EdgeAdding
from .edge_removing import EdgeRemoving
from .n... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | GCL/augmentors/augmentor.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:38.557620 | """Augmentors"""
from __future__ import annotations
import torch
from abc import ABC, abstractmethod
from typing import Union, List, Callable, TYPE_CHECKING
from torch_geometric.data import Data as PyGGraph
if TYPE_CHECKING:
from dgl import DGLGraph
def _is_dgl_graph(g) -> bool:
"""Check if g is a DGLGraph ... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | GCL/augmentors/feature_masking.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:38.558699 | from __future__ import annotations
from GCL.augmentors.augmentor import PyGGraph, Augmentor
from GCL.augmentors.functional import drop_feature
class FeatureMasking(Augmentor):
def __init__(self, pf: float):
"""
Masks features with probability pf.
Args:
pf: probability of featu... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | GCL/augmentors/adaptive_feature_masking.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:38.579792 | from __future__ import annotations
from typing import Callable, Union
import torch
from GCL.augmentors.augmentor import PyGGraph, Augmentor
from GCL.augmentors.functional import get_feature_weights, drop_edge_by_weight, drop_feature_by_weight
from functools import lru_cache
class AdaptiveFeatureMasking(Augmentor):
... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | GCL/augmentors/adaptive_edge_removing.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:38.580326 | from __future__ import annotations
from typing import Callable, Union
import torch
from GCL.augmentors.augmentor import PyGGraph, Augmentor
from GCL.augmentors.functional import get_feature_weights, drop_edge_by_weight, drop_feature_by_weight
import GCL.augmentors.functional as F_pyg
from functools import lru_cache
... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | GCL/augmentors/rw_sampling.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:39.184832 | from __future__ import annotations
from GCL.augmentors.augmentor import PyGGraph, Augmentor
from GCL.augmentors.functional import random_walk_subgraph
class RWSampling(Augmentor):
def __init__(self, num_seeds: int, walk_length: int):
"""
Random walk sampling.
Args:
num_seeds: ... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | GCL/augmentors/identity.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:39.202912 | from __future__ import annotations
from GCL.augmentors.augmentor import PyGGraph, Augmentor
class Identity(Augmentor):
def __init__(self):
"""
Identity augmentor.
"""
super(Identity, self).__init__()
def pyg_augment(self, g: PyGGraph):
return g
def dgl_augment(se... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | GCL/augmentors/node_shuffling.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:39.204399 | from __future__ import annotations
from GCL.augmentors.augmentor import PyGGraph, Augmentor
from GCL.augmentors.functional import permute
class NodeShuffling(Augmentor):
def __init__(self):
"""
Shuffle the nodes of the graph.
"""
super(NodeShuffling, self).__init__()
def pyg_... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | GCL/augmentors/node_dropping.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:39.205244 | from __future__ import annotations
from GCL.augmentors.augmentor import PyGGraph, Augmentor
from GCL.augmentors.functional import drop_node
class NodeDropping(Augmentor):
def __init__(self, pn: float):
"""
This augmentor drops nodes from the graph with probability pn.
Args:
pn... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | GCL/augmentors/functional_dgl.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:39.206242 | """DGL utilities for graph augmentations."""
import math
import torch
def _import_dgl():
try:
import dgl
return dgl
except ImportError:
raise ImportError(
"DGL is required for DGL graph augmentations. "
"Install it with: pip install dgl"
)
def add_edge... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | GCL/augmentors/functional.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:39.214885 | """PyTorch utilities for graph augmentation functions."""
import torch
import networkx as nx
import torch.nn.functional as F
from typing import Optional, Tuple
from GCL.utils import normalize
from torch_geometric.utils import coalesce, scatter
from torch_geometric.transforms import GDC
from torch.distributions import ... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | GCL/eval/eval.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:39.216577 | import torch
import numpy as np
import pandas as pd
from tqdm import tqdm
from typing import Union, Callable, List, Dict, Optional, Type
from operator import itemgetter
from torch.optim import Optimizer
from sklearn.base import BaseEstimator
from sklearn.model_selection import GridSearchCV, BaseCrossValidator
from GC... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | GCL/augmentors/markov_diffusion.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:39.240798 | from __future__ import annotations
from GCL.augmentors.augmentor import PyGGraph, Augmentor
from GCL.augmentors.functional import compute_markov_diffusion
class MarkovDiffusion(Augmentor):
def __init__(self, alpha: float = 0.05, order: int = 16, sp_eps: float = 1e-4, use_cache: bool = True,
add_... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | GCL/augmentors/ppr_diffusion.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:39.241996 | from __future__ import annotations
from GCL.augmentors.augmentor import PyGGraph, Augmentor
from GCL.augmentors.functional import compute_ppr
class PPRDiffusion(Augmentor):
def __init__(self, alpha: float = 0.2, eps: float = 1e-4, use_cache: bool = True, add_self_loop: bool = True):
"""
Run PPR d... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | GCL/eval/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:39.243130 | from .eval import BaseTrainableEvaluator, BaseSKLearnEvaluator
from .split import random_split, from_PyG_split
from .svm import SVMEvaluator
from .logistic_regression import LRTrainableEvaluator, LRSklearnEvaluator
from .random_forest import RFEvaluator
__all__ = [
'BaseTrainableEvaluator',
'BaseSKLearnEvaluat... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | GCL/losses/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:40.348942 | from .jsd import JSD, DebiasedJSD, HardnessJSD
from .vicreg import VICReg
from .infonce import InfoNCE, DebiasedInfoNCE, HardnessInfoNCE, ReweightedInfoNCE, RobustInfoNCE
from .triplet import TripletMargin
from .bootstrap import BootstrapLatent
from .barlow_twins import BarlowTwins
from .loss import Loss, ContrastInsta... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | GCL/losses/loss.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:40.350426 | import torch
from abc import ABC, abstractmethod
from typing import Optional
from dataclasses import dataclass
@dataclass
class ContrastInstance:
anchor: torch.Tensor
sample: torch.Tensor
pos_mask: Optional[torch.Tensor] = None
neg_mask: Optional[torch.Tensor] = None
def unpack(self):
re... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | GCL/losses/jsd.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:40.352728 | import numpy as np
import torch
import torch.nn.functional as F
from .loss import Loss
class JSD(Loss):
def __init__(self, discriminator=lambda x, y: x @ y.t()):
super(JSD, self).__init__()
self.discriminator = discriminator
def compute(self, contrast_instance, *args, **kwargs):
anch... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | GCL/losses/bootstrap.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:40.353684 | import torch
import torch.nn.functional as F
from .loss import Loss, ContrastInstance
class BootstrapLatent(Loss):
def __init__(self):
super(BootstrapLatent, self).__init__()
def compute(self, contrast_instance: ContrastInstance, *args, **kwargs) -> torch.FloatTensor:
anchor, sample, pos_mas... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | GCL/eval/split.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:40.354861 | import torch
import numpy as np
from typing import List, Dict, Union, Iterator
from torch_geometric.data import Data
from sklearn.model_selection import BaseCrossValidator
def random_split(
num_samples: int, num_splits: int = 1,
train_ratio: float = 0.1, test_ratio: float = 0.8) -> List[Dict]:
""... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | GCL/eval/svm.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:40.355733 | from typing import Callable, Optional, Dict
from sklearn.svm import LinearSVC, SVC
from sklearn.model_selection import BaseCrossValidator
from GCL.eval import BaseSKLearnEvaluator
class SVMEvaluator(BaseSKLearnEvaluator):
"""
Evaluate using the sklearn SVM classifier.
Parameters:
metrics (Dict[s... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | GCL/eval/random_forest.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:40.357267 | from typing import Callable, Optional, Dict
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import BaseCrossValidator
from GCL.eval import BaseSKLearnEvaluator
class RFEvaluator(BaseSKLearnEvaluator):
"""
Evaluate using the sklearn random forest classifier.
Parameters:
... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | GCL/losses/infonce.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:40.358271 | import torch
import numpy as np
import torch.nn.functional as F
from .loss import Loss
def similarity(h1: torch.Tensor, h2: torch.Tensor):
h1 = F.normalize(h1)
h2 = F.normalize(h2)
return h1 @ h2.t()
def tensor_similarity(z1: torch.Tensor, z2: torch.Tensor):
z1 = F.normalize(z1, dim=-1) # [N, d]
... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | GCL/losses/barlow_twins.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:40.359520 | import torch
from .loss import Loss
class BarlowTwins(Loss):
def __init__(self, lambda_: float = None, batch_norm: bool = True, eps: float = 1e-5):
self.lambda_ = lambda_
self.batch_norm = batch_norm
self.eps = eps
def compute(self, contrast_instance, *args, **kwargs) -> torch.FloatT... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | GCL/eval/logistic_regression.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:40.940218 | import torch
from torch import nn
from typing import Union, List, Callable, Dict, Optional
from torch.optim import Adam
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import BaseCrossValidator
from GCL.eval import BaseTrainableEvaluator, BaseSKLearnEvaluator
class LRModel(nn.Module... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | docs/run_livereload.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:41.549525 | from livereload import Server, shell
if __name__ == '__main__':
server = Server()
server.watch('*.md', shell('make html'), delay=1)
server.watch('*.py', shell('make html'), delay=1)
server.watch('notes/*.md', shell('make html'), delay=1)
server.watch('modules/*.md', shell('make html'), delay=1)
... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | examples/BGRL_G2L.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:42.338702 | import copy
import torch
import os.path as osp
import GCL.losses as L
import GCL.augmentors as A
import torch.nn.functional as F
from tqdm import tqdm
from functools import partial
from torch.optim import Adam
from GCL.eval import SVMEvaluator
from GCL.models import BootstrapContrast
from sklearn.metrics import f1_sco... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | examples/BGRL_L2L.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:42.954275 | import copy
import torch
import os.path as osp
import GCL.losses as L
import GCL.augmentors as A
import torch.nn.functional as F
import torch_geometric.transforms as T
from tqdm import tqdm
from functools import partial
from torch.optim import Adam
from GCL.eval import LRTrainableEvaluator, from_PyG_split
from GCL.mod... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | examples/DGI_inductive.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:43.794689 | import torch
import os.path as osp
import GCL.losses as L
from tqdm import tqdm
from torch import nn
from torch.optim import Adam
from functools import partial
from GCL.eval import random_split, LRTrainableEvaluator
from GCL.models import SingleBranchContrast
from sklearn.metrics import f1_score
from torch_geometric.n... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | examples/DGI_transductive.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:45.220587 | import torch
import os.path as osp
import GCL.losses as L
import torch_geometric.transforms as T
from tqdm import tqdm
from torch import nn
from functools import partial
from torch.optim import Adam
from sklearn.metrics import f1_score
from GCL.eval import random_split, LRTrainableEvaluator
from GCL.models import Sing... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | examples/GBT.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:45.813787 | import torch
import os.path as osp
import GCL.losses as L
import GCL.augmentors as A
import torch_geometric.transforms as T
from tqdm import tqdm
from functools import partial
from torch.optim import Adam
from GCL.eval import from_PyG_split, LRTrainableEvaluator
from GCL.models.contrast_model import WithinEmbedContras... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | GCL/models/sampler.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:45.969535 | import torch
from abc import ABC, abstractmethod
from torch_geometric.utils import scatter
from GCL.losses import ContrastInstance
def compute_supervised_masks(data):
# compute extra pos and neg masks for semi-supervised learning
device = data.y.device
extra_pos_mask = torch.eq(data.y, data.y.unsqueeze(d... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | GCL/utils/convert.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:45.996083 | from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from dgl import DGLGraph
from torch_geometric.data import Data as PyGGraph
def from_dglgraph_to_pyggraph(pyggraph: 'PyGGraph') -> 'DGLGraph':
raise NotImplementedError
def from_pyggraph_to_dglgraph(dglgraph: 'DGLGrap... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | docs/conf.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:45.996593 | import GCL
import datetime
import sphinx_rtd_theme
project = 'PyGCL'
author = 'Yanqiao Zhu'
copyright = '{}, {}'.format(datetime.datetime.now().year, author)
version = GCL.__version__
release = GCL.__version__
extensions = [
'myst_parser',
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.d... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | GCL/models/contrast_model.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:46.002403 | import torch
from typing import Optional, Union
from GCL.losses import Loss
from GCL.models import get_dense_sampler
from GCL.models.sampler import DenseSampler, DefaultSampler, ContrastInstance
class SingleBranchContrast(torch.nn.Module):
def __init__(self, loss: Loss, mode: str, intraview_negs: bool = False, ... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | GCL/losses/triplet.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:46.012291 | import torch
from .loss import Loss, ContrastInstance
class TripletMargin(Loss):
def __init__(self, margin: float = 1.0, p: float = 2):
super(TripletMargin, self).__init__()
self.loss_fn = torch.nn.TripletMarginLoss(margin=margin, p=p, reduction='none')
self.margin = margin
def compu... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | GCL/utils/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:46.013241 | from .utils import split_dataset, seed_everything, normalize, batchify_dict, sinkhorn
try:
from .convert import from_pyggraph_to_dglgraph, from_dglgraph_to_pyggraph
except ImportError:
pass
__all__ = [
'split_dataset',
'seed_everything',
'normalize',
'batchify_dict',
'from_pyggraph_to_dglg... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | GCL/losses/vicreg.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:46.013705 | import torch
import torch.nn.functional as F
from .loss import Loss
class VICReg(Loss):
def __init__(self, sim_weight=25.0, var_weight=25.0, cov_weight=1.0, eps=1e-4):
super(VICReg, self).__init__()
self.sim_weight = sim_weight
self.var_weight = var_weight
self.cov_weight = cov_we... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | GCL/models/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:46.041460 | from .sampler import SameScaleDenseSampler, CrossScaleDenseSampler, get_dense_sampler, compute_supervised_masks
from .contrast_model import SingleBranchContrast, DualBranchContrast, WithinEmbedContrast, BootstrapContrast
__all__ = [
'SingleBranchContrast',
'DualBranchContrast',
'WithinEmbedContrast',
... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | GCL/utils/utils.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:46.101031 | from typing import *
import os
import torch
import random
import numpy as np
def split_dataset(dataset, split_mode, *args, **kwargs):
assert split_mode in ['rand', 'ogb', 'wikics', 'preload']
if split_mode == 'rand':
assert 'train_ratio' in kwargs and 'test_ratio' in kwargs
train_ratio = kwarg... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | examples/GCA.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:46.377449 | import torch
import os.path as osp
import GCL.losses as L
import GCL.augmentors as A
import torch.nn.functional as F
import torch_geometric.transforms as T
from tqdm import tqdm
from functools import partial
from torch.optim import Adam
from GCL.eval import random_split, LRTrainableEvaluator
from GCL.models import Dua... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | examples/GRACE_SupCon.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:46.556987 | import torch
import os.path as osp
import GCL.losses as L
import GCL.augmentors as A
import torch.nn.functional as F
import torch_geometric.transforms as T
from tqdm import tqdm
from functools import partial
from torch.optim import Adam
from GCL.eval import from_PyG_split, LRTrainableEvaluator
from GCL.models import D... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | examples/GRACE.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:46.567529 | import torch
import os.path as osp
import GCL.losses as L
import GCL.augmentors as A
import torch.nn.functional as F
import torch_geometric.transforms as T
from tqdm import tqdm
from functools import partial
from torch.optim import Adam
from GCL.eval import random_split, LRTrainableEvaluator
from GCL.models import Dua... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | examples/GraphCL.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:46.568182 | import torch
import os.path as osp
import GCL.losses as L
import GCL.augmentors as A
import torch.nn.functional as F
from tqdm import tqdm
from torch import nn
from functools import partial
from torch.optim import Adam
from GCL.eval import SVMEvaluator
from GCL.models import DualBranchContrast
from sklearn.metrics imp... |
PyGCL/PyGCL | https://github.com/PyGCL/PyGCL | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | examples/InfoGraph.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:46.654757 | import torch
import os.path as osp
import GCL.losses as L
from tqdm import tqdm
from torch import nn
from functools import partial
from torch.optim import Adam
from GCL.eval import SVMEvaluator
from GCL.models import SingleBranchContrast
from torch_geometric.nn import GINConv, global_add_pool
from torch_geometric.load... |
aio-libs/janus | https://github.com/aio-libs/janus | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/test_async.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:48.974766 | """Tests for queues.py"""
import asyncio
import time
import re
import pytest
import janus
async def close(_q):
for i in range(5):
time.sleep(0.001)
if not _q._sync_mutex.locked():
break
else:
assert not _q._sync_mutex.locked()
await _q.aclose()
assert _q.closed
... |
aio-libs/janus | https://github.com/aio-libs/janus | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | janus/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:48.975421 | import asyncio
import sys
import threading
from asyncio import QueueEmpty as AsyncQueueEmpty
from asyncio import QueueFull as AsyncQueueFull
from collections import deque
from heapq import heappop, heappush
from queue import Empty as SyncQueueEmpty
from queue import Full as SyncQueueFull
from time import monotonic
from... |
aio-libs/janus | https://github.com/aio-libs/janus | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/test_mixed.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:48.979252 | import asyncio
import sys
from concurrent.futures import ThreadPoolExecutor
import pytest
import janus
class TestMixedMode:
@pytest.mark.skipif(
sys.version_info >= (3, 10),
reason="Python 3.10+ supports delayed initialization",
)
def test_ctor_noloop(self):
with pytest.raises(R... |
aio-libs/janus | https://github.com/aio-libs/janus | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/test_benchmarks.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:49.029597 | import asyncio
import sys
import janus
if sys.version_info >= (3, 11):
from asyncio import Runner
else:
from backports.asyncio.runner import Runner
def test_bench_sync_put_async_get(benchmark):
q: janus.Queue
async def init():
nonlocal q
q = janus.Queue()
def threaded():
... |
aio-libs/janus | https://github.com/aio-libs/janus | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | tests/test_sync.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:49.030186 | # Some simple queue module tests, plus some failure conditions
# to ensure the Queue locks remain stable.
import asyncio
import queue
import re
import sys
import threading
import time
from unittest.mock import patch
import pytest
import janus
QUEUE_SIZE = 5
def qfull(q):
return q._parent._maxsize > 0 and q.qsi... |
greyhaven-ai/autocontext | https://github.com/greyhaven-ai/autocontext | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | autocontext/smoke_test.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:54.696078 | """End-to-end smoke test — exercises the full autocontext Phase A stack with a real provider.
Tests:
1. AnthropicProvider.complete() — real API call
2. LLMJudge.evaluate() — real scoring with structured output parsing
3. TaskRunner.run_once() — queue → dequeue → generate → judge → store result
4. Notifications — Callb... |
greyhaven-ai/autocontext | https://github.com/greyhaven-ai/autocontext | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | autocontext/smoke_test_loop.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:54.720648 | """E2E smoke test: ImprovementLoop with real API calls.
Tests the full generate→judge→revise→judge cycle to verify:
1. Score improves across rounds
2. Revision incorporates judge feedback
3. Loop terminates at threshold or max rounds
4. ImprovementResult is well-formed
"""
import sys
from pathlib import Path
sys.pat... |
greyhaven-ai/autocontext | https://github.com/greyhaven-ai/autocontext | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | autocontext/scripts/check_python_no_telemetry.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:54.722399 | #!/usr/bin/env python3
"""
check_python_no_telemetry.py — Enterprise discipline check.
Greps the autocontext source (production_traces + integrations.openai subtrees)
and the openai SDK dist (if installed) for patterns that would indicate
phone-home / analytics network calls beyond the expected openai API endpoints.
... |
greyhaven-ai/autocontext | https://github.com/greyhaven-ai/autocontext | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | autocontext/scripts/check_python_reproducible_wheel.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:54.724255 | #!/usr/bin/env python3
"""
check_python_reproducible_wheel.py — Enterprise discipline check.
Builds the wheel twice with `uv build --wheel` and compares the SHA-256
hashes of the resulting .whl files to assert byte-identical output
(reproducible build).
Exits 0 on success (hashes match or tool unavailable).
Exits 1 i... |
greyhaven-ai/autocontext | https://github.com/greyhaven-ai/autocontext | null | null | null | null | 960 | null | null | apache-2.0 | null | null | null | null | null | null | null | autocontext/scripts/check_no_python_postinstall.py | null | null | null | null | null | null | Python | 2026-05-04T02:38:54.724973 | #!/usr/bin/env python3
"""
check_no_python_postinstall.py — Enterprise discipline check.
Parses pyproject.toml and asserts that no install-time hook scripts are
declared that would execute automatically during `pip install` / `uv sync`.
Checks:
- [project.scripts] entries must not point to installer-hook patterns.
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.