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 python """ Resolve the nearest available MirMachine node for a species using a local NCBI Taxonomy dump. Examples -------- Download/cache taxonomy once and resolve a species: python mirmachine_autonode.py --species "Caenorhabditis elegans" Print a ready-to-run MirMachine command: python mirmach...
sinanugur/MirMachine
scripts/mirmachine_autonode.py
.py
ad107ff487150d58
7.6
15
#!/usr/bin/env python ''' Created on 01/02/2024 Seed detector @author: suu13 ''' import sys from Bio import SeqIO #import ast def check_patterns(patterns, target_sequence): p=[] for pattern in patterns: if pattern.strip().strip("*").replace('U','T') in target_sequence: #star seeds are high confiden...
sinanugur/MirMachine
scripts/seed_detector.py
.py
665619cb7bc0f342
7.6
15
from setuptools import setup, find_packages, Command import os with open("requirements.txt") as req: requirements=req.readlines() class CleanCommand(Command): """Custom clean command to tidy up the project root.""" user_options = [] def initialize_options(self): pass def finalize_options(s...
sinanugur/MirMachine
setup.py
.py
11da701ba6c2ba51
7.6
15
#!/usr/bin/env python3 import sys import math import argparse import gzip from scipy.stats import norm, chi2 from scipy.optimize import brentq # Example usage: # python3 munge.py biomarkers-30780-both_sexes-irnt.tsv.bgz --chr-col chr --pos-col pos --ref-col ref --alt-col alt --af-col af_EUR --effect-col beta_EUR --se...
FINNGEN/META_ANALYSIS
scripts/munge.py
.py
5595d89528d2cc3f
7.63
17
#!/usr/bin/env python3 import unittest import sys import os import io import json import gzip import tempfile import shutil from contextlib import redirect_stderr from types import SimpleNamespace from unittest.mock import patch # Add parent directory to path to import the module under test sys.path.insert(0, os.path...
FINNGEN/META_ANALYSIS
scripts/tests/test_loo.py
.py
a7e867d0ed008ddf
8.13
17
""" The spherical harmonic classes store the respective definitions and basis functions, as well as their derivative and inverse. Please refer to the :doc:`/theory/spherical_harmonic_definition` page for more specific information on the mathematical definitions of spherical harmonics. """ import numpy as np import pyfa...
pyfar/spharpy
spharpy/classes/sh.py
.py
70057c66835dd639
7.54
11
"""Interpolation module for spherical data.""" from scipy import interpolate as spinterpolate import numpy as np class SmoothSphereBivariateSpline(spinterpolate.SmoothSphereBivariateSpline): """Smooth bivariate spline approximation in spherical coordinates. The implementation uses the method proposed by Dier...
pyfar/spharpy
spharpy/interpolate.py
.py
a6924ed0496ce142
7.54
11
""" Helper functions for coordinate operations. """ import numpy as np from scipy.spatial import cKDTree, SphericalVoronoi def coordinates2latlon(coordinates): r"""Transforms from Cartesian coordinates to Geocentric coordinates. .. math:: h = \sqrt{x^2 + y^2 + z^2}, \theta = \pi/2 - \arcco...
pyfar/spharpy
spharpy/samplings/helpers.py
.py
1e14702af737f46d
7.54
11
import pytest import pyfar as pf import numpy as np from spharpy import SamplingSphere from spharpy.samplings import equal_area @pytest.fixture def make_coordinates(): """Fixture factory which can be used to return coordinate storing objects. Works with every child class of pyfar.Coordinates which supports t...
pyfar/spharpy
tests/conftest.py
.py
51871fb0296988b8
7.04
11
""" Tests for the aperture function of a spherical loudspeaker array. """ import spharpy.spherical as sh from scipy.special import legendre from spharpy.spherical import sph_identity_matrix import numpy as np def test_aperture_diag(): n_max = 10 rad_cap = 0.1 rad_sphere = 1 aperture = sh.aperture_vibr...
pyfar/spharpy
tests/test_aperture.py
.py
10db829846cbc1fc
7.04
11
from spharpy import SamplingSphere from pyfar import Coordinates import numpy as np import numpy.testing as npt import pytest from spharpy.samplings import gaussian def test_sampling_sphere_init(): sampling = SamplingSphere() assert isinstance(sampling, SamplingSphere) def test_sampling_sphere_init_value():...
pyfar/spharpy
tests/test_coordinates.py
.py
fe8960b1ab328667
7.04
11
""" Tests for modal strength function. """ from scipy.io import loadmat import spharpy.spherical as sh import numpy as np def test_modal_strength_open(): n_max = 5 n_bins = 128 k = np.linspace(0.5, 15, n_bins) fname = './tests/data/modal_strength_open.mat' reference = loadmat(fname)['matrix'] ...
pyfar/spharpy
tests/test_modal_strength.py
.py
e176e2ce75350282
8.04
11
import pytest import matplotlib.pyplot as plt from spharpy.plot._utils import _prepare_plot @pytest.mark.parametrize( ("ax_case", "output_type", "projection"), [("none", plt.Axes, "3d"), ("single", plt.Axes, None), ("two", list, None)], ) def test_prepare_plot(ax_case, output_type, projection): """ ...
pyfar/spharpy
tests/test_plot__utils.py
.py
a0540180f0215434
7.04
11
import numpy as np import pytest import spharpy.samplings as samplings from spharpy import SamplingSphere from pyfar import Coordinates import numpy.testing as npt from spharpy.spherical import ( spherical_harmonic_basis_real, spherical_harmonic_basis) @pytest.mark.parametrize("flatten_output", [True, False]) de...
pyfar/spharpy
tests/test_samplings.py
.py
c57e28b3dd61352e
7.04
11
""" Tests for spherical harmonic class. """ import pytest import numpy as np from spharpy import ( SphericalHarmonics, SamplingSphere, SphericalHarmonicDefinition, ) import pyfar as pf import deepdiff def test_spherical_harmonics_definition_init(): """Test default behavior.""" definition = SphericalHarmon...
pyfar/spharpy
tests/test_sh_class.py
.py
0a7fc3afebf454d1
8.04
11
""" Tests for special functions. """ import pytest from spharpy import special import numpy as np import numpy.testing as npt def genfromtxt_complex(filename, delimiter=','): """Generate complex numpy array from csv file.""" data_str = np.genfromtxt(filename, delimiter=delimiter, dtype=str) mapping = np...
pyfar/spharpy
tests/test_special.py
.py
22b6bb82e9e60540
7.04
11
from spharpy.classes.audio import ( SphericalHarmonicTimeData, SphericalHarmonicFrequencyData, _atleast_3d_first_dimension) from spharpy import SphericalHarmonicDefinition import numpy as np import numpy.testing as npt def test_atleast_3d_data(): """Test extending the shape of 1D and 2D array likes.""...
pyfar/spharpy
tests/test_spherical_harmonics_audio.py
.py
c3326765f2b6b429
8.04
11
# coding=utf8 # Copyright 2018-2025 JDCLOUD.COM # # 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 agr...
jdcloud-api/jdcloud-sdk-python
demo/rds_test.py
.py
a02c309b3ea8c9ae
7.16
20
# coding=utf8 # Copyright 2018 JDCLOUD.COM # # 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 ...
jdcloud-api/jdcloud-sdk-python
jdcloud_sdk/core/signer.py
.py
165186c1ff080a9d
7.66
20
# coding=utf8 # Copyright 2018 JDCLOUD.COM # # 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 ...
jdcloud-api/jdcloud-sdk-python
jdcloud_sdk/services/ag/apis/CreateAgRequest.py
.py
1bf51417515304ef
7.66
20
# coding=utf8 # Copyright 2018 JDCLOUD.COM # # 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 ...
jdcloud-api/jdcloud-sdk-python
jdcloud_sdk/services/ag/apis/CreateAsAlarmRequest.py
.py
43365ee903ba613d
7.66
20
# coding=utf8 # Copyright 2018 JDCLOUD.COM # # 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 ...
jdcloud-api/jdcloud-sdk-python
jdcloud_sdk/services/ag/apis/CreateAsCronRequest.py
.py
5ea25b956fd3371a
7.66
20
# coding=utf8 # Copyright 2018 JDCLOUD.COM # # 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 ...
jdcloud-api/jdcloud-sdk-python
jdcloud_sdk/services/ag/apis/CreateAsRuleRequest.py
.py
b0513fcd39f0590b
7.66
20
# coding=utf8 # Copyright 2018 JDCLOUD.COM # # 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 ...
jdcloud-api/jdcloud-sdk-python
jdcloud_sdk/services/ag/apis/DescribeAgsRequest.py
.py
bda8a990d143651f
7.66
20
# coding=utf8 # Copyright 2018 JDCLOUD.COM # # 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 ...
jdcloud-api/jdcloud-sdk-python
jdcloud_sdk/services/ag/apis/DescribeAsAlarmsRequest.py
.py
cec437571fde7430
7.66
20
# coding=utf8 # Copyright 2018 JDCLOUD.COM # # 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 ...
jdcloud-api/jdcloud-sdk-python
jdcloud_sdk/services/ag/apis/DescribeAsCronsRequest.py
.py
61ed893bb890be89
7.66
20
# coding=utf8 # Copyright 2018 JDCLOUD.COM # # 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 ...
jdcloud-api/jdcloud-sdk-python
jdcloud_sdk/services/ag/apis/DescribeAsRulesRequest.py
.py
daa5a8ccfe0a7107
7.66
20
# coding=utf8 # Copyright 2018 JDCLOUD.COM # # 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 ...
jdcloud-api/jdcloud-sdk-python
jdcloud_sdk/services/ag/apis/DescribeScalingActivitiesRequest.py
.py
6b28b01ca1c7ac64
7.66
20
#!/usr/bin/env python3 # MIT License # # Copyright (c) 2020 FABRIC Testbed # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to ...
fabric-testbed/InformationModel
fim/slivers/attached_components.py
.py
0e2ecd02c9eeefae
7.42
6
#!/usr/bin/env python3 # MIT License # # Copyright (c) 2020 FABRIC Testbed # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to ...
fabric-testbed/InformationModel
fim/slivers/base_sliver.py
.py
e39d6f4800e15f08
7.42
6
#!/usr/bin/env python3 # MIT License # # Copyright (c) 2021 FABRIC Testbed # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to ...
fabric-testbed/InformationModel
fim/slivers/gateway.py
.py
490f7a21a82f050c
7.42
6
#!/usr/bin/env python3 # MIT License # # Copyright (c) 2020 FABRIC Testbed # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to ...
fabric-testbed/InformationModel
fim/slivers/maintenance_mode.py
.py
c6957e6d2413e618
7.42
6
"""Entry point for ``python -m microbench`` / ``microbench`` console script.""" import os import subprocess import sys import threading from microbench.cli.parser import ( _CAPTURE_CHOICES, _SIGTERM_GRACE_PERIOD, _build_parser, ) from microbench.cli.registry import MIXIN_REGISTRY from microbench.cli.runne...
alubbock/microbench
microbench/cli/main.py
.py
bdfe2078cbf466d7
7.66
20
"""Subprocess execution and per-iteration capture for the CLI.""" import threading from datetime import datetime, timezone class _SubprocessMonitorThread(threading.Thread): """Background thread that samples CPU and RSS of a child process.""" def __init__(self, pid, interval): super().__init__(daemon...
alubbock/microbench
microbench/cli/runner.py
.py
2979018a7cfd1e40
7.66
20
"""JSON encoding utilities for microbench. Provides a JSONEncoder that handles datetime, timedelta, timezone, and numpy scalar/array types, plus a warning class and placeholder value for unencodable objects. """ import json from datetime import datetime, timedelta, timezone try: import numpy except ImportError: ...
alubbock/microbench
microbench/core/encoding.py
.py
32affeaee4d4c8cb
7.66
20
import json import logging import threading from datetime import datetime class LiveStream: """Tail a benchmark output file and process records as they arrive. Usage:: stream = MyStream('/path/to/benchmark.jsonl') # ... runs in background ... stream.stop() stream.join() "...
alubbock/microbench
microbench/livestream.py
.py
b2cdb0b940f55bdb
7.66
20
"""Shared mixin utilities: CLIArg descriptor and internal sentinels.""" _UNSET = object() class CLIArg: """Declares a CLI argument that sets a mixin attribute. Attach a list of ``CLIArg`` instances to a mixin class as ``cli_args`` to expose configurable attributes through ``python -m microbench``. A...
alubbock/microbench
microbench/mixins/base.py
.py
f823f3c5093a2fa1
7.66
20
"""Call-related mixins: MBFunctionCall, MBReturnValue.""" import warnings from microbench.core.encoding import _UNENCODABLE_PLACEHOLDER_VALUE, JSONEncodeWarning class MBFunctionCall: """Capture function arguments and keyword arguments""" def capture_function_args_and_kwargs(self, bm_data): call = b...
alubbock/microbench
microbench/mixins/call.py
.py
81980708c4b1257f
7.66
20
"""GPU mixins: MBNvidiaSmi.""" import re import subprocess from microbench.mixins.base import CLIArg _NVIDIA_GPU_REGEX = re.compile(r'^[0-9A-Za-z\-:]+$') def _nvidia_gpu_id(value): """argparse type: accept a GPU index, UUID, or PCI bus ID.""" import argparse if not _NVIDIA_GPU_REGEX.match(value): ...
alubbock/microbench
microbench/mixins/gpu.py
.py
195d58d8cc20a453
7.66
20
"""Profiling mixins: MBPeakMemory, MBLineProfiler.""" import base64 import pickle try: import line_profiler except ImportError: line_profiler = None class MBPeakMemory: """Capture peak Python memory allocation during the benchmarked function. Uses :mod:`tracemalloc` from the Python standard library...
alubbock/microbench
microbench/mixins/profiling.py
.py
079cc86510de7b29
7.66
20
"""Python environment mixins. Classes: MBPythonInfo, MBGlobalPackages, MBInstalledPackages, MBCondaPackages. """ import inspect import os import platform import shutil import subprocess import sys import types def _is_microbench_internal(filename): """True for source files inside the microbench package, excludi...
alubbock/microbench
microbench/mixins/python.py
.py
7f28fad072f8e0d5
7.66
20
"""System-info mixins. Classes: MBHostInfo, MBWorkingDir, MBSlurmInfo, MBCgroupLimits, MBLoadedModules, MBResourceUsage. """ import os import socket import sys try: import psutil except ImportError: psutil = None try: import resource as _resource except ImportError: _resource = None class MBHostIn...
alubbock/microbench
microbench/mixins/system.py
.py
473a5be2cd5a7b01
7.66
20
"""Version-control mixins: MBGitInfo, MBFileHash.""" import os import subprocess import sys from microbench.mixins.base import CLIArg def _existing_file(value): """argparse type: accept an existing file path, reject directories.""" import argparse if os.path.isdir(value): raise argparse.Argumen...
alubbock/microbench
microbench/mixins/vcs.py
.py
533d37c28a0da533
7.66
20
"""Abstract base class for benchmark output sinks.""" class Output: """Abstract base class for benchmark output sinks. Subclass this to implement custom output destinations. Must implement :meth:`write`. May optionally implement :meth:`get_results` to allow reading back stored results. Example::...
alubbock/microbench
microbench/outputs/base.py
.py
0a88d6c6191d3d0a
7.66
20
"""FileOutput — write benchmark results to a file or StringIO buffer.""" import io import json try: import pandas except ImportError: pandas = None from .base import Output from .utils import _flatten_dict class FileOutput(Output): """Write benchmark results to a file path or file-like object (JSONL fo...
alubbock/microbench
microbench/outputs/file.py
.py
f96c5bcc1cd9ecea
7.66
20
"""HttpOutput — POST each benchmark result to an HTTP/HTTPS endpoint.""" import json import urllib.error import urllib.request from .base import Output class HttpOutput(Output): """POST each benchmark result to an HTTP/HTTPS endpoint. Designed for webhooks and real-time notifications (e.g. Slack, Teams, ...
alubbock/microbench
microbench/outputs/http.py
.py
a2bb5efc3fd13d60
7.66
20
import os from unittest.mock import patch from microbench import MBCondaPackages, MicroBench SAMPLE_CONDA_LIST = """\ # packages in environment at /path/to/env: # # Name Version Build Channel numpy 1.24.3 py311ha0bc626_0 conda-forge pandas ...
alubbock/microbench
tests/test_conda.py
.py
90f5a3defd1fa804
7.16
20
from microbench.diff import _align_seqs, _html_diffs, _markup_diff def test_markup_diff_identical(): """Identical sequences produce no highlighted spans.""" tokens = ['hello', 'world'] out_a, out_b = _markup_diff(tokens, tokens) assert out_a == tokens assert out_b == tokens def test_markup_diff_...
alubbock/microbench
tests/test_diff.py
.py
1fa5eb3f8d649be8
8.16
20
import json import os import tempfile import time from datetime import timedelta from microbench.livestream import LiveStream def _write_record(fp, record): fp.write(json.dumps(record) + '\n') fp.flush() def _make_record(**kwargs): """Build a v2-schema benchmark record.""" base = { 'call': ...
alubbock/microbench
tests/test_livestream.py
.py
f39cb8d43fd0c0b7
7.16
20
from unittest.mock import patch import microbench.mixins.system from microbench import MBHostInfo, MicroBench def test_mbhostinfo_with_psutil(): """MBHostInfo captures all five host fields when psutil is available.""" class MyBench(MicroBench, MBHostInfo): pass mybench = MyBench() @mybench...
alubbock/microbench
tests/test_psutil.py
.py
49703771d855feb4
7.16
20
#!/usr/bin/python3 """Manage FAUCET config files via RPC (client).""" import argparse import inspect from faucetconfrpc.faucetconfrpc_client_lib import FaucetConfRpcClient from faucetconfrpc.faucetconfrpc_server import yaml_load, yaml_dump class ClientError(Exception): """Exceptions for client.""" def get_att...
anarkiwi/faucetconfrpc
src/faucetconfrpc/faucetconfrpc_client.py
.py
dbfc7f22b558e2ce
7.5
9
""" MDPSolver This file defines a `model` class that wraps around the `solvermodule` to create and solve Markov Decision Processes (MDPs). It provides methods to configure the model, solve it, and extract the resulting policy and value vectors. """ import sys from mdpsolver import solvermodule class model: """ ...
areenberg/MDPSolver
Python/src/mdpsolver/model.py
.py
f9866d55dfab40d2
7.5
9
import configparser import os import sys class FoenixConfig: """Configuration data for the FoenixMgr. Exposes the foenix.ini file.""" def __init__(self): """Attempt to read and process the config file.""" config = configparser.ConfigParser() config.read(['foenixmgr.ini', os.path.expand...
pweingar/FoenixMgr
FoenixMgr/foenix_config.py
.py
7e25f6c570d4f038
7.62
16
import re class HexFile: """Read information from an Intel Hex file.""" file = 0 base_address = 0 handler = 0 def __init__(self): self.file = 0 self.base_address = 0 self.handler = 0 def open(self, filename): self.file = open(filename, 'r') def set_ha...
pweingar/FoenixMgr
FoenixMgr/intelhex.py
.py
d64812771eb3da6f
7.62
16
"""Encode host keys as K2 optical-keyboard matrix snapshots.""" OPTICAL_SNAPSHOT_SIZE = 16 # These are the first 64 entries of the K2 microkernel key table. Each # group of eight is a firmware state row. Hardware delivers the rows in reverse # order and reverses the column bit numbering. _OPTICAL_ASCII_INDEX = { ...
pweingar/FoenixMgr
FoenixMgr/keyboard.py
.py
1c5ca217975afa13
7.62
16
# # Loader for PGX files # import sys import constants import foenix_config from pathlib import Path class PGXBinFile: """Reads information from PGX formated file""" address_size = 0 data = 0 handler = 0 cpu = "" config = 0 def __init__(self): self.config = foeni...
pweingar/FoenixMgr
FoenixMgr/pgx.py
.py
127127fb2aca9afb
7.62
16
# # Loader for PGZ files # import foenix_config from pathlib import Path class PGZBinFile: """Reads information from PGZ formated file""" address_size = 0 data = 0 handler = 0 cpu = "" config = 0 def __init__(self): self.config = foenix_config.FoenixConfig() ...
pweingar/FoenixMgr
FoenixMgr/pgz.py
.py
3aa5bc439ff6ed90
7.62
16
import re class SRECFile: """Read information from a Motorola SREC file.""" file = 0 handler = 0 def __init__(self): self.file = 0 self.handler = 0 def open(self, filename): self.file = open(filename, 'r') def set_handler(self, proc): self.handler = proc ...
pweingar/FoenixMgr
FoenixMgr/srec.py
.py
b8331107a8b132df
7.62
16
from pathlib import Path ## # See: http://www.westerndesigncenter.com/wdc/datasheets/Assembler_Linker.pdf # page 37 # # Initial byte 'Z' as signature. # # Then for each block: # 3 byte address # 3 byte length # length bytes of data # # The final block has an address and length of 0. # class WdcB...
pweingar/FoenixMgr
FoenixMgr/wdc.py
.py
e93f8886958d3dad
7.62
16
import os from logging.config import fileConfig from sqlalchemy import engine_from_config from sqlalchemy import pool from sqlmodel import SQLModel from alembic import context from app.models import bulk_email, food_tracking, forms, judging, meal, user # noqa: F401 # this is the Alembic Config object, which provide...
hackthevalley/hack-the-back
alembic/env.py
.py
f4262db7b547e2fa
7.42
6
"""add account security state Revision ID: 2c1d5e7a9b30 Revises: bf8b33c13520 Create Date: 2026-07-22 """ from typing import Sequence, Union import sqlalchemy as sa from alembic import op revision: str = "2c1d5e7a9b30" down_revision: Union[str, Sequence[str], None] = "bf8b33c13520" branch_labels: Union[str, Seque...
hackthevalley/hack-the-back
alembic/versions/2c1d5e7a9b30_add_account_security_state.py
.py
a077d4361697c215
7.42
6
"""merge renamed race ethnicity question Revision ID: 94b0f2d61c7a Revises: 2c1d5e7a9b30 Create Date: 2026-08-05 """ from typing import Sequence, Union import sqlalchemy as sa from alembic import op revision: str = "94b0f2d61c7a" down_revision: Union[str, Sequence[str], None] = "2c1d5e7a9b30" branch_labels: Union[s...
hackthevalley/hack-the-back
alembic/versions/94b0f2d61c7a_merge_race_ethnicity_question.py
.py
fe559e37498b4f96
7.42
6
"""add bulk email jobs Revision ID: a31f0e8c4d12 Revises: d72b2ec932bf """ from collections.abc import Sequence import sqlalchemy as sa from alembic import op revision: str = "a31f0e8c4d12" down_revision: str | None = "d72b2ec932bf" branch_labels: str | Sequence[str] | None = None depends_on: str | Sequence[str] | ...
hackthevalley/hack-the-back
alembic/versions/a31f0e8c4d12_add_bulk_email_jobs.py
.py
501a3c87ec2754cd
7.42
6
"""enforce unique food tracking per user and meal Revision ID: c61a1db821ae Revises: 7f3c1a2d9e40 Create Date: 2026-08-06 """ from typing import Sequence, Union from alembic import op revision: str = "c61a1db821ae" down_revision: Union[str, Sequence[str], None] = "7f3c1a2d9e40" branch_labels: Union[str, Sequence[st...
hackthevalley/hack-the-back
alembic/versions/c61a1db821ae_unique_food_tracking.py
.py
73d48a9a56699275
7.42
6
class DomainError(Exception): """Base exception for expected domain and application failures.""" status_code = 400 def __init__(self, detail: str, *, status_code: int | None = None) -> None: super().__init__(detail) self.detail = detail if status_code is not None: self....
hackthevalley/hack-the-back
app/core/errors.py
.py
2fc0e49675352e91
7.42
6
"""Utilities for compatibility with older versions of Python """ import os import sys import asyncio import shutil import warnings from typing import TypeVar, Literal __all__ = [ 'StartResponse', 'WSGIEnvironment', 'WSGIApplication', 'rmtree', 'HAVE_EXCEPTION_GROUP', 'warnings_warn', 'asyn...
encukou/freezeyt
freezeyt/compat.py
.py
2be5c4b0ab9361ed
7.48
8
from io import BytesIO from pathlib import PurePosixPath from typing import Dict, Union, Iterable, Tuple from .saver import Saver # Type for holding simulated directory contents. DictSaverContents = Dict[ str, # filename; maps to either: Union[ bytes, # file content, or 'DictSaverContents',...
encukou/freezeyt
freezeyt/dictsaver.py
.py
c0dfce0249c3d05e
7.48
8
from urllib.parse import unquote # See doc/encoding-notes.txt for notes on the string encodings. def decode_input_path(s: str) -> str: r"""Decodes a path from URL (text) for internal use Examples: /čau/☺フ → /čau/☺フ /%C4%8Dau → /čau /%8Dau → '/\udc8dau' """ return unquote(s, er...
encukou/freezeyt
freezeyt/encoding.py
.py
724c4947c1ce179a
7.48
8
import base64 from pathlib import Path import collections.abc from typing import Mapping, Iterator, Tuple, Union import sys from freezeyt.util import get_url_part from freezeyt.types import ExtraFileConfig if sys.version_info > (3, 8): from typing import Literal literal_content = Literal["content"] liter...
encukou/freezeyt
freezeyt/extra_files.py
.py
78510fc53a03b571
7.48
8
import os import stat import asyncio from pathlib import Path, PurePosixPath from . import compat from .saver import Saver from .urls import PrefixURL from typing import Callable, Iterable, BinaryIO class DirectoryExistsError(Exception): """Attempt to overwrite directory that doesn't contain freezeyt output""" ...
encukou/freezeyt
freezeyt/filesaver.py
.py
737e93160293bcd2
7.48
8
from typing import Iterable, Callable, Optional, TYPE_CHECKING from freezeyt.urls import AppURL if TYPE_CHECKING: from freezeyt.freezer import Freezer, Task class TaskInfo: """Public information about a task that's being saved""" def __init__(self, task: 'Task'): self._task = task self._...
encukou/freezeyt
freezeyt/hooks.py
.py
47a80514b151e5f5
7.48
8
from mimetypes import guess_type import json from typing import Optional, List, Mapping, Dict import functools from pathlib import PurePosixPath from werkzeug.datastructures import Headers from werkzeug.http import parse_options_header from freezeyt.util import WrongMimetypeError from freezeyt.util import import_vari...
encukou/freezeyt
freezeyt/mimetype_check.py
.py
83828004241b4f83
7.48
8
import xml.etree.ElementTree from typing import Iterable, BinaryIO, Optional, Any, TYPE_CHECKING import asyncio import html5lib import tinycss2 import tinycss2.ast import tinycss2_core_attributes from werkzeug.datastructures import Headers from werkzeug.http import parse_options_header from .util import process_pool...
encukou/freezeyt
freezeyt/url_finders.py
.py
8036ba03b5697054
7.48
8
import urllib.parse import functools from typing import Union from werkzeug.urls import uri_to_iri from freezeyt.util import RelativeURLError, UnsupportedSchemeError from freezeyt.util import BadPrefixError, ExternalURLError from freezeyt.encoding import decode_input_path def split_iri(url): return urllib.parse...
encukou/freezeyt
freezeyt/urls.py
.py
e2dbf5fbfd6979e9
7.48
8
import importlib import concurrent.futures from typing import Sequence, TYPE_CHECKING, List, Optional, TypeVar import enum from werkzeug.http import HTTP_STATUS_CODES from freezeyt.compat import _MultiErrorBase, HAVE_EXCEPTION_GROUP from freezeyt.encoding import decode_input_path if TYPE_CHECKING: from freezeyt...
encukou/freezeyt
freezeyt/util.py
.py
10c319ff2c6e1dd4
7.48
8
import io import sys import itertools from typing import List, Dict, Tuple, Optional import freezeyt from freezeyt.types import asgi_types from freezeyt.encoding import encode_wsgi_path from freezeyt.urls import PrefixURL from freezeyt.types import WSGIExceptionInfo, WSGIStartResponseResult from freezeyt.compat import...
encukou/freezeyt
freezeyt/wsgi_to_asgi.py
.py
6e6a9f6098166a5f
7.48
8
from flask import Flask app = Flask(__name__) # For verification that this is the unchanged Flask app app.is_the_fixture_app_2pages = True @app.route('/') def index(): """Show index page of the web app. And link to the second page. """ return """ <html> <head> <title>Hello w...
encukou/freezeyt
tests/fixtures/app_2pages/app.py
.py
e350cfdfba1ca5ea
7.98
8
from flask import Flask app = Flask(__name__) @app.route('/') def index(): """Make index page. Link to the second page. Link to itself. """ return """ <html> <head> <title>Hello world</title> </head> <body> Hello world! <br> ...
encukou/freezeyt
tests/fixtures/app_2pages_cycle/app.py
.py
810db76bfcf094a6
7.98
8
from flask import Flask, Response, url_for app = Flask(__name__) freeze_config = { 'status_handlers': {'3xx': 'follow'}, } @app.route('/') def index(): """Redirect to the second page. """ return Response( "Redirecting to second page...", status='301 Moved Permanently', headers=...
encukou/freezeyt
tests/fixtures/app_3pages_redirects/app.py
.py
8c1a7458166bad12
7.98
8
import falcon freeze_config = {'cleanup': False} class Resource(object): """Creates Resource object for Falcon App""" def on_get(self, req, resp): """Handles GET requests on index (/)""" resp.text = """ <html> <head> <title>Hello world from Falcon app</title>...
encukou/freezeyt
tests/fixtures/app_cleanup_config/app.py
.py
6b503ee55346fd3e
7.98
8
from flask import Flask, url_for class TestFailFastError(ValueError): """ Error defined for purpose of this test to indetify source of exception easily. """ app = Flask(__name__) freeze_config = {'fail_fast': True} app.config['PROPAGATE_EXCEPTIONS'] = True @app.route('/') def index(): return f""" ...
encukou/freezeyt
tests/fixtures/app_fail_fast/app.py
.py
b3d717c8c05732d3
7.98
8
from flask import Flask, render_template app = Flask(__name__) freeze_config = {'extra_pages': ["static/OFL.txt"]} @app.route("/") def index(): """ Demo app for test HTML template links to CSS which links to a font in a file. """ return render_template("index.html") @app.route("/second_page.ht...
encukou/freezeyt
tests/fixtures/app_links_css/app.py
.py
24cdeba25cbf2130
7.98
8
from flask import Flask wsgi_application = Flask(__name__) @wsgi_application.route('/') def index(): """Create the index page of the web app.""" return """ <html> <head> <title>Hello world</title> </head> <body> Hello world! </body> </html> ...
encukou/freezeyt
tests/fixtures/app_nonstandard_name/application.py
.py
aa434ebd75c1a253
7.48
8
from flask import Flask, url_for app = Flask(__name__) @app.route('/') def index(): """Show index page of the web app. And link to the second page. """ return f""" <html> <head> <title>Hello world</title> </head> <body> Hello world! <br...
encukou/freezeyt
tests/fixtures/app_url_for/app.py
.py
7248380852e87cd9
7.98
8
from flask import Flask, url_for app = Flask(__name__) freeze_config = {'prefix': 'http://freezeyt.test:1234/foo/'} @app.route('/') def index(): """Show index page of the web app. And link to the second page. """ return f""" <html> <head> <title>Hello world</title> </...
encukou/freezeyt
tests/fixtures/app_url_for_port_prefix/app.py
.py
e0491f14dc34cf8d
7.98
8
from flask import Flask, url_for app = Flask(__name__) freeze_config = {'prefix': 'http://freezeyt.test/foo/'} @app.route('/') def index(): """Show index page of the web app. And link to the second page. """ return f""" <html> <head> <title>Hello world</title> </head> ...
encukou/freezeyt
tests/fixtures/app_url_for_prefix/app.py
.py
20cfbb1684325f20
7.98
8
from flask import Flask, url_for app = Flask(__name__) freeze_config = {'prefix': 'https://freezeyt.test/foo/'} @app.route('/') def index(): """Show index page of the web app. And link to the second page. """ return f""" <html> <head> <title>Hello world</title> </head>...
encukou/freezeyt
tests/fixtures/app_url_for_prefix_https/app.py
.py
674cb078f7e89953
7.98
8
#!/usr/bin/env python3 # vi: ts=4 """ TIC TAC TOE game for WWI Simple version with one display and light gun A 3x3 grid of points, crosses and circles is display. If a point is hit by any light gun, it is changed to X or O, depending on the player's number. A point is shown in the b...
gfedorkow/Whirlwind-Instruction-Simulator
Py/Shell/tictactoe.py
.py
34a4769107531f72
7.65
19
#!/usr/bin/env python3 # vi: ts=4 """ Stand-alone test for the WWI vector interface Shows some tests, switches to next by key Last one uses light pen uses floating point numbers for convenience, not (yet) fixed point fractions as in WWI """ # import math import random import time import vecI...
gfedorkow/Whirlwind-Instruction-Simulator
Py/Shell/vecIF.py
.py
042ed0a9cf6dfee8
7.65
19
#!/usr/bin/env python3 # vi: ts=4 """ Basic functions for vector interface """ # import RPi.GPIO as gpio import spidev import time import math import random # version = "0.2c" # pin definitions in BCM numbering pin_doMove = 17 pin_doDraw = 22 pin_enZ1 = 18 pin_enZ2 = 23 pin_isKey = 27 pin_isGun1 = 25 pin_isGun2 = 2...
gfedorkow/Whirlwind-Instruction-Simulator
Py/Shell/vecIFbase.py
.py
5a5a863a9137cb61
7.65
19
from vpython import * # Bruce Sherwood N = 4 # N by N by N array of atoms # Surrounding the N**3 atoms is another layer of invisible fixed-position atoms # that provide stability to the lattice. k = 1 m = 1 spacing = 1 atom_radius = 0.3*spacing L0 = spacing-1.8*atom_radius V0 = pi*(0.5*atom_radius)**2*L0 # initial vo...
gfedorkow/Whirlwind-Instruction-Simulator
Py/Tester/VPythonDemos_no_notebook/AtomicSolid.py
.py
09bcef291009fb28
7.15
19
import uuid import datetime import traceback import logging import aio_pika from PikaBus.tools import PikaConstants from PikaBus.abstractions.AbstractPikaProperties import AbstractPikaProperties ISO_TIME_FORMAT = None LEGACY_TIME_FORMAT = '%m/%d/%Y %H:%M:%S' def UtcNow() -> datetime.datetime: """ Timezone...
hansehe/PikaBus
PikaBus/PikaProperties.py
.py
82ba9e7c7d8986dd
7.5
9
import json import logging from PikaBus.abstractions.AbstractPikaSerializer import AbstractPikaSerializer class PikaSerializer(AbstractPikaSerializer): def __init__(self, contentEncoding: str = 'utf-8', logger=logging.getLogger(__name__)): """ :param str contentEn...
hansehe/PikaBus
PikaBus/PikaSerializer.py
.py
81f98d8efb3a1b8b
7.5
9
import abc from PikaBus.abstractions.AbstractPikaBus import AbstractPikaBus class AbstractPikaMessageHandler(abc.ABC): @abc.abstractmethod def HandleMessage(self, data: dict, bus: AbstractPikaBus, payload: dict): """ Handle an incoming message. May be implemented as either `def Handl...
hansehe/PikaBus
PikaBus/abstractions/AbstractPikaMessageHandler.py
.py
42477f87dcbfbebd
7.5
9
import abc class AbstractPikaSerializer(abc.ABC): @abc.abstractmethod def Serialize(self, data: dict, payload: dict): """ :param dict data: General data holder dictionary :param payload: payload to serialize :return: (bytes, str, str) body, contentType, contentEncoding ...
hansehe/PikaBus
PikaBus/abstractions/AbstractPikaSerializer.py
.py
8c38c525ae3c96c6
7.5
9
import json from PikaBus.tools import PikaConstants from PikaBus.abstractions.AbstractPikaBus import AbstractPikaBus from PikaBus.abstractions.AbstractPikaMessageHandler import AbstractPikaMessageHandler class PikaMessageHandler(AbstractPikaMessageHandler): """An asynchronous AbstractPikaMessageHandler subclass....
hansehe/PikaBus
tests/PikaMessageHandler.py
.py
9983921a63f78dbe
8
9
r""" The module :mod:`espm.datasets.base` implements the functions that combines a spatial distribution and associated spectra into a 3D dataset. It also implements the functions to convert the dataset into hyperspy compatible objects. """ from pathlib import Path import hyperspy.api as hs import numpy as np from tqd...
adriente/espm
espm/datasets/base.py
.py
37f64f8beff2a74a
7.64
18
import numpy as np from espm.conf import dicotomy_tol, log_shift, maxit_dichotomy def dichotomy_simplex( num, denum, log_shift=log_shift, tol=dicotomy_tol, maxit=maxit_dichotomy ): """ Function to solve the num/(x+denum) -1 = 0 equation. Here, x is the Lagragian multiplier which is used to apply the simp...
adriente/espm
espm/estimators/dicotomy.py
.py
7f6a1683701fdeda
7.64
18
""" Test suite for the docstrings of the espm package. """ import doctest import os def gen_recursive_file(root, ext): for root, _, filenames in os.walk(root): for name in filenames: if name.lower().endswith(ext): yield os.path.join(root, name) def func_test_docstrings(root,...
adriente/espm
tests/test_docstring.py
.py
20015cf3ead90d95
8.14
18
import numpy as np from espm.conf import log_shift from espm.measures import ( Frobenius_loss, KL_loss_surrogate, KLdiv, KLdiv_loss, find_min_angle, find_min_MSE, log_reg, log_surrogate, mse, ordered_angles, ordered_mse, spectral_angle, trace_xtLx, ) from espm.utils ...
adriente/espm
tests/test_measures.py
.py
6f2667724ec627cc
7.14
18