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
"""Adaptor for xtb-python package. Great overview of how to implement this adaptor: https://github.com/grimme-lab/xtb-python/blob/main/xtb/qcschema/harness.py """ import importlib import os from collections.abc import Callable import numpy as np from qcdata import CalcType, ProgramInput, SinglePointData, Wavefunctio...
atomsforhumanity/qccompute
src/qccompute/adapters/xtb.py
.py
e7e5d4cd8e27fe46
7.42
6
"""Top level compute functions for qccompute.""" import traceback from collections.abc import Callable from typing import Any from warnings import warn from qcdata import ( CalcType, DataType, Files, InputType, Model, ProgramInput, ProgramOutput, Structure, ) from qcdata.helper_types i...
atomsforhumanity/qccompute
src/qccompute/main.py
.py
d4d033ee83f3c2a9
7.42
6
import shutil from functools import lru_cache from qcdata import FileInput, Inputs from .adapters import BaseAdapter, FileAdapter, registry from .exceptions import AdapterNotFoundError, ProgramNotFoundError @lru_cache # Improves perf of tests when repeatedly called def prog_available(program: str) -> bool: """...
atomsforhumanity/qccompute
src/qccompute/utils.py
.py
52ea04be29014a78
7.42
6
from pathlib import Path import pytest from qccompute.adapters import TeraChemAdapter from qccompute.adapters.utils import tmpdir from qccompute.exceptions import AdapterError, AdapterInputError def test_get_version_no_stdout(monkeypatch): """Test get_version method.""" adapter = TeraChemAdapter() # Mon...
atomsforhumanity/qccompute
tests/adaptors/test_terachem.py
.py
aa87c507d481582e
7.92
6
import numpy as np import pytest from qcdata import ( CalcType, DualProgramInput, ProgramArgs, ProgramInput, ProgramOutput, SinglePointData, Structure, ) from qccompute.adapters.base import ProgramAdapter from qccompute.utils import prog_available @pytest.fixture(scope="session") def hyd...
atomsforhumanity/qccompute
tests/conftest.py
.py
932f877c3de4cee3
7.92
6
import pytest from qcdata import CalcType, DualProgramInput, OptimizationResults, ProgramOutput from qccompute.adapters import GeometricAdapter from tests.conftest import skipif_program_not_available @pytest.mark.integration @skipif_program_not_available("terachem") def test_full_optimization(dual_prog_input_factory...
atomsforhumanity/qccompute
tests/integration_tests/test_geometric_integration.py
.py
fee29238d65dc77e
7.92
6
"""Test utils functions.""" import builtins from pathlib import Path import pytest from qccompute.adapters.utils import capture_logs, execute_subprocess, tmpdir from qccompute.exceptions import ExternalProgramError, ProgramNotFoundError from qccompute.utils import available_programs, prog_available def test_tmpdir...
atomsforhumanity/qccompute
tests/test_utils.py
.py
c64b9d54d483d091
7.92
6
# Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved. # # 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 applic...
NVIDIA-NeMo/FW-CI-templates
.github/actions/check-imports/check_imports.py
.py
27e542e668191842
7.5
9
#!/usr/bin/env python3 """ Script to check and optionally add NVIDIA copyright headers to files. """ import sys import argparse import re # Import the regular expression module from pathlib import Path from datetime import datetime # Regex to check for in leading comment lines. # Supports both legacy NVIDIA copyrigh...
NVIDIA-NeMo/FW-CI-templates
.github/actions/copyright-checker/check_copyright.py
.py
31d0fb444899910e
7.5
9
# Copyright (c) 2026, NVIDIA CORPORATION. All rights reserved. # # 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 appli...
NVIDIA-NeMo/FW-CI-templates
.github/actions/identify-follow-up-issues/test_identify_follow_up_issues.py
.py
cc5af618705cb77b
7
9
# Copyright (c) {{cookiecutter.year}}, NVIDIA CORPORATION. All rights reserved. # # 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 ...
NVIDIA-NeMo/FW-CI-templates
github_repo_template/{{cookiecutter.project_slug}}/tests/conftest.py
.py
2567096e398d9de1
8
9
#!/usr/bin/env python3 # # Copyright 2026 Red Hat, Inc. # # 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 la...
openstack-k8s-operators/edpm-ansible
openstack_ansibleee/write_runner_summary.py
.py
69fd6ba98b07ab6b
7.64
18
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright 2019 Red Hat, Inc. # All Rights Reserved. # # 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/lice...
openstack-k8s-operators/edpm-ansible
plugins/modules/container_config_hash.py
.py
420cd6cbc475f5ea
7.64
18
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright 2020 Red Hat, Inc. # All Rights Reserved. # # 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/lice...
openstack-k8s-operators/edpm-ansible
plugins/modules/edpm_os_net_config_mappings.py
.py
5f445043e2f6acd1
7.64
18
#!/usr/bin/env python # # Copyright 2018 Red Hat Inc. # # 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...
openstack-k8s-operators/edpm-ansible
roles/edpm_nova/files/nova_statedir_ownership.py
.py
a3707e4693eeec70
7.64
18
# Copyright 2023 Red Hat, Inc. # All Rights Reserved. # # 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 ...
openstack-k8s-operators/edpm-ansible
roles/edpm_tuned/molecule/isolated/tests/test_isolated.py
.py
f03f6c4d5d1184e0
7.14
18
import os import json import requests import time from datetime import datetime from collections import defaultdict from typing import Dict, List, Tuple # 配置项 GITHUB_TOKEN = os.getenv("GH_TOKEN") OUTPUT_FILE = "STARS.md" CACHE_FILE = "stars_cache.json" REQUEST_INTERVAL = 1 # API请求间隔 class GitHubStarOrganizer: de...
Fgaoxing/Fgaoxing
starmgr.py
.py
46ae9fd3dc71cdee
7.62
16
import re import subprocess import sys from datetime import datetime from pathlib import Path import toml def get_repo_url(): """Get the repository URL from pyproject.toml or ask the user for it.""" try: with open("pyproject.toml") as file: pyproject = toml.load(file) repo_url = p...
atomsforhumanity/qccodec
scripts/release.py
.py
0c93d1a00a062778
7.45
7
"""Top level functions for the tcparse library""" import logging from importlib import import_module from pathlib import Path from typing import Any from qcdata import ( CalcType, ConformerSearchData, OptimizationData, ProgramInput, SinglePointData, StructuredData, StructuredInputs, ) fro...
atomsforhumanity/qccodec
src/qccodec/codec.py
.py
7f47c9a1793cc897
7.45
7
import copy import os from typing import Any import tomli_w from qcdata import CalcType, ProgramInput from qccodec.exceptions import EncoderError from qccodec.models import NativeInput SUPPORTED_CALCTYPES = { CalcType.conformer_search, CalcType.optimization, CalcType.energy, CalcType.gradient, Ca...
atomsforhumanity/qccodec
src/qccodec/encoders/crest.py
.py
becf07c01ca30e51
7.45
7
from collections.abc import Mapping from typing import Any from qcdata import CalcType, ProgramInput from qccodec.exceptions import EncoderError from qccodec.models import NativeInput SUPPORTED_CALCTYPES = { CalcType.energy, CalcType.gradient, CalcType.hessian, CalcType.optimization, CalcType.tra...
atomsforhumanity/qccodec
src/qccodec/encoders/orca.py
.py
30ec670f84042741
7.45
7
class BaseError(Exception): """Base qccodec exceptions""" class DecoderError(BaseError): """Exception raised when a decoder error occurs""" class EncoderError(BaseError): """Exception raised when a encoder error occurs""" class ParserError(BaseError): """Base exception for parsers""" def __in...
atomsforhumanity/qccodec
src/qccodec/exceptions.py
.py
80d1300b1da651ea
7.45
7
"""Simple data models to support parsing of QM program output files.""" from dataclasses import dataclass from typing import Any from .exceptions import DataCollectorError class DataCollector(dict): """A dictionary for collecting data from parsers.""" def add_data(self, target: str | tuple[str, ...], value...
atomsforhumanity/qccodec
src/qccodec/models.py
.py
49e477388a65d5d8
7.45
7
import math import re from collections.abc import Generator from enum import Enum from pathlib import Path from typing import Any import numpy as np from qcconst import constants from qcdata import ( CalcType, ProgramInput, ProgramOutput, Provenance, SinglePointData, Structure, ) from qccodec....
atomsforhumanity/qccodec
src/qccodec/parsers/crest.py
.py
55934cf264a56d3d
7.45
7
"""Parsers for Orca output files.""" import itertools import re from enum import Enum from pathlib import Path from typing import Generator from qcdata import ( CalcType, ProgramInput, ProgramOutput, Provenance, SinglePointData, Structure, ) from qccodec.exceptions import MatchNotFoundError, ...
atomsforhumanity/qccodec
src/qccodec/parsers/orca.py
.py
a8ab2d35c73540cb
7.45
7
"""Parsers for TeraChem output files.""" import re from collections.abc import Generator from enum import Enum from pathlib import Path from qcconst import constants from qcdata import ( CalcType, ProgramInput, ProgramOutput, Provenance, SinglePointData, Structure, ) from qccodec.exceptions i...
atomsforhumanity/qccodec
src/qccodec/parsers/terachem.py
.py
6c155529881fb270
7.45
7
import logging import re from qccodec.exceptions import MatchNotFoundError logger = logging.getLogger(__name__) def re_search(regex: str, contents: str, flags: int = 0) -> re.Match: """ Search for a regex pattern in a string and return the first match. Raises: MatchNotFoundError if no match is ...
atomsforhumanity/qccodec
src/qccodec/parsers/utils.py
.py
9cd706e73a758b40
7.45
7
import inspect from collections import defaultdict from collections.abc import Callable from dataclasses import dataclass, field from enum import Enum from qcdata import CalcType from qccodec.exceptions import RegistryError @dataclass class ParserSpec: """Specification for a parser function. This class hol...
atomsforhumanity/qccodec
src/qccodec/registry.py
.py
6dc8825d3c9dd224
7.45
7
import inspect import shutil from collections.abc import Callable from contextlib import contextmanager from dataclasses import dataclass from pathlib import Path from typing import Any import pytest from qcdata import CalcType, ProgramInput from qcdata.utils import water from qccodec.codec import decode from qccodec...
atomsforhumanity/qccodec
tests/conftest.py
.py
db4261059fa5a18a
7.95
7
import pytest from qcdata import CalcType, Model, ProgramInput from qcdata.utils import water from qccodec.encoders.orca import _validate_keywords, encode from qccodec.exceptions import EncoderError @pytest.mark.parametrize( "calctype, method, basis, keywords", [ (CalcType.energy, "b3lyp", "def2-svp"...
atomsforhumanity/qccodec
tests/test_orca_encoders.py
.py
ddbf58701732425b
7.95
7
import pytest from qccodec.encoders.terachem import PADDING, XYZ_FILENAME, encode from qccodec.exceptions import EncoderError def test_write_input_files(prog_input_factory): """Test write_input_files method.""" prog_input_factory = prog_input_factory("energy") prog_input_factory.keywords.update({"purify"...
atomsforhumanity/qccodec
tests/test_terachem_encoders.py
.py
b136c714103a87d1
7.95
7
''' WIP. Its impossible to get the value of a socket. Use "ShaderNodeCustomGroup", which are node groups with a fancy UI. ''' import bpy import nodeitems_builtins import nodeitems_utils from nodeitems_utils import NodeCategory, NodeItem from bpy.types import Node, ShaderNodeCustomGroup, NodeSocket # Cat...
seilotte/Blender-Stuff
Scripts/_extra/sei/sei-materials_node custom lerp.py
.py
837bcf6cda5ab2af
7.45
7
''' WIP Its impossible to get the value of a socket. Use "ShaderNodeCustomGroup", which are node groups with a fancy UI. ''' import bpy import os import nodeitems_builtins import nodeitems_utils from nodeitems_utils import NodeCategory, NodeItem from bpy.types import Node, ShaderNodeCustomGroup, NodeSocke...
seilotte/Blender-Stuff
Scripts/_extra/sei/sei-materials_node run script.py
.py
a953c7c39495e288
7.45
7
''' Developed in Blender 5.0.0. WARNING: This modifies the user settings! There is not an undo option. If things go wrong "Reset" the theme. ''' import bpy import mathutils from bpy import context #from mathutils import Color as c DEBUG = False TEXT_SIZE = 14 COLOURS = [ ('FFFFFF', 'FFFFFF'), # tod...
seilotte/Blender-Stuff
Scripts/_extra/theme_setup.py
.py
3d0cb3add707d12c
7.45
7
import bpy import mathutils class ViewDirectionUpdater(bpy.types.Operator): """Update the combine xyz node with the current view direction""" bl_idname = "view_direction_updater.modal_operator" bl_label = "View Direction Updater" _timer = None def modal(self, context, event): ...
seilotte/Blender-Stuff
Scripts/_extra/view vector (modal).py
.py
82f39f494d901e6a
7.45
7
"""Keeping a meter read when things fail, three ways. manual you rebuild the session yourself automatic reopen_delays rebuilds it; connecting is still yours none reopen_delays never gives up, so nothing is left to catch Which exception means what is in the README under Exception. What ...
nbtk/momonga
tests/error_handling_example.py
.py
33fe04042c2b9c25
8.16
20
""" Integration tests for smart meter notification (sync API). Requires a Wi-SUN USB dongle connected to a live smart meter. Configure via environment variables: MOMONGA_ROUTEB_ID Route-B ID MOMONGA_ROUTEB_PASSWORD Password MOMONGA_DEV_PATH Serial device path (e.g. /dev/ttyUSB0, COM3) MOMONGA_...
nbtk/momonga
tests/test_notification.py
.py
99413c9748f7f38e
8.16
20
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. from __future__ import annotations from datetime import datetime from enum import Enum from typing import Any, Literal, TypedDict, Union from typing_extensions import NotRequired __all__ = [ "ManifestProperties", "AssignedSession", "Ba...
aws-deadline/deadline-cloud-worker-agent
src/deadline_worker_agent/api_models.py
.py
79782d9f8c4e2d28
7.64
18
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. from __future__ import annotations from typing import Optional from datetime import datetime, timezone from threading import Lock from botocore.session import Session as BotocoreSession, get_session as get_botocore_session from botocore.credentials...
aws-deadline/deadline-cloud-worker-agent
src/deadline_worker_agent/aws_credentials/boto3_sessions.py
.py
794ac511ccaea704
7.64
18
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. from __future__ import annotations import logging from typing import Callable, Optional, TypeVar, Any, cast from types import TracebackType from datetime import datetime, timedelta, timezone from threading import Lock, Timer from .boto3_sessions im...
aws-deadline/deadline-cloud-worker-agent
src/deadline_worker_agent/aws_credentials/credentials_refresher.py
.py
109e9e6fadbf6c62
7.64
18
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. from __future__ import annotations from dataclasses import dataclass from datetime import datetime, timezone from typing import Any, Optional, Type import logging import json from typing_extensions import TypedDict from botocore.credentials import...
aws-deadline/deadline-cloud-worker-agent
src/deadline_worker_agent/aws_credentials/temporary_credentials.py
.py
4e9bab60d0ee3e88
7.64
18
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. from __future__ import annotations import logging from typing import Any, cast from botocore.utils import JSONFileCache from ..boto import DEADLINE_BOTOCORE_CONFIG, Session from ..config import Configuration from ..aws.deadline import ( Deadlin...
aws-deadline/deadline-cloud-worker-agent
src/deadline_worker_agent/aws_credentials/worker_boto3_session.py
.py
b39670c0e52e8baf
7.64
18
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. from __future__ import annotations import math import random from typing import Callable from botocore.retries.standard import ExponentialBackoff class NoOverflowExponentialBackoff(ExponentialBackoff): """This is the same exponential backoff a...
aws-deadline/deadline-cloud-worker-agent
src/deadline_worker_agent/boto/retries.py
.py
87a39ec4ee9867a3
7.64
18
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. from __future__ import annotations import sys import os import getpass import logging as _logging from dataclasses import dataclass from pathlib import Path from typing import Any, Optional, Sequence, Tuple, cast, TYPE_CHECKING from .._session_runt...
aws-deadline/deadline-cloud-worker-agent
src/deadline_worker_agent/config/config.py
.py
a652cc322b30bea6
7.64
18
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. from __future__ import annotations from typing import Optional, Tuple from pathlib import Path from pydantic.v1 import BaseSettings, Field from pydantic.v1.env_settings import SettingsSourceCallable from ..capabilities import Capabilities from .._...
aws-deadline/deadline-cloud-worker-agent
src/deadline_worker_agent/config/settings.py
.py
30b2c52119e80c27
7.64
18
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. from __future__ import annotations import re from typing import Literal from tomlkit import comment from tomlkit.container import Container from tomlkit.items import ( Bool, Comment, SingleKey, String, ) class CommentNotFoundError(...
aws-deadline/deadline-cloud-worker-agent
src/deadline_worker_agent/config/toml_comment.py
.py
48610e7b0623e4ab
7.64
18
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. """This module contains code for interacting with Linux capabilities. See https://man7.org/linux/man-pages/man7/capabilities.7.html for details on this Linux kernel feature. """ import ctypes import os import sys from logging import getLogger from ...
aws-deadline/deadline-cloud-worker-agent
src/deadline_worker_agent/linux/capabilities.py
.py
29cf74ab72db293c
7.64
18
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. from __future__ import annotations from logging import Logger, getLogger from threading import Event, Thread from typing import Any, Dict import os import psutil import subprocess from .log_messages import MetricsLogEvent, MetricsLogEventSubtype ...
aws-deadline/deadline-cloud-worker-agent
src/deadline_worker_agent/metrics.py
.py
873c59430c725f15
7.64
18
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. from __future__ import annotations import subprocess import sys import getpass from threading import Lock from openjd.sessions import SessionUser, PosixSessionUser, WindowsSessionUser from .log import LOGGER from ..sessions import Session logger =...
aws-deadline/deadline-cloud-worker-agent
src/deadline_worker_agent/scheduler/session_cleanup.py
.py
268bb90428fe84f3
7.64
18
import numpy as np import pandas as pd import openturns as ot from utils.core_utils import call_groq_api from utils.constants import RETURN_INSTRUCTION def compute_model_understanding(model, problem, model_code_str, is_pce_used=False, original_model_code_str=None, metamodel_str=None, language_model='groq'): """ ...
MLegkovskis/UncertaintyCat
Streamlit_Backup/modules/model_understanding.py
.py
6cd330227a110ecc
7.48
8
# modules/monte_carlo.py import numpy as np import pandas as pd import openturns as ot from utils.model_utils import sample_inputs def monte_carlo_simulation(model, problem, N=1000, seed=42): """Run Monte Carlo simulation.""" # Ensure problem is an OpenTURNS distribution if not isinstance(problem, (ot.Dis...
MLegkovskis/UncertaintyCat
Streamlit_Backup/modules/monte_carlo.py
.py
3380bb937e7e351b
7.48
8
import numpy as np import pandas as pd import openturns as ot from SALib.analyze import sobol from utils.core_utils import call_groq_api, create_chat_interface from utils.constants import RETURN_INSTRUCTION import plotly.graph_objects as go from plotly.subplots import make_subplots import plotly.express as px def comp...
MLegkovskis/UncertaintyCat
Streamlit_Backup/modules/sobol_sensitivity_analysis.py
.py
944c3df48c25eba4
7.48
8
from typing import Literal, overload import numpy as np from numpy.typing import ArrayLike, NDArray from scipy.signal import ShortTimeFFT, detrend, get_window class OnlineHelper: """ Online helper class for efficient signal processing using sliding windows. Implements an efficient sliding window approac...
iskandergaba/pyriodicity
src/pyriodicity/_internal/online_helper.py
.py
91b504eb6de2123a
7.48
8
from typing import Literal import numpy as np from numpy.typing import ArrayLike, NDArray from scipy.signal import get_window, periodogram def to_1d_array(x: ArrayLike) -> NDArray[np.floating]: """ Convert input to a contiguous 1-dimensional numpy array. Parameters ---------- x : array_like ...
iskandergaba/pyriodicity
src/pyriodicity/_internal/utils.py
.py
0315ae83d70c987c
7.48
8
from typing import Literal import numpy as np from numpy.typing import ArrayLike, NDArray from scipy.signal import find_peaks from .._internal.online_helper import OnlineHelper class OnlineACFPeriodicityDetector: """ Online Autocorrelation Function (ACF) based periodicity detector. Detect periodicities...
iskandergaba/pyriodicity
src/pyriodicity/online/online_acf.py
.py
35c7028bc6735395
7.48
8
from typing import Literal import numpy as np from numpy.typing import ArrayLike, NDArray from .._internal.online_helper import OnlineHelper class OnlineFFTPeriodicityDetector: """ Online Fast Fourier Transform (FFT) based periodicity detector. Detect periodicities in a signal stream data using Sliding...
iskandergaba/pyriodicity
src/pyriodicity/online/online_fft.py
.py
f8661d05be4d5243
7.48
8
from typing import Literal import numpy as np from numpy.typing import ArrayLike, NDArray from scipy.signal import detrend, find_peaks from .._internal.utils import acf, apply_window, to_1d_array class ACFPeriodicityDetector: """ Autocorrelation Function (ACF) based periodicity detector. Find the perio...
iskandergaba/pyriodicity
src/pyriodicity/static/acf.py
.py
55c79cc6ebd6022f
7.48
8
from typing import Literal import numpy as np from numpy.typing import ArrayLike, NDArray from scipy.signal import detrend, find_peaks, periodogram from .._internal.utils import acf, apply_window, power_threshold, to_1d_array class Autoperiod: """ Autoperiod periodicity detector. Find the periods in a ...
iskandergaba/pyriodicity
src/pyriodicity/static/autoperiod.py
.py
aebf6732d979608c
7.48
8
from typing import Literal import numpy as np from numpy.typing import ArrayLike, NDArray from scipy.signal import butter, detrend, find_peaks, periodogram, sosfiltfilt from .._internal.utils import acf, apply_window, power_threshold, to_1d_array class CFDAutoperiod: """ CFD-Autoperiod periodicity detector....
iskandergaba/pyriodicity
src/pyriodicity/static/cfd_autoperiod.py
.py
4dcb542f9382dd86
7.48
8
from typing import Literal import numpy as np from numpy.typing import ArrayLike, NDArray from scipy.signal import detrend from .._internal.utils import apply_window, to_1d_array class FFTPeriodicityDetector: """ Fast Fourier Transform (FFT) based periodicity detector. Find the periods in a given signa...
iskandergaba/pyriodicity
src/pyriodicity/static/fft.py
.py
f4a1eefedb8c4d5c
7.48
8
from collections import Counter from typing import Literal import numpy as np from numpy.typing import ArrayLike, NDArray from scipy.fft import dct from scipy.optimize import fminbound from scipy.signal import detrend, periodogram from scipy.stats import gaussian_kde, zscore from .._internal.utils import acf, apply_w...
iskandergaba/pyriodicity
src/pyriodicity/static/sazed.py
.py
49d56f9bb625dd29
7.48
8
import requests from okareo.checks import CheckOutputType, CheckResponse, CodeBasedCheck class Check(CodeBasedCheck): check_type = CheckOutputType.PASS_FAIL @staticmethod def evaluate(model_output: str) -> CheckResponse: # type: ignore[override] """Malicious check that makes network requests an...
okareo-ai/okareo-python-sdk
okareo_tests/checks/malicious_check.py
.py
420b786bdab95233
7.98
8
import os import random import string from typing import Any, Callable import pytest from okareo.common import BASE_URL API_KEY = os.environ.get("OKAREO_API_KEY", "no-api-key") class OkareoAPIhost: def __init__(self, path: str, is_mock: bool) -> None: self.path = path self.is_mock = is_mock d...
okareo-ai/okareo-python-sdk
okareo_tests/common.py
.py
b06c3bd86513def5
7.98
8
from uuid import UUID import pytest from okareo_tests.checks.sample_check import Check from okareo_tests.common import API_KEY, default_project_id, random_string from okareo import Okareo from okareo_api_client.models import EvaluatorSpecRequest @pytest.fixture(scope="module") def okareo_client() -> Okareo: ret...
okareo-ai/okareo-python-sdk
okareo_tests/test_checks.py
.py
a3fd07d2f8421bb3
7.98
8
"""Unit tests for CodeBasedCheck.check_config(). These run without a live server. The SDK no longer declares an output type for code-based checks: check_config() emits only `code_contents`, and the server infers pass/fail vs. score from the check's runtime return value at persist time. """ from okareo_tests.checks im...
okareo-ai/okareo-python-sdk
okareo_tests/test_code_check_config.py
.py
8584868b43484c6e
7.98
8
"""End-to-end integration tests for conversation ingestion. This test validates the complete conversation monitoring flow: 1. Ingest conversations with audio and transcript 2. Verify datapoints are created 3. Verify monitors match and trigger checks 4. Validate transcript_fidelity check execution """ import base64 im...
okareo-ai/okareo-python-sdk
okareo_tests/test_conversation_ingestion_e2e.py
.py
3ac6afaf87bc0759
7.98
8
"""E2E DTMF validation against the IVR testtarget, for both Twilio and Vonage. The Driver places a phone call (via a Twilio or Vonage voice target) to a number routed to okareo_server's opt-in IVR testtarget (``/v0/voice/twilio/testtarget/ivr``). The Driver presses a random keypad code; the testtarget captures it — fr...
okareo-ai/okareo-python-sdk
okareo_tests/test_integration_voice_dtmf.py
.py
b5fc377f5c20aad1
7.98
8
import random from datetime import datetime from typing import List, Union from uuid import UUID import pytest from okareo_tests.common import API_KEY, random_string from okareo import Okareo from okareo.checks import CheckOutputType, ModelBasedCheck from okareo.model_under_test import CustomModel, ModelInvocation fr...
okareo-ai/okareo-python-sdk
okareo_tests/test_projects.py
.py
132bc7a586508569
7.98
8
# 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
google/drjax
drjax/_src/api.py
.py
e0d664062277119e
7.65
19
# 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
google/drjax
drjax/_src/api_test.py
.py
609ac0e41b45b76e
7.15
19
# 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
google/drjax
drjax/_src/impls.py
.py
ff7548e925577e8c
7.65
19
# 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
google/drjax
drjax/_src/impls_test.py
.py
eecc786077d21982
7.15
19
# 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
google/drjax
drjax/_src/primitives.py
.py
9a88748eb9d3dbe5
7.65
19
# 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
google/drjax
drjax/_src/primitives_test.py
.py
22ca2d796f142b12
8.15
19
""" DEVStone atomic model for the pyjevsim benchmark. The DEVStone atomic has a single passive/active state machine: - passive (initial, deadline = inf): waits for an input event. - active (deadline = int_delay): on entry the model is committed to emit output(s); on int_trans it returns to passive. To make t...
eventsim/pyjevsim
benchmark/devstone/atomic.py
.py
bada960179af44e2
7.5
9
""" DEVStone topology builders for pyjevsim. Three canonical variants are implemented (LI, HI, HO). Each builds a flat graph of registered atomics and couplings inside a SysExecutor: Generator -> level_0 -> level_1 -> ... -> level_(depth-1) -> Sink A "level" is a group of `width - 1` DEVStoneAtomic instances. The ...
eventsim/pyjevsim
benchmark/devstone/topology.py
.py
2daf4772371b3949
7.5
9
"""Shared types and helpers for engine adapters. A `RunResult` captures timing breakdown plus the static counts that come from the DEVStone topology (atomics, couplings, transitions). Every engine adapter returns the same dataclass so the cross-engine runner can tabulate results without engine-specific knowledge. """ ...
eventsim/pyjevsim
benchmark/engines/common.py
.py
551fe373d5d8d961
7.5
9
"""Canonical DEVStone topology built on pyjevsim's SysExecutor. The graph mirrors the *flattened* shape of the canonical xdevs DEVStone: - Seeder fires exactly one event at t=0 then passivates. - LI(d, w) has 1 + (d-1) * (w-1) atomics. Seeder feeds every atomic. - HI adds an internal chain inside every non-inne...
eventsim/pyjevsim
benchmark/engines/pyjevsim/topology.py
.py
eb8fa7a461f3d2bc
7.5
9
"""PythonPDEVS DEVStone runner (uses the minimal kernel).""" import time from benchmark.engines.common import RunResult ENGINE_NAME = "pypdevs" def is_available() -> bool: try: from pypdevs.minimal import Simulator # noqa: F401 return True except Exception: return False def run(...
eventsim/pyjevsim
benchmark/engines/pypdevs/runner.py
.py
462293e28b52d75e
7.5
9
"""xdevs (xdevs.py) DEVStone runner. Uses the canonical implementation that ships with `xdevs.examples.devstone`. A single seed event is injected into the root model; the coordinator then drains the event queue with `simulate_iters()`. """ import time from benchmark.engines.common import RunResult ENGINE_NAME = "x...
eventsim/pyjevsim
benchmark/engines/xdevs/runner.py
.py
d8c87f59019834b2
7.5
9
"""Memory-bounded 3-D convolution for the CPU inference path. PyTorch's CPU ``conv3d`` lowers to an im2col matrix multiplication and materialises the column buffer for the *whole* volume in a single allocation of ``C_in * prod(kernel) * prod(output_shape)`` elements. At the 1.5 mm warp template grid (padded to 128x14...
ChristianGaser/T1Prep
src/t1prep/_conv_chunk.py
.py
e5c8221e15550ff2
7.52
10
"""Compute-device selection for the deepmriprep stages. ``deepmriprep`` decides its device once, at import, with DEVICE = 'cuda' if torch.cuda.is_available() else 'cpu' so on Apple Silicon every stage it owns — affine registration, nogm segmentation, warping, atlas registration — pins itself to the CPU no matter...
ChristianGaser/T1Prep
src/t1prep/_device.py
.py
a42d50adcaa3ee05
7.52
10
"""Colormaps shared by the surface and volume viewers. Both build the same lookup tables, so they live here rather than in either viewer — cat_surf_view imports cat_vol_view, which would make the reverse direction circular. """ from __future__ import annotations import math from typing import List, Optional, Tuple ...
ChristianGaser/T1Prep
src/t1prep/gui/colormaps.py
.py
3b08bcac1947773f
7.52
10
import sys import unittest from pathlib import Path # Allow running tests without installing the package (repo checkout / editable dev) _ROOT = Path(__file__).resolve().parents[1] _SRC = _ROOT / "src" if str(_SRC) not in sys.path: sys.path.insert(0, str(_SRC)) try: import torch import torch.nn.functional ...
ChristianGaser/T1Prep
tests/test_conv_chunk.py
.py
b45403c17f77783a
8.02
10
import logging import sys import unittest from pathlib import Path import numpy as np import nibabel as nib # Allow running tests without installing the package (repo checkout / editable dev) _ROOT = Path(__file__).resolve().parents[1] _SRC = _ROOT / "src" if str(_SRC) not in sys.path: sys.path.insert(0, str(_SR...
ChristianGaser/T1Prep
tests/test_metrics.py
.py
9575cac6742d87d4
8.02
10
"""Tests for :mod:`t1prep._segment_utils`.""" import numpy as np import pytest import torch from t1prep._segment_utils import scale_intensity def _reference(x, low=0.5, high=99.5): """Percentile rescaling with log-compressed top tail, computed on the host. Deliberately written with plain NumPy rather than ...
ChristianGaser/T1Prep
tests/test_segment_utils.py
.py
a9e362aafeca4972
8.02
10
"""Security helpers for guarding privileged API endpoints.""" from __future__ import annotations import os from typing import Callable, Optional from flask import Response, request OperatorAuthFormatter = Callable[..., Response] # Headers / environment variable names that can supply the operator token. OPERATOR_TO...
futuroptimist/token.place
api/security.py
.py
984f2b52d5b018b4
7.45
7
""" Encryption manager for token.place API v1 """ import json import base64 import logging from typing import Dict, Any, Union, Optional from encrypt import generate_keys, encrypt, decrypt try: from config import RSA_KEY_SIZE except ImportError: # Default value if config.py is not available RSA_KEY_SIZE ...
futuroptimist/token.place
api/v1/encryption.py
.py
acbdd45984be33a2
7.45
7
""" Model management for token.place API v1 This module provides model information and management. """ import os import random import logging import time from pathlib import Path from typing import Any, Dict, Iterable, List, Optional from utils.llm.model_profiles import ( CANONICAL_API_V1_MODEL_ID, build_mode...
futuroptimist/token.place
api/v1/models.py
.py
bcd714e53d497339
7.45
7
""" Simplified CLI chat client for token.place Uses the CryptoClient helper to handle encryption and API communication """ import argparse import sys # Import our CryptoClient from utils.crypto_helpers import CryptoClient def clear_screen(): """Clear the terminal screen without spawning a shell. Skips outp...
futuroptimist/token.place
client_simplified.py
.py
9b52534bf0a8cf1b
7.45
7
#!/usr/bin/env python3 """Build a local token.place desktop installer, mirroring desktop-release.yml. One command produces a real packaged app/installer (not `tauri dev`), so packaging-only bugs (embedded runtime PATH handling, packaged import-root resolution, resource bundling) reproduce locally instead of only surfa...
futuroptimist/token.place
desktop-tauri/scripts/build_local.py
.py
17f77fd225304c1b
7.45
7
"""Helpers for desktop llama-cpp-python GPU packaging/install contract.""" from __future__ import annotations import sys from dataclasses import dataclass from pathlib import Path from typing import Any LLAMA_CPP_PYPI_INDEX_URL = "https://pypi.org/simple" LLAMA_CPP_PREBUILT_WHEEL_INDEX_BASE = "https://abetlen.github...
futuroptimist/token.place
desktop-tauri/src-tauri/python/desktop_gpu_packaging.py
.py
77bf52311fb31602
7.45
7
"""CLI application for the project. A dependency-free ``argparse`` root for the ``hwid`` command. It exposes the same ``version`` / ``info`` commands as the Typer variant and hangs every enabled non-primary component off the root as a lazily-imported subcommand — ``hwid interactive`` (TUI), ``hwid web``, ... — rather ...
hasansezertasan/hwid
src/hwid/cli/app.py
.py
54fc369921292446
7.5
9
"""Core functionality for getting hardware IDs.""" # Copyright (c) 2023 Hasan Sezer Taşan # Licensed under the MIT License import re from sys import platform from hwid.core.exceptions import InvalidHWIDError, UnsupportedOSError from hwid.core.impl import darwin, linux, win32 __all__ = ["get_hwid", "validate_hwid"] ...
hasansezertasan/hwid
src/hwid/core/resolution.py
.py
41440d7e84d2cd80
7.5
9
"""Test cases for the hwid argparse root.""" from __future__ import annotations import importlib from importlib.metadata import Distribution, PackageNotFoundError import pytest from hwid.cli.app import app # Import the module object (not the re-exported callable) so the monkeypatch # below patches ``Distribution``...
hasansezertasan/hwid
tests/cli/test_app.py
.py
927992f91d3f336e
8
9
"""Tests for :mod:`hwid.core.impl.darwin`; ``subprocess`` is mocked on any host.""" from __future__ import annotations from typing import TYPE_CHECKING from hwid.core.impl import darwin if TYPE_CHECKING: from pytest_mock import MockerFixture VALID_HWID = "D486629F-0026-55CC-988A-C086D16715C1" def test_darwin...
hasansezertasan/hwid
tests/core/impl/test_darwin.py
.py
8dff4c63e1795681
8
9
"""Tests for :mod:`hwid.core.impl.linux`; ``subprocess`` is mocked on any host.""" from __future__ import annotations import subprocess # noqa: S404 from typing import TYPE_CHECKING import pytest from hwid.core.impl import linux if TYPE_CHECKING: from pytest_mock import MockerFixture VALID_HWID = "D486629F-0...
hasansezertasan/hwid
tests/core/impl/test_linux.py
.py
9fa0397274c3674e
8
9
"""Tests for :mod:`hwid.core.impl.win32`; ``subprocess`` is mocked on any host.""" from __future__ import annotations from typing import TYPE_CHECKING from hwid.core.impl import win32 if TYPE_CHECKING: from pytest_mock import MockerFixture VALID_HWID = "D486629F-0026-55CC-988A-C086D16715C1" def test_win32_st...
hasansezertasan/hwid
tests/core/impl/test_win32.py
.py
51043086e8c23963
7
9
"""Tests for :mod:`hwid.core.resolution` -- validation and platform dispatch.""" from __future__ import annotations from typing import TYPE_CHECKING import pytest from hwid.core.exceptions import InvalidHWIDError, UnsupportedOSError from hwid.core.resolution import get_hwid, validate_hwid if TYPE_CHECKING: fro...
hasansezertasan/hwid
tests/core/test_resolution.py
.py
2af791b0e5999603
8
9
"""Tests for the package's runnable entrypoint (``python -m hwid``).""" import importlib def test_main_is_callable() -> None: """The package exposes a callable ``main()`` entrypoint. Every standalone-executable build (launcher / freezer / compiler — see ADR-007) targets ``hwid.__main__:main``, so this p...
hasansezertasan/hwid
tests/test_main.py
.py
e821617704ccc037
7
9