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 |
|---|---|---|---|---|---|---|
import json
from src.companies import Companies
from src.logging_utils import get_logger
# Filter companies specifically for the Fintech category
company_list = Companies.filter_companies(category="fintech")
Companies.write_companies('fin_companies.json', company_list)
logger = get_logger(__name__)
# Main output file... | crypto-jobs-fyi/crawler | merge_fin_jobs.py | .py | 202e9a96ae0efcab | 7.48 | 8 |
import json
from src.companies import Companies
from src.logging_utils import get_logger
# Filter companies specifically for the Tech category
company_list = Companies.filter_companies(category="tech")
Companies.write_companies('tech_companies.json', company_list)
logger = get_logger(__name__)
# Main output file for ... | crypto-jobs-fyi/crawler | merge_tech_jobs.py | .py | db5f46829bd2d812 | 7.48 | 8 |
# Copyright 2024-, European Centre for Medium Range Weather Forecasts.
# 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 ... | ecmwf/earthkit-transforms | src/earthkit/transforms/_aggregate.py | .py | 2d53dbcb92163fb0 | 7.52 | 10 |
# Copyright 2024-, European Centre for Medium Range Weather Forecasts.
# 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 ... | ecmwf/earthkit-transforms | src/earthkit/transforms/temporal/_rates.py | .py | 2b59f5ca9512d141 | 7.52 | 10 |
from typing import Any
import numpy as np
try:
import cupy as cp
except ImportError:
cp = None
import pandas as pd
import pytest
import xarray as xr
from earthkit.transforms._tools import (
_is_evenly_spaced,
get_dim_key,
get_how,
get_how_xp,
get_spatial_info,
groupby_kwargs_decorator... | ecmwf/earthkit-transforms | tests/legacy-api/test_legacy_10_tools.py | .py | e5747f6a6148a821 | 7.02 | 10 |
# (C) Copyright 2024- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernment... | ecmwf/earthkit-transforms | tests/legacy-api/test_legacy_50_ensemble.py | .py | eb9b22678ae77ff1 | 7.02 | 10 |
# (C) Copyright 2024- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernment... | ecmwf/earthkit-transforms | tests/test_50_ensemble.py | .py | 1c61f973c69d9858 | 7.02 | 10 |
"""Profile Mycosmo.
This script profiles the mycosmo package using timeit, cProfile,
line_profiler and memray.
"""
import cProfile
import pstats
import timeit
import memray
import numpy as np
from line_profiler import LineProfiler
from mycosmo import cosmology
REDSHIFTS = np.linspace(0, 10, 100_000)
COSMO_DICT = ... | sfarrens/Scientific-Software-Dev-Demo | scripts/profile_mycosmo.py | .py | 38d133bb83d0d72b | 7.48 | 8 |
import pytest
from astropy.cosmology import WMAP9 as cosmo
from mycosmo.cosmology import critical_density, hubble
REDSHIFTS = [0.0, 0.5, 1.0]
COSMO_DICT = {
"H0": cosmo.H0.value,
"omega_m_0": cosmo.Om0,
"omega_k_0": cosmo.Ok0,
"omega_lambda_0": cosmo.Ode0,
}
class TestAstropy:
"""Test Astropy.
... | sfarrens/Scientific-Software-Dev-Demo | tests/verify/test_astropy.py | .py | be1113ee9f132f3e | 7.98 | 8 |
# code from https://github.com/theislab/scanpy/blob/master/docs/extensions/typed_returns.py
# with some minor adjustment
from __future__ import annotations
import re
from sphinx.ext.napoleon import NumpyDocstring
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from sphinx.application import Sphinx
from co... | theislab/ehrdata | docs/extensions/typed_returns.py | .py | cacfd10afee48078 | 7.6 | 15 |
import ipywidgets as widgets
def create_single_option_widget(title_text: str, options: list[str]) -> tuple[widgets.VBox, widgets.RadioButtons]:
"""Create a single-option selection widget (RadioButtons).
Args:
title_text: The title displayed above the radio buttons.
options: List of strings re... | theislab/ehrdata | docs/tutorials/widgets.py | .py | 693ab02b5812a877 | 7.6 | 15 |
from __future__ import annotations
import warnings
from functools import wraps
from typing import TYPE_CHECKING, Literal
import numpy as np
import pandas as pd
from dateutil.parser import isoparse # type: ignore
from fast_array_utils.conv import to_dense
from rich import print
from rich.tree import Tree
from scipy.s... | theislab/ehrdata | src/ehrdata/_feature_types.py | .py | 065701be811cb62d | 7.6 | 15 |
from importlib.util import find_spec
from typing import TYPE_CHECKING, Literal
import numpy as np
import scipy
import scipy.sparse as sp
import sparse
# from anndata.abc import CSCDataset, CSRDataset
from anndata.compat import CupyArray, CupySparseMatrix, H5Array, H5Group, ZarrArray, ZarrGroup
if TYPE_CHECKING:
... | theislab/ehrdata | src/ehrdata/_types.py | .py | f3d26b91d1e2f4ba | 7.6 | 15 |
from collections.abc import Sequence
from typing import TYPE_CHECKING, Literal
from duckdb import DuckDBPyConnection
from ehrdata._compat import lazy_import_torch
from ehrdata.core import EHRData
from ehrdata.io.omop._queries import DATA_TABLE_DATE_KEYS, TIME_DEFINING_TABLE_ID_KEY
if TYPE_CHECKING:
import torch
... | theislab/ehrdata | src/ehrdata/integrations/torch/_dataset.py | .py | 174ad68f14206d5c | 7.6 | 15 |
from __future__ import annotations
import warnings
from functools import reduce
from operator import or_, truediv
from pathlib import Path
from types import MappingProxyType
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from collections.abc import Iterable, Mapping
import zarr
from lamindb import Ar... | theislab/ehrdata | src/ehrdata/integrations/vitessce/_config.py | .py | 8cc86f7f0d458274 | 7.6 | 15 |
from __future__ import annotations
import contextlib
from typing import TYPE_CHECKING
import numpy as np
if TYPE_CHECKING:
from ehrdata import EHRData
from ehrdata._logger import logger
def _cast_variables_to_float(edata: EHRData) -> None:
"""Cast the dtype of variables to float, and overwrite the values o... | theislab/ehrdata | src/ehrdata/io/_array_casting.py | .py | 2072f48c7d7121ac | 7.6 | 15 |
"""ehrdata-owned serialization of pydata-sparse :class:`sparse.COO` tensors.
anndata's IO has no writer for n-D ``sparse.COO``, and ehrdata keeps its time-series as 3D
``X``/layers. Rather than register a codec on anndata's *private* IO registry (which would
tie ehrdata to non-public internals), ehrdata serializes the... | theislab/ehrdata | src/ehrdata/io/_coo_codec.py | .py | 5b9ea3652fdf9c0d | 7.6 | 15 |
"""Translate :class:`~ehrdata.EHRData` to and from its on-disk layout.
EHRData keeps time-series as 3D arrays in ``X``/``layers``, but anndata only guarantees 2D arrays there, and enforces this 0.13.0 onwards
EHRData in memory: keeps 3D arrays in ``X``/``layers``. EHRData on disk: moves 3D arrays into ``.obsm``.
"""
... | theislab/ehrdata | src/ehrdata/io/_ondisk.py | .py | 4972d9473ffbd4b6 | 7.6 | 15 |
from __future__ import annotations
import warnings
from pathlib import Path
from typing import TYPE_CHECKING, Literal
import anndata as ad
import h5py
from ehrdata._feature_types import _harmonize_on_read
from ehrdata.core.constants import (
EHRDATA_ENCODING_TYPE,
EHRDATA_ENCODING_TYPE_KEY,
EHRDATA_OBSM_... | theislab/ehrdata | src/ehrdata/io/h5ed.py | .py | 55baadb44584b8fd | 7.6 | 15 |
import logging
from collections.abc import Sequence
from typing import Literal
import duckdb
import pandas as pd
TIME_DEFINING_TABLE_SUBJECT_KEY = {
"person": "person_id",
"visit_occurrence": "person_id",
"observation_period": "person_id",
"cohort": "subject_id",
}
TIME_DEFINING_TABLE_ID_KEY = {
... | theislab/ehrdata | src/ehrdata/io/omop/_queries.py | .py | f333c3721fc56a99 | 7.6 | 15 |
from __future__ import annotations
import warnings
from functools import wraps
from pathlib import Path
from typing import TYPE_CHECKING, Any, Literal
import anndata as ad
import zarr
from ehrdata._feature_types import _harmonize_on_read
from ehrdata.core.constants import (
EHRDATA_ENCODING_TYPE,
EHRDATA_ENC... | theislab/ehrdata | src/ehrdata/io/zarr.py | .py | 745910c94d457dcd | 7.6 | 15 |
"""Script to convert vanilla OMOP CSV files to Parquet format.
This script is run once to create the Parquet test data.
Run from the tests directory:
python data/toy_omop/_convert_vanilla_to_parquet.py
"""
from pathlib import Path
import pandas as pd
def convert_vanilla_to_parquet():
"""Convert all CSV fil... | theislab/ehrdata | tests/data/toy_omop/_convert_vanilla_to_parquet.py | .py | 091a5ea80522e4fb | 7.1 | 15 |
import duckdb
import numpy as np
import pandas as pd
import pytest
import sparse
from tests.conftest import _ANNDATA_ALLOWS_COO, _ANNDATA_ALLOWS_ND_X
import ehrdata as ed
from ehrdata.core.constants import DEFAULT_TEM_LAYER_NAME
def test_mimic_2():
edata = ed.dt.mimic_2()
assert edata.shape == (1776, 46, 1)
... | theislab/ehrdata | tests/dt/test_dt.py | .py | 3991136b95bf5c66 | 8.1 | 15 |
import anndata as ad
import numpy as np
import pytest
from tests.conftest import _ANNDATA_ALLOWS_ND_X
import ehrdata as ed
pytest.importorskip("vitessce")
from ehrdata.integrations.vitessce import gen_config
@pytest.fixture
def adata() -> ad.AnnData:
return ad.AnnData(
X=np.array([[1, 2, 3], [4, 5, 6]]... | theislab/ehrdata | tests/integrations/test_vitessce.py | .py | fc79ac6ac5200834 | 7.1 | 15 |
"""Unit tests for the binsparse data-type table in :mod:`ehrdata.io._coo_codec`.
These lock ehrdata's on-disk COO dtype handling to the binsparse specification's canonical
data-type strings (https://graphblas.org/binsparse-specification/#key_data_types). They exercise
the pure mapping function directly, so they run re... | theislab/ehrdata | tests/io/test_coo_codec.py | .py | c93643d868f3057e | 8.1 | 15 |
import json
import anndata as ad
import numpy as np
import pandas as pd
import pytest
import sparse
import zarr
from scipy.sparse import issparse
from tests.conftest import (
_ANNDATA_ALLOWS_COO,
_ANNDATA_ALLOWS_ND_X,
TEST_DATA_PATH,
_assert_dtype_object_array_with_missing_values_equal,
_assert_io_... | theislab/ehrdata | tests/io/test_zarr.py | .py | b2828d59876e07e1 | 7.1 | 15 |
#!/usr/bin/env python3
"""Update bioconda meta.yaml run dependencies from pyproject.toml."""
import re
import sys
from pathlib import Path
# pip -> conda package name mapping
PIP_TO_CONDA = {
"matplotlib": "matplotlib-base",
"parasail": "parasail-python",
}
def parse_pyproject_deps(pyproject_path: Path) -> ... | MGXlab/Jaeger | .github/scripts/update-meta-deps.py | .py | 64301554a5373037 | 7.52 | 10 |
#!/usr/bin/env python3
"""Plot classifier validation training histories for the nuc vs trans experiments."""
from __future__ import annotations
import sys
from pathlib import Path
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
BASE_DIR = Path(
"... | MGXlab/Jaeger | nuc_vs_trans_experiments/plot_nuc_vs_trans.py | .py | e0b220b0519284bd | 7.52 | 10 |
#!/usr/bin/env python
"""Rebuild a fragment SavedModel graph with a different conv mask_mode.
Loads the model's project yaml + weights, overrides mask_mode on all
masked_conv1d and residual_block layers (weights are unaffected — mask_mode
only changes mask propagation math), and exports a new SavedModel plus the
class... | MGXlab/Jaeger | padding_experiments/rebuild_graph.py | .py | 2c3da30f31771909 | 7.52 | 10 |
#!/usr/bin/env python3
"""Replace some existing eukarya fragments with new big-euk fragments.
The overall eukarya class count stays equal to the original count, so the
eukarya fraction of the training set does not grow when a large eukaryotic
genome is added.
"""
from __future__ import annotations
import argparse
im... | MGXlab/Jaeger | scripts/balance_and_merge_eukarya.py | .py | de57e4c57175520d | 7.52 | 10 |
#!/usr/bin/env python3
"""Evaluate Jaeger predictions on real-world metagenome assemblies.
Matches Jaeger per-contig TSV predictions against fraction-based labels
(e.g. cellular vs phage/virus fractions) and reports precision, recall,
F1, confusion matrices, and reliability statistics.
"""
from __future__ import anno... | MGXlab/Jaeger | scripts/calculate_metrics_realworld.py | .py | 2c86198cd12cb3e4 | 7.52 | 10 |
"""Download bacterial genomes from NCBI for Casjens 2003 validation set.
Downloads FASTA sequences for the 54 bacterial genomes used in the Casjens 2003
prophage evaluation, based on the accessions extracted from the PHASTEST
evaluation table.
"""
from __future__ import annotations
import time
import urllib.request
... | MGXlab/Jaeger | scripts/download_casjens2003_genomes.py | .py | f9aa3547be12e3d7 | 7.52 | 10 |
"""Evaluate a trained Jaeger reliability head at an arbitrary validation crop length.
Loads a saved fragment SavedModel (which exposes a ``reliability`` output) and
scores a reliability validation NPZ with ``validation_crop_sizes`` overridden to
the requested codon count. Reports exact AUROC/AUPRC, calibration (ECE, B... | MGXlab/Jaeger | scripts/eval_reliability_crop_length.py | .py | b35b848ec915c898 | 7.52 | 10 |
"""Extract Casjens 2003 prophage reference coordinates from PHASTEST evaluation table.
Downloads the PHASTEST evaluation table and parses the reference prophage
coordinates for 54 bacterial genomes from Casjens 2003.
"""
from __future__ import annotations
import re
import urllib.request
from pathlib import Path
# P... | MGXlab/Jaeger | scripts/extract_casjens2003_prophages.py | .py | a4109846c9148736 | 7.52 | 10 |
"""Validate Jaeger prophage detection against Casjens 2003 reference set.
Compares Jaeger's prophage predictions with the reference coordinates from
Casjens 2003 (as used in the PHASTEST evaluation) and computes accuracy metrics.
"""
from __future__ import annotations
import argparse
from pathlib import Path
import... | MGXlab/Jaeger | scripts/validate_casjens2003.py | .py | 6119c95ac1e07f9b | 7.52 | 10 |
# curl -X GET "https://ckan.fdm.uni-greifswald.de/api/3/action/package_search?q=jaeger_models"
import requests
from pathlib import Path
import tarfile
import logging
API_URL = "https://ckan.fdm.uni-greifswald.de/api/3/action/package_search"
QUERY = "jaeger"
logger = logging.getLogger("Jaeger")
def list_ckan_model_d... | MGXlab/Jaeger | src/jaeger/commands/downloads.py | .py | 5f5a0fa82fd428e0 | 7.52 | 10 |
import os
os.environ["WRAPT_DISABLE_EXTENSIONS"] = "true"
import json
import sys
import platform
import tempfile
from pathlib import Path
from importlib.resources import files
from importlib.metadata import version, PackageNotFoundError
import tensorflow as tf
from jaeger.nnlib.inference import JaegerModel
from jaeger... | MGXlab/Jaeger | src/jaeger/commands/health.py | .py | f215f0c0c93efe95 | 7.52 | 10 |
import os
os.environ["WRAPT_DISABLE_EXTENSIONS"] = "true"
import json
from pathlib import Path
from importlib.resources import files
import tensorflow as tf
from jaeger.nnlib.inference import JaegerModel
from jaeger.nnlib.v1.layers import WRes_model_embeddings
from jaeger.preprocess.v1.convert import process_string
fr... | MGXlab/Jaeger | src/jaeger/commands/test.py | .py | f9e96725932a8886 | 8.02 | 10 |
#!/usr/bin/env python3
import json
import os
import statistics
from argparse import ArgumentParser
from datetime import datetime
def parse_args():
usage = "python %(prog)s <run_dir> <hash> "
parser = ArgumentParser(usage=usage)
parser.add_argument(
"run_dir",
type=str,
action="sto... | NOAA-GFDL/pyFV3 | examples/standalone/benchmarks/collect_memory_usage_data.py | .py | 65c16305978b3a85 | 7.42 | 6 |
#!/usr/bin/env python3
# type: ignore
import copy
import json
import os
from argparse import ArgumentParser, Namespace
from datetime import datetime, timedelta
from typing import Any, Dict, List, Tuple
import f90nml
import numpy as np
import xarray as xr
import yaml
from mpi4py import MPI
# NOTE: we need to import d... | NOAA-GFDL/pyFV3 | examples/standalone/runfile/dynamics.py | .py | 0424ff0e1d8b158c | 7.42 | 6 |
#!/usr/bin/env python3
import copy
import json
from datetime import datetime
from typing import Any, Dict, List, Optional
import numpy as np
from mpi4py import MPI
def set_experiment_info(experiment_setup: Dict[str, Any]) -> Dict[str, Any]:
experiment: Dict[str, Any] = {}
now = datetime.now()
dt_string ... | NOAA-GFDL/pyFV3 | examples/standalone/runfile/timing.py | .py | 17ce864bac9c83d8 | 7.42 | 6 |
import math
from dataclasses import fields
from types import SimpleNamespace
import numpy as np
import ndsl.constants as constants
from ndsl.comm.communicator import Communicator
from ndsl.dsl.typing import Float
from ndsl.grid.eta import SURFACE_PRESSURE, compute_eta, vertical_coordinate
from ndsl.grid.gnomonic impo... | NOAA-GFDL/pyFV3 | pyfv3/initialization/init_utils.py | .py | 9b5dbd439c3d8248 | 7.42 | 6 |
import numpy as np
import ndsl.constants as constants
import ndsl.dsl.gt4py_utils as utils
from ndsl import CubedSphereCommunicator, QuantityFactory
from ndsl.dsl.typing import Float
from ndsl.grid import GridData
from ndsl.grid.gnomonic import great_circle_distance_lon_lat, lon_lat_midpoint
from pyfv3.dycore_state im... | NOAA-GFDL/pyFV3 | pyfv3/initialization/test_cases/initialize_baroclinic.py | .py | 36dbb68839dc1974 | 7.92 | 6 |
"""Test case initialization for Rossby-Haurwitz wave 4
Corresponds to Fortran shallow-water test #6 found in tools/test_cases.F90 of
https://github.com/NOAA-GFDL/GFDL_atmos_cubed_sphere.git
"""
from types import SimpleNamespace
import numpy as np
from ndsl import CubedSphereCommunicator, QuantityFactory, constants
... | NOAA-GFDL/pyFV3 | pyfv3/initialization/test_cases/initialize_rossby.py | .py | 6df47cfa8b0ec83c | 7.92 | 6 |
from typing import Optional
import dace
from ndsl import NDSLRuntime, Quantity, QuantityFactory, StencilFactory
from ndsl.constants import I_DIM, I_INTERFACE_DIM, J_DIM, J_INTERFACE_DIM, K_DIM
from ndsl.dsl.gt4py import PARALLEL, computation
from ndsl.dsl.gt4py import function as gtfunction
from ndsl.dsl.gt4py import... | NOAA-GFDL/pyFV3 | pyfv3/stencils/delnflux.py | .py | deab4759d3611d8d | 7.42 | 6 |
import typing
from ndsl import NDSLRuntime, StencilFactory
from ndsl.constants import I_DIM, J_DIM, K_DIM
from ndsl.dsl.gt4py import BACKWARD, FORWARD, PARALLEL, computation, interval, max, min
from ndsl.dsl.typing import FloatField, FloatFieldIJ, IntFieldIJ
from pyfv3.tracers import FVTracers
@typing.no_type_check
... | NOAA-GFDL/pyFV3 | pyfv3/stencils/fillz.py | .py | 01ce7c9dc812ef41 | 7.42 | 6 |
from ndsl import QuantityFactory, StencilFactory, orchestrate
from ndsl.constants import I_DIM, J_DIM, K_DIM
from ndsl.dsl.gt4py import PARALLEL, computation
from ndsl.dsl.gt4py import function as gtfunction
from ndsl.dsl.gt4py import horizontal, interval, region
from ndsl.dsl.typing import Float, FloatField, FloatFiel... | NOAA-GFDL/pyFV3 | pyfv3/stencils/fvtp2d.py | .py | 7e536c70dba35b67 | 7.42 | 6 |
from typing import Optional
from ndsl import NDSLRuntime, QuantityFactory, StencilFactory
from ndsl.constants import I_DIM, J_DIM, K_DIM
from ndsl.dsl.gt4py import FORWARD, PARALLEL, computation, interval
from ndsl.dsl.typing import Float, FloatField, FloatFieldIJ, Int, IntFieldIJ
from ndsl.stencils import copy
from p... | NOAA-GFDL/pyFV3 | pyfv3/stencils/map_single.py | .py | 543f4169ad0f72ef | 7.42 | 6 |
from ndsl import NDSLRuntime, QuantityFactory, StencilFactory
from ndsl.constants import I_DIM, J_DIM, K_DIM
from ndsl.dsl.typing import FloatField
from pyfv3.stencils.fillz import FillNegativeTracerValues
from pyfv3.stencils.map_single import MapSingle
from pyfv3.tracers import FVTracers
class MapNTracer(NDSLRuntime... | NOAA-GFDL/pyFV3 | pyfv3/stencils/mapn_tracer.py | .py | dbbbba15e1ca8d1c | 7.42 | 6 |
import ndsl.constants as constants
from ndsl import QuantityFactory, StencilFactory
from ndsl.constants import I_DIM, J_DIM
from ndsl.dsl.gt4py import BACKWARD, FORWARD, PARALLEL, computation
from ndsl.dsl.gt4py import function as gtfunction
from ndsl.dsl.gt4py import interval
from ndsl.dsl.typing import Float, FloatFi... | NOAA-GFDL/pyFV3 | pyfv3/stencils/neg_adj3.py | .py | 5dcdea751661e6ff | 7.42 | 6 |
import numpy as np
from ndsl import QuantityFactory, StencilFactory, orchestrate
from ndsl.constants import I_DIM, J_DIM, K_INTERFACE_DIM
from ndsl.dsl.gt4py import PARALLEL, computation, interval
from ndsl.dsl.typing import Float, FloatField, FloatFieldIJ
from ndsl.grid import GridData
from pyfv3.stencils.a2b_ord4 im... | NOAA-GFDL/pyFV3 | pyfv3/stencils/nh_p_grad.py | .py | bd30505c0e779387 | 7.42 | 6 |
from ndsl import QuantityFactory, StencilFactory
from ndsl.constants import I_DIM, J_DIM
from ndsl.dsl.gt4py import FORWARD, computation, horizontal, interval, region
from ndsl.dsl.typing import Float, FloatField, FloatFieldIJ
# TODO merge with pe_halo? reuse partials?
# NOTE: This is different from pyFV3.stencils.pe... | NOAA-GFDL/pyFV3 | pyfv3/stencils/pk3_halo.py | .py | 8bda99fe40c60803 | 7.42 | 6 |
import ndsl.constants as constants
from ndsl import StencilFactory, orchestrate
from ndsl.constants import I_INTERFACE_DIM, J_INTERFACE_DIM, K_DIM
from ndsl.dsl.gt4py import __INLINED, BACKWARD, FORWARD, PARALLEL, computation
from ndsl.dsl.gt4py import function as gtfunction
from ndsl.dsl.gt4py import horizontal, inter... | NOAA-GFDL/pyFV3 | pyfv3/stencils/ray_fast.py | .py | ce06d56c85550d3e | 7.42 | 6 |
import math
import typing
import ndsl.constants as constants
from ndsl import QuantityFactory, StencilFactory, orchestrate
from ndsl.constants import I_DIM, J_DIM, K_DIM, K_INTERFACE_DIM
from ndsl.dsl.gt4py import (
__INLINED,
BACKWARD,
FORWARD,
PARALLEL,
computation,
exp,
interval,
log... | NOAA-GFDL/pyFV3 | pyfv3/stencils/riem_solver3.py | .py | fa472170774cfdf7 | 7.42 | 6 |
import typing
import ndsl.constants as constants
from ndsl import QuantityFactory, StencilFactory
from ndsl.constants import I_DIM, J_DIM, K_DIM, K_INTERFACE_DIM
from ndsl.dsl.gt4py import BACKWARD, FORWARD, PARALLEL, computation, interval, log
from ndsl.dsl.typing import Float, FloatField, FloatFieldIJ
from pyfv3.ste... | NOAA-GFDL/pyFV3 | pyfv3/stencils/riem_solver_c.py | .py | ccf2a9379d1b9796 | 7.42 | 6 |
import typing
import ndsl.constants as constants
from ndsl import StencilFactory
from ndsl.constants import I_DIM, J_DIM, K_INTERFACE_DIM
from ndsl.dsl.gt4py import BACKWARD, FORWARD, PARALLEL, computation, exp, interval, log
from ndsl.dsl.typing import Float, FloatField, FloatFieldIJ
@typing.no_type_check
def sim1_... | NOAA-GFDL/pyFV3 | pyfv3/stencils/sim1_solver.py | .py | 19c83197819e63ae | 7.42 | 6 |
import math
from ndsl import NDSLRuntime, QuantityFactory, StencilFactory, WrappedHaloUpdater
from ndsl.constants import (
I_DIM,
I_INTERFACE_DIM,
J_DIM,
J_INTERFACE_DIM,
K_DIM,
N_HALO_DEFAULT,
)
from ndsl.dsl.gt4py import PARALLEL, computation
from ndsl.dsl.gt4py import function as gtfunction
... | NOAA-GFDL/pyFV3 | pyfv3/stencils/tracer_2d_1l.py | .py | e6b893646d6f4f83 | 7.42 | 6 |
import ndsl.constants as constants
from ndsl import Quantity, QuantityFactory, StencilFactory
from ndsl.constants import I_DIM, J_DIM, K_DIM
from ndsl.dsl.gt4py import BACKWARD, FORWARD, PARALLEL, computation
from ndsl.dsl.gt4py import function as gtfunction
from ndsl.dsl.gt4py import interval
from ndsl.dsl.typing impo... | NOAA-GFDL/pyFV3 | pyfv3/stencils/updatedzc.py | .py | 935ace5cb30a2df9 | 7.42 | 6 |
import ndsl.constants as constants
from ndsl import Quantity, QuantityFactory, StencilFactory, orchestrate
from ndsl.constants import (
I_DIM,
I_INTERFACE_DIM,
J_DIM,
J_INTERFACE_DIM,
K_DIM,
K_INTERFACE_DIM,
)
from ndsl.dsl.gt4py import BACKWARD, FORWARD, PARALLEL, computation
from ndsl.dsl.gt4p... | NOAA-GFDL/pyFV3 | pyfv3/stencils/updatedzd.py | .py | d66638b45b0b6efd | 7.42 | 6 |
import os
from typing import Callable, Optional
import worker_threads
from dynaface.const import Pose
from PyQt6.QtCore import QSize, Qt
from PyQt6.QtGui import QIcon
from PyQt6.QtWidgets import (
QApplication,
QButtonGroup,
QDialog,
QFileDialog,
QHBoxLayout,
QLabel,
QMessageBox,
QPushB... | jeffheaton/dynaface | dynaface-app/dlg_modal.py | .py | c94b9d4a0a4739a0 | 7.63 | 17 |
# Load ONYX before anything else, to prevent DLL errors
import onnxruntime as ort
# Begin logging ASAP
from jth_ui import app_const, utl_log
app_const.BUNDLE_ID = "com.heatonresearch.dynaface"
app_const.APP_NAME = "Dynaface"
app_const.APP_AUTHOR = "Jeff Heaton"
app_const.COPYRIGHT = "Copyright 2026 by Jeff Heaton, re... | jeffheaton/dynaface | dynaface-app/dynaface_app.py | .py | a31276f73d81bb33 | 7.63 | 17 |
import logging
import os
import webbrowser
import tab_splash
from jth_ui import app_jth
from jth_ui.window_jth import MainWindowJTH
from PyQt6.QtCore import QTimer
from PyQt6.QtGui import QAction, QKeySequence
from PyQt6.QtWidgets import QMenu, QMenuBar, QTabWidget
from jth_ui import app_const, utl_env, utl_log
logge... | jeffheaton/dynaface | dynaface-app/dynaface_window.py | .py | 8cc2aca7ce489c25 | 7.63 | 17 |
import datetime
import glob
import json
import logging
import logging.handlers
import os
import platform
import plistlib
import shutil
import sys
import appdirs
import pkg_resources
from PyQt6.QtCore import QEvent, Qt, QtMsgType, QUrl, qInstallMessageHandler
from PyQt6.QtGui import QDesktopServices, QFileOpenEvent
fro... | jeffheaton/dynaface | dynaface-app/jth_ui/app_jth.py | .py | 746df7122f43419d | 7.63 | 17 |
import logging
import numpy as np
from PyQt6.QtCore import QDateTime, Qt, QTimer
from PyQt6.QtGui import QColor, QFont, QFontMetrics, QImage, QPainter, QPixmap
from PyQt6.QtWidgets import QGraphicsScene, QGraphicsView, QVBoxLayout, QWidget
from jth_ui.overlay import OverlayGraphicsView
logger = logging.getLogger(__na... | jeffheaton/dynaface | dynaface-app/jth_ui/tab_graphic.py | .py | c15bf0bb59f1ed64 | 7.63 | 17 |
import importlib
def get_class_full_name(instance):
"""Returns the full name of the class of the given instance."""
return instance.__class__.__module__ + "." + instance.__class__.__name__
def create_instance_from_full_name(full_name):
"""Creates an instance of the class with the given full name."""
... | jeffheaton/dynaface | dynaface-app/jth_ui/utl_classes.py | .py | 633d7640df5b7b2e | 7.63 | 17 |
import datetime
import glob
import logging
import logging.handlers
import os
import sys
import appdirs
from jth_ui import app_const, utl_env
from PyQt6.QtCore import QUrl
from PyQt6.QtGui import QDesktopServices
_console_handler = None
_file_handler = None
_LOG_FORMAT = "%(asctime)s - %(levelname)s - %(name)s - %(mes... | jeffheaton/dynaface | dynaface-app/jth_ui/utl_log.py | .py | ee0f51634787692c | 7.63 | 17 |
import sys
from dynaface.facial import Pose
from PyQt6.QtGui import QClipboard, QImage, QPixmap
from PyQt6.QtWidgets import QApplication
import dynaface
def opencv_img_to_qimage(opencv_img):
# Convert from BGR to RGB
# rgb_image = cv2.cvtColor(opencv_img, cv2.COLOR_BGR2RGB)
# Create a QImage from the R... | jeffheaton/dynaface | dynaface-app/utl_gfx.py | .py | 14108cb392045f26 | 7.63 | 17 |
import logging
import time
from collections import deque
from typing import Callable
import cv2
from jth_ui import utl_etc
from PyQt6.QtCore import QThread, pyqtSignal
from PyQt6.QtWidgets import QApplication
from dynaface import facial, measures, util
logger = logging.getLogger(__name__)
BATCH_SIZE = 10
class Wo... | jeffheaton/dynaface | dynaface-app/worker_threads.py | .py | 492c15ffc0bc9cc8 | 7.63 | 17 |
"""Deterministic, first-principles image resampling.
A faithful port of the .NET dynaface port's ``facial_dll/ImageUtils.cs``
(``ResizeBilinear`` / ``WarpAffine`` / ``InvertAffine``), used to replace the
OpenCV calls on the *measurement-affecting* preprocessing path
(``dynaface_onnx.py``: the BlazeFace/SPIGA/U-2-Net i... | jeffheaton/dynaface | dynaface-lib-python/dynaface/resample.py | .py | 5c61080de6a1d50c | 7.63 | 17 |
import argparse
import os
import re
import shutil
import pathlib
import yaml
import markdown
from collections import namedtuple
import urllib.parse
import urllib.request
from jinja2 import Environment, FileSystemLoader
class Filters:
@classmethod
def join_paths(cls, a, b):
a = pathlib.Path(a)
... | GoogleChrome/chromerootprogram | src/generate.py | .py | 757def0af765e72f | 7.63 | 17 |
# %%
from ichingpy.divination.base import DivinationEngineBase
from ichingpy.enum import HeavenlyStem
from ichingpy.enum.branch import EarthlyBranch
from ichingpy.enum.palace import Palace
from ichingpy.enum.role import HexagramRole
from ichingpy.enum.six_relative import SixRelative
from ichingpy.enum.six_spirit import... | JinyangWang27/ichingpy | src/ichingpy/divination/six_lines.py | .py | ed67e4717bc95e29 | 7.54 | 11 |
from typing import Self
from ichingpy.enum.five_phase import FivePhase
from ichingpy.enum.mixed_enum import MixEnum
COMBINATION_MAPPING: dict[str, str] = {
"Zi": "Chou", "Chou": "Zi",
"Yin": "Hai", "Hai": "Yin",
"Mao": "Xu", "Xu": "Mao",
"Chen": "You", "You": "Chen",
"Si": "Shen", "Shen": "Si",
... | JinyangWang27/ichingpy | src/ichingpy/enum/branch.py | .py | 78abf6d5edf6c3d8 | 7.54 | 11 |
from __future__ import annotations
from ichingpy.enum.mixed_enum import MixEnum
# Class-level mapping for "generates", Enum does not allow for ClassVar...
GENERATE_MAPPING: dict[str, str] = {
"WOOD": "FIRE",
"FIRE": "EARTH",
"EARTH": "METAL",
"METAL": "WATER",
"WATER": "WOOD",
}
OVERCOME_MAPPING... | JinyangWang27/ichingpy | src/ichingpy/enum/five_phase.py | .py | 61691ca346c14562 | 7.54 | 11 |
from enum import Enum
class LineStatus(Enum):
"""An Enum representing the status of a line in a hexagram.
Attributes:
CHANGING_YANG (int): A solid line that is changing to a broken line.
STATIC_YIN (int): A static broken line, representing dark, feminine, etc.
STATIC_YANG (int): A sta... | JinyangWang27/ichingpy | src/ichingpy/enum/line_status.py | .py | c0e3d1df28dc81b0 | 7.54 | 11 |
from enum import Enum
class MixEnum(Enum):
def __new__(cls, value: int, label: str):
"""Create a new Enum member.
Args:
value (int): The integer value of the Enum member.
label (str): The string label for the Enum member.
Returns:
obj: A new instance o... | JinyangWang27/ichingpy | src/ichingpy/enum/mixed_enum.py | .py | bc3cefa36ba774ed | 7.54 | 11 |
from typing import Self
from ichingpy.enum.mixed_enum import MixEnum
class HeavenlyStem(MixEnum):
"""The HeavenlyStem (天干) Enum class."""
Jia = 1, "甲"
Yi = 2, "乙"
Bing = 3, "丙"
Ding = 4, "丁"
Wu = 5, "戊"
Ji = 6, "己"
Geng = 7, "庚"
Xin = 8, "辛"
Ren = 9, "壬"
Gui = 10, "癸"
... | JinyangWang27/ichingpy | src/ichingpy/enum/stem.py | .py | f581418af8abd5cf | 7.54 | 11 |
from datetime import datetime
from typing import Self
from ichingpy.enum.branch import EarthlyBranch
from ichingpy.enum.stem import HeavenlyStem
from ichingpy.model.sexagenary_cycle import SexagenaryCycle
class FourPillars:
"""Four Pillars of Destiny (BaZi) model."""
def __init__(self, year: SexagenaryCycle... | JinyangWang27/ichingpy | src/ichingpy/model/four_pillars.py | .py | 342148c615329268 | 7.54 | 11 |
import random
from datetime import datetime
from functools import cached_property
from typing import Self
from pydantic import BaseModel
from ichingpy.enum.line_status import LineStatus
from ichingpy.model.four_pillars import FourPillars
from ichingpy.model.interpretation.hexagram.base import HexagramInterpretationBa... | JinyangWang27/ichingpy | src/ichingpy/model/hexagram.py | .py | b72fd0691af4368f | 7.54 | 11 |
from ichingpy.enum.palace import Palace
from ichingpy.model.interpretation.hexagram.base import HexagramInterpretationBase
from ichingpy.model.interpretation.line.six_line_line import SixLineLineInterp
from ichingpy.model.interpretation.trigram.six_line_trigram import SixLineTrigramInterp
class SixLineHexagramInterp(... | JinyangWang27/ichingpy | src/ichingpy/model/interpretation/hexagram/six_line_hexagram.py | .py | 51f2849d82611b1e | 7.54 | 11 |
from typing import ClassVar
from ichingpy.enum.language import Language
from ichingpy.enum.line_status import LineStatus
from ichingpy.model.interpretation.base import InterpretationBase
class LineInterpretationBase(InterpretationBase):
display_language: ClassVar[Language] = Language.CHINESE
status: LineStat... | JinyangWang27/ichingpy | src/ichingpy/model/interpretation/line/base.py | .py | e5fa4cb118ad0ea8 | 7.54 | 11 |
from ichingpy.enum.branch import EarthlyBranch
from ichingpy.enum.language import Language
from ichingpy.enum.role import HexagramRole
from ichingpy.enum.six_relative import SixRelative
from ichingpy.enum.six_spirit import SixSpirit
from ichingpy.enum.stem import HeavenlyStem
from ichingpy.model.interpretation.line.bas... | JinyangWang27/ichingpy | src/ichingpy/model/interpretation/line/six_line_line.py | .py | e3dccc1dcc2eef4b | 7.54 | 11 |
import random
from typing import Self
from pydantic import BaseModel
from ichingpy.enum import LineStatus
from ichingpy.model.interpretation.line.base import LineInterpretationBase
class LineTransformationError(Exception):
pass
class Line(BaseModel):
"""A Line (爻) of a trigram or a hexagram in the I Ching... | JinyangWang27/ichingpy | src/ichingpy/model/line.py | .py | b8660da5122963ca | 7.54 | 11 |
# %%
from functools import cached_property
from typing import ClassVar, Self
from pydantic import BaseModel, field_validator
from ichingpy.enum import LineStatus
from ichingpy.model.interpretation.line.base import LineInterpretationBase
from ichingpy.model.interpretation.trigram.base import TrigramInterpretationBase
... | JinyangWang27/ichingpy | src/ichingpy/model/trigram.py | .py | d7aa7ba9974e2fc7 | 7.54 | 11 |
#!/usr/bin/env python3
"""downgrade-advisory.py -- Convert a security advisory into a public bug report
Fetches a repository security advisory by GHSA ID, scrubs reporter
identity and sensitive metadata, and creates a public GitHub issue
with the technical description preserved.
This is a "downgrade" operation: the m... | open-telemetry/sig-security | tools/downgrade-advisory.py | .py | 519db91b21b0aef9 | 7.62 | 16 |
# (c) 2025 ANSYS, Inc. Unauthorized use, distribution, or duplication is prohibited.
"""Module to handle file transfer to a server.
This module allows to transfer files to and from a server
Examples
--------
>>> from ansys.api.speos import grpc_stub
>>> import ansys.api.speos.file.v1.file_transfer_pb2_grpc as file_tr... | ansys/ansys-api-speos | src/ansys/api/speos/file/v1/file_transfer.py | .py | 6c611f04bdb8a1d7 | 7.45 | 7 |
#!/usr/bin/env python3
# Copied from https://github.com/rerun-io/rerun_template
"""
Summarizes recent PRs based on their GitHub labels.
The result can be copy-pasted into CHANGELOG.md,
though it often needs some manual editing too.
"""
from __future__ import annotations
import argparse
import multiprocessing
import... | rerun-io/rerun_template | scripts/generate_changelog.py | .py | b9dcdb30b5d8fba3 | 7.56 | 12 |
#!/usr/bin/env python3
# Copied from https://github.com/rerun-io/rerun_template
"""
The script has two purposes.
After using `rerun_template` as a template, run this to clean out things you don't need.
Use `scripts/template_update.py init --languages cpp,rust,python` for this.
Update an existing repository with the ... | rerun-io/rerun_template | scripts/template_update.py | .py | 679546358ceee1c0 | 7.56 | 12 |
"""DuckDB-on-top query layer: answers hashtag stats from the published hashtag_changeset artifact (history)
plus the recent tail derived on the fly from the base Postgres tables, so the API matches the CLI. No
materialized recent rollup; the split frontier is re-read on a TTL so a newly published month needs no restart... | osgeonepal/osmsg | api/duck.py | .py | be844184b9c76f24 | 7.48 | 8 |
"""Hashtag endpoints, served DuckDB-on-top (published hashtag_changeset artifact for history + recent tail
from the base Postgres tables). The path hashtag is comma-separated for multiple prefixes, the union
deduped by changeset; an optional half-open [start, end) window narrows any endpoint, omit both for all-time.
""... | osgeonepal/osmsg | api/routers/hashtag.py | .py | 0544924b2998e5fb | 7.48 | 8 |
"""Shared `requests.Session` with a retry policy and connect/read timeouts, so every osmsg HTTP call is
consistent. A per-request `timeout=` still wins.
"""
from __future__ import annotations
import requests
from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry
USER_AGENT = "osmsg"
DEFAULT_T... | osgeonepal/osmsg | osmsg/_http.py | .py | de3fcd3b3f526d7b | 7.48 | 8 |
"""Worker tick: bootstrap on first run, --update thereafter."""
import fcntl
import os
import shlex
import subprocess
import sys
from pathlib import Path
import duckdb
from .db import connect, create_tables, get_state, upsert_state
from .geofabrik import country_update_url
from .replication import resolve_url
def ... | osgeonepal/osmsg | osmsg/_tick.py | .py | fc41430733eb5a13 | 7.48 | 8 |
"""Typed exceptions for library callers. The CLI catches these and translates to exit codes; library users
catch them where they integrate the pipeline.
"""
from __future__ import annotations
class OsmsgError(Exception):
"""Base for every error osmsg raises at API boundaries."""
class UnknownRegionError(OsmsgE... | osgeonepal/osmsg | osmsg/exceptions.py | .py | 6f61022b6498a936 | 7.48 | 8 |
"""PostgreSQL exporter via DuckDB's postgres extension."""
import duckdb
from ..exceptions import OsmsgError
from ..pg_schema import PG_SCHEMA, PG_TAG_TYPE_SQL
_BULK_INDEXES = [
("idx_changesets_created_at", "CREATE INDEX idx_changesets_created_at ON changesets USING BTREE (created_at)"),
(
"idx_chan... | osgeonepal/osmsg | osmsg/export/psql.py | .py | 9a0a08515c331426 | 7.48 | 8 |
"""Download + decompress OSM replication files. Cache-friendly: skips downloads
when the decompressed file is already on disk."""
from __future__ import annotations
import gzip
import os
import shutil
from pathlib import Path
from ._http import session
DEFAULT_CACHE_DIR = Path("temp")
def file_path_for(url: str, ... | osgeonepal/osmsg | osmsg/fetch.py | .py | fe1998da9e847023 | 7.48 | 8 |
"""Live region lookup via Geofabrik index-v1.json."""
from __future__ import annotations
from functools import lru_cache
from typing import Any
from shapely.geometry import MultiPolygon, Polygon, shape
from ._http import session
from .exceptions import UnknownRegionError
INDEX_URL = "https://download.geofabrik.de/... | osgeonepal/osmsg | osmsg/geofabrik.py | .py | 7711df0e2bde571c | 7.48 | 8 |
"""osmium SimpleHandler subclasses driving the in-memory accumulators."""
from __future__ import annotations
import datetime as dt
import re
from typing import Any
import osmium
import osmium.geom
from shapely import wkt as shapely_wkt
from shapely.geometry import box
from .models import Action, Changeset, Changese... | osgeonepal/osmsg | osmsg/handlers.py | .py | 9df5605a9bc11122 | 7.48 | 8 |
"""`osmsg maintain` sub-app: generate, convert, and publish the history parquet datasets."""
import datetime as dt
from pathlib import Path
from typing import Annotated
import typer
from ..ui import console, error, info
UTC = dt.UTC
maintain_app = typer.Typer(add_completion=False, help="Generate and publish the his... | osgeonepal/osmsg | osmsg/maintain/cli.py | .py | 684d7535c4aff72f | 7.48 | 8 |
"""Read, write, and advance the dataset manifest.json (the covered month range) that drives osmsg's
hybrid history read."""
import json
import pathlib
import subprocess
import tempfile
import requests
SCHEMA_VERSION = 1
def covered_months(out_dir: pathlib.Path) -> list[tuple[int, int]]:
"""Sorted (year, month)... | osgeonepal/osmsg | osmsg/maintain/manifest.py | .py | e07d8b6bcec881cc | 7.48 | 8 |
"""Pull the newest published rollup into a deployment's local history artifact so its frontier advances
to the latest month without a rebuild. Download and verify into a scratch dir, then swap atomically:
the parquet files first and the manifest last, so a query never sees an advanced frontier without the
data behind i... | osgeonepal/osmsg | osmsg/maintain/refresh.py | .py | 9c592836044f9482 | 7.48 | 8 |
"""Per-user rollups so the API can serve any window, hashtag, or tag query from small precomputed
aggregates instead of scanning the full history. Built for each finished month by `maintain month`.
See docs/rollups.md."""
import pathlib
import duckdb
from ..db.schema import _apply_runtime_pragmas
from ..exceptions i... | osgeonepal/osmsg | osmsg/maintain/rollup.py | .py | b0c6a36b2ba38c3b | 7.48 | 8 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.