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 |
|---|---|---|---|---|---|---|
from __future__ import annotations
from aio_ld2410.protocol import CommandFrame
from aio_ld2410.stream import FrameStream
class TestFrameStream:
def test_with_only_garbage(self):
"""Push garbage and check that we have no frame."""
stream = FrameStream(b'This is garbage data')
count = len(... | morian/aio-ld2410 | tests/test_stream.py | .py | 2fc15cfe1d822784 | 7.95 | 7 |
import argparse
import hashlib
import logging
import os
import tarfile
import requests
from tqdm import tqdm
# Setup logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger("Houdini Downloader")
def download_file(url: str, path: str):
"""Download a file with a progress bar."""
logger.info(f... | Bismuth-Consultancy-BV/HoudiniOnAWS | infra/docker/houdini/install_files/download_houdini.py | .py | b313b3a2f1fa8610 | 7.54 | 11 |
import json
import logging
import subprocess
import boto3
import requests
from botocore.exceptions import ClientError
logger = logging.getLogger(__name__)
def get_aws_user_id() -> str:
"""Gets the AWS user ID. It will grab whatever is configured using aws configure."""
result = subprocess.run(
["aws... | Bismuth-Consultancy-BV/HoudiniOnAWS | infra/utils/aws_utils.py | .py | 819f8e00558b65ff | 7.54 | 11 |
import os
import ctypes
import sys
import shutil
import contextlib
def require_admin() -> None:
"""Ensure the script is running with administrator privileges."""
try:
is_admin = os.getuid() == 0 # Linux/macOS
except AttributeError:
try:
is_admin = ctypes.windll.shell32.IsUserA... | Bismuth-Consultancy-BV/HoudiniOnAWS | infra/utils/misc_utils.py | .py | bfa78deac0c932c2 | 7.54 | 11 |
from typing import Dict
import subprocess
import os
def check_packer_installed() -> None:
"""Check if Packer is installed."""
try:
subprocess.run(
["packer", "-v"],
check=True,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
)
except Fi... | Bismuth-Consultancy-BV/HoudiniOnAWS | infra/utils/packer_utils.py | .py | 222b915a52b5f9e3 | 7.54 | 11 |
import requests
from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry
import sesiweb.webapi
from sesiweb import SesiWeb
from sesiweb.model.service import ProductBuild
from .aws_utils import get_aws_secrets
def _create_compatible_session() -> requests.Session:
"""Create a requests sessio... | Bismuth-Consultancy-BV/HoudiniOnAWS | infra/utils/sesiweb_utils.py | .py | e8cbc2042b8043db | 7.54 | 11 |
import json
import subprocess
from typing import Dict
def check_terraform_installed() -> None:
"""Check if Terraform is installed."""
try:
subprocess.run(
["terraform", "-version"],
check=True,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
... | Bismuth-Consultancy-BV/HoudiniOnAWS | infra/utils/terraform_utils.py | .py | b6d6fc55cf673420 | 7.54 | 11 |
import logging
import os
import platform
import subprocess
import time
from typing import Dict, List, Optional
logger = logging.getLogger(__name__)
# ── Linux GPU / display mounts required for headless Houdini (Vulkan) ──
_LINUX_VOLUME_MOUNTS: List[str] = [
"/tmp/.X11-unix:/tmp/.X11-unix",
"/run/user/1000:/ru... | Bismuth-Consultancy-BV/HoudiniOnAWS | runtime/batch/docker_utils.py | .py | 9cddd35fd1263b27 | 7.54 | 11 |
import dataclasses
import json
import os
import typing
import argparse
import hou
@dataclasses.dataclass
class HoudiniNodeError:
"""Dataclass to hold Houdini node error information."""
node_path: str
error_message: str
def get_errors(node: hou.node) -> typing.List[HoudiniNodeError]:
"""Retrieve er... | Bismuth-Consultancy-BV/HoudiniOnAWS | runtime/batch/processing.py | .py | cd8620c9aff5de67 | 7.54 | 11 |
"""Child-process worker for one backend and one canonical workload."""
from __future__ import annotations
import argparse
import json
import platform
import sys
import time
from collections.abc import Sequence
from pathlib import Path
from typing import TypedDict, cast
import numpy as np
import pymab
from benchmark... | danielaLopes/pymab | benchmarks/worker.py | .py | a57f668efdffd342 | 7.45 | 7 |
from boto3 import client
def get_dynamo_db_table():
"""
ARN and name of DynamoDB table
"""
dynamodb_client = client("dynamodb")
tables = dynamodb_client.list_tables()["TableNames"]
table = [t for t in tables if "CA" in t]
return table[0]
def delete_dynamo_db_table_items(table):
""... | serverless-ca/cloud-ca | scripts/delete_db_table_items.py | .py | 3f39c34b32abf44a | 7.59 | 14 |
import boto3
def kms_generate_key_pair(key_id, key_pair_spec="ECC_NIST_P256"):
client = boto3.client(service_name="kms")
return client.generate_data_key_pair(
KeyId=key_id,
KeyPairSpec=key_pair_spec,
)
def kms_get_kms_key_id(alias):
"""returns the KMS Key ARN for a specified alias""... | serverless-ca/cloud-ca | utils/modules/certs/kms.py | .py | fe7af3e013ff59e6 | 7.59 | 14 |
from metrics import *
def range_logAUC(true_y, predicted_score, FPR_range=(0.001, 0.1)):
"""
Author: Yunchao "Lance" Liu (lanceknight26@gmail.com)
Calculate logAUC in a certain FPR range (default range: [0.001, 0.1]).
This was used by previous methods [1] and the reason is that only a
small ... | justinwjl/GTB-DTI | evaluater.py | .py | e6cc7c9f2cc335e6 | 7.56 | 12 |
from collections import defaultdict
import scipy.sparse as sp
import numpy as np
import torch
from torch_geometric.data import Data
from rdkit import Chem
import os
from utils import dump_dictionary
from featurize.base import normalize_smile, pad_or_truncate
from tqdm import tqdm
class CPI_featurize:
def __init__... | justinwjl/GTB-DTI | featurize/CPI_feat.py | .py | bf6c3fb688d3163f | 7.56 | 12 |
import numpy as np
from featurize.base import str2int
import torch
import pandas as pd
from torch_geometric.data.data import Data
import os
import torch.utils.data as data
from functools import partial
from dgllife.utils import smiles_to_bigraph, CanonicalAtomFeaturizer, CanonicalBondFeaturizer
import random
import log... | justinwjl/GTB-DTI | featurize/DrugBAN_feat.py | .py | 169a4eef4b5944ed | 7.56 | 12 |
import warnings
warnings.filterwarnings("ignore")
import numpy as np
from rdkit import Chem
import pandas as pd
def read_data(filename):
df = pd.read_csv('data/' + filename)
drugs, prots, Y = list(df['compound_iso_smiles']), list(df['target_sequence']), list(df['affinity'])
return drugs, prots, Y
def s... | justinwjl/GTB-DTI | featurize/base.py | .py | 646b8abc31966666 | 7.56 | 12 |
"""
Provide menu or control the flow
"""
import warnings
warnings.filterwarnings("ignore")
from utils import load_config
import numpy as np
import logging
import os
import random
import torch
import torch_geometric
from train import Trainer
import argparse
import time
def set_seed(seed):
# Set random seed to en... | justinwjl/GTB-DTI | main.py | .py | 882b9260508f5aab | 7.56 | 12 |
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 27 14:18:27 2020
@author: shuyu
"""
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import pickle
class GanDTI(nn.Module):
def __init__(self, n_output, features, GNN_depth, MLP_depth, dropout, **config):
super(GanDTI, sel... | justinwjl/GTB-DTI | models/GANDTI.py | .py | 91418ab57bb1678a | 7.56 | 12 |
import torch
import torch.nn as nn
import torch.nn.functional as F
from collections import OrderedDict
from torch.nn.modules.batchnorm import _BatchNorm
import torch_geometric.nn as gnn
from torch import Tensor
from torch_geometric.utils import to_dense_batch
from test_model.MGIN import GraphDenseGinNet
from test_model... | justinwjl/GTB-DTI | models/MATDTI.py | .py | e306469e24035e0a | 7.56 | 12 |
"""Access SNOTEL and CCSS automatic weather station data.
Data are hosted on the companion repository
`egagli/snotel_ccss_stations <https://github.com/egagli/snotel_ccss_stations>`_
and retrieved as individual CSV files or as a single compressed archive.
References
----------
- SNOTEL: https://www.nrcs.usda.gov/wps/p... | egagli/easysnowdata | easysnowdata/automatic_weather_stations.py | .py | 8551551e286ad2c0 | 7.6 | 15 |
"""Access digital elevation models and topographic indices.
Currently supported datasets:
* **Copernicus DEM** (30 m / 90 m) via Microsoft Planetary Computer
* **CHILI** — Continuous Heat-Insolation Load Index via Google Earth Engine
"""
from __future__ import annotations
import logging
import ee
import geopandas ... | egagli/easysnowdata | easysnowdata/topography.py | .py | 5115516e98c662c3 | 7.6 | 15 |
"""Update the data-source status table in README.md from history.json.
Usage
-----
python scripts/update_readme_status.py \\
[--history data_status/history.json] \\
[--readme README.md]
The script reads the last 4 weekly snapshots from *history.json* and
replaces the content between the sentinel c... | egagli/easysnowdata | scripts/update_readme_status.py | .py | 9030c60275158f3a | 7.6 | 15 |
"""Shared fixtures and skip-markers for easysnowdata tests."""
from __future__ import annotations
import os
import geopandas as gpd
import pytest
import shapely
# Small bbox for testing — Mount Rainier, WA (covers SNOTEL, snow products, etc.)
TEST_BBOX = (-121.94, 46.72, -121.54, 46.99)
def pytest_configure(confi... | egagli/easysnowdata | tests/conftest.py | .py | 15e503b8fb36577d | 8.1 | 15 |
"""Tests for Earth Engine credential handling via ``EARTHENGINE_TOKEN``.
The token may be a service-account key JSON or the ``~/.config/earthengine``
OAuth JSON, raw or base64-encoded. Parsing tests need no network; the
``TestEarthEngine`` tests need a real token and are skipped without one.
"""
from __future__ impor... | egagli/easysnowdata | tests/test_credentials.py | .py | 11db8dd1975c919c | 8.1 | 15 |
"""Tests for easysnowdata.topography.
Copernicus DEM uses Planetary Computer (anonymous access, no credentials required).
CHILI uses Google Earth Engine (requires EARTHENGINE_TOKEN).
"""
from __future__ import annotations
import pytest
import xarray as xr
TEST_BBOX = (-121.94, 46.72, -121.54, 46.99)
class TestCop... | egagli/easysnowdata | tests/test_topography.py | .py | e8c2bb7de96f1550 | 7.1 | 15 |
import logging
import argparse
from github.GithubException import GithubException
from populate_discussion_helpers import RateLimiter, GitHubAuthManager, GraphQLHelper
from typing import Dict, List, Any
# Get logger for this module
logger = logging.getLogger(__name__)
def setup_logging():
root_logger = logging.... | bcgov/developer-experience-team | utils/stackoverflow/delete_all_labels.py | .py | 849d45f893e82cbf | 7.5 | 9 |
#!/usr/bin/env python3
"""
Delete GitHub Discussions based on Stack Overflow question IDs.
This script reads a list of SO question IDs, finds the corresponding questions in the
questions_answers_comments.json file, looks up the GitHub discussions by title,
and deletes them along with all associated comments.
"""
imp... | bcgov/developer-experience-team | utils/stackoverflow/delete_discussions.py | .py | 0b2d65f169c3ddac | 7.5 | 9 |
#!/usr/bin/env python3
"""
Extract specific questions from questions_answers_comments.json by question_id.
Useful for re-processing questions that failed during populate_discussion.py runs.
"""
import json
import argparse
import sys
from typing import List, Dict, Any, Set
from pathlib import Path
def load_question_id... | bcgov/developer-experience-team | utils/stackoverflow/extract_questions.py | .py | e7c90508ab43e94c | 7.5 | 9 |
import argparse
import logging
from typing import Dict
import os
import sys
logger = logging.getLogger(__name__)
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
class MergeFiles:
"""Class to handle merging of two so2ghd log files."""
def __init__(self, base_file: str, patch_file: str, new_file... | bcgov/developer-experience-team | utils/stackoverflow/merge_so2ghd_files.py | .py | 52d99467b9bed88f | 7.5 | 9 |
"""
Helper classes and functions for Stack Overflow to GitHub Discussions migration.
"""
import os
import logging
import time
from github import Github, Auth
import requests
from typing import Optional
# Setup logging
logger = logging.getLogger(__name__)
class RateLimiter:
"""Manages API rate limiting with confi... | bcgov/developer-experience-team | utils/stackoverflow/populate_discussion_helpers.py | .py | 310f7873158fc5c0 | 7.5 | 9 |
import unittest
import unittest.mock
from unittest.mock import mock_open, patch, MagicMock
from merge_so2ghd_files import MergeFiles, main
class TestMergeFiles(unittest.TestCase):
"""Unit tests for the MergeFiles class."""
def setUp(self):
"""Set up test fixtures."""
self.base_file = "base_te... | bcgov/developer-experience-team | utils/stackoverflow/test_merge_so2ghd_files.py | .py | 4ac2bc9ca40e5ad2 | 8 | 9 |
#!/usr/bin/env python3
# coding: utf-8
import os
import argparse
import subprocess
from pathlib import Path
from bs4 import BeautifulSoup
from lxml import etree
def extract_content_from_hugohtml(input_file: Path):
"""Extract <div class="td-content"> from a Hugo-generated HTML file."""
with input_file.open("r"... | axoflow/axosyslog-core-docs | scripts/create-man-from-html.py | .py | cd2f9e378af91d3b | 7.52 | 10 |
from __future__ import annotations
import os
import shutil
import subprocess
import sys
import threading
import urllib.request
from devservices.utils.console import Console
GITHUB_API_ACCEPT = "application/vnd.github+json"
_auth_warning_lock = threading.Lock()
_auth_warned = False
def parse_repo_path(repo_link: s... | getsentry/devservices | devservices/utils/github.py | .py | eb9059f2248ab503 | 7.54 | 11 |
from __future__ import annotations
import configparser
import http.client
import os
import socket
import subprocess
import time
import xmlrpc.client
from enum import IntEnum
from typing import TypedDict
import yaml
from sentry_sdk import capture_exception
from supervisor.options import ServerOptions
from devservices... | getsentry/devservices | devservices/utils/supervisor.py | .py | 66e2c3ad373d6f73 | 7.54 | 11 |
from __future__ import annotations
import pytest
from devservices.utils.state import State
@pytest.fixture(autouse=True)
def clear_singleton_instance() -> None:
State._instance = None
@pytest.fixture(autouse=True)
def deterministic_github_auth(
request: pytest.FixtureRequest, monkeypatch: pytest.MonkeyPat... | getsentry/devservices | tests/conftest.py | .py | d17a6aaafbfbe217 | 8.04 | 11 |
"""Tests for AudioClassifier with AST (Audio Spectrogram Transformer) backend.
Covers only what runs on a GitHub runner: construction and the pure event-merging
logic. Anything needing the AST weights is verified by the real-model harness
instead (see CLAUDE.md), not by a test that downloads a model.
"""
import pytes... | BartWojtowicz/videopython | src/tests/ai/test_audio_classifier.py | .py | 1ebd6ba4e959e725 | 8.14 | 18 |
"""Tests for TextToVideo / ImageToVideo (Wan2.2), with the diffusers pipeline mocked."""
from unittest.mock import MagicMock, patch
import numpy as np
import pytest
from PIL import Image
from videopython.ai.generation.video import ImageToVideo, TextToVideo
_T2V_SHA = "5be7df9619b54f4e2667b2755bc6a756675b5cd7"
_I2V_... | BartWojtowicz/videopython | src/tests/ai/test_generation_video.py | .py | e057991101790264 | 7.14 | 18 |
"""Tests for the ObjectDetector understanding primitive (mocked D-FINE)."""
from unittest.mock import MagicMock
import numpy as np
import pytest
from videopython.ai.understanding.objects import ObjectDetector
def _result(scores, labels, boxes):
"""A post_process_object_detection result dict (one per image).
... | BartWojtowicz/videopython | src/tests/ai/test_objects.py | .py | 5330d6e6ebd92ffa | 8.14 | 18 |
"""Tests for OllamaVisionLLM with an injected fake client (no server, no ollama package)."""
from __future__ import annotations
import base64
import io
from types import SimpleNamespace
from typing import Any
import numpy as np
import pytest
from PIL import Image
from videopython.ai.auto_edit import OllamaVisionLLM... | BartWojtowicz/videopython | src/tests/ai/test_ollama_backend.py | .py | 8bda020a05b9863c | 8.14 | 18 |
"""Regression test: AI ops must be in the op registry / plan schema.
``FaceTrackingCrop`` and ``ObjectDetectionOverlay`` register only as an import
side-effect of their class definition, and ``ai/__init__`` re-exports them
lazily. Before the ``ai.ops`` self-registration shim (imported by
``ai.auto_edit``), a fresh pro... | BartWojtowicz/videopython | src/tests/ai/test_ops_registration.py | .py | e51ecc1c7e2e0b82 | 8.14 | 18 |
"""Registry-alignment twin of ``editing/test_streamability.py`` for ai ops.
The editing suite must not import the optional ``[ai]`` extra, so its
alignment test only sees ops registered by the editing layer. This twin runs
in the ai suite, where importing the ai op modules registers ``face_crop``
and ``object_detectio... | BartWojtowicz/videopython | src/tests/ai/test_streamability_alignment.py | .py | edcacb3886059232 | 7.14 | 18 |
"""Tests for detection dataclasses in videopython.base."""
import pytest
from videopython.base.description import AudioClassification, AudioEvent, BoundingBox, DetectedObject
class TestBoundingBox:
"""Tests for BoundingBox dataclass."""
def test_bounding_box_creation(self):
"""Test BoundingBox can ... | BartWojtowicz/videopython | src/tests/base/test_detection.py | .py | 36b0c55dba8d53d1 | 8.14 | 18 |
"""Tests for memory-efficient frame iteration and extraction."""
import numpy as np
import pytest
from tests.test_config import SMALL_VIDEO_PATH
from videopython.base.video import (
FrameIterator,
VideoMetadata,
extract_frames_at_indices,
extract_frames_at_times,
)
class TestFrameIterator:
"""Te... | BartWojtowicz/videopython | src/tests/base/test_frame_iterator.py | .py | 55063d22a0516b19 | 7.14 | 18 |
"""Tests for ``PlanError.to_prompt_line`` and ``PlanValidationError.prompt_feedback``."""
from __future__ import annotations
import pytest
from videopython.base.exceptions import PlanError, PlanErrorCode, PlanValidationError
@pytest.mark.parametrize("code", list(PlanErrorCode))
def test_every_code_renders_nonempty... | BartWojtowicz/videopython | src/tests/base/test_plan_error_prompt_line.py | .py | 9403c4284e6f8025 | 8.14 | 18 |
from typing import Any
import numpy as np
import pytest
from tests.test_config import TEST_FONT_PATH
from videopython.base.transcription import Transcription, TranscriptionSegment, TranscriptionWord
from videopython.base.video import Video
from videopython.editing import VideoEdit
from videopython.editing.transcripti... | BartWojtowicz/videopython | src/tests/base/test_transcription.py | .py | 99b68b1ed008a813 | 7.14 | 18 |
import shutil
import tempfile
import threading
from pathlib import Path
import numpy as np
import pytest
from PIL import Image
from tests.test_config import (
BIG_VIDEO_METADATA,
BIG_VIDEO_PATH,
SMALL_VIDEO_METADATA,
SMALL_VIDEO_PATH,
TEST_AUDIO_PATH,
TEST_IMAGE_PATH,
)
from videopython.audio.... | BartWojtowicz/videopython | src/tests/base/test_video.py | .py | 7947521e3b54b1f8 | 8.14 | 18 |
"""Pytest configuration.
Test structure:
- tests/base/ - No AI dependencies, runs in CI
- tests/ai/ - Requires AI extras, runs in CI
Every test here runs on a GitHub runner: no GPU, no model downloads. Anything
needing real weights belongs in the real-model harness (see CLAUDE.md), not in a
test that CI cannot execut... | BartWojtowicz/videopython | src/tests/conftest.py | .py | 5473ab7e07cf1f40 | 8.14 | 18 |
"""Fixtures shared across editing tests."""
import pytest
from videopython.base.video import Video
@pytest.fixture
def render(tmp_path):
"""Render a VideoEdit plan to a file and load it back as a ``Video``.
Streaming-to-file is the only execution engine, so a test that needs a
``Video`` object runs the... | BartWojtowicz/videopython | src/tests/editing/conftest.py | .py | 7422949711e30fa6 | 8.14 | 18 |
import numpy as np
import pytest
from PIL import Image
from pydantic import ValidationError
from tests.test_config import SMALL_VIDEO_PATH, TEST_AUDIO_PATH, TEST_FONT_PATH
from videopython.base.description import BoundingBox
from videopython.base.video import Video, VideoMetadata
from videopython.editing import VideoE... | BartWojtowicz/videopython | src/tests/editing/test_effects.py | .py | 151597caf70f880e | 7.14 | 18 |
"""Tests for natively compiled duration-changing transforms (P0.3).
``speed_change`` and ``freeze_frame`` compile to ffmpeg filter chains
(``setpts``/``fps``/``framerate``, ``loop``/``select``) instead of forcing
the whole-plan eager fallback; the plan builder folds real metadata through
the chain so frame counts, eff... | BartWojtowicz/videopython | src/tests/editing/test_native_transform_streaming.py | .py | b8733db198ea22ea | 7.14 | 18 |
"""Tests for the per-op streamability report and ``strict_streaming`` (P0.2)."""
from __future__ import annotations
from typing import Any
import pytest
from tests.test_config import SMALL_VIDEO_METADATA, SMALL_VIDEO_PATH
from videopython.base.exceptions import PlanErrorCode, PlanValidationError
from videopython.ed... | BartWojtowicz/videopython | src/tests/editing/test_streamability.py | .py | 580bf948cb94ee17 | 8.14 | 18 |
"""Tests for the editing transforms (streaming-only, post eager-removal).
Since 0.44.0 there is no eager/in-memory ``apply`` path: a transform exists
only as a streaming compilation. So these tests assert the two decode-free
surfaces a transform exposes:
* ``predict_metadata(meta)`` -- exact output shape / fps / fram... | BartWojtowicz/videopython | src/tests/editing/test_transforms.py | .py | 8e93ff1353efcfe4 | 7.14 | 18 |
"""Test that non-AI subpackages don't pull in videopython.ai.
videopython.ai brings in heavy ML dependencies (torch, diffusers, whisper,
demucs, ...). Anything outside it must stay importable on a vanilla
``pip install videopython`` (no ``[ai]`` extra).
"""
import importlib
import sys
from pathlib import Path
import... | BartWojtowicz/videopython | src/tests/test_import_isolation.py | .py | ef900b0294a727f3 | 8.14 | 18 |
import os
import glob
from pathlib import Path
from json import load
from importlib_metadata import files
import synapseclient
from synapseclient.core.exceptions import SynapseHTTPError
from synapseclient.services.json_schema import JsonSchemaService, JsonSchemaOrganization
# Environment Variables are set in the gith... | adknowledgeportal/data-models | scripts/upload_jsonschema.py | .py | 365dcae945051dc7 | 7.42 | 6 |
"""Configuration classes for multitenant_provider."""
import logging
from typing import Any, Mapping
from mergedeep import merge
from pydantic import BaseModel
LOGGER = logging.getLogger(__name__)
def _alias_generator(key: str) -> str:
return key.replace("_", "-")
class BasicMessageStorageConfig(BaseModel):
... | openwallet-foundation/acapy-plugins | basicmessage_storage/basicmessage_storage/v1_0/config.py | .py | fbbf0c61cd8b53f4 | 7.52 | 10 |
"""Basic Messages Storage Model classes and schemas."""
from acapy_agent.core.profile import ProfileSession
from acapy_agent.messaging.models.base_record import BaseRecord, BaseRecordSchema
from acapy_agent.messaging.valid import (
ISO8601_DATETIME_EXAMPLE,
ISO8601_DATETIME_VALIDATE,
)
from acapy_agent.storage... | openwallet-foundation/acapy-plugins | basicmessage_storage/basicmessage_storage/v1_0/models.py | .py | a2571c42f3b996d3 | 7.52 | 10 |
"""Basic Messages Storage API Routes."""
import functools
import logging
import uuid
from acapy_agent.admin.decorators.auth import tenant_authentication
from acapy_agent.admin.request_context import AdminRequestContext
from acapy_agent.messaging.models.base import BaseModelError
from acapy_agent.messaging.models.open... | openwallet-foundation/acapy-plugins | basicmessage_storage/basicmessage_storage/v1_0/routes.py | .py | 7f65b835d3f7b631 | 7.52 | 10 |
from functools import wraps
import pytest
import requests
AUTO_ACCEPT = "false"
BOB = "http://bob:3001"
ALICE = "http://alice:3001"
def get(agent: str, path: str, **kwargs):
"""Get."""
return requests.get(f"{agent}{path}", **kwargs)
def post(agent: str, path: str, **kwargs):
"""Post."""
return re... | openwallet-foundation/acapy-plugins | basicmessage_storage/integration/tests/__init__.py | .py | 1cd888f7e6373a29 | 8.02 | 10 |
"""Integration tests for Basic Message Storage."""
# pylint: disable=redefined-outer-name
import time
import pytest
from . import ALICE, BOB, Agent
@pytest.fixture(scope="session")
def bob():
"""bob agent fixture."""
yield Agent(BOB)
@pytest.fixture(scope="session")
def alice():
"""resolver agent fi... | openwallet-foundation/acapy-plugins | basicmessage_storage/integration/tests/test_basicmessage_storage.py | .py | 736224b686f77d57 | 7.02 | 10 |
import json
import logging
from collections.abc import Sequence
from typing import Any
from acapy_agent.cache.base import BaseCache, CacheKeyLock
from acapy_agent.core.error import BaseError
from acapy_agent.core.profile import Profile
from redis import asyncio as aioredis
from redis.asyncio import RedisCluster
from r... | openwallet-foundation/acapy-plugins | cache_redis/acapy_cache_redis/v0_1/redis_base_cache.py | .py | 234050abb91ca403 | 7.52 | 10 |
"""Helpers for did:cheqd."""
from enum import Enum
from hashlib import sha256
from typing import Dict, List, Union
from uuid import uuid4
from acapy_agent.utils.multiformats import multibase, multicodec
from acapy_agent.wallet.util import b64_to_bytes, bytes_to_b58, bytes_to_b64
from base58 import b58encode
class C... | openwallet-foundation/acapy-plugins | cheqd/cheqd/did/helpers.py | .py | 218171d1ac198eeb | 7.52 | 10 |
"""DID Resolver for Cheqd."""
import json
from dataclasses import dataclass
from typing import Optional, Pattern, Sequence, Text
from acapy_agent.config.injection_context import InjectionContext
from acapy_agent.core.profile import Profile
from acapy_agent.resolver.base import (
BaseDIDResolver,
DIDNotFound,
... | openwallet-foundation/acapy-plugins | cheqd/cheqd/resolver/resolver.py | .py | 73be67372b19705a | 7.52 | 10 |
import logging
from collections import defaultdict
from collections.abc import Callable, Hashable, Iterator, Mapping
from types import MethodType, ModuleType
from typing import (
Any,
Concatenate,
TypeVar,
overload,
)
from symbolite import real
from symbolite.ops import count_named, substitute, transla... | dyscolab/poincare | src/poincare/_utils.py | .py | 541f52bfa7157e4d | 7.45 | 7 |
from __future__ import annotations
import weakref
from collections.abc import Sequence
from dataclasses import dataclass, replace
from typing import TYPE_CHECKING, Iterable, Literal, Protocol, assert_never
import numpy as np
from numpy.typing import NDArray
from scipy import integrate
from scipy_events import Events,... | dyscolab/poincare | src/poincare/solvers.py | .py | c35b9bab451d8ce4 | 7.45 | 7 |
# %% [markdown]
# # Use the vBase API Client from Async Code
#
# Run the synchronous vBase API workflow without blocking the event loop.
# %%
import asyncio
from functools import partial
from utils import (
create_vbase_client_from_env,
get_or_create_collection,
wait_for_stamp,
)
COLLECTION_NAME = "Pytho... | validityBase/vbase-py-samples | samples/add_string_dataset_record_async.py | .py | 37f9590a12ee3746 | 7.45 | 7 |
# %% [markdown]
# # Coordinate Concurrent Trade Workflows
#
# Prepare and verify several independent trade histories in worker threads.
# Each worker creates its own client from the same account API key. vBase writes
# are serialized because concurrent on-chain transactions for one account can
# conflict. True parallel... | validityBase/vbase-py-samples | samples/add_trades_parallel.py | .py | 075f1512288de18f | 7.45 | 7 |
"""AWS S3 helpers shared by the storage-backed samples."""
from typing import Any, List, Tuple
def create_s3_client_from_env() -> Any:
"""Create an S3 client using boto3's standard credential resolution."""
from dotenv import load_dotenv
import boto3
load_dotenv(verbose=True, override=False)
ret... | validityBase/vbase-py-samples | samples/aws_utils.py | .py | 1c1cf51e93126aa3 | 7.45 | 7 |
# region imports
from AlgorithmImports import *
# endregion
class VirtualBlackGuanaco(QCAlgorithm):
"""Export target portfolio weights with QuantConnect's vBase provider."""
def initialize(self):
self.set_start_date(2024, 1, 9)
self.set_end_date(2024, 1, 10)
self.set_cash(100000)
... | validityBase/vbase-py-samples | samples/quantconnect_custom_signal_export.py | .py | 64a56a49a375b614 | 7.45 | 7 |
"""Shared helpers for the vBase Python samples."""
import hashlib
import os
import time
from typing import Any, Dict, Iterable, Optional
def get_env_var_or_fail(env_var_name: str) -> str:
"""Return a required environment variable or raise a helpful error."""
value = os.getenv(env_var_name)
if value is No... | validityBase/vbase-py-samples | samples/utils.py | .py | 5517c5d87fda10f8 | 7.45 | 7 |
"""Multi-agent actor including post-processing. All computations are made across a mini-batch and agents in parallel."""
import numpy as np
import pandas as pd
import tensorflow as tf
import tensorflow_probability as tfp
from tensorflow.keras.layers import Dense, Activation, Multiply
from tensorflow.keras.regularizers... | tumBAIS/GR-MADRL-AMoD | algorithms/actor.py | .py | fc0139857cf0d20a | 7.5 | 9 |
"""Training loop incl. validation and testing"""
import os
import copy
import pandas as pd
import numpy as np
import tensorflow as tf
from replay_buffer import ReplayBuffer
np.random.seed(0)
class Trainer:
def __init__(self, policy, env, args):
self.policy = policy
self.env = env
... | tumBAIS/GR-MADRL-AMoD | algorithms/trainer.py | .py | e2c57fd1d547e15a | 7.5 | 9 |
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Callable, Coroutine, Optional
from .models.json_rpc import JsonRPCRequest
if TYPE_CHECKING:
from .string_matcher import MatchData
NAME_SPACE = 'Flow.Launcher'
def _send_action(method: str, *parameters) -> JsonRPCRequest:
return {"Me... | Garulf/pyFlowLauncher | pyflowlauncher/api.py | .py | fc33e73da45905f1 | 7.63 | 17 |
from __future__ import annotations
import asyncio
import os
from abc import ABC, abstractmethod
from pathlib import Path
from typing import Any, Awaitable, Callable, Dict, Optional
from .api import NAME_SPACE, Api
from .base import pyFlowLauncherObject
from .icons import Icons
from .jsonrpc import JsonRPCClient, Json... | Garulf/pyFlowLauncher | pyflowlauncher/launcher.py | .py | 7067f857707d9e1a | 7.63 | 17 |
from __future__ import annotations
from dataclasses import dataclass, field
import json
from pathlib import Path
import sys
if sys.version_info < (3, 11):
from typing_extensions import Self
else:
from typing import Self
from .models.plugin_manifest import FILE_NAME, PluginMetadata
@dataclass... | Garulf/pyFlowLauncher | pyflowlauncher/manifest.py | .py | 8bf3383f2b29edc1 | 7.63 | 17 |
import sys
from typing import Optional, Iterable
if sys.version_info < (3, 11):
from typing_extensions import NotRequired, TypedDict, Required
else:
from typing import NotRequired, TypedDict, Required
class Glyph(TypedDict):
"""Flow Launcher Glyph"""
Glyph: str
FontFamily: str
cl... | Garulf/pyFlowLauncher | pyflowlauncher/models/result.py | .py | a502f62bc927090e | 7.63 | 17 |
from __future__ import annotations
import json
import sys
from functools import cached_property, wraps
from typing import Any, Callable, Iterable, Optional, Type, List
from pathlib import Path
import asyncio
from .base import pyFlowLauncherObject
from .event import EventHandler
from .launcher import Launcher, FlowLa... | Garulf/pyFlowLauncher | pyflowlauncher/plugin.py | .py | c00bab739345f417 | 7.63 | 17 |
from __future__ import annotations
import inspect
from typing import Any, Generator, Union
from .result import Result, send_results
from .models.json_rpc import JsonRPCRequest, JsonRPCResponse
def handle_response(result: Any) -> Union[JsonRPCResponse, JsonRPCRequest, None]:
"""Normalize a method's return value ... | Garulf/pyFlowLauncher | pyflowlauncher/response.py | .py | 17bc25d8f00a05ae | 7.63 | 17 |
from __future__ import annotations
from dataclasses import dataclass
from pathlib import Path
import sys
from typing import Any, Callable, Dict, Iterable, List, Optional, Union, cast
if sys.version_info < (3, 11):
from typing_extensions import Self
else:
from typing import Self
from .types import Method
from... | Garulf/pyFlowLauncher | pyflowlauncher/result.py | .py | 1a1b8b3bd8768a08 | 7.63 | 17 |
############
#
# Copyright (c) 2024-2026 Maxim Yudayev and KU Leuven eMedia Lab
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
... | maximyudayev/hermes | src/hermes/base/broker/broker.py | .py | fafb4060dd10b195 | 7.62 | 16 |
############
#
# Copyright (c) 2024-2026 Maxim Yudayev and KU Leuven eMedia Lab
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
... | maximyudayev/hermes | src/hermes/base/nodes/consumer.py | .py | 50c224c44f9c8248 | 7.62 | 16 |
############
#
# Copyright (c) 2024-2026 Maxim Yudayev and KU Leuven eMedia Lab
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
... | maximyudayev/hermes | src/hermes/base/nodes/node.py | .py | 9d3bb95930189e64 | 7.62 | 16 |
############
#
# Copyright (c) 2024-2026 Maxim Yudayev and KU Leuven eMedia Lab
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
... | maximyudayev/hermes | src/hermes/base/nodes/node_states.py | .py | 9f08f69a248564e1 | 7.62 | 16 |
############
#
# Copyright (c) 2024-2026 Maxim Yudayev and KU Leuven eMedia Lab
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
... | maximyudayev/hermes | src/hermes/base/nodes/pipeline.py | .py | fff793caa568ee20 | 7.62 | 16 |
############
#
# Copyright (c) 2024-2026 Maxim Yudayev and KU Leuven eMedia Lab
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
... | maximyudayev/hermes | src/hermes/base/storage/storage_states.py | .py | 59f00dbb746825ed | 7.62 | 16 |
############
#
# Copyright (c) 2024-2026 Maxim Yudayev and KU Leuven eMedia Lab
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
... | maximyudayev/hermes | src/hermes/datastructures/cache.py | .py | 3a2da40c71a3b767 | 7.62 | 16 |
############
#
# Copyright (c) 2024-2026 Maxim Yudayev and KU Leuven eMedia Lab
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
... | maximyudayev/hermes | src/hermes/datastructures/shared_memory.py | .py | d4fdde2287c17a87 | 7.62 | 16 |
############
#
# Copyright (c) 2024-2026 Maxim Yudayev and KU Leuven eMedia Lab
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
... | maximyudayev/hermes | src/hermes/dummy/pipeline.py | .py | ab7285bb1505c164 | 7.62 | 16 |
############
#
# Copyright (c) 2024-2026 Maxim Yudayev and KU Leuven eMedia Lab
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
... | maximyudayev/hermes | src/hermes/dummy/producer.py | .py | 7b6d60c2d761c64c | 7.62 | 16 |
############
#
# Copyright (c) 2024-2026 Maxim Yudayev and KU Leuven eMedia Lab
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
... | maximyudayev/hermes | src/hermes/logger/consumer.py | .py | 5472e1ecd879731c | 7.62 | 16 |
############
#
# Copyright (c) 2024-2026 Maxim Yudayev and KU Leuven eMedia Lab
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
... | maximyudayev/hermes | src/hermes/utils/argparse_utils.py | .py | a6ba1f9401d2a2d5 | 7.62 | 16 |
############
#
# Copyright (c) 2024-2026 Maxim Yudayev and KU Leuven eMedia Lab
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
... | maximyudayev/hermes | src/hermes/utils/mp_utils.py | .py | 34e7768af8bea218 | 7.62 | 16 |
############
#
# Copyright (c) 2024-2026 Maxim Yudayev and KU Leuven eMedia Lab
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
... | maximyudayev/hermes | src/hermes/utils/msgpack_utils.py | .py | ab6571d3403b8a3c | 7.62 | 16 |
############
#
# Copyright (c) 2024-2026 Maxim Yudayev and KU Leuven eMedia Lab
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
... | maximyudayev/hermes | src/hermes/utils/time_utils.py | .py | c622e7d8f34d54f0 | 7.62 | 16 |
############
#
# Copyright (c) 2024-2026 Maxim Yudayev and KU Leuven eMedia Lab
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
... | maximyudayev/hermes | src/hermes/utils/types.py | .py | db2c2bc392a9a592 | 7.62 | 16 |
"""Module to load the the settings from SHOME/.packagename/configuration.ini file
Will fall back to a default
"""
import os
import shutil
from configparser import ConfigParser
from pathlib import Path
from mantid.kernel import Logger
logger = Logger("PACKAGENAME")
# configuration settings file path
CONFIG_PATH_FIL... | neutrons/python_project_template | src/packagenamepy/configuration.py | .py | cf2e0bbb41ed92bf | 7.42 | 6 |
"""Main Qt window"""
from qtpy.QtWidgets import QHBoxLayout, QPushButton, QTabWidget, QVBoxLayout, QWidget
from packagenamepy.help.help_model import help_function
from packagenamepy.home.home_model import HomeModel
from packagenamepy.home.home_presenter import HomePresenter
from packagenamepy.home.home_view import Ho... | neutrons/python_project_template | src/packagenamepy/mainwindow.py | .py | a957f92e44fa0195 | 7.42 | 6 |
"""Main Qt application"""
import sys
from mantid.kernel import Logger
from mantidqt.gui_helper import set_matplotlib_backend
from qtpy.QtWidgets import QApplication, QMainWindow
# make sure matplotlib is correctly set before we import shiver
set_matplotlib_backend()
# make sure the algorithms have been loaded so th... | neutrons/python_project_template | src/packagenamepy/packagename.py | .py | 7a041834b64146cf | 7.42 | 6 |
"""
Configuration normalization for Meshtastic client app assets.
Client app assets include Android APKs and Desktop installers from the same
upstream Meshtastic-Android release feed. The primary config keys are:
- SAVE_CLIENT_APPS
- SELECTED_APP_ASSETS
- APP_VERSIONS_TO_KEEP
- CHECK_APP_PRERELEASES
- CHECK_APP_SNAPS... | jeremiah-k/fetchtastic | src/fetchtastic/client_app_config.py | .py | 3a138f33195e7318 | 7.59 | 14 |
"""
Shared release-discovery helpers for client app artifacts (Android + Desktop).
"""
from typing import Any, Callable, Dict, Mapping, Optional, Protocol, Sequence
from fetchtastic.constants import (
APK_EXTENSION,
DESKTOP_EXTENSIONS,
)
_DESKTOP_EXTENSIONS_LOWER = tuple(ext.lower() for ext in DESKTOP_EXTENS... | jeremiah-k/fetchtastic | src/fetchtastic/client_release_discovery.py | .py | 8b07bb955e4dd414 | 7.59 | 14 |
"""
Device Hardware Management Module
This module handles fetching, caching, and managing device hardware data
from the Meshtastic API to enable dynamic pattern matching for firmware downloads.
"""
import json
import logging
import os
import time
from pathlib import Path
from typing import Optional, Set
from urllib.p... | jeremiah-k/fetchtastic | src/fetchtastic/device_hardware.py | .py | 8e05fce1e0e0e214 | 7.59 | 14 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.