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
""" Astoria WiFi Daemon. Manages a WiFi hotspot for the robot. """ import asyncio import logging import os import signal import tempfile from typing import IO from astoria.common.config.system import WiFiInfo from .lifecycle import AccessPointInfo, WiFiLifecycle LOGGER = logging.getLogger(__name__) class WiFiHot...
srobo/astoria
astoria/astwifid/hotspot_lifecycle.py
.py
af178a3aa234d9a0
7.3
3
"""Definition for a WiFi lifecycle.""" from abc import ABCMeta, abstractmethod from typing import NamedTuple from astoria.common.config.system import WiFiInfo class AccessPointInfo(NamedTuple): """The information required for an Access Point.""" ssid: str psk: str region: str class WiFiLifecycle(...
srobo/astoria
astoria/astwifid/lifecycle.py
.py
0ec2b63ee9968969
7.3
3
""" Astoria WiFi Daemon. Manages a WiFi hotspot for the robot. """ import asyncio import logging from pathlib import Path from astoria.common.components import StateManager from astoria.common.ipc import WiFiManagerMessage from astoria.common.metadata import Metadata from astoria.common.mixins import MetadataHandler...
srobo/astoria
astoria/astwifid/wifi_manager.py
.py
552097e1f7ab24c3
7.3
3
""" Data Component base class. A data component represents the common functionality between State Managers and Consumers. It handles connecting to the broker and managing the event loop. """ import asyncio import logging import signal import sys from abc import ABCMeta, abstractmethod from signal import SIGHUP, SIGIN...
srobo/astoria
astoria/common/components/component.py
.py
fea167a46538798f
7.3
3
"""State Manager base class.""" import logging from abc import ABCMeta, abstractmethod from collections.abc import Callable, Coroutine from re import Match from typing import TypeVar from pydantic import PydanticUserError, TypeAdapter, ValidationError from astoria.common.ipc import ManagerMessage, ManagerRequest, Re...
srobo/astoria
astoria/common/components/manager.py
.py
014377872b470bd5
7.3
3
""" System Configuration schema for Astoria. Common to all components. """ import tomllib from pathlib import Path from typing import BinaryIO, ClassVar from pydantic import BaseModel, ConfigDict, TypeAdapter class MQTTBrokerInfo(BaseModel): """MQTT Broker Information.""" host: str port: int enabl...
srobo/astoria
astoria/common/config/system.py
.py
6e23ecfb97311261
7.3
3
"""User config file schema.""" import random import re import secrets import tomllib from pathlib import Path from typing import ClassVar from pydantic import BaseModel, ConfigDict, TypeAdapter, ValidationError, field_validator from astoria.common.config import AstoriaConfig SSID_PREFIX = "robot-" MAX_SSID_LENGTH =...
srobo/astoria
astoria/common/config/user.py
.py
7612645eed1daa2d
7.3
3
"""Class to determine the type of a disk.""" from pathlib import Path from astoria.common.config import RobotSettings, RobotSettingsException from .constraints import Constraint, FilePresentConstraint, TrueConstraint from .structs import DiskType class DiskTypeCalculator: """ Helper class to calculate the ...
srobo/astoria
astoria/common/disks/type_calculator.py
.py
3e75563424f114e1
7.3
3
"""Broadcast Event Schemas.""" from enum import Enum from typing import ClassVar from pydantic import BaseModel class BroadcastEvent(BaseModel): """Schema for a broadcast event.""" name: ClassVar[str] event_name: str sender_name: str priority: int = 0 def __gt__(self, other: "BroadcastEve...
srobo/astoria
astoria/common/ipc/broadcast_event.py
.py
bae261453e640ab2
7.3
3
"""Manager Messages.""" from enum import Enum from pathlib import Path from pydantic import BaseModel from astoria import __version__ from astoria.common.code_status import CodeStatus from astoria.common.disks import DiskInfo, DiskTypeCalculator, DiskUUID from astoria.common.metadata import Metadata class ManagerM...
srobo/astoria
astoria/common/ipc/manager_messages.py
.py
a9ac3a1e36d7a0b4
7.3
3
""" Base utilities for building annotation-based Sphinx extensions. """ from code_annotations.base import AnnotationConfig from code_annotations.find_static import StaticSearch def find_annotations(source_path, config_path, group_by_key): """ Find the feature toggles as defined in the configuration file. ...
openedx/code-annotations
code_annotations/contrib/sphinx/extensions/base.py
.py
b160b19d3c19bfc5
7.39
5
""" Sphinx extension for viewing feature toggle annotations. """ import os from docutils import nodes from sphinx.util.docutils import SphinxDirective from code_annotations.contrib.config import FEATURE_TOGGLE_ANNOTATIONS_CONFIG_PATH from .base import find_annotations, quote_value def find_feature_toggles(source_p...
openedx/code-annotations
code_annotations/contrib/sphinx/extensions/featuretoggles.py
.py
897ce2946209506e
7.39
5
""" Sphinx extension for viewing (non-toggle) setting annotations. """ import os from docutils import nodes from docutils.parsers.rst import directives from sphinx.util.docutils import SphinxDirective from code_annotations.contrib.config import SETTING_ANNOTATIONS_CONFIG_PATH from .base import find_annotations, quot...
openedx/code-annotations
code_annotations/contrib/sphinx/extensions/settings.py
.py
e205260aac7039e0
7.39
5
""" Abstract and base classes to support plugins. """ import re from abc import ABCMeta, abstractmethod from code_annotations.helpers import clean_abs_path, clean_annotation, get_annotation_regex class AnnotationExtension(metaclass=ABCMeta): """ Abstract base class that annotation extensions will inherit fro...
openedx/code-annotations
code_annotations/extensions/base.py
.py
52977bd50b93d7d2
7.39
5
""" Annotation searcher for Django model comment searching Django introspection. """ import inspect import os import sys import django import yaml from django.apps import apps from django.db import models from code_annotations.base import BaseSearch from code_annotations.helpers import clean_annotation, fail, get_an...
openedx/code-annotations
code_annotations/find_django.py
.py
6da0fe4cedfa71ff
7.39
5
""" Annotation searcher for static comment searching via Stevedore plugins. """ import os from code_annotations.base import BaseSearch class StaticSearch(BaseSearch): """ Handles static code searching for annotations. """ def search_extension(self, ext, file_handle, file_extensions_map, filename_ex...
openedx/code-annotations
code_annotations/find_static.py
.py
44b2bfe5ec265f60
7.39
5
""" Contains functionality for turning YAML reports into human-readable documentation. """ import collections import datetime import os import jinja2 import yaml from slugify import slugify class ReportRenderer: """ Generates human readable documentation from YAML reports. """ def __init__(self, co...
openedx/code-annotations
code_annotations/generate_docs.py
.py
5a6faf28e0d176ed
7.39
5
#!/usr/bin/env python """ Package metadata for code_annotations. """ import os import re import sys from setuptools import setup def get_version(*file_paths): """ Extract the version string from the file at the given relative path fragments. """ filename = os.path.join(os.path.dirname(__file__), *fi...
openedx/code-annotations
setup.py
.py
b0c09747bb956918
7.39
5
""" Tests for the extension base classes """ import re from code_annotations.extensions.base import SimpleRegexAnnotationExtension from code_annotations.helpers import VerboseEcho from tests.helpers import FakeConfig class FakeExtension(SimpleRegexAnnotationExtension): extension_name = 'fake_extension' lan...
openedx/code-annotations
tests/extensions/test_base_extensions.py
.py
fae73ec655fa2f17
7.89
5
""" Helper code shared between tests. """ import os import re from click.testing import CliRunner from code_annotations.base import BaseSearch, VerboseEcho from code_annotations.cli import entry_point EXIT_CODE_SUCCESS = 0 EXIT_CODE_FAILURE = 1 DEFAULT_FAKE_SAFELIST_PATH = 'fake_safelist_path.yaml' FAKE_CONFIG_FILE...
openedx/code-annotations
tests/helpers.py
.py
973a826ba36ed151
7.89
5
""" Tests for the DjangoSearch coverage functionality. """ from unittest.mock import DEFAULT, patch import pytest from code_annotations.find_django import DjangoSearch from tests.fake_models import ( FakeBaseModelAbstract, FakeBaseModelBoring, FakeBaseModelBoringWithAnnotations, FakeBaseModelNoAnnotat...
openedx/code-annotations
tests/test_django_coverage.py
.py
5b9ef16a1eb507fa
7.89
5
#!/usr/bin/env python """ Tests for seeding the safelist. """ import os from unittest.mock import DEFAULT, MagicMock, patch import pytest from code_annotations.find_django import DjangoSearch from tests.helpers import DEFAULT_FAKE_SAFELIST_PATH, EXIT_CODE_FAILURE, EXIT_CODE_SUCCESS, call_script_isolated @patch.mult...
openedx/code-annotations
tests/test_django_generate_safelist.py
.py
3edfbebede37273c
7.89
5
""" Tests for the StaticSearch/DjangoSearch API. """ from code_annotations import annotation_errors from code_annotations.base import AnnotationConfig from code_annotations.find_static import StaticSearch def test_annotation_errors(): config = AnnotationConfig( "tests/test_configurations/.annotations_tes...
openedx/code-annotations
tests/test_search.py
.py
3c17a7263d067862
7.89
5
""" Test sphinx extensions. """ from code_annotations.contrib.sphinx.extensions.base import find_annotations, quote_value def test_collect_pii_for_sphinx(): annotations = find_annotations( "tests/extensions/python_test_files/simple_success.pyt", "tests/test_configurations/.annotations_test", ...
openedx/code-annotations
tests/test_sphinx.py
.py
02605df6dbd38a3d
7.89
5
"""Publishes an empty message to the "report_requested" topic whenever the button is pressed. Code borrowed from: http://effbot.org/tkinterbook/ Author: Nathan Sprague Version: 11/2020 """ from tkinter import * import rclpy from std_msgs.msg import Empty class ReportButton(object): """ Node that presents a tk...
JMU-ROBOTICS-VIVA/zeta_competition
zeta_competition/zeta_competition/report_button.py
.py
c4b7ed0df77e263a
7.15
1
""" Code to publish victim messages for the purposes of testing competition code. """ import rclpy import rclpy.node import numpy as np import cv2 import sys from cv_bridge import CvBridge, CvBridgeError from zeta_competition_interfaces.msg import Victim from sensor_msgs.msg import Image import time class VictimPubl...
JMU-ROBOTICS-VIVA/zeta_competition
zeta_competition/zeta_competition/victim_pub.py
.py
5a31f3b469df34cd
7.15
1
from typing import Dict from typing import List from typing import Sequence from typing import TypedDict import requests DEFAULT_ALERTMANAGER_TIMEOUT_S = 60 class AlertStatus(TypedDict): state: str silencedBy: List[str] inhibitedBy: List[str] mutedBy: List[str] class Receiver(TypedDict): name:...
Yelp/sticht
sticht/alertmanager.py
.py
415a99b84f82d5f8
7.35
4
# Copyright 2019 Yelp Inc. # # 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, so...
Yelp/sticht
sticht/rollbacks/slo.py
.py
b0b2620d4b330afd
7.35
4
import glob import os from typing import List DEFAULT_SOA_DIR = '/nail/etc/services' def get_cluster_from_soaconfigs_filename(filename: str) -> str: """Given a file like {type}-{cluster}.yaml, returns {cluster}""" basename, _ = os.path.splitext(os.path.basename(filename)) _, cluster = basename.split('-',...
Yelp/sticht
sticht/rollbacks/soaconfigs.py
.py
4d8d7968eac712b4
7.35
4
import logging import threading import time from datetime import datetime from datetime import timezone from typing import Dict from typing import List from typing import Optional from typing import Tuple from typing_extensions import Protocol import sticht.metrics as metrics from sticht.alertmanager import Alert fro...
Yelp/sticht
sticht/rollbacks/sources/alertmanager.py
.py
7421019da172bed0
7.35
4
# Copyright 2019 Yelp Inc. # # 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, so...
Yelp/sticht
sticht/signalfx.py
.py
e787309bd2b00719
7.35
4
# Copyright 2019 Yelp Inc. # # 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, so...
Yelp/sticht
sticht/slack.py
.py
7381ec3abc5cc994
7.35
4
# Copyright 2019 Yelp Inc. # # 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, so...
Yelp/sticht
sticht/state_machine.py
.py
f7b25818c98021e8
7.35
4
# Copyright 2019 Yelp Inc. # # 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, so...
Yelp/sticht
tests/test_slack.py
.py
48ddb48aa7547dba
7.85
4
"""Stellt jeder Seite zwei Angaben fuer den Kopf bereit. * `page_locales` — in welchen Sprachen es diese Seite *wirklich* gibt. Nicht alle vier: eine Admin-Seite, die nur auf Deutsch und Englisch vorliegt, soll auch nur «de | en» anzeigen. Die Fallback-Fassungen unter /fr/ und /it/ zeigen deutschen Text und sind...
kraenzle-ritter/anton-documentation
hooks/page_meta.py
.py
8486fb1c12f1f448
7
0
#!/usr/bin/env python3 """ Erzeugt den Referenzblock in docs/admin/console-commands.md aus `php artisan list`. Die Befehle leben in ../anton.test (app/Console/Commands/); ihre Beschreibungen laufen der handgeschriebenen Doku sonst davon (zuletzt 87 Befehle im Code, 21 dokumentiert). Dieser Generator hält die *vollstän...
kraenzle-ritter/anton-documentation
scripts/gen-command-reference.py
.py
a465cdb9ab7051cb
7
0
#!/usr/bin/env python3 # # Copyright 2014 Rackspace Australia # Copyright 2018-2019 Red Hat, Inc # Copyright 2021 Acme Gating, LLC # # 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://w...
GerritCodeReview/zuul_config
roles/gcs-upload/library/gcs_upload.py
.py
bee3fbd51cc5257f
7
0
from __future__ import annotations import json import time import requests from urllib.parse import quote from mutalyzer_retriever.request import Http400, request from mutalyzer_retriever.configuration import DEFAULT_TIMEOUT, settings from mutalyzer_retriever.util import HUMAN_TAXON class BaseAPIClient: """Base c...
mutalyzer/retriever
mutalyzer_retriever/client.py
.py
e9461cc51ad9d428
7.15
1
""" Retriever configuration. """ import configparser import os DEFAULT_SETTINGS = { "NCBI_GFF3_URL": "https://eutils.ncbi.nlm.nih.gov/sviewer/viewer.cgi", "LRG_URL": "http://ftp.ebi.ac.uk/pub/databases/lrgex/", "MAX_FILE_SIZE": 10 * 1048576, "ENSEMBL_API": "https://rest.ensembl.org", "ENSEMBL_API_G...
mutalyzer/retriever
mutalyzer_retriever/configuration.py
.py
3764046afc4c0262
7.15
1
""" Module for NCBI Datsets response parsing. https://www.ncbi.nlm.nih.gov/datasets/docs/v2/api/rest-api/ """ from mutalyzer_retriever.reference import GRCH37 from mutalyzer_retriever.util import HUMAN_TAXON, DataSource def parse_assemblies(dataset_report): """ Args: report (dict): One gene report fro...
mutalyzer/retriever
mutalyzer_retriever/parsers/datasets.py
.py
4ccb85d55bdb1240
7.15
1
""" Module for gff files parsing. GFF3 specifications: - Official: - [1] https://github.com/The-Sequence-Ontology/Specifications/blob/master/gff3.md - NCBI: - [2]: ftp://ftp.ncbi.nlm.nih.gov/genomes/README_GFF3.txt - https://www.ncbi.nlm.nih.gov/genbank/genomes_gff/ - Ensembl: - ftp://ftp.ensembl.org/pub/relea...
mutalyzer/retriever
mutalyzer_retriever/parsers/gff3.py
.py
8b8b6c82ad1cd652
7.15
1
import requests from ..configuration import DEFAULT_TIMEOUT from ..util import f_e, make_location def _feature(raw_dict): """Convert a general tark sub-dictionary into our internal model. - only id and location info; - Tark locations are 1-based, our model is 0-based. """ return { "...
mutalyzer/retriever
mutalyzer_retriever/parsers/json_ensembl.py
.py
b4c33f38fb3b0891
7.15
1
""" LRG file parser. An LRG file is an XML formatted file and consists of a fixed and updatable section. The fixed section contains a DNA sequence and for that sequence a number of transcripts. The updatable region could contain all sorts of annotation for the sequence and transcripts. It can also contain additional (...
mutalyzer/retriever
mutalyzer_retriever/parsers/lrg.py
.py
2b8b1ca0efc3a65b
7.15
1
from http.client import HTTPException, IncompleteRead from urllib.error import HTTPError from Bio import Entrez from ..configuration import DEFAULT_TIMEOUT, settings from ..request import Http400, RequestErrors, request from ..util import f_e Entrez.email = settings.get("EMAIL") Entrez.api_key = settings.get("NCBI_A...
mutalyzer/retriever
mutalyzer_retriever/sources/ncbi.py
.py
1ee8439ee337ae79
7.15
1
from enum import Enum class StrEnum(str, Enum): """ Enum where members are also (and must be) strings """ pass # Constants HUMAN_TAXON: str = "HOMO SAPIENS" EMPTY_VALUES = (None, "", []) class DataSource(StrEnum): """Data source enumeration""" ENSEMBL = "ENSEMBL" NCBI = "NCBI" OTHER ...
mutalyzer/retriever
mutalyzer_retriever/util.py
.py
cf620168aa63e482
7.15
1
"""Detect and prune near-duplicate images across and within dataset splits using dHash.""" from __future__ import annotations import logging from dataclasses import dataclass, field from pathlib import Path import cv2 from hakim_vision.datasets.yolo_layout import DatasetLayout, discover_layout logger = logging.get...
osos3lom/AIBaloot
src/hakim_vision/datasets/dedupe.py
.py
a64235215ca647bf
7
0
"""Count and validate a YOLO dataset before anyone spends GPU hours on it. Everything here is derived from the user's actual files: no sampling estimates, no placeholder numbers. If a split has 3 orphan labels, this reports 3. """ from __future__ import annotations from collections import Counter from dataclasses im...
osos3lom/AIBaloot
src/hakim_vision/datasets/inspection.py
.py
de68346a40500cfd
7.5
0
"""Map a third-party card dataset onto the 32-card Baloot deck. Public playing-card datasets are 52-card poker decks. Baloot uses 32 cards (A K Q J 10 9 8 7), so ranks 2-6 and jokers must be dropped and the remaining classes re-indexed to the Baloot order. This module suggests that mapping and then materialises a new ...
osos3lom/AIBaloot
src/hakim_vision/datasets/remap.py
.py
acb605ce99ded610
7
0
"""Discover the shape of a YOLO-format dataset on disk. Public playing-card datasets ship in several near-identical layouts (Roboflow exports, Ultralytics conventions, hand-rolled folders). This module normalises them into one :class:`DatasetLayout` so the rest of the pipeline never has to guess where images and label...
osos3lom/AIBaloot
src/hakim_vision/datasets/yolo_layout.py
.py
74b616161ddd5da1
7
0
"""Geometry helpers extracted from the legacy notebook. Initial slice: bounding-box conversion to YOLO format. The full corner-detection and keypoint pipeline (`findHull`, `hull_to_kps`, `kps_to_BB`) will be ported in follow-up PRs as the notebook is decomposed. """ from __future__ import annotations from typing imp...
osos3lom/AIBaloot
src/hakim_vision/geometry.py
.py
fdae6ca84ebb7dd4
7
0
"""Background job runner for long tasks the studio starts (remap, train, export). Jobs are subprocesses, not threads: training pins a GPU and prints a lot, and a subprocess can be stopped cleanly without leaving a half-initialised CUDA context behind. Output is kept in a bounded buffer so a 50-epoch run cannot grow me...
osos3lom/AIBaloot
src/hakim_vision/jobs.py
.py
b3dabee08b3c7e36
7
0
"""Static INT8 ONNX Quantization for YOLO Card Detector.""" from __future__ import annotations import logging from collections.abc import Iterator from pathlib import Path import cv2 import numpy as np logger = logging.getLogger(__name__) def preprocess_image_stretch(image_path: Path, imgsz: int = 416) -> np.ndar...
osos3lom/AIBaloot
src/hakim_vision/models/quantize.py
.py
ce5a7eb9be7f2caf
7
0
"""Train a Baloot card detector with Ultralytics YOLO. This module runs real training. It has no simulation mode: when Ultralytics or a dataset is missing it raises, so nothing downstream can mistake a placeholder for a trained model. """ from __future__ import annotations import csv import logging from dataclasses ...
osos3lom/AIBaloot
src/hakim_vision/models/train.py
.py
bea8026f3ceba2de
7
0
"""YOLO Model Training, Evaluation, and WebGPU ONNX Export Pipeline.""" from __future__ import annotations import logging from pathlib import Path logger = logging.getLogger(__name__) BALOOT_RANKS: tuple[str, ...] = ("A", "K", "Q", "J", "10", "9", "8", "7") BALOOT_SUITS: tuple[str, ...] = ("h", "d", "c", "s") BALOO...
osos3lom/AIBaloot
src/hakim_vision/models/yolo_export.py
.py
5e35ea799dbfc007
7
0
"""Background-texture and card-image asset loaders. Ported from the `Backgrounds` and `Cards` classes in the legacy notebook, with three structural changes: 1. **No pickle.** Assets live in WebDataset tar shards (`backgrounds-{000..NNN}.tar`, `cards-{000..NNN}.tar`). Pickle loading was an RCE risk; this also ma...
osos3lom/AIBaloot
src/hakim_vision/synthetic/assets.py
.py
2c34609a7ba39977
7
0
"""Card extraction from a photo or video frame. Ported and modernized from `extract_card` in the legacy notebook. Key fixes relative to the original: - `cv2.findContours` API: in OpenCV 4.x it returns `(contours, hierarchy)`, not `(_, contours, hierarchy)` as in OpenCV 3.x. The original code broke silently. - `np.i...
osos3lom/AIBaloot
src/hakim_vision/synthetic/card_extraction.py
.py
1d8f9440b080b500
7
0
"""Corner-symbol hull detection and keypoint utilities. Ported from `findHull`, `hull_to_kps`, `kps_to_polygon`, `kps_to_BB` in the legacy notebook. Two substantive changes from the original: - We do not depend on `imgaug` (unmaintained). Keypoints are plain `(N, 2)` float arrays; polygons are `shapely.geometry.Pol...
osos3lom/AIBaloot
src/hakim_vision/synthetic/hull.py
.py
737706116a1b1eb4
7
0
"""Pack on-disk asset directories into tar shards loadable by `Backgrounds` / `Cards`. - `pack_backgrounds(...)` walks a directory of texture images (e.g. an unpacked Describable Textures Dataset) and writes one or more `backgrounds-{NNN}.tar` shards. - `pack_cards(...)` walks a directory laid out as `{root}/{card...
osos3lom/AIBaloot
src/hakim_vision/synthetic/pack.py
.py
45dd6fa92ce8bc26
7
0
"""Scene compositor: place 2 or 3 cards on a background, emit YOLO labels. Design notes: * Augmentation is a single OpenCV affine via ``random_affine_card``; richer photometric/elastic effects can be layered on top later. * No global RNG. The caller injects ``numpy.random.Generator``. * Occlusion handling is explic...
osos3lom/AIBaloot
src/hakim_vision/synthetic/scene.py
.py
295798d34120cb2f
7
0
"""Per-card affine augmentation, OpenCV-only. Applies a uniform random affine (rotation, scale, translation) to a BGRA card layer and its corner-hull keypoints using ``cv2.warpAffine`` plus plain numpy point arrays. Fully deterministic given an injected RNG. Photometric / elastic effects can be layered on top in a fol...
osos3lom/AIBaloot
src/hakim_vision/synthetic/transforms.py
.py
e0aca22c42d8ec8e
7
0
from __future__ import annotations from pathlib import Path import numpy as np import pytest from hakim_vision.models import export_yolo_to_onnx, get_baloot_classes from hakim_vision.models.evaluate_parity import ( ModelEvalResult, compute_iou, decode_yolo_tensor, nms, ) from hakim_vision.models.quan...
osos3lom/AIBaloot
tests/test_models.py
.py
cb7e8f5211db96ab
7.5
0
"""Smoke tests: package imports, CLI runs, basic geometry round-trips.""" from __future__ import annotations import pytest from typer.testing import CliRunner from hakim_vision import __version__ from hakim_vision.cli import app from hakim_vision.config import GenerationConfig from hakim_vision.geometry import YoloB...
osos3lom/AIBaloot
tests/test_smoke.py
.py
8d4e1909804fb5d5
7.5
0
#!/usr/bin/env python ''' Terraform Inventory Script ========================== This inventory script generates dynamic inventory by reading Terraform state contents. Servers and groups a defined inside the Terraform state using special resources defined by the Terraform Provider for Ansible. Configuration ==========...
sorrowless/ansible_controller
inventory/iac_state_inventory.py
.py
5480646325e1a305
7.24
2
#!/usr/bin/env python3 """ Generate an SSH config block from Ansible host_vars/<host>/main.yml. For each host, ansible_host/ansible_ip, ansible_port, ansible_user and ansible_ssh_common_args are converted to an OpenSSH Host block. Example: host_vars/web-01/main.yml: ansible_host: 10.0.0.11 ansibl...
sorrowless/ansible_controller
tools/import_infra_to_sshconf.py
.py
a38ff321d69fda69
7.24
2
from __future__ import with_statement import logging from logging.config import fileConfig from alembic import context from sqlalchemy import engine_from_config, pool # this is the Alembic Config object, which provides # access to the values within the .ini file in use. config = context.config # Interpret the confi...
alecgunny/kook-tracker
kook-tracker/migrations/env.py
.py
6dc64ca2a02379fd
7
0
"""first migration Revision ID: 46e9e4b0831c Revises: Create Date: 2020-12-07 09:09:06.385484 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "46e9e4b0831c" down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto ge...
alecgunny/kook-tracker
kook-tracker/migrations/versions/46e9e4b0831c_first_migration.py
.py
709a8f2e42279f3b
7
0
"""adding event stat id Revision ID: 9bd534a4f694 Revises: 46e9e4b0831c Create Date: 2023-03-14 08:38:46.291672 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "9bd534a4f694" down_revision = "46e9e4b0831c" branch_labels = None depends_on = None def upgrade():...
alecgunny/kook-tracker
kook-tracker/migrations/versions/9bd534a4f694_adding_event_stat_id.py
.py
a9daacf2331f6ab8
7
0
import argparse import json import os import re from contextlib import contextmanager from datetime import datetime from apiclient import discovery from dotenv import load_dotenv from google.oauth2.service_account import Credentials IMPORTRANGE_RE = re.compile(r'IMPORTRANGE\(\s*"([^"]+)"', re.IGNORECASE) def read_s...
alecgunny/kook-tracker
ops/update_rosters.py
.py
0d774df93bba6ab2
7
0
"""Module containing helper functions for CH15k concatenation.""" import datetime import shutil from pathlib import Path import netCDF4 from cloudnetpy import concat_lib as clib from cloudnetpy.utils import get_epoch, seconds2date def concat_netcdf_files( files: list[Path], date: datetime.date, output_f...
actris-cloudnet/cloudnet-processing
src/processing/concat_wrapper.py
.py
14a97fef20efedf5
7.24
2
import logging import re from uuid import UUID import cftime import cloudnetpy.exceptions import cloudnetpy.instruments.instruments import cloudnetpy.metadata import cloudnetpy.output import cloudnetpy.utils import netCDF4 import numpy as np from processing.version import __version__ as cloudnet_processing_version ...
actris-cloudnet/cloudnet-processing
src/processing/harmonizer/core.py
.py
6c10b19d218f3810
7.24
2
import shutil from tempfile import NamedTemporaryFile from uuid import UUID import netCDF4 import numpy as np from cloudnetpy.instruments import instruments from processing.harmonizer import core from processing.utils import MiscError def harmonize_halo_calibrated_file(data: dict) -> UUID: """Harmonizes calibra...
actris-cloudnet/cloudnet-processing
src/processing/harmonizer/halo_calibrated.py
.py
178f528742741a7b
7.24
2
import shutil from tempfile import NamedTemporaryFile from uuid import UUID import netCDF4 import numpy as np from processing.harmonizer import core from processing.utils import MiscError def harmonize_model_file(data: dict) -> UUID: """Harmonizes model netCDF file.""" if "output_path" not in data: ...
actris-cloudnet/cloudnet-processing
src/processing/harmonizer/model.py
.py
8ce0d5511253117c
7.24
2
"""Repository interfaces keep SQL out of Discord commands and API clients.""" from __future__ import annotations import json import sqlite3 from dataclasses import dataclass, field from typing import Any, Optional from .secrets import SecretBox from .database import utc_now @dataclass(frozen=True) class ServerCapa...
demethan/eggBot
eggbot_db/repositories.py
.py
8d014bbc5e5b8bfe
7
0
"""Durable Fry API connectivity monitoring and incident state transitions.""" from __future__ import annotations import json import sqlite3 from dataclasses import dataclass from datetime import datetime, timezone from typing import Optional FAILURE_THRESHOLD = 2 @dataclass(frozen=True) class FryHealthTransition:...
demethan/eggBot
fry_health.py
.py
9b7fd65145f4b122
7
0
"""Tests for the XML-TEI output format (``obeliks.run(text, tei=True)``). Current document shape (as produced by ``tokenizer.process_tei``):: TEI (xmlns, xml:lang="sl") text p (empty, xml:id="F<npar>") s (xml:id="F<npar>.<ns>") w | c | pc ... s ... """ import obeliks impor...
clarinsi/obeliks
tests/test_tei.py
.py
4907f48993743ec2
7.5
0
"""Tests for the default 'tokenize-only' output format. The default output of ``obeliks.run(text)`` is a plain-text list of tokens with positions ``<para>.<sent>.<tok>.<start>-<end>`` (1-based character offsets into the original text), one token per line, and blank lines between sentences. """ import obeliks def te...
clarinsi/obeliks
tests/test_tokenize.py
.py
bae461372b6fc011
7.5
0
from aiohttp import web import logging import asyncio import uvloop FORMAT = "[%(asctime)s][%(name)s][%(process)d %(processName)s][%(levelname)-8s] (L:%(lineno)s) %(funcName)s: %(message)s" logging.basicConfig(format=FORMAT, datefmt="%Y-%m-%d %H:%M:%S") LOG = logging.getLogger(__name__) LOG.setLevel(logging.INFO) rou...
blankdots/minimalpy
minimalpy/server.py
.py
02ad4b5442827456
7.3
3
from typing import Awaitable import unittest from aiohttp.test_utils import AioHTTPTestCase, unittest_run_loop from aiohttp import web from minimalpy.server import init, main from unittest import mock class AppTestCase(AioHTTPTestCase): """Test for Web app. Testing web app endpoints. """ async def g...
blankdots/minimalpy
tests/test_server.py
.py
8d30378f00bb5453
7.8
3
import os import re from cookiecutter.main import cookiecutter def _nonword_to_underscore(the_str): ''' nonword to underscore style. ex: the-str => the_str ''' return re.sub(r'\W+', '_', the_str) def _underscore_to_uppercase(the_str): ''' underscore style to UPPERCASE style. e...
chhsiao1981/cc-tmpl.py
src/cc_tmpl_py/gen.py
.py
0364d26f8ce6f29c
7.15
1
# -*- coding: utf-8 -*- """Setup file for etos-test-runner.""" from setuptools import setup from setuptools_scm.version import get_local_dirty_tag def version_scheme(version) -> str: """Get version component for the current commit. Used by setuptools_scm. """ if version.tag and version.distance == 0...
eiffel-community/etos-test-runner
setup.py
.py
57ee5ce8cb70b970
7
0
#!/usr/bin/env python # Copyright Axis Communications AB. # # For a full list of individual contributors, please see the commit history. # # 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 # # ...
eiffel-community/etos-test-runner
src/etos_test_runner/etr.py
.py
b66034bc9415bd50
7.5
0
# Copyright Axis Communications AB. # # For a full list of individual contributors, please see the commit history. # # 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.or...
eiffel-community/etos-test-runner
src/etos_test_runner/lib/events.py
.py
0730aba981cbff92
7.5
0
# Copyright 2020-2021 Axis Communications AB. # # For a full list of individual contributors, please see the commit history. # # 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...
eiffel-community/etos-test-runner
src/etos_test_runner/lib/executor.py
.py
95c61a02249c25c9
7.5
0
# Copyright 2020-2021 Axis Communications AB. # # For a full list of individual contributors, please see the commit history. # # 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...
eiffel-community/etos-test-runner
src/etos_test_runner/lib/iut.py
.py
ea9f347bbf47d413
7.5
0
# Copyright Axis Communications AB. # # For a full list of individual contributors, please see the commit history. # # 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.or...
eiffel-community/etos-test-runner
src/etos_test_runner/lib/log_area.py
.py
5cb13fc11a009988
7.5
0
# Copyright 2020-2021 Axis Communications AB. # # For a full list of individual contributors, please see the commit history. # # 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...
eiffel-community/etos-test-runner
src/etos_test_runner/lib/testrunner.py
.py
69a4741ff2e1b9d3
7.5
0
# Copyright Axis Communications AB. # # For a full list of individual contributors, please see the commit history. # # 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.or...
eiffel-community/etos-test-runner
src/etos_test_runner/lib/verdict.py
.py
8aecd1a77b7b51fc
7.5
0
# Copyright 2020-2021 Axis Communications AB. # # For a full list of individual contributors, please see the commit history. # # 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...
eiffel-community/etos-test-runner
src/etos_test_runner/lib/workspace.py
.py
a8d08de8a0a1e4a3
7.5
0
# Copyright 2020 Axis Communications AB. # # For a full list of individual contributors, please see the commit history. # # 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.apac...
eiffel-community/etos-test-runner
tests/lib/test_workspace.py
.py
314c8e20742bb9f1
7.5
0
# Copyright Axis Communications AB. # # For a full list of individual contributors, please see the commit history. # # 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.or...
eiffel-community/etos-test-runner
tests/library/fake_server.py
.py
6db2879bc5b8fb81
7.5
0
# Copyright Axis Communications AB. # # For a full list of individual contributors, please see the commit history. # # 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.or...
eiffel-community/etos-test-runner
tests/library/handler.py
.py
43a98ecb5c4aed95
7.5
0
# Copyright Axis Communications AB. # # For a full list of individual contributors, please see the commit history. # # 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.or...
eiffel-community/etos-test-runner
tests/scenarios/test_full_execution.py
.py
1b7d05c5528ee8b7
7.5
0
# Copyright Axis Communications AB. # # For a full list of individual contributors, please see the commit history. # # 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.or...
eiffel-community/etos-test-runner
tests/scenarios/test_log_upload.py
.py
f558a7ffac113f99
7.5
0
# Copyright Axis Communications AB. # # For a full list of individual contributors, please see the commit history. # # 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.or...
eiffel-community/etos-test-runner
tests/scenarios/test_no_detected_test_name.py
.py
da794eb1ecb9c4a3
7.5
0
# SPDX-License-Identifier: MIT # Copyright (c) 2020-2026 Takayuki Nagata """Command-line interface for m2h (MSP430 to Hack assembly transpiler).""" import argparse import os import sys from typing import Optional from m2h import __version__ from m2h.emitter import HackEmitter from m2h.parser import parse_assembly ...
takayuki-nagata/hack_tools
m2h/src/m2h/cli.py
.py
e79cebb5e961bda6
7
0
# SPDX-License-Identifier: MIT # Copyright (c) 2020-2026 Takayuki Nagata """Compiler driver connecting msp430-gcc, m2h, and has.""" import os import shutil import subprocess import sys import tempfile from typing import Optional from m2h.cli import transpile_file def find_executable(name: str, fallback_paths: Opti...
takayuki-nagata/hack_tools
m2h/src/m2h/driver.py
.py
c5c4d36082cb584f
7
0
# SPDX-License-Identifier: MIT # Copyright (c) 2020-2026 Takayuki Nagata """Command-line interface for hcc (Hack C Compiler frontend).""" import argparse import sys from typing import Optional from m2h import __version__ from m2h.driver import CompilerDriver def build_parser() -> argparse.ArgumentParser: """Bu...
takayuki-nagata/hack_tools
m2h/src/m2h/hcc.py
.py
19a8e37ad98d160b
7
0
# SPDX-License-Identifier: MIT # Copyright (c) 2020-2026 Takayuki Nagata """MSP430 assembly parser.""" import re from dataclasses import dataclass, field from enum import Enum, auto from typing import Optional class OperandType(Enum): """Addressing mode of an MSP430 operand.""" REGISTER = auto() # r4, sp,...
takayuki-nagata/hack_tools
m2h/src/m2h/parser.py
.py
e52d1220aefa8cd0
7
0
import nox nox.options.download_python = 'never' @nox.session def lint(session): """Lint using Flake8.""" session.install('flake8') session.run('flake8', '--statistics', '.') @nox.session def typecheck(session): """Typecheck using MyPy.""" session.install('mypy') session.install('.[argcompl...
airtower-luna/mpvasync
noxfile.py
.py
caf9c1badc155fbb
7.39
5
#!/usr/bin/env python3 """Custom input type parser.""" from argparse import ArgumentTypeError import dateparser import environs env = environs.Env() def timedelta_validator(value: str | None) -> str | None: """ Return the dateparser string for a time in the past. :param value: a string containing a ti...
thegeeklab/docker-tidy
dockertidy/parser.py
.py
86de9032971aaa78
7.39
5