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 |
|---|---|---|---|---|---|---|
"""Provide model latest fixtures."""
import json
from pathlib import Path
import pytest
@pytest.fixture(scope="session")
def latest_latest(latest_latest_usd: str, request: pytest.FixtureRequest) -> str:
"""Return a response for latest.json with USD base or request.param base."""
body_string = latest_latest_... | MartinHjelmare/aioopenexchangerates | tests/model/conftest.py | .py | f8a0bcfc7b5d7c34 | 7.5 | 0 |
import json
import logging
import threading
import time
from typing import List
import celery
import redis as redis_lib
from celery.utils.objects import FallbackContext
from prometheus_client import CollectorRegistry, Counter, Gauge
from src.app import create_app
logging.basicConfig(level=logging.INFO)
class Cel... | AllenInstitute/CeleryMetricsExporter | src/exporter.py | .py | fc03a527667eaad7 | 7 | 0 |
import json
from prometheus_client import CollectorRegistry, Gauge
from src.exporter import QueueLengthMonitoringThread
class _FakeClient:
"""Stands in for the redis client the thread now holds directly.
The thread used to reach its client through celery_app.connection().channel(), so the
fakes here mi... | AllenInstitute/CeleryMetricsExporter | tests/test_metrics.py | .py | e2ebde53c9c92a4a | 7.5 | 0 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 1 14:05:54 2021
@author: dylancalame
"""
import numpy as np
import random
import math
from scipy.stats import norm
class ResultsData():
def __init__(self,num_trials:int=None):
self.purkinje_fr = [None]*num_trials
... | dycala/temporal-cerebellar-model | core.py | .py | 7cd0353890017167 | 7.3 | 3 |
import pandas as pd
import math
import matplotlib.pyplot as plt
from matplotlib import cm
import numpy as np
import matplotlib.colors as mcolors
from core import ResultsData
parameters = {'font.sans-serif':'Arial',
'figure.titlesize': 10,
'axes.labelsize': 10,
'axes.titlesize': 10,
'ytick.labelsize': 10,
'... | dycala/temporal-cerebellar-model | plotting.py | .py | 3a5381ebcd6c88c6 | 7.3 | 3 |
"""Translate between the Gen4 WAC IoT wire protocol and canonical dicts.
Gen4 fans speak the WAC IoT `/device` + `/fixture` REST model instead of
Gen 1/2/3's flat `/mf` shadow. Every function here is a pure translation
step — no HTTP happens in this module; `ModernFormsDevice` is the only
thing that makes requests.
""... | wonderslug/aiomodernforms | aiomodernforms/gen4.py | .py | e948dfb681559cd8 | 7.3 | 3 |
"""Models for Async IO Modern Forms."""
from __future__ import annotations
from dataclasses import dataclass, field
from enum import Enum
from typing import Any
from .const import (
CONFIG_CERTIFICATE_ID,
CONFIG_FIRMWARE_VERSION,
CONFIG_FIRMWARE_VERSION_LEGACY,
CONFIG_HARDWARE_REVISION,
CONFIG_NA... | wonderslug/aiomodernforms | aiomodernforms/models.py | .py | 87adb71a33b90f1f | 7.3 | 3 |
"""aiohttp server emulating the Modern Forms fan wire protocol."""
from __future__ import annotations
import asyncio
import logging
from aiohttp import web
from aiomodernforms.const import (
COMMAND_DECOMMISSION,
COMMAND_FACTORY_RESET,
COMMAND_QUERY_STATIC_DATA,
COMMAND_REBOOT,
GEN4_DEVICE_HARD_... | wonderslug/aiomodernforms | mock_fan/server.py | .py | e56d6d66a464b77b | 7.3 | 3 |
"""Mutable dynamic-shadow state for the mock fan, and command validation."""
from __future__ import annotations
from collections.abc import Callable
from aiomodernforms.const import (
COMMAND_ADAPTIVE_LEARNING,
COMMAND_AWAY_MODE,
COMMAND_DECOMMISSION,
COMMAND_FACTORY_RESET,
COMMAND_FAN_DIRECTION,... | wonderslug/aiomodernforms | mock_fan/state.py | .py | 00a69cdc50329167 | 7.3 | 3 |
#!/usr/bin/env python
"""The setup script."""
import os
import re
import sys
from setuptools import find_packages, setup
def get_version():
"""Get current version from code."""
regex = r"__version__\s=\s\"(?P<version>[\d\.]+?)\""
path = ("aiomodernforms", "__version__.py")
return re.search(regex, re... | wonderslug/aiomodernforms | setup.py | .py | 74dc8c4058787343 | 7.3 | 3 |
"""Unit tests for mock_fan.__main__ argument parsing."""
import pytest
from mock_fan.__main__ import _parse_args
def test_generation_is_required():
"""--generation is required; omitting it is a usage error."""
with pytest.raises(SystemExit):
_parse_args([])
def test_defaults():
"""host/port/br... | wonderslug/aiomodernforms | tests/mock_fan/test_cli.py | .py | 37c9c0c5771103cc | 7.8 | 3 |
"""Unit tests for mock_fan.gen4 fixture data and state."""
from aiomodernforms.const import (
COMMAND_FAN_DIRECTION,
COMMAND_FAN_SPEED,
COMMAND_WIND,
COMMAND_WIND_SPEED,
GEN4_DEVICE_STA_MAC,
GEN4_FIELD_ADDR,
GEN4_FIELD_FINDME,
GEN4_FIELD_LEVEL,
GEN4_FIELD_MAX_COLOR_TEMP,
GEN4_FI... | wonderslug/aiomodernforms | tests/mock_fan/test_gen4.py | .py | f84bc6279de248f9 | 7.8 | 3 |
"""Unit tests for mock_fan.generations profile data."""
from aiomodernforms.const import CONFIG_HARDWARE_REVISION, CONFIG_WIFI_STRENGTH
from mock_fan.generations import GEN1_2, GEN3, PROFILES
def test_gen1_2_uses_epoch_timers():
"""Gen 1/2 profile is marked as using epoch (not relative) timers."""
assert GEN... | wonderslug/aiomodernforms | tests/mock_fan/test_generations.py | .py | 56c542b22a2aeb06 | 7.8 | 3 |
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... | NeCTAR-RC/taynac | taynac/app.py | .py | 9931724c6c4be8f1 | 7 | 0 |
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... | NeCTAR-RC/taynac | taynac/common/config.py | .py | b91922b7c6b955dc | 7 | 0 |
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... | NeCTAR-RC/taynac | taynac/common/identity.py | .py | f7cb21268dff0ffc | 7 | 0 |
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... | NeCTAR-RC/taynac | taynac/common/keystone.py | .py | f092e48613bd3233 | 7 | 0 |
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... | NeCTAR-RC/taynac | taynac/message/drivers/freshdesk.py | .py | 0546f3969e1f17fc | 7 | 0 |
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... | NeCTAR-RC/taynac | taynac/tests/unit/message/drivers/test_freshdesk.py | .py | b5ed4965aaa522a9 | 7.5 | 0 |
# -*- coding: utf-8 -*-
# Original: https://github.com/collective/plone_clean_history
import sys
import optparse
import transaction
from ZODB.POSException import ConflictError
from Products.CMFEditions.utilities import dereference
from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.Secu... | eea/eea-website-backend | develop/scripts/clean_history.py | .py | 6b1673dabfe0197d | 7.15 | 1 |
#!/usr/bin/env python3
"""
Import v6-new_urls.csv into Redis
Key: old_url
Value: new_url
"""
import argparse
import csv
import sys
from pathlib import Path
try:
import redis # type: ignore
except ImportError:
print("Error: redis module not installed", file=sys.stderr)
print("Please install it with: pip i... | eea/eea-website-backend | develop/scripts/import_to_redis.py | .py | 383701f50e031689 | 7.15 | 1 |
#!/usr/bin/env python3
""" Usage:
python3 ims_migrate.py <input_file> <output_file>
"""
import json
import sys
from organisations import ORGANISATIONS
from uuid import uuid4
DEBUG_INSTANCE = "http://10.120.10.133:63954/www/SITE"
HOST = "https://www.eea.europa.eu/indicators"
REAL_HOST = "https://www.eea.europa.eu... | eea/eea-website-backend | develop/scripts/ims_migrate.py | .py | 28d5dca8515eacaf | 7.15 | 1 |
# -*- coding: utf-8 -*-
"""Migrate a single Folder content type to Document (in-place).
Usage:
bin/zconsole run etc/zope.conf scripts/migrate_folder_to_document.py [options] <path>
bin/zconsole run etc/relstorage.conf scripts/migrate_folder_to_document.py [options] <path>
# Dry-run (default) — logs what w... | eea/eea-website-backend | develop/scripts/migrate_folder_to_document.py | .py | 5170c9deb61fede0 | 7.15 | 1 |
#!/usr/bin/env python3
"""
MIT License
Copyright (c) 2025 Damian Zaremba
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy,... | cluebotng/trainer | cbng_trainer/cli.py | .py | d0054ce73d34908b | 7 | 0 |
#!/usr/bin/env python3
"""
MIT License
Copyright (c) 2025 Damian Zaremba
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy,... | cluebotng/trainer | cbng_trainer/common/steps.py | .py | 7200f017ee959de1 | 7 | 0 |
"""
MIT License
Copyright (c) 2025 Damian Zaremba
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish... | cluebotng/trainer | cbng_trainer/common/utils.py | .py | 47339c195094d196 | 7 | 0 |
"""
DESCRIPTION: Admin/Mod only commands reside here
"""
import discord
from discord.ext import commands
from functions.core.embeds import create_embed
from functions.core.utils import setup_logger, modal_error_check
logger = setup_logger("administrative")
class EmbedCreatorModal(discord.ui.Modal, title="Embed Crea... | aaron-rai/dollar-discord-bot | functions/admin/admin.py | .py | bb265553687583d7 | 7.15 | 1 |
"""
DESCRIPTION: Functions for Auto Channel Creation resides here
"""
#pylint: disable=not-async-context-manager
import asyncio
import discord
from contextlib import asynccontextmanager
from functions.core.utils import setup_logger
logger = setup_logger("auto-channel-creation")
DEFAULT_JOIN_CHANNEL_NAME = "JOIN HERE�... | aaron-rai/dollar-discord-bot | functions/core/autochannelcreation.py | .py | 140d4e3a8d46268b | 7.15 | 1 |
"""
DESCRIPTION: Configuration settings for the application.
Defines constants and loads environment variables for use across the codebase.
"""
import os
# pylint: disable=invalid-name
# Config attribute use UPPER_CASE by convention, not lower_case
class Config():
"""Application configuration loaded from environme... | aaron-rai/dollar-discord-bot | functions/core/config.py | .py | 467e83bc10e4c62c | 7.15 | 1 |
"""
DESCRIPTION: Database connection pooling and management service.
Provides proper connection pooling with context managers for safe cursor/connection cleanup.
"""
import time
from contextlib import contextmanager
from psycopg2 import pool
from functions.core.config import config
from functions.core.utils import set... | aaron-rai/dollar-discord-bot | functions/core/database.py | .py | ea0d1713300a6341 | 7.15 | 1 |
"""
DESCRIPTION: Common embed creation functions for the bot.
"""
import aiofiles
import discord
import os
from functions.core.utils import setup_logger
from functions.core.config import config
logger = setup_logger("embeds")
async def send_embed(title: str, image: str, msg: str, channel: discord.TextChannel, foote... | aaron-rai/dollar-discord-bot | functions/core/embeds.py | .py | 19bf3e91acfdc585 | 7.15 | 1 |
"""
DESCRIPTION: Common utility functions used across the bot
"""
import discord
import logging
import logging.handlers
import pytz
from datetime import datetime
from discord.ext import commands
def setup_logger(logger_name: str) -> logging.Logger:
"""
Set up and configure a rotating file logger and stdout logger ... | aaron-rai/dollar-discord-bot | functions/core/utils.py | .py | c6cdeef00641e364 | 7.15 | 1 |
"""
DESCRIPTION: Debugging functions reside here
"""
import io
import aiohttp
import aiofiles
import discord
import os
import logging
import time
import psutil
from discord.ext import commands
from functions.core.config import config
from functions.core.embeds import create_embed
from functions.core.utils import setup... | aaron-rai/dollar-discord-bot | functions/diagnostic/debugging.py | .py | c88abee08c68455d | 7.15 | 1 |
"""
Dollar Customization Settings
"""
import discord
from discord.ext import commands
from functions.core.utils import setup_logger, modal_error_check, is_guild_owner_interaction
logger = setup_logger("settings")
class SettingsModal(discord.ui.Modal, title="DollarSettings"):
"""
DESCRIPTION: Creates Settings Moda... | aaron-rai/dollar-discord-bot | functions/diagnostic/settings.py | .py | f47362f95ef04db7 | 7.15 | 1 |
"""
This file contains the functions for the push notifications.
"""
import discord
from discord.ext import commands
from functions.core.embeds import create_embed
from functions.core.utils import setup_logger, convert_time_zone
logger = setup_logger("notifications")
@discord.app_commands.context_menu(name="Poke Us... | aaron-rai/dollar-discord-bot | functions/notifications/push_notifications.py | .py | 242a1b3240005f88 | 7.15 | 1 |
"""EmBody protocol codec."""
__all__ = ["__version__"]
def __getattr__(name: str) -> str:
"""Resolve __version__ lazily (PEP 562).
importlib.metadata pulls in the email parser and costs ~25ms at import time, which
every consumer of this library would otherwise pay just to import a codec. Doing it
he... | aidee-health/embody-codec | src/embodycodec/__init__.py | .py | 450506dc04692acd | 7 | 0 |
from embodycodec.crc import crc16
def test_crc() -> None:
crc = crc16(b"\x12\x00\x06\xa1")
assert crc == 32098
def test_crc_partial() -> None:
crc = crc16(b"\x12\x00")
crc = crc16(data=b"\x06\xa1", existing_crc=crc)
assert crc == 32098
def test_crc_with_zero_existing() -> None:
"""Test tha... | aidee-health/embody-codec | tests/test_crc.py | .py | cbf039acbf48e4c0 | 7.5 | 0 |
"""Test ExecuteCommand and ExecuteCommandResponse edge cases."""
import pytest
from embodycodec import codec
from embodycodec import types
def test_execute_command_decode_payload_extraction():
"""Test that ExecuteCommand.decode() extracts only the payload bytes."""
# Create a valid ExecuteCommand message wi... | aidee-health/embody-codec | tests/test_execute_command.py | .py | 0c60ef012ab7bb97 | 7.5 | 0 |
"""Regression tests for variable-length payloads.
The original test suite only asserted round-trips for fixed-size payloads, which hid a
family of defects in every attribute and complex type whose encoded size is not static.
Each test here fails against the code as it was before these were fixed.
"""
import pytest
f... | aidee-health/embody-codec | tests/test_variable_length_payloads.py | .py | 24aa7e696e9bbf35 | 7.5 | 0 |
#!/usr/bin/env python
"""Ingest ATLAS data files.
Usage:
%s <configfile> <regex> [--ingester=<ingester>] [--days=<days>] [--maxjobs=<maxjobs>] [--camera=<camera>] [--mjd=<mjd>] [--verbose] [--atlasroot=<atlasroot>] [--pid=<pid>] [--loglocation=<loglocation>] [--logprefix=<logprefix>] [--difflocation=<difflocation>]
... | genghisken/psat-server | psat-server/scripts/ingest/python/ingesterWrapperMultiprocess.py | .py | 1108595db598b7cb | 7.15 | 1 |
#!/usr/bin/python
from astropy.io import fits as pyfits
#import pyfits
import pylab
import random
import numpy as np
class TargetImage(object):
# 2023-08-21 KWS Introduced magicNumber for ATLAS integer images.
def __init__(self, fitsFile, extent=10, extension=1, magicNumber=None):
"""
fit... | genghisken/psat-server | psat-server/scripts/ml/cnn/python/TargetImage.py | .py | f0e11ca925e7a7c4 | 7.15 | 1 |
"""
PyTorch triplet-CNN inference for Pan-STARRS postage stamps.
Loads target/ref/diff FITS triplets with z-scale normalisation and returns
per-image real-bogus probabilities compatible with the legacy psat-ml pipeline.
"""
from __future__ import annotations
import logging
import os
from collections impor... | genghisken/psat-server | psat-server/scripts/ml/cnn/python/cnn_inference.py | .py | 61aeb8cadd71d9a8 | 7.15 | 1 |
"""
Pan-STARRS catalogue XGBoost utilities (Python 3).
Shadow-mode scoring for live pipeline objects. Model training lives in 5.XGBOOST.py.
"""
from __future__ import annotations
import os
import time
from dataclasses import dataclass
from pathlib import Path
from typing import Any
import numpy as np
import pandas ... | genghisken/psat-server | psat-server/scripts/ml/xgb/python/xgb_catalogue_utils.py | .py | b2c57803dbe6a62a | 7.15 | 1 |
#!/usr/bin/env python
"""Make an ATLAS stamp given the RA and Dec and exposure ID (a wrapper for ATLAS pix2sky and monsta)
Usage:
%s <exposure> <coords> [--outputfile=<outputfile>] [--stampsize=<stampsize>] [--stamplocation=<location>] [--test] [--edge]
%s (-h | --help)
%s --version
Options:
-h --help ... | genghisken/psat-server | psat-server/scripts/stamps/python/makeATLASStamp.py | .py | 1eeaa55b4c16dc64 | 7.15 | 1 |
#!/usr/bin/env python
"""Request Pan-STARRS forced photometry
Usage:
%s <configFile> [<candidate>...] [--test] [--listid=<listid>] [--customlist=<customlistid>] [--flagdate=<flagdate>] [--limitdays=<limitdays>] [--limitdaysafter=<limitdaysafter> ] [--usefirstdetection] [--overlapdays=<overlapdays>] [--overrideflags]... | genghisken/psat-server | psat-server/scripts/stamps/python/requestPSForcedPhotometry.py | .py | 291eb19b57530af6 | 7.15 | 1 |
#!/usr/bin/env python
# The only required additional python module for this code is "requests" (pip install requests).
import requests
import json
import time
import logging
# Hurl the log info into a default log file. We'll use debug level by default.
logging.basicConfig(filename='/tmp/tns.log', format='%(asctime)s ... | genghisken/psat-server | psat-server/scripts/tns/python/tnsAPI.py | .py | fe917fff8747379d | 7.15 | 1 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
__author__ = 'Roberto Valle'
__email__ = 'roberto.valle@upm.es'
import os
import sys
sys.path.append(os.getcwd())
import numpy as np
from tqdm import tqdm
from sklearn.metrics import confusion_matrix, accuracy_score, recall_score, precision_score
from eval_tools import draw_co... | pcr-upm/images_framework | output/eval_recognition.py | .py | 78ae5878c78b5170 | 7.39 | 5 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
__author__ = 'Roberto Valle'
__email__ = 'roberto.valle@upm.es'
import os
import sys
sys.path.append(os.getcwd())
import argparse
import numpy as np
from PIL import Image
from tqdm import tqdm
from sklearn.metrics import confusion_matrix
from eval_tools import draw_confusion_m... | pcr-upm/images_framework | output/eval_segmentation.py | .py | 31264290ecf707d4 | 7.39 | 5 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
__author__ = 'Roberto Valle'
__email__ = 'roberto.valle@upm.es'
from enum import Enum, unique
@unique
class PersonLandmarkPart(Enum):
"""
Person landmark part label.
"""
FACE = 'face'
HAND = 'hand'
BODY = 'body'
@unique
class FaceLandmarkPart(Enum):... | pcr-upm/images_framework | regression/alignment/landmarks.py | .py | 2a9a6d574dcc879b | 7.39 | 5 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
__author__ = 'Roberto Valle'
__email__ = 'roberto.valle@upm.es'
import uuid
import numpy as np
from enum import Enum
from scipy.spatial.transform import Rotation
from .categories import Name
from images_framework.regression.alignment.landmarks import PersonLandmarkPart as Pl
... | pcr-upm/images_framework | src/annotations.py | .py | ea2820a650a874fb | 7.39 | 5 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
__author__ = 'Roberto Valle'
__email__ = 'roberto.valle@upm.es'
import abc
class Name:
def __init__(self, name):
self.name = name
class Category(object):
"""
Category label.
"""
__metaclass__ = abc.ABCMeta
BACKGROUND = Name('Background')
... | pcr-upm/images_framework | src/categories.py | .py | c08b7970e43ce620 | 7.39 | 5 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
__author__ = 'Roberto Valle'
__email__ = 'roberto.valle@upm.es'
from .component import Component
class Composite(Component):
"""
Store child components. Implement child-related operations in the Component interface.
"""
def __init__(self):
super().__i... | pcr-upm/images_framework | src/composite.py | .py | 170159d8ec4f08e2 | 7.39 | 5 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
__author__ = 'Roberto Valle'
__email__ = 'roberto.valle@upm.es'
from enum import Enum, unique
@unique
class Modes(Enum):
"""
Different types of experiments.
"""
TRAIN = 'train'
TEST = 'test'
@unique
class Parts(Enum):
"""
Different types of comp... | pcr-upm/images_framework | src/constants.py | .py | 184323e3704395c3 | 7.39 | 5 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
__author__ = 'Roberto Valle'
__email__ = 'roberto.valle@upm.es'
import abc
import cv2
import math
import numpy as np
from .component import Component
from .datasets import Database
class Detection(Component):
"""
Represent detection instances in the composition.
... | pcr-upm/images_framework | src/detection.py | .py | 3f34872bdbab4ecd | 7.39 | 5 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
__author__ = 'Roberto Valle'
__email__ = 'roberto.valle@upm.es'
import abc
from .component import Component
from .datasets import Database
class Generation(Component):
"""
Represent generation instances in the composition.
"""
def __init__(self):
supe... | pcr-upm/images_framework | src/generation.py | .py | 0edfb8d13aafdcae | 7.39 | 5 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
__author__ = 'Roberto Valle'
__email__ = 'roberto.valle@upm.es'
import os
import abc
import cv2
import json
import itertools
import numpy as np
from .component import Component
from .detection import Detection
from .datasets import Database
class Recognition(Component):
... | pcr-upm/images_framework | src/recognition.py | .py | eebb26f6cc4e3be8 | 7.39 | 5 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
__author__ = 'Roberto Valle'
__email__ = 'roberto.valle@upm.es'
import abc
import cv2
import itertools
import numpy as np
from .component import Component
from .datasets import Database
class Segmentation(Component):
"""
Represent segmentation instances in the compos... | pcr-upm/images_framework | src/segmentation.py | .py | 09355ac72904a627 | 7.39 | 5 |
#!/usr/bin/env python
"""Backfill per-release benchmark history by running the suite against each published version.
For every release tag (>= a minimum version), this installs that ``id-translation`` release into an isolated,
ephemeral ``uv`` environment and runs the *current* benchmark harness against it (the harnes... | rsundqvist/id-translation | benchmark/scripts/backfill.py | .py | 98d21d678b7f2b3a | 7 | 0 |
"""Feature detection for the *installed* ``id_translation`` version.
The suite is run against many historical releases (see ``scripts/backfill.py``), so it must degrade gracefully
when an API does not exist yet rather than crashing. Detection is by introspection, not version parsing.
"""
import inspect
from functools... | rsundqvist/id-translation | benchmark/src/id_translation_benchmark/capabilities.py | .py | 8be5dbb44bc5b563 | 7 | 0 |
"""CI entry point: run the portable history config, render a report, optionally persist the JSON.
Usage::
# PR / push: measure current code, compare to the latest recorded release, write a report (no commit).
python -m id_translation_benchmark.ci
# Release: record this version's data point under benchmar... | rsundqvist/id-translation | benchmark/src/id_translation_benchmark/ci.py | .py | abf8ce2625a00f72 | 7 | 0 |
"""Generation of ID data for benchmarking.
The goal is to produce *realistic* translatable payloads cheaply (outside of the timed region) so that the
benchmark measures :meth:`id_translation.Translator.translate` and not data construction.
Two knobs shape an ID array:
* ``n`` -- the number of rows (the headline scal... | rsundqvist/id-translation | benchmark/src/id_translation_benchmark/data.py | .py | caf88ca8b12a70a2 | 7 | 0 |
"""Per-release performance history: a portable config + JSON (de)serialization.
The history config is deliberately small and **portable** so the same measurement runs against every backfilled
release: default-settings candidates (no IO knobs, which only exist from 1.1.0) on the vectorized int / str /
stringified-UUID ... | rsundqvist/id-translation | benchmark/src/id_translation_benchmark/history.py | .py | 86357ba34766a485 | 7 | 0 |
"""Per-case payload construction: the translator + the containers it will translate.
We build an **offline** :class:`~id_translation.Translator` (the full universe of IDs is pre-fetched into an
in-memory map). This deliberately makes the fetch stage a cheap dict lookup so that the timed work is dominated by
the backen... | rsundqvist/id-translation | benchmark/src/id_translation_benchmark/payload.py | .py | f9995ad2da16b4e3 | 7 | 0 |
"""Render a benchmark run as Markdown (for ``$GITHUB_STEP_SUMMARY`` / PR comments) and flag regressions.
Policy: **report-only**. Regressions are flagged loudly but never fail the job -- GitHub-hosted runners are too
noisy for a hard gate. The flagging threshold is deliberately generous for the same reason.
"""
from ... | rsundqvist/id-translation | benchmark/src/id_translation_benchmark/report.py | .py | d4525cfef7534c59 | 7 | 0 |
"""Benchmark configuration and execution.
A run compares **candidates** across a grid of data variants. A candidate is a ``(backend, io_kwargs)`` pair --
this lets us measure not just pandas-vs-polars, but the IO knobs that have a large effect on performance:
:class:`~id_translation.dio.integration.pandas.PandasIO` ``... | rsundqvist/id-translation | benchmark/src/id_translation_benchmark/suite.py | .py | 467baf72c5578a54 | 7 | 0 |
"""Nox sessions."""
import os
import platform
import re
import nox
from nox.sessions import Session
nox.options.default_venv_backend = "uv"
nox.options.sessions = ["tests", "mypy"]
python_versions = ["3.11", "3.12", "3.13", "3.14"]
def install(session: Session) -> None:
"""Install the project using uv."""
... | rsundqvist/id-translation | noxfile.py | .py | 0f32de04ef145c18 | 7 | 0 |
from collections.abc import Mapping
from time import perf_counter
from typing import TYPE_CHECKING, Any, Generic
from rics.misc import get_public_module
from ..logging import generate_task_id
if TYPE_CHECKING:
from .._translator import Translator
from ..dio import DataStructureIO, resolve_io
from ..types import... | rsundqvist/id-translation | src/id_translation/_tasks/_base_task.py | .py | e93e47720ef596cf | 7 | 0 |
import logging
from collections.abc import Mapping
from time import perf_counter
from typing import TYPE_CHECKING, Any
from rics.strings import format_seconds as fmt_sec
from .. import logging as _logging
from .._utils.emit_warning import emit_warning
from ..exceptions import TranslationAbortedWarning
from ..mapping.... | rsundqvist/id-translation | src/id_translation/_tasks/_map.py | .py | ad96dd6f123238d0 | 7 | 0 |
import logging
from collections.abc import Mapping
from typing import TYPE_CHECKING, Any, Generic
from rics.collections.misc import as_list
from .._utils.emit_warning import emit_warning
from ..mapping.exceptions import MappingWarning
if TYPE_CHECKING:
from .._translator import Translator
from ..exceptions impo... | rsundqvist/id-translation | src/id_translation/_tasks/_names.py | .py | 5c75d2b25db145b0 | 7 | 0 |
"""Handler which pretty-prints (color) logger output to stdout.
Used by :func:`~id_translation.logging.enable_verbose_debug_messages`.
"""
import logging
from datetime import datetime
from enum import StrEnum
from random import shuffle
from re import Match, compile
from threading import Lock
from types import Traceba... | rsundqvist/id-translation | src/id_translation/_utils/debug_logging_formatter.py | .py | ad8d94748f46bec8 | 7 | 0 |
"""Utilities for emitting warnings with accurate stack levels."""
from id_translation import logging as _logging
_USER_PREFIXES: set[str] = set()
def add_skip_file_prefix(path: str) -> None:
"""Add a path to skip in warnings.
Useful e.g. for internal libraries that are based on the https://github.com/rsund... | rsundqvist/id-translation | src/id_translation/_utils/emit_warning.py | .py | aeb2e5ee9dd4337b | 7 | 0 |
from collections.abc import Sequence
from typing import Any
from uuid import UUID
def try_cast_many(ids: Sequence[Any]) -> Sequence[Any]:
"""Try casting `ids` to UUIDs, falling back to the original input."""
if len(ids) == 0:
return ids
try:
return list(map(UUID, ids))
except (ValueEr... | rsundqvist/id-translation | src/id_translation/_uuid_utils.py | .py | f6919deffdf01893 | 7 | 0 |
"""Insertion and extraction of IDs and translations."""
from abc import abstractmethod
from collections.abc import Sequence
from typing import Any, ClassVar, Generic
from ..offline import TranslationMap
from ..types import IdType, NameType, SourceType, TranslatableT
from .exceptions import DataStructureIOError
clas... | rsundqvist/id-translation | src/id_translation/dio/_data_structure_io.py | .py | 0966585fe9aff77f | 7 | 0 |
import logging
from collections.abc import Iterable, Mapping
from importlib.metadata import entry_points
from inspect import signature
from time import perf_counter
from typing import Any
from rics.misc import tname
from .._utils.emit_warning import emit_warning
from ..types import TranslatableT
from ._data_structure... | rsundqvist/id-translation | src/id_translation/dio/_repository.py | .py | 8ca88620b60af56d | 7 | 0 |
from collections.abc import Mapping
from threading import Lock
from typing import Any
from .._utils.emit_warning import emit_warning
from ..types import IdType, NameType, SourceType, TranslatableT
from ._data_structure_io import DataStructureIO
from ._repository import ENTRYPOINT_GROUP, AnyIoType, Repository
_INSTANC... | rsundqvist/id-translation | src/id_translation/dio/_resolve.py | .py | 359bcc248dfa65b8 | 7 | 0 |
import os
from collections.abc import Callable, Sequence
from typing import TYPE_CHECKING, Any, TypeVar
from rics.collections.misc import as_list
from id_translation.offline import TranslationMap
from id_translation.types import IdType, NameType, SourceType
from .._data_structure_io import DataStructureIO
from ..exc... | rsundqvist/id-translation | src/id_translation/dio/default/_sequence.py | .py | 66ad359692f9e46e | 7 | 0 |
# Copyright (C) 2022 - 2026 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limita... | ansys/pymaterials-manager | src/ansys/materials/manager/integrations/_common.py | .py | 6a50296b94af21dd | 7 | 0 |
# Copyright (C) 2022 - 2026 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limita... | ansys/pymaterials-manager | src/ansys/materials/manager/integrations/base_visitor.py | .py | 82e05cad4e982fe6 | 7 | 0 |
# Copyright (C) 2022 - 2026 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limita... | ansys/pymaterials-manager | src/ansys/materials/manager/integrations/fluent/fluent_writer.py | .py | 2201d8d6c0faeba0 | 7 | 0 |
# Copyright (C) 2022 - 2026 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limita... | ansys/pymaterials-manager | src/ansys/materials/manager/integrations/lsdyna/lsdyna_writer.py | .py | 9819e733df3c9f50 | 7 | 0 |
# Copyright (C) 2022 - 2026 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limita... | ansys/pymaterials-manager | src/ansys/materials/manager/integrations/mapdl/_mapdl_utils.py | .py | abb50bf642b0b4f5 | 7 | 0 |
# Copyright (C) 2022 - 2026 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limita... | ansys/pymaterials-manager | src/ansys/materials/manager/integrations/mapdl/mapdl_reader.py | .py | 3e3170aff8dee69d | 7 | 0 |
# Copyright (C) 2022 - 2026 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limita... | ansys/pymaterials-manager | src/ansys/materials/manager/integrations/mapdl/mapdl_writer.py | .py | e23413d859c2aeb4 | 7 | 0 |
# Copyright (C) 2022 - 2026 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limita... | ansys/pymaterials-manager | src/ansys/materials/manager/integrations/material_model_writer_visitor.py | .py | 01ff94d82db59b03 | 7 | 0 |
# Copyright (C) 2022 - 2026 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limita... | ansys/pymaterials-manager | src/ansys/materials/manager/integrations/matml/_matml_parser.py | .py | 5b6ae915cc00c047 | 7 | 0 |
# Copyright (C) 2022 - 2026 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limita... | ansys/pymaterials-manager | src/ansys/materials/manager/integrations/matml/_matml_utils.py | .py | 95e3b4c58a7c27e7 | 7 | 0 |
# Copyright (C) 2022 - 2026 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limita... | ansys/pymaterials-manager | src/ansys/materials/manager/integrations/matml/matml_writer.py | .py | 57bc9a9eddb4823f | 7 | 0 |
# Copyright (C) 2022 - 2026 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limita... | ansys/pymaterials-manager | src/ansys/materials/manager/integrations/rest/_grantami_auth.py | .py | 543dd42cae3a0334 | 7 | 0 |
# Copyright (C) 2022 - 2026 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limita... | ansys/pymaterials-manager | src/ansys/materials/manager/integrations/rest/_rest_model_map.py | .py | 6937317adc3dbfc6 | 7 | 0 |
# Copyright (C) 2022 - 2026 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limita... | ansys/pymaterials-manager | src/ansys/materials/manager/integrations/rest/_rest_reader.py | .py | fdde1bbf1619af0d | 7 | 0 |
# Copyright (C) 2022 - 2026 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limita... | ansys/pymaterials-manager | src/ansys/materials/manager/integrations/rest/rest_material_reader.py | .py | db83b0611cb114dc | 7 | 0 |
# Copyright (C) 2022 - 2026 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limita... | ansys/pymaterials-manager | src/ansys/materials/manager/integrations/rest/rest_session_client.py | .py | c722ac99253da06a | 7 | 0 |
# Copyright (C) 2022 - 2026 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limi... | ansys/pymaterials-manager | src/ansys/materials/manager/material_manager.py | .py | 5cd588659c33b067 | 7 | 0 |
# Copyright (C) 2022 - 2026 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limita... | ansys/pymaterials-manager | src/ansys/materials/manager/models/_common/common.py | .py | 99e8085050613493 | 7 | 0 |
# Copyright (C) 2022 - 2026 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limita... | ansys/pymaterials-manager | src/ansys/materials/manager/models/_common/tabular_quantity.py | .py | dddafc425e9bf6b4 | 7 | 0 |
# Copyright (C) 2022 - 2026 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limita... | ansys/pymaterials-manager | src/ansys/materials/manager/models/_material_models/cofficient_of_thermal_expansion_isotropic.py | .py | abeb59a9639266b2 | 7 | 0 |
# Copyright (C) 2022 - 2026 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limita... | ansys/pymaterials-manager | src/ansys/materials/manager/models/_material_models/cofficient_of_thermal_expansion_orthotropic.py | .py | bdf5238b05679b4a | 7 | 0 |
import argparse
import os
import sys
from pathlib import Path
import pandas as pd
from tabulate import tabulate
from streetscape_metadata_tracker.analysis import analyze_gsv_status
def format_status_table(df: pd.DataFrame) -> str:
"""Format status code counts and percentages as a table."""
stats = analyze_g... | jonfroehlich/streetscape-tracker | check_status_codes.py | .py | 4dc90adf10984df0 | 7.24 | 2 |
#!/usr/bin/env python3
"""
Multi-city runner for Streetscape Metadata Tracker.
This script provides a wrapper around the Streetscape Metadata Tracker to process multiple cities.
Each line in the input file represents a complete command line style configuration for a city.
Example cities.txt format:
Seattle, WA --... | jonfroehlich/streetscape-tracker | run_cities.py | .py | b3f95231968169b7 | 7.24 | 2 |
#!/usr/bin/env python3
"""
Apply reviewed boundary decisions back to the catalog (issue #91, part 3).
Closes the human-in-the-loop: ``scripts/build_boundary_review.py`` renders each
flagged city and the reviewer exports ``boundary_decisions.csv`` (one row per
city with a ``decision`` and the ``chosen_*`` geometry). Th... | jonfroehlich/streetscape-tracker | scripts/apply_decisions.py | .py | 9e099b50c40a6ccc | 7.24 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.