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
"""Archive EIA Commercial Buildings Energy Consumption Survey (CBECS).""" import re from pathlib import Path from urllib.parse import urljoin from pudl_archiver.archivers.classes import ( AbstractDatasetArchiver, ArchiveAwaitable, ResourceInfo, ) from pudl_archiver.frictionless import ZipLayout BASE_URL...
catalyst-cooperative/pudl-archiver
src/pudl_archiver/archivers/eia/eiacbecs.py
.py
e91cee2054fdefa5
7.64
18
"""Archive EIA Manufacturing Energy Consumption Survey (MECS).""" import re from pathlib import Path from pudl_archiver.archivers.classes import ( AbstractDatasetArchiver, ArchiveAwaitable, ResourceInfo, ) from pudl_archiver.frictionless import ZipLayout BASE_URL = "https://www.eia.gov/consumption/manufa...
catalyst-cooperative/pudl-archiver
src/pudl_archiver/archivers/eia/eiamecs.py
.py
519ef3595ab4ed8d
7.64
18
"""Download EIA NEMS Github respository.""" import asyncio import os import subprocess from pathlib import Path from pudl_archiver.archivers.classes import ( AbstractDatasetArchiver, ArchiveAwaitable, ResourceInfo, ) from pudl_archiver.frictionless import ZipLayout RELEASE_TO_YEAR_MAP = { "AEO2026-Pu...
catalyst-cooperative/pudl-archiver
src/pudl_archiver/archivers/eia/eianems.py
.py
c0b3886629ea3b45
7.64
18
"""Archive EIA Residential Energy Consumption Survey (RECS).""" import re from dataclasses import dataclass from io import BytesIO from pathlib import Path from urllib.parse import urljoin, urlparse import bs4 from pudl_archiver.archivers.classes import ( AbstractDatasetArchiver, ArchiveAwaitable, Resour...
catalyst-cooperative/pudl-archiver
src/pudl_archiver/archivers/eia/eiarecs.py
.py
ded533122d93ff6b
7.64
18
"""Archive EIA Short-Term Energy Outlook (STEO). There are two pages containing EIA STEO data: * The archives, which contain a PDF with all charts and figures and an Excel sheet with the base data, updated monthly. * A page containing the current month's charts and figures. Note that some tables may appear listed on t...
catalyst-cooperative/pudl-archiver
src/pudl_archiver/archivers/eia/eiasteo.py
.py
497cdbef3e05838d
7.64
18
"""Download EIA Thermal Cooling Water data.""" import re from pathlib import Path from pudl_archiver.archivers.classes import ( AbstractDatasetArchiver, ArchiveAwaitable, ResourceInfo, ) BASE_URL = "https://www.eia.gov/electricity/data/water" class EiaWaterArchiver(AbstractDatasetArchiver): """EIA ...
catalyst-cooperative/pudl-archiver
src/pudl_archiver/archivers/eia/eiawater.py
.py
d35c1712868b9867
7.64
18
"""Shared methods for data from EIA Natural Gas Quarterly Viewer (NGQV). The Natural Gas Quarterly Viewer allows us to export data from EIA Forms 176, 191 and 757A as individual "reports". A dataset's content may be split into multiple reports, as it is for EIA 176, or be contained entirely in one report (as it is for...
catalyst-cooperative/pudl-archiver
src/pudl_archiver/archivers/eia/naturalgas.py
.py
375a030a43c073c7
7.64
18
"""Download EPA CAMD data.""" from pudl_archiver.archivers.classes import ( AbstractDatasetArchiver, ArchiveAwaitable, ResourceInfo, ) class EpaCamdEiaArchiver(AbstractDatasetArchiver): """EPA CAMD archiver.""" name = "epacamd_eia" async def get_resources(self) -> ArchiveAwaitable: ...
catalyst-cooperative/pudl-archiver
src/pudl_archiver/archivers/epa/epacamd_eia.py
.py
032b63c4967c5271
7.64
18
"""Download EPACEMS data.""" import datetime import os from collections.abc import Iterable from itertools import groupby from typing import ClassVar from pydantic import BaseModel, ConfigDict, ValidationError from pydantic.alias_generators import to_camel from pudl_archiver.archivers.classes import ( AbstractDa...
catalyst-cooperative/pudl-archiver
src/pudl_archiver/archivers/epa/epacems.py
.py
1e72a10f81fe2c87
7.64
18
"""Download EPA eGRID data.""" import re from pudl_archiver.archivers.classes import ( AbstractDatasetArchiver, ArchiveAwaitable, ResourceInfo, ) from pudl_archiver.frictionless import ZipLayout BASE_URL = "https://www.epa.gov/egrid/historical-egrid-data" class EpaEgridArchiver(AbstractDatasetArchiver)...
catalyst-cooperative/pudl-archiver
src/pudl_archiver/archivers/epa/epaegrid.py
.py
daddcdf718213da7
7.64
18
"""Download EPAMATS data.""" import os from collections.abc import Iterable from itertools import groupby from typing import ClassVar from pydantic import ValidationError from pudl_archiver.archivers.classes import ( AbstractDatasetArchiver, ArchiveAwaitable, ResourceInfo, ) from pudl_archiver.archivers....
catalyst-cooperative/pudl-archiver
src/pudl_archiver/archivers/epa/epamats.py
.py
b839478af510db37
7.64
18
"""Download EPA PCAP data.""" import re from pathlib import Path from urllib.parse import urljoin, urlsplit from playwright.async_api import async_playwright from pudl_archiver.archivers.classes import ( AbstractDatasetArchiver, ArchiveAwaitable, ResourceInfo, ) from pudl_archiver.frictionless import Zip...
catalyst-cooperative/pudl-archiver
src/pudl_archiver/archivers/epa/epapcap.py
.py
e786be432a83d481
7.64
18
"""Download FERC Form 1 data.""" from pudl_archiver.archivers.classes import ( AbstractDatasetArchiver, ArchiveAwaitable, ) from pudl_archiver.archivers.ferc import ferc_online_helpers, xbrl class Ferc1Archiver(AbstractDatasetArchiver): """Ferc Form 1 archiver.""" name = "ferc1" concurrency_limi...
catalyst-cooperative/pudl-archiver
src/pudl_archiver/archivers/ferc/ferc1.py
.py
c6a12328955639ef
7.64
18
"""Defines base class for archiver.""" from pudl_archiver.archivers.classes import ( AbstractDatasetArchiver, ArchiveAwaitable, ) from pudl_archiver.archivers.ferc import ferc_online_helpers, xbrl class Ferc2Archiver(AbstractDatasetArchiver): """Ferc Form 2 archiver.""" name = "ferc2" async def...
catalyst-cooperative/pudl-archiver
src/pudl_archiver/archivers/ferc/ferc2.py
.py
0538310b28b2cfc4
7.64
18
"""Defines base class for archiver.""" from pudl_archiver.archivers.classes import ( AbstractDatasetArchiver, ArchiveAwaitable, ) from pudl_archiver.archivers.ferc import ferc_online_helpers, xbrl class Ferc6Archiver(AbstractDatasetArchiver): """FERC Form 6 archiver.""" name = "ferc6" concurrenc...
catalyst-cooperative/pudl-archiver
src/pudl_archiver/archivers/ferc/ferc6.py
.py
6af8cca7b9bee217
7.64
18
"""Defines base class for archiver.""" from pudl_archiver.archivers.classes import ( AbstractDatasetArchiver, ArchiveAwaitable, ) from pudl_archiver.archivers.ferc import ferc_online_helpers, xbrl class Ferc60Archiver(AbstractDatasetArchiver): """Ferc Form 60 archiver.""" name = "ferc60" concurr...
catalyst-cooperative/pudl-archiver
src/pudl_archiver/archivers/ferc/ferc60.py
.py
1a23eba1a3148b59
7.64
18
"""Download FERC Form 714 data.""" from pathlib import Path from playwright.async_api import async_playwright from pudl_archiver.archivers.classes import ( AbstractDatasetArchiver, ArchiveAwaitable, ResourceInfo, ) from pudl_archiver.archivers.ferc import xbrl class Ferc714Archiver(AbstractDatasetArchi...
catalyst-cooperative/pudl-archiver
src/pudl_archiver/archivers/ferc/ferc714.py
.py
5c8a117f468be744
7.64
18
"""Download FERC EQR data.""" import asyncio import logging import re from pathlib import Path import pandas as pd from playwright.async_api import async_playwright from pudl_archiver.archivers.classes import ( AbstractDatasetArchiver, ArchiveAwaitable, Partitions, ResourceInfo, ) logger = logging.g...
catalyst-cooperative/pudl-archiver
src/pudl_archiver/archivers/ferc/ferceqr.py
.py
05782568d9beff73
7.64
18
"""A command line interface (CLI) to archive data from an RSS feed.""" import asyncio import datetime import io import json import logging import re import zipfile from collections import defaultdict from collections.abc import Callable from enum import Enum from pathlib import Path from typing import Annotated from u...
catalyst-cooperative/pudl-archiver
src/pudl_archiver/archivers/ferc/xbrl.py
.py
b97a5c09342ebbd1
7.64
18
"""Archive GridPath RA toolkit renewable generation data. This dataset was produced by Moment Energy Insights (now Sylvan Energy Analytics). It is archived from files stored in the private sources.catalyst.coop bucket. """ import zipfile from pathlib import Path from typing import ClassVar from google.cloud import s...
catalyst-cooperative/pudl-archiver
src/pudl_archiver/archivers/gridpathratoolkit.py
.py
7eaf283ae3939947
7.64
18
"""Download MSHA data.""" import re from pathlib import Path from pudl_archiver.archivers.classes import ( AbstractDatasetArchiver, ArchiveAwaitable, ResourceInfo, ) URL_BASE = "https://arlweb.msha.gov/OpenGovernmentData/" EXT_BASE = "OGIMSHA.asp" MSHA_DATASETS = { "accidents": "https://arlweb.msha....
catalyst-cooperative/pudl-archiver
src/pudl_archiver/archivers/mshamines.py
.py
3649b72c6ec5eeaa
7.64
18
"""Download NREL ATB for Electricity Parquet data.""" import re from pathlib import Path from typing import Literal from urllib.parse import urljoin from aiobotocore.session import get_session from botocore import UNSIGNED from botocore.config import Config from pudl_archiver.archivers.classes import ( AbstractD...
catalyst-cooperative/pudl-archiver
src/pudl_archiver/archivers/nrel/nrelatb.py
.py
fc656a0f1340b2d5
7.64
18
"""Download NREL Cambium Scenarios data.""" import re from collections import defaultdict from pudl_archiver.archivers.classes import ( ArchiveAwaitable, ResourceInfo, ) from pudl_archiver.archivers.nrel.nrelss import ( API_URL_FILE_DOWNLOAD, API_URL_PROJECTS_LIST, AbstractNrelScenarioArchiver, ) ...
catalyst-cooperative/pudl-archiver
src/pudl_archiver/archivers/nrel/nrelcambium.py
.py
d54c242a05197b63
7.64
18
""" Contains all the fields related classes to support custom features such as variants in Cloudflare Images """ from typing import Any from django import forms from django.db.models import CharField from django.db.models.fields.files import ( ImageField, ImageFieldFile, ImageFileDescriptor, ) from cloud...
KalvadTech/django-cloudflare-images
cloudflare_images/field.py
.py
f407921845e67262
7.65
19
""" Views for the widget """ import json from django.http import HttpRequest, JsonResponse from django.views.generic import View from cloudflare_images.service import ApiException, CloudflareImagesService class WidgetAPI(View): """ View for the widget """ def get(self, request: HttpRequest) -> Jso...
KalvadTech/django-cloudflare-images
cloudflare_images/views.py
.py
93d0c3dd7f15cd7b
7.65
19
""" Custom widget for Direct Creator Uploads """ from typing import Any from django.forms.widgets import Widget from django.utils.datastructures import MultiValueDict from cloudflare_images.config import Config from cloudflare_images.service import CloudflareImagesService class CloudflareImagesWidget(Widget): ...
KalvadTech/django-cloudflare-images
cloudflare_images/widget.py
.py
f77f888e07843829
7.65
19
""" Tests related to the Config """ from django.test import TestCase, override_settings from cloudflare_images.config import Config class ConfigTests(TestCase): """ Test case for Config """ def setUp(self): self.config = Config() def test_account_id(self): account_id = self.con...
KalvadTech/django-cloudflare-images
tests/test_config.py
.py
b9d02987679c962d
8.15
19
""" Tests related to the CloudflareImagesField """ from django import forms from django.test import TestCase, override_settings from cloudflare_images.field import ( CloudflareImageIDField, CloudflareImagesField, CloudflareImagesFieldFile, ) from cloudflare_images.widget import CloudflareImagesWidget cl...
KalvadTech/django-cloudflare-images
tests/test_field.py
.py
f33f622ba32a8fad
7.15
19
""" Tests related to the CloudflareImagesWidget URL patterns """ from django.test import TestCase from django.urls import resolve, reverse from cloudflare_images.views import WidgetAPI class UrlPatternTests(TestCase): """ Test case for URL patterns """ def test_widget_api_url_resolves(self): ...
KalvadTech/django-cloudflare-images
tests/test_urls.py
.py
ac695ae05f2ca1f6
8.15
19
""" Tests related to the CloudflareImagesWidget Views """ from unittest.mock import patch from django.http import JsonResponse from django.test import RequestFactory, TestCase from cloudflare_images.service import ApiException from cloudflare_images.views import WidgetAPI class WidgetAPITests(TestCase): """ ...
KalvadTech/django-cloudflare-images
tests/test_views.py
.py
d368db869c8cc7c3
7.15
19
""" Utils for running test """ import json from unittest.mock import MagicMock def get_dummy_image(): """ Returns the dummy image """ return open("tests/python-logo.jpeg", "rb") def get_dummy_image_name(): """ Returns the name of the dummy image """ return "python-logo.jpeg" def g...
KalvadTech/django-cloudflare-images
tests/utils.py
.py
c19c80b6afc7e156
8.15
19
"""Shared lazy-import helpers for example packages.""" import importlib def make_lazy_plot_getter(names, plots_module): """Build a PEP 562 ``__getattr__`` that lazy-loads plot functions. Parameters ---------- names : set[str] Attribute names that live in the plots submodule. Anything else ...
akshayshanker/FUES
examples/_lazy.py
.py
cec36eaa47aa0ad6
7.59
14
"""Nest accessors and solution diagnostics for durables.""" import numpy as np def derive_savings(nest, grids, tau): """Derive savings from budget constraint for all periods. Keeper: a_nxt = w - c (keeper domain is cash-on-hand). Adjuster: a_nxt = w - c - (1+tau)*h_choice. Returns ------- d...
akshayshanker/FUES
examples/durables/postprocess/diagnostics.py
.py
a447ff578c534810
7.59
14
"""Notebook utilities for durables. Thin helpers that keep notebook cells clean: stdout filtering, CE transforms, solve wrappers with progress display. """ import sys import numpy as np class FilteredStdout: """Proxy that suppresses lines matching a pattern (e.g. numba debug). Usage:: real = sys.s...
akshayshanker/FUES
examples/durables/postprocess/notebook.py
.py
673c2d6f1b32ad87
7.59
14
"""Shock conditioning helpers for tenure arrival values.""" import numpy as np from numba import njit, prange def make_conditioners(Pi): """Build E_z conditioning operators from a Markov transition matrix.""" @njit(parallel=True) def condition_V(Vcurr, d_aV_curr, d_hV_curr): n_z, n_a, n_h = Vcur...
akshayshanker/FUES
examples/durables/solvers/conditioning.py
.py
36a8c324e376cc42
7.59
14
#!/usr/bin/env python3 """ Generate income process based on Fella (2014) parameters. This script generates the income process using the parameters from Fella's 2014 paper "A generalized endogenous grid method for non-smooth and non-concave problems" and saves it in YAML format for use with FUES. """ import numpy as...
akshayshanker/FUES
examples/housing_renting/config_HR/generate_income_process.py
.py
757310dee14b8da1
7.59
14
"""Asset-return tax utilities for housing_renting model. This module provides functions to compute piecewise-linear capital income taxes on asset holdings. The tax schedule is defined by brackets with: - a0, a1: bracket bounds (assets) - B: base tax at a0 (can have discontinuous jumps) - tau_a: marginal tax rate withi...
akshayshanker/FUES
examples/housing_renting/helpers/asset_tax.py
.py
6deeb365f19bbd44
7.59
14
""" Memory monitoring utilities for the housing renting model solver. This module provides tools for monitoring and managing memory usage during intensive computation tasks, particularly useful for cluster environments with strict memory limits. """ import psutil import gc import os from typing import Optional import...
akshayshanker/FUES
examples/housing_renting/helpers/memory_utils.py
.py
ba18e9fc018c26b8
7.59
14
""" Table formatting utilities for housing model benchmarks. Handles pretty table formatting and summary displays. """ import json import tabulate from collections import defaultdict from pathlib import Path import pandas as pd def safely_parse(obj): """Safely parse JSON/literal string or return original object...
akshayshanker/FUES
examples/housing_renting/helpers/tables.py
.py
44e20b24e663954e
7.59
14
"""Benchmarking helpers: true-solution precompute and timing-table layout. The retirement ``run.py`` path uses the canonical kikku ``sweep`` over ``run.test_set``; this module holds the cross-tab post-processing and the reference-solution precompute for consumption-deviation metrics. """ from __future__ import annota...
akshayshanker/FUES
examples/retirement/benchmark.py
.py
0b72544dced38878
7.59
14
# Copyright SUSE LLC # SPDX-License-Identifier: MIT """Sync aggregate results.""" from argparse import Namespace from concurrent.futures import ThreadPoolExecutor, as_completed from itertools import chain from logging import getLogger from . import config from .loader.config import read_products from .loader.qem impo...
openSUSE/qem-bot
openqabot/aggrsync.py
.py
da72a333dd1e4f22
7.48
8
# Copyright SUSE LLC # SPDX-License-Identifier: MIT """AMQP listener for openQA events.""" import re from argparse import Namespace from logging import getLogger from pprint import pformat from typing import TYPE_CHECKING, Any from .approver import Approver from .config import settings from .loader.amqp_listener impo...
openSUSE/qem-bot
openqabot/amqp.py
.py
be7f81bacd8bb13a
7.48
8
# Copyright SUSE LLC # SPDX-License-Identifier: MIT """Commenter class for commenting on submissions.""" from __future__ import annotations from logging import getLogger from pprint import pformat from typing import TYPE_CHECKING, Any from urllib.parse import urlencode, urlparse import osc.conf from openqabot impor...
openSUSE/qem-bot
openqabot/commenter.py
.py
c5a92b5c2a5fe1ba
7.48
8
# Copyright SUSE LLC # SPDX-License-Identifier: MIT """Configuration constants. This module defines configuration constants used throughout the application. Most of these constants can be overridden by environment variables. """ from __future__ import annotations import logging from pathlib import Path from typing i...
openSUSE/qem-bot
openqabot/config.py
.py
e6e29282b0cf89ad
7.48
8
# Copyright SUSE LLC # SPDX-License-Identifier: MIT """Dashboard API client.""" from typing import Any import requests from .config import settings from .utils import retry5 as retried_requests _GET_CACHE: dict[str, Any] = {} def clear_cache() -> None: """Clear the local cache for dashboard GET requests.""" ...
openSUSE/qem-bot
openqabot/dashboard.py
.py
bb010210878963d6
7.48
8
# Copyright SUSE LLC # SPDX-License-Identifier: MIT """Sync Gitea pull requests to dashboard.""" from argparse import Namespace from logging import getLogger from pprint import pformat from typing import Any from openqabot.types.pullrequest import PullRequest from .loader.amqp_listener import AMQPListener from .load...
openSUSE/qem-bot
openqabot/giteasync.py
.py
c1211426bf580ff4
7.48
8
# Copyright SUSE LLC # SPDX-License-Identifier: MIT """Trigger testing for PR(s) with certain label.""" from argparse import Namespace from concurrent.futures import ThreadPoolExecutor from dataclasses import dataclass from itertools import chain from logging import getLogger from typing import Any, cast import reque...
openSUSE/qem-bot
openqabot/giteatrigger.py
.py
d0607419f99b75da
7.48
8
# Copyright SUSE LLC # SPDX-License-Identifier: MIT """AMQP base module for handling RabbitMQ connections and message consumption. This module provides the AMQPBase class which manages shared AMQP connection and event loop logic for consuming messages from a RabbitMQ broker. """ import contextlib import json from col...
openSUSE/qem-bot
openqabot/loader/amqp_listener.py
.py
47a7288b36655557
7.48
8
# Copyright SUSE LLC # SPDX-License-Identifier: MIT """Build info loader.""" from __future__ import annotations from logging import getLogger from typing import TYPE_CHECKING, Any from openqabot.types.increment import BuildInfo from openqabot.utils import get_obs_filter_params from openqabot.utils import retry10 as ...
openSUSE/qem-bot
openqabot/loader/buildinfo.py
.py
aafd45b35fb964ba
7.48
8
# Copyright SUSE LLC # SPDX-License-Identifier: MIT """Configuration loader.""" from __future__ import annotations from dataclasses import dataclass from logging import getLogger from typing import TYPE_CHECKING, Any, Protocol from ruamel.yaml import YAML, YAMLError from ruamel.yaml.constructor import ConstructorErr...
openSUSE/qem-bot
openqabot/loader/config.py
.py
ed3caf46fbd92c98
7.48
8
# Copyright SUSE LLC # SPDX-License-Identifier: MIT """Grep content of web page and filter it by provided regex.""" from __future__ import annotations import logging import re import requests from requests.adapters import HTTPAdapter from requests.exceptions import RequestException from urllib3.util.retry import Ret...
openSUSE/qem-bot
openqabot/loader/crawler.py
.py
d60d57bcb6acec8f
7.48
8
# Copyright SUSE LLC # SPDX-License-Identifier: MIT """Increment configuration loader.""" from __future__ import annotations import pprint import re from dataclasses import dataclass, field, fields, replace from logging import getLogger from typing import TYPE_CHECKING, Any from openqabot import config from .config...
openSUSE/qem-bot
openqabot/loader/incrementconfig.py
.py
d47d962812a34495
7.48
8
# Copyright SUSE LLC # SPDX-License-Identifier: MIT """QEM Dashboard loader.""" from __future__ import annotations import sys from http import HTTPStatus from itertools import chain from logging import getLogger from operator import itemgetter from pprint import pformat from typing import TYPE_CHECKING, Any, NamedTup...
openSUSE/qem-bot
openqabot/loader/qem.py
.py
c55208d41cd03d9d
7.48
8
# Copyright SUSE LLC # SPDX-License-Identifier: MIT """Repository hash loader.""" from __future__ import annotations from hashlib import md5 from logging import getLogger from typing import TYPE_CHECKING, NamedTuple import requests from lxml import etree # ty: ignore[unresolved-import] from requests.exceptions impo...
openSUSE/qem-bot
openqabot/loader/repohash.py
.py
b2be7bae0e16d83c
7.48
8
# Copyright SUSE LLC # SPDX-License-Identifier: MIT """Trigger configuration loader.""" from __future__ import annotations import pprint from dataclasses import dataclass, field, fields from logging import getLogger from typing import Any from .gitea import VERSION_EXTRACT_REGEX log = getLogger("bot.loader.triggerc...
openSUSE/qem-bot
openqabot/loader/triggerconfig.py
.py
869b0f16b4a27267
7.48
8
# Copyright SUSE LLC # SPDX-License-Identifier: MIT """Entry point for the application.""" import hashlib import sys import time import traceback from collections import defaultdict from logging import Logger from dotenv import load_dotenv import openqabot.config as config_module from .args import app from .utils i...
openSUSE/qem-bot
openqabot/main.py
.py
d78abd43451ae80c
7.48
8
# Copyright SUSE LLC # SPDX-License-Identifier: MIT """OpenQA Interface.""" from __future__ import annotations import logging from functools import lru_cache from http import HTTPStatus from itertools import batched from pprint import pformat from typing import TYPE_CHECKING, Any from urllib.parse import urlparse im...
openSUSE/qem-bot
openqabot/openqa.py
.py
0739a15feeb35ce2
7.48
8
# Copyright SUSE LLC # SPDX-License-Identifier: MIT """Main OpenQABot logic.""" from argparse import Namespace from concurrent.futures import ThreadPoolExecutor, wait from logging import getLogger from os import environ from typing import Any import openqabot.config as config_module from openqabot import dashboard f...
openSUSE/qem-bot
openqabot/openqabot.py
.py
a7dbce3f6a1f8f43
7.48
8
# Copyright SUSE LLC # SPDX-License-Identifier: GPL-2.0+ """OSC comments handling.""" from __future__ import annotations import re from datetime import UTC, datetime from typing import Any from lxml import etree # ty: ignore[unresolved-import] from osc.connection import http_DELETE, http_GET, http_POST from osc.cor...
openSUSE/qem-bot
openqabot/osclib/comments.py
.py
6e81746dc07bea50
7.48
8
# Copyright SUSE LLC # SPDX-License-Identifier: MIT """Public Cloud helper functions.""" from __future__ import annotations import json import re from functools import cache from logging import getLogger from operator import itemgetter from typing import Any import requests from .utils import retry5 as retried_requ...
openSUSE/qem-bot
openqabot/pc_helper.py
.py
4b69f41f8837e6a2
7.48
8
# Copyright SUSE LLC # SPDX-License-Identifier: MIT """Repository diff computation.""" from __future__ import annotations import gzip import io import json import re import sys from collections import defaultdict from logging import getLogger from pathlib import Path from typing import TYPE_CHECKING, Any, NamedTuple ...
openSUSE/qem-bot
openqabot/repodiff.py
.py
82d5169267014711
7.48
8
# Copyright SUSE LLC # SPDX-License-Identifier: MIT """OSC request helpers.""" from __future__ import annotations from functools import cache from logging import getLogger from typing import TYPE_CHECKING import osc.core from openqabot import config if TYPE_CHECKING: from argparse import Namespace log = getLo...
openSUSE/qem-bot
openqabot/requests.py
.py
57a324edf16a49b4
7.48
8
# Copyright SUSE LLC # SPDX-License-Identifier: MIT """Sync SMELT incidents to dashboard.""" from __future__ import annotations from logging import getLogger from operator import itemgetter from pprint import pformat from typing import TYPE_CHECKING, Any from .config import settings from .loader.qem import update_su...
openSUSE/qem-bot
openqabot/smeltsync.py
.py
3572ee1c219ca219
7.48
8
# Copyright SUSE LLC # SPDX-License-Identifier: MIT """Sync submission results.""" from argparse import Namespace from concurrent import futures from itertools import chain from logging import getLogger from . import config from .loader.qem import get_active_submissions, get_submission_settings_data from .syncres imp...
openSUSE/qem-bot
openqabot/subsyncres.py
.py
b0e10bfe5114f8ff
7.48
8
# Copyright SUSE LLC # SPDX-License-Identifier: MIT """Sync result base class.""" from __future__ import annotations from logging import getLogger from pprint import pformat from typing import TYPE_CHECKING, Any from .config import settings from .loader.qem import post_job from .openqa import OpenQAInterface from .u...
openSUSE/qem-bot
openqabot/syncres.py
.py
243f66bda0f5e661
7.48
8
# Copyright SUSE LLC # SPDX-License-Identifier: MIT """Aggregate type definition.""" from __future__ import annotations import datetime from collections import defaultdict from datetime import UTC from itertools import chain from logging import getLogger from typing import TYPE_CHECKING, Any, NamedTuple import reque...
openSUSE/qem-bot
openqabot/types/aggregate.py
.py
e49b1b45e94e3d2d
7.48
8
# Copyright SUSE LLC # SPDX-License-Identifier: MIT """Base configuration type.""" from __future__ import annotations from abc import ABC, abstractmethod from dataclasses import dataclass from typing import TYPE_CHECKING, Any if TYPE_CHECKING: from .submission import Submission @dataclass class JobConfig: ...
openSUSE/qem-bot
openqabot/types/baseconf.py
.py
47aa377cd0e04e20
7.48
8
# Copyright SUSE LLC # SPDX-License-Identifier: MIT """Types for handling a product increment.""" from __future__ import annotations from logging import getLogger from typing import TYPE_CHECKING, Any, NamedTuple from openqabot import config if TYPE_CHECKING: import osc.core log = getLogger("bot.increment_appr...
openSUSE/qem-bot
openqabot/types/increment.py
.py
e1b8f125c68aa9c7
7.48
8
# Copyright SUSE LLC # SPDX-License-Identifier: MIT """ISO match information extracted from artifacts.""" from re import Match from typing import Self class IsoMatch: """Information extracted from a matched ISO filename.""" product: str version: str arch: str build: str def __init__(self, p...
openSUSE/qem-bot
openqabot/types/isomatch.py
.py
91e242f7eee61680
7.48
8
# Copyright SUSE LLC # SPDX-License-Identifier: MIT """Gitea Pullrequest type definition.""" import html from dataclasses import dataclass, field from logging import getLogger from typing import Any, Protocol, Self log = getLogger("bot.loader.pullrequest") class CommentableProtocol(Protocol): """Protocol for ob...
openSUSE/qem-bot
openqabot/types/pullrequest.py
.py
c767fdb5c5f31ed0
7.48
8
# Copyright SUSE LLC # SPDX-License-Identifier: MIT """Submission type definition.""" from __future__ import annotations import html import re from collections import defaultdict from logging import getLogger from typing import Any from openqabot import config from openqabot.errors import EmptyChannelsError, EmptyPa...
openSUSE/qem-bot
openqabot/types/submission.py
.py
9030d999d3ba3e9a
7.48
8
# Copyright SUSE LLC # SPDX-License-Identifier: MIT """Submissions list type definition.""" from __future__ import annotations import json from logging import getLogger from typing import TYPE_CHECKING, Any, NamedTuple import requests from openqabot.config import OBSOLETE_PARAMS, settings from openqabot.errors impo...
openSUSE/qem-bot
openqabot/types/submissions.py
.py
6165ea7867678f1a
7.48
8
# Copyright SUSE LLC # SPDX-License-Identifier: MIT """Common type definitions.""" from __future__ import annotations from enum import Enum, auto from typing import TYPE_CHECKING, NamedTuple from openqabot.config import OBS_REPO_TYPE if TYPE_CHECKING: from openqabot.loader.triggerconfig import TriggerConfig ...
openSUSE/qem-bot
openqabot/types/types.py
.py
76fdca23acdd2e02
7.48
8
# Copyright SUSE LLC # SPDX-License-Identifier: MIT """Utility functions.""" from __future__ import annotations import logging import os import re from copy import deepcopy from typing import TYPE_CHECKING, Any from requests import Session from requests.adapters import HTTPAdapter from urllib3.util.retry import Retr...
openSUSE/qem-bot
openqabot/utils.py
.py
1aba4b7c233ee2d9
7.48
8
#!/usr/bin/env python3 # Copyright SUSE LLC # SPDX-License-Identifier: MIT """Helper for Public Cloud testing.""" from argparse import ArgumentParser from pathlib import Path from typing import Any from ruamel.yaml import YAML, YAMLError from openqabot.loader.config import get_yml_list from openqabot.pc_helper impo...
openSUSE/qem-bot
pc_helper_online.py
.py
668e17a5f44b2b54
7.48
8
#!/usr/bin/env python3 # Copyright SUSE LLC # SPDX-License-Identifier: MIT """Manage local qem-dashboard environment for integration testing.""" import os import subprocess # ruff: ignore[suspicious-subprocess-import] import sys import time from pathlib import Path try: import typer except ImportError: sys.s...
openSUSE/qem-bot
scripts/manage_dashboard.py
.py
7bcf652ebfc12855
7.48
8
#!/usr/bin/env python3 # Copyright SUSE LLC # SPDX-License-Identifier: MIT """Script to update Readme.md.""" import logging import os import re import subprocess # ruff: ignore[suspicious-subprocess-import] import sys from pathlib import Path # Add project root to sys.path to allow imports from openqabot sys.path.in...
openSUSE/qem-bot
scripts/update_readme.py
.py
e8f63f029bb61e9e
7.48
8
"""Authentication support for the Hydrawise v2 GraphQL API.""" from asyncio import Lock from dataclasses import dataclass from datetime import datetime, timedelta from typing import Any import aiohttp from .base import BaseAuth from .const import CLIENT_ID, CLIENT_SECRET, REQUEST_TIMEOUT, REST_URL, TOKEN_URL from .e...
dknowles2/pydrawise
pydrawise/auth.py
.py
ddc2498c82b73f23
7.52
10
"""Asynchronous client library for interacting with Hydrawise's GraphQL API.""" import logging from datetime import datetime, timedelta from gql import Client from gql.dsl import DSLField, DSLMutation, DSLQuery, DSLSelectable, dsl_gql from gql.transport.aiohttp import AIOHTTPTransport from gql.transport.aiohttp impor...
dknowles2/pydrawise
pydrawise/client.py
.py
320920cc7fdc1b32
7.52
10
"""Client library for interacting with Hydrawise's REST API. This library should remain compatible with https://github.com/ptcryan/hydrawiser. """ import time from typing import Any import requests from .auth import RestAuth from .const import REST_URL from .exceptions import NotInitializedError, UnknownError from ...
dknowles2/pydrawise
pydrawise/legacy.py
.py
711c185731296283
7.52
10
"""Utilities for managing the GraphQL schema.""" from __future__ import annotations from collections import namedtuple from collections.abc import Iterator from dataclasses import fields, is_dataclass from functools import cache from types import NoneType, UnionType from typing import ( TYPE_CHECKING, Any, ...
dknowles2/pydrawise
pydrawise/schema_utils.py
.py
21c35f23e2cbab18
7.52
10
"""Structural checks that every client implements exactly the shared interface.""" import inspect import pytest from pydrawise.base import HydrawiseBase from pydrawise.client import Hydrawise from pydrawise.hybrid import HybridClient from pydrawise.rest import RestClient CLIENTS = (Hydrawise, HybridClient, RestClie...
dknowles2/pydrawise
tests/test_base.py
.py
d799a601bd5462e9
8.02
10
from dataclasses import fields, is_dataclass from datetime import datetime from string import ascii_lowercase from apischema.metadata.keys import CONVERSION_METADATA, FALL_BACK_ON_DEFAULT_METADATA from apischema.type_names import get_type_name from apischema.utils import to_camel_case from graphql import build_schema ...
dknowles2/pydrawise
tests/test_schema.py
.py
f17fbabf7f1a8bf8
8.02
10
from dataclasses import dataclass, field from apischema.metadata import skip from graphql import InlineFragmentNode from pydrawise import schema_utils from pydrawise.schema import ( AdvancedWateringSettings, Controller, StandardWateringSettings, User, Zone, ) def test_parse_skip(): skip = ["...
dknowles2/pydrawise
tests/test_schema_utils.py
.py
a45fa0ea531ca517
8.02
10
import json import os import urllib3 http = urllib3.PoolManager() def lambda_handler(event, context): """ Handle AWS Batch job failure events and send Slack notifications. Triggered by EventBridge when Batch job status changes to FAILED. """ detail = event['detail'] job_name = detail['job...
ddps-lab/spotlake
collector/spot-dataset/aws/batch-test/infrastructure/lambda/batch_failure_notifier.py
.py
e5cb1cad75bfcc2e
7.15
19
# ------ import module ------ import pandas as pd import numpy as np import warnings # ------ import user module ------ from utility.slack_msg_sender import send_slack_message # compare previous collected workload with current collected workload # return changed workload def compare(previous_df, current_df, workload_...
ddps-lab/spotlake
collector/spot-dataset/aws/batch-test/merge/compare_data.py
.py
310a1fd15c31b6eb
7.15
19
# ------ import module ------ from datetime import datetime, timezone, timedelta import boto3 import pickle import gzip import json import pandas as pd import argparse import os import sys from pathlib import Path # TITANS environment setup (Test) - set before imports os.environ.setdefault("TITANS_ENV", "test") # Add...
ddps-lab/spotlake
collector/spot-dataset/aws/batch-test/merge/merge_data.py
.py
6844304e7fc6182c
7.15
19
# ------ import module ------ import boto3.session from botocore.config import Config import pandas as pd from datetime import datetime, timedelta, timezone EC2_CLIENT_CONFIG = Config(retries={'max_attempts': 2, 'mode': 'standard'}) # get all available regions def get_regions(session: boto3.session.Session, region=...
ddps-lab/spotlake
collector/spot-dataset/aws/batch-test/price/load_price.py
.py
a1991408ff404462
7.15
19
# reference # https://developers.google.com/optimization/bin/bin_packing # ------ import module ------ import boto3 import botocore import pickle import gzip from datetime import datetime, timezone, timedelta from ortools.linear_solver import pywraplp import io import argparse # ------ import user module ------ from ...
ddps-lab/spotlake
collector/spot-dataset/aws/batch-test/workload/generate_workload.py
.py
53564eace7f18acc
7.15
19
import boto3 from collections import Counter # get all available regions def get_regions(session: boto3.session.Session, region='us-east-1') -> list: client = session.client('ec2', region_name=region) describe_args = { 'AllRegions': False } return [region['RegionName'] for region in client.des...
ddps-lab/spotlake
collector/spot-dataset/aws/batch-test/workload/load_metadata.py
.py
6954d6bc254621fb
7.15
19
# ------ import module ------ from datetime import datetime, timezone, timedelta import boto3 import pickle import gzip import json import os import resource import sys import pandas as pd import argparse import time from pathlib import Path # ------ TITANS setup ------ # Add titans_common path (merge -> batch -> aws ...
ddps-lab/spotlake
collector/spot-dataset/aws/batch/merge/merge_data.py
.py
1fcc14eb73406fe1
7.65
19
# ------ import module ------ from datetime import datetime, timezone import boto3.session, botocore import sys, os, argparse import pickle, gzip, json, yaml import pandas as pd from io import StringIO # ------ import user module ------ # memo: change the path sys.path.append("/home/ubuntu/spotlake/utility") from slac...
ddps-lab/spotlake
collector/spot-dataset/aws/ec2/sps/collect_sps.py
.py
5f2663c576b85716
7.65
19
# Copyright 2025-2026 Trevor Lauder. # SPDX-License-Identifier: MIT """Blocklist text parsing for community block list formats.""" import re _COMMENT_RE = re.compile(r"\s*[#!].*$") _IPV4_RE = re.compile(r"^\d{1,3}(?:\.\d{1,3}){3}$") _IPV6_RE = re.compile(r"^[\[\]0-9a-fA-F:]+:[0-9a-fA-F:]*$") _ADBLOCK_RE = re.compil...
trevorlauder/cloudflare-doh-worker
src/blocklist_parser.py
.py
ea0dcf36059d184a
7.65
19
# Copyright 2025-2026 Trevor Lauder. # SPDX-License-Identifier: MIT """Cloudflare Cache API helpers for DNS response caching.""" import base64 import logging import urllib.parse from workers import Response from dns_utils import Question logger = logging.getLogger(__name__) def _to_js_body(body: bytes | bytearra...
trevorlauder/cloudflare-doh-worker
src/cache_utils.py
.py
a9debe014853da3e
7.65
19
# Copyright 2025-2026 Trevor Lauder. # SPDX-License-Identifier: MIT """Shared TypedDict definitions for worker configuration.""" from typing import NewType, NotRequired, TypedDict PositiveInt = NewType("PositiveInt", int) NonNegativeInt = NewType("NonNegativeInt", int) class EcsConfig(TypedDict): """ECS (EDNS ...
trevorlauder/cloudflare-doh-worker
src/config_types.py
.py
f1c37e17e7713f00
7.65
19
# Copyright 2025-2026 Trevor Lauder. # SPDX-License-Identifier: MIT """BinaryFuse32 lookup and domain hashing for the blocklist filter.""" import hashlib import struct from typing import NamedTuple _U64_MASK = (1 << 64) - 1 _U32_MASK = (1 << 32) - 1 _MIX_C1 = 0xFF51AFD7ED558CCD _MIX_C2 = 0xC4CEB9FE1A85EC53 class ...
trevorlauder/cloudflare-doh-worker
src/filter_utils.py
.py
1a72cf1f00ef4bc2
7.65
19
# Copyright 2025-2026 Trevor Lauder. # SPDX-License-Identifier: MIT """Shared pytest fixtures and configuration for DoH worker tests.""" import os import re import ssl import sys from unittest.mock import MagicMock import urllib.request _runtime_stub = MagicMock() _runtime_stub.WorkerEntrypoint = object sys.modules[...
trevorlauder/cloudflare-doh-worker
tests/conftest.py
.py
838800d1d29540a8
8.15
19
"""Models for P1 Monitor.""" from __future__ import annotations from dataclasses import dataclass from enum import StrEnum from typing import Any class EnergyTariff(StrEnum): """Enumeration representing the rate period.""" __slots__ = () LOW = "low" HIGH = "high" @dataclass class SmartMeter: ...
klaasnicolaas/python-p1monitor
src/p1monitor/models.py
.py
b94af65814e58d41
7.57
13
"""Asynchronous Python client for the P1 Monitor API.""" from __future__ import annotations import asyncio import socket from dataclasses import dataclass from importlib import metadata from typing import Any, Self from aiohttp import ClientError, ClientSession from aiohttp.hdrs import METH_GET from yarl import URL ...
klaasnicolaas/python-p1monitor
src/p1monitor/p1monitor.py
.py
9c2aae4d13eff8ab
7.57
13
#!/usr/bin/env python3 """ Prepare Pantry phenotypes for Pheast This script converts sample IDs to individual IDs in Pantry phenotype files. For multi-tissue datasets like GTEx, RNA-seq samples often have IDs that differ from individual IDs, and genetic analyses require the individual IDs to match genotypes. Usage: ...
PejLab/Pantry
pheast/scripts/prepare_phenotypes.py
.py
725f7795a1c7c94d
7.66
20