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 |
|---|---|---|---|---|---|---|
"""Falcon example application."""
import falcon
class HelloResource:
"""Resource for Falcon application."""
def on_get(self, req: falcon.Request, resp: falcon.Response) -> None: # ruff:ignore[no-self-use]
"""Handle GET request."""
resp.media = {"message": "Hello falcon"}
app = falcon.App(... | hasansezertasan/a2wsgi-examples | src/app/applications/falcon/app.py | .py | 7da79619b5b4ada0 | 7.04 | 11 |
"""webapp2 sub-application mounted via WSGIMiddleware."""
import json
from collections.abc import Callable
try:
import webapp2
except ImportError: # pragma: no cover - optional dependency
webapp2 = None
if webapp2 is not None:
class HelloHandler(webapp2.RequestHandler): # type: ignore[misc]
"... | hasansezertasan/a2wsgi-examples | src/app/applications/webapp2/app.py | .py | 62d9a3c8278fc6ba | 7.54 | 11 |
"""Tests for the application."""
from __future__ import annotations
import pytest
from fastapi import status
from fastapi.testclient import TestClient
from app.main import app
@pytest.fixture(scope="module")
def client() -> TestClient:
"""Create a test client for the application.
Returns:
TestClie... | hasansezertasan/a2wsgi-examples | tests/test_main.py | .py | fbbbb04ba5cd5ab2 | 8.04 | 11 |
# Generated by Django 4.2.2 on 2023-06-14 18:48
"""
This migration loads the languagefamilies.json and languages.json fixtures.
First, it updates the Language and LanguageFamily schemas to allow null
created/last_modified dates. Then it loads the fixtures. Then it populates
the created/last_modified dates to the curren... | First-Peoples-Cultural-Council/fv-be | firstvoices/backend/migrations/0004_load_languagefamily_language_data.py | .py | aa47d39c0ed15772 | 7.5 | 9 |
# Copyright 2026 S&P Global Energy (previously S&P Global Commodity Insights)
#
# 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 r... | spgi-ci/spgci-python | spgci/api_client.py | .py | d757e1de0c8cbd7a | 7.52 | 10 |
# Copyright 2026 S&P Global Energy (previously S&P Global Commodity Insights)
# 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 requ... | spgi-ci/spgci-python | spgci/config.py | .py | fc70b23cc75edc63 | 7.52 | 10 |
# Copyright 2026 S&P Global Energy (previously S&P Global Commodity Insights)
# 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 requ... | spgi-ci/spgci-python | spgci/crude_supply_risk.py | .py | 2046b5943cff3e04 | 7.52 | 10 |
# Copyright 2026 S&P Global Energy (previously S&P Global Commodity Insights)
# 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 requ... | spgi-ci/spgci-python | spgci/eu_power.py | .py | 6fcdff0e764404e7 | 7.52 | 10 |
# Copyright 2026 S&P Global Energy (previously S&P Global Commodity Insights)
# 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 requ... | spgi-ci/spgci-python | spgci/ewindow_md.py | .py | 5b222f9ac55a7855 | 7.52 | 10 |
# Copyright 2026 S&P Global Energy (previously S&P Global Commodity Insights)
# 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 requ... | spgi-ci/spgci-python | spgci/forward_curves.py | .py | 5cbbf4cb1ae21c2c | 7.52 | 10 |
# Copyright 2026 S&P Global Energy (previously S&P Global Commodity Insights)
# 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 requ... | spgi-ci/spgci-python | spgci/na_gas.py | .py | c05b0e484d91d46b | 7.52 | 10 |
# Copyright 2026 S&P Global Energy (previously S&P Global Commodity Insights)
# 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 requ... | spgi-ci/spgci-python | spgci/smart_heards.py | .py | b91af0f9cd19d168 | 7.52 | 10 |
# Copyright 2026 S&P Global Energy (previously S&P Global Commodity Insights)
# 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 requ... | spgi-ci/spgci-python | spgci/structured_heards.py | .py | e7b8d8b217dcaa26 | 7.52 | 10 |
# Copyright 2026 S&P Global Energy (previously S&P Global Commodity Insights)
# 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 requ... | spgi-ci/spgci-python | spgci/utilities.py | .py | 8cf43956a2c959e7 | 7.52 | 10 |
# Copyright 2023 S&P Global Commodity Insights
# 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 agree... | spgi-ci/spgci-python | tests/test_arbflow.py | .py | f5d16674634bb12f | 7.02 | 10 |
# Copyright 2023 S&P Global Commodity Insights
# 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 agree... | spgi-ci/spgci-python | tests/test_auth.py | .py | 4986a36067c1bf9b | 7.02 | 10 |
# Copyright 2023 S&P Global Commodity Insights
# 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 agree... | spgi-ci/spgci-python | tests/test_client.py | .py | f898dccefe64947d | 7.02 | 10 |
# Copyright 2023 S&P Global Commodity Insights
# 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 agree... | spgi-ci/spgci-python | tests/test_giem.py | .py | ee9b746a9c2b2387 | 7.02 | 10 |
# Copyright 2023 S&P Global Commodity Insights
# 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 agree... | spgi-ci/spgci-python | tests/test_mdd.py | .py | 8be0a8e8dd4ff2f4 | 7.02 | 10 |
# Copyright 2023 S&P Global Commodity Insights
# 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 agree... | spgi-ci/spgci-python | tests/test_na_gas.py | .py | 3e023884c322d954 | 7.02 | 10 |
# Copyright 2023 S&P Global Commodity Insights
# 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 agree... | spgi-ci/spgci-python | tests/test_od.py | .py | ab36e50c75507002 | 7.02 | 10 |
# Copyright 2023 S&P Global Commodity Insights
# 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 agree... | spgi-ci/spgci-python | tests/test_symbols.py | .py | 5e5364ece5308bfa | 7.02 | 10 |
# NOTE: do not add `from __future__ import annotations` to this file. hatchling
# execs this module without registering it in sys.modules, so PEP 563 string
# annotations make dataclasses resolve CopyConfig's ClassVar/KW_ONLY markers via
# `sys.modules.get(cls.__module__).__dict__`, which is None here. That crashes the... | aws-deadline/deadline-cloud-test-fixtures | hatch_version_hook.py | .py | 11257932f92ca7e4 | 7.5 | 9 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
from __future__ import annotations
import logging
import os
from typing import Any
from botocore.loaders import Loader
from botocore.model import OperationModel, ServiceModel
LOG = logging.getLogger(__name__)
class DeadlineClient:
"""
A ... | aws-deadline/deadline-cloud-test-fixtures | src/deadline_test_fixtures/deadline/client.py | .py | 289de6535b27db76 | 8 | 9 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
from __future__ import annotations
import dataclasses
from dataclasses import dataclass
from botocore.exceptions import ClientError as OriginalClientError
class ClientError(OriginalClientError):
def __init__(self, errmsg, operation_name):
... | aws-deadline/deadline-cloud-test-fixtures | src/deadline_test_fixtures/deadline/stubs.py | .py | 61d0a49c92022aa2 | 8 | 9 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
"""Child-process entry point for :class:`MockDeadlineServerProcess`."""
from __future__ import annotations
import json
import os
import sys
from .backend import MockDeadlineBackend, start_server
from .process import _SCENARIO_ENV
from .scenario im... | aws-deadline/deadline-cloud-test-fixtures | src/deadline_test_fixtures/deadline_mock/_server_child.py | .py | a255e2baa7e9ae0d | 7 | 9 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
"""Configuration helpers for subprocesses that use the mock service."""
from __future__ import annotations
from collections.abc import Mapping
from pathlib import Path
MOCK_ACCESS_KEY = "testing"
MOCK_SECRET_KEY = "testing"
MOCK_SESSION_TOKEN = "t... | aws-deadline/deadline-cloud-test-fixtures | src/deadline_test_fixtures/deadline_mock/config.py | .py | c657d310240dfbc0 | 8 | 9 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
"""Run the mock Deadline service in an independent Python process."""
from __future__ import annotations
import json
import os
import queue
import subprocess
import sys
import threading
import time
import urllib.request
from typing import Any
from... | aws-deadline/deadline-cloud-test-fixtures | src/deadline_test_fixtures/deadline_mock/process.py | .py | ed38f5f6658e6478 | 8 | 9 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
"""Image assertions shared by DCC render integration tests."""
from __future__ import annotations
import re
from pathlib import Path
import numpy as np
from PIL import Image
def _normalized_name(name: str) -> str:
return re.sub(r"_+", "_", n... | aws-deadline/deadline-cloud-test-fixtures | src/deadline_test_fixtures/images.py | .py | 18a6930a0d8403a1 | 8 | 9 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
from __future__ import annotations
import logging
import os
from dataclasses import InitVar, dataclass, field
from datetime import datetime, timedelta, timezone
from uuid import uuid4
from botocore.client import BaseClient
from botocore.exceptions i... | aws-deadline/deadline-cloud-test-fixtures | src/deadline_test_fixtures/job_attachment_manager.py | .py | 1d78b7e8c74becff | 8 | 9 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
"""Conventional filesystem layout for DCC job-bundle cases."""
from __future__ import annotations
from dataclasses import dataclass
from pathlib import Path
from shutil import rmtree
@dataclass(frozen=True)
class JobBundleCase:
"""A test case... | aws-deadline/deadline-cloud-test-fixtures | src/deadline_test_fixtures/job_bundle/cases.py | .py | f57d9cd9a73f98d8 | 8 | 9 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
"""Structural comparison helpers for OpenJD job bundles."""
from __future__ import annotations
import copy
import json
import re
import subprocess
from collections.abc import Mapping, Sequence
from dataclasses import dataclass, field
from difflib i... | aws-deadline/deadline-cloud-test-fixtures | src/deadline_test_fixtures/job_bundle/compare.py | .py | 2da518e859416ff3 | 8 | 9 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
from __future__ import annotations
import gzip
import json
import os
import re
import tempfile
from abc import ABC, abstractproperty
from collections.abc import Generator
from contextlib import contextmanager
from dataclasses import dataclass
from pa... | aws-deadline/deadline-cloud-test-fixtures | src/deadline_test_fixtures/models.py | .py | 41b2aea95fac382d | 8 | 9 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
from __future__ import annotations
import logging as _logging
import pytest as _pytest
_root_logger = _logging.getLogger()
_log_filters: dict[str, _logging.Filter] = {}
class _PytestIdLoggerFilter(_logging.Filter):
"""Filter that prepends pyt... | aws-deadline/deadline-cloud-test-fixtures | src/deadline_test_fixtures/pytest_hooks.py | .py | 4732b18b83c99558 | 8 | 9 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
from __future__ import annotations
import functools
import logging
from time import sleep
from typing import Any, Callable
import botocore.exceptions
LOG = logging.getLogger(__name__)
def wait_for(
*,
description: str,
predicate: Cal... | aws-deadline/deadline-cloud-test-fixtures | src/deadline_test_fixtures/util.py | .py | 0682fe9462441a2a | 8 | 9 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
"""Cross-platform accessibility application discovery."""
from __future__ import annotations
import time
import xa11y
STARTUP_TIMEOUT = 60.0
def find_accessibility_app(
pid: int,
timeout: float = STARTUP_TIMEOUT,
*,
name_prefix:... | aws-deadline/deadline-cloud-test-fixtures | src/deadline_test_fixtures/xa11y/app.py | .py | 8f248b331f3ee72b | 7 | 9 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
"""Robust cross-platform interactions for common Qt accessibility widgets."""
from __future__ import annotations
import os
import time
from typing import Callable, Union
import xa11y
WIDGET_TIMEOUT = 60.0
TAB_SHARED = "Shared job settings"
TAB_JO... | aws-deadline/deadline-cloud-test-fixtures | src/deadline_test_fixtures/xa11y/controls.py | .py | 41009b1f10e7ff5a | 7 | 9 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
"""Minimal page object for controls shared by Deadline submitter dialogs."""
from __future__ import annotations
import time
from typing import Union
import xa11y
from .controls import is_checked
SubmitterRoot = Union[xa11y.App, xa11y.Locator]
SA... | aws-deadline/deadline-cloud-test-fixtures | src/deadline_test_fixtures/xa11y/submitter.py | .py | b5db06c46a8cc8af | 8 | 9 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
import json
import re
from pathlib import Path
# For distributed open source and proprietary code, we must include a copyright header in source every file:
_copyright_header_re = re.compile(
r"Copyright Amazon\.com, Inc\. or its affiliates\. All... | aws-deadline/deadline-cloud-test-fixtures | test/test_copyright_headers.py | .py | 01c77d380cacef30 | 8 | 9 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
from unittest.mock import MagicMock, patch
import pytest
from deadline_test_fixtures import DeadlineClient
MOCK_FARM_NAME = "test-farm"
MOCK_FLEET_NAME = "test-fleet"
MOCK_QUEUE_NAME = "test-queue"
class TestDeadlineClient:
def test_deadline_... | aws-deadline/deadline-cloud-test-fixtures | test/unit/deadline/test_client.py | .py | 479c5b3dab89ef11 | 7 | 9 |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
from collections.abc import Generator
from datetime import datetime, timedelta, timezone
from unittest.mock import MagicMock, patch
import boto3
import pytest
from botocore.exceptions import ClientError, WaiterError
from moto import mock_aws
from d... | aws-deadline/deadline-cloud-test-fixtures | test/unit/test_job_attachment_manager.py | .py | 6ab69bd6368eda17 | 7 | 9 |
from pytorch3d.ops import (sample_points_from_meshes,
knn_points,
knn_gather,
sample_farthest_points)
from pytorch3d.structures import Meshes
import utils
import numpy as np
import argparse
import pandas as pd
import os
import torch
fr... | ImageMindAnalytics/ShapeAXI | src/shapeaxi/mesh_sampling.py | .py | e42904b65a9119c9 | 7.45 | 7 |
import torch
from torch import nn as nn
import numpy as np
class VarianceSchedule(nn.Module):
def __init__(self, num_steps, beta_1, beta_T, mode='linear'):
super().__init__()
assert mode in ('linear', )
self.num_steps = num_steps
self.beta_1 = beta_1
self.beta_T = beta_T
... | ImageMindAnalytics/ShapeAXI | src/shapeaxi/saxi_diffusion.py | .py | 7d1955d105e1a81e | 7.45 | 7 |
"""Command-line interface for pyquist.
This module is just the argparse dispatch layer. The actual functionality
(playback, recording, device selection) lives in :mod:`pyquist.device`,
and audio loading lives in :mod:`pyquist.audio` / :mod:`pyquist.web`.
"""
import argparse
import numpy as np
from . import __versio... | gclef-cmu/pyquist | pyquist/cli.py | .py | d054a9bc635015a8 | 7.5 | 9 |
import numpy as np
def db_to_amplitude(
db: float | np.ndarray, *, reference: float = 1.0
) -> float | np.ndarray:
"""Converts a decibel level to a linear amplitude.
Decibels are a logarithmic ratio: ``amplitude = reference * 10**(db / 20)``.
With the default ``reference=1.0`` and float audio (where ... | gclef-cmu/pyquist | pyquist/helper.py | .py | 342b879e5238f2c1 | 7.5 | 9 |
"""Plot helpers for ``Audio`` (waveform, magnitude spectrum, spectrogram).
These work the same in a notebook and a regular script. Pass
``output_file=<path>`` to save the figure to disk in addition to (or instead
of) displaying it interactively.
"""
import warnings
from typing import Optional, Tuple
import matplotli... | gclef-cmu/pyquist | pyquist/plot.py | .py | 2b04add56d27a7e8 | 7.5 | 9 |
import unittest
import numpy as np
from .audio import Audio
from .paths import TEST_DATA_DIR
from .score import (
BasicMetronome,
Event,
Metronome,
MIDIMetronome,
Score,
)
_BOLERO_MIDI = TEST_DATA_DIR / "ravel_bolero.mid"
def _const_tone(duration, value, sample_rate=1000, **kwargs) -> Audio:
... | gclef-cmu/pyquist | pyquist/score_test.py | .py | b9bdc3194dd7bae9 | 7 | 9 |
"""End-to-end guard that detection optimisations stay output-preserving.
The detection fast paths (contour pre-filtering, list-mode contour retrieval,
sampling cell centres before colour correction) are only worth keeping if they
decode exactly what the straightforward implementation decoded. These tests pin
the decod... | sjtrny/freelens | tests/test_detection_equivalence.py | .py | aa602c0f27f8855c | 8.09 | 14 |
import jax.numpy as jnp
from jax import lax
from jax.scipy.special import betainc, gammaincc
from jaxtyping import Array, ArrayLike
def t_cdf(value: ArrayLike, df: ArrayLike, loc: ArrayLike = 0.0, scale: ArrayLike = 1.0) -> Array:
r"""Evaluate the cumulative distribution function of Student's t distribution.
... | mancusolab/jaxqtl | src/jaxqtl/distribution/_utils.py | .py | 775186a032059d46 | 7.66 | 20 |
# pattern: Functional Core
from abc import abstractmethod
from typing import NamedTuple
import equinox as eqx
import jax
import jax.numpy as jnp
from jaxtyping import Array, ArrayLike
from ..infer import (
AbstractLinearModel,
AbstractLinearSolve,
AbstractVarianceEstimator,
FisherInfoError,
)
clas... | mancusolab/jaxqtl | src/jaxqtl/hypothesis/_base.py | .py | d1a2872eeaf61412 | 7.66 | 20 |
# pattern: Functional Core
import jax.numpy as jnp
from jax.scipy.stats import norm
from jaxtyping import ArrayLike
from ._base import (
_residualize_genotypes,
_score_from_residuals,
_validate_score_variance_estimator,
AbstractHypothesisTest,
TestResult,
)
class ScoreTest(AbstractHypothesisTes... | mancusolab/jaxqtl | src/jaxqtl/hypothesis/_score.py | .py | 3fa8da8cb7be5a4e | 7.66 | 20 |
# pattern: Functional Core
import jax
import jax.lax as lax
import jax.numpy as jnp
from jaxtyping import ArrayLike
from ..infer import LinearModel
from ._base import _residualize_genotypes, AbstractHypothesisTest, TestResult
class WaldTest(AbstractHypothesisTest):
r"""Wald test for association between a varia... | mancusolab/jaxqtl | src/jaxqtl/hypothesis/_wald.py | .py | 2fa3f572e1dc6025 | 7.66 | 20 |
# pattern: Functional Core
import math
from typing import NamedTuple
import equinox as eqx
import jax.numpy as jnp
from jax import grad, lax
from jax.numpy import linalg as jnla
from jax.scipy import stats as jaxstats
from jax.scipy.special import polygamma
from jaxtyping import Array, ScalarLike
from ..distributi... | mancusolab/jaxqtl | src/jaxqtl/infer/_optimize.py | .py | 4764d760dc761630 | 7.66 | 20 |
# pattern: Imperative Shell
from __future__ import annotations
from dataclasses import dataclass
from typing import Literal
import genoio
import numpy as np
import polars as pl
GenotypeSource = Literal["bfile", "pfile", "vcf", "bgen"]
@dataclass(frozen=True, slots=True)
class GenotypeReadOptions:
r"""Options... | mancusolab/jaxqtl | src/jaxqtl/io/_geno_engine.py | .py | d812c8b719b1c37d | 7.66 | 20 |
# pattern: Functional Core
"""JAX-native expression normalization kernels."""
from typing import Any
import jax
import jax.numpy as jnp
from jax.scipy import stats as jsp_stats
def _as_inexact_array(values: Any) -> jax.Array:
array = jnp.asarray(values)
if not jnp.issubdtype(array.dtype, jnp.inexact):
... | mancusolab/jaxqtl | src/jaxqtl/io/_normalization.py | .py | 6476f9e66a2a9ad3 | 7.66 | 20 |
# pattern: Imperative Shell
from collections.abc import Collection
from dataclasses import dataclass
from functools import partial
from os import PathLike
from typing import Literal
import numpy as np
import polars as pl
import equinox as eqx
import jax
from jax import numpy as jnp
from jaxtyping import Array, PRNG... | mancusolab/jaxqtl | src/jaxqtl/io/_pheno.py | .py | 5614e44978f4dc19 | 7.66 | 20 |
import gzip
import re
from os import PathLike
import polars as pl
def validate_user_columns(user_cols, observed_cols) -> list[str]:
"""Validate user-specified column names or indices against observed columns."""
# drop any duplicates and convert back to list
user_cols = list(set(user_cols))
# user ... | mancusolab/jaxqtl | src/jaxqtl/io/_utils.py | .py | c2b639e9d27385e6 | 7.66 | 20 |
# pattern: Mixed (needs refactoring)
from collections import deque
from collections.abc import Iterator
from dataclasses import dataclass
from typing import Any
import genoio
import numpy as np
import polars as pl
import equinox as eqx
import jax.numpy as jnp
from jaxtyping import Array
from ..io._geno_engine impo... | mancusolab/jaxqtl | src/jaxqtl/map/data.py | .py | dd4928a946fd207d | 7.66 | 20 |
import itertools as itt
from collections.abc import Iterator
from logging import Logger
import numpy as np
import polars as pl
import equinox as eqx
from jax import numpy as jnp
from ..distribution._expfam import NegativeBinomial
from ..hypothesis import AbstractHypothesisTest
from ..log import get_log
from .data ... | mancusolab/jaxqtl | src/jaxqtl/map/trans.py | .py | 145ca303a5b34dc4 | 7.66 | 20 |
# pattern: Imperative Shell
import os
import subprocess
import sys
from pathlib import Path
_X32_WORKER_FLAG = "--_run-nb-x32"
def _run_negative_binomial_x32_case() -> None:
# These imports must stay inside the child worker. Importing JAX while pytest
# collects this module would make the process-global p... | mancusolab/jaxqtl | tests/test_precision_modes.py | .py | b57c8dbdefb2750b | 7.16 | 20 |
# coding:utf-8
import datetime
import codecs
import requests
import os
import time
import html2markdown
import re
from pyquery import PyQuery as pq
def git_add_commit_push(date, filename):
cmd_git_add = 'git add {filename}'.format(filename=filename)
cmd_git_commit = 'git commit -m "{date}"'.format(date=date)... | araguaci/github-trending | backups/scrapers/pre-docs-layout-2026-06-29/scraper_fixed.py | .py | 2078aeb28c2f9bee | 7.62 | 16 |
# coding:utf-8
import datetime
import codecs
import requests
import os
import time
import html2markdown
import re
from pyquery import PyQuery as pq
from dotenv import load_dotenv
def git_add_commit_push(date, filename):
cmd_git_add = 'git add {filename}'.format(filename=filename)
cmd_git_commit = 'git commit ... | araguaci/github-trending | backups/scrapers/pre-docs-layout-2026-06-29/scraper_improved.py | .py | 72f5c09a12ebf55b | 7.62 | 16 |
# coding:utf-8
import datetime
import codecs
import requests
import os
import time
import html2markdown
import re
from pyquery import PyQuery as pq
def git_add_commit_push(date, filename):
cmd_git_add = 'git add {filename}'.format(filename=filename)
cmd_git_commit = 'git commit -m "{date}"'.format(date=date)... | araguaci/github-trending | backups/scrapers/pre-docs-layout-2026-06-29/scraper_with_stars.py | .py | 10e3da2e0ab66f6a | 7.62 | 16 |
# coding:utf-8
from collections import defaultdict
from datetime import datetime
from pathlib import Path
MONTHS = {
'01': 'JAN', '02': 'FEV', '03': 'MAR', '04': 'ABR',
'05': 'MAY', '06': 'JUN', '07': 'JUL', '08': 'AGO',
'09': 'SET', '10': 'OUT', '11': 'NOV', '12': 'DEC',
}
def project_root(base_path=No... | araguaci/github-trending | docs_utils.py | .py | 13fbfc7dc3f8d08f | 7.62 | 16 |
# coding:utf-8
import os
import json
import re
from datetime import datetime, timedelta
from collections import defaultdict, Counter
import requests
from docs_utils import daily_md_path
class GitHubTrendingAnalyzer:
def __init__(self, docs_path="docs"):
self.docs_path = docs_path
self.repos_path ... | araguaci/github-trending | generate_analytics.py | .py | 921a450e63f3e5d6 | 7.62 | 16 |
# coding:utf-8
def generate_enhanced_docsify_config():
"""Gera configuração melhorada para o Docsify"""
config = """<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>GitHub Trending Analytics</title>
<link rel="icon" href="_media/favicon.ico" />
<meta http-equiv="X-... | araguaci/github-trending | generate_docsify_config.py | .py | d27a96b3d7e2088f | 7.62 | 16 |
# coding:utf-8
import datetime
import codecs
import requests
import os
import time
import html2markdown
import re
from pyquery import PyQuery as pq
from docs_utils import daily_md_path, update_year_index
def git_add_commit_push(date, filename):
cmd_git_add = 'git add {filename}'.format(filename=filename)
cm... | araguaci/github-trending | scraper_fixed.py | .py | 6bf30259c6c63d36 | 7.62 | 16 |
# coding:utf-8
import datetime
import codecs
import requests
import os
import time
import html2markdown
import re
from pyquery import PyQuery as pq
from dotenv import load_dotenv
from docs_utils import daily_md_path, update_year_index
def git_add_commit_push(date, filename):
cmd_git_add = 'git add {filename}'.fo... | araguaci/github-trending | scraper_improved.py | .py | 273d739d3ef977c0 | 7.62 | 16 |
# coding:utf-8
import datetime
import codecs
import requests
import os
import time
import html2markdown
import re
from pyquery import PyQuery as pq
from docs_utils import daily_md_path, update_year_index
def git_add_commit_push(date, filename):
cmd_git_add = 'git add {filename}'.format(filename=filename)
cm... | araguaci/github-trending | scraper_with_stars.py | .py | 19f794566e2d3d36 | 7.62 | 16 |
# coding:utf-8
import requests
import os
from datetime import datetime
def test_github_token(token=None):
"""Testa se o token do GitHub está funcionando corretamente"""
if not token:
print("❌ Token não fornecido!")
return False
print("🔍 Testando token do GitHub...")
print(f"... | araguaci/github-trending | test_token.py | .py | f2db2e4afb380a78 | 8.12 | 16 |
# don't import any costly modules
import sys
import os
is_pypy = '__pypy__' in sys.builtin_module_names
def warn_distutils_present():
if 'distutils' not in sys.modules:
return
if is_pypy and sys.version_info < (3, 7):
# PyPy for 3.6 unconditionally imports distutils, so bypass the warning
... | araguaci/github-trending | venv/Lib/site-packages/_distutils_hack/__init__.py | .py | 4d27a48545b57dd1 | 7.62 | 16 |
"""Build Environment used for isolation during sdist building
"""
import logging
import os
import pathlib
import site
import sys
import textwrap
from collections import OrderedDict
from sysconfig import get_paths
from types import TracebackType
from typing import TYPE_CHECKING, Iterable, List, Optional, Set, Tuple, Ty... | araguaci/github-trending | venv/Lib/site-packages/pip/_internal/build_env.py | .py | 804013f11e92b966 | 7.62 | 16 |
"""Cache Management
"""
import hashlib
import json
import logging
import os
from pathlib import Path
from typing import Any, Dict, List, Optional, Set
from pip._vendor.packaging.tags import Tag, interpreter_name, interpreter_version
from pip._vendor.packaging.utils import canonicalize_name
from pip._internal.excepti... | araguaci/github-trending | venv/Lib/site-packages/pip/_internal/cache.py | .py | 0b79fbf159c181af | 7.62 | 16 |
"""Base Command class, and related routines"""
import functools
import logging
import logging.config
import optparse
import os
import sys
import traceback
from optparse import Values
from typing import Any, Callable, List, Optional, Tuple
from pip._vendor.rich import traceback as rich_traceback
from pip._internal.cl... | araguaci/github-trending | venv/Lib/site-packages/pip/_internal/cli/base_command.py | .py | b750f9c78d077e7f | 7.62 | 16 |
import os
import textwrap
from optparse import Values
from typing import Any, List
import pip._internal.utils.filesystem as filesystem
from pip._internal.cli.base_command import Command
from pip._internal.cli.status_codes import ERROR, SUCCESS
from pip._internal.exceptions import CommandError, PipError
from pip._inter... | araguaci/github-trending | venv/Lib/site-packages/pip/_internal/commands/cache.py | .py | 9ae693d266cbf995 | 7.62 | 16 |
import sys
import textwrap
from optparse import Values
from typing import List
from pip._internal.cli.base_command import Command
from pip._internal.cli.status_codes import SUCCESS
from pip._internal.utils.misc import get_prog
BASE_COMPLETION = """
# pip {shell} completion start{script}# pip {shell} completion end
""... | araguaci/github-trending | venv/Lib/site-packages/pip/_internal/commands/completion.py | .py | 1f44c9bc6addb289 | 7.62 | 16 |
import importlib.resources
import locale
import logging
import os
import sys
from optparse import Values
from types import ModuleType
from typing import Any, Dict, List, Optional
import pip._vendor
from pip._vendor.certifi import where
from pip._vendor.packaging.version import parse as parse_version
from pip._interna... | araguaci/github-trending | venv/Lib/site-packages/pip/_internal/commands/debug.py | .py | 9158e7f8ed62c4b9 | 7.62 | 16 |
"""Convenience functions to help locate sources"""
import warnings
from typing import Optional, Union
import numpy as np
import pandas as pd
from astropy.coordinates import SkyCoord
from astropy.table import Table
from astropy.time import Time
from tqdm import tqdm
from tesswcs import WCS, log, pointings
from .util... | tessgi/tesswcs | src/tesswcs/locate.py | .py | 88c5901fb54a9827 | 7.63 | 17 |
"""Work with WCS objects for TESS"""
import astropy.units as u
import numpy as np
from astropy.coordinates import SkyCoord
from astropy.io import fits
from astropy.wcs import WCS as astropyWCS
from astropy.wcs import Sip
from . import log, pixel_corners, pointings, rcolumns, rrows # noqa: E402
from .utils import (
... | tessgi/tesswcs | src/tesswcs/tesswcs.py | .py | 3a573ad39bf66a96 | 7.63 | 17 |
"""Retention engine — Ebbinghaus decay scoring, tiering, and grace-period eviction.
Embedding-free. Operates on registry records (see registry.py). The retention
score decays with age and is boosted by reinforcements; a record is evicted only
after remaining below the cold tier for the grace period.
Spec: docs/design... | rbelem/devbox-global | dotfiles/dot_agents/skills/autolearn-reviewer/scripts/retention.py | .py | d32fde025f3af1c6 | 7.48 | 8 |
"""Autolearn sync crypto primitives.
Implements the E2E-encryption layer described in
docs/designs/sync/encryption-LLD.md:
Master Password
|
v
PBKDF2-SHA256 (600,000 iterations, per-installation random salt)
|
v
master_key (256 bits) -- stored in OS keychain
|
+--... | rbelem/devbox-global | dotfiles/dot_agents/skills/autolearn-reviewer/scripts/sync_crypto.py | .py | 5f283e888fd3001e | 7.48 | 8 |
# /// script
# dependencies = ["pytest", "python-slugify"]
# ///
"""Tests for registry.py — run via `uv run pytest test_registry.py -q`."""
import json
from pathlib import Path
import pytest
import registry as R
def persona(tmp_path: Path) -> Path:
p = tmp_path / "default"
p.mkdir()
return p
def test_... | rbelem/devbox-global | dotfiles/dot_agents/skills/autolearn-reviewer/scripts/test_registry.py | .py | 3870a9ee63822ab4 | 7.98 | 8 |
"""End-to-end integration test for autolearn sync.
Starts the Fastify sync server as a subprocess on an ephemeral port, then
exercises the full pipeline:
Python crypto (encrypt) -> HTTP POST -> SQLite store -> HTTP POST -> Python crypto (decrypt)
Verifies that:
1. A file encrypted by sync_crypto survives the ser... | rbelem/devbox-global | dotfiles/dot_agents/skills/autolearn-reviewer/scripts/test_sync_e2e.py | .py | 57d5fd4e70a57c93 | 7.98 | 8 |
#!/usr/bin/env python3
"""
Protocol Analyzer for Saleae Logic MSO captures.
Analyzes digital signal captures to identify timing patterns and help
determine the protocol being used.
"""
import argparse
import sys
from pathlib import Path
from collections import Counter
import numpy as np
try:
from saleae.mso_api... | rbelem/devbox-global | dotfiles/dot_agents/skills/logicmso/executable_analyze_protocol.py | .py | 397fea26264c7f6c | 7.48 | 8 |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import abc
import collections.abc
import json
from typing import Any, Dict, Mapping, Optional, Tuple, Union, get_args, get_origin
from . import grpcClientType, sdkType, utils
class Datum:
def __init__(self, value: Any,... | Azure/azure-functions-python-extensions | azurefunctions-extensions-base/azurefunctions/extensions/base/meta.py | .py | 2b879f16b5e96e6d | 7.45 | 7 |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from abc import abstractmethod
class SdkType:
def __init__(self, *, data: dict = None):
self._data = data or {}
@classmethod
def supports_deferred_binding(cls) -> bool:
"""Returns whether this S... | Azure/azure-functions-python-extensions | azurefunctions-extensions-base/azurefunctions/extensions/base/sdkType.py | .py | 119ec5367655a7ee | 7.45 | 7 |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import inspect
import json
import re
from abc import ABC
from enum import Enum
from typing import Any, Callable, Optional
from . import meta
SNAKE_CASE_RE = re.compile(r"^([a-zA-Z]+\d*_|_+[a-zA-Z\d])\w*$")
WORD_RE = re.comp... | Azure/azure-functions-python-extensions | azurefunctions-extensions-base/azurefunctions/extensions/base/utils.py | .py | 8cb42210b661ceb5 | 7.45 | 7 |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import unittest
from azurefunctions.extensions.base import sdkType
class TestSdkType(unittest.TestCase):
def test_init(self):
data_populated = sdkType.SdkType(data={"key": "value"})
self.assertEqual(dat... | Azure/azure-functions-python-extensions | azurefunctions-extensions-base/tests/test_sdk_type.py | .py | 3f535307ab70b988 | 7.95 | 7 |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import json
from azurefunctions.extensions.base import Datum, SdkType
from .utils import (validate_connection_name,
service_client_factory)
class BlobSdkType(SdkType):
def __init__(self, *, data: D... | Azure/azure-functions-python-extensions | azurefunctions-extensions-bindings-blob/azurefunctions/extensions/bindings/blob/blobSdkType.py | .py | 9777d8d3849dc22f | 7.45 | 7 |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import os
from azure.identity import DefaultAzureCredential
from azure.cosmos import CosmosClient as CosmosClientSdk
def get_connection_string(connection_string: str) -> str:
"""
Validates and returns the Cosmos DB... | Azure/azure-functions-python-extensions | azurefunctions-extensions-bindings-cosmosdb/azurefunctions/extensions/bindings/cosmosdb/utils.py | .py | 4836de14e4d5b43b | 7.45 | 7 |
"""Shared nowcast data objects and source protocol."""
from __future__ import annotations
import datetime as dt
from dataclasses import dataclass, field
from typing import TYPE_CHECKING, Protocol
if TYPE_CHECKING:
from cfa.stf.routine.epiautogp.config import EpiAutoGPConfig
@dataclass(frozen=True)
class Nowcas... | CDCgov/cfa-stf-routine-forecasting | src/cfa/stf/routine/data/nowcast.py | .py | 7b4dfb64b0658e5a | 7.62 | 16 |
"""Simple nowcast source implementations for EpiAutoGP."""
import datetime as dt
from dataclasses import dataclass
from cfa.stf.routine.data.nowcast import NowcastData
from cfa.stf.routine.epiautogp.config import EpiAutoGPConfig
@dataclass(frozen=True)
class FixedNowcast:
"""Return precomputed nowcast data unch... | CDCgov/cfa-stf-routine-forecasting | src/cfa/stf/routine/epiautogp/nowcast.py | .py | 603c43422a5505c7 | 7.62 | 16 |
"""
Reporting-delay nowcasting for EpiAutoGP.
The estimator inflates the most-recent observations of a daily count series by
the inverse of the reporting CDF. It is only meaningful for *count* targets:
applied to a percentage (numerator / denominator) the same inflation factor
would multiply both terms and cancel out,... | CDCgov/cfa-stf-routine-forecasting | src/cfa/stf/routine/epiautogp/reporting_delay_nowcast.py | .py | 59e2de80352ec7c8 | 7.62 | 16 |
"""Shared lifecycle for routine forecast pipelines."""
import datetime as dt
import logging
from abc import ABC, abstractmethod
from collections.abc import Collection
from pathlib import Path
from cfa.stf.routine.data.data_access import (
DataResolution,
ForecastSourceName,
load_surveillance_inputs,
)
fro... | CDCgov/cfa-stf-routine-forecasting | src/cfa/stf/routine/forecast_pipeline.py | .py | 28c939b12f007491 | 7.62 | 16 |
"""Canonical state for one materialized forecast run."""
import datetime as dt
from dataclasses import dataclass
from pathlib import Path
from cfa.stf.routine.data.data_access import (
DataFreshness,
NHSNData,
NSSPData,
SurveillanceInputs,
)
from cfa.stf.routine.utils.directory_utils import get_model_... | CDCgov/cfa-stf-routine-forecasting | src/cfa/stf/routine/forecast_run.py | .py | 1c41c33073886844 | 7.62 | 16 |
"""Resolve and serialize model-specific inputs for PyRenew HEW."""
import json
from dataclasses import dataclass
from pathlib import Path
import jax.numpy as jnp
from cfa.stf.data import (
get_nnh_delay_pmf,
get_nnh_generation_interval_pmf,
get_nnh_right_truncation_pmf,
)
from pyrenew_multisignal.hew impo... | CDCgov/cfa-stf-routine-forecasting | src/cfa/stf/routine/pyrenew_hew/model_inputs.py | .py | 92e13b6870ac88e6 | 7.62 | 16 |
#!/usr/bin/env python3
import argparse
import logging
import re
from collections import defaultdict
from pathlib import Path
from pypdf import PdfWriter
def merge_pdfs(to_merge: list[Path], output_path: Path) -> None:
"""
Merge an ordered list of PDF files and
write the result to a designated output pat... | CDCgov/cfa-stf-routine-forecasting | src/cfa/stf/routine/utils/collate_plots.py | .py | c10c7e0c61d1afc0 | 7.62 | 16 |
"""Utilities for preparing forecast pipeline datasets."""
import polars as pl
import polars.selectors as cs
from cfa.stf.forecasttools import daily_to_weekly
def aggregate_long_to_epiweekly(
data: pl.DataFrame,
date_col: str = "date",
value_col: str = ".value",
) -> pl.DataFrame:
"""Aggregate daily v... | CDCgov/cfa-stf-routine-forecasting | src/cfa/stf/routine/utils/data_utils.py | .py | fb6ae7f6c3250c24 | 7.62 | 16 |
"""Date parsing and training-window utilities."""
import datetime as dt
import logging
def _parse_single_date(date_str: str) -> tuple[dt.date, dt.date]:
"""Parse a single date string into a one-day date range."""
try:
single_date = dt.datetime.strptime(date_str, "%Y-%m-%d").date()
return (sin... | CDCgov/cfa-stf-routine-forecasting | src/cfa/stf/routine/utils/date_utils.py | .py | d398f0b417aa3601 | 7.62 | 16 |
"""R-backed forecast postprocessing utilities."""
from pathlib import Path
from cfa.stf.routine._paths import UTILS_DIR
from cfa.stf.routine.utils.language_utils import run_r_script
def make_figures_from_model_fit_dir(
model_fit_dir: Path,
save_ci: bool = False,
save_figs: bool = True,
) -> None:
""... | CDCgov/cfa-stf-routine-forecasting | src/cfa/stf/routine/utils/r_utils.py | .py | c00f33fb9af9e286 | 7.62 | 16 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.