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 |
|---|---|---|---|---|---|---|
"""
Programmatic API for asimov monitor functionality.
This module provides Python functions to run asimov monitoring operations
programmatically, suitable for use in scripts, Jupyter notebooks, or custom
automation workflows.
"""
from typing import Optional, List
from asimov import condor, logger, LOGGER_LEVEL
from... | etive-io/asimov | asimov/monitor_api.py | .py | a1cd6f9fa03dd167 | 7.45 | 7 |
"""
Context management for asimov monitor loop.
This module provides the MonitorContext class that coordinates state handling
and manages analysis monitoring.
"""
from asimov import logger, LOGGER_LEVEL
logger = logger.getChild("monitor_context")
logger.setLevel(LOGGER_LEVEL)
class MonitorContext:
"""
Cont... | etive-io/asimov | asimov/monitor_context.py | .py | 3248ea9e5302dc56 | 7.45 | 7 |
"""
Helper functions for the asimov monitor loop.
This module provides reusable functions to monitor analyses,
replacing the duplicated code in the monitor command.
"""
import click
from asimov import logger, LOGGER_LEVEL
from asimov.cli import ACTIVE_STATES
from asimov.monitor_states import get_state_handler
from as... | etive-io/asimov | asimov/monitor_helpers.py | .py | c1898ff60735535b | 7.45 | 7 |
import logging
import os
import sys
if sys.version_info < (3, 10):
from importlib_metadata import entry_points
else:
from importlib.metadata import entry_points
# Ignore warnings from the condor module
import warnings
import click
warnings.filterwarnings("ignore", module="htcondor") # NoQA
# Replace this w... | etive-io/asimov | asimov/olivaw.py | .py | f68c418d15dd81cf | 7.45 | 7 |
"""
Minimal testing pipeline for ProjectAnalysis.
This pipeline is designed to test asimov's ProjectAnalysis infrastructure,
which operates across multiple events/subjects. It provides a minimal
implementation ideal for testing and as a template for population analyses.
"""
import os
from pathlib import Path
from .... | etive-io/asimov | asimov/pipelines/testing/project.py | .py | 4246eb8f7772f6e8 | 7.95 | 7 |
"""
Minimal testing pipeline for SimpleAnalysis.
This pipeline is designed to be used for testing asimov's infrastructure
without requiring a real gravitational wave analysis pipeline.
It provides a minimal implementation that completes quickly, making it
ideal for end-to-end testing and as a template for pipeline dev... | etive-io/asimov | asimov/pipelines/testing/simple.py | .py | 036d753fa6701e61 | 7.95 | 7 |
"""
Minimal testing pipeline for SubjectAnalysis.
This pipeline is designed to test asimov's SubjectAnalysis infrastructure,
which operates on multiple SimpleAnalysis results for a single event/subject.
It provides a minimal implementation ideal for testing and as a template.
"""
import os
from pathlib import Path
... | etive-io/asimov | asimov/pipelines/testing/subject.py | .py | 48fd29703bbaff26 | 7.95 | 7 |
"""
Prior specification and interface system for asimov.
This module provides a flexible prior specification system that:
1. Validates prior specifications using pydantic
2. Allows pipeline-specific conversion of priors
3. Supports both simple priors and reparameterizations
"""
from typing import Any, Dict, Optional,... | etive-io/asimov | asimov/priors.py | .py | 11d2ee9bdf11b66d | 7.45 | 7 |
"""
Project management and Python API interface.
This module provides a Python API for creating and managing asimov projects.
"""
import os
try:
import ConfigParser as configparser
except ImportError:
import configparser
from asimov import config as global_config, logger, LOGGER_LEVEL
from asimov.ledger imp... | etive-io/asimov | asimov/project.py | .py | caa7f4920eb29cca | 7.45 | 7 |
"""
Review-related code.
Note
----
This code does not directly relate to the review of *asimov*
but rather to the review of events which it has been used to analyse.
"""
from datetime import datetime
STATES = {"REJECTED", "APPROVED", "PREFERRED", "DEPRECATED"}
review_map = {
"deprecated": "warning",
"none": ... | etive-io/asimov | asimov/review.py | .py | 33ed77a3fa99a3de | 7.45 | 7 |
"""
Helper utilities for scheduler integration in asimov.
This module provides convenience functions and decorators for using
the scheduler API in pipelines and other parts of asimov.
"""
import configparser
import functools
from asimov import config, logger
from asimov.scheduler import get_scheduler, JobDescription,... | etive-io/asimov | asimov/scheduler_utils.py | .py | 53d5f88d40f6b9fb | 7.45 | 7 |
"""
Strategy expansion for asimov blueprints.
This module provides functionality to expand strategy definitions in blueprints
into multiple analyses, similar to GitHub Actions matrix strategies.
"""
from copy import deepcopy
from typing import Any, Dict, List
import itertools
def set_nested_value(dictionary: Dict[s... | etive-io/asimov | asimov/strategies.py | .py | fc49e8d8d40e33bf | 7.45 | 7 |
"""
This file contains code to allow unittests to be written with
Asimov so that productions can be tested with minimal boilerplate.
This module contains the factory classes for other asimov tests.
"""
import os
import unittest
import shutil
import git
from asimov import current_ledger as ledger
from asimov.cli.projec... | etive-io/asimov | asimov/testing.py | .py | 18737cde8ce2802f | 7.95 | 7 |
import collections
import os
from contextlib import contextmanager
from copy import deepcopy
from pathlib import Path
from asimov import logger
@contextmanager
def set_directory(path: (Path, str)):
"""
Change to a different directory for the duration of the context.
Args:
path (Path): The path t... | etive-io/asimov | asimov/utils.py | .py | 86634ac0a7c004a4 | 7.45 | 7 |
_missing = object()
class cached_property(object):
"""A decorator that converts a function into a lazy property. The
function wrapped is called the first time to retrieve the result
and then that calculated result is used the next time you access
the value::
class Foo(object):
... | FOLIO-FSE/FolioClient | src/folioclient/cached_property.py | .py | ae7366f16e2a9577 | 7.56 | 12 |
"""
Pytest configuration for FolioClient tests.
"""
import pytest
def pytest_addoption(parser):
"""Add command line option to enable integration tests."""
parser.addoption(
"--run-integration",
action="store_true",
default=False,
help="Run integration tests against FOLIO snaps... | FOLIO-FSE/FolioClient | tests/conftest.py | .py | 4291c539839e3bf0 | 8.06 | 12 |
"""
Integration tests for FolioClient against FOLIO community snapshot environment.
These tests are designed to run against the live FOLIO snapshot system and are
disabled by default to prevent them from running during normal test execution.
To run these tests:
pytest tests/integration_tests.py --run-integration
... | FOLIO-FSE/FolioClient | tests/integration_tests.py | .py | 9f736c8184e1292e | 7.06 | 12 |
"""Tests for the exceptions module."""
import inspect
import pytest
from unittest.mock import Mock
import httpx
from folioclient.exceptions import (
# Base exceptions
FolioError,
FolioClientClosed,
# Connection errors
FolioConnectionError,
FolioSystemUnavailableError,
FolioTimeoutErr... | FOLIO-FSE/FolioClient | tests/test_exceptions.py | .py | a12f8614332e67cb | 7.06 | 12 |
"""
Shared test utilities for FolioClient tests.
This module provides robust, Pythonic test utilities that avoid cross-test
contamination while maintaining compatibility across Python versions.
"""
from unittest.mock import Mock, patch
from contextlib import contextmanager
@contextmanager
def folio_auth_patcher():... | FOLIO-FSE/FolioClient | tests/test_utils.py | .py | d70da1958bcad5a2 | 8.06 | 12 |
from ..util.util import get_ansible, get_variable
testinfra_runner, testinfra_hosts = get_ansible()
def read_file(host, path):
user = get_variable(host, "operator_user")
with host.sudo(user):
return host.check_output(f"cat {path}")
def test_preserved_file_survives_update(host):
# netbox/setting... | osism/ansible-collection-commons | molecule/delegated/tests/configuration/preserve.py | .py | 4a0eca41a30f648c | 7.07 | 13 |
import pytest
from .util.util import get_ansible, get_variable
testinfra_runner, testinfra_hosts = get_ansible()
def test_install_type(host):
assert get_variable(host, "docker_compose_install_type") == "package"
def test_systemd(host):
f = host.file("/etc/systemd/system/docker-compose@.service")
asser... | osism/ansible-collection-commons | molecule/delegated/tests/docker_compose.py | .py | 4b7efa2ba7e38b0f | 7.07 | 13 |
from .util.util import get_ansible
testinfra_runner, testinfra_hosts = get_ansible()
def test_packages_installed(host):
"""Check if the gnupg2 and pass packages are installed."""
# Check if gnupg2 is installed
gnupg2_pkg = host.package("gnupg2")
assert gnupg2_pkg.is_installed, "The gnupg2 package is... | osism/ansible-collection-commons | molecule/delegated/tests/docker_login.py | .py | 221b77d8c6b36821 | 7.07 | 13 |
import pytest
from .util.util import get_ansible, get_variable
testinfra_runner, testinfra_hosts = get_ansible()
def is_virtual_machine(host):
"""Check if the host is running inside a virtual machine."""
cmd = host.run("systemd-detect-virt --quiet")
return cmd.rc == 0
def test_ipmitool_package_install... | osism/ansible-collection-commons | molecule/delegated/tests/ipmitool.py | .py | cf9f363bdc679f85 | 8.07 | 13 |
from .util.util import get_ansible, get_variable
testinfra_runner, testinfra_hosts = get_ansible()
def test_limits_set_correctly(host):
# Fetching the variables from Ansible
limits_defaults = get_variable(host, "limits_defaults")
limits_extra = get_variable(host, "limits_extra")
combined_limits = {**... | osism/ansible-collection-commons | molecule/delegated/tests/limits.py | .py | ffd4978db085da4d | 7.07 | 13 |
import pytest
from ..util.util import (
get_ansible,
get_variable,
get_from_url,
extract_url_from_variable,
)
testinfra_runner, testinfra_hosts = get_ansible()
def check_ansible_os_family(host):
if get_variable(host, "ansible_os_family", True) != "Debian":
pytest.skip("ansible_os_family ... | osism/ansible-collection-commons | molecule/delegated/tests/lynis/debian.py | .py | 0a66519c23a8278a | 8.07 | 13 |
import pytest
from ..util.util import get_ansible, get_variable
testinfra_runner, testinfra_hosts = get_ansible()
def test_podman_pkg(host):
package_name = get_variable(host, "podman_package_name")
assert package_name != ""
package = host.package(package_name)
assert package.is_installed
@pytest.m... | osism/ansible-collection-commons | molecule/delegated/tests/podman/main.py | .py | 3bf2dbcce5fa9a99 | 7.07 | 13 |
from collections import namedtuple
from ovn_context import Context
from cms.ovn_kubernetes import Namespace
from ovn_ext_cmd import ExtCmd
import ovn_exceptions
DENSITY_N_BUILD_PODS = 6
DENSITY_N_PODS = 4
DENSITY_N_TOT_PODS = DENSITY_N_BUILD_PODS + DENSITY_N_PODS
# In ClusterDensity.run_iteration() we assume at leas... | ovn-org/ovn-heater | ovn-tester/cms/ovn_kubernetes/tests/cluster_density.py | .py | d54b2ab9a2015f3a | 7.1 | 15 |
import itertools
from typing import List, Dict, Optional
VALID_PROTOCOLS = ['tcp', 'udp', 'sctp']
class InvalidProtocol(Exception):
def __init__(self, invalid_protocols):
self.args = invalid_protocols
def __str__(self):
return f"Invalid Protocol: {self.args}"
class OvnLoadBalancer:
def... | ovn-org/ovn-heater | ovn-tester/ovn_load_balancer.py | .py | 62583f9aaafd0ed1 | 8.1 | 15 |
#!/usr/bin/env python3
import logging
import sys
import netaddr
import yaml
import importlib
import ovn_exceptions
import gc
import time
from collections import namedtuple
from ovn_context import Context
from ovn_sandbox import PhysicalNode
from ovn_workload import (
BrExConfig,
ClusterConfig,
)
from ovn_util... | ovn-org/ovn-heater | ovn-tester/ovn_tester.py | .py | 64a1a89b0483225a | 7.1 | 15 |
from functools import wraps
import flask
import httplib2
from apiclient import discovery
from flask.views import MethodView
from oauth2client import client
flow = None
def init_app(app):
if app.config["USE_GOOGLE_AUTH"]:
global flow
flow = client.flow_from_clientsecrets(
"/app/resour... | Nextdoor/gogo | src/auth.py | .py | b658d6c32333d0dd | 7.54 | 11 |
import urllib
from flask import current_app, render_template, request
from flask.views import View
from sqlalchemy import asc, desc
import auth
# Keys map to values in list.html for the sortColumn class element val attribute.
SORT_MAP = {
"hits": "hits",
"name": "name",
"owner": "owner",
"dateCreated... | Nextdoor/gogo | src/base_list_view.py | .py | 042e00b0eaa0c252 | 7.54 | 11 |
"""Crawl orchestration: discover works, then fill them in as cheaply as possible.
A run has three stages, each of which can be skipped or resumed independently:
1. **Discover** — walk the search listing newest-first. Because the listing is
ordered by release date, an incremental run only needs to read until it has... | eggplants/dojinvoice_db | dojinvoice_db/crawler.py | .py | a5bbc42038e2a3d6 | 7.62 | 16 |
"""Request-efficient access layer over :mod:`dlsite_async`.
Three kinds of request are used, in increasing cost per work:
1. **Search listing** (:meth:`DlsiteClient.fetch_listing_ids`) — one request
returns up to 100 product IDs, newest first.
2. **Product info ajax** (:meth:`DlsiteClient.fetch_product_info`) — DL... | eggplants/dojinvoice_db | dojinvoice_db/dlsite.py | .py | 6814c7172a621102 | 7.62 | 16 |
"""Plain data structures shared by the client, database, crawler and CLI.
The canonical work model is :class:`dlsite_async.Work`; this module only adds
what DLsite exposes but ``dlsite-async`` does not model (sales/price/rating
figures), plus the search-listing query and the crawl option/result records.
"""
from __fu... | eggplants/dojinvoice_db | dojinvoice_db/models.py | .py | a4f9a7e04fe3ebd6 | 7.62 | 16 |
"""Embed the `tbls doc` output into README.md as a single collapsed section.
`tbls doc` writes one markdown file per table plus an index that links to them
with relative `*.md` links. Those links are meaningless once the text lives in
README.md, so this script concatenates the whole set into one document:
headings are... | eggplants/dojinvoice_db | scripts/embed_tbls_doc.py | .py | df421a2a8f3492f7 | 7.62 | 16 |
"""Basic tests for HippsDimes package."""
import numpy as np
import pytest
# Import the main module
import HippsDimes
import hipps_dimes
import hipps_dimes.numerics as numerics
def test_import():
"""Test that the package can be imported."""
assert HippsDimes is not None
def test_construct_connectivity_mat... | anyuzx/HIPPS-DIMES | tests/test_basic.py | .py | 0fa6d817d5999e34 | 8.07 | 13 |
"""Regression tests for the Dynamics class."""
import numpy as np
import pytest
import HippsDimes
def test_dynamics_copies_input_connectivity_matrix():
"""External mutations of the input matrix should not affect the model."""
a = np.array(
[
[2.0, -1.0, -1.0],
[-1.0, 2.0, -1.... | anyuzx/HIPPS-DIMES | tests/test_dynamics.py | .py | 13d53979bbf768d0 | 8.07 | 13 |
from sympy import * # provides mathematical interface for symbolic calculations
from sympy.physics.mechanics import Point, ReferenceFrame, dynamicsymbols
from dynpy import * # enables mechanical models for mathematical modelling
from dynpy.dynamics import HarmonicOscillator, LagrangesDynamicSystem
from dynpy.models.... | bogumilchilinski/dynpy | models/mechanics/absorber.py | .py | c9a1e88ccb01150b | 7.52 | 10 |
# Copyright 2018 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | ciphergoth/pylambdac | tests/tdata.py | .py | 6bcc0352ba06e2e6 | 7.16 | 20 |
import re
import urllib.parse
from collections import Counter
from typing import Iterable, Sequence, Tuple
from cohort.models.fhir_filter import FhirFilter
from cohort.models.request_query_snapshot import RequestQuerySnapshot
# Keep URL quoting rules centralized (same behavior everywhere).
_URL_QUOTE_SAFE = "~()*!.'"... | aphp/Cohort360-Back-end | .patch_and_fix/MEP_2025_12_15/patch_utils.py | .py | 919792973c314570 | 7.45 | 7 |
__all__ = [
'pier_displacement',
'pier_shear_strength'
]
from math import pi, sqrt
from calla import abacus, InputError
class pier_displacement(abacus):
"""
E2地震作用下墩顶位移验算
《城市桥梁抗震设计规范》(CJJ 166-2011)第7.3.4条
"""
__title__ = 'E2地震墩顶位移验算'
__inputs__ = [
('H', '<i>H</i>', 'cm',... | warmwaver/calla | calla/CJJ/earth_quake.py | .py | ee194a403f503416 | 7.57 | 13 |
"""CJJ 11-2011 城市桥梁设计规范"""
__all__ = [
'crowd',
]
from calla import abacus
from collections import OrderedDict
from math import pi, sqrt, sin, cos, tan
class crowd(abacus):
'''
人群荷载
《城市桥梁设计规范》(CJJ 11-2011)10.0.5节
'''
__title__ = '人群荷载'
__inputs__ = OrderedDict([
('wp',... | warmwaver/calla | calla/CJJ/loads.py | .py | 4ae68b6abefcfd45 | 7.57 | 13 |
"""钢管混凝土构件承载力
GB 50936-2014 钢管混凝土结构技术规范 第5.3.1节
"""
__all__ = [
'bearing_capacity',
'solid_circular_CSFT_compressive_capacity',
]
from collections import OrderedDict
from math import pi, sqrt
from calla import abacus, InputError
class bearing_capacity(abacus):
"""
钢管混凝土构件在复杂受力状态下承载力计算
... | warmwaver/calla | calla/GB/CFST.py | .py | e7c933ce2512b9b5 | 7.57 | 13 |
"""裂缝控制验算
《混凝土结构设计规范》(GB 50010-2010)第7.1节
"""
__all__ = [
'crack_width',
]
from math import pow
from calla import abacus, InputError
class crack_width(abacus):
"""
裂缝宽度计算
《混凝土结构设计规范》(GB 50010-2010)第7.1节
"""
__title__ = '裂缝宽度'
__inputs__ = [
# options
# 0:计算裂缝宽度;
... | warmwaver/calla | calla/GB/crack_width.py | .py | e7431dca8f2fd493 | 7.57 | 13 |
"""材料
《混凝土结构设计规范》(GB 50010-2010)第4节
"""
__all__ = []
import calla
class concrete(calla.material.concrete):
# 混凝土强度变异系数(GB)
δcs = {'C15': 0.233, 'C20': 0.206, 'C25': 0.189, 'C30': 0.172, 'C35': 0.164, 'C40': 0.156,
'C45': 0.156, 'C50': 0.149, 'C60': 0.141}
class rebar(calla.material.rebar):
... | warmwaver/calla | calla/GB/material.py | .py | 3294587358a03bf4 | 7.57 | 13 |
"""
受冲切承载力计算
《混凝土结构设计规范》(GB 50010-2010)第6.5节
"""
from collections import OrderedDict
from calla import abacus
eta1 = lambda beta_s: 0.4+1.2/beta_s
eta2 = lambda alpha_s,h0,um: 0.5+alpha_s*h0/4/um
F = lambda beta_h,ft,sigma_pc_m,eta,um,h0: (0.7*beta_h*ft+0.25*sigma_pc_m)*eta*um*h0
class punching_shear_capacity(abacus... | warmwaver/calla | calla/GB/punching_shear_capacity.py | .py | 643d29b53e180d6a | 7.57 | 13 |
"""钢筋混凝土斜截面承载力计算
《混凝土结构设计规范》(GB 50010-2010)第6.3.1节
"""
__all__ = [
'shear_capacity',
]
from math import pi, sin
from calla import abacus
from calla.GB.material import concrete, rebar, prestressed_steel, materials_util
class shear_capacity(abacus):
"""钢筋混凝土斜截面承载力计算
《混凝土结构设计规范》(GB 50010-2010)第6.3.1节
... | warmwaver/calla | calla/GB/shear_capacity.py | .py | 89a3c952d6ee8a08 | 7.57 | 13 |
"""
构件设计
依据:《钢结构设计规范》(GB 50017-2017)
"""
__all__ = [
'flange',
]
from collections import OrderedDict
from calla import abacus, InputError, html
from math import pi, sqrt
class flange(abacus):
"""
受压板件加劲肋几何尺寸验算
《钢结构设计标准》(GB 50017-2017) 第9.1.1节
"""
__title__ = '受压板件加劲肋几何尺寸验算'
__inputs__... | warmwaver/calla | calla/GB/steel.py | .py | cb8ae13cab5df773 | 7.57 | 13 |
"""
公路板式橡胶支座
《公路钢筋混凝土及预应力混凝土桥涵设计规范》(JTG 3362-2018)8.7节
《公路桥梁板式橡胶支座》(JT/T 4-2019 )
"""
__all__ = [
'GJZ',
'GYZ',
]
from calla import abacus
from math import pi
class epbearing(abacus):
'''板式橡胶支座基类'''
__inputs__ = [
('t','<i>t</i>','mm',21,'支座总厚度'),
('t1','<i>t</i><sub>1</su... | warmwaver/calla | calla/JTG/bearing.py | .py | 57f2d0aa4d22cfd9 | 7.57 | 13 |
"""
《公路钢筋混凝土及预应力混凝土桥涵设计规范》(JTG 3362-2018)第8.3节
"""
__all__ = [
'diaphragm',
]
from math import pi, sin, cos, acos, sqrt
from collections import OrderedDict
from calla import abacus, numeric
from calla.JTG.material import materials_util
class diaphragm(abacus, materials_util):
"""支座处横隔梁计算
《公路钢筋混凝土及预应力... | warmwaver/calla | calla/JTG/diaphragm.py | .py | 345a5d469916ebb1 | 7.57 | 13 |
"""
JTG 3363-2019 公路桥涵地基与基础设计规范
"""
__all__ = [
'groundbase',
'eccentricity',
'overturning',
'sliding'
]
from calla import abacus, InputError
from collections import OrderedDict
from math import pi, sqrt, sin, cos, tan
class groundbase(abacus):
"""
地基承载力
《公路桥涵地基与基础设计规范》(JTG 3363-2019)... | warmwaver/calla | calla/JTG/foundation.py | .py | 89cab01d31c6478a | 7.57 | 13 |
"""JTG D60-2015 公路桥涵设计通用规范"""
__all__ = [
'load_combination',
'earth_pressure',
'column_earth_pressure_width',
]
from calla import abacus, InputError, numeric
from collections import OrderedDict
from math import pi, sqrt, sin, cos, tan
class load_combination:
# ULS
# 基本组合(fundamental combinat... | warmwaver/calla | calla/JTG/loads.py | .py | 7dbff229adcf6421 | 7.57 | 13 |
# __all__ = [
# 'concrete',
# 'rebar',
# 'ps',
# ]
__all__ = []
import calla
class concrete(calla.material.concrete):
# 强度等级
grades = ('C25', 'C30', 'C35', 'C40', 'C45', 'C50', 'C55', 'C60', 'C65', 'C70', 'C75', 'C80')
fcs = (11.5, 13.8, 16.1, 18.4, 20.5, 22.4, 24.4, 26.5, 28.5, 30.5, 32.... | warmwaver/calla | calla/JTG/material.py | .py | 25422deada42fed6 | 7.57 | 13 |
"""
墩台盖梁
《公路钢筋混凝土及预应力混凝土桥涵设计规范》(JTG 3362-2018)第8.4节
"""
__all__ = [
'flexural_capacity',
'shear_capacity',
'cap_cantilever',
'pier_top',
]
from collections import OrderedDict
from math import sqrt, pi, sin, cos, tan, atan
from calla import abacus, InputError, html
from calla.JTG.bearing_capacity i... | warmwaver/calla | calla/JTG/pier_cap.py | .py | 8a8afdd89901199a | 7.57 | 13 |
"""
桩基承台
《公路钢筋混凝土及预应力混凝土桥涵设计规范》(JTG 3362-2018)第8.5节
"""
__all__ = [
'pile_vertical_force',
'bearing_capacity',
'punching_capacity',
]
from math import pi, sin, cos, tan, atan
from calla import abacus, InputError, html
from calla.JTG.material import concrete, materials_util
class pile_vertical_force(... | warmwaver/calla | calla/JTG/pile_cap.py | .py | f6eb2a22f5e2f018 | 7.57 | 13 |
"""
混凝土收缩徐变
"""
__all__ = [
'shrinkage',
]
from collections import OrderedDict
from calla import abacus, InputError, html
from math import pi, sqrt
class shrinkage(abacus):
"""
混凝土收缩应变
《公路钢筋混凝土及预应力混凝土桥涵设计规范》(JTG 3362-2018)附录C.1
"""
__title__ = '混凝土收缩应变'
__inputs__ = OrderedDict((
... | warmwaver/calla | calla/JTG/shrinkage_creep.py | .py | 86f49b57dbe1a448 | 7.57 | 13 |
"""JTG/T 3360-01-2018 公路桥梁抗风设计规范"""
__all__ = [
'wind_reference_speed',
'wind_girder',
'wind_element',
'flutter_stability'
]
from calla import abacus, InputError, numeric
from math import pi, sqrt
class wind_reference_speed(abacus):
'''
设计基准风速
《公路桥梁抗风设计规范》(JTG/T 3360-01-2018)第4.2.6节
... | warmwaver/calla | calla/JTG/wind.py | .py | b4fc40206ebd28bc | 7.57 | 13 |
"""
钢筋混凝土结构强度计算
《铁路桥涵混凝土结构设计规范》(TB 10092-2017)第6节
"""
__all__ = [
'beam_strength',
'column_strength',
'crack_width'
]
from math import pi, sqrt
from calla import abacus, numeric
def eval_x(b, h0, As, n):
μ = As/b/h0
α = sqrt((n*μ)**2+2*n*μ)-n*μ
return α*h0
class beam_strength(abacus):
... | warmwaver/calla | calla/TB/RC_strength.py | .py | 9f8f04de053629dc | 7.57 | 13 |
__all__ = [
'html2text',
'table2html',
'table2text',
'save',
'save_and_open',
'default_html_style',
]
default_html_style = '''
body{font:16px times new roman,宋体}
table{border-collapse:collapse; font-size:14px;}
'''
def html2text(html, sub='', sup=''):
"""Convert html to plain text
... | warmwaver/calla | calla/html.py | .py | cfadaa3a19571bd5 | 7.57 | 13 |
"""
持久状况承载能力极限状态计算
《公路钢筋混凝土及预应力混凝土桥涵设计规范》(JTG D62-2004)第5节
"""
__all__ = [
'bc_round',
]
from math import pi, sin, cos, acos
from collections import OrderedDict
from calla import abacus, numeric
class bc_round(abacus):
"""
圆形截面承载力计算
公路钢筋混凝土及预应力混凝土桥涵设计规范(JTG D62-2004)第5.3.9节及附录C
>>> bc_round.s... | warmwaver/calla | calla/legacy/JTG D62-2004/bearing_capacity.py | .py | ba2934220699982c | 7.57 | 13 |
"""
JTG D63-2007 公路桥涵地基与基础设计规范
"""
__all__ = [
'groundbase',
'eccentricity',
'overturning',
'sliding'
]
from calla import abacus
from collections import OrderedDict
from math import pi, sqrt, sin, cos, tan
class groundbase(abacus):
"""
地基承载力
《公路桥涵地基与基础设计规范》(JTG D63-2007)第4.2.2~4节
... | warmwaver/calla | calla/legacy/JTG D63-2007/foundation.py | .py | 12906f432363fd9e | 7.57 | 13 |
"""JTG D60-2015 公路桥涵设计通用规范"""
__all__ = [
'wind',
]
from calla import abacus
from collections import OrderedDict
from math import pi, sqrt, sin, cos, tan
class wind(abacus):
'''风荷载计算
《公路桥梁抗风设计规范》(JTG/T D60-01-2004)
'''
__title__ = '风荷载计算'
__inputs__ = OrderedDict([
('B',('<i>B... | warmwaver/calla | calla/legacy/JTG_T D60-01-2004/wind.py | .py | dddcde07cbda2763 | 7.57 | 13 |
"""材料
《混凝土结构设计规范》(GB 50010-2010)第4节
《公路钢筋混凝土及预应力混凝土桥涵设计规范》(JTG 3362-2018)第3节
"""
__all__ = [
'concrete',
'rebar'
]
from math import pi, sqrt
class concrete:
"""混凝土材料"""
# 混凝土重力密度(kN/m^3)
density = 25
# 强度等级
grades = ('C15', 'C20', 'C25', 'C30', 'C35', 'C40', 'C45', 'C50', 'C60', 'C65',... | warmwaver/calla | calla/material.py | .py | b365068abf47ffd8 | 7.57 | 13 |
__all__ = [
'NumericError',
'binary_search_solve',
'iteration_method_solve',
'secant_method_solve',
'query_table',
]
class NumericError(Exception):
def __init__(self, message:str):
self.message = message
Exception.__init__(self, self.message)
def binary_search_solve(functio... | warmwaver/calla | calla/numeric.py | .py | 62bfb1e1fc5d7c65 | 7.57 | 13 |
import unittest
class TestCase(unittest.TestCase):
def assertApproxEqual(self, v, t, tolerance=0.01):
"""
判断值是否与目标值近似相等(Approximately Equal)
采用差值与目标值的比值判定
Arguments:
v: 需要判断的值(value)
t: 目标值(target value)
tolerance: 容许比值
Returns:
... | warmwaver/calla | calla/test.py | .py | 045416f4d7eceee8 | 8.07 | 13 |
import getpass
import logging
import subprocess
from saml2awsmulti.file_io import load_saml2aws_config
class Saml2AwsHelper:
def __init__(self, configfile, session_duration, browser_autofill):
self._configfile = configfile
self._session_duration = session_duration
self._browser_autofill =... | kyhau/saml2aws-multi | saml2awsmulti/saml2aws_helper.py | .py | a04baa20e5a8d888 | 7.65 | 19 |
"""Label relaxation loss (Lienen & Hüllermeier, AAAI 2021).
Instead of a precise (possibly smoothed) target distribution, label relaxation
trains against the credal set of distributions
Q_{alpha,y} = { p in simplex : p_y >= 1 - alpha },
i.e. all distributions assigning probability at least ``1 - alpha`` to the
o... | julilien/LabelRelaxation | src/label_relaxation/loss.py | .py | 345808081de311af | 7.6 | 15 |
"""Mixup-compatible label relaxation loss.
Label relaxation for a mixed (mixup / CutMix) target ``lam * e_i + (1 - lam) * e_j``: the
credal set becomes ``S = { p in simplex : p_i >= lam*(1-alpha), p_j >= (1-lam)*(1-alpha) }``
and the loss is the KL projection ``min_{q in S} KL(q || p_hat)`` (zero inside ``S``). The
pr... | julilien/LabelRelaxation | src/label_relaxation/mixup.py | .py | 1a3762e747f22117 | 7.6 | 15 |
import io
import json
import os
import unittest
from contextlib import redirect_stderr, redirect_stdout
from unittest.mock import patch
from geojson_rewind import rewind
from geojson_rewind.rewind import main
class RewindTests(unittest.TestCase):
maxDiff = None
def get_fixture_path(self, filename):
... | chris48s/geojson-rewind | tests/tests.py | .py | 3eda475fcf6a604b | 7.16 | 20 |
from . import scene
def remove_node_name(blendshape):
"""
This will rename channels such that they will be split by a "." and the channel
will be named with the last part.
This is particularly because maya exports its fbx files with the blendshape node
as the channel name.
:param ... | mikemalinowski/fbxtra | fbxtra/morphs.py | .py | 9a2c1f1a17ae2a3d | 7.48 | 8 |
from inspect import signature
from itertools import repeat
from typing import (Optional, NamedTuple, NewType, Callable, Dict, Mapping, TypeVar, Type, Union, Sequence, Any,
Iterable, Tuple)
Sentinel = type("Sentinel", (), {})
SENTINEL = Sentinel()
FORMATTERS = "_formatters" # attr name to keep refe... | Ricyteach/simpleformatter | simpleformatter/simpleformatter.py | .py | 398ba3d59b73d63a | 7.45 | 7 |
"""Basic graphics and base classes for spacetime plots and animations in
special relativity."""
from abc import ABC, abstractmethod
import math
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
from specrel.graphics import graphrc
class FigureCreator:
"""Something that can create an... | johanngan/special_relativity | specrel/graphics/basegraph.py | .py | 9a816c8c2b6d18bd | 7.95 | 7 |
"""Composite graphics that glue together one or more simple spacetime
animations in special relativity.
"""
from abc import abstractmethod
import copy
import os
import subprocess
import matplotlib.pyplot as plt
from specrel.graphics import graphrc
import specrel.graphics.basegraph as bgraph
import specrel.graphics.s... | johanngan/special_relativity | specrel/graphics/companim.py | .py | 8e87e8523d99f7d1 | 7.95 | 7 |
"""Objects that form color gradients across regions of spacetime, representing
continuous change of some sort.
"""
from matplotlib.colors import to_rgba
import specrel.geom as geom
def _calc_colorgrad(x, point1, point2, color1, color2):
"""Calculate a linear color gradient value between two points at some
pr... | johanngan/special_relativity | specrel/spacetime/gradient.py | .py | bed1369608616997 | 7.95 | 7 |
import unittest
import specrel.geom as geom
import specrel.spacetime.physical as phy
import specrel.visualize as vis
def _arrays_to_lists(arrarr, precision=7):
"""Get the data of a nested numpy array as a list of lists, rounded to some
precision.
"""
return [[round(p, precision) for p in arr] for arr ... | johanngan/special_relativity | specrel/tests/test_visualize.py | .py | 22870d9ffc3cb51e | 7.95 | 7 |
from pgraph import UGraph, UVertex, Edge
import itertools
class Frame(UVertex):
def __str__(self):
return f"Frame: {self.name}"
def __repr__(self):
return self.__str__()
def neighbours(self):
"""
Neighbours of a vertex
``v.neighbours()`` is a list of neighbours o... | petercorke/pgraph-python | posegraph.py | .py | dec39879a661d541 | 7.65 | 19 |
"""Logger module for setting up a custom logger."""
import logging
from datetime import datetime
LOG_FORMAT = (
"%(asctime)s [%(levelname)s]: %(filename)s(%(funcName)s:%(lineno)s) >> %(message)s"
)
LOG_FILEMODE = "w"
LOG_LEVEL = logging.INFO
class CustomFormatter(logging.Formatter):
def formatTime(self, rec... | E3SM-Project/e3sm_to_cmip | e3sm_to_cmip/_logger.py | .py | fbb565432755de07 | 7.45 | 7 |
import copy
import importlib.util
import os
import sys
from collections import defaultdict
from typing import Literal, get_args
import yaml
from e3sm_to_cmip import (
HANDLER_DEFINITIONS_PATH,
LEGACY_HANDLER_DIR_PATH,
MPAS_HANDLER_DIR_PATH,
)
from e3sm_to_cmip._logger import _setup_child_logger
from e3sm_... | E3SM-Project/e3sm_to_cmip | e3sm_to_cmip/cmor_handlers/utils.py | .py | f0e50fee370481db | 7.45 | 7 |
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.net.SocketException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import chat.dim.dmtp.Client;
import chat.dim.dmtp.ContactManager;
import ch... | moky/wormhole | dmtp-java/DMTP/src/test/java/DmtpClient.java | .java | bfaea6867922a05a | 7 | 9 |
# -*- coding: utf-8 -*-
from abc import ABC
from typing import Generic, TypeVar, Optional
from startrek.skywalker import Runnable, Runner, Daemon
from udp import SocketAddress
from udp import Connection, ActiveConnection
from udp import Hub, Arrival, PackageArrival
from udp import PorterDelegate, Porter
from udp imp... | moky/wormhole | dmtp-py/tests/auto.py | .py | a7b65bb9e0e2a187 | 7 | 9 |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
import json
import random
import socket
import sys
import os
import time
import traceback
from typing import Optional, List
from startrek.utils import Log, Logging
from startrek.skywalker import Runner
from startrek.net.state import StateOrder
from udp import SocketAdd... | moky/wormhole | dmtp-py/tests/client.py | .py | 0fe44a5f8bcf8131 | 7 | 9 |
"""Shared machinery for the per-class fit-diagnostics tables.
Each fitting class (Spectrum, Calibration, DecayChain) exposes a `.diagnostics`
DataFrame with the same core columns; per-class extra columns are appended
after the core set. The table is rebuilt on every fit, and is an empty frame
carrying the full schema... | jtmorrell/curie | curie/_diagnostics.py | .py | cb8e3056e3af06f4 | 7.48 | 8 |
"""Package-wide logging and shared configuration validation.
Every message curie emits on its own initiative (fit summaries, dropped-data
announcements, warnings) goes through the ``curie`` logger hierarchy defined
here. Output requested by the user (e.g. ``summarize()``) stays on plain
``print``.
Conventions:
- Me... | jtmorrell/curie | curie/_log.py | .py | bed9fc9b35f8beb9 | 7.48 | 8 |
"""Nuclear-data acquisition and connection layer.
Curie's databases live in a per-user data directory (~/.local/share/curie on
Linux, ~/Library/Application Support/curie on macOS, %LOCALAPPDATA%\\curie on
Windows; override with the CURIE_DATA_DIR environment variable) and are
fetched on first use from the GitHub data ... | jtmorrell/curie | curie/data.py | .py | 72a328c94c02339d | 7.48 | 8 |
import re
import numpy as np
import pandas as pd
from .data import _get_connection, _ensure_table
from .isotope import Isotope
from ._log import _get_logger
_log = _get_logger('library')
class Library(object):
"""Library of nuclear reaction data
Provides a means of searching and retrieving data from various nucl... | jtmorrell/curie | curie/library.py | .py | 565db0dcbfa1b743 | 7.48 | 8 |
import matplotlib.pyplot as plt
LIGHT = """#1abc9c #2ecc71 #3498db #9b59b6 #34495e #f1c40f #e67e22 #e74c3c #ecf0f1 #95a5a6
#81ecec #55efc4 #74b9ff #a29bfe #636e72 #ffeaa7 #fab1a0 #ff7675 #dfe6e9 #b2bec3
#7ed6df #badc58 #686de0 #e056fd #30336b #f6e58d #ffbe76 #ff7979 #dff9fb #95afc0
#00a8ff #4cd137 #273c75 #9c88ff #35... | jtmorrell/curie | curie/plotting.py | .py | 189b55096abde32c | 7.48 | 8 |
import numpy as np
import pandas as pd
from scipy.interpolate import interp1d
from .data import _get_connection
from .plotting import _init_plot, _draw_plot, colormap
from .isotope import Isotope
from .library import Library
from ._log import _get_logger, _choice, _validate_config
_log = _get_logger('reaction')
_IN... | jtmorrell/curie | curie/reaction.py | .py | 956a29d291be36ca | 7.48 | 8 |
"""Shared fixtures and data-availability handling for the curie public test suite.
Tests declare the databases they need via `requires_data`; a missing database produces an
explicit, reported skip. The CI job provides only a subset of the databases (see
.github/workflows/ci.yml) — everything needing another database s... | jtmorrell/curie | tests/conftest.py | .py | 607d835f083b9d95 | 7.98 | 8 |
"""Structural tests of the public API (public suite, category 5).
One test per public class, mirroring the documented (docstring) happy path and asserting
structure, units, and physical invariants - never exact data values. These hold across
nuclear-data library rebuilds; verbatim docstring execution (doctests) is pla... | jtmorrell/curie | tests/test_api_structure.py | .py | fa5233a5a62159bd | 7.98 | 8 |
"""Tests for the .diagnostics tables and the public fit-data surfaces.
Covers the shared schema (identical core columns on Spectrum, Calibration and
DecayChain; empty-with-schema before any fit), population on the real
eu_calib_7cm.Spe fit, flag detection on constructed at-bound and failed fits,
the tidy cb.*_data poi... | jtmorrell/curie | tests/test_diagnostics.py | .py | f317bfff64eff0ae | 7.98 | 8 |
"""Known-truth validation of the constrained same-isotope doublet fit.
Builds a synthetic spectrum containing the 133Ba 79.6142 / 80.9979 keV pair - two
gammas of one isotope 1.3837 keV apart, at the ~12.4:1 emission-intensity ratio of
the shipped 133Ba library (79.6142 keV at 2.6495%, 80.9979 keV at 32.9486%). The
tw... | jtmorrell/curie | tests/test_doublet_fit.py | .py | 46cbb73edb2d2e2f | 7.98 | 8 |
"""Tests for the DecayChain count filters and fit_config.
Covers the fit_config attribute (validator, kwarg merge, persistence), the
max_chi2 / exclude_lines / time_range / unc_R_floor filters with their drop
accounting and announcements, the p0 starting-estimate override, and the
peak-fit chi2 column get_counts carri... | jtmorrell/curie | tests/test_fit_filters.py | .py | fcddb31a5e9f006b | 7.98 | 8 |
"""Reaction interpolation schemes and the interp_config surface.
The TENDL libraries default to 'pchip-sqrt' — monotone PCHIP interpolation in
sqrt(E)-sqrt(sigma) space, exact through the evaluated points with no
overshoot at thresholds (the previous quadratic spline oscillated across
sharp threshold rises) — and the ... | jtmorrell/curie | tests/test_interpolation.py | .py | 21ce9beebc055380 | 7.98 | 8 |
"""Laziness guarantees for the data layer: importing curie touches no database,
and pure stopping-power work needs only ziegler.db.
These run curie in a subprocess with CURIE_DATA_DIR pointed at a fresh
directory: any database access shows up there as an adopted/fetched file (or
as a failed fetch on a machine with no ... | jtmorrell/curie | tests/test_lazy_data.py | .py | 5c593cae0db2542c | 7.98 | 8 |
"""Library cross-section reference tests (public suite, category 4).
Every value here is pinned to the *shipped* nuclear-data libraries. IRDFF-II values
recorded 2026-06-09 (unchanged by the v2 rebuild: 119/119 reactions data-identical);
ENDF/B-VIII.1, IAEA monitor (2025 evaluation) and TENDL-2025 values re-recorded
2... | jtmorrell/curie | tests/test_library_values.py | .py | 76585d6a39b5c377 | 7.98 | 8 |
"""Render tests (Agg backend) for the fit-visibility plot upgrades.
Every surface follows the same rule: a fit's plot never hides evidence.
DecayChain.plot draws a 1-sigma band from the stored fit covariance and shows
fit/plot-excluded counts as open grey markers; Spectrum.plot marks failed
multiplets; the Calibration... | jtmorrell/curie | tests/test_plots.py | .py | ed5ca4ac746703c0 | 7.98 | 8 |
#!/usr/bin/python3
# -*- coding: utf8 -*-
import browsercontroller, store
icon = '789c73f235636600033320d600620128666490804800e58ff041300cfc270b6cdc7868ca94ddab56edbe73e7fe9b376fbe7dfbf6ffffbfffffffe050feb7b0f0a4b0f00d46c663f6f6b3d7ae5d76e8e0be1933d6a4a71f6e6db9f8f1e3574c0d9b363fd0d179cec7f7c9d0f0cea74f3f7ffefc9e9... | artyl/mbplugin | plugin/a1by.py | .py | 6875436c19e084c0 | 7.59 | 14 |
# -*- coding: utf8 -*-
''' Автор ArtyLa '''
import os, sys, re, logging
import requests
import store, settings, browsercontroller
login_url = 'https://avtodor-tr.ru/account/login'
login_checkers = ['<input[^>]*id="username"[^>]*', '<input[^>]*id="password"[^>]*', '<input[^>]*type="submit"[^>]*']
# Строка для... | artyl/mbplugin | plugin/avtodor-tr.py | .py | ae19c81f03641ffa | 7.59 | 14 |
# -*- coding: utf8 -*-
''' Автор ArtyLa '''
import browsercontroller, store
icon = '789C7D93CB6B135114C6BF79C4BC66924993D0269926D3247DD8579A5A92D61A5B84B6282816AC8FADB890BAB3E24E37EE15D48505F11FD045C54AC577B1540AC5A255B1B4A2958AF85AE9C23E92F8CD344A15F4901FDF9D7BE79C09E7BB67C7EE8C0C2B32A48E68250418EB07A5F3FF4545450... | artyl/mbplugin | plugin/beeline_uz.py | .py | 164b09658259aac5 | 7.59 | 14 |
# -*- coding: utf8 -*-
''' Автор d1mas
проверка баланса хостинг-провайдера BEGET
https://beget.com/ru
https://beget.com/ru/kb/api/beget-api '''
import os, sys, re, logging, time
import store, json
icon = '789c9dd1314bc3401407f03c7016475d24228820487488a2d65c3b38084a0675f123d4ef503737a1babaa89393273a28158b5849c1... | artyl/mbplugin | plugin/beget.py | .py | b09773c396c2f66c | 7.59 | 14 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.