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 |
|---|---|---|---|---|---|---|
#!/usr/bin/env python3
"""
Pre-push hook to ensure __version__ is updated when aiuser/ files change.
"""
import re
import subprocess
import sys
def get_compare_range() -> str:
"""Get a sensible diff range for pre-push checks."""
upstream = subprocess.run(
["git", "rev-parse", "--verify", "@{upstream}... | zhaobenny/bz-cogs | .githooks/check_version_update.py | .py | 5f82594e4bac5701 | 7.75 | 31 |
#!/usr/bin/env python3
"""
Fetches model data from OpenRouter API and generates aiuser/config/models.py
Usage:
uv run .githooks/update_models.py
"""
import importlib.util
import json
import urllib.request
from decimal import Decimal
from pathlib import Path
OPENROUTER_API_URL = "https://openrouter.ai/api/v1/mode... | zhaobenny/bz-cogs | .githooks/update_models.py | .py | b17e7fe49d252616 | 7.75 | 31 |
from __future__ import annotations
from dataclasses import dataclass
from typing import Iterable
from aiuser.config.models import (
OTHER_MODELS_LIMITS,
TOOLS_SUPPORTED_MODELS,
UNSUPPORTED_LOGIT_BIAS_MODELS,
VISION_SUPPORTED_MODELS,
)
DEFAULT_TOKEN_LIMIT = 7000
@dataclass(frozen=True)
class ModelIn... | zhaobenny/bz-cogs | aiuser/config/model_info.py | .py | 1df48f010f6a9d16 | 7.75 | 31 |
from __future__ import annotations
import logging
from typing import Any, Optional
import discord
from redbot.core import Config, commands
from aiuser.config.defaults import DEFAULT_PROMPT
logger = logging.getLogger("red.bz_cogs.aiuser")
class ScopedConfigResolver:
"""The single source of truth for scoped set... | zhaobenny/bz-cogs | aiuser/config/resolver.py | .py | 54c7064c9937b634 | 7.75 | 31 |
from __future__ import annotations
import asyncio
import logging
from typing import Iterable, Set
import discord
from redbot.core import Config
from redbot.core.bot import Red
logger = logging.getLogger("red.bz_cogs.aiuser")
class ConsentService:
"""The single owner of bot-wide opt-in/opt-out state.
All r... | zhaobenny/bz-cogs | aiuser/consent/service.py | .py | 984920f8bfa2c054 | 7.75 | 31 |
import json
import logging
from typing import Any, Dict, List, Optional
from aiuser.context.entry import MessageEntry
from aiuser.utils.utilities import encode_text_to_tokens
logger = logging.getLogger("red.bz_cogs.aiuser.context")
LOW_DETAIL_IMAGE_TOKEN_COST = 512
HIGH_DETAIL_IMAGE_TOKEN_COST = 2500
class Convers... | zhaobenny/bz-cogs | aiuser/context/conversation.py | .py | 0c03b180c0bade05 | 7.75 | 31 |
# Copyright 2026 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | GoogleCloudPlatform/jupyter-extensions | google-cloud-jupyter-config/conftest.py | .py | ed376fcdf76286e7 | 7.38 | 57 |
# Copyright 2023 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | GoogleCloudPlatform/jupyter-extensions | google-cloud-jupyter-config/google/cloud/jupyter_config/config.py | .py | 1c3bedb203f785e9 | 7.88 | 57 |
# Copyright 2023 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | GoogleCloudPlatform/jupyter-extensions | google-cloud-jupyter-config/google/cloud/jupyter_config/tokenrenewer.py | .py | 5c07a064ba6b3879 | 7.88 | 57 |
# Copyright 2026 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | GoogleCloudPlatform/jupyter-extensions | jupyter-gcs-contents-manager/conftest.py | .py | 51f1c9d2e7d6556c | 7.38 | 57 |
# Copyright 2023 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | GoogleCloudPlatform/jupyter-extensions | kernels-mixer/kernels_mixer/kernels_test.py | .py | 9f098f135b79df37 | 7.38 | 57 |
# Copyright 2023 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | GoogleCloudPlatform/jupyter-extensions | kernels-mixer/kernels_mixer/kernelspecs.py | .py | 4236af5d2ab5aa29 | 8.38 | 57 |
# Copyright 2023 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | GoogleCloudPlatform/jupyter-extensions | kernels-mixer/kernels_mixer/websockets.py | .py | c6da77e05e8fa77d | 7.88 | 57 |
# Copyright 2024 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | GoogleCloudPlatform/jupyter-extensions | kernels-mixer/kernels_mixer/websockets_test.py | .py | 498c1eaa2c19da47 | 7.38 | 57 |
#!/usr/bin/env python3
'''
(C) Copyright 2023 UCAR
This software is licensed under the terms of the Apache Licence Version 2.0
which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
'''
from collections import OrderedDict
from initialize.applications.EnKF import EnKF
from initialize.applications.Ex... | NCAR/MPAS-Workflow | initialize/applications/DA.py | .py | 2a607f9b7820068e | 7.71 | 25 |
#!/usr/bin/env python3
'''
(C) Copyright 2023 UCAR
This software is licensed under the terms of the Apache Licence Version 2.0
which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
'''
from copy import deepcopy
from initialize.applications.Members import Members
from initialize.config.Component i... | NCAR/MPAS-Workflow | initialize/applications/Forecast.py | .py | 1d71e5bdc043ce31 | 7.71 | 25 |
#!/usr/bin/env python3
'''
(C) Copyright 2023 UCAR
This software is licensed under the terms of the Apache Licence Version 2.0
which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
'''
from copy import deepcopy
import tools.prevMeanTimes as pmt
from initialize.applications.Forecast import Forecast... | NCAR/MPAS-Workflow | initialize/applications/ForecastSACA.py | .py | 14fe4680f82ced2c | 7.71 | 25 |
#!/usr/bin/env python3
'''
(C) Copyright 2023 UCAR
This software is licensed under the terms of the Apache Licence Version 2.0
which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
'''
from initialize.framework.HPC import HPC
from initialize.applications.Members import Members
from initialize.conf... | NCAR/MPAS-Workflow | initialize/applications/HofX.py | .py | 0232bb6f4f77ccb0 | 7.71 | 25 |
#!/usr/bin/env python3
'''
(C) Copyright 2023 UCAR
This software is licensed under the terms of the Apache Licence Version 2.0
which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
'''
from initialize.config.Component import Component
from initialize.config.Config import Config
from initialize.conf... | NCAR/MPAS-Workflow | initialize/applications/InitIC.py | .py | c596af8b3f70b529 | 7.71 | 25 |
#!/usr/bin/env python3
'''
(C) Copyright 2023 UCAR
This software is licensed under the terms of the Apache Licence Version 2.0
which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
'''
from initialize.config.Component import Component
from initialize.config.Config import Config
class Members(Compo... | NCAR/MPAS-Workflow | initialize/applications/Members.py | .py | 827489025dc0ae58 | 7.71 | 25 |
#!/usr/bin/env python3
'''
(C) Copyright 2023 UCAR
This software is licensed under the terms of the Apache Licence Version 2.0
which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
'''
#from initialize.applications.DA import DA
from initialize.applications.Members import Members
from initialize.co... | NCAR/MPAS-Workflow | initialize/applications/RTPP.py | .py | 07615e1db96b426b | 7.71 | 25 |
#!/usr/bin/env python3
'''
(C) Copyright 2023 UCAR
This software is licensed under the terms of the Apache Licence Version 2.0
which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
'''
from initialize.config.Component import Component
from initialize.config.Config import Config
from initialize.conf... | NCAR/MPAS-Workflow | initialize/applications/SACA.py | .py | f93a20396b86702a | 7.71 | 25 |
#!/usr/bin/env python3
'''
(C) Copyright 2023 UCAR
This software is licensed under the terms of the Apache Licence Version 2.0
which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
'''
from collections import OrderedDict
from initialize.applications.Members import Members
from initialize.config.C... | NCAR/MPAS-Workflow | initialize/applications/Variational.py | .py | 6f8e9d68fd44e0fb | 7.71 | 25 |
#!/usr/bin/env python3
'''
(C) Copyright 2023 UCAR
This software is licensed under the terms of the Apache Licence Version 2.0
which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
'''
from copy import deepcopy
class Configurable:
conf = {}
def __init__(self, conf:dict):
'''
conf: {key... | NCAR/MPAS-Workflow | initialize/config/Configurable.py | .py | 0520bc8674504772 | 7.71 | 25 |
#!/usr/bin/env python3
'''
(C) Copyright 2023 UCAR
This software is licensed under the terms of the Apache Licence Version 2.0
which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
'''
import os
'''
class for logging statements conditionally, based on verbosity.
the value of the CYLC_DEBUG environ... | NCAR/MPAS-Workflow | initialize/config/Logger.py | .py | 0c1a82168b48b7e2 | 7.71 | 25 |
#!/usr/bin/env python3
'''
(C) Copyright 2023 UCAR
This software is licensed under the terms of the Apache Licence Version 2.0
which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
'''
#from typing import Iterable, Callable, Union, Tuple, Type, Mapping
#from collections.abc import Iterable
from in... | NCAR/MPAS-Workflow | initialize/config/Resource.py | .py | b5405cc063aa936e | 7.71 | 25 |
#!/usr/bin/env python3
'''
(C) Copyright 2023 UCAR
This software is licensed under the terms of the Apache Licence Version 2.0
which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
'''
from initialize.config.Config import Config
class Scenario():
def __init__(self, file, bundle, suffix,
... | NCAR/MPAS-Workflow | initialize/config/Scenario.py | .py | 04ff4c9a3269a553 | 7.71 | 25 |
#!/usr/bin/env python3
'''
(C) Copyright 2023 UCAR
This software is licensed under the terms of the Apache Licence Version 2.0
which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
'''
from initialize.config.Config import Config
class SubConfig(Config):
def __init__(self,
table:dict = {},
... | NCAR/MPAS-Workflow | initialize/config/SubConfig.py | .py | 2f4c82fa69847299 | 7.71 | 25 |
#!/usr/bin/env python3
'''
(C) Copyright 2023 UCAR
This software is licensed under the terms of the Apache Licence Version 2.0
which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
'''
import sys
from initialize.config.Resource import Resource
class Task():
def __init__(self, r:Resource):
se... | NCAR/MPAS-Workflow | initialize/config/Task.py | .py | 7285b56ca5efab67 | 7.71 | 25 |
#!/usr/bin/env python3
'''
(C) Copyright 2023 UCAR
This software is licensed under the terms of the Apache Licence Version 2.0
which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
'''
from copy import deepcopy
placeholdertask = 'PlaceHolder'
class TaskFamilyBase:
def __init__(self, name:str, i... | NCAR/MPAS-Workflow | initialize/config/TaskFamily.py | .py | ae4be6c70661d373 | 7.71 | 25 |
#!/usr/bin/env python3
'''
(C) Copyright 2023 UCAR
This software is licensed under the terms of the Apache Licence Version 2.0
which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
'''
# copied from https://stackoverflow.com/questions/3487434/overriding-append-method-after-inheriting-from-a-python-... | NCAR/MPAS-Workflow | initialize/data/DataList.py | .py | 3cc5b8e8152ebd1c | 7.71 | 25 |
#!/usr/bin/env python3
'''
(C) Copyright 2023 UCAR
This software is licensed under the terms of the Apache Licence Version 2.0
which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
'''
from copy import deepcopy
from initialize.config.Component import Component
from initialize.config.Config import ... | NCAR/MPAS-Workflow | initialize/data/ExternalAnalyses.py | .py | a49b1bc2f34b15b0 | 7.71 | 25 |
#!/usr/bin/env python3
'''
(C) Copyright 2023 UCAR
This software is licensed under the terms of the Apache Licence Version 2.0
which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
'''
from initialize.applications.Forecast import Forecast
from initialize.applications.Members import Members
from in... | NCAR/MPAS-Workflow | initialize/data/FirstBackground.py | .py | 4f405194a8294c7e | 7.71 | 25 |
#!/usr/bin/env python3
'''
(C) Copyright 2023 UCAR
This software is licensed under the terms of the Apache Licence Version 2.0
which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
'''
import datetime as dt
import tools.dateFormats as dtf
from initialize.applications.Members import Members
from i... | NCAR/MPAS-Workflow | initialize/data/InvariantStream.py | .py | c106a8298a6a6f18 | 7.71 | 25 |
#!/usr/bin/env python3
'''
(C) Copyright 2023 UCAR
This software is licensed under the terms of the Apache Licence Version 2.0
which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
'''
from copy import deepcopy
from initialize.config.Component import Component
from initialize.config.Config import ... | NCAR/MPAS-Workflow | initialize/data/Model.py | .py | cce3461cf804b308 | 7.71 | 25 |
#!/usr/bin/env python3
'''
(C) Copyright 2023 UCAR
This software is licensed under the terms of the Apache Licence Version 2.0
which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
'''
from initialize.config.Configurable import Configurable
from initialize.data.DataList import DataList
class ObsEn... | NCAR/MPAS-Workflow | initialize/data/ObsEnsemble.py | .py | 1d10915158e0102f | 7.71 | 25 |
#!/usr/bin/env python3
'''
(C) Copyright 2023 UCAR
This software is licensed under the terms of the Apache Licence Version 2.0
which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
'''
from initialize.config.Configurable import Configurable
from initialize.data.Model import Mesh
from initialize.da... | NCAR/MPAS-Workflow | initialize/data/StateEnsemble.py | .py | 919e3b67d01179a4 | 7.71 | 25 |
#!/usr/bin/env python3
'''
(C) Copyright 2023 UCAR
This software is licensed under the terms of the Apache Licence Version 2.0
which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
'''
from initialize.applications.DA import DA
from initialize.applications.ExtendedForecast import ExtendedForecast
fr... | NCAR/MPAS-Workflow | initialize/framework/Naming.py | .py | 24fa93e6dbeb8c91 | 7.71 | 25 |
#!/usr/bin/env python3
'''
(C) Copyright 2023 UCAR
This software is licensed under the terms of the Apache Licence Version 2.0
which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
'''
import datetime as dt
import tools.dateFormats as dtf
from initialize.config.Component import Component
from init... | NCAR/MPAS-Workflow | initialize/framework/Workflow.py | .py | 6be43514d28d1967 | 7.71 | 25 |
#!/usr/bin/env python3
'''
(C) Copyright 2023 UCAR
This software is licensed under the terms of the Apache Licence Version 2.0
which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
'''
from initialize.config.Component import Component
from initialize.config.Config import Config
from initialize.conf... | NCAR/MPAS-Workflow | initialize/post/Benchmark.py | .py | 32e36d8c2e2163a6 | 7.71 | 25 |
#!/usr/bin/env python3
'''
(C) Copyright 2023 UCAR
This software is licensed under the terms of the Apache Licence Version 2.0
which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
'''
from initialize.applications.HofX import HofX
from initialize.config.Component import Component
from initialize.c... | NCAR/MPAS-Workflow | initialize/post/Post.py | .py | 9f470397ed16be6a | 7.71 | 25 |
#!/usr/bin/env python3
'''
(C) Copyright 2023 UCAR
This software is licensed under the terms of the Apache Licence Version 2.0
which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
'''
import os
from initialize.applications.Members import Members
from initialize.config.Component import Component
f... | NCAR/MPAS-Workflow | initialize/post/VerifyModel.py | .py | 88dd877d435aaab9 | 7.71 | 25 |
#!/usr/bin/env python3
'''
(C) Copyright 2023 UCAR
This software is licensed under the terms of the Apache Licence Version 2.0
which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
'''
import os
from initialize.applications.HofX import HofX
from initialize.applications.Members import Members
from ... | NCAR/MPAS-Workflow | initialize/post/VerifyObs.py | .py | 4b3584aadb9c3053 | 7.71 | 25 |
#!/usr/bin/env python3
'''
(C) Copyright 2023 UCAR
This software is licensed under the terms of the Apache Licence Version 2.0
which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
'''
from initialize.applications.SACA import SACA
from initialize.applications.DA import DA
from initialize.applicatio... | NCAR/MPAS-Workflow | initialize/suites/CloudDirectInsertionCycle.py | .py | 6d54e83be7a323fb | 7.71 | 25 |
#!/usr/bin/env python3
'''
(C) Copyright 2023 UCAR
This software is licensed under the terms of the Apache Licence Version 2.0
which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
'''
from initialize.applications.DA import DA
from initialize.applications.ExtendedForecast import ExtendedForecast
fr... | NCAR/MPAS-Workflow | initialize/suites/Cycle.py | .py | fa9b8842a7700021 | 7.71 | 25 |
#!/usr/bin/env python3
'''
(C) Copyright 2023 UCAR
This software is licensed under the terms of the Apache Licence Version 2.0
which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
'''
from initialize.applications.InitIC import InitIC
from initialize.applications.ExtendedForecast import ExtendedFor... | NCAR/MPAS-Workflow | initialize/suites/ForecastFromExternalAnalyses.py | .py | 24bbd341a0653a93 | 7.71 | 25 |
#!/usr/bin/env python3
'''
(C) Copyright 2023 UCAR
This software is licensed under the terms of the Apache Licence Version 2.0
which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
'''
from initialize.applications.InitIC import InitIC
# TODO: make members optional, modify getCycleVars
from initiali... | NCAR/MPAS-Workflow | initialize/suites/GenerateExternalAnalyses.py | .py | f01c71bdf0775f60 | 7.71 | 25 |
#!/usr/bin/env python3
'''
(C) Copyright 2023 UCAR
This software is licensed under the terms of the Apache Licence Version 2.0
which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
'''
# TODO: make members optional, modify getCycleVars
from initialize.applications.Members import Members
from initi... | NCAR/MPAS-Workflow | initialize/suites/GenerateObs.py | .py | 5c2924feff41b3c6 | 7.71 | 25 |
#!/usr/bin/env python3
'''
(C) Copyright 2023 UCAR
This software is licensed under the terms of the Apache Licence Version 2.0
which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
'''
import os
import subprocess
from initialize.config.Logger import Logger
from initialize.config.Config import Conf... | NCAR/MPAS-Workflow | initialize/suites/SuiteBase.py | .py | d10b1e0a652e02db | 7.71 | 25 |
#!/usr/bin/env python3
'''
(C) Copyright 2023 UCAR
This software is licensed under the terms of the Apache Licence Version 2.0
which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
'''
from initialize.config.Component import Component
class Example(Component):
#defaults = 'scenarios/defaults/exa... | NCAR/MPAS-Workflow | initialize/util/ExampleComponent.py | .py | 47e37c44aedda3c6 | 7.71 | 25 |
"""
Shared loading/computation logic for the GLC-X-10 (Wotton et al. 2009) published FBP System test
cases, used by test_fbp_glc_x_10.py's test_fbp_glc_x_10 (reads the vendored CSVs directly) and
test_fbp_glc_x_10_rasters (reads the equivalent GeoTIFF fixtures generated by
generate_glc_x_10_rasters.py from those same C... | bcgov/wps | backend/packages/cffdrs-vec/src/cffdrs_vec/tests/_glc_x_10_data.py | .py | f62c44a5624247c4 | 7.41 | 65 |
"""
Generates the GeoTIFF fixtures under fixtures/glc_x_10/ and fixtures/glc_x_10_paper/, from each
GLCX10Source's own input/output CSVs (see _glc_x_10_data.py for the source definitions, and
GLCX10Source.load_raster_inputs() for how the raster fixtures generated here get read back).
Not a test_*.py module - this is a... | bcgov/wps | backend/packages/cffdrs-vec/src/cffdrs_vec/tests/generate_glc_x_10_rasters.py | .py | 621e09603157af6c | 8.41 | 65 |
"""
Validates cffdrs_vec.fbp.vectorized_fire_behaviour_prediction against the 20 published FBP System
test cases from GLC-X-10 (Wotton et al. 2009), Table 4 (inputs) and Table 5 (primary outputs).
See https://github.com/bcgov/wps/issues/4893.
Parametrized over two independent data sources (see _glc_x_10_data.py's GLCX... | bcgov/wps | backend/packages/cffdrs-vec/src/cffdrs_vec/tests/test_fbp_glc_x_10.py | .py | 46eb25105b928208 | 8.41 | 65 |
"""Configurations for Alembic migrations"""
import asyncio
from logging.config import fileConfig
import sqlalchemy
from alembic import context
from sqlalchemy.ext.asyncio import async_engine_from_config
from wps_shared.db.database import ASYNC_DB_WRITE_STRING
from wps_shared.db.models import Base
# this is the Alem... | bcgov/wps | backend/packages/wps-api/alembic/env.py | .py | 426791595b0c5498 | 7.91 | 65 |
"""rdps_latlon_projection
Revision ID: 05349c55c1e2
Revises: 591bf3e24705
Create Date: 2026-04-14 16:16:51.902177
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = '05349c55c1e2'
down_revision = '591bf3e24705'
branch_labels = None
depends_on = None
def upgrade():
# Adds the new MS... | bcgov/wps | backend/packages/wps-api/alembic/versions/05349c55c1e2_rdps_latlon_projection.py | .py | 79d4299f46053bf3 | 7.91 | 65 |
"""drop shape combustible_area column
Revision ID: 0f0c47b0c47a
Revises: 7ac7f5600d81
Create Date: 2026-05-07 13:45:04.280862
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "0f0c47b0c47a"
down_revision = "7ac7f5600d81"
branch_labels = None
depends_on = None
... | bcgov/wps | backend/packages/wps-api/alembic/versions/0f0c47b0c47a_drop_shape_combustible_area_colum.py | .py | a1f042e03fbd0046 | 7.91 | 65 |
"""Four panel charts
Revision ID: 591bf3e24705
Revises: 0b35542720bf
Create Date: 2026-03-23 13:25:08.190313
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
from wps_shared.db.models.common import TZTimeStamp
# revision identifiers, used by Alembic.
revision = '591bf3e24... | bcgov/wps | backend/packages/wps-api/alembic/versions/591bf3e24705_four_panel_charts.py | .py | c69ccd3c006f6cd9 | 7.91 | 65 |
"""seed_application_data
Revision ID: 6157a8d08f28
Revises: 9bb0dc8ed7fb
Create Date: 2025-12-29 14:44:23.524448
"""
from alembic import op
import sqlalchemy as sa
from pathlib import Path
import re
import gzip
from shapely import wkb
# revision identifiers, used by Alembic.
revision = "6157a8d08f28"
down_revision... | bcgov/wps | backend/packages/wps-api/alembic/versions/6157a8d08f28_seed_application_data.py | .py | 994c825eb9ab7818 | 7.91 | 65 |
"""Add fuel raster install status
Revision ID: 6f7d3e9c2a10
Revises: a4fb7e8a1d2c
Create Date: 2026-06-10 00:00:00.000000
"""
import sqlalchemy as sa
from alembic import op
from wps_shared.db.models.common import TZTimeStamp
# revision identifiers, used by Alembic.
revision = "6f7d3e9c2a10"
down_revision = "a4fb7e... | bcgov/wps | backend/packages/wps-api/alembic/versions/6f7d3e9c2a10_add_fuel_raster_install_status.py | .py | b8977e7649c853f3 | 7.91 | 65 |
"""advisory_fuel_shapes constraints
Revision ID: 7ac7f5600d81
Revises: 05349c55c1e2
Create Date: 2026-05-05 14:44:35.738801
"""
import sqlalchemy as sa
from alembic import op
from wps_shared.db.models.common import TZTimeStamp
# revision identifiers, used by Alembic.
revision = "7ac7f5600d81"
down_revision = "05349... | bcgov/wps | backend/packages/wps-api/alembic/versions/7ac7f5600d81_advisory_fuel_shapes_constraints.py | .py | e0404da06ee793fa | 7.91 | 65 |
"""Push notification tokens
Revision ID: 7d2194c5051e
Revises: 0b46effaf3a1
Create Date: 2026-03-02 10:48:11.523814
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
from wps_shared.db.models.common import TZTimeStamp
# revision identifiers, used by Alembic.
revision = '7d... | bcgov/wps | backend/packages/wps-api/alembic/versions/7d2194c5051e_push_notification_tokens.py | .py | 2fc92c16a7c372a9 | 7.91 | 65 |
"""Add HRDPS rotated latlon prediction model
Revision ID: a4fb7e8a1d2c
Revises: d3513840fd37
Create Date: 2026-06-03 00:00:00.000000
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = "a4fb7e8a1d2c"
down_revision = "d3513840fd37"
branch_labels = None
depends_on = None
def upgrade():
... | bcgov/wps | backend/packages/wps-api/alembic/versions/a4fb7e8a1d2c_hrdps_rlatlon_projection.py | .py | 84d3eab941c44be0 | 7.91 | 65 |
"""indices
Revision ID: 004ac48ffe18
Revises: 81c96876355a
Create Date: 2021-03-29 18:24:10.485482
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = '004ac48ffe18'
down_revision = '81c96876355a'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by... | bcgov/wps | backend/packages/wps-api/alembic/versions/archive/004ac48ffe18_indices.py | .py | 2c88013159f33f1d | 7.91 | 65 |
"""Add combust area col to advisory_shapes
Revision ID: 0669994d4089
Revises: fbca68ccc9da
Create Date: 2022-09-09 15:50:57.376665
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '0669994d4089'
down_revision = 'fbca68ccc9da'
branch_labels = None
depends_on = Non... | bcgov/wps | backend/packages/wps-api/alembic/versions/archive/0669994d4089_add_combust_area_col_to_advisory_shapes.py | .py | a5f52cd93fe3b229 | 7.91 | 65 |
"""partition weather_station_model_predictions part 1
Revision ID: 07007f659064
Revises: c5bea0920d53
Create Date: 2024-11-04 10:41:31.466124
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = "07007f659064"
down_revision = "c5bea0920d53"
branch_labels = None
depends_on = None
### Adapt... | bcgov/wps | backend/packages/wps-api/alembic/versions/archive/07007f659064_partition_weather_station_model_.py | .py | 1238c84c9be7a89a | 7.91 | 65 |
"""create advisory_hfi_percent_conifer table
Revision ID: 08799237842e
Revises: 2cf10021c5f1
Create Date: 2025-03-05 14:50:47.127461
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "08799237842e"
down_revision = "2cf10021c5f1"
branch_labels = None
depends_on = ... | bcgov/wps | backend/packages/wps-api/alembic/versions/archive/08799237842e_create_advisory_hfi_percent_conifer_.py | .py | 846b4060cf71e775 | 7.91 | 65 |
"""simplify high hfi area
Revision ID: 0961883640ef
Revises: 298f400dfa64
Create Date: 2023-02-02 16:58:43.239162
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '0961883640ef'
down_revision = '298f400dfa64'
branch_labe... | bcgov/wps | backend/packages/wps-api/alembic/versions/archive/0961883640ef_simplify_high_hfi_area.py | .py | 919f86e6cf2aea45 | 7.91 | 65 |
"""Alter morecast_forecast columns to float
Revision ID: 0d46262707af
Revises: 69cbd7ca2477
Create Date: 2023-03-14 15:55:31.325373
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '0d46262707af'
down_revision = '69cbd7ca2477'
branch_labels = None
depends_on = N... | bcgov/wps | backend/packages/wps-api/alembic/versions/archive/0d46262707af_alter_morecast_forecast_columns_to_float.py | .py | fecc059608c002fa | 7.91 | 65 |
"""Add SFMSFuelType data
Revision ID: 0dd8306467a9
Revises: fdbf57102d06
Create Date: 2023-01-31 16:56:22.323537
"""
from alembic import op
import json
# revision identifiers, used by Alembic.
revision = '0dd8306467a9'
down_revision = 'fdbf57102d06'
branch_labels = None
depends_on = None
def upgrade():
# Load... | bcgov/wps | backend/packages/wps-api/alembic/versions/archive/0dd8306467a9_add_sfmsfueltype_data.py | .py | 48dcdf424052774f | 7.91 | 65 |
"""add status to prescription_status
Revision ID: 128156e36f67
Revises: 65d5edb3f200
Create Date: 2025-05-08 15:14:49.193067
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.orm.session import Session
# revision identifiers, used by Alembic.
revision = '128156e36f67'
down_revision = '65d5edb3f200'... | bcgov/wps | backend/packages/wps-api/alembic/versions/archive/128156e36f67_add_status_to_prescription_status.py | .py | 2c6e2c8a141d1801 | 7.91 | 65 |
"""Update C7B
Revision ID: 16386a52d7bf
Revises: 82cc8ffa75ce
Create Date: 2022-05-04 13:46:16.589667
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = '16386a52d7bf'
down_revision = '82cc8ffa75ce'
branch_labels = None
depends_on = None
def upgrade():
# Change fuel type code to C7... | bcgov/wps | backend/packages/wps-api/alembic/versions/archive/16386a52d7bf_update_c7b.py | .py | 23a3689628753290 | 7.91 | 65 |
"""add back min wind table with fk
Revision ID: 17b3fb451866
Revises: 521681b2d802
Create Date: 2025-03-18 15:12:08.434619
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '17b3fb451866'
down_revision = '521681b2d802'
branch_labels = None
depends_on = None
def ... | bcgov/wps | backend/packages/wps-api/alembic/versions/archive/17b3fb451866_add_back_min_wind_table_with_fk.py | .py | 32f2a5debb14002e | 7.91 | 65 |
"""Fuel area per TPI class
Revision ID: 1e6932096921
Revises: 4014ddf1f874
Create Date: 2025-01-21 09:48:41.621501
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = "1e6932096921"
down_revision = "4014ddf1f874"
branch_la... | bcgov/wps | backend/packages/wps-api/alembic/versions/archive/1e6932096921_fuel_area_per_tpi_class.py | .py | 3efd582637284dd3 | 7.91 | 65 |
"""singular value weather model prediction table
Revision ID: 2442f07d975c
Revises: f49418d95584
Create Date: 2023-09-26 16:14:01.658515
"""
from alembic import op
import sqlalchemy as sa
from wps_shared.db.models.common import TZTimeStamp
# revision identifiers, used by Alembic.
revision = '2442f07d975c'
down_revi... | bcgov/wps | backend/packages/wps-api/alembic/versions/archive/2442f07d975c_singular_value_weather_model_prediction_.py | .py | 6e0833b01793e44c | 7.91 | 65 |
"""Order planning areas in KFC; modify order_of_appearance_in_list column
in planning_areas table to be non-nullable
Revision ID: 274bec360d8c
Revises: 6d2f4d058ebc
Create Date: 2022-01-24 16:36:51.978303
"""
from alembic import op
import sqlalchemy as sa
import json
# revision identifiers, used by Alembic.
revisio... | bcgov/wps | backend/packages/wps-api/alembic/versions/archive/274bec360d8c_order_planning_areas_in_kfc.py | .py | a63f55c9290ee2a9 | 7.91 | 65 |
"""zonal elevation stats
Revision ID: 298f400dfa64
Revises: 0dd8306467a9
Create Date: 2023-02-01 15:56:27.433120
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '298f400dfa64'
down_revision = '0dd8306467a9'
branch_labels = None
depends_on = None
def upgrade()... | bcgov/wps | backend/packages/wps-api/alembic/versions/archive/298f400dfa64_zonal_elevation_stats.py | .py | 32e7d357b4deccdd | 7.91 | 65 |
"""Percent grass curing
Revision ID: 2b3755392ad8
Revises: 5845f568a975
Create Date: 2024-02-01 16:45:05.914743
"""
from alembic import op
import sqlalchemy as sa
from wps_shared.db.models.common import TZTimeStamp
# revision identifiers, used by Alembic.
revision = '2b3755392ad8'
down_revision = '5845f568a975'
bran... | bcgov/wps | backend/packages/wps-api/alembic/versions/archive/2b3755392ad8_percent_grass_curing.py | .py | 08dfb02dd4a975a2 | 7.91 | 65 |
"""Download Flow Launcher plugin ZIPs from their GitHub release URLs.
This script reads plugin manifest JSON files from the ``plugins/``
directory and downloads each plugin's ``UrlDownload`` ZIP into an output
directory. It supports a ``--mode new`` option to download only newly
submitted plugins, ``--mode changed`` ... | Flow-Launcher/Flow.Launcher.PluginsManifest | ci/src/download_plugins.py | .py | 3fb08811fbea20e6 | 7.91 | 66 |
import sys
from time import time
import json
import os
from pathlib import Path
import zipfile
import io
from subprocess import Popen, PIPE
from _utils import clean, id_name, language_list, language_name, plugin_reader, plugin_writer
import requests
import yaml
USER_PATH = Path(os.environ["APPDATA"], "FlowLauncher")... | Flow-Launcher/Flow.Launcher.PluginsManifest | ci/src/test-python.py | .py | da6bf38b25a91a49 | 8.41 | 66 |
"""Analytic surfaces demo: exports one of each surface type to STEP.
This example creates one solid for each class of analytic surface supported
by the native BREP system and exports them to STEP files. The user can choose
between:
1. Analytic form (native BREP with exact geometric definitions)
2. Faceted form (triang... | rdevaul/yapCAD | examples/analytic_surfaces_demo.py | .py | 7e0329b5dc9a4abf | 7.74 | 29 |
"""Simple generative rocket demo using yapCAD.
Builds a multi-stage rocket model, visualises it using pyglet, and exports
an STL file suitable for downstream slicers.
"""
from __future__ import annotations
import argparse
from pathlib import Path
from yapcad.geom import point, vect
from yapcad.geom3d import solid, ... | rdevaul/yapCAD | examples/rocket_demo.py | .py | a7fa698cc8ebe14d | 7.74 | 29 |
#!/usr/bin/env python3
"""
Simple Assembly Example - Demonstrating the yapCAD Assembly System
This example shows how to use yapCAD's datum-driven assembly system to
position parts using geometric constraints rather than hardcoded transforms.
Key concepts demonstrated:
1. Define parts with datum features (geometric re... | rdevaul/yapCAD | examples/simple_assembly.py | .py | 6c59d0ac694a2256 | 7.74 | 29 |
"""Demonstration of yapCAD solid boolean operations.
This script can visualise the result via OpenGL or export the mesh to STL/STEP.
STEP Export Modes:
- analytic: Uses native BREP with exact geometric definitions (PLANE, CYLINDER, etc.)
Requires OCC engine and preserves analytic surface data.
- faceted: ... | rdevaul/yapCAD | examples/solid_boolean_demo.py | .py | 349a49191fcbe54c | 7.74 | 29 |
#!/usr/bin/env python3
"""
Optimization driver for thrust structure design.
This script compares different hole configurations to find
the minimum-mass design that meets deflection requirements.
Uses actual FEA (FEniCSx) for deflection calculations when available,
falling back to analytical approximation otherwise.
... | rdevaul/yapCAD | examples/thrust_structure/optimize.py | .py | 4bcb11c2ae72ce99 | 7.74 | 29 |
#!/usr/bin/env python3
"""
Run validation checks on the thrust structure.
This script:
1. Creates a yapCAD package with the optimized thrust plate geometry
2. Runs the mass budget check using mass-check.yaml (no external deps)
3. Runs the FEA analysis using thrust-fea.yaml (requires fenics)
4. Outputs results includin... | rdevaul/yapCAD | examples/thrust_structure/run_validation.py | .py | 1c02436ff2dc96c3 | 7.74 | 29 |
#!/usr/bin/env python3
"""
Visualization and export utility for thrust structure designs.
Usage:
python visualize.py [OPTIONS]
Commands:
python visualize.py # View baseline design
python visualize.py --light # View 9-hole design
python visualize.py --optimized ... | rdevaul/yapCAD | examples/thrust_structure/visualize.py | .py | 380918155262d6a7 | 7.74 | 29 |
#!/usr/bin/env python3
"""
Runner for visual/interactive tests that require pyglet windows.
These tests are skipped during normal pytest runs.
Each test runs in a subprocess to prevent pyglet from terminating the runner.
"""
import sys
import os
import re
import glob
import subprocess
import ast
def find_visual_tests... | rdevaul/yapCAD | run_visual_tests.py | .py | 1f016c02a474a480 | 8.24 | 29 |
from __future__ import annotations
from dataclasses import is_dataclass, fields
from enum import Enum
from typing import Any, Dict
def _span_to_dict(span: Any) -> Dict[str, Any]:
# yapcad.dsl.tokens.SourceSpan
try:
start = span.start
end = span.end
return {
"start": {
... | rdevaul/yapCAD | service/core/ast_serialize.py | .py | fd307275d33bb5ea | 7.74 | 29 |
from __future__ import annotations
from typing import Any, Dict, Optional, Tuple
import anyio
from yapcad.dsl.runtime.interpreter import compile_and_run
from yapcad.dsl.lexer import tokenize
from yapcad.dsl.parser import parse
from .ast_serialize import ast_to_dict
class DslTimeoutError(RuntimeError):
pass
... | rdevaul/yapCAD | service/core/dsl_runner.py | .py | c54237670f0fbe6d | 7.74 | 29 |
from __future__ import annotations
from typing import Any, Dict, List, Tuple
from yapcad.geom3d import issolid, issurface
def _collect_surfaces(entity: Any) -> List[list]:
if issurface(entity):
return [entity]
if issolid(entity):
# solid structure: ['solid', [surfaces], voids, ...]
r... | rdevaul/yapCAD | service/core/tessellator.py | .py | 51d675976283402f | 7.74 | 29 |
#!/usr/bin/env python3
# Compare pyproject.toml's runtime dependencies against the
# conda-forge feedstock's `requirements.run` list and report drift.
#
# Why: the conda-forge regro-cf-autotick-bot can only bump version +
# sha256 on a release. If we add a new runtime dependency in
# pyproject.toml (or rename / remove... | cameronabrams/htpolynet | scripts/check-conda-sync.py | .py | 031b1a58bedeb0b8 | 7.77 | 33 |
"""Handles the analyze subcommand.
Author: Cameron F. Abrams <cfa22@drexel.edu>
"""
import json
import logging
import os
from pathlib import Path
import yaml
from ..core import projectfilesystem as pfs
from ..core.configuration import Configuration
from ..external import software as software
from ..external.gromacs... | cameronabrams/htpolynet | src/htpolynet/analysis/analyze.py | .py | bccf85a4ceeb0ba8 | 7.77 | 33 |
"""Handles the postsim subcommand.
Author: Cameron F. Abrams <cfa22@drexel.edu>
"""
import json
import logging
import os
import shutil
import yaml
import numpy as np
from ..analysis.plot import scatter
from ..core import projectfilesystem as pfs
from ..core.configuration import Configuration
from ..core.topocoord i... | cameronabrams/htpolynet | src/htpolynet/analysis/postsim.py | .py | ec7bd6eb23c77d27 | 7.77 | 33 |
"""Manages reading and parsing of YAML configuration files.
Author: Cameron F. Abrams <cfa22@drexel.edu>
"""
import json
import logging
import os
import yaml
logger = logging.getLogger(__name__)
class Configuration:
"""Pure data container for a build configuration file.
Reads and validates a YAML or JSON ... | cameronabrams/htpolynet | src/htpolynet/core/configuration.py | .py | 0ac7c213afd2c301 | 7.77 | 33 |
"""Provenance records for cached GAFF parameterizations.
A parameterization checked into the user library is identified by molecule
name alone, but the numbers it contains depend on more than the name: the
antechamber charge method, the net charge passed as ``-nc``, and the atom-type
set. Without a record of those, a... | cameronabrams/htpolynet | src/htpolynet/core/paramcache.py | .py | dcc4c6f7a178bed4 | 7.77 | 33 |
"""
.. module:: chain
:synopsis: Manages data structure that keeps track of polymerized chains
.. moduleauthor: Cameron F. Abrams, <cfa22@drexel.edu>
"""
import logging
logger=logging.getLogger(__name__)
class Chain:
def __init__(self,head=-1,tail=-1,idx=-1):
self.idx_list=[]
if head!=-1:
... | cameronabrams/htpolynet | src/htpolynet/cure/chain.py | .py | f9de41144e7150a8 | 7.77 | 33 |
"""Handles expansion of reactions based on chains, stereoisomers, and symmetry.
Author: Cameron F. Abrams <cfa22@drexel.edu>
"""
import logging
from copy import deepcopy
from itertools import product
from ..core.molecule import Molecule, MoleculeList, MoleculeDict
from ..cure.reaction import reaction_stage, Reaction... | cameronabrams/htpolynet | src/htpolynet/cure/expandreactions.py | .py | fcd36c02e3827601 | 7.77 | 33 |
"""Handles Reaction objects.
Author: Cameron F. Abrams <cfa22@drexel.edu>
"""
import logging
from copy import deepcopy
from enum import Enum
from ..analysis.plot import draw_reaction_dag
logger=logging.getLogger(__name__)
class reaction_stage(Enum):
"""Enumerated reaction stage
"""
build=0 # only used... | cameronabrams/htpolynet | src/htpolynet/cure/reaction.py | .py | 4bec3ad07a1c6249 | 7.77 | 33 |
"""Thin wrapper around subprocess for running external commands.
Author: Cameron F. Abrams <cfa22@drexel.edu>
"""
import logging
import subprocess
import time
from ..utils import profiling
logger = logging.getLogger(__name__)
_LINELEN = 55
def opts(**kwargs):
"""Format keyword arguments as '-key value' flag p... | cameronabrams/htpolynet | src/htpolynet/external/command.py | .py | 29899657c3f89eec | 7.77 | 33 |
"""Methods for handling the gmx suite of executables.
Author: Cameron F. Abrams <cfa22@drexel.edu>
"""
import logging
import os
from collections import namedtuple
from itertools import product
import numpy as np
import pandas as pd
from ..external import software as sw
from ..external.command import opts, run
logge... | cameronabrams/htpolynet | src/htpolynet/external/gromacs.py | .py | 284b470384ee1da4 | 7.77 | 33 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.