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 |
|---|---|---|---|---|---|---|
"""
Compatibility wrapper for the unified Meshtastic client app downloader.
Android APKs are now client app assets stored under app/<version>/ and
app/prerelease/<version>/ with Desktop installers from the same upstream
release feed. This module keeps legacy imports working without owning a
separate storage or cleanup... | jeremiah-k/fetchtastic | src/fetchtastic/download/android.py | .py | 03909e9ae1a1b142 | 7.59 | 14 |
"""
Configuration Utilities for Fetchtastic Download Subsystem
This module provides configuration-related utilities that were previously
in the monolithic downloader but are needed by the new modular architecture.
"""
from typing import Any, Dict, List
from fetchtastic.log_utils import logger
def _get_string_list_... | jeremiah-k/fetchtastic | src/fetchtastic/download/config_utils.py | .py | 77718e8448993f48 | 7.59 | 14 |
"""
Compatibility wrapper for the unified Meshtastic client app downloader.
Desktop installers are now client app assets stored under app/<version>/ and
app/prerelease/<version>/ with APKs from the same upstream release feed. This
module keeps legacy imports working without owning a separate storage or cleanup
lifecyc... | jeremiah-k/fetchtastic | src/fetchtastic/download/desktop.py | .py | 352511c636f40f01 | 7.59 | 14 |
"""Best-effort latest symlink management for downloaded artifacts."""
import os
import uuid
from pathlib import Path
from fetchtastic.constants import LATEST_POINTER_NAME
from fetchtastic.log_utils import logger
from .files import _sanitize_path_component
# TODO: Parent and ancestor symlinks are rejected before mut... | jeremiah-k/fetchtastic | src/fetchtastic/download/latest_pointer.py | .py | 2448913a3570811d | 8.09 | 14 |
import logging
import os # Added for environment variable
from logging.handlers import RotatingFileHandler # Already here, ensure it stays
from pathlib import Path
from typing import Optional # Added Optional
from rich.logging import RichHandler # Keep Rich for console
from fetchtastic.constants import (
DEBU... | jeremiah-k/fetchtastic | src/fetchtastic/log_utils.py | .py | c828deb14ff5245c | 7.59 | 14 |
# src/fetchtastic/menu_apk.py
import json
from typing import Any, Dict, Sequence, Union, cast
import requests # type: ignore[import-untyped]
from pick import pick
from fetchtastic.client_release_discovery import (
extract_matching_asset_dicts,
is_android_asset_name,
is_android_prerelease_tag,
select... | jeremiah-k/fetchtastic | src/fetchtastic/menu_apk.py | .py | 3ac0f51db59555be | 7.59 | 14 |
# src/fetchtastic/menu_desktop.py
import json
from typing import cast
import requests # type: ignore[import-untyped]
from pick import pick
from fetchtastic.client_release_discovery import (
extract_matching_asset_names,
is_desktop_asset_name,
is_desktop_prerelease_tag,
is_release_prerelease,
sel... | jeremiah-k/fetchtastic | src/fetchtastic/menu_desktop.py | .py | 378505a75a6010f3 | 7.59 | 14 |
# src/fetchtastic/menu_firmware.py
import json
from typing import cast
import requests # type: ignore[import-untyped]
from pick import pick
from fetchtastic.constants import MESHTASTIC_FIRMWARE_RELEASES_URL
from fetchtastic.log_utils import logger
from fetchtastic.utils import (
extract_base_name,
make_gith... | jeremiah-k/fetchtastic | src/fetchtastic/menu_firmware.py | .py | c13e15eb4776cd3b | 7.59 | 14 |
"""
Notification utilities for Fetchtastic.
This module provides functionality to send notifications via NTFY servers
when downloads are completed or when new releases are available.
"""
from datetime import datetime
from typing import Any, Dict, List, Optional
import requests # type: ignore[import-untyped]
from f... | jeremiah-k/fetchtastic | src/fetchtastic/notifications.py | .py | 182ced105cb62b92 | 7.59 | 14 |
# src/fetchtastic/repo_downloader.py
import os
import platform
import shutil
from typing import Any
from fetchtastic import menu_repo, setup_config, utils
from fetchtastic.constants import (
EXECUTABLE_PERMISSIONS,
FIRMWARE_DIR_NAME,
REPO_DOWNLOADS_DIR,
SHELL_SCRIPT_EXTENSION,
)
from fetchtastic.log_u... | jeremiah-k/fetchtastic | src/fetchtastic/repo_downloader.py | .py | fcae3c646329c1d5 | 7.59 | 14 |
"""
Tests for ALLOW_ENV_TOKEN configuration option.
"""
import os
from unittest.mock import patch
import pytest
from fetchtastic.download.cli_integration import DownloadCLIIntegration
pytestmark = [pytest.mark.user_interface, pytest.mark.unit]
MOCK_RUN_DOWNLOAD_RESULT = (
["fw"],
["new_fw"],
["apk"],
... | jeremiah-k/fetchtastic | tests/test_allow_env_token.py | .py | 6f2fd22873a0da8c | 7.09 | 14 |
"""
Comprehensive tests for AndroidReleaseDownloader functionality.
This module tests the core Android app download behaviors that were
previously handled by the legacy downloader module, ensuring they work
correctly with the new modular architecture.
"""
import os
from unittest.mock import patch
import pytest
impor... | jeremiah-k/fetchtastic | tests/test_android_downloader_comprehensive.py | .py | eb893b45350b7487 | 8.09 | 14 |
"""Targeted tests for async_core.py branch coverage."""
from pathlib import Path
from typing import Any, Optional
from unittest.mock import AsyncMock, MagicMock, Mock, patch
import pytest
import fetchtastic.download.async_core as async_core_module
from fetchtastic.download.async_client import AsyncDownloadError
from... | jeremiah-k/fetchtastic | tests/test_async_core.py | .py | 2f968e426b795d1f | 7.09 | 14 |
"""
Simplified automation configuration tests focused on coverage.
"""
import pytest
import fetchtastic.setup_config as setup_config
@pytest.mark.configuration
@pytest.mark.unit
class TestAutomationConfiguration:
"""Test automation configuration functionality."""
def test_prompt_for_cron_frequency_valid_ch... | jeremiah-k/fetchtastic | tests/test_automation_config.py | .py | 59744ae7a9e8a1ab | 8.09 | 14 |
"""
Integration test for cache flow: mismatch detection and refresh.
"""
import json
import os
from datetime import datetime, timezone
from unittest.mock import MagicMock, patch
import pytest
from fetchtastic.constants import GITHUB_RELEASES_CACHE_SCHEMA_VERSION
from fetchtastic.download.cache import CacheManager
fr... | jeremiah-k/fetchtastic | tests/test_cache_flow_integration.py | .py | c9e547aa8922be3f | 7.09 | 14 |
# /// script
# requires-python = ">=3.8"
# dependencies = [
# "click",
# "pystac-client",
# "requests",
# "shapely",
# "rasterio",
# "pyproj",
# ]
# ///
from __future__ import annotations
from datetime import UTC, datetime
import json
from pathlib import Path
import shutil
import subprocess
imp... | OpenGeoscience/geodatalytics | scripts/sentinelDownload/sentinel2Download.py | .py | fe0fceee9376555b | 7.48 | 8 |
# /// script
# requires-python = ">=3.14"
# dependencies = [
# "discord-py>=2.7.1",
# ]
# ///
"""Script to export all guild members and their roles to per-guild .csv files."""
import argparse
import asyncio
import csv
import logging
import os
import sys
from pathlib import Path
import discord
from discord.ext.comma... | EuroPython/discord | scripts/export-members.py | .py | badfa9a6711d3e27 | 7.59 | 14 |
"""Commands for organisers."""
from __future__ import annotations
import logging
from discord import Role
from discord.ext import commands
from discord.utils import get as discord_get
from pydantic import BaseModel
_logger = logging.getLogger(__name__)
class GuildStatisticsConfig(BaseModel):
required_role: st... | EuroPython/discord | src/europython_discord/cogs/guild_statistics.py | .py | 92d77d61a688678f | 7.59 | 14 |
from __future__ import annotations
import textwrap
from datetime import datetime
from enum import Enum
from typing import Final
from discord import Embed
from discord.utils import escape_markdown, format_dt
from europython_discord.programme_notifications.models import Session, Speaker
_AUTHOR_WIDTH: Final = 128
_TW... | EuroPython/discord | src/europython_discord/programme_notifications/session_to_embed.py | .py | 95ecafbda0433ef9 | 7.59 | 14 |
from __future__ import annotations
import pydantic
class PretixItem(pydantic.BaseModel):
"""Item which can be ordered, e.g. 'Business', 'Personal', 'Education'."""
# https://docs.pretix.eu/en/latest/api/resources/items.html
id: int
names_by_locale: dict[str, str] = pydantic.Field(alias="name")
v... | EuroPython/discord | src/europython_discord/registration/pretix_api_response_models.py | .py | 6752303239634055 | 7.59 | 14 |
from __future__ import annotations
import asyncio
import itertools
import logging
import time
from collections import defaultdict
from datetime import UTC, datetime, timedelta
from pathlib import Path
import aiofiles
import aiohttp
from pydantic import BaseModel
from europython_discord.registration.pretix_api_respon... | EuroPython/discord | src/europython_discord/registration/pretix_connector.py | .py | 5e35075035eac5ae | 7.59 | 14 |
import asyncio
import logging
from pathlib import Path
import aiofiles
from europython_discord.registration.ticket import Ticket
_logger = logging.getLogger(__name__)
class RegistrationLogger:
def __init__(self, log_file: Path) -> None:
"""Track tickets which are registered via the Discord bot."""
... | EuroPython/discord | src/europython_discord/registration/registration_logger.py | .py | 6d1e51ea1e43791b | 7.59 | 14 |
from datetime import datetime, timedelta, timezone
import pytest
from europython_discord.programme_notifications import session_to_embed
from europython_discord.programme_notifications.models import Session, Speaker
from europython_discord.programme_notifications.session_to_embed import (
_AUTHOR_WIDTH,
_FIEL... | EuroPython/discord | tests/program_notifications/test_session_to_embed.py | .py | 7b29419f7b24435b | 8.09 | 14 |
"""Tests for the debug output which reveals ``ignore_names`` values."""
from pathlib import Path
import pytest
from mypy import api
_SOURCE = """\
def implementation(self: object, value: int) -> None:
return None
class Base:
assigned = implementation
def method(self, value: int) -> None:
retur... | adamtheturtle/mypy-strict-kwargs | tests/test_debug_output.py | .py | bf61b18ba4f01d19 | 7.92 | 6 |
import requests
from bs4 import BeautifulSoup
import time
BASE_URL = "http://localhost:5000"
# Use a session so cookies (session cookie) persist between requests
session = requests.Session()
def get_csrf_token():
"""Fetch the CSRF token from the homepage meta tag."""
res = session.get(BASE_URL)
soup = Be... | pooyanazad/AnsiblePower | tests/test_live_app.py | .py | 38611e92a8cbddf8 | 8.12 | 16 |
import unittest
import os
import json
import sys
import tempfile
import shutil
# Add parent directory to path to import ansiblePower
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import ansiblePower
class TestFlaskRoutes(unittest.TestCase):
"""Quality tests for Flask route resp... | pooyanazad/AnsiblePower | tests/test_quality.py | .py | 2763497f1ea60de0 | 8.12 | 16 |
#!/usr/bin/env python3
"""
Smoke Tests for AnsiblePower Application
These tests verify basic functionality and ensure the application
can start and respond to basic requests without errors.
"""
import unittest
import sys
import os
import tempfile
import json
from unittest.mock import patch, MagicMock
# Add the paren... | pooyanazad/AnsiblePower | tests/test_smoke.py | .py | bb4194bb9789c083 | 8.12 | 16 |
import unittest
import os
import json
import sys
from unittest.mock import patch, mock_open
# Add parent directory to path to import ansiblePower
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from ansiblePower import (
get_history_db_file,
load_config,
load_history,
s... | pooyanazad/AnsiblePower | tests/test_unit.py | .py | 558f547584e3909d | 7.12 | 16 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache/openserverless-operator | actions/common/authorize.py | .py | 3415f542d731aeda | 7.54 | 11 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache/openserverless-operator | actions/common/minio_util.py | .py | 2f153d165bea6742 | 7.54 | 11 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache/openserverless-operator | actions/content/__main__.py | .py | d36db1a8650b0eac | 7.54 | 11 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache/openserverless-operator | actions/devel/download/__main__.py | .py | b2b9d2ef3fcd603c | 7.54 | 11 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache/openserverless-operator | actions/devel/download/nuvolaris/config.py | .py | 7224d5a830f9b792 | 7.54 | 11 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache/openserverless-operator | actions/devel/ferretdb/__main__.py | .py | c3c915c4c8174796 | 7.54 | 11 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache/openserverless-operator | actions/devel/ferretdb/command/ferretbd.py | .py | 3a6c65075e8f2d54 | 7.54 | 11 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache/openserverless-operator | actions/devel/minio/__main__.py | .py | 338350be3513db6a | 7.54 | 11 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache/openserverless-operator | actions/devel/psql/__main__.py | .py | 67b3879c6a01d598 | 7.54 | 11 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache/openserverless-operator | actions/devel/psql/command/psql.py | .py | dd31839ad54fe10d | 7.54 | 11 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache/openserverless-operator | actions/devel/redis/__main__.py | .py | 913ac9384d2eddad | 7.54 | 11 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache/openserverless-operator | actions/devel/redis/command/redis.py | .py | eea0824d9d1c6e44 | 7.54 | 11 |
#!/usr/bin/env python3
"""
Benchmark cache effectiveness for acmcsufoss/oss-stats.
Measures cold (no cache) vs warm (populated cache) runs across all resources,
reporting wall-clock time AND the number of HTTP requests issued to the GitHub
API. Request count is the more meaningful metric: wall-clock varies with
networ... | acmcsufoss/oss-stats | bench_cache.py | .py | e8900529e421e2d7 | 7.45 | 7 |
import os
import sys
from typing import List
from github import Github, GithubException
from dotenv import find_dotenv, load_dotenv
from datetime import datetime, timedelta, timezone
from alive_progress import alive_bar
from platformdirs import user_config_dir
from pathlib import Path
import tomllib
import tomli_w
from... | acmcsufoss/oss-stats | src/oss_stats/stats.py | .py | c45028579ff3fab1 | 7.45 | 7 |
#!/usr/bin/env python3
"""Behavioural checks for the configurable cache staleness threshold.
Run with:
uv run python tests/test_stale.py
The module-level GitHub setup is mocked during import, so these checks run
without credentials or network access.
"""
import os
import sys
from datetime import datetime, timede... | acmcsufoss/oss-stats | tests/test_stale.py | .py | 6a97ef3391312c5d | 7.95 | 7 |
from abc import ABC, abstractmethod
from dataclasses import dataclass, field
from importlib.resources import files
from pathlib import Path
import nibabel as nib
import numpy as np
import pandas as pd
import scipy
from nilearn.image import iter_img, load_img, math_img, resample_to_img
from nilearn.maskers import Nifti... | HALFpipe/wonkyconn | wonkyconn/atlas.py | .py | b394786c84689a64 | 7.45 | 7 |
from dataclasses import dataclass
from functools import cached_property
from pathlib import Path
from typing import Any
import numpy as np
from numpy import typing as npt
@dataclass
class ConnectivityMatrix:
"""
Represents a connectivity matrix.
Attributes:
path (Path): The path to the ".tsv" fi... | HALFpipe/wonkyconn | wonkyconn/base.py | .py | e87338b4b2117dcc | 7.45 | 7 |
import numpy as np
from numba import guvectorize
from numpy import typing as npt
from scipy import stats
def correlation_p_value(r: npt.NDArray[np.float64], m: int) -> npt.NDArray[np.float64]:
ab = m / 2 - 1
distribution = stats.beta(ab, ab, loc=-1, scale=2)
pvalue = 2 * (distribution.sf(np.abs(r)))
r... | HALFpipe/wonkyconn | wonkyconn/correlation.py | .py | 73aa56b5acbc037b | 7.45 | 7 |
from __future__ import annotations
from dataclasses import dataclass, field
from typing import TYPE_CHECKING, Dict, List
import numpy as np
import pandas as pd
from joblib import parallel_backend
from nilearn.connectome import sym_matrix_to_vec
from numpy.typing import NDArray
from sklearn.base import BaseEstimator, ... | HALFpipe/wonkyconn | wonkyconn/features/age_sex_prediction.py | .py | aa03482113b526fd | 7.45 | 7 |
import glob
import warnings
from pathlib import Path
from typing import Iterable, List, Tuple
import nibabel as nib
import numpy as np
from brainspace.gradient import GradientMaps
from nibabel.nifti1 import Nifti1Image
from nilearn import image
from nilearn.connectome import sym_matrix_to_vec, vec_to_sym_matrix
from n... | HALFpipe/wonkyconn | wonkyconn/features/calculate_gradients_correlation.py | .py | e944cf0f4b50871a | 7.45 | 7 |
"""GCOR feature implementation."""
from __future__ import annotations
from typing import Iterable
import numpy as np
from numpy import typing as npt
from ..base import ConnectivityMatrix
# AFNI's `gcor2` computes GCOR as ||(1/M) Σ u_i||^2 for unit-variance time series,
# which equals the average of the pairwise d... | HALFpipe/wonkyconn | wonkyconn/features/gcor.py | .py | 144ed806a55ce8a1 | 7.45 | 7 |
"""Network similarity measures."""
from __future__ import (
annotations,
)
import warnings
from typing import Tuple
import numpy as np
import pandas as pd
from numpy import typing as npt
from scipy import stats
from ..base import ConnectivityMatrix
def single_subject_within_network_connectivity(
connectiv... | HALFpipe/wonkyconn | wonkyconn/features/network.py | .py | 33c0c12d77570bc8 | 7.45 | 7 |
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
from __future__ import annotations
from collections import defaultdict
from dataclasses import dataclass, field
from functools import cached_property
from pathlib import Path
from ... | HALFpipe/wonkyconn | wonkyconn/file_index/base.py | .py | c6b955f67d0c405e | 7.45 | 7 |
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
import json
from pathlib import Path
from typing import Any, MutableSequence
from .base import FileIndex
def split_ext(path: str | Path) -> tuple[str, str]:
"""Splits filenam... | HALFpipe/wonkyconn | wonkyconn/file_index/bids.py | .py | 338477c6b691b8c0 | 7.45 | 7 |
from __future__ import annotations
from pathlib import Path
from typing import Iterable
from textual.app import App, ComposeResult
from textual.containers import Center, Container, Horizontal, Vertical
from textual.events import DescendantFocus
from textual.widgets import (
Button,
Checkbox,
DirectoryTree... | HALFpipe/wonkyconn | wonkyconn/textual_app.py | .py | 48c95f8bd9a2a880 | 7.45 | 7 |
"""
Process fMRIPrep outputs to timeseries based on denoising strategy.
"""
import sys
from collections import defaultdict, namedtuple
from pathlib import Path
from typing import Any
import numpy as np
import pandas as pd
from numpy import typing as npt
from tqdm.auto import tqdm
from wonkyconn.config import Metric,... | HALFpipe/wonkyconn | wonkyconn/workflow.py | .py | 97683be2dc5d3442 | 7.45 | 7 |
"""MkDocs hooks for poly-hammer-docs.
on_page_context: fixes a Windows-specific bug in mkdocs-shadcn where
`page.file.src_path` (backslash-separated on Windows) is used to build
`raw_markdown_url`, triggering an "OS-specific separator" warning from MkDocs.
We normalize the URL to forward-slashes before any template re... | poly-hammer/poly-hammer-docs | scripts/hooks.py | .py | 27387efe3e799760 | 7.48 | 8 |
#!/usr/bin/env python3
"""Sync external repo docs into the main docs site.
Reads the repo list from pyproject.toml [tool.poly-hammer-docs],
clones each repo, copies its docs/ directory, and patches the
mkdocs.yml nav section using BEGIN/END markers.
Usage:
uv run python scripts/sync_docs.py [--token GH_PAT] [--fo... | poly-hammer/poly-hammer-docs | scripts/sync_docs.py | .py | bbf590313f134746 | 7.48 | 8 |
"""
Module to setup the PypeIt debugger
"""
import matplotlib.pyplot as plt
import numpy as np
# These need to be outside of the def's
try:
from pypeit.ginga import show_image
except ImportError: # Ginga is not yet required
pass
else:
from pypeit.ginga import clear_canvas
# ADD-ONs from xastropy
def plot... | mit-kavli-institute/llamas-pyjamas | Test/debugger.py | .py | 6160209752107bc9 | 7.04 | 11 |
from astropy.io import fits
import scipy
import numpy as np
from matplotlib import pyplot as plt
import pydl
import pyds9
###########
def detect_peaks(x, mph=None, mpd=1, threshold=0, edge='rising',
kpsh=False, valley=False, show=False, ax=None):
"""Detect peaks in data based on their amplitu... | mit-kavli-institute/llamas-pyjamas | Test/llamas_trace.py | .py | f179ed194f4c9fe1 | 8.04 | 11 |
from astropy.io import fits
import scipy
import numpy as np
from matplotlib import pyplot as plt
import pydl
import pyds9
###########
def detect_peaks(x, mph=None, mpd=1, threshold=0, edge='rising',
kpsh=False, valley=False, show=False, ax=None):
"""Detect peaks in data based on their amplitu... | mit-kavli-institute/llamas-pyjamas | Test/llamas_trace_oldtest.py | .py | 3bc14d95239f598d | 8.04 | 11 |
"""
This module provides functionality to create a master bias frame from a directory of bias images or a list of files.
Classes:
BiasLlamas: A class to handle bias image processing and creation of a master bias frame.
Usage:
To use this module, instantiate the BiasLlamas class with a directory path containin... | mit-kavli-institute/llamas-pyjamas | llamas_pyjamas/Bias/llamasBias.py | .py | b5cbf7bfaef9ff39 | 7.54 | 11 |
#!/usr/bin/env python3
"""
CRR Cube Construction Command Line Interface
Command-line interface for the Covariance-regularized Reconstruction (CRR)
cube construction following Liu et al. (2020). This script provides a
convenient interface for processing LLAMAS IFU data with CRR reconstruction.
Usage:
python crr_c... | mit-kavli-institute/llamas-pyjamas | llamas_pyjamas/Cube/crr_cli.py | .py | fa9f5e891c0d0d07 | 7.54 | 11 |
"""
RSS to CRR Data Format Adapter
This module provides conversion functions to adapt existing LLAMAS RSS (Row-Stacked Spectra)
files to the CRR (Covariance-regularized Reconstruction) data format. This enables seamless
integration of CRR reconstruction into the existing LLAMAS pipeline.
Functions:
load_rss_as_cr... | mit-kavli-institute/llamas-pyjamas | llamas_pyjamas/Cube/rss_to_crr_adapter.py | .py | 778ae1a328d78aa8 | 7.54 | 11 |
from typing import List, Literal, Optional, overload
import math
from aiohttp_retry import dataclass
from pydantic import BaseModel
from app.utils.helper import SliceMode
# Custom Exceptions
class EmbeddingException(Exception):
"""Base exception for embedding operations"""
pass
class EmptyVectorError(Embed... | princee1/Notifyr | app/classes/embeddings.py | .py | adf1011941ba76ea | 7.57 | 13 |
from dataclasses import dataclass, field
import smtplib as smtp
import imaplib as imap
from enum import Enum
from typing import Callable, Iterable, Literal, Optional, Self, overload
from base64 import urlsafe_b64encode, urlsafe_b64decode
SMTP_NORMAL_PORT = smtp.SMTP_PORT
SMTP_SSL_PORT = smtp.SMTP_SSL_PORT
SMTP_TLS_PO... | princee1/Notifyr | app/classes/mail_provider.py | .py | 454728ea342966ee | 7.57 | 13 |
from pydantic import BaseModel, Field, field_validator, model_validator
from typing import List, Optional, Self, TypedDict, Literal, Union
from app.classes.chunk import Density, DocumentType, Extension
from app.definition._error import BaseError
class QdrantSearchParamsModel(BaseModel):
hnsw_ef: Optional[int] = Fi... | princee1/Notifyr | app/classes/qdrant.py | .py | 7dc75646a9a56e6f | 7.57 | 13 |
from os import urandom
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from cryptography.hazmat.primitives.ciphers.aead import ChaCha20Poly1305
from typing import Union
from app.utils.helper import DICT_SEP, flatten_dict, unflattened_dict
from app.utils.toolbox import Time
from cryptography... | princee1/Notifyr | app/classes/secrets.py | .py | 5ba0b2f905411e2b | 7.57 | 13 |
from dataclasses import dataclass, field
import json
import re
from typing import List, Optional, Tuple, Union, Self,Iterator,Dict,Any
import aiohttp
from pydantic import BaseModel, Field, field_validator, model_validator
from typing import Literal, get_args
from itertools import product
from app.utils.helper import p... | princee1/Notifyr | app/classes/url.py | .py | e79153a673685a26 | 7.57 | 13 |
"""Interactive tool for marking parking bays.
Left-click adds a bay whose top-left corner is where you clicked.
Right-click inside a bay removes it.
Press q or Esc to quit (positions are saved after every change).
The marked positions are written to CarParkPos and consumed by main.py.
"""
import argparse
import os
i... | verjin-dev/Car_Parking_Space_Detection | Source Code/ParkingSpacePicker.py | .py | d07b8aca1e01429b | 7.56 | 12 |
"""API for home_assistant_intents package."""
import importlib.resources
import json
import os
import typing
from dataclasses import dataclass
from enum import Enum
from pathlib import Path
from typing import IO, Any, Callable, Dict, List, Optional
from .languages import LANGUAGES
_PACKAGE = "home_assistant_intents"... | OHF-Voice/intents-package | home_assistant_intents/__init__.py | .py | 97ea637be1a4f129 | 7.52 | 10 |
"""Command to generate merged output."""
import argparse
import collections
import json
import logging
from pathlib import Path
import yaml
_LOGGER = logging.getLogger(__name__)
ROOT = Path(__file__).parent.parent
INTENTS_DIR = ROOT / "intents"
IMPORTANT_INTENTS = {"HassTurnOn", "HassTurnOff"}
def convert_slot_c... | OHF-Voice/intents-package | script/merged_output.py | .py | 7a9d51e21def154a | 7.52 | 10 |
"""Test loading intents for available languages."""
from functools import lru_cache
from pathlib import Path
from typing import Any, Dict, FrozenSet, List, Optional, Set, Tuple
import pytest
import yaml
from hassil import Intents, TextSlotList, recognize_best
from home_assistant_intents import (
get_intents,
... | OHF-Voice/intents-package | tests/test_intents.py | .py | 81da557b3a91bd16 | 8.02 | 10 |
# SPDX-FileCopyrightText: (c) 2026 Tenstorrent AI ULC
#
# SPDX-License-Identifier: Apache-2.0
import logging
import numpy as np
from blacksmith.datasets.torch.alpaca.alpaca_dataset import AlpacaDataset
from blacksmith.tools.templates.configs import TrainingConfig
logger = logging.getLogger(__name__)
def _create_b... | tenstorrent/tt-blacksmith | blacksmith/datasets/jax/alpaca/alpaca_dataset.py | .py | 4ad69b84c0a3922b | 7.63 | 17 |
# SPDX-FileCopyrightText: (c) 2025 Tenstorrent AI ULC
#
# SPDX-License-Identifier: Apache-2.0
import json
import os
from typing import Dict, Optional, Tuple
import jax
import jax.numpy as jnp
from huggingface_hub import hf_hub_download
from PIL import Image
from blacksmith.datasets.jax.nerf.ray_utils import get_ray_... | tenstorrent/tt-blacksmith | blacksmith/datasets/jax/nerf/blender.py | .py | f8b6f6d8522fe9b3 | 7.63 | 17 |
# SPDX-FileCopyrightText: (c) 2025 Tenstorrent AI ULC
#
# SPDX-License-Identifier: Apache-2.0
from typing import Tuple
import jax.numpy as jnp
# JAX equivalent of kornia.create_meshgrid
def create_meshgrid(height: int, width: int, normalized_coordinates: bool = False) -> jnp.ndarray:
"""Generate a coordinate gri... | tenstorrent/tt-blacksmith | blacksmith/datasets/jax/nerf/ray_utils.py | .py | e93c13e9454b4842 | 7.63 | 17 |
# SPDX-FileCopyrightText: (c) 2026 Tenstorrent AI ULC
#
# SPDX-License-Identifier: Apache-2.0
import logging
import numpy as np
from blacksmith.datasets.torch.sst2.sst2_dataset import SSTDataset
from blacksmith.tools.templates.configs import TrainingConfig
logger = logging.getLogger(__name__)
def _create_batches(... | tenstorrent/tt-blacksmith | blacksmith/datasets/jax/sst2/sst2_dataset.py | .py | c2d95015f8193b67 | 7.63 | 17 |
# SPDX-FileCopyrightText: (c) 2026 Tenstorrent AI ULC
#
# SPDX-License-Identifier: Apache-2.0
"""
Wikitext-2 Dataset Implementation for Causal Language Model Training.
This module provides a dataset wrapper for the Wikitext-2 dataset,
suitable for causal language model fine-tuning.
"""
from typing import Dict, List
f... | tenstorrent/tt-blacksmith | blacksmith/datasets/torch/BOUNTIES/wikitext/wikitext_dataset.py | .py | d6ddbf909a537723 | 7.63 | 17 |
# SPDX-FileCopyrightText: (c) 2025 Tenstorrent AI ULC
#
# SPDX-License-Identifier: Apache-2.0
from string import Template
from torch.utils.data import DataLoader
from transformers import AutoTokenizer, DataCollatorForSeq2Seq
from blacksmith.datasets.torch.torch_dataset import BaseDataset
from blacksmith.tools.templat... | tenstorrent/tt-blacksmith | blacksmith/datasets/torch/alpaca/alpaca_dataset.py | .py | 874ec881a2f1f975 | 7.63 | 17 |
# SPDX-FileCopyrightText: (c) 2025 Tenstorrent AI ULC
#
# SPDX-License-Identifier: Apache-2.0
from typing import Dict
from torch.utils.data import DataLoader
from transformers import AutoTokenizer, DataCollatorWithPadding
from blacksmith.datasets.torch.torch_dataset import BaseDataset
from blacksmith.tools.templates... | tenstorrent/tt-blacksmith | blacksmith/datasets/torch/banking77/banking77_dataset.py | .py | 48584f59c9f2a2ad | 7.63 | 17 |
# SPDX-FileCopyrightText: (c) 2025 Tenstorrent AI ULC
#
# SPDX-License-Identifier: Apache-2.0
from enum import Enum
from blacksmith.datasets.torch.alpaca.alpaca_dataset import AlpacaDataset
from blacksmith.datasets.torch.banking77.banking77_dataset import Banking77Dataset
from blacksmith.datasets.torch.BOUNTIES.wikite... | tenstorrent/tt-blacksmith | blacksmith/datasets/torch/dataset_utils.py | .py | 7f9d011305a4ea0b | 7.63 | 17 |
# SPDX-FileCopyrightText: (c) 2026 Tenstorrent AI ULC
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import io
import random
import zipfile
from pathlib import Path
import numpy as np
import pandas as pd
import torch
from huggingface_hub import HfApi, hf_hub_download
from PIL import Image
... | tenstorrent/tt-blacksmith | blacksmith/datasets/torch/diffusiondb_pixelart/diffusiondb_pixelart_dataset.py | .py | ff9c67e653ea0903 | 7.63 | 17 |
# SPDX-FileCopyrightText: (c) 2026 Tenstorrent AI ULC
#
# SPDX-License-Identifier: Apache-2.0
from torch.utils.data import DataLoader
from transformers import AutoTokenizer, DataCollatorForSeq2Seq
from blacksmith.datasets.torch.fusechat.fusechat_utils import (
DATASET_PATH,
PROMPT_TEMPLATE,
)
from blacksmith.... | tenstorrent/tt-blacksmith | blacksmith/datasets/torch/fusechat/fusechat_dataset.py | .py | 0f8a7d869c420b69 | 7.63 | 17 |
# SPDX-FileCopyrightText: (c) 2026 Tenstorrent AI ULC
#
# SPDX-License-Identifier: Apache-2.0
"""
GSM8K dataset for GRPO training.
"""
from typing import Dict, List
from torch.utils.data import DataLoader
from transformers import AutoTokenizer
from blacksmith.datasets.torch.gsm8k.gsm8k_utils import (
DATASET_CONF... | tenstorrent/tt-blacksmith | blacksmith/datasets/torch/gsm8k/gsm8k_dataset.py | .py | ad47f959563c3387 | 7.63 | 17 |
# SPDX-FileCopyrightText: (c) 2026 Tenstorrent AI ULC
#
# SPDX-License-Identifier: Apache-2.0
"""
Constants, parsing helpers, and GRPO reward scoring for GSM8K.
"""
import re
from typing import List, Tuple
import torch
# Dataset source
DATASET_PATH = "openai/gsm8k"
DATASET_CONFIG = "main"
# R1-style system prompt. G... | tenstorrent/tt-blacksmith | blacksmith/datasets/torch/gsm8k/gsm8k_utils.py | .py | bf1c1a54c2ece519 | 7.63 | 17 |
# SPDX-FileCopyrightText: (c) 2026 Tenstorrent AI ULC
#
# SPDX-License-Identifier: Apache-2.0
from typing import Dict, List
import torch
from torch.utils.data import DataLoader
from transformers import AutoTokenizer, DataCollatorForSeq2Seq
from blacksmith.datasets.torch.mathpreference.math_preference_utils import (
... | tenstorrent/tt-blacksmith | blacksmith/datasets/torch/mathpreference/math_preference_dataset.py | .py | 4e5f735d6113ca75 | 7.63 | 17 |
# SPDX-FileCopyrightText: (c) 2026 Tenstorrent AI ULC
#
# SPDX-License-Identifier: Apache-2.0
from inspect import cleandoc
from string import Template
from torch.utils.data import DataLoader
from transformers import AutoTokenizer, DataCollatorForSeq2Seq
from blacksmith.datasets.torch.torch_dataset import BaseDataset
... | tenstorrent/tt-blacksmith | blacksmith/datasets/torch/metamathqa/metamathqa_dataset.py | .py | 5d6560f199b044e0 | 7.63 | 17 |
# SPDX-FileCopyrightText: (c) 2025 Tenstorrent AI ULC
#
# SPDX-License-Identifier: Apache-2.0
import torch
from kornia import create_meshgrid
def get_ray_directions(H, W, focal):
"""
Get ray directions for all pixels in camera coordinate.
Reference: https://www.scratchapixel.com/lessons/3d-basic-rendering... | tenstorrent/tt-blacksmith | blacksmith/datasets/torch/nerf/ray_utils.py | .py | 75e6f35ca0177c7d | 7.63 | 17 |
# SPDX-FileCopyrightText: (c) 2025 Tenstorrent AI ULC
#
# SPDX-License-Identifier: Apache-2.0
from string import Template
from torch.utils.data import DataLoader
from transformers import AutoTokenizer, DataCollatorForSeq2Seq
from blacksmith.datasets.torch.torch_dataset import BaseDataset
from blacksmith.tools.templat... | tenstorrent/tt-blacksmith | blacksmith/datasets/torch/squadV2/squadV2_dataset.py | .py | 2a76bc4b5d3141ac | 7.63 | 17 |
# SPDX-FileCopyrightText: (c) 2025 Tenstorrent AI ULC
#
# SPDX-License-Identifier: Apache-2.0
from torch.utils.data import DataLoader
from transformers import AutoTokenizer, DataCollatorForSeq2Seq
from blacksmith.datasets.torch.sst2.sst2_utils import (
DATASET_BENCHMARK,
DATASET_NAME,
LBL2VALUE,
PROMPT... | tenstorrent/tt-blacksmith | blacksmith/datasets/torch/sst2/sst2_dataset.py | .py | 13303f3e9fa3dfc8 | 7.63 | 17 |
# SPDX-FileCopyrightText: (c) 2026 Tenstorrent AI ULC
#
# SPDX-License-Identifier: Apache-2.0
import torch
from torch.utils.data import DataLoader
from torchvision import transforms
from blacksmith.datasets.torch.torch_dataset import BaseDataset
from blacksmith.tools.templates.configs import TrainingConfig
from datase... | tenstorrent/tt-blacksmith | blacksmith/datasets/torch/stanfordcars/stanfordcars_dataset.py | .py | 2df23b335506a04f | 7.63 | 17 |
"""Generate language files and assemble the Minecraft resource pack."""
from collections.abc import Mapping
from dataclasses import dataclass
from time import perf_counter
from zipfile import ZIP_DEFLATED, ZipFile, ZipInfo
from unreadable_language_pack.conversion import (
LanguageConversionResult,
LanguageEnt... | SkyEye-FAST/unreadable_language_pack | src/unreadable_language_pack/build.py | .py | fc201616d5ce3219 | 7.63 | 17 |
"""Command-line interface for the resource-pack generator."""
import argparse
from pathlib import Path
from unreadable_language_pack.build import ResourcePackBuilder
from unreadable_language_pack.repository import ProjectLayout
def create_parser() -> argparse.ArgumentParser:
"""Create the command-line argument ... | SkyEye-FAST/unreadable_language_pack | src/unreadable_language_pack/cli.py | .py | 88b60c8ec8795b7c | 7.63 | 17 |
"""Shared workflow for converting language dictionaries."""
from collections.abc import Callable, Mapping
from dataclasses import dataclass
from time import perf_counter
from unreadable_language_pack.repository import StringMap
type TextTransform = Callable[[str], str]
type LanguageEntryPreprocessor = Callable[[str,... | SkyEye-FAST/unreadable_language_pack | src/unreadable_language_pack/conversion.py | .py | 6278122623080571 | 7.63 | 17 |
"""The `sigstore_rekor_types` APIs."""
from __future__ import annotations
from typing import Annotated, Literal
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
from ._internal import (
alpine,
cose,
dsse,
hashedrekord,
helm,
intoto,
jar,
rekord,
rfc3161,
... | sigstore/sigstore-rekor-types | src/rekor_types/__init__.py | .py | 4e2935b1e7e0f1db | 7.45 | 7 |
"""Implementation of the CLI for pypi-attestations."""
from __future__ import annotations
import argparse
import json
import logging
import typing
from collections import defaultdict
from pathlib import Path
from tempfile import TemporaryDirectory
import requests
import sigstore.oidc
from cryptography import x509
fr... | pypi/pypi-attestations | src/pypi_attestations/_cli.py | .py | 5668edc80b2359bf | 7.12 | 16 |
import logging
import os
from datetime import datetime
from pathlib import Path
from typing import Literal, Tuple, Union
import geopandas as gpd
import numpy as np
import xarray as xr
from dask.distributed import Client, Future, progress
from data_processing.dask_utils import no_cluster, temp_cluster
logger = logging... | CIROH-UA/NGIAB_data_preprocess | modules/data_processing/dataset_utils.py | .py | 88b63fddd491c5df | 7.62 | 16 |
import logging
from typing import Optional
import s3fs
import xarray as xr
from data_processing.dask_utils import use_cluster
from data_processing.dataset_utils import validate_dataset_format
from data_processing.s3fs_utils import S3ParallelFileSystem
logger = logging.getLogger(__name__)
@use_cluster
def load_v3_re... | CIROH-UA/NGIAB_data_preprocess | modules/data_processing/datasets.py | .py | fc4275b994964d4d | 7.62 | 16 |
import logging
import sqlite3
from functools import cache
from pathlib import Path
from typing import List, Optional, Set, Union
import igraph as ig
from data_processing.file_paths import FilePaths
logger = logging.getLogger(__name__)
def get_from_to_id_pairs(
hydrofabric: Path = FilePaths.conus_hydrofabric, id... | CIROH-UA/NGIAB_data_preprocess | modules/data_processing/graph_utils.py | .py | f4911c9a9e7ffaf4 | 7.62 | 16 |
from s3fs import S3FileSystem
from s3fs.core import _error_wrapper, version_id_kw
from typing import Optional
import asyncio
class S3ParallelFileSystem(S3FileSystem):
"""S3FileSystem subclass that supports parallel downloads"""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
... | CIROH-UA/NGIAB_data_preprocess | modules/data_processing/s3fs_utils.py | .py | 922d44980d1ecd5d | 7.62 | 16 |
import gzip
import json
import os
import sqlite3
import tarfile
import warnings
from time import sleep
import boto3
import botocore
import psutil
import requests
from boto3.s3.transfer import TransferConfig
from botocore.exceptions import ClientError
from data_processing.file_paths import FilePaths
from data_processin... | CIROH-UA/NGIAB_data_preprocess | modules/data_sources/source_validation.py | .py | fb400bef47dbe862 | 7.62 | 16 |
import logging
from colorama import Fore, Style, init
# Initialize colorama
init(autoreset=True)
class ColoredFormatter(logging.Formatter):
def format(self, record):
message = super().format(record)
if record.levelno == logging.DEBUG:
return f"{Fore.BLUE}{message}{Style.RESET_ALL}"
... | CIROH-UA/NGIAB_data_preprocess | modules/ngiab_data_cli/custom_logging.py | .py | 892d97a336b1b9d7 | 7.62 | 16 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.