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
import os, json, re, threading from dotenv import load_dotenv import requests from langsmith import traceable from GenBox.azurestorage import ( get_last_n_rows, get_row, insert_history, try_acquire_decision_lock, release_decision_lock, ) from GenBox.research import research_real_world from GenBox.sc...
abozaralizadeh/SandBox
GenBox/prompt.py
.py
7183c38bd09c7a61
7.57
13
"""Real-world research step for GenBox decisions, using the model's NATIVE web search. Mirrors how AIBlog (and ComicBook) search the live web: an Azure OpenAI model on the Responses API is given the built-in ``{"type": "web_search"}`` tool, so the search runs server-side and a single call returns a synthesized, source...
abozaralizadeh/SandBox
GenBox/research.py
.py
8d6ac48cb8250fae
7.57
13
"""Publication cadence for the GenBox channel. `GENBOX_GENERATION_INTERVAL_DAYS` (default 1 = every day) says how often a new decision is produced. Slots sit on a fixed grid anchored at `GENBOX_SCHEDULE_ANCHOR_DATE` (default 1970-01-01), so the grid is derived purely from the calendar — it does not depend on when the ...
abozaralizadeh/SandBox
GenBox/schedule.py
.py
55d10d9484c91f3b
7.57
13
"""Integration surface for the GenBox news-anchor video feature. Generation runs in a background thread (the app has no job system) so the HTTP request never blocks. Status + single-flight lock live in Azure Tables, so any gunicorn worker can serve the polling endpoint regardless of which worker owns the generating th...
abozaralizadeh/SandBox
GenBox/video.py
.py
752b26ac7d5c2a3b
7.57
13
from azure.storage.blob import BlobServiceClient, BlobClient, ContainerClient from azure.data.tables import TableServiceClient, TableEntity from utils import get_flat_date_hour, get_flat_date_full from io import BytesIO from dotenv import load_dotenv import requests import os import uuid from urllib.parse import urlpar...
abozaralizadeh/SandBox
TomorrowNews/azurestorage.py
.py
0237c82d1adea1d1
7.57
13
import getpass import os from datetime import datetime, timedelta from typing import Annotated from typing_extensions import Literal from langchain_core.messages import ToolMessage from langchain_core.tools import tool from langgraph.graph import MessagesState, StateGraph, START, END from langgraph.types import Command...
abozaralizadeh/SandBox
TomorrowNews/supervisor.py
.py
a87a3753b89a0f1c
7.57
13
"""Read-only access to the trAIde public dashboard data in Azure Blob + Table. The PRODUCER lives in the separate trAIde repo and writes a sanitized, public-safe projection of its trading agents' activity here. This module only ever READS. It is intentionally guarded: if the storage account / container / table is not ...
abozaralizadeh/SandBox
TrAIde/azurestorage.py
.py
126074d000f2ea98
7.57
13
import pickle import pandas as pd from sqlalchemy import create_engine, text from TimelineKGQA.constants import DATA_DIR, DB_CONNECTION_STR from TimelineKGQA.utils import get_logger, timer logger = get_logger(__name__) class CronQuestions: def __init__(self): self.engine = create_engine(DB_CONNECTION_S...
PascalSun/TimelineKGQA
TimelineKGQA/data_loader/load_cronquestions.py
.py
44d2320133cd4fa1
7.54
11
""" Read a table of generated questions, and paraphrase them using OpenAI's GPT-4o model. Given a table name, then read from the database, update the paraphrased questions, and write them back to the database. """ import argparse import pandas as pd import psycopg2 from loguru import logger from tqdm import tqdm fr...
PascalSun/TimelineKGQA
TimelineKGQA/paraphrase.py
.py
401990aee089729b
7.54
11
from TimelineKGQA.utils import get_logger logger = get_logger(__name__) def mean_reciprocal_rank(rs): """ Calculate Mean Reciprocal Rank (MRR). Args: rs (list of lists): List of results for each query. Each result is a list of binary values (1 if the item is relevant, 0 other...
PascalSun/TimelineKGQA
TimelineKGQA/rag/metrics.py
.py
50a7fbfd7d69a217
7.54
11
import json import logging import sys import time from logging import Logger from typing import List import requests def get_logger(name): # Create a logger the_logger = logging.getLogger(name) the_logger.setLevel(logging.INFO) # Create console handler and set level to debug console_handler = lo...
PascalSun/TimelineKGQA
TimelineKGQA/utils.py
.py
f332c28250e303f9
7.54
11
#! /usr/bin/python3 # SPDX-License-Identifier: MIT # Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. # # Check firmware version strings in binaries against linux-firmware repo import glob import hashlib import os import re import struct import sys import subprocess from check import load_config # ...
linux-msm/hexagon-dsp-binaries
scripts/checkfw.py
.py
f6f5f24f62d5469f
7.64
18
import numpy as np import rocks import phunk from phunk.logging import logger class PhaseCurve: """Phase curve of a given asteroid.""" def __init__( self, phase=None, mag=None, mag_err=None, target=None, epoch=None, ra=None, dec=None, r...
astrockers/phunk
phunk/core.py
.py
7bed36b16cc4c0d9
7.48
8
import numpy as np from sbpy import photometry as phot from phunk.geometry import cos_aspect_angle, rotation_phase, subobserver_longitude from phunk.reparametrization import lmfit_to_dict, dict_to_lmfit, parameter_remapping def func_shg1g2(pha, h, g1, g2, R, alpha, delta): """Return f(H, G1, G2, R, alpha, delta)...
astrockers/phunk
phunk/equations.py
.py
d7f11ec114c45fe6
7.48
8
import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import phunk import rocks def get_colors(N, cmap="turbo"): """ Get a list of unique colors. Parameters ---------- N : int The number of unique colors to return. cmap : str The matplotlib colormap to s...
astrockers/phunk
phunk/plotting.py
.py
8f35df83d104e4ca
7.48
8
import numpy as np import lmfit # # FIXME # # Source - https://stackoverflow.com/a/30368735 # # Posted by niekas, modified by community. See post 'Timeline' for change history # # Retrieved 2026-03-10, License - CC BY-SA 4.0 # import warnings # warnings.filterwarnings("error") # # FIXME def sigmoid(x): """ ...
astrockers/phunk
phunk/reparametrization.py
.py
44d08c4b161918d0
7.48
8
from pathlib import Path import numpy as np import pandas as pd import pytest import phunk # Observations from Gehrels 1956 PHASE = [0.57, 1.09, 3.20, 10.99, 14.69, 20.42] MAG = [6.555, 6.646, 6.793, 7.130, 7.210, 7.414] OBS_8988 = pd.read_csv(Path(__file__).parent / "data/Hansenkoharcheck.csv") @pytest.mark.para...
astrockers/phunk
tests/test_core.py
.py
78f3ea298f6b2501
7.98
8
"""Base class for all anonymized rollup processors.""" import io import json import os import tarfile from datetime import datetime import pandas as pd from metrics_utility.anonymized_rollups.helpers import sanitize_json class BaseAnonymizedRollup: """Base class for all anonymized rollup processors. Subc...
ansible/metrics-utility
metrics_utility/anonymized_rollups/base_anonymized_rollup.py
.py
f841a0c54c246740
7.52
10
"""Anonymized rollup for controller_version_service collector data.""" import pandas as pd from metrics_utility.anonymized_rollups.base_anonymized_rollup import BaseAnonymizedRollup from metrics_utility.anonymized_rollups.helpers import sanitize_json class ControllerVersionAnonymizedRollup(BaseAnonymizedRollup): ...
ansible/metrics-utility
metrics_utility/anonymized_rollups/controller_version_anonymized_rollup.py
.py
a90e1a03664126b0
7.52
10
"""Anonymized rollup for credentials_service collector data.""" from metrics_utility.anonymized_rollups.base_anonymized_rollup import BaseAnonymizedRollup from metrics_utility.anonymized_rollups.helpers import sanitize_json class CredentialsAnonymizedRollup(BaseAnonymizedRollup): """ Collector - credentials_...
ansible/metrics-utility
metrics_utility/anonymized_rollups/credentials_anonymized_rollup.py
.py
d4b224eb52cb28bf
7.52
10
"""Anonymized rollup for execution_environment_service collector data.""" import pandas as pd from metrics_utility.anonymized_rollups.base_anonymized_rollup import BaseAnonymizedRollup from metrics_utility.anonymized_rollups.helpers import sanitize_json class ExecutionEnvironmentsAnonymizedRollup(BaseAnonymizedRoll...
ansible/metrics-utility
metrics_utility/anonymized_rollups/execution_environments_anonymized_rollup.py
.py
96ebbfaef2209eb3
7.52
10
import pandas as pd from metrics_utility.anonymized_rollups.base_anonymized_rollup import BaseAnonymizedRollup from metrics_utility.anonymized_rollups.helpers import sanitize_json class FeatureFlagsAnonymizedRollup(BaseAnonymizedRollup): """ Rollup for feature_flags_service collector data. Returns the l...
ansible/metrics-utility
metrics_utility/anonymized_rollups/feature_flags_anonymized_rollup.py
.py
65b46b2a50c24424
7.52
10
""" Helper utilities for anonymized rollups. """ import json import math import os try: import numpy as np HAS_NUMPY = True except ImportError: HAS_NUMPY = False def load_known_collections(): """Load the public collections whitelist from collections.json. Returns: Dict mapping collect...
ansible/metrics-utility
metrics_utility/anonymized_rollups/helpers.py
.py
ab35ed03b32dfb8e
7.52
10
"""Anonymized rollup for indirect managed node audit collector data.""" import json import pandas as pd from metrics_utility.anonymized_rollups.base_anonymized_rollup import BaseAnonymizedRollup from metrics_utility.anonymized_rollups.helpers import sanitize_json from metrics_utility.automation_controller_billing.da...
ansible/metrics-utility
metrics_utility/anonymized_rollups/indirect_managed_nodes_anonymized_rollup.py
.py
a794b8f35a4759d4
7.52
10
"""Anonymized rollup for job_host_summary_service collector data.""" import pandas as pd from metrics_utility.anonymized_rollups.base_anonymized_rollup import BaseAnonymizedRollup from metrics_utility.anonymized_rollups.helpers import sanitize_json class JobHostSummaryAnonymizedRollup(BaseAnonymizedRollup): """...
ansible/metrics-utility
metrics_utility/anonymized_rollups/jobhostsummary_anonymized_rollup.py
.py
97762f771f486100
7.52
10
"""Anonymized rollup for table_metadata collector data.""" import pandas as pd from metrics_utility.anonymized_rollups.base_anonymized_rollup import BaseAnonymizedRollup from metrics_utility.anonymized_rollups.helpers import sanitize_json class TableMetadataAnonymizedRollup(BaseAnonymizedRollup): """ Collec...
ansible/metrics-utility
metrics_utility/anonymized_rollups/table_metadata_anonymized_rollup.py
.py
56cda1baf059279e
7.52
10
import pandas as pd from metrics_utility.anonymized_rollups.base_anonymized_rollup import BaseAnonymizedRollup from metrics_utility.anonymized_rollups.helpers import sanitize_json # Known collector types and their expected daily execution counts. # Hourly collectors run once per hour → 24 expected per day. # Snapsho...
ansible/metrics-utility
metrics_utility/anonymized_rollups/task_executions_anonymized_rollup.py
.py
a38f74240acd2c75
7.52
10
"""Thin boto3 wrapper for common S3 operations used by billing packages and savers.""" import os import boto3 from botocore.exceptions import ClientError from metrics_utility.logger import logger class S3Handler: """Wrapper around boto3 providing upload, download, and list operations for a single S3 bucket.""...
ansible/metrics-utility
metrics_utility/automation_controller_billing/base/s3_handler.py
.py
1292dc5e34fd73a9
7.52
10
"""Billing-specific Collector implementation for Automation Controller metrics.""" import json import os from django.conf import settings from django.core.serializers.json import DjangoJSONEncoder from django.db import connection from metrics_utility import base from metrics_utility.automation_controller_billing.hel...
ansible/metrics-utility
metrics_utility/automation_controller_billing/collector.py
.py
75fd593c67b9db28
7.52
10
import json import os from django.db import connection from django.db.utils import ProgrammingError from django.utils.timezone import now, timedelta from metrics_utility.automation_controller_billing.helpers import get_last_entries_from_db from metrics_utility.base import register from metrics_utility.base.utils impo...
ansible/metrics-utility
metrics_utility/automation_controller_billing/collectors.py
.py
e2bf0aadb727f6f0
7.52
10
"""Base dataframe engine utilities and base class for billing dataframe processors.""" import datetime from functools import reduce import pandas as pd from dateutil.relativedelta import relativedelta def granularity_cast(date, granularity): """Truncate *date* to the start of its month or year according to *g...
ansible/metrics-utility
metrics_utility/automation_controller_billing/dataframe_engine/base.py
.py
f18a8bf37dc22359
7.52
10
"""Dataframe engine for parsing data_collection_status CSV files from billing tarballs.""" import pandas as pd from metrics_utility.automation_controller_billing.dataframe_engine.base import Base # dataframe for data_collection_status class DataframeCollectionStatus(Base): """Reads and concatenates data_collect...
ansible/metrics-utility
metrics_utility/automation_controller_billing/dataframe_engine/dataframe_collection_status.py
.py
1cf91cc54624712e
7.52
10
"""Factory for creating the set of dataframe engines appropriate for a given report type.""" from metrics_utility.automation_controller_billing.dataframe_engine.dataframe_collection_status import DataframeCollectionStatus from metrics_utility.automation_controller_billing.dataframe_engine.dataframe_content_usage impor...
ansible/metrics-utility
metrics_utility/automation_controller_billing/dataframe_engine/factory.py
.py
6321cf0449bb96bf
7.52
10
"""CCSP deduplication logic for billing dataframes.""" from collections import defaultdict from collections.abc import Iterable class DedupCCSP: """CCSP host deduplication engine. In standard mode, returns the built dataframes unchanged (no deduplication). In experimental mode, uses hardware serial numb...
ansible/metrics-utility
metrics_utility/automation_controller_billing/dedup/ccsp.py
.py
21bbb769e29dc430
7.52
10
"""Factory for selecting and constructing the appropriate deduplicator.""" from metrics_utility.automation_controller_billing.dedup.ccsp import DedupCCSP from metrics_utility.automation_controller_billing.dedup.renewal_guidance import ( DedupRenewal, DedupRenewalExperimental, DedupRenewalHostname, ) from m...
ansible/metrics-utility
metrics_utility/automation_controller_billing/dedup/factory.py
.py
3ce1505bd8472d84
7.52
10
"""Base extractor class and safe tarball extraction utilities for billing data.""" import json import os import re import tarfile import pandas as pd from metrics_utility.exceptions import MetricsException from metrics_utility.logger import logger _main_host_sheets = [ 'inventory_scope', 'jobs', 'manag...
ansible/metrics-utility
metrics_utility/automation_controller_billing/extract/base.py
.py
87fa252aecb201e9
7.52
10
"""Extractor that reads host_metric data directly from the Controller database.""" import datetime from django.db import connection from metrics_utility.library.collectors.controller.main_hostmetric import main_hostmetric class ExtractorControllerDB: """Extracts host_metric data from the AWX/Controller Postgre...
ansible/metrics-utility
metrics_utility/automation_controller_billing/extract/extractor_controller_db.py
.py
b7bb0aef52b350cf
7.52
10
"""Extractor that reads billing tarballs from the local filesystem.""" import os import tempfile from metrics_utility.automation_controller_billing.extract.base import Base from metrics_utility.logger import logger class ExtractorDirectory(Base): """Extracts billing data tarballs from a local directory partitio...
ansible/metrics-utility
metrics_utility/automation_controller_billing/extract/extractor_directory.py
.py
0ed04c83a2f7ab7b
7.52
10
"""Extractor that reads billing tarballs from an S3-compatible object store.""" import os import tempfile from metrics_utility.automation_controller_billing.base.s3_handler import S3Handler from metrics_utility.automation_controller_billing.extract.base import Base from metrics_utility.logger import logger class Ex...
ansible/metrics-utility
metrics_utility/automation_controller_billing/extract/extractor_s3.py
.py
66bcefa31dc9b185
7.52
10
"""Factory for selecting the appropriate billing data extractor.""" from metrics_utility.automation_controller_billing.extract.extractor_controller_db import ExtractorControllerDB from metrics_utility.automation_controller_billing.extract.extractor_directory import ExtractorDirectory from metrics_utility.automation_co...
ansible/metrics-utility
metrics_utility/automation_controller_billing/extract/factory.py
.py
635e1e0005d0d616
7.52
10
"""Helper utilities for the automation_controller_billing package.""" import json from itertools import chain import pandas as pd from django.db import connection from metrics_utility.library.collectors.controller.config import _datetime_hook from metrics_utility.logger import logger def get_last_entries_from_db...
ansible/metrics-utility
metrics_utility/automation_controller_billing/helpers.py
.py
4b4a4f5353de35ab
7.52
10
"""Factory for selecting the correct Package class for the configured ship target.""" from metrics_utility.automation_controller_billing.package.package_crc import PackageCRC from metrics_utility.automation_controller_billing.package.package_directory import PackageDirectory from metrics_utility.automation_controller_...
ansible/metrics-utility
metrics_utility/automation_controller_billing/package/factory.py
.py
613cd0b822d98153
7.52
10
"""Package implementation that ships billing tarballs to a local directory.""" import os import shutil from django.conf import settings from metrics_utility import base from metrics_utility.logger import logger class PackageDirectory(base.Package): """Package that copies the generated tarball into a local date...
ansible/metrics-utility
metrics_utility/automation_controller_billing/package/package_directory.py
.py
b83bc76cd510fcd3
7.52
10
"""Package implementation that ships billing tarballs to an S3-compatible object store.""" import os from django.conf import settings from metrics_utility import base from metrics_utility.automation_controller_billing.base.s3_handler import S3Handler from metrics_utility.logger import logger class PackageS3(base.P...
ansible/metrics-utility
metrics_utility/automation_controller_billing/package/package_s3.py
.py
26f369c2abac9392
7.52
10
"""Factory for creating the correct report builder for the configured report type.""" from metrics_utility.automation_controller_billing.report.report_ccsp import ReportCCSP from metrics_utility.automation_controller_billing.report.report_ccsp_v2 import ReportCCSPv2 from metrics_utility.automation_controller_billing.r...
ansible/metrics-utility
metrics_utility/automation_controller_billing/report/factory.py
.py
f0c670d0637843aa
7.52
10
from typing import Any, Self import equinox as eqx import jax import jax.numpy as jnp import numpy as np import pysm3 import pysm3.units as u from jax.typing import ArrayLike from jaxtyping import Array, DTypeLike, PRNGKeyArray from numpy.typing import NDArray from ..obs.landscapes import FrequencyLandscape from ..ob...
CMBSciPol/furax
src/furax/_instruments/sky.py
.py
be9d3d7289b27660
7.5
9
from collections.abc import Sequence from dataclasses import field from math import prod import jax from jax import Array from jax import numpy as jnp from jaxtyping import Inexact, PyTree from ._base import AbstractLinearOperator, IdentityOperator, TransposeOperator from .rules import AbstractCompositionRule, NoRedu...
CMBSciPol/furax
src/furax/core/_axes.py
.py
f227316079ab2063
7.5
9
import functools from abc import ABC from collections.abc import Callable from typing import Any import jax import jax.numpy as jnp import jax.scipy.linalg as jsl from jax import Array from jax.tree_util import PyTreeDef from jaxtyping import Inexact, PyTree from ..tree import add from ._base import ( AbstractLin...
CMBSciPol/furax
src/furax/core/_blocks.py
.py
cd6045caa3f0956a
7.5
9
from collections.abc import Callable from dataclasses import field import jax import jax.numpy as jnp import numpy as np from jaxtyping import Array, Float, Inexact, PyTree from ._base import AbstractLinearOperator, square __all__ = [ 'FourierOperator', ] @square class FourierOperator(AbstractLinearOperator): ...
CMBSciPol/furax
src/furax/core/_fourier.py
.py
098a3c3be093c125
7.5
9
from dataclasses import field from types import EllipsisType import jax import jax.numpy as jnp from jax import Array from jaxtyping import Bool, Inexact, Integer, PyTree from ._base import AbstractLinearOperator, IdentityOperator, TransposeOperator from ._diagonal import DiagonalOperator from .rules import AbstractC...
CMBSciPol/furax
src/furax/core/_indices.py
.py
0fc9abeec57b0d6d
7.5
9
from jax import Array from jaxtyping import Bool, PyTree from ._base import AbstractLinearOperator, TransposeOperator from .rules import AbstractCompositionRule class PackOperator(AbstractLinearOperator): """Operator that extracts elements using a boolean mask: y = x[mask]. This operator satisfies: Pack @ P...
CMBSciPol/furax
src/furax/core/_linear.py
.py
ed9187bcdfdbac80
7.5
9
from typing import Self import jax import jax.numpy as jnp from jaxtyping import Array, Bool, Inexact, PyTree, UInt8 from ._base import AbstractLinearOperator, idempotent, symmetric from .rules import AbstractCompositionRule @symmetric @idempotent class MaskOperator(AbstractLinearOperator): """Operator that zer...
CMBSciPol/furax
src/furax/core/_mask.py
.py
1c194734066d7191
7.5
9
from abc import ABC, abstractmethod from collections.abc import Iterator import jax.numpy as jnp from jaxtyping import Scalar from ._base import ( AbstractLazyInverseOperator, AbstractLinearOperator, HomothetyOperator, IdentityOperator, TransposeOperator, ) class NoReduction(BaseException): ...
CMBSciPol/furax
src/furax/core/rules.py
.py
5d9da5c6c6e57040
7.5
9
import dataclasses from collections.abc import Iterable from typing import Any, TypeVar from jax._src.tree_util import GetAttrKey, register_pytree_with_keys T = TypeVar('T') class DefaultIdentityDict(dict[T, T]): """A dict whose default factory is the identity. Examples: >>> d = DefaultIdentityDict...
CMBSciPol/furax
src/furax/core/utils.py
.py
4cd46bf4bb839b16
7.5
9
from __future__ import annotations import typing from collections.abc import Collection from functools import partial from pathlib import Path from typing import Any import jax.numpy as jnp import numpy as np import toast from astropy import units as u from astropy.wcs import WCS from jaxtyping import Array, Bool, Fl...
CMBSciPol/furax
src/furax/interfaces/toast/observation.py
.py
8c00cd5aca94cd78
7.5
9
import logging import time from abc import ABC, abstractmethod from collections.abc import Mapping, Sequence from typing import Any import jax import numpy as np from jax import Array from jax.experimental import io_callback from jax.tree_util import register_static from jaxtyping import PyTree from furax.tree import...
CMBSciPol/furax
src/furax/io/readers.py
.py
4d46c29e6dbbaaa4
7.5
9
from collections.abc import Callable from typing import Literal, NamedTuple import equinox as eqx import equinox.internal as eqxi import jax import jax.numpy as jnp from jaxtyping import Array, Float, Num, PyTree from furax import AbstractLinearOperator, tree class CGResult(NamedTuple): """Result of the Conjuga...
CMBSciPol/furax
src/furax/linalg/_cg.py
.py
f907282fb84cc8d5
7.5
9
import jax import jax.numpy as jnp from jaxtyping import Array, Float @jax.jit def _eigvalsh_2x2(A: Float[Array, '... 2 2']) -> Float[Array, '... 2']: """Analytic eigenvalues of batched symmetric 2x2 matrices, sorted ascending.""" # symmetric 2x2 matrix # [ a b ] # [ b c ] # characteristic p...
CMBSciPol/furax
src/furax/linalg/_eigvalsh.py
.py
fbb00ed76f0732b3
7.5
9
"""Low-rank approximation for PyTree-aware linear operators.""" from typing import Any, Literal, NamedTuple, get_args import jax import jax.numpy as jnp from jax import Array from jaxtyping import Float, Num, PRNGKeyArray, PyTree from furax import AbstractLinearOperator, symmetric from furax.tree import dot, normal_...
CMBSciPol/furax
src/furax/linalg/low_rank.py
.py
7a3b2616bc360096
7.5
9
"""Cross-process collectives for the mapmaking pipeline.""" import jax import numpy as np from jax.sharding import Mesh, NamedSharding from jax.sharding import PartitionSpec as P from jaxtyping import Array, PyTree def _cross_process_mesh() -> Mesh: """A ``(proc, dev)`` mesh over every device in the job, grouped...
CMBSciPol/furax
src/furax/mapmaking/_distributed.py
.py
d4a88d154a61fad3
7.5
9
import functools from dataclasses import dataclass from typing import Any, Self import jax import jax.numpy as jnp from jax.tree_util import register_dataclass from jaxtyping import Array, Float, PyTree from furax import AbstractLinearOperator, IdentityOperator, MaskOperator, tree from furax.obs.landscapes import Sto...
CMBSciPol/furax
src/furax/mapmaking/_model.py
.py
2bd87e5e0f1f0368
7.5
9
from __future__ import annotations from abc import ABC, abstractmethod from collections.abc import Collection from dataclasses import dataclass from enum import StrEnum from hashlib import sha1 from pathlib import Path from typing import Any, ClassVar, Literal, NamedTuple, Self, overload import jax import jax.numpy a...
CMBSciPol/furax
src/furax/mapmaking/_observation.py
.py
cd65582652f3c77a
7.5
9
"""Assign observations to processes, keeping buffer padding down. Observations read together are padded to a common shape, the per-axis maximum over the group, so a short observation grouped with a long one is padded up to the long one. That padding costs compute and memory, so the grouping decides how much of a run i...
CMBSciPol/furax
src/furax/mapmaking/_partition.py
.py
e2305b9819295f83
7.5
9
# pylint: disable=invalid-name,duplicate-code """Generate TOC JSON from AEM-page HTML files. AEM documentation archives use two structural patterns: 1. Nested articles: <article class="nested0/1/2/..."> with topictitle headings. The nesting level comes from the CSS class (nested0 = root, nested1 = chapter, etc.). ...
ansible/aap-rag-content
scripts/aem-toc-generator.py
.py
1f2444a6eca3adca
7.42
6
"""Custom metadata processor for AAP documentation. This module provides AAPMetadataProcessor class for processing AAP product documentation metadata and generating vector databases. """ # pylint: disable=import-error import functools import json from pathlib import Path from aap_rag_content import utils from aap_ra...
ansible/aap-rag-content
scripts/custom_processor_aap.py
.py
731f8901b0ef2d49
7.42
6
"""Utility script to download models from HuggingFace.""" import argparse import os import shutil from aap_rag_content.utils import resolve_within_cwd def download_model(local_dir: str, hf_repo_id: str) -> str: """Download a model snapshot from HuggingFace and prepare it for offline use. Args: loca...
ansible/aap-rag-content
scripts/download_embeddings_model.py
.py
552f18ef88ad320c
7.42
6
"""Parse Mimir documentation archives into plaintext for RAG ingestion.""" # pylint: disable=invalid-name,duplicate-code import argparse import configparser import json import os import re import subprocess import sys import time import traceback # List of directories that are used as sources to generate RAG data. # ...
ansible/aap-rag-content
scripts/mimir-parser.py
.py
811db4bf1f673bed
7.42
6
"""Download and parse solution guides for RAG DB ingestion.""" # pylint: disable=invalid-name import argparse import json import os import re import shutil import sys import time import urllib.error import urllib.request from aap_rag_content.utils import resolve_output_path SOLUTION_GUIDES_REPO_URL = "https://githu...
ansible/aap-rag-content
scripts/solution-guides-parser.py
.py
5e4f645e1c179d86
7.42
6
"""Core classes for document processing without llama_index dependency. This module provides llama-index compatible classes without importing all llama-index dependencies. These lightweight implementations offer the same interface as their llama-index counterparts, allowing code to work with familiar patterns while mi...
ansible/aap-rag-content
src/aap_rag_content/llama_index/core.py
.py
749593cac380be21
7.42
6
# Copyright 2025 Red Hat, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
ansible/aap-rag-content
src/aap_rag_content/metadata_processor.py
.py
14fc35962fd32872
7.42
6
# Copyright 2025 Red Hat, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
ansible/aap-rag-content
src/aap_rag_content/utils.py
.py
307d6650fb1cc995
7.42
6
# Copyright 2025 Red Hat, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
ansible/aap-rag-content
tests/tests/test_aem_toc_generator.py
.py
65a5afb77cefc626
7.92
6
# Copyright 2025 Red Hat, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
ansible/aap-rag-content
tests/tests/test_document_processor.py
.py
c9a11a10b325c7bf
7.92
6
# Copyright 2025 Red Hat, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
ansible/aap-rag-content
tests/tests/test_download_embeddings_model.py
.py
f875b3c9ef7afd0f
7.92
6
# Copyright 2025 Red Hat, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
ansible/aap-rag-content
tests/tests/test_utils.py
.py
f11f47a1055be51b
7.92
6
# Copyright 2025 Red Hat, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
ansible/aap-rag-content
tests/tests/test_vector_query.py
.py
dc9df987fc0302b2
7.92
6
"""Prometheus Metrics.""" import asyncio import resource import aiofiles from prometheus_client import Gauge from prometheus_sanic import monitor from prometheus_sanic.constants import BaseMetrics from prometheus_sanic.metrics import init from sanic import Sanic _PAGESIZE = resource.getpagesize() PROMETHEUS_VIRTUAL_...
SwissDataScienceCenter/renku-data-services
bases/renku_data_services/data_api/prometheus.py
.py
d76df2a9890e3c2a
7.48
8
"""A simple task manager.""" from __future__ import annotations import asyncio import math import sys from asyncio.tasks import Task from collections.abc import Callable, Coroutine, Iterator from dataclasses import dataclass from datetime import datetime, timedelta from typing import Any, final from renku_data_servi...
SwissDataScienceCenter/renku-data-services
bases/renku_data_services/data_tasks/taskman.py
.py
4b0862a84b305c10
7.48
8
"""Dependency management for k8s cache.""" from dataclasses import dataclass, field from renku_data_services.crc.db import ClusterRepository, QuotaRepository, ResourcePoolQueryRepository from renku_data_services.k8s.clients import DummyPriorityClassClient, DummyResourceQuotaClient from renku_data_services.k8s.db impo...
SwissDataScienceCenter/renku-data-services
bases/renku_data_services/k8s_cache/dependencies.py
.py
e03fe21847b5d96b
7.48
8
"""Secrets storage configuration.""" import os from dataclasses import dataclass, field from pathlib import Path from typing import Any, Self from yaml import safe_load import renku_data_services.secrets from renku_data_services.app_config import logging from renku_data_services.app_config.config import KeycloakConf...
SwissDataScienceCenter/renku-data-services
bases/renku_data_services/secrets_storage_api/config.py
.py
08f414968f68a123
7.48
8
"""Dependencies management of secrets storage.""" from __future__ import annotations import os from dataclasses import dataclass, field from renku_data_services import base_models from renku_data_services.authn.dummy import DummyAuthenticator from renku_data_services.authn.keycloak import KeycloakAuthenticator from ...
SwissDataScienceCenter/renku-data-services
bases/renku_data_services/secrets_storage_api/dependencies.py
.py
4cf6c08c2d4123e0
7.48
8
"""The entrypoint for the secrets storage application.""" import argparse import os from multiprocessing import Lock from os import environ from typing import Any from prometheus_sanic import monitor from sanic import Request, Sanic from sanic.response import BaseHTTPResponse from sanic.worker.loader import AppLoader...
SwissDataScienceCenter/renku-data-services
bases/renku_data_services/secrets_storage_api/main.py
.py
d8b33112faa354d7
7.48
8
"""Configurations. An important thing to note here is that the configuration classes in here contain some getters (i.e. @property decorators) intentionally. This is done for things that need a database connection and the purpose is that the database connection is not initialized when the classes are initialized. Only ...
SwissDataScienceCenter/renku-data-services
components/renku_data_services/app_config/config.py
.py
6d7c0d667aa56631
7.48
8
"""Logging configuration. This is a central place for configuring the logging library, so that all log messages have the same format. The intention is to use it like described in the manual of python logging: Define a module based logger like this: ``` python import renku_data_services.app_config.logging as logging ...
SwissDataScienceCenter/renku-data-services
components/renku_data_services/app_config/logging.py
.py
e14390d88ec0aca7
7.48
8
"""Internal authentication blueprint.""" from dataclasses import dataclass from sanic import Request from sanic.response import JSONResponse from sanic_ext import validate from renku_data_services import base_models, errors from renku_data_services.app_config import logging from renku_data_services.authn.api import ...
SwissDataScienceCenter/renku-data-services
components/renku_data_services/authn/api/blueprints.py
.py
48cb19dd94612311
7.48
8
"""Core logic for internal authentication.""" import asyncio from dataclasses import dataclass from typing import TYPE_CHECKING from renku_data_services import base_models, errors from renku_data_services.app_config import logging from renku_data_services.data_connectors.core import get_deposit_job_status from renku_...
SwissDataScienceCenter/renku-data-services
components/renku_data_services/authn/api/core.py
.py
c8f075f6962b7b7c
7.48
8
"""Authenticator which tries authenticators in a chain until a user is authenticated or all authenticators are tried.""" from collections.abc import Sequence from dataclasses import dataclass from sanic import Request from renku_data_services.base_models.core import ( AnyAPIUser, Authenticator, ) from renku_...
SwissDataScienceCenter/renku-data-services
components/renku_data_services/authn/chained.py
.py
fcfa1c2928d96cf8
7.48
8
"""Dummy adapter for communicating with Keycloak to be used for testing.""" import contextlib import json from asyncio import Lock from dataclasses import dataclass from typing import Optional from sanic import Request from ulid import ULID import renku_data_services.base_models as base_models class DummyUserStore...
SwissDataScienceCenter/renku-data-services
components/renku_data_services/authn/dummy.py
.py
35b9a832126970e1
7.48
8
"""Gitlab authenticator.""" import contextlib import urllib.parse as parse from contextlib import suppress from dataclasses import dataclass from datetime import datetime import gitlab from sanic import Request from sanic.compat import Header import renku_data_services.base_models as base_models from renku_data_serv...
SwissDataScienceCenter/renku-data-services
components/renku_data_services/authn/gitlab.py
.py
dda6907bc10bdd41
7.48
8
"""Keycloak user store.""" from __future__ import annotations from contextlib import suppress from dataclasses import dataclass from datetime import datetime from typing import Any, Optional, cast import httpx import jwt from jwt import PyJWKClient, PyJWKClientError from sanic import Request from tenacity import ret...
SwissDataScienceCenter/renku-data-services
components/renku_data_services/authn/keycloak.py
.py
7fa89f4b9d00c4ac
7.48
8
"""Renku data services self authentication. Instances of `RenkuSelfTokenMint` can create internal access and refresh tokens and instances of `RenkuSelfAuthenticator` can validate those tokens. """ from contextlib import suppress from dataclasses import dataclass, field from datetime import UTC, datetime, timedelta fr...
SwissDataScienceCenter/renku-data-services
components/renku_data_services/authn/renku.py
.py
900d0e00d9fc15a5
7.48
8
"""Authorization configurations.""" import os from dataclasses import dataclass, field from authzed.api.v1 import AsyncClient, SyncClient from grpcutil import bearer_token_credentials, insecure_bearer_token_credentials @dataclass class AuthzConfig: """The configuration for connecting to the authorization databa...
SwissDataScienceCenter/renku-data-services
components/renku_data_services/authz/config.py
.py
afb1e322fd39dffe
7.48
8
"""Models for authorization.""" from dataclasses import dataclass from enum import Enum, StrEnum from ulid import ULID from renku_data_services.base_models.core import ResourceType from renku_data_services.errors import errors from renku_data_services.namespace.apispec import GroupRole class Role(Enum): """Mem...
SwissDataScienceCenter/renku-data-services
components/renku_data_services/authz/models.py
.py
f680325f1fbe7a75
7.48
8
"""SQLAlchemy schemas for the CRC database.""" from typing import Optional from sqlalchemy import Identity, Integer, MetaData, String from sqlalchemy.orm import DeclarativeBase, Mapped, MappedAsDataclass, mapped_column class BaseORM(MappedAsDataclass, DeclarativeBase): """Base class for all ORM classes.""" ...
SwissDataScienceCenter/renku-data-services
components/renku_data_services/authz/orm.py
.py
faf4ed59e924ed68
7.48
8
"""Authentication decorators for Sanic.""" import asyncio import re from collections.abc import Callable, Coroutine from functools import wraps from typing import Any, Concatenate, ParamSpec, TypeVar, cast from sanic import Request from renku_data_services import errors from renku_data_services.base_models import An...
SwissDataScienceCenter/renku-data-services
components/renku_data_services/base_api/auth.py
.py
7452fd45c812ebad
7.48
8
"""Custom blueprint wrapper for Sanic.""" from collections.abc import Callable from dataclasses import dataclass, field from inspect import getmembers, ismethod from typing import cast from sanic import Blueprint from sanic.models.handler_types import RequestMiddlewareType, ResponseMiddlewareType, RouteHandler @dat...
SwissDataScienceCenter/renku-data-services
components/renku_data_services/base_api/blueprint.py
.py
6289c1e2a7940f74
7.48
8
"""The error handler for the application.""" import os import sys import traceback from asyncio import CancelledError from collections.abc import Mapping, Set from sqlite3 import Error as SqliteError from typing import Any, Optional, Protocol, TypeVar, Union import httpx import jwt import sentry_sdk from asyncpg impo...
SwissDataScienceCenter/renku-data-services
components/renku_data_services/base_api/error_handler.py
.py
aa515c107dc9ddd3
7.48
8
"""Common blueprints.""" from collections.abc import Awaitable, Callable, Coroutine from dataclasses import dataclass from functools import wraps from typing import Any, Concatenate, NoReturn, ParamSpec, TypeVar, cast from pydantic import BaseModel from sanic import Request, json from sanic.response import JSONRespon...
SwissDataScienceCenter/renku-data-services
components/renku_data_services/base_api/misc.py
.py
93b782099e5b41f5
7.48
8
"""Classes and decorators used for paginating long responses.""" from collections.abc import Callable, Coroutine, Sequence from functools import wraps from math import ceil from typing import Any, Concatenate, NamedTuple, ParamSpec, TypeVar, cast from sanic import Request, json from sanic.response import JSONResponse...
SwissDataScienceCenter/renku-data-services
components/renku_data_services/base_api/pagination.py
.py
643168993c90fc64
7.48
8
""" Tests for the main module. Copyright (C) 2026 "Daniel Mizsak" <daniel@mizsak.com> """ from python_package_template.main import add_five, subtract_three def test_add_five() -> None: assert add_five(5) == 10 assert add_five(0) == 5 assert add_five(-5) == 0 def test_subtract_three() -> None: asse...
daniel-mizsak/python-package-template
tests/main_test.py
.py
847e35cb23c82208
7.48
8