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 typing import List
from armodel.models.M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.PrimitiveTypes import RefType
from armodel.models.utils.uuid_mgr import UUIDMgr
from armodel.models.M2.MSR.AsamHdo.BaseTypes import SwBaseType
from armodel.models.M2.MSR.Documentation.TextModel.BlockElements import... | melodypapa/py-armodel | src/armodel/models/M2/AUTOSARTemplates/AutosarTopLevelStructure/__init__.py | .py | 09c05c85dfb64be9 | 7.63 | 17 |
"""
This module defines BSW interrupt event in AUTOSAR.
"""
from armodel.models.M2.AUTOSARTemplates.BswModuleTemplate.BswBehavior import BswEvent
class BswInterruptEvent(BswEvent):
"""
Represents a BSW interrupt event in AUTOSAR.
This event occurs when an interrupt is triggered.
"""
# BswInterru... | melodypapa/py-armodel | src/armodel/models/M2/AUTOSARTemplates/BswModuleTemplate/BswBehavior/BswInterruptEvent.py | .py | 40d295d4ad6146ab | 7.63 | 17 |
"""
This module defines BSW scheduler name prefix in AUTOSAR.
"""
from armodel.models.M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.ArObject import ARObject
class BswSchedulerNamePrefix(ARObject):
"""
Represents a BSW scheduler name prefix in AUTOSAR.
This class defines the prefix used for ... | melodypapa/py-armodel | src/armodel/models/M2/AUTOSARTemplates/BswModuleTemplate/BswBehavior/BswSchedulerNamePrefix.py | .py | af35a9b0fa864c06 | 7.63 | 17 |
"""
This module contains classes for representing AUTOSAR Basic Software (BSW) implementation.
BSW implementation describes how BSW modules are implemented, including their behavior references,
configuration options, and version information.
"""
from armodel.models.M2.AUTOSARTemplates.GenericStructure.GeneralTemplateC... | melodypapa/py-armodel | src/armodel/models/M2/AUTOSARTemplates/BswModuleTemplate/BswImplementation.py | .py | 01ab8e19d3ca1332 | 7.63 | 17 |
from armodel.models.M2.AUTOSARTemplates.GenericStructure.AbstractStructure import (
AtpInstanceRef,
)
from armodel.models.M2.AUTOSARTemplates.GenericStructure.GeneralTemplateClasses.PrimitiveTypes import (
RefType,
)
from typing import Optional
class ModeInBswModuleDescriptionInstanceRef(AtpInstanceRef):
... | melodypapa/py-armodel | src/armodel/models/M2/AUTOSARTemplates/BswModuleTemplate/BswOverview/InstanceRefs/__init__.py | .py | b687068b73825e22 | 7.63 | 17 |
from django_elasticsearch_dsl import Document, fields
from django_elasticsearch_dsl.registries import registry
from apps.deed.models import DeedPage
@registry.register_document
class DeedPageDocument(Document):
# Identifier fields - use KeywordField for exact matches and filtering
s3_lookup = fields.KeywordF... | UMNLibraries/racial_covenants_processor | apps/deed/documents.py | .py | f860a19cef4cc3d8 | 7.42 | 6 |
import os
import datetime
import urllib
import boto3
import botocore
from multiprocessing.pool import ThreadPool
import pandas as pd
from random import sample
from django.core.management.base import BaseCommand
from django.core import management
from django.db.models import OuterRef, Subquery
from django.conf import ... | UMNLibraries/racial_covenants_processor | apps/deed/management/commands/export_match_data_post_zooniverse.py | .py | ae058e79d54707ee | 7.42 | 6 |
import os
import re
import boto3
import datetime
import random
import numpy as np
import pandas as pd
from pathlib import PurePath
# from itertools import batched
from django.core.management.base import BaseCommand
from django.conf import settings
from django.db.models import Count
from apps.deed.models import DeedPa... | UMNLibraries/racial_covenants_processor | apps/deed/management/commands/gather_deed_images.py | .py | 0b94431c2f343b94 | 7.42 | 6 |
import os
import re
import boto3
import json
import ndjson
import tempfile
import datetime
import pandas as pd
from multiprocessing.pool import ThreadPool
from django.core.management.base import BaseCommand
from django.core.files.base import File
from django.db.models import Count
from django.conf import settings
fro... | UMNLibraries/racial_covenants_processor | apps/deed/management/commands/gather_image_hits.py | .py | f311f9a4016be49d | 7.42 | 6 |
import os
import boto3
from django.core.management.base import BaseCommand
from django.db.models.functions import Coalesce
from django.conf import settings
from racial_covenants_processor.storage_backends import PrivateMediaStorage
from apps.deed.models import DeedPage
from apps.zoon.models import ZooniverseSubject
f... | UMNLibraries/racial_covenants_processor | apps/deed/management/commands/join_deeds_to_subjects.py | .py | 80c099788684eeac | 7.42 | 6 |
import os
import pandas as pd
from django.core.management.base import BaseCommand
from django.conf import settings
from apps.deed.models import DeedPage
from apps.zoon.utils.zooniverse_config import get_workflow_obj
class Command(BaseCommand):
'''Use a CSV to manually set hits or exceptions on DeedPage objects ... | UMNLibraries/racial_covenants_processor | apps/deed/management/commands/set_manual_hits.py | .py | 94e736d02528b259 | 7.42 | 6 |
import os
import csv
import json
import boto3
import datetime
import pandas as pd
from multiprocessing.pool import ThreadPool
from django.core.management.base import BaseCommand
from django.db.models import Q
from django.conf import settings
from apps.deed.models import DeedPage
from apps.zoon.utils.zooniverse_config... | UMNLibraries/racial_covenants_processor | apps/deed/management/commands/trigger_term_search_refresh_fuzzy.py | .py | b7b7cf77897f1f3a | 7.42 | 6 |
"""Parse the keymap grid into layers and combos."""
from __future__ import annotations
from collections.abc import Iterable, Sequence
from pathlib import Path
from typing import NamedTuple
from keymap_generator.codes import FLAVORS, LAYER_LABELS
# Number of keys in each row of the grid: three rows of ten, then the ... | denniskempin/dubu36 | keymap_generator/src/keymap_generator/parser.py | .py | 35a5b39128020ec8 | 7.65 | 19 |
"""Map parsed keys to QMK keycodes."""
from __future__ import annotations
from keymap_generator.codes import KEY_PRESS_CODES, LAYER_LABELS, SPECIAL_LABELS
from keymap_generator.parser import Combo, Key, Layer
def get_qmk_key_press_code(label: str) -> str | None:
if label.startswith("CMD_"):
return f"G({... | denniskempin/dubu36 | keymap_generator/src/keymap_generator/qmk.py | .py | 22a3813cea390e99 | 7.65 | 19 |
"""Render keymap.txt to Selenium-style SVG (and PNG) diagrams.
Per-key legend layout (matches https://onedeadkey.github.io/selenium/):
Top-left base layer tap (grey)
Bottom-left hold binding (grey by default, boxed)
Top-right symbol layer (lwr) — purple
Bottom-right number/nav layer (rse) — orange
Hol... | denniskempin/dubu36 | keymap_generator/src/keymap_generator/render.py | .py | 7a02a29413b1a570 | 7.65 | 19 |
"""Map parsed keys to ZMK bindings."""
from __future__ import annotations
from keymap_generator.codes import (
DEFAULT_FLAVOR,
KEY_PRESS_CODES,
LAYER_LABELS,
SPECIAL_LABELS,
)
from keymap_generator.parser import Combo, Key, Layer
def get_zmk_key_press_code(label: str) -> str | None:
if label.sta... | denniskempin/dubu36 | keymap_generator/src/keymap_generator/zmk.py | .py | 425770ced969e719 | 7.65 | 19 |
"""Golden regression tests against committed keymap outputs."""
from __future__ import annotations
from pathlib import Path
from keymap_generator.generate import (
ComboGenerator,
LayerGenerator,
generate_keymap,
)
from keymap_generator.parser import parse_keymap
from keymap_generator.qmk import generate... | denniskempin/dubu36 | keymap_generator/tests/test_golden.py | .py | 2435f5100b6eb8ce | 8.15 | 19 |
"""Tests for the keymap grid parser."""
from __future__ import annotations
import textwrap
from pathlib import Path
import pytest
from keymap_generator.parser import (
Combo,
Key,
KeymapParser,
ParseError,
parse_keymap,
split_unescaped,
strip_comment,
unescape,
)
# Minimal six-layer... | denniskempin/dubu36 | keymap_generator/tests/test_parser.py | .py | 610f352a86515661 | 7.15 | 19 |
"""Tests for the Selenium-style SVG diagram renderer."""
from __future__ import annotations
from pathlib import Path
from keymap_generator.parser import Key, Layer, parse_keymap
from keymap_generator.render import (
EXCLUDED_LAYERS,
build_stacked_specs,
hold_flavor,
layer_specs,
render_board,
... | denniskempin/dubu36 | keymap_generator/tests/test_render.py | .py | b795b875e1d83527 | 8.15 | 19 |
"""Regenerate every row of the Expected Assessments tab from a calendar spec.
The tab drives the forced scaffold in int_tableau__college_assessment_roster_scores
-- one expected row per student per assessment, covering a current student's whole
high school history. Hand-editing it does not work, for two reasons:
1.... | TEAMSchools/teamster | .claude/skills/carat-dashboard/scripts/build_expected_assessment_rows.py | .py | 516ddd27fb5d8bc5 | 7.6 | 15 |
"""Turn College Board raw-to-scale conversion pastes into act_scale_score_key rows.
Reads columns BY HEADER NAME, not position. This is load-bearing: Foundation's
tabs differ in shape (some carry `Scale Score Upper`, some don't, some append
`Percentage`), so a positional parser reads `Percentage` as the scale score an... | TEAMSchools/teamster | .claude/skills/carat-dashboard/scripts/build_scale_score_rows.py | .py | 8c45499f9760e783 | 7.6 | 15 |
"""Create the NJ SLEDS ungraded-worklist view and export one CSV per region.
Deliberately NOT gated on validate_submission.run_checks. The worklist is the
tool used to resolve the rows that make the gate fail (no usable grade in
either source, conflicting grades, or an out-of-domain grade) - gating this
script on the ... | TEAMSchools/teamster | docs/superpowers/nj-sleds-roster/submission/export_worklist.py | .py | e29106cc1ce5d5f5 | 7.6 | 15 |
"""Validation gate for the NJ SLEDS student course submission.
Exits non-zero if any handbook or parity rule fails. Prints aggregate counts
only - never row-level values, which are PII.
"""
import sys
from google.cloud import bigquery
from submission_query import (
ALPHA_GRADE_DOMAIN,
SUBMISSION_COLUMNS,
... | TEAMSchools/teamster | docs/superpowers/nj-sleds-roster/submission/validate_submission.py | .py | eb066f77aa872e28 | 7.6 | 15 |
# /// script
# requires-python = ">=3.13"
# dependencies = [
# "google-api-python-client",
# "google-auth",
# "google-cloud-bigquery",
# ]
# ///
r"""One-shot backfill: set externalIds[type='custom', customType='student_number'] on existing student Google accounts.
Identifies matched student accounts under ... | TEAMSchools/teamster | scripts/backfill_google_directory_student_external_ids.py | .py | 8f7ffcd39f9b1a55 | 7.6 | 15 |
# /// script
# requires-python = ">=3.13"
# dependencies = [
# "psycopg[binary]>=3.3",
# ]
# ///
"""Validate Cube row-level security by emulating each viewer over the SQL API.
Ground-truth pre-pilot check. Cube's `checkSqlAuth` resolves identity from the
connecting SQL user, so one connection per viewer email runs ... | TEAMSchools/teamster | scripts/cube_rls_matrix.py | .py | d67f4850a4c65663 | 7.6 | 15 |
# /// script
# requires-python = ">=3.13"
# dependencies = ["pyyaml>=6.0"]
# ///
"""Enrich dbt staging YAML files with descriptions and PII flags.
Reads JSON mapping file(s) produced by extract_pdf_dictionary.py and writes
description and config.meta.contains_pii to staging YAML properties files.
Usage:
uv run s... | TEAMSchools/teamster | scripts/enrich_staging_descriptions.py | .py | ecf4411a19587acd | 7.6 | 15 |
# /// script
# requires-python = ">=3.13"
# dependencies = ["openpyxl>=3.1"]
# ///
"""Extract CEDS element names and definitions.
Fetches the CEDS-Elements XLSX workbook from GitHub, joins the Properties
and Classes sheets via `Domain Includes` IRI, and writes a vendored CSV
in the same shape as `edfi-v6.1.0-attribut... | TEAMSchools/teamster | scripts/extract_ceds_schema.py | .py | 14cfc8168e3c75dd | 7.6 | 15 |
# /// script
# requires-python = ">=3.13"
# dependencies = ["pyyaml>=6.0"]
# ///
"""Extract Ed-Fi Unified Data Model attribute names and descriptions.
Fetches the Ed-Fi Resource API OpenAPI spec from GitHub, extracts
(entity, attribute, description) triples, and writes a vendored CSV.
Output: docs/superpowers/specs/... | TEAMSchools/teamster | scripts/extract_edfi_schema.py | .py | db205608836070b1 | 7.6 | 15 |
# /// script
# requires-python = ">=3.13"
# dependencies = ["pyyaml>=6.0"]
# ///
"""Generate the column naming audit inventory CSV.
Reads every YAML properties file under the kipptaf mart directories
(bridges/dimensions/facts) and emits one CSV row per (model, column) pair
plus pre-populated structural-addition rows ... | TEAMSchools/teamster | scripts/gen_column_naming_audit_inventory.py | .py | 675a46a6537d52f7 | 7.6 | 15 |
# /// script
# requires-python = ">=3.13"
# dependencies = [
# "pyyaml>=6.0",
# ]
# ///
"""Generate the marts data-model reference page.
Parses foreign-key constraints from the kipptaf marts properties YAML, builds a
directed FK graph, traverses the full snowflake chain per fact table, and emits
a single markdown p... | TEAMSchools/teamster | scripts/generate_marts_reference.py | .py | dc5563844c77eddf | 7.6 | 15 |
"""Re-encode an asset's partitioned GCS Avro files to its current schema.
Use after a schema evolution where only some partitions were re-materialized,
leaving the external table with heterogeneous Avro writer schemas. A BigQuery
external-table read resolves one reader schema across the scanned files and
drops any fie... | TEAMSchools/teamster | scripts/reencode_avro_partitions.py | .py | a24de3e43a2170b1 | 7.6 | 15 |
# /// script
# requires-python = ">=3.13"
# dependencies = ["pyyaml>=6.0", "ruamel.yaml>=0.18"]
# ///
"""Sync dbt mart YAML descriptions into Cube cube YAML files.
Reads each cube file under ``src/cube/model/cubes/``, locates the matching
dbt mart YAML via ``sql_table:``, and inserts dbt column descriptions onto
cube... | TEAMSchools/teamster | scripts/sync_cube_descriptions.py | .py | c3cee0b63b1c2bfd | 7.6 | 15 |
"""Arm definitions for the academic-year eval.
Two designs are compared, holding everything constant except the one variable
under test: the academic-year crosswalk paragraph in the ``load`` tool
description.
A_baseline shipped tools minus the "resolve it yourself" crosswalk
paragraph in ... | TEAMSchools/teamster | src/cube/mcp/eval/arms.py | .py | 8d303dd50cc8ba27 | 7.6 | 15 |
"""Model-in-the-loop runner: drive one prompt through the Anthropic tool-use
loop against a single arm, capturing what the model did.
Every Cube tool is stubbed so the only thing measured is model behavior:
- ``meta`` returns the fixed catalog (arms.META_STUB),
- ``load`` / ``sql`` record the query the model built and... | TEAMSchools/teamster | src/cube/mcp/eval/harness.py | .py | c6f5f65e8918af08 | 7.6 | 15 |
#!/usr/bin/env python3
"""Run the academic-year eval through the Claude Agent SDK.
Same experiment as run_eval.py (arms A/B x models x prompts x reps, scored by
scorer.py), but drives the model through Claude Code instead of the raw
Anthropic Messages API — so it authenticates with your Claude Code
subscription, no AN... | TEAMSchools/teamster | src/cube/mcp/eval/run_eval_cc.py | .py | 3e671a6c44d035eb | 7.6 | 15 |
"""Scoring for the academic-year eval.
Maps the filter the model built (captured by the harness) to a canonical
academic-year START integer, compares it to each prompt's ground truth, and
aggregates per (model, arm).
Metrics
-------
Determinate prompts (families 1 & 2 — a correct year exists):
correct_rate qu... | TEAMSchools/teamster | src/cube/mcp/eval/scorer.py | .py | 6d2d1c0a70488719 | 7.6 | 15 |
"""A command-line interface for metar-weather-bot."""
import json
import os
from datetime import datetime
import click
import pytz
import requests
import twitter
from mastodon import Mastodon
from metar import Metar
from retry import retry
from rich import print
@click.group()
def cli():
"""Download, parse and p... | palewire/metar-weather-bot | cli.py | .py | c95c401c4156619f | 7.5 | 9 |
"""Steps specific for the ATMOSPEC workflow"""
import enum
from copy import deepcopy
from dataclasses import dataclass
import ipywidgets as ipw
import traitlets
from aiida.engine import ProcessState, run_get_node, submit
from aiida.manage import get_manager
from aiida.orm import Bool, load_code, load_node
from aiida... | ispg-group/aiidalab-ispg | aiidalab_ispg/app/atmospec_steps.py | .py | 0ff68500211dfaf9 | 7.02 | 10 |
"""Widgets for the conformer generation usign RDKit.
Inspired by:
https://rdkit.org/UGM/2012/Ebejer_20110926_RDKit_1stUGM.pdf
https://doi.org/10.1021/ci2004658
RDKit documentation
https://www.rdkit.org/docs/RDKit_Book.html#conformer-generation
API reference
https://www.rdkit.org/docs/source/rdkit.Chem.rdDistG... | ispg-group/aiidalab-ispg | aiidalab_ispg/app/conformers.py | .py | 82e313a7386763c3 | 7.52 | 10 |
"""Common inputs widgets for workflow settings"""
from enum import Enum, unique
import ipywidgets as ipw
import traitlets as tl
from aiida.common import NotExistent
from aiida.orm import load_code
from aiidalab_widgets_base import ComputationalResourcesWidget
from .utils import NCPUS
# Taken from ORCA-5.0 manual, ... | ispg-group/aiidalab-ispg | aiidalab_ispg/app/input_widgets.py | .py | ec54cd460e3cf043 | 7.52 | 10 |
"""Steps specific for the optimization workflow"""
import enum
from dataclasses import dataclass
import ipywidgets as ipw
import traitlets
from IPython.display import clear_output, display
from aiida.engine import ProcessState, submit
from aiida.orm import Bool, load_code, load_node
from aiida.plugins import Workflo... | ispg-group/aiidalab-ispg | aiidalab_ispg/app/optimization_steps.py | .py | 5d0ff8d583d018eb | 7.52 | 10 |
"""Widgets related to process management."""
from __future__ import annotations
import threading
from dataclasses import make_dataclass
import ipywidgets as ipw
import traitlets as tl
from aiida.tools.query.calculation import CalculationQueryBuilder
# Limit the number of workchains that we should in the selector
#... | ispg-group/aiidalab-ispg | aiidalab_ispg/app/qeapp/process.py | .py | 0dbb7a67580ff6f8 | 7.52 | 10 |
"""Widgets for the upload and selection of structure data.
Authors:
* Carl Simon Adorf <simon.adorf@epfl.ch>
"""
import ipywidgets as ipw
import traitlets
from aiida import orm
from aiidalab_widgets_base import WizardAppWidgetStep
class StructureSelectionStep(ipw.VBox, WizardAppWidgetStep):
"""Integrated ... | ispg-group/aiidalab-ispg | aiidalab_ispg/app/qeapp/structures.py | .py | ea0f19b70c9adf2d | 7.52 | 10 |
"""Widgets for the QE app.
Authors:
* Carl Simon Adorf <simon.adorf@epfl.ch>
"""
import base64
import hashlib
from queue import Queue
from tempfile import NamedTemporaryFile
from threading import Event, Lock, Thread
import ipywidgets as ipw
import traitlets
from IPython.display import HTML, Javascript, display
... | ispg-group/aiidalab-ispg | aiidalab_ispg/app/qeapp/widgets.py | .py | dc16105512f6a612 | 7.52 | 10 |
# /// script
# requires-python = ">=3.9"
# dependencies = [
# "numpy>=2.0.2",
# "scipy>=1.13.1",
# ]
# ///
"""Class for calculating UV/vis spectra using Nuclear Ensemble Approach (NEA).
Authors:
* Daniel Hollas <daniel.hollas@bristol.ac.uk>
"""
from enum import Enum, unique
import numpy as np
from scipy ... | ispg-group/aiidalab-ispg | aiidalab_ispg/app/spectrum.py | .py | 4827f802a32456ca | 8.02 | 10 |
"""Tools for analyzing the spectra.
Authors:
* Daniel Hollas <daniel.hollas@bristol.ac.uk>
* Fay Abu-Al-Timen
* Will Hobson
* Konstantin Nomerotski
* Kirstin Gerrand
* Marco Barnfield
* Emily Wright
"""
from enum import Enum, unique
from pathlib import Path
import bokeh.plotting as plt
im... | ispg-group/aiidalab-ispg | aiidalab_ispg/app/spectrum_analysis.py | .py | e583b0c1ec58c376 | 8.02 | 10 |
"""Common/Base Steps for AiiDAlab workflows.
Code inspired by the QeApp.
Authors:
* Daniel Hollas <daniel.hollas@bristol.ac.uk>
"""
import re
import ipywidgets as ipw
import traitlets
from aiida.engine import ProcessState
from aiida.engine.processes.control import ProcessTimeoutException, kill_processes
from... | ispg-group/aiidalab-ispg | aiidalab_ispg/app/steps.py | .py | f58c7ada24d25867 | 7.52 | 10 |
import math
import bokeh.io
import ipywidgets as ipw
import psutil
from aiida.plugins import DataFactory
StructureData = DataFactory("core.structure")
TrajectoryData = DataFactory("core.array.trajectory")
CifData = DataFactory("core.cif")
# Energy units conversion factors
# TODO: Make this an Enum, or use a library... | ispg-group/aiidalab-ispg | aiidalab_ispg/app/utils.py | .py | 41d97efebbf07c4a | 7.52 | 10 |
#!/usr/bin/env python3
# Specification of standalone script dependencies according to PEP 723
# /// script
# dependencies = ['ase', 'tdqm', 'cclib~=1.8.0']
# ///
# Script for the calculation of Wigner distributions in coordinate space
import copy
import math
import random
import sys
from pathlib import Path
# some c... | ispg-group/aiidalab-ispg | aiidalab_ispg/wigner/wigner.py | .py | 3c38745d77e56fdc | 7.52 | 10 |
"""Base work chain to run an ORCA calculation"""
# Not sure if this is needed? Can we use self.run()?
from aiida.engine import (
ExitCode,
ToContext,
WorkChain,
append_,
if_,
process_handler,
run,
)
from aiida.orm import (
Bool,
Dict,
Float,
Int,
List,
SinglefileData... | ispg-group/aiidalab-ispg | aiidalab_ispg/workflows/atmospec.py | .py | c9e0ed4caa0a02c5 | 8.02 | 10 |
"""AiiDA workflows for optimization of molecules."""
from aiida.engine import (
ExitCode,
ProcessHandlerReport,
WorkChain,
append_,
process_handler,
)
from aiida.plugins import DataFactory, WorkflowFactory
from .utils import extract_trajectory_arrays, structures_to_trajectory
StructureData = Data... | ispg-group/aiidalab-ispg | aiidalab_ispg/workflows/optimization.py | .py | 4c31ec8b32d073af | 7.52 | 10 |
"""Small utility workflows and functions"""
import math
from typing import Optional
import numpy as np
from aiida.engine import WorkChain, calcfunction
from aiida.orm import (
ArrayData,
Dict,
List,
StructureData,
TrajectoryData,
)
__all__ = [
"ConcatInputsToList",
"add_orca_wf_guess",
... | ispg-group/aiidalab-ispg | aiidalab_ispg/workflows/utils.py | .py | d627782e221d8fe2 | 7.52 | 10 |
from enum import Enum
from pathlib import Path
import pytest
import requests
# https://selenium-python.readthedocs.io/locating-elements.html
import selenium.webdriver.support.expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
WINDOW_WIDTH =... | ispg-group/aiidalab-ispg | tests_integration/test_app.py | .py | 096137568fed96be | 7.02 | 10 |
from unittest.mock import patch
import pytest
from django.http import Http404
from django.test import TestCase
from config.views.schema import schema
class TestSchemas(TestCase):
@patch("config.views.schema.requests.get")
def test_cached(self, get):
# Tests caching behaviour; happy path
"We ... | nationalarchives/ds-caselaw-public-ui | config/tests/test_schema.py | .py | fc1bae346e77dc75 | 8.12 | 16 |
"""
To understand why this file is here, please read:
http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
"""
from django.conf import settings
from django.db import migrations
def _update_or_create_site_with_sequence(site_model, connection... | nationalarchives/ds-caselaw-public-ui | ds_judgements_public_ui/contrib/sites/migrations/0003_set_site_domain_and_name.py | .py | ed36ddc46bf5a2d7 | 7.62 | 16 |
from __future__ import annotations
# https://github.com/benediktschmitt/py-ts3/blob/v2/ts3/escape.py
ESCAPE_MAP = (
("\\", r"\\"),
("/", r"\/"),
(" ", r"\s"),
("|", r"\p"),
("\a", r"\a"),
("\b", r"\b"),
("\f", r"\f"),
("\n", r"\n"),
("\r", r"\r"),
("\t", r"\t"),
("\v", r"\v... | jykob/TSBot | tsbot/encoders.py | .py | 51ff607216ddcda5 | 7.54 | 11 |
from __future__ import annotations
from typing import Any, NamedTuple
from typing_extensions import Self
from tsbot import context, parsers
class TSEvent(NamedTuple):
event: str
ctx: Any = None
@classmethod
def from_server_notification(cls, raw_data: str) -> Self:
"""
Creates a TSE... | jykob/TSBot | tsbot/events/event.py | .py | c59387e3ab655307 | 7.54 | 11 |
#!/usr/bin/env python3
"""
sync-to-gitee-verify.py
=======================
Post-push verification for the `sync-to-gitee.yml` workflow. Compares the
SHA of every ref listed in $VERIFY_REFS between:
* the local bare clone in $CACHE_DIR (just-pushed state), and
* the Gitee mirror (via `/tmp/lsremote.log` captured e... | scszcoder/eCan.ai | .github/scripts/sync-to-gitee-verify.py | .py | 662828c940470714 | 7.63 | 17 |
"""Recursive protobuf decoder for the captured Feige Frontier WS frames — proves
the READ path: can we pull customer message text (incl. product cards) out of the
raw binary frames without the .proto schema?
Reads the *_feigecap.jsonl produced by _feige_cap_parse.py (k=="ws" records),
recursively decodes each frame's ... | scszcoder/eCan.ai | _feige_proto_decode.py | .py | f64d678214b472fb | 7.63 | 17 |
"""
Service-tag fingerprint used in zeroconf TXT records.
Purpose: prevent ACCIDENTAL cross-account discovery on shared LANs (coffee
shops, conferences). NOT a full security boundary — anyone who can read
zeroconf records knows the ``org`` string, and the HMAC key in v1 is
derived from that same ``org`` string, so spo... | scszcoder/eCan.ai | agent/a2a/discovery/auth.py | .py | e3699794fbecff8c | 7.63 | 17 |
"""
Group A2A sends — fan one payload out to many agents in parallel.
Built on top of ``router.send_to_agent`` (which picks LAN vs WAN per call)
and ``query.find_agents`` (which picks the recipients from filters).
Two main public functions:
send_to_group(agent_ids, payload)
Parallel fanout to an explicit... | scszcoder/eCan.ai | agent/a2a/discovery/group.py | .py | 84fc1849c364bb1d | 7.63 | 17 |
"""
Stable per-install machine identifier.
Generated once on first launch and persisted under the user's data home at
``<user_data_home>/discovery/machine_id.json``. Survives renames, IP changes,
OS upgrades. Used by zeroconf node records and by the future WAN relay so
peers can address "this physical eCan install" re... | scszcoder/eCan.ai | agent/a2a/discovery/machine_id.py | .py | 470728fb324cea17 | 7.63 | 17 |
"""
Filtered queries over AgentDirectory — "find any agent with skill X".
Phase 3 of the discovery rework. Per-agent advertising landed in Phase 1
(zeroconf) and Phase 2 (cloud), so the directory already knows what each
peer agent can do (TXT/cloud ``skills`` field). This module adds the
search API that's the headline... | scszcoder/eCan.ai | agent/a2a/discovery/query.py | .py | 270319518938fd82 | 7.63 | 17 |
"""
AppSync-backed A2A message relay.
Used by the router when the recipient agent isn't reachable via LAN-direct
HTTP. Publishes an ``A2AMessage`` mutation; the recipient (subscribed via
``onA2AMessage(toAgentId=<self>)``) receives it on its WebSocket and feeds
it into the same A2A handler chain that LAN-direct HTTP w... | scszcoder/eCan.ai | agent/a2a/discovery/wan_relay.py | .py | ab072211610b1eba | 7.63 | 17 |
"""
A2A Task Executor - Adapter between a2a-sdk and ec_tasks.
This module provides a thin adapter layer that:
1. Implements the a2a-sdk AgentExecutor interface
2. Delegates execution to the existing TaskRunner
3. Bridges a2a EventQueue with existing waiter/future pattern
"""
import asyncio
import time
import tracebac... | scszcoder/eCan.ai | agent/a2a/langgraph_agent/a2a_task_executor.py | .py | f5a8bb3966c355f3 | 7.63 | 17 |
import traceback
import socket
from typing import Any, Dict, List, Optional
from pydantic import BaseModel, ConfigDict, model_validator
from typing_extensions import Self
from utils.logger_helper import logger_helper as logger
SUPPORTED_CONTENT_TYPES = ["text", "text/plain", "json", "file"]
class FileContent(BaseMo... | scszcoder/eCan.ai | agent/a2a/langgraph_agent/utils.py | .py | e3870a5258851582 | 7.63 | 17 |
"""Process-wide registry for an optional in-process A2A local-delivery hook.
Deliberately STANDALONE (stdlib only, no project imports) so it can be imported by both the A2A
send core (`agent.ec_agent`) and the live-chat hook module without a circular import.
Why this exists: `ec_agent` imports `agent.ec_tasks` at mod... | scszcoder/eCan.ai | agent/a2a/local_delivery_hook.py | .py | e4f98059e1040915 | 7.63 | 17 |
from app_context import AppContext
from typing import TYPE_CHECKING, Optional
from utils.logger_helper import logger_helper as logger, get_traceback
if TYPE_CHECKING:
from agent.ec_agent import EC_Agent
def get_agent_by_id(agent_id) -> Optional['EC_Agent']:
"""Safely fetch agent by id from the current main wi... | scszcoder/eCan.ai | agent/agent_service.py | .py | ea995da8e6d5d000 | 7.63 | 17 |
"""
Avatar cloud sync manager.
Handles automatic synchronization between local storage and cloud storage for avatars.
Renamed from CloudSyncManager to AvatarCloudSync for better clarity.
"""
import os
from pathlib import Path
from typing import Optional, Dict, Any, List
from datetime import datetime
from ..cloud.s3_... | scszcoder/eCan.ai | agent/avatar/avatar_cloud_sync.py | .py | 626d144f469f08fb | 7.63 | 17 |
"""
Avatar URL utilities for converting file paths to HTTP URLs.
This module provides unified functions for avatar URL generation,
avoiding code duplication across multiple files.
"""
import urllib.parse
from typing import Optional, Dict, Any
from pathlib import Path
from utils.logger_helper import logger_helper as l... | scszcoder/eCan.ai | agent/avatar/avatar_url_utils.py | .py | c5122d309d8311fa | 7.63 | 17 |
# Avatar Video Utils - Video processing utilities for avatars
import os
import subprocess
import asyncio
from pathlib import Path
from typing import Optional, Tuple
from PIL import Image
import io
from utils.logger_helper import logger_helper as logger
async def extract_first_frame(video_path: str, output_path: str... | scszcoder/eCan.ai | agent/avatar/avatar_video_utils.py | .py | 8d85dd5d3984fafa | 7.63 | 17 |
"""
Avatar Video Generator - Generate videos from avatar images.
This module provides functionality to generate animated videos from static avatar images
using LLM APIs or fallback to ffmpeg-based placeholder videos.
"""
import os
import asyncio
import subprocess
import sys
from pathlib import Path
from typing import... | scszcoder/eCan.ai | agent/avatar/video_generator.py | .py | 902370263e83a5c6 | 7.63 | 17 |
"""
Discord channel adapter — Gateway bot via discord.py.
Requires: ``discord.py`` (in requirements-base.txt).
Config keys: ``bot_token``, ``allowed_channel_ids`` (optional list of int),
``default_agent_id`` (optional).
Uses discord.py's Gateway connection (WebSocket) to receive messages and
the REST API... | scszcoder/eCan.ai | agent/channels/adapters/discord.py | .py | b7d150c1be4ef49b | 7.63 | 17 |
"""
Facebook Messenger channel adapter — Webhook + Graph API.
Requires: ``requests`` (already in requirements-base.txt).
Config keys: ``page_access_token``, ``verify_token``, ``app_secret`` (optional, for signature verification),
``webhook_port`` (default 8444), ``default_agent_id`` (optional).
Messenger... | scszcoder/eCan.ai | agent/channels/adapters/messenger.py | .py | 09980a419d4558c3 | 7.63 | 17 |
"""
WebChat channel adapter — wraps existing GUI chat pipeline.
This adapter is a no-op that registers itself so the ChannelManager
recognizes "webchat" as a valid channel type. Inbound and outbound
messages for the GUI are already handled by the existing IPC/WS pipeline.
"""
from __future__ import annotations
impor... | scszcoder/eCan.ai | agent/channels/adapters/webchat.py | .py | 114bb2c55d7eddbc | 7.63 | 17 |
"""PyTorch port of the SCoPe feature+dmdt DNN.
Layer-for-layer translation of :class:`scope.nn.ScopeNet` (TF/Keras) into
PyTorch, with the same interface:
model({"features": (B, F), "dmdt": (B, 26, 26, 1)}) -> (B, 1) sigmoid score
Primary use case: retrain the same architecture on the new WISE NEP feature
set with... | scope-ml/scope-ml | scope/nn_pytorch.py | .py | 53da20476451689e | 7.56 | 12 |
"""Kowalski / Gloria / Melman connection helpers for scope-ml.
Wraps the `penquins.Kowalski` client with scope-ml's token-from-env and
multi-instance configuration conventions. Keeps all external-archive access
in ``scope.surveys``.
Usage
-----
>>> from scope.surveys.kowalski import make_kowalski_client
>>> k = make_... | scope-ml/scope-ml | scope/surveys/kowalski.py | .py | 3035cccb306c50a2 | 7.56 | 12 |
#!/usr/bin/env python3
"""
Damped-random-walk (DRW / Ornstein-Uhlenbeck) features for AGN-like
stochastic variability.
Fits a celerite Gaussian process with a RealTerm (the DRW kernel) plus a
JitterTerm (extra white noise absorbing underestimated photometric errors)
by maximizing the marginal likelihood with L-BFGS-B.... | scope-ml/scope-ml | tools/featureGeneration/drw.py | .py | 71902813551fd380 | 7.56 | 12 |
#!/usr/bin/env python3
"""
PDRS: peak-driven region segmentation for flare / high-activity features.
Adapted from https://github.com/zerozole/Peak_Driven_Region_Segmentation
Detects flare regions in a light curve by finding significant peaks in binned
flux, growing each peak into a region using a gradient-guided expa... | scope-ml/scope-ml | tools/featureGeneration/pdrs.py | .py | 5595c56b6cdce676 | 7.56 | 12 |
#!/usr/bin/env python
import os
import pathlib
import time
import argparse
import pandas as pd
import numpy as np
import subprocess
from scope.utils import parse_load_config
BASE_DIR = pathlib.Path.cwd()
config = parse_load_config()
fields_to_run = config['feature_generation'].get('fields_to_run')
fields_to_exclude ... | scope-ml/scope-ml | tools/generate_features_job_submission.py | .py | 8a7ed4f47748a560 | 7.56 | 12 |
#!/usr/bin/env python
"""
Source discovery tool for Rubin LSST data.
Parallel to tools/get_quad_ids.py, this script finds Rubin object IDs
via cone search or reads them from a CSV file.
"""
import argparse
import os
import pathlib
import pandas as pd
from scope.utils import parse_load_config
from scope.surveys.rubin ... | scope-ml/scope-ml | tools/get_rubin_ids.py | .py | 20c4ebf16f5505d6 | 7.56 | 12 |
#!/usr/bin/env python
"""
Merge chunk parquet files from parallel feature generation into a single training set.
Usage:
python tools/merge_training_chunks.py \
--chunks-dir regenerate_training \
--output regenerate_training/new_training_set.parquet \
--n-chunks 8
"""
import argparse
import... | scope-ml/scope-ml | tools/merge_training_chunks.py | .py | ba6260e5e6f3cd14 | 7.56 | 12 |
#!/usr/bin/env python
"""
Regenerate ZTF training set with the latest period-finding features.
This script:
1. Reads the old training set parquet to extract source IDs and labels
2. Calls generate_features() with top-N periods, FPW, and agreement scoring
3. Merges the new features with old class labels
4. Saves the re... | scope-ml/scope-ml | tools/regenerate_training_set.py | .py | 87bebc39bd6f47ae | 7.56 | 12 |
#!/usr/bin/env python
import os
import pathlib
import argparse
import numpy as np
from scope.utils import parse_load_config
BASE_DIR = pathlib.Path.cwd()
BASE_DIR_PREDS = BASE_DIR
config = parse_load_config()
path_to_preds = config['inference']['path_to_preds']
if path_to_preds is not None:
BASE_DIR_PREDS = pat... | scope-ml/scope-ml | tools/run_inference_job_submission.py | .py | 464a6b13d80ffa19 | 7.56 | 12 |
"""Run RHIME from a cookiecutter-generated project package."""
from __future__ import annotations
import argparse
from collections.abc import Sequence
import json
from pathlib import Path
from typing import Any
from openghg_inversions.rhime import RhimeResult, run_rhime
from .likelihoods import likelihood_builder
... | openghg/openghg_inversions | examples/rhime_cookiecutter/my_inversion/runner.py | .py | ef5c49503d6dbcf7 | 7.45 | 7 |
"""Run standard RHIME with project-owned emissions basis construction.
This copy-and-modify example keeps RHIME's supported acquisition, filtering,
sensitivity, labelled-input, model, sampling, and output stages. Only the
emissions-basis stage is replaced by :func:`build_project_basis`. The example
either loads a se... | openghg/openghg_inversions | examples/rhime_customisation/custom_basis_runner.py | .py | c821153e62b0095a | 7.45 | 7 |
"""Run ordinary RHIME with a project-owned Student-t likelihood.
This is the preferred low-ceremony customization route. It keeps RHIME's
complete acquisition-to-output pipeline and changes only the direct-Python
likelihood callable passed to :func:`openghg_inversions.rhime.run_rhime`.
Use :func:`run_with_likelihood` ... | openghg/openghg_inversions | examples/rhime_customisation/run_with_likelihood.py | .py | 3385602d8fc9a595 | 7.45 | 7 |
"""Advanced copy-and-modify runner for a standard RHIME inversion.
This example deliberately replaces RHIME's default likelihood with a
project-owned Student-t builder. The orchestration is intentionally copied so
that a project can make deeper scientific changes while continuing to reuse
the supported acquisition, pr... | openghg/openghg_inversions | examples/rhime_customisation/runner.py | .py | 0dccd9b446e6b40d | 7.45 | 7 |
"""Shared labelled square-matrix axis construction and diagnostics.
Numerical kernels use distinct row and column dimensions so xarray never
contracts a square matrix along both axes accidentally. Column axes retain
the row axis's typed :class:`pandas.Index` or :class:`pandas.MultiIndex`;
MultiIndex level names and o... | openghg/openghg_inversions | openghg_inversions/_labelled_matrices.py | .py | 84aa67f64043806a | 7.45 | 7 |
"""Shared PyMC/PyTensor runtime configuration."""
from __future__ import annotations
import os
import sys
from typing import Any, cast
def _pytensor_flag_is_explicit(name: str) -> bool:
"""Return whether the process supplied one named ``PYTENSOR_FLAGS`` value."""
for setting in os.environ.get("PYTENSOR_FLAG... | openghg/openghg_inversions | openghg_inversions/_pymc_config.py | .py | f8a53a635ea4a259 | 7.45 | 7 |
"""Lightweight private codecs shared by versioned artifact schemas."""
from __future__ import annotations
import json
import numpy as np
_TAGGED_JSON_VALUE_ENCODING = "tagged_json_v1"
def _encode_tagged_json_value(value: object) -> str:
"""Encode a supported scalar or nested tuple as compact tagged JSON.
... | openghg/openghg_inversions | openghg_inversions/_serialization_codecs.py | .py | 5a633adb37faa7ac | 7.45 | 7 |
"""Small helpers for grep-friendly runtime instrumentation."""
from __future__ import annotations
from contextlib import contextmanager
from time import perf_counter
from typing import Any, Iterator
import resource
import sys
def _maxrss_kb() -> int:
"""Return peak resident set size in KiB where available."""
... | openghg/openghg_inversions | openghg_inversions/_timing.py | .py | b13dbc346e062b65 | 7.45 | 7 |
"""Functions to create fit basis functiosn and apply to data."""
import numpy as np
import pandas as pd
import xarray as xr
from openghg_inversions.array_ops import get_xr_dummies, sparse_xr_dot, to_dense
from openghg_inversions.basis.basis_functions import BasisFunctions
from ._functions import basis_boundary_condi... | openghg/openghg_inversions | openghg_inversions/basis/_helpers.py | .py | 0a18ba63f6b86993 | 7.45 | 7 |
"""Observation-space contrast scoring for candidate basis splits.
The score in this module is a basis-construction diagnostic. It uses a fixed
design contribution array and an optional fixed design covariance; it must not
be built from observed mole fractions or residuals. With the default
``contrast_tau=None`` and id... | openghg/openghg_inversions | openghg_inversions/basis/algorithms/_contrast.py | .py | 2d3bddc87cbc2955 | 7.45 | 7 |
"""Module to create basis regions for the inversion using a quadtree algorithm."""
import numpy as np
import scipy.optimize
class quadTreeNode:
"""Node of the quadtree algorithm.
Class attributes 'xStart', 'xEnd', 'yStart', 'yEnd' store the
coordinates (in terms of indexes of the grid) of the node;
... | openghg/openghg_inversions | openghg_inversions/basis/algorithms/_quadtree.py | .py | b09e9429c5b680d5 | 7.45 | 7 |
"""Weighted bucket algorithms for basis-region construction.
If the total (sum) of the input data in a region exceeds a certain threshold, then the region
is split in two. This continues recursively until we have a collection of regions whose totals
are all below the threshold.
The threshold is optimised to create a ... | openghg/openghg_inversions | openghg_inversions/basis/algorithms/_weighted.py | .py | ee3de41b04ddcdba | 7.45 | 7 |
"""Grouped basis layout helpers.
This module contains the small internal representation used to combine
partition-local basis labels into one flat basis map while preserving semantic
state metadata. It is intentionally separate from basis-generation algorithms:
algorithms decide how to split cells inside a mask or reg... | openghg/openghg_inversions | openghg_inversions/basis/layout.py | .py | badb45a03e46d731 | 7.45 | 7 |
"""Experimental static markers for borrowed NumPy and xarray arrays.
The :func:`borrow` helper is an identity function at runtime. Its overloads
cast supported arrays to phantom subclasses whose common mutation entry points
are marked with PEP 702 ``deprecated`` diagnostics. The diagnostic means
"mutation is unsuppo... | openghg/openghg_inversions | openghg_inversions/borrowed.py | .py | e091d381af148847 | 7.45 | 7 |
"""Prepare labelled, backend-neutral boundary-condition sensitivities."""
from __future__ import annotations
from collections.abc import Sequence
from dataclasses import dataclass
import numpy as np
import xarray as xr
from openghg_inversions.array_ops import get_xr_dummies
from openghg_inversions.inversion_inputs ... | openghg/openghg_inversions | openghg_inversions/boundary_sensitivity.py | .py | 9db3b6361395c1bf | 7.45 | 7 |
"""Command line interface for OpenGHG inversions."""
from __future__ import annotations
import argparse
import json
from typing import Any
def _add_run_args(parser: argparse.ArgumentParser) -> None:
parser.add_argument("start", help="Start date string of the format YYYY-MM-DD", nargs="?")
parser.add_argumen... | openghg/openghg_inversions | openghg_inversions/cli.py | .py | 619ce83bebe94406 | 7.45 | 7 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.