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
"""Rewrite a generated bk expression module as a redshift-monomial coefficient table. Every term of the bispectrum factorises into a product of redshift scalars and a factor built only from the triangle geometry and the power spectrum: B = sum_m C_m(k1,k2,k3,ct,st,Pk...) * M_m(d,K,C,f,D1,b1,b2,g2,r,s) C_m moves...
craddis1/CosmoWAP
src/cosmo_wap/bk/table/convert.py
.py
e9ecda910dbee41a
7.59
14
"""Runtime for the redshift-monomial tables: cache the coefficients, contract per call. The table path is deliberately hard to enter by accident. It runs only when * COSMOWAP_BK_TABLE=1 is set, and * a sampler has called set_version() to say which slow (cosmology) state is current. Anything that does not registe...
craddis1/CosmoWAP
src/cosmo_wap/bk/table/runtime.py
.py
03fcb122ab10ba54
7.59
14
""" Base class for posterior analysis methods (Fisher matrices & MCMC samples). Shared functionality for storing parameters and plotting with ChainConsumer. """ from __future__ import annotations import warnings from abc import ABC from typing import TYPE_CHECKING, Any import numpy as np from chainconsumer import Ch...
craddis1/CosmoWAP
src/cosmo_wap/forecast/base_posterior.py
.py
147eed7651a40ec2
7.59
14
""" Holds the class that store fisher matrices - then contains a bunch of routines for plotting and analysing (they are computed in forecast.py) """ import warnings import numpy as np from matplotlib import pyplot as plt from scipy import stats from cosmo_wap.lib.utils import solve_preconditioned from .base_poster...
craddis1/CosmoWAP
src/cosmo_wap/forecast/fisher.py
.py
be6207ae82896d95
7.59
14
""" Batch processing of Fisher matrices across survey cuts and splits. """ import copy from pathlib import Path import matplotlib.colors as mcolors import numpy as np from matplotlib import pyplot as plt from .base_posterior import BasePosterior class FisherList(BasePosterior): """ Class to store and handl...
craddis1/CosmoWAP
src/cosmo_wap/forecast/fisher_list.py
.py
90ef4a3f807996cd
7.59
14
""" Adapted from URLExtract - https://github.com/lipoja/URLExtract Originally created by Jan Lipovský <janlipovsky@gmail.com>, janlipovsky.cz """ import re import string from collections import OrderedDict from collections.abc import Generator from urllib.parse import ParseResult, urlparse class URLExtract: # co...
natecohen/microsoft-ips
urlextract.py
.py
fa75e2eeeef5099d
7.59
14
""" On inbound SMS (MO), send a reply (MT) to the same number: "Your message said: <text>". Uses channel identity (SMS + phone number) only; app is in DISPATCH mode. """ from sinch.domains.conversation.models.v1.sinch_events import MessageInboundEvent def handle_conversation_event(event, logger, sinch_client): "...
sinch/sinch-sdk-python
examples/getting-started/conversation/send_handle_incoming_sms/server_business_logic.py
.py
b2e237fce715e0ee
7.48
8
from sinch.domains.conversation.models.v1.sinch_events import ( ConversationSinchEventBase, MessageDeliveryReceiptEvent, MessageInboundEvent, MessageSubmitEvent, ) def handle_conversation_event(event: ConversationSinchEventBase, logger): """ Dispatch a Conversation Sinch Event to the appropria...
sinch/sinch-sdk-python
examples/sinch_events/conversation_api/server_business_logic.py
.py
09ece290c975a917
7.48
8
from pathlib import Path from sinch import SinchClient from dotenv import dotenv_values def load_config() -> dict[str, str]: """ Load configuration from the .env file in the sinch_events directory. Returns: dict[str, str]: Dictionary containing configuration values """ # Get the directory...
sinch/sinch-sdk-python
examples/sinch_events/sinch_client_helper.py
.py
ff83e326fb49f615
7.48
8
"""Example: Using Amplitude Quality Coach for Threshold Tuning. This example demonstrates how to use the amplitude quality coaching feature to understand data quality, identify problematic channels, and tune voltage thresholds appropriately for artifact rejection. The amplitude quality coach provides interpretable di...
cincibrainlab/autocleaneeg_pipeline
examples/amplitude_quality_coach_example.py
.py
d5317b956a2a787a
7.45
7
#!/usr/bin/env python3 """Example: Custom ML-Based Artifact Detection Plugin This example demonstrates the CORRECT use of the plugin system: - Extends pipeline functionality (doesn't duplicate existing mixins) - Imports helper functions from pipeline (zero code duplication) - Provides new capability not available in c...
cincibrainlab/autocleaneeg_pipeline
examples/custom_artifact_detector_plugin.py
.py
7cb08cce421e34e9
7.45
7
"""Example: Using Event Discovery Helper for EEG Epoching Configuration. This example demonstrates how to use the print_discovered_events() method to understand what events are available in your EEG data and configure your epoching parameters correctly. The event discovery feature helps solve the common problem where...
cincibrainlab/autocleaneeg_pipeline
examples/event_discovery_example.py
.py
591dff1958230294
7.45
7
#!/usr/bin/env python3 """Example demonstrating ICA sources caching for improved performance. This example shows how the new caching system dramatically improves performance when generating multiple ICA reports by avoiding redundant source computations. """ import time import numpy as np import mne from mne.preproces...
cincibrainlab/autocleaneeg_pipeline
examples/ica_caching_example.py
.py
481113d2a41b0d95
7.45
7
#!/usr/bin/env python3 """ Local code quality checker for AutoClean EEG Pipeline using uv tool. This script runs the same code quality checks that are performed in CI, allowing developers to fix issues locally before committing. Uses uv tool run for isolated tool execution without installation conflicts. """ import a...
cincibrainlab/autocleaneeg_pipeline
scripts/check_code_quality.py
.py
9f11850390169f65
7.45
7
#!/usr/bin/env python3 """ Install development tools for AutoClean EEG Pipeline using uv tool. This script installs all the code quality tools needed for local development using uv tool for isolated tool management. Each tool runs in its own environment to prevent dependency conflicts. """ import shutil import subpro...
cincibrainlab/autocleaneeg_pipeline
scripts/install_dev_tools.py
.py
0977ca9afb3da370
7.45
7
#!/usr/bin/env python3 """Run pytest with early warning filters for noisy third-party imports.""" from __future__ import annotations import sys import warnings def _install_warning_filters() -> None: try: from pyparsing.warnings import PyparsingDeprecationWarning except Exception: return ...
cincibrainlab/autocleaneeg_pipeline
scripts/run_pytest.py
.py
4401a78d4872fe9b
7.95
7
#!/usr/bin/env python3 """ UV tool management script for AutoClean EEG Pipeline. This script provides easy management of development tools using uv tool, including installation, upgrading, and listing of tools. """ import argparse import shutil import subprocess import sys from typing import List, Tuple def run_uv_...
cincibrainlab/autocleaneeg_pipeline
scripts/uv_tools.py
.py
a568c65f58065e9c
7.45
7
"""WebSocket event broadcasting for live updates.""" from __future__ import annotations import asyncio from datetime import datetime, timezone from typing import Any, Optional, Set from fastapi import APIRouter, WebSocket, WebSocketDisconnect from autoclean.api.models import Event, EventType router = APIRouter() ...
cincibrainlab/autocleaneeg_pipeline
src/autoclean/api/events.py
.py
86bb3e2221c5c48c
7.45
7
"""Pydantic models for API request/response schemas.""" from __future__ import annotations from enum import Enum from typing import Any, Optional from pydantic import BaseModel, ConfigDict, Field class QueueStatus(str, Enum): """Queue entry status. - pending: File discovered, waiting to be processed -...
cincibrainlab/autocleaneeg_pipeline
src/autoclean/api/models.py
.py
11ff2b29e2755e7f
7.45
7
"""Single-file event analyzer. Mirrors the CLI `events discover` and `events analyze` commands. Loads a raw EEG file with MNE, extracts events, and returns the same EventsResponse format used by the Results Events tab. """ import asyncio import logging import statistics from collections import Counter from pathlib im...
cincibrainlab/autocleaneeg_pipeline
src/autoclean/api/routes/event_analyzer.py
.py
0b20692a5f1fe676
7.45
7
"""Queue management API routes.""" from __future__ import annotations from typing import Optional from fastapi import APIRouter, HTTPException, Query from autoclean.api.models import ( ClearResponse, EnqueueRequest, EnqueueResponse, QueueEntriesResponse, QueueEntry, QueueStats, QueueStat...
cincibrainlab/autocleaneeg_pipeline
src/autoclean/api/routes/queue.py
.py
1284493cdcd6b7e2
7.45
7
"""Tutorial setup and cleanup endpoints. Provides a guided onboarding experience by generating synthetic EEG data and setting up a sample processing route. """ from __future__ import annotations import asyncio import logging import shutil from pathlib import Path from typing import Any from fastapi import APIRouter...
cincibrainlab/autocleaneeg_pipeline
src/autoclean/api/routes/tutorial.py
.py
ed9af1aeff014855
7.45
7
"""API state management - separate module to avoid circular imports.""" from __future__ import annotations from pathlib import Path from typing import Any, Optional from fastapi import HTTPException class APIState: """Global API state container.""" def __init__(self) -> None: self.workspace_dir: O...
cincibrainlab/autocleaneeg_pipeline
src/autoclean/api/state.py
.py
7e9c1cd638c63760
7.45
7
"""Helpers for the bundled MATLAB FOOOF block.""" from __future__ import annotations import json from pathlib import Path from typing import Any DEFAULT_FOOOF_FREQS = (1.0, 55.0) DEFAULT_ARTIFACTS_SUBDIR = "matlab/fooof" def resolve_matlab_fooof_context( task_config: dict[str, Any], step_params: dict[str, ...
cincibrainlab/autocleaneeg_pipeline
src/autoclean/blocks/analysis/matlab_fooof/algorithm.py
.py
19a10d8f1da29de4
7.45
7
"""Source-level functional connectivity and graph theory algorithms. This module contains scientifically validated functions for calculating functional connectivity between brain regions from source-localized EEG data and computing graph theory metrics to characterize brain network properties. These functions are EXA...
cincibrainlab/autocleaneeg_pipeline
src/autoclean/blocks/analysis/source_connectivity/algorithm.py
.py
0c53e6ef82dbad19
7.45
7
"""Source connectivity mixin for autoclean tasks. This module provides functionality for calculating functional connectivity between brain regions from source-localized EEG data and computing graph theory metrics. The SourceConnectivityMixin class implements methods for computing connectivity using multiple methods (...
cincibrainlab/autocleaneeg_pipeline
src/autoclean/blocks/analysis/source_connectivity/mixin.py
.py
427e90403dbe0ee1
7.45
7
"""User-facing caveats for template-based EEG source localization.""" from __future__ import annotations from pathlib import Path from typing import Any SOURCE_LOCALIZATION_UNITS = "native_source_units" SOURCE_LOCALIZATION_TEMPLATE = "fsaverage" SOURCE_LOCALIZATION_ATLAS = "Desikan-Killiany (aparc), 68 ROI channels"...
cincibrainlab/autocleaneeg_pipeline
src/autoclean/blocks/analysis/source_localization/caveats.py
.py
53281e34352404e2
7.45
7
"""Source localization mixin using autocleaneeg-eeg2source package. This mixin provides a seamless interface to the autocleaneeg-eeg2source PyPI package for EEG source localization. All processing is delegated to the standalone package, ensuring consistent results and easier maintenance. The mixin always outputs 68-c...
cincibrainlab/autocleaneeg_pipeline
src/autoclean/blocks/analysis/source_localization/mixin.py
.py
75b6d1fda9a1a2d5
7.45
7
"""Source PSD mixin for autoclean tasks. This module provides functionality for calculating power spectral density (PSD) from source-localized EEG data with region-of-interest (ROI) averaging using the Desikan-Killiany atlas. The SourcePSDMixin class implements methods for computing PSD from source estimates (STCs) p...
cincibrainlab/autocleaneeg_pipeline
src/autoclean/blocks/analysis/source_psd/mixin.py
.py
374947f06ec36d17
7.45
7
"""AutoReject epochs cleaning mixin for autoclean tasks. This module provides functionality for cleaning epochs using AutoReject, a machine learning-based method for automatic artifact rejection in EEG data. AutoReject automatically identifies and removes bad epochs and interpolates bad channels within epochs. The Au...
cincibrainlab/autocleaneeg_pipeline
src/autoclean/blocks/signal_processing/autoreject/mixin.py
.py
75f50555e33bbdc4
7.45
7
""" Calculates CH4 response """ import logging import numpy as np from scipy.interpolate import interp1d from scipy.integrate import solve_ivp from .construct_conc import interp_bg_conc from .calc_co2 import N2O_0 # CONSTANTS TAU_GLOBAL = 8.0 CH4_0 = 731.41 # pre-industrial CH4 concentration [ppb] used as reference ...
dlr-pa/oac
openairclim/core/calc_ch4.py
.py
ce4c697270942376
7.63
17
""" Calculates temperature changes for each species and scenario """ import logging import numpy as np # CONSTANTS # # from Boucher & Reddy (2008) # https://doi.org/10.1016/j.enpol.2007.08.039 C_ARR = [0.631, 0.429] # in K / (W m-2) D_ARR = [8.4, 409.5] # in years def calc_dtemp(config, spec, rf_dict): """ ...
dlr-pa/oac
openairclim/core/calc_dt.py
.py
3d60614ea270d2e7
7.63
17
""" Calculates climate metric for each species and scenario """ import numpy as np from .read_netcdf import get_results def calc_climate_metrics(config: dict) -> dict: """Get all combinations of required climate metrics Args: config (dict): Configuration from config file Returns: dict: ...
dlr-pa/oac
openairclim/core/calc_metric.py
.py
6ea66140a30aa72f
7.63
17
""" Calculates responses for each species and scenario """ import logging import numpy as np from .interpolate_space import calc_weights from .calc_swv import calc_swv_rf, calc_swv_mass_conc from .calc_ch4 import calc_pmo_rf from .config_model import OUT_TO_INV_REQUIRED # CONSTANTS # # CORRECTION (normalization) fac...
dlr-pa/oac
openairclim/core/calc_response.py
.py
d12dded922aa630b
7.63
17
""" Constructs concentrations """ from pathlib import Path import numpy as np import xarray as xr from .interpolate_time import interp_linear from .utils import convert_units def get_emissions(inv_dict, species): """Get total emissions in Tg for each inventory and given species Args: species (str): ...
dlr-pa/oac
openairclim/core/construct_conc.py
.py
9cfbbb16daf36887
7.63
17
""" Interpolation and Regridding methods in the space domain """ # TODO Check if one of these python packages are more suitable/flexible # for example geocat, see https://geocat-comp.readthedocs.io/en/stable/ # for pressure level interpolations geocat.comp.interpolation.interp_hybrid_to_pressure # maybe this is a more...
dlr-pa/oac
openairclim/core/interpolate_space.py
.py
36adb6d996d4b0c3
7.63
17
""" Parametric scenario: Adapt emissions of CO2 and RF of other species. Post-processing approach after: MSc thesis: Saleh Walie, Mitigation of aviation's climate impact: a scenario-based parametric study in OpenAirClim, UC3M, 2025 Refactoring and integration of code by Stefan Völk. """ import logging # Default v...
dlr-pa/oac
openairclim/core/parametric.py
.py
36485fe8cab73f53
7.63
17
""" Plot routines for the OpenAirClim framework """ import re from pathlib import Path import matplotlib.pyplot as plt # %config InlineBackend.figure_format='retina' BINS = 50 def plot_inventory_vertical_profiles(inv_dict): """Plots vertical emission profiles of dictionary of inventories Args: inv...
dlr-pa/oac
openairclim/core/plot.py
.py
dc1a7d93bd811e01
7.63
17
""" Reads a config file, checks that it is complete and correct, and creates the output directory. Configuration checking runs in two layers, split across two modules: - **Structural validation** (:mod:`openairclim.core.config_model`) — types, required/optional keys, valid option strings, and defaults, enforced by ...
dlr-pa/oac
openairclim/core/read_config.py
.py
1db6476e669e14a2
7.63
17
""" Methods for reading netCDF input """ from pathlib import Path import logging import numpy as np import xarray as xr from .utils import quantity, UREG, convert_mass_or_annual_rate # CONSTANTS # expected physical dimension of each inventory species' units; species not # listed here default to mass. INV_SPEC_DIMENSI...
dlr-pa/oac
openairclim/core/read_netcdf.py
.py
2e848e280b2041d5
7.63
17
""" Utility functions used over the entire framework """ import re from pathlib import Path import numpy as np import pint UREG: pint.UnitRegistry = pint.UnitRegistry() def find_basenames(path_lst): """Find basenames of a list of paths Args: path_arr (list): List of paths Returns: list...
dlr-pa/oac
openairclim/core/utils.py
.py
667382bb415519af
7.63
17
""" Configure the OpenAirClim GUI. """ def launch( config_path=None, results_path=None, show=True, port=5006, theme="default" ): """Launch the OpenAirClim GUI in the browser. Args: config_path (str or Path, optional): Path to an existing config file to load on startup. Defaults to None...
dlr-pa/oac
openairclim/gui/__init__.py
.py
10e085d8d4339869
7.63
17
"""Assemble the OpenAirClim GUI application.""" from pathlib import Path import panel as pn from . import sidebar from .state import AppState from .tabs import aircraft, config, config_text, results, scenario, inventories def _wire_config_expert_dirty_notification(tabs, state, expert_index): """Warn the user a...
dlr-pa/oac
openairclim/gui/app.py
.py
d6694318a20eec91
7.63
17
"""Helpers for driving GUI widgets off core.config_model's pydantic schema. """ import types from typing import Literal, Union, get_args, get_origin, cast from pydantic import BaseModel from ...core.config_model import Config def _unwrap_optional(annotation): """Strip an `Optional[...]`/`X | None` wrapper off a...
dlr-pa/oac
openairclim/gui/components/schema.py
.py
7ae3071f2a2c1926
7.63
17
"""Provides utility functions for the OpenAirClim GUI.""" from pathlib import Path # define unicode superscripts, rather than using math mode _SUPERSCRIPTS = str.maketrans( "0123456789-", "\u2070\u00b9\u00b2\u00b3\u2074\u2075\u2076\u2077\u2078\u2079\u207b" ) # visual style COLORS = [ "#2271B2", "#3DB7E9...
dlr-pa/oac
openairclim/gui/components/utils.py
.py
8915892be41dc82d
7.63
17
"""Shared reactive application state. All tabs read from and write to a single ``AppState`` instance, which keeps them loosely coupled while sharing data like the validated configuration dictionary and file paths. """ import param class AppState(param.Parameterized): """Observable application state shared acros...
dlr-pa/oac
openairclim/gui/state.py
.py
2f7cef857e3d8700
7.63
17
"""Config (Expert) tab: view and hand-edit the config as raw TOML text. Deliberately does *not* stay in sync with other tabs while the user is typing. The text box is only rebuilt when `state.config_generation` changes (a fresh config was loaded/created, or loaded from this tab's own "Apply to Config" button), matchin...
dlr-pa/oac
openairclim/gui/tabs/config_text.py
.py
b0f96d2406911cac
7.63
17
"""Shared fixtures for the whole test suite. The core purpose is to centralise a single valid configuration dict that can be read by pytest functionality in tests/core and tests/gui. All paths are relative to `tests/core` since core tests with that as its cwd. GUI tests use their own `working_dir` fixture, which also r...
dlr-pa/oac
tests/conftest.py
.py
5a9821c1235e827b
8.13
17
""" Provides tests for module attribution """ from typing import Literal import numpy as np import pytest from openairclim.core import attribution as att def _func_factory( mode: Literal["constant", "linear", "affine"] = "linear", *, scale: float = 1.0, value: float = 1.0, offset: float = 0.0, ):...
dlr-pa/oac
tests/core/attribution_test.py
.py
11664dfa177be553
7.13
17
""" Provides tests for module calc_ch4 """ import numpy as np import xarray as xr import pytest from openairclim.core import calc_ch4 class TestCalcCh4Rf: """Tests function calc_ch4_rf(config, conc_dict, conc_ch4_bg_dict, conc_no2_bg_dict)""" def test_invalid_method(self): """Invalid method returns ...
dlr-pa/oac
tests/core/calc_ch4_test.py
.py
31bc186498f8733a
8.13
17
# # Copyright (c) 2023 Project CHIP Authors # # 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 applicable law or agreed to i...
project-chip/matter-test-scripts
onboarding_payload_test_suite/onboarding_script_support.py
.py
3e87343ed25ebd93
7.15
19
# # Copyright (c) 2023 Project CHIP Authors # # 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 applicable law or agreed to i...
project-chip/matter-test-scripts
onboarding_payload_test_suite/tcdd11/tcdd11.py
.py
7385410585d0d964
7.15
19
# # Copyright (c) 2025 Project CHIP Authors # # 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 applicable law or ag...
project-chip/matter-test-scripts
onboarding_payload_test_suite/tcdd12/tcdd12.py
.py
05acf78e2261e85c
7.15
19
# # Copyright (c) 2023 Project CHIP Authors # # 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 applicable law or agreed to i...
project-chip/matter-test-scripts
onboarding_payload_test_suite/tcdd13/tcdd13.py
.py
09c28b62f8bc17a4
7.15
19
# # Copyright (c) 2023 Project CHIP Authors # # 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 applicable law or agreed to i...
project-chip/matter-test-scripts
onboarding_payload_test_suite/tcdd14/tcdd14.py
.py
e8160bdebd9be3d2
7.15
19
"""Tesy button component.""" from __future__ import annotations from homeassistant.components.button import ButtonEntity, ButtonEntityDescription from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant from homeassistant.exceptions import HomeAssistantError from homeassistant...
krasnoukhov/homeassistant-tesy
custom_components/tesy/button.py
.py
35fb5e9effe90b67
7.66
20
"""Config flow for Tesy integration.""" from __future__ import annotations import logging from typing import Any import voluptuous as vol from homeassistant import config_entries from homeassistant.core import HomeAssistant from homeassistant.data_entry_flow import AbortFlow import homeassistant.helpers.config_vali...
krasnoukhov/homeassistant-tesy
custom_components/tesy/config_flow.py
.py
d421c04f49595ba1
7.66
20
"""DataUpdateCoordinator for the Tesy integration.""" from __future__ import annotations from datetime import timedelta from typing import Any from homeassistant.core import HomeAssistant from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed from .tesy import Tesy from .tesy_oldap...
krasnoukhov/homeassistant-tesy
custom_components/tesy/coordinator.py
.py
b615e5eebb80eeea
7.66
20
"""Base entity for the Tesy integration.""" from __future__ import annotations from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant from homeassistant.helpers.device_registry import DeviceInfo from homeassistant.helpers.entity import EntityDescription from homeassistant.he...
krasnoukhov/homeassistant-tesy
custom_components/tesy/entity.py
.py
010b3e4d33898fc1
7.66
20
"""Tesy switch component.""" from __future__ import annotations from homeassistant.components.switch import ( SwitchEntity, SwitchDeviceClass, SwitchEntityDescription, ) from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_pla...
krasnoukhov/homeassistant-tesy
custom_components/tesy/switch.py
.py
caf5b0bb8b010196
7.66
20
"""Tesy integration.""" from __future__ import annotations import logging from typing import Any from urllib.parse import urlparse, urlencode import requests from .const import ( ATTR_POWER, ATTR_TARGET_TEMP, ATTR_BOOST, ATTR_MODE, ATTR_CHILD_LOCK, ATTR_API, ATTR_ENERGY_RESETTABLE, H...
krasnoukhov/homeassistant-tesy
custom_components/tesy/tesy.py
.py
f5c59c25bb4b9b70
7.66
20
"""Tesy integration.""" from __future__ import annotations import logging import time from typing import Any from urllib.parse import urlparse, urlencode import requests from .const import * _LOGGER = logging.getLogger(__name__) class TesyOldApi: """Tesy Old API instance.""" def __init__(self, data: dic...
krasnoukhov/homeassistant-tesy
custom_components/tesy/tesy_oldapi.py
.py
afcd80e30b789d08
7.66
20
"""Tesy water heater component.""" from typing import Any from custom_components.tesy.coordinator import TesyCoordinator from homeassistant.components.water_heater import ( STATE_ECO, STATE_PERFORMANCE, WaterHeaterEntity, WaterHeaterEntityDescription, WaterHeaterEntityFeature, ) from homeassistant...
krasnoukhov/homeassistant-tesy
custom_components/tesy/water_heater.py
.py
baa73cc4dfe6f9a7
7.66
20
"""Tests for the Tesy old API client.""" from importlib.util import module_from_spec, spec_from_file_location from pathlib import Path import sys import time from types import ModuleType from unittest import TestCase from unittest.mock import Mock def load_old_api_module(): """Load the old API module without req...
krasnoukhov/homeassistant-tesy
tests/test_tesy_oldapi.py
.py
3bd5e81bc64ba892
8.16
20
import pandas as pd import os import ast from datetime import datetime import warnings class HistoricDataComparer: ''' A class to compare newly scraped data against a historical record set to identify novel entries. Attributes: historic_ids (set): Set of unique identifiers from previously observe...
lorae/roundup
src/data_comparer.py
.py
c61976ecdf30fa5b
7.52
10
import os from selenium import webdriver from selenium.webdriver.chrome.service import Service from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from w...
lorae/roundup
src/scraper/external_requests.py
.py
3b0b4f586bb55d96
7.52
10
from abc import ABC, abstractmethod import pandas as pd class GenericScraper(ABC): def __init__(self, source): ''' Initialize the GenericScraper with a source identifier. :param source: Identifier for the source of the data being scraped. :type source: str ''' self....
lorae/roundup
src/scraper/generic_scraper.py
.py
b7f0e9d5d32468ac
7.52
10
from src.scraper.external_requests import request_soup from ..generic_scraper import GenericScraper import requests class BEAScraper(GenericScraper): def __init__(self): super().__init__(source = 'BEA') # Define headers once and use them throughout the class self.headers = { ...
lorae/roundup
src/scraper/sites/bea_scraper.py
.py
aa4f3417a15df5e1
7.52
10
from src.scraper.external_requests import request_soup from ..generic_scraper import GenericScraper import requests from bs4 import BeautifulSoup class BFIScraper(GenericScraper): def __init__(self): super().__init__(source = 'BFI') # Define headers once and use them throughout the class se...
lorae/roundup
src/scraper/sites/bfi_scraper.py
.py
bbfdb22615ec055f
7.52
10
import feedparser from ..generic_scraper import GenericScraper class BISScraper(GenericScraper): def __init__(self): super().__init__(source = "BIS") # Public method which is called from outside the class. def fetch_data(self): ''' Requests and parses the source's main RSS feed usi...
lorae/roundup
src/scraper/sites/bis_scraper.py
.py
7ac7f917f0481612
7.52
10
from src.scraper.external_requests import selenium_soup from ..generic_scraper import GenericScraper class ECBScraper(GenericScraper): def __init__(self): super().__init__(source = 'ECB') # Public method which is called from outside the class. def fetch_data(self): # TODO: Store data i...
lorae/roundup
src/scraper/sites/ecb_scraper.py
.py
ed2b90e4c10d9fc5
7.52
10
from ..generic_scraper import GenericScraper import feedparser import calendar class FedAtlantaScraper(GenericScraper): def __init__(self): super().__init__(source = 'FED-ATLANTA') # Public method which is called from outside the class. def fetch_data(self): ''' Requests and parses...
lorae/roundup
src/scraper/sites/fed_atlanta_scraper.py
.py
4043ee2aaef331d4
7.52
10
from src.scraper.external_requests import request_soup from ..generic_scraper import GenericScraper from datetime import datetime import requests class FedBoardNotesScraper(GenericScraper): def __init__(self): super().__init__(source = 'FED-BOARD-NOTES') # Define headers once and use them throughou...
lorae/roundup
src/scraper/sites/fed_board_notes_scraper.py
.py
2c3ff53744e791d2
7.52
10
from ..generic_scraper import GenericScraper from src.scraper.external_requests import request_soup import requests class FedBoardScraper(GenericScraper): def __init__(self): super().__init__(source = 'FED-BOARD') # Define headers once and use them throughout the class self.headers = { ...
lorae/roundup
src/scraper/sites/fed_board_scraper.py
.py
ed556591fd5612f6
7.52
10
from ..generic_scraper import GenericScraper from src.scraper.external_requests import request_soup import requests class FedChicagoScraper(GenericScraper): def __init__(self): super().__init__(source = "FED-CHICAGO") # Define headers once and use them throughout the class self.headers = { ...
lorae/roundup
src/scraper/sites/fed_chicago_scraper.py
.py
a30d458565f5c1ea
7.52
10
from ..generic_scraper import GenericScraper from src.scraper.external_requests import selenium_soup class FedClevelandScraper(GenericScraper): def __init__(self): super().__init__(source = 'FED-CLEVELAND') # Public method which is called from outside the class. def fetch_data(self): ''' ...
lorae/roundup
src/scraper/sites/fed_cleveland_scraper.py
.py
000e080d82fb7a9c
7.52
10
from ..generic_scraper import GenericScraper from src.scraper.external_requests import request_soup import requests import re import PyPDF2 import io from datetime import datetime class FedDallasScraper(GenericScraper): def __init__(self): super().__init__(source = 'FED-DALLAS') # Define headers on...
lorae/roundup
src/scraper/sites/fed_dallas_scraper.py
.py
05283b7da35efaf5
7.52
10
from ..generic_scraper import GenericScraper from src.scraper.external_requests import request_soup import requests import re class FedMinneapolisScraper(GenericScraper): # TODO: Check if this source has an API that can be scraped def __init__(self): super().__init__(source = 'FED-MINNEAPOLIS') ...
lorae/roundup
src/scraper/sites/fed_minneapolis_scraper.py
.py
a80bc1c9440dd239
7.52
10
""" Generate a yaml template with coments from omnibenchmark models. It's important to note that the output of this script is intended to be used as a starting point for creating a benchmark configuration file, but it's only informative, not normative - the pydantic validations are the ultimate source of truth. The g...
omnibenchmark/omnibenchmark
docs/templategen.py
.py
213b350938968984
7.64
18
""" Main archive implementation for creating benchmark archives. This module provides the core archiving functionality that can work with or without remote storage, separated from the remote storage module to avoid circular dependencies and architectural confusion. """ import tarfile import zipfile from pathlib impor...
omnibenchmark/omnibenchmark
omnibenchmark/archive/archive.py
.py
2687ddca8c0dfc96
7.64
18
""" Archive components handling for different parts of a benchmark. This module provides functions to prepare different components of a benchmark for archiving: configuration, code, software environments, and results. Each component can be included or excluded independently. """ import os from pathlib import Path fro...
omnibenchmark/omnibenchmark
omnibenchmark/archive/components.py
.py
95627085bcb3fa8c
7.64
18
""" Metric collector resolution module. This module handles the conversion of MetricCollector entities into regular ResolvedNode instances, allowing them to be processed through the standard pipeline instead of requiring special treatment. Design Philosophy: - Metric collectors are conceptually just modules that aggr...
omnibenchmark/omnibenchmark
omnibenchmark/backend/_metric_collector.py
.py
2c5dce0deafd7a82
7.64
18
"""CLI commands for collecting metrics from a benchmark output folder. The ``collect`` group gathers post-hoc artefacts that are scattered across the output tree into a single combined table. Right now it knows how to gather the Snakemake ``performance.txt`` benchmark files emitted for every executed node; the resulti...
omnibenchmark/omnibenchmark
omnibenchmark/cli/collect.py
.py
20dbb0808d43cb72
7.64
18
from functools import wraps from typing import TypeVar, Union, cast import click from omnibenchmark.logging import configure_logging T = TypeVar("T", bound=Union[click.Command, click.Group]) def add_debug_option(cmd: T) -> T: """Decorator to add debug option to commands and groups""" if isinstance(cmd, cli...
omnibenchmark/omnibenchmark
omnibenchmark/cli/debug.py
.py
7d356067087f842e
7.64
18
"""cli commands related to benchmark infos and stats""" import sys from typing import Any, List import click import json from jinja2 import Environment, FileSystemLoader from pathlib import Path from omnibenchmark.core.status.status import prepare_status, print_exec_path_dict from omnibenchmark.core import Benchmar...
omnibenchmark/omnibenchmark
omnibenchmark/cli/describe.py
.py
e3eac0eb1aa09114
7.64
18
"""omnibenchmark CLI""" import click from omnibenchmark import __version__ from omnibenchmark.cli.archive import archive from omnibenchmark.cli.cite import cite from omnibenchmark.cli.collect import collect from omnibenchmark.cli.create import create from omnibenchmark.cli.dashboard import dashboard from omnibenchmar...
omnibenchmark/omnibenchmark
omnibenchmark/cli/main.py
.py
635c169678dabdb8
7.64
18
"""CLI commands for validation of benchmarks and modules.""" import re import warnings from pathlib import Path from typing import Optional import click import yaml from pydantic import ValidationError as PydanticValidationError from omnibenchmark.core.metadata import ( ValidationException, ValidationSeverit...
omnibenchmark/omnibenchmark
omnibenchmark/cli/validate.py
.py
91ba8c41cd81c3b3
7.64
18
"""Configuration to set up a local cache and a datadir for test data download""" # TODO: make sure this is in use import configparser import getpass import os import platform import tempfile from typing import Optional, Any from pathlib import Path APP_NAME = "omnibenchmark" _home = os.path.expanduser("~") xdg_co...
omnibenchmark/omnibenchmark
omnibenchmark/config.py
.py
7251b065d559b606
7.64
18
"""DAG Builder for Benchmark execution. This module provides the DAGBuilder class which constructs the computational directed acyclic graph (DAG) from a benchmark model. """ from pathlib import Path from typing import Dict, List, Optional from omnibenchmark.dag import DiGraph from omnibenchmark.model import Benchmar...
omnibenchmark/omnibenchmark
omnibenchmark/core/_dag_builder.py
.py
b8533a9a803ec5eb
7.64
18
"""Pure lineage/selection helpers over resolved nodes. These operate on the ``parent_id`` chain of resolved nodes (see ``model.resolved.ResolvedNode``) and back the stage-expansion loop in ``cli/run.py``. Kept out of the CLI layer because they are pure and unit-tested in isolation. """ def select_input_nodes( de...
omnibenchmark/omnibenchmark
omnibenchmark/core/_lineage.py
.py
c8510ef8ec80e274
7.64
18
"""Mermaid diagram generation utilities for omnibenchmark.""" from typing import Dict, List from omnibenchmark.model import Benchmark as BenchmarkModel from omnibenchmark.model.benchmark import Parameter from omnibenchmark.core._graph import upstream_stage_ids from omnibenchmark.model.params import Params def _quote...
omnibenchmark/omnibenchmark
omnibenchmark/core/_mermaid.py
.py
18cb97ee0da02c5f
7.64
18
"""Path construction utilities for omnibenchmark workflows.""" import hashlib import re from pathlib import PurePosixPath, Path from typing import List, Dict, Set, Optional # Per-component limit on most modern filesystems (ext4, xfs, apfs, ntfs). MAX_FILENAME_LEN = 255 # Cap on what we treat as a "compound extension...
omnibenchmark/omnibenchmark
omnibenchmark/core/_paths.py
.py
6007e3f38451bb57
7.64
18
"""Citation metadata extraction from benchmark modules.""" import logging import yaml from typing import Dict, Optional, Any, List from omnibenchmark.core.execution import BenchmarkExecution from omnibenchmark.core.repository_utils import ( RepositoryManager, get_module_repository_info, resolve_module_rep...
omnibenchmark/omnibenchmark
omnibenchmark/core/cite.py
.py
90cc050a8e4c5c06
7.64
18
import math from typing import Dict, List, Any # Always available - no longer requires pandas EXPORT_AVAILABLE = True # Performance metrics configuration PERFORMANCE_METRICS = { "s": {"class": "time", "flip": True, "transform": "[0,1]"}, "max_rss": {"class": "memory", "flip": True, "transform": "[0,1]"}, ...
omnibenchmark/omnibenchmark
omnibenchmark/core/dashboard.py
.py
1efcfca51836704f
7.64
18
import os.path from pathlib import Path from typing import Dict, List, Set, Optional from omnibenchmark.core._mermaid import generate_mermaid_diagram from omnibenchmark.core._paths import ( collect_output_paths, collect_path_exclusions, ) from omnibenchmark.core import _graph as graph from omnibenchmark.mode...
omnibenchmark/omnibenchmark
omnibenchmark/core/execution.py
.py
7f9f9e8b620c46d7
7.64
18
"""Shared repository utilities for benchmark module validation and citation extraction. This module provides common functionality for cloning, accessing, and cleaning up module repositories used by both validation and citation extraction workflows. """ import logging import shutil from pathlib import Path from typing...
omnibenchmark/omnibenchmark
omnibenchmark/core/repository_utils.py
.py
7e72ed5afb4cf194
7.64
18
from pathlib import Path from typing import Union from omnibenchmark.core._paths import sanitize_rule_name, truncate_filename from omnibenchmark.core.execution_path import ( ExecutionPathSet, ) from omnibenchmark.core import BenchmarkExecution def _attach_log_paths(exec_path_dict: dict, out_dir: Union[str, Path])...
omnibenchmark/omnibenchmark
omnibenchmark/core/status/status.py
.py
0b74b6cbdf797057
7.64
18
import os from pathlib import Path from filelock import FileLock from omnibenchmark.model.params import Params UNSAFE_CHARS = { "/": "_", "\\": "_", ":": "_", "*": "_", "?": "_", '"': "_", "<": "_", ">": "_", "|": "_", " ": "_", } class SymlinkManager: """ Manages a t...
omnibenchmark/omnibenchmark
omnibenchmark/core/symlinks.py
.py
feeb9f99b2cf0556
7.64
18
"""Validator utilities - delegates to BenchmarkValidator in model.validation.""" from pathlib import Path from typing import Optional from omnibenchmark.model import SoftwareBackendEnum, SoftwareEnvironment from omnibenchmark.model.validation import BenchmarkValidator class Validator: """Utility class for valida...
omnibenchmark/omnibenchmark
omnibenchmark/core/validator.py
.py
9334b5b48bec45f1
7.64
18
"""Simple DAG implementation to replace NetworkX dependency.""" from typing import Dict, List, Set, Tuple, Any, Iterator from collections import defaultdict, deque class CyclicDependencyError(Exception): """Raised when a cycle is detected in the DAG.""" pass class SimpleDAG: """A simple directed acycl...
omnibenchmark/omnibenchmark
omnibenchmark/dag/simple_dag.py
.py
374ec75df1d1b20e
7.64
18