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
"""Kategori filtre aşaması: ignore_categories.txt'teki desenlere uyan kategorileri atlar.""" from __future__ import annotations import logging import unicodedata from bookdata.models import Category logger = logging.getLogger(__name__) _TURKISH_TO_ASCII = str.maketrans("çğıöşüÇĞİÖŞÜ", "cgiosuCGIOSU") def _normal...
fzozyurt/BookStoresDatasets
src/bookdata/pipeline/filter.py
.py
8eb59888c410ade5
7
0
"""Standardizasyon aşaması: ham sayfa verisini ortak `Product` şemasına dönüştürür. Fiyat metnini ("53,30 TL", "1.234,50") sayıya çevirir, URL'leri temizler ve URL bazında kopya ürünleri ayıklar. Adapter'lar bu mantığı içermez. """ from __future__ import annotations import logging import re from datetime import UTC,...
fzozyurt/BookStoresDatasets
src/bookdata/pipeline/standardize.py
.py
29b3d4727f01a7e0
7
0
#!/usr/bin/env python3 """ Generate separate requirements.txt files for each profile in pyproject.toml. This prevents dependency conflicts during WhiteSource scanning. """ import re import sys import os from collections import defaultdict from packaging import version import toml def parse_dependency(dep_string): ...
SolaceDev/solace-public-workflows
.github/scripts/consolidate_requirements.py
.py
7013e6051067f578
7.15
1
#!/usr/bin/env python3 """Shared helpers for CI payload construction and parsing.""" from __future__ import annotations import json from pathlib import Path from typing import Any def to_bool(raw: str | None, default: bool = False) -> bool: """Convert common CI string booleans to Python bool.""" if raw is N...
SolaceDev/solace-public-workflows
common/ci_payload.py
.py
1367b4748391f177
7.15
1
#!/usr/bin/env python3 """ Test runner for generate-github-release-notes action """ import os import subprocess import sys from pathlib import Path def run_command(cmd, cwd=None, check=True): """Run a command and return the result""" print(f"Running: {' '.join(cmd)}") try: result = subprocess.run...
SolaceDev/solace-public-workflows
generate-github-release-notes/tests/run_tests.py
.py
9b52e38dd5bef95f
7.65
1
#!/usr/bin/env python3 import json import os import sys import unittest from pathlib import Path from unittest.mock import patch, MagicMock # Add the parent directory to the path so we can import the script sys.path.insert(0, str(Path(__file__).parent.parent)) # Import the script as a module import importlib.util s...
SolaceDev/solace-public-workflows
generate-github-release-notes/tests/test_simple.py
.py
3f73d30eb2953c5a
7.65
1
"""The one thing this program stores.""" from __future__ import annotations import datetime from dataclasses import dataclass # The categories, and the order they are offered in. Kept here rather than in # the UI because the CSV stores the category name verbatim: change a label and # you orphan every row already wri...
eimaieros/Personal-Finance-Tracking-App
expense.py
.py
5b86e0d09975192e
7
0
"""A terminal expense tracker. Written in February 2025 as one of my first Python programs, and revisited since. The revisit is documented in the README: the bugs it had are more interesting than the code it is. """ from __future__ import annotations import calendar import csv import datetime import sys from pathlib...
eimaieros/Personal-Finance-Tracking-App
expense_tracker.py
.py
dadbe42da65f5802
7
0
#!/usr/bin/env python3 """Count the tests, and hold the README to what it says. WHY THIS EXISTS. The README states the number of tests in three places: a badge, a comment next to the pytest command, and a line in the file table. Three copies of one fact, and nothing re-measuring any of them. They drifted. The suite ...
eimaieros/Personal-Finance-Tracking-App
tools/contagem.py
.py
3d4baaadb3621f27
7
0
import requests from datetime import datetime import os # URL of the JSON data url = "https://allowlists.grafana.com/synthetics" # Directory to save output files output_dir = "output_files" def format_value(value): """Formats the value for writing as plain text.""" if isinstance(value, dict): # Conve...
ar3thien/grafana-synthetic-cidr-parser
parser.py
.py
10e92352acf4d39e
7
0
import logging from typing import Optional from fastapi import APIRouter, BackgroundTasks, Depends, HTTPException, Query from fastapi.security import HTTPBasic from app.api.v1.auth import verify_credentials from app.api.v1.utils import create_response, sanitize_for_json from app.services.admin_service import ( Ad...
geobtaa/api
backend/app/api/v1/admin.py
.py
2ae1ae0729a12c3f
7.3
3
""" Utilities for advanced multi-field search functionality. """ from typing import List, Optional from fastapi import HTTPException # Valid boolean operators VALID_OPERATORS = {"AND", "OR", "NOT"} def validate_advanced_query_clause(clause: dict) -> dict: """Validate and normalize a single advanced query claus...
geobtaa/api
backend/app/api/v1/advanced_search_utils.py
.py
845ce65c629acf35
7.3
3
import json from typing import Optional import aiohttp from fastapi import HTTPException, Query from fastapi.responses import HTMLResponse, JSONResponse from sqlalchemy.sql import select from app.api.schemas import MetadataBlockResponse, ResourceMetadataResponse from app.api.v1.utils import filter_empty_values, sanit...
geobtaa/api
backend/app/api/v1/endpoint_modules/resources/metadata.py
.py
a9737640db1ca264
7.3
3
import io import logging import os from fastapi import APIRouter, HTTPException, Request from fastapi.responses import Response from PIL import Image from app.api.errors import PUBLIC_ERROR_RESPONSES from app.services.cache_service import ( alias_redirect_cache_control_header, cache_control_header, immuta...
geobtaa/api
backend/app/api/v1/endpoint_modules/thumbnails.py
.py
392058660974e76a
7.3
3
import json from datetime import datetime from typing import Any from fastapi.responses import JSONResponse def datetime_handler(obj): """Handle datetime serialization.""" if isinstance(obj, datetime): return obj.isoformat() raise TypeError(f"Object of type {type(obj)} is not JSON serializable") ...
geobtaa/api
backend/app/api/v1/jsonp.py
.py
f05bd70dd57bd2b3
7.3
3
#!/usr/bin/env python3 """ @Time : 2026-03-13 @Author : Rey @Contact : reyxbo@163.com @Explain : Ali website base methods. """ from alibabacloud_dypnsapi20170525.client import Client as AliClient from alibabacloud_tea_openapi.models import Config as AliConfig from alibabacloud_credentials.models import Config as ...
reyxbo/reyclient-py
src/reyclient/rali/rbase.py
.py
b9498d0c6ac77fe1
7
0
#!/usr/bin/env python3 """ @Time : 2024-01-11 @Author : Rey @Contact : reyxbo@163.com @Explain : Baidu website translate methods. """ from typing import TypedDict from enum import StrEnum from reydb import rorm, DatabaseEngine from reykit.rbase import throw from reykit.rnet import request as reykit_request from r...
reyxbo/reyclient-py
src/reyclient/rbaidu/rtranslate.py
.py
78801ae5e22672e3
7
0
#!/usr/bin/env python3 # Retrieve new jobs from the online form and validate # Update with new jobs # Also check for expiration and remove these from the site # Copyright @vsoch, 2020-2023 import os import requests import icalendar import yaml import json here = os.path.dirname(os.path.abspath(__file__)) def get_f...
hpc-social/events
v1/scripts/check_feeds.py
.py
fe53501c6c8f6fbe
7
0
#!/usr/bin/env python3 # Retrieve new jobs from the online form and validate # Update with new jobs # Also check for expiration and remove these from the site # Copyright @vsoch, 2020-2023 import os import copy import datetime import requests import yaml import urllib import json import pytz import sys import icalend...
hpc-social/events
v1/scripts/update_events.py
.py
add1d67b05be2b7d
7
0
#!/usr/bin/env python3 import os import yaml import requests from datetime import datetime from pathlib import Path from xml.etree import ElementTree from collections import Counter def load_config(): """Load and validate feed configuration from config.yml""" with open('config.yml', 'r') as f: config =...
NiloCK/pcm
update_feeds.py
.py
3287cf2554dc277b
7
0
#!/usr/bin/env python # -*- coding: UTF-8 -*- import sys import crawl.bing as bing import crawl.plmeizi as plmei import crawl.todbi as todbi import crawl.wilii as wilii import crawl.xinac as xinac import crawl.story as story import datal.sqllite as sqllite import utils.date as date """ 生成单个项目中的使用到的安装包文件 requireme...
wefashe/bing-image
code/action.py
.py
22416c2bf490ac42
7
0
#!/usr/bin/env python # -*- coding: UTF-8 -*- import os import re import json import requests from faker import Factory from bs4 import BeautifulSoup import sys from datetime import datetime, timedelta sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))) import utils.date as date_utils # http...
wefashe/bing-image
code/crawl/bing.py
.py
64eef4abb4f2bb16
7
0
#!/usr/bin/env python # -*- coding: UTF-8 -*- import os import json import requests from faker import Factory import sys sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))) fc = Factory.create() STORIES_PATH = os.path.join( os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpat...
wefashe/bing-image
code/crawl/story.py
.py
408e88a248096dd4
7
0
#!/usr/bin/env python # -*- coding: UTF-8 -*- import os import json import requests from faker import Factory import sys sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))) import utils.date as date # https://bing.wilii.cn 网站爬虫 fc = Factory.create() def get_image_listByPage(pageIndex=1, p...
wefashe/bing-image
code/crawl/wilii.py
.py
a98a8a1dc8ca58e5
7
0
import streamlit as st import datetime import requests from data.data_utils import process_and_upload_text # Hugging Face Whisper API configuration WHISPER_API_URL = "https://api-inference.huggingface.co/models/openai/whisper-large-v3-turbo" HF_TOKEN = st.secrets["HF_TOKEN"] WHISPER_HEADERS = {"Authorization": f"Beare...
adrian-saez-martinez/my-clone
admin/admin_page.py
.py
0e68f17c21016499
7
0
from langchain_chroma import Chroma from langchain_openai import OpenAIEmbeddings from langchain_core.tools import tool from dotenv import load_dotenv # Load environment variables from .env file load_dotenv() # Constants for environment and database DB_PATH = "./chroma_databases/allinfo_db" DEBUG = False # Initializ...
adrian-saez-martinez/my-clone
chains/retriever_chain.py
.py
514f641bd324c176
7
0
import requests import streamlit as st import os import glob from data.data_utils import process_and_upload_text # Hugging Face Whisper API WHISPER_API_URL = "https://api-inference.huggingface.co/models/openai/whisper-large-v3-turbo" HF_TOKEN = st.secrets["HF_TOKEN"] WHISPER_HEADERS = {"Authorization": f"Bearer {HF_TO...
adrian-saez-martinez/my-clone
data/bulking_process_audios.py
.py
a949e5997e8a742f
7
0
import sys import os # Check if running in Streamlit Cloud if os.getenv("CLOUD_SERVER") == "true": __import__('pysqlite3') sys.modules['sqlite3'] = sys.modules.pop('pysqlite3') import streamlit as st from langchain_chroma import Chroma from langchain_community.embeddings import HuggingFaceEmbeddings from ...
adrian-saez-martinez/my-clone
pages/3_chatbot.py
.py
7b221b0413cc8d94
7
0
import sys import streamlit as st from langchain_chroma import Chroma from langchain_community.embeddings import HuggingFaceEmbeddings from langchain_huggingface import HuggingFaceEndpoint from langchain.prompts import ( ChatPromptTemplate, SystemMessagePromptTemplate, HumanMessagePromptTemplate, ) from lan...
adrian-saez-martinez/my-clone
pages/chatbot_old.py
.py
d277657f6cdf5822
7
0
from langchain_chroma import Chroma from langchain_community.embeddings import HuggingFaceEmbeddings from langchain.chains import RetrievalQA from langchain_huggingface import HuggingFaceEndpoint import streamlit as st # Environment Variables LLM_MODEL_REPO_ID = "mistralai/Mistral-7B-Instruct-v0.3" HF_TOKEN = st.secr...
adrian-saez-martinez/my-clone
tests/test_retriever.py
.py
c2e1d0272226ce1a
7.5
0
from langchain_chroma import Chroma from langchain_community.embeddings import HuggingFaceEmbeddings from langchain.chains import RetrievalQA from langchain_huggingface import HuggingFaceEndpoint import streamlit as st # Environment Variables LLM_MODEL_REPO_ID = "mistralai/Mistral-7B-Instruct-v0.3" HF_TOKEN = st.secre...
adrian-saez-martinez/my-clone
tests/testing_chatbot.py
.py
78c24431091fc47d
7.5
0
from langchain_chroma import Chroma from langchain_community.embeddings import HuggingFaceEmbeddings from langchain_huggingface import HuggingFaceEndpoint from langchain.prompts import ( ChatPromptTemplate, SystemMessagePromptTemplate, HumanMessagePromptTemplate, ) from langchain.chains import LLMChain impo...
adrian-saez-martinez/my-clone
tests/testing_chatbot_2.py
.py
2525406222158570
7.5
0
#!/usr/bin/env python3 """Detect duplicate env keys across an app's env_refs sources, from ciphertext. SOPS's dotenv output format only encrypts values, not key names (`DOMAIN=ENC[...]`), so this needs no decryption at all - it runs in CI, before anything is pushed to the target host, on files whose private key CI nev...
rubykatzen/flightdeck
deploy/collisions.py
.py
881a65b7df86816b
7
0
#!/usr/bin/env python3 """Pure-Python equivalent of `envsubst` for rendering config templates on the runner (values are already known there post-decryption; no need to push plaintext to the host just to shell out to envsubst there). Matches real envsubst's actual behavior: only `$VAR`/`${VAR}` shell-identifier referen...
rubykatzen/flightdeck
deploy/render.py
.py
6d481bacf6451e43
7
0
#!/usr/bin/env python3 """Decrypt SOPS-encrypted dotenv vault assets on the runner. Symmetric counterpart to encrypt-env/action.yml's `sops encrypt` call - same dotenv input/output type, same tool, just decrypt instead of encrypt. """ import os import subprocess class VaultError(Exception): pass def decrypt_en...
rubykatzen/flightdeck
deploy/vault.py
.py
bc375476809269c5
7
0
from unittest import result from aigyminsper.search.search_algorithms import AEstrela from aigyminsper.search.graph import State import math class Puzzle8(State): objetivo = [[1,2,3],[8,0,4],[7,6,5]] def __init__(self, tabuleiro, op): """ In the init method, we set the initial variables: ...
Insper/ai_gym
docs/src/Puzzle8.py
.py
4422dd274b01bc3b
7.3
3
from aigyminsper.search.search_algorithms import BuscaCustoUniforme from aigyminsper.search.graph import State class U2(State): def __init__(self, bono, edge, adam, larry, lanterna, op): """ In the init method, we set the initial variables: `bono`, `edge`, `adam`, `larry` and `latern` are ...
Insper/ai_gym
docs/src/U2.py
.py
31d1a180a29b978e
7.3
3
from aigyminsper.search.search_algorithms import BuscaProfundidadeIterativa, AEstrela from aigyminsper.search.graph import State import numpy import sys # Importação das bibliotecas necessárias # Utilizaremos a Busca em Profundidade Iterativa neste exemplo, e a classe base State class VacuumWorldGeneric(State): d...
Insper/ai_gym
docs/src/VacuumWorldGeneric.py
.py
5e2ab206c082aa71
7.3
3
import abc import enum from typing import Any, Self class RawCatalog(enum.Enum): """ Enum that represents the catalogs in their original form. They are stored in two forms: one is the unaggregated collection of original data on layer 1 and the other is the aggregated data on layer 2. """ ICRS...
HyperLEDA/db-app
app/data/model/interface.py
.py
b3c0f006047f19d3
7
0
"""Shared base entity for Stopfinder student entities. Every entity in this integration is bound to a single student key (str(rider_id)) and shares the same device grouping, coordinator-data lookup, and availability rule. """ from __future__ import annotations from collections.abc import Callable, Iterable from home...
steveredden/ha_stopfinder
custom_components/stopfinder/entity.py
.py
5e926bd7ed931f3a
7.15
1
"""Benchmark robust regression on 1M rows for ``linear_residual`` fit alternatives. User constraint: pick the fastest robust variant and ship ONLY that one (plus plain OLS) as a registered transform. Slow methods (typically Theil-Sen at O(n^2)) must NOT enter the production registry. Tested variants: - ``ols_lstsq``:...
fingoldo/mlframe
benchmarks/bench_robust_linres_1M.py
.py
6d6b1619ad732301
7.15
1
"""Profile harness for composite-target hotfixes 1/2/3 + R3.18 multilabel. Profiles: A. Raw-y baseline gate (_tiny_cv_rmse_raw_y + tiny_model_rerank gate logic) B. Hint precompute + per-target config clone (model_copy) C. Multilabel expansion (2-D -> k 1-D in target_by_type) D. Plot helpers (per_fold_rmse, per...
fingoldo/mlframe
benchmarks/profile_composite_new_code.py
.py
ab2dc39070830edd
7.15
1
"""Bench short-circuit any-isinf vs np.isinf(arr).any(). bench-attempt-rejected (2026-05-21, c0095 / iter141): numba @njit short-circuit-and-skip-bool-alloc is 24-51% SLOWER on CLEAN (no inf) arrays -- the production-dominant case in ensure_no_infinity_pd: CLEAN n= 100000: numpy= 28.0us numba= 57.4us (0.49x) ...
fingoldo/mlframe
profiling/bench_any_isinf_short_circuit.py
.py
5da90837b109a79e
7.15
1
"""Bench audit_residuals math: numpy vs numba (seq + par) vs cupy (iter129, 2026-05-21). Per user request "пойди еще дальше, попробуй njit, parallel, cuda, cupy": CPU bench results (mean / std / skew / kurt / pct_outliers_3sigma pipeline only): n=50_000 numpy: 2.4 ms numba seq: 0.21 ms (~11x) numba pa...
fingoldo/mlframe
profiling/bench_audit_residuals_kernels.py
.py
1a756c1e945683da
7.15
1
"""Bench baseline_diagnostics._sample at the production call shape. c0052 iter168 profile attributed 322ms / 1 call to _sample at n=100k. Default config.sample_n=50_000. Hot path: idx = rng.choice(n, size=sample_n, replace=False) idx.sort() X.iloc[idx].reset_index(drop=True) y[idx] The .choice(replace...
fingoldo/mlframe
profiling/bench_baseline_diagnostics_sample.py
.py
65e1624cf13deb1d
7.15
1
"""A/B correctness + speed check for the fused auc/brier/log_loss/ece batch bootstrap (2026-07-31). Compares ``bootstrap_auc_brier_ll_ece_batch`` (one prange-parallel njit pass over the whole bootstrap distribution) against ``bootstrap_metrics`` (the generic per-resample Python-dispatch loop honest_diagnostics.py curr...
fingoldo/mlframe
profiling/bench_bootstrap_fused_binary_bundle.py
.py
3c2f3a0a365f5b9a
7.15
1
"""Bench _vectorized_bootstrap_logloss_samples: log+clip BEFORE vs AFTER gather (iter118). The shipped refactor moves the per-element log-loss computation (np.clip + 2x np.log + np.where) BEFORE the (n_resamples, n) bootstrap-index gather, so each elementwise op runs on the (n,) / (n, K) input ONCE instead of on the g...
fingoldo/mlframe
profiling/bench_bootstrap_logloss_pre_gather.py
.py
b1c21936316cbffd
7.15
1
"""A/B bench for bootstrap_metric's vectorized-batch per-row-fast-path (2026-07-31). bootstrap_metric's per-row-fast-path (RMSE / Brier / log-loss's mean-decomposable metrics, when jackknife_per_row is registered and unstratified) drew one resample index array per Python-level loop iteration, gathering + reducing it i...
fingoldo/mlframe
profiling/bench_bootstrap_metric_prow_batch.py
.py
0162f05a0508dab6
7.15
1
"""A/B bench: constrained vs None vs None+adjust on the canonical 2-panel calibration plot (scatter + histogram + colorbar spanning both axes). Wave 4 1M-row fuzz aggregate attributed 146 s of wall across 108 calls to ``show_calibration_plot`` (1.35 s / call). All 108 calls build their own ``Figure(layout="constrained...
fingoldo/mlframe
profiling/bench_calibration_layout.py
.py
ed84a877a1f41e0d
7.15
1
"""Bench cb_logits_to_probs_multiclass softmax with (K,N) vs transposed (N,K) input. bench-attempt-rejected (2026-05-22, c0108 / iter165): transpose-and- contiguous-row approach is 11-21% SLOWER at every benchmark size. Modern CPU prefetchers handle stride-N reads well for small K=3-8; the 24-100 MB full-transpose mem...
fingoldo/mlframe
profiling/bench_cb_logits_softmax_layout.py
.py
e364178424d55966
7.15
1
"""Layer 84 profiling: CMIM hotspot identification on a realistic fixture. Fixture: n=2500, ~10 raw + 20 engineered candidates (so p_eng=20 against the raw_X redundancy reference). Profiles a full call to ``score_features_by_cmim`` end-to-end and prints the cProfile tottime ranking truncated to functions inside the ml...
fingoldo/mlframe
profiling/bench_cmim_l84.py
.py
373ec2965a9698c1
7.15
1
"""A/B bench: legacy per-class Python loop vs batched numba kernel for ``compute_probabilistic_multiclass_error`` on 1M-row inputs. Wave 6 fuzz aggregate attributed 23 s of wall-time to this function across 4 combos (60 ms / call * 392 calls). The hot path is ``method='multicrit'`` + ``verbose=False`` which calls...
fingoldo/mlframe
profiling/bench_compute_multiclass_error.py
.py
e6141581bb8b7efd
7.15
1
"""Isolated microbench (Q2): cupy bincount on the FE-MI flat-index workload. The scene MRMR sampler shows ~26% of fit-wall in cupy ``bincount`` -- but that is NOT the histogram kernel: ``cupy.bincount`` runs TWO synchronizing host-blocking validations on every call (``(x < 0).any()`` non-negativity check + ``cupy.max(...
fingoldo/mlframe
profiling/bench_cupy_bincount_sync.py
.py
c89c06f0096649b8
7.15
1
"""Isolated microbench (Q2b): narrow the count-matrix D2H from int64 -> int32. batch_mi_with_noise_gate_cupy D2Hs the (P1, total_size) int64 joint-count matrix (``cp.asnumpy(tile_counts)``) -- the top GPU cost after OPT-D (~16% of scene wall, the 1050 Ti is PCIe-bound). The per-cell count is bounded by n (rows) so it ...
fingoldo/mlframe
profiling/bench_cupy_d2h_narrow.py
.py
d11b9e8e18ba685e
7.15
1
"""Q4 PROTOTYPE: F-contiguous discretize buffers (unit-stride inner loop). Both _quantile_edges_2d_njit and _searchsorted_2d_right_njit iterate for j (cols): for r (rows): arr2d[r, j] For a C-contiguous array, the inner r-loop strides by n_cols (cache-hostile). For an F-contiguous (column-major) array, arr2d[r, j] o...
fingoldo/mlframe
profiling/bench_disc_fcontig.py
.py
dfce5eb7b5a2e32b
7.15
1
"""Empirical grounding study: does the FI-weighted drift score predict MLP harm? User asked 2026-05-22 whether the ``feature_drift_report`` sensor's ``weighted_drift_score = sum(|z_i| * |fi_i|) / sum(|fi_i|)`` actually correlates with MLP catastrophic extrapolation, or whether it's a speculative signal. Hypothesis (H...
fingoldo/mlframe
profiling/bench_drift_fi_vs_model_harm.py
.py
e048ec39e9236ec0
7.15
1
"""Bench ECE score variants: numpy bincount vs numba serial vs numba parallel. iter309 (2026-05-26) follow-up to iter308: comparing alternative backends for ``_ece_score`` to pick the actually-fastest default. Run: ``python profiling/bench_ece_score_variants.py``. """ from __future__ import annotations import time i...
fingoldo/mlframe
profiling/bench_ece_score_variants.py
.py
61fef3cde247c2fa
7.15
1
"""Base configuration file.""" import sys import numpy as np from ml_collections import config_dict # parent directory sys.path.append("..") from utils import constants import os class Config(config_dict.ConfigDict): """Base config file. Attributes: data_dir: str, path to directory with subject ...
TeamXenonDuke/xenon-gas-exchange-consortium
config/base_config.py
.py
6e0e1e835d3392d3
7.35
4
"""Demo configuration file.""" import os import sys from ml_collections import config_dict # parent directory sys.path.append("..") from config import base_config, config_utils from utils import constants class Config(base_config.Config): """Demo config file. Inherit from base_config.Config and override t...
TeamXenonDuke/xenon-gas-exchange-consortium
config/tests/mystery_subj.py
.py
aafd05f8ac9ca6ff
7.85
4
"""Demo configuration file.""" import os import sys from ml_collections import config_dict # parent directory sys.path.append("..") from config import base_config, config_utils from utils import constants class Config(base_config.Config): """Demo config file. Inherit from base_config.Config and override t...
TeamXenonDuke/xenon-gas-exchange-consortium
config/tests/subject01.py
.py
fa824ee998619384
7.85
4
"""Demo configuration file.""" import os import sys from ml_collections import config_dict # parent directory sys.path.append("..") from config import base_config, config_utils from utils import constants class Config(base_config.Config): """Demo config file. Inherit from base_config.Config and override t...
TeamXenonDuke/xenon-gas-exchange-consortium
config/tests/subject02.py
.py
603eeddc4f737383
7.85
4
"""Demo configuration file.""" import os import sys from ml_collections import config_dict # parent directory sys.path.append("..") from config import base_config, config_utils from utils import constants class Config(base_config.Config): """Demo config file. Inherit from base_config.Config and override t...
TeamXenonDuke/xenon-gas-exchange-consortium
config/tests/subject03.py
.py
4e700ec9359c02fd
7.85
4
"""Demo configuration file.""" import os import sys from ml_collections import config_dict # parent directory sys.path.append("..") from config import base_config, config_utils from utils import constants class Config(base_config.Config): """Demo config file. Inherit from base_config.Config and override t...
TeamXenonDuke/xenon-gas-exchange-consortium
config/tests/subject04.py
.py
41f296b25b5bbacd
7.85
4
"""Demo configuration file.""" import os import sys from ml_collections import config_dict # parent directory sys.path.append("..") from config import base_config, config_utils from utils import constants class Config(base_config.Config): """Demo config file. Inherit from base_config.Config and override t...
TeamXenonDuke/xenon-gas-exchange-consortium
config/tests/subject05.py
.py
3012aa30336a582c
7.85
4
"""Demo configuration file.""" import os import sys from ml_collections import config_dict # parent directory sys.path.append("..") from config import base_config, config_utils from utils import constants class Config(base_config.Config): """Demo config file. Inherit from base_config.Config and override t...
TeamXenonDuke/xenon-gas-exchange-consortium
config/tests/subject06.py
.py
875215b520069993
7.85
4
"""Demo configuration file of processing with MRD files.""" import os import sys from ml_collections import config_dict # parent directory sys.path.append("..") from config import base_config, config_utils from utils import constants class Config(base_config.Config): """Demo config file. Inherit from base...
TeamXenonDuke/xenon-gas-exchange-consortium
config/tests/subject07.py
.py
5a6f365decf0e753
7.85
4
""" configure file for pytest """ import pytest def pytest_addoption(parser): """ Add parameters to pytest for 'test_end_to_end.py' Enter the following in terminal: pytest test_end_to_end.py -s --config=<path-to-config> --csv=<path-to-expected-csv> --folder=<path-to-subject-folder> """ parser...
TeamXenonDuke/xenon-gas-exchange-consortium
conftest.py
.py
35f1ba6e926117e3
7.85
4
"""Preprocessing util functions.""" import sys sys.path.append("..") from typing import Any, Dict, Optional, Tuple import ml_collections import numpy as np import logging from utils import constants, recon_utils, signal_utils, spect_utils, traj_utils def gas_contamination_correction( dict_dis: Dict[str, Any],...
TeamXenonDuke/xenon-gas-exchange-consortium
preprocessing.py
.py
9cf2168a018e5c9f
7.35
4
"""Module for calculating and caching Chebyshev polynomials. Also contains helper functions regarding polynomial manipulation. """ from sympy import Poly from sympy.abc import x # Cache the computed polynomials computed_polynomials = [Poly(1, x), Poly(x, x)] def get_nth_chebyshev_polynomial(polynomial_degree: int)...
TeamXenonDuke/xenon-gas-exchange-consortium
recon/cs/polynomial.py
.py
b26121a89f45cf3d
7.35
4
# -*- coding: utf-8 -*- """Machine learning utilities. """ import numpy as np import sigpy as sp __all__ = ['labels_to_scores', 'scores_to_labels'] def labels_to_scores(labels): """Convert labels to scores. Args: labels (array): One-dimensional label array. Returns: array: Score array ...
TeamXenonDuke/xenon-gas-exchange-consortium
recon/cs/sigpy/learn/util.py
.py
aa259242210b5354
7.35
4
# -*- coding: utf-8 -*- """MRI waveform import/export files. """ import numpy as np import struct __all__ = ['signa', 'ge_rf_params', 'philips_rf_params', 'siemens_rf'] def siemens_rf(pulse, rfbw, rfdurms, pulsename, minslice=0.5, maxslice=320.0, comment=None): """Write a .pta text file for Sieme...
TeamXenonDuke/xenon-gas-exchange-consortium
recon/cs/sigpy/mri/rf/io.py
.py
8d5a61ad25ae4d93
7.35
4
# -*- coding: utf-8 -*- """Optimal Control Pulse Design functions. """ from sigpy import backend __all__ = ['blochsim', 'deriv'] def blochsim(rf, x, g): r"""1D RF pulse simulation, with simultaneous RF + gradient rotations. Assume x has inverse spatial units of g, and g has gamma*dt applied and assume x ...
TeamXenonDuke/xenon-gas-exchange-consortium
recon/cs/sigpy/mri/rf/optcont.py
.py
18bf953c382f31a8
7.35
4
import streamlit as st import requests import re from datetime import datetime st.set_page_config(page_title="Interview Assistant", page_icon="🎤", layout="wide") st.markdown(""" <style> .main { background-color: #f5f7fa; } .big-title { font-size: 32px; font-weight: bold; color: #1f1f1f; margin-bottom: 20...
srinivasp0451/gdp-dashboard
interviewanswers.py
.py
89f0d635d9f96846
7
0
# Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. from collections import defaultdict from collections.abc import Iterator import yaml from pydantic import BaseModel, ConfigDict, Field from .charm import Charm, CharmConfigValue, EndpointType from .juju_version import JujuVersion # Mermaid re...
canonical/charm-integration-testing
bundle_builder_x/bundle_builder_x/bundle.py
.py
b1bf93476b4481a9
7.35
4
# Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. import operator from enum import Enum from functools import total_ordering from typing import Callable from pydantic import BaseModel, ConfigDict, Field, field_validator, model_serializer, model_validator from .constraints_dsl import AnyExpr f...
canonical/charm-integration-testing
bundle_builder_x/bundle_builder_x/charm.py
.py
b5533483f289fd1e
7.35
4
# Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. import logging import os from functools import cache from typing import Any import requests import yaml from pydantic import BaseModel, ConfigDict, Field, field_validator from requests.adapters import HTTPAdapter from urllib3.util.retry import ...
canonical/charm-integration-testing
bundle_builder_x/bundle_builder_x/charmhub_http.py
.py
4720e273c166dc48
7.35
4
# Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. """Converts a SpecFile into a Z3 Domain. This module bridges the spec (user input) and domain (solver) layers, owning the translation from spec types to domain types, including Juju version resolution via the Snapstore API. """ import logging ...
canonical/charm-integration-testing
bundle_builder_x/bundle_builder_x/domain_builder.py
.py
f603a99131946b29
7.35
4
# Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. import logging import z3 # type: ignore[import-untyped] from .bundle import Application, ApplicationEndpoint, Bundle, CrossModelIntegration, Integration, Solution from .charm import EndpointType from .domain import Domain, ModelRef def _ext...
canonical/charm-integration-testing
bundle_builder_x/bundle_builder_x/extract.py
.py
2f52d142f0ef29fa
7.35
4
# Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. from dataclasses import dataclass from enum import Enum from typing import Any class ReleaseUnavailableKind(str, Enum): """Stable classifications for release lookup failures.""" MISSING_BASES = "missing_bases" CHANNEL_BASE_UNSUPPO...
canonical/charm-integration-testing
bundle_builder_x/bundle_builder_x/release_errors.py
.py
e28519ce4db091ab
7.35
4
# Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. import logging from .snapstore_http import SnapstoreHttpClient, SnapVersionNotFoundException class SnapstoreClient: http_client: SnapstoreHttpClient logger: logging.Logger def __init__( self, http_client: Snapstor...
canonical/charm-integration-testing
bundle_builder_x/bundle_builder_x/snapstore.py
.py
9c097580b89120e0
7.35
4
# Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. """Spec file models for multi-model bundle building.""" from __future__ import annotations from pathlib import Path from typing import cast import yaml from pydantic import BaseModel, ConfigDict, Field, model_validator class AppSpec(BaseMod...
canonical/charm-integration-testing
bundle_builder_x/bundle_builder_x/spec.py
.py
9b661414375b18b3
7.85
4
# Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. import logging import time from pydantic import BaseModel, ConfigDict class Span(BaseModel): model_config = ConfigDict(frozen=True) label: str start: float duration: float class _SpanToken(BaseModel): full_label: str ...
canonical/charm-integration-testing
bundle_builder_x/bundle_builder_x/timing.py
.py
2fb8c8cabd846fb3
7.35
4
# Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. """Shared test infrastructure for offline logic tests. These tests use a stub CharmhubClient that serves charms from an in-memory registry, making all tests fully offline and deterministic. """ from bundle_builder_x import CharmReleaseNotFound...
canonical/charm-integration-testing
bundle_builder_x/tests/logic/conftest.py
.py
da1aab9fe8423c03
7.85
4
# Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. """Logic tests for minimum observability constraints. Covers Section 9 of charm-deployment-constraints.rst: A charm must have at least N endpoints from a set of M observability endpoints integrated. Real example: grafana-agent-k8s must have a...
canonical/charm-integration-testing
bundle_builder_x/tests/logic/test_min_observability.py
.py
49d4a7649bb6a5d0
7.85
4
# Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. """Logic tests for len(units({self})) unit-count constraints. Covers the `len(units(charm_set)) >= N` DSL constraint which forces the bundle builder to deploy an application with at least N units. Real example: OpenSearch requires a minimum of...
canonical/charm-integration-testing
bundle_builder_x/tests/logic/test_num_units_constraint.py
.py
7605b64aa0a8647b
7.85
4
# Copyright (C) 2026 Canonical Ltd # See LICENSE file for licensing details. """Logic tests for correct app-to-charm ordering when multiple apps share a charm. When two or more applications use the same charm (e.g. mongodb-k8s deployed as both config-server and shard), the solver must correctly determine which applic...
canonical/charm-integration-testing
bundle_builder_x/tests/logic/test_shared_charm_ordering.py
.py
3eb108f47b22a0d9
7.85
4
# Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. """Charm override file validation tests. Parametrized by (charm_name, channel): conftest computes the set of (charm_name, channel) pairs covered by each override file at collection time, applying first-met semantics so each channel maps to exac...
canonical/charm-integration-testing
bundle_builder_x/tests/overrides/test_charm_overrides.py
.py
7650905a16b91a89
7.85
4
# Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. """Unit tests for assertion_tags.py.""" from bundle_builder_x.assertion_tags import ( Assertions, AssertionTag, CharmEndpointPayload, IntegrationFeatureMismatchTag, SubordinateBaseMismatchTag, ) class TestSubordinateBaseMi...
canonical/charm-integration-testing
bundle_builder_x/tests/unit/test_assertion_tags.py
.py
d8c988958e9def60
7.85
4
"""Password hashing and login checks. Passwords are never stored or compared in plain text. Each one is put through PBKDF2-HMAC-SHA256 with a random per-user salt, and the result is stored in a single self-describing field:: pbkdf2_sha256$260000$<salt hex>$<digest hex> Keeping the algorithm and iteration count i...
warsab/Task_Manager
src/task_manager/auth.py
.py
e94e5e20a866f069
7
0
"""Domain models for users and tasks. These are plain dataclasses with no knowledge of files, terminals or hashing, so they can be constructed freely in tests and reused by any front end. """ from __future__ import annotations from dataclasses import dataclass from datetime import date #: Date formats accepted from...
warsab/Task_Manager
src/task_manager/models.py
.py
6eebc7e37323a496
7
0
"""Task statistics and the text reports built from them. Statistics are computed from :class:`~task_manager.models.Task` objects rather than by counting substrings in the data file, which is what makes the numbers trustworthy: a task described as "Yes, do this" no longer counts as complete, and a user named ``sam`` no...
warsab/Task_Manager
src/task_manager/reports.py
.py
431cb3eae454d1d2
7
0
"""Shared fixtures and helpers for the test suite.""" from __future__ import annotations from collections.abc import Callable, Sequence from datetime import date from pathlib import Path import pytest from task_manager.cli import Console from task_manager.demo import seed from task_manager.models import Task from t...
warsab/Task_Manager
tests/conftest.py
.py
48d4dbe85634cd2d
7.5
0
""" Configuration Loader Module Handles loading and validation of configuration """ import yaml import os from typing import Dict, Optional import logging from dotenv import load_dotenv logger = logging.getLogger(__name__) class ConfigLoader: """Loads and manages configuration""" def __init__(self, config_...
Zeeviiii/email-summary-automation
src/config_loader.py
.py
43a0a56315f0b72b
7
0
""" Output Handler Module Handles saving and sending email summaries """ import os import json from datetime import datetime from typing import Dict, List import logging import smtplib from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart logger = logging.getLogger(__name__) class Outp...
Zeeviiii/email-summary-automation
src/output_handler.py
.py
c954dcd5993a7d1c
7
0
"""Shared fixtures for the test suite.""" import sys from pathlib import Path import pytest import yaml sys.path.insert(0, str(Path(__file__).resolve().parents[1])) @pytest.fixture def valid_config(): """A minimal configuration that passes validation.""" return { "email": { "imap_server...
Zeeviiii/email-summary-automation
tests/conftest.py
.py
cd994ffd11f81f3b
7.5
0
from enum import Enum from typing import Dict, Tuple, List from datetime import datetime from pytz import timezone, utc from manager_environment import EnvironmentManager as EM from manager_file import FileManager as FM DAY_TIME_EMOJI = ["🌞", "🌆", "🌃", "🌙"] # Emojis, representing different times of day. DAY_TI...
KaanEnt/Time-Tracking
sources/graphics_list_formatter.py
.py
a19ab9eaa6a9ea29
7
0
from os.path import join, isfile, dirname from pickle import load as load_pickle, dump as dump_pickle from json import load as load_json from typing import Dict, Optional, Any from manager_environment import EnvironmentManager as EM def init_localization_manager(): """ Initialize localization manager. Lo...
KaanEnt/Time-Tracking
sources/manager_file.py
.py
4393725ffb85b979
7
0
from base64 import b64encode from os import environ, makedirs from os.path import dirname, join from random import choice from re import sub from shutil import copy, rmtree from string import ascii_letters from git import Repo, Actor from github import Github, AuthenticatedUser, Repository from manager_environment im...
KaanEnt/Time-Tracking
sources/manager_github.py
.py
a88281e04f3623f9
7
0
#!/usr/bin/env python3 """ Build a stratified, threshold-biased review queue from large-turn exit event CSVs. Usage examples: python build_turn_review_queue.py \ --inputs per_fly_turn_exit_tables/*.csv \ --out review_queue.csv \ --seed 123 \ --weaving-max-outside 1.5 \ --tangent-thresh ...
rcalfredson/nvsl-analysis
scripts/build_turn_review_queue.py
.py
2d675a209851f73a
7.15
1
""" Script for processing per-fly large turn data raw data (obtained by running the analyze script using the --dump-large-turn-exits flag) """ import matplotlib.pyplot as plt from pathlib import Path from collections import defaultdict import pandas as pd CATEGORY_ORDER = [ "weaving", "backward_walking", ...
rcalfredson/nvsl-analysis
scripts/calc_lg_turn_ratios.py
.py
081d2cfa061e6c9c
7.15
1