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
"""Command line interface for subsetting geopackages by catchment ID.""" import argparse import time from pathlib import Path import logging from data_processing.subset import subset logger = logging.getLogger(__name__) def parse_arguments() -> argparse.Namespace: """Parse command line arguments.""" parser...
CIROH-UA/NGIAB_data_preprocess
modules/ngiab_data_cli/subset_cli.py
.py
04da89b1da16c2a7
7.62
16
"""Config-generation regression tests. Fixture geopackages: tests/golden/geopackage/cat-1555522_subset.gpkg tests/golden/geopackage/gage-10109001_subset.gpkg """ import difflib import json import math import os import re import shutil from datetime import datetime from pathlib import Path import pytest from...
CIROH-UA/NGIAB_data_preprocess
tests/test_config_generation.py
.py
3d115f3a95be28cf
8.12
16
import logging import tempfile from pathlib import Path import numpy as np import pandas as pd import pytest import xarray as xr # Import the functions to test from data_processing.forcings import interpolate_nan_values # Configure logging logger = logging.getLogger(__name__) if not logging.getLogger().hasHandlers()...
CIROH-UA/NGIAB_data_preprocess
tests/test_nan_impute.py
.py
0e28b7f9da538153
8.12
16
"""Regression (characterization) tests for the generated ngen realization files. These tests snapshot that output for each model against a committed golden file. Updating goldens (only when a change is intentional): UPDATE_GOLDEN=1 uv run pytest tests/test_realization_templates.py then eyeball the diff in ``tests/g...
CIROH-UA/NGIAB_data_preprocess
tests/test_realization_templates.py
.py
d0ec3079d7b40841
8.12
16
import warnings import kornia.augmentation as Kaug import torch from omegaconf import OmegaConf from benchmark.augmentations import custom_augmentations as Caug warnings.simplefilter("once", UserWarning) # Set this at the script start def get_augmentation(name, **kwargs): """Get the augmentation c...
Kainmueller-Lab/Pathology-Foundation-Model-Benchmark
src/benchmark/augmentations/augmentations.py
.py
87e3a13b081b7660
7.52
10
from typing import Optional import kornia.augmentation as K import numpy as np import torch RGB_FROM_HED = np.array([[0.65, 0.70, 0.29], [0.07, 0.99, 0.11], [0.27, 0.57, 0.78]], dtype=np.float32) HED_FROM_RGB = np.linalg.inv(RGB_FROM_HED) def torch_rgb2hed(img, hed_t, e): """Converts an RGB image to ...
Kainmueller-Lab/Pathology-Foundation-Model-Benchmark
src/benchmark/augmentations/custom_augmentations.py
.py
65a6466c976f8bab
7.52
10
import pickle import lmdb from torch.utils.data import Dataset class LMDBDataset(Dataset): def __init__(self, path, include_sample_names=None, include_tile_names=None): """Initializes the LMDBDataset. Args: path (str): Path to the LMDB file. include_sample_nam...
Kainmueller-Lab/Pathology-Foundation-Model-Benchmark
src/benchmark/dataset/lmdb_dataset.py
.py
604889a5682da841
7.52
10
import numpy as np from benchmark.utils.utils import get_height_width, to_tuple def center_pad_to_size(array, desired_shape): """ Center pad an array with zeros to reach the desired shape. Args: array (numpy.ndarray): The array to pad. desired_shape (tuple of int): The desired shape afte...
Kainmueller-Lab/Pathology-Foundation-Model-Benchmark
src/benchmark/dataset/split_to_tiles.py
.py
66dc5b36f4ff2502
7.52
10
# adapted from CellViT # https://github.com/TIO-IKIM/CellViT-plus-plus/blob/main/cellvit/models/cell_segmentation/cellvit.py from collections import OrderedDict import einops import torch import torch.nn as nn from benchmark.models.simple_segmentation_model import ( clean_str, load_model_and_transfo...
Kainmueller-Lab/Pathology-Foundation-Model-Benchmark
src/benchmark/heads/unetr.py
.py
f31924a4c1d30d7f
7.52
10
import os import re import numpy as np import pandas as pd import torch from skimage.measure import regionprops_table from tqdm import tqdm from benchmark.utils.metric_utils import ( accuracy, confusion_matrix_func, f1_score_class, precision, recall, ) from benchmark.utils.utils im...
Kainmueller-Lab/Pathology-Foundation-Model-Benchmark
src/benchmark/run/eval.py
.py
c54b8b082fcdf1ca
7.52
10
import os import torch import torch.distributed as dist def init_distributed(): # Initializes the distributed backend which will take care of synchronizing nodes/GPUs global RANK, WORLD_SIZE, LOCAL_RANK, LOCAL_WORLD_SIZE # only works with torch.distributed.launch // torch.run dist.init_proc...
Kainmueller-Lab/Pathology-Foundation-Model-Benchmark
src/benchmark/utils/init_dist.py
.py
5e0732be824a4117
7.52
10
import json import os from typing import Union import h5py import numpy as np import pandas as pd import torch import torch.nn as nn import torch.nn.functional as F from torchvision.transforms import v2 from benchmark.dataset.lmdb_dataset import LMDBDataset def get_height_width(array): """Get th...
Kainmueller-Lab/Pathology-Foundation-Model-Benchmark
src/benchmark/utils/utils.py
.py
f55a92a17f068dc7
7.52
10
import os import unittest import numpy as np from benchmark.dataset.lmdb_dataset import LMDBDataset class TestLMDBDataset(unittest.TestCase): """Unit tests for the LMDBDataset class.""" def setUp(self): """Set up the test environment and dataset.""" # Path to the small LMDB dataset ...
Kainmueller-Lab/Pathology-Foundation-Model-Benchmark
tests/test_lmdb_dataset.py
.py
1581b1a87962b520
8.02
10
import os import shutil import tempfile import unittest import numpy as np import scipy.io as sio from bio_image_datasets.lizard_dataset import LizardDataset from PIL import Image from benchmark.dataset.split_to_tiles import center_pad_to_size, transform_to_tiles class TestSplitToTiles(unittest.TestCase): """Te...
Kainmueller-Lab/Pathology-Foundation-Model-Benchmark
tests/test_split_to_tiles.py
.py
4c373ee21deb83af
8.02
10
import os import pickle import shutil import tempfile import unittest import lmdb import numpy as np import scipy.io as sio # Import the necessary modules from your project # Adjust the import paths as necessary from bio_image_datasets.lizard_dataset import LizardDataset from bio_image_datasets.segpath_dataset import...
Kainmueller-Lab/Pathology-Foundation-Model-Benchmark
tests/test_tiles_to_lmdb.py
.py
14cc8675f8aa7ccd
8.02
10
#!/usr/bin/env python3 # -*- coding: utf-8 -*- def cry_ads_energy(e_full_system, e_substrate, e_adsorbate): """ Calculate the adsorption energy of a system. Args: e_full_system (float): Total energy of the full system. e_substrate (float): Energy of the substrate. e_adsorbate (flo...
crystaldevs/CRYSTALClear
CRYSTALClear/calculate.py
.py
44b0c021a8acb884
7.56
12
""" Basic methods to manipulate pymatgen geometries """ def rotate_lattice(struc, rot): """ Geometries generated by ``base.crysout.GeomBASE`` might be rotated. Rotate them back to make them consistent with geometries in output. .. math:: \mathbf{L}_{crys} = \mathbf{L}_{pmg}\mathbf{R} :math...
crystaldevs/CRYSTALClear
CRYSTALClear/geometry.py
.py
59ba7aa2d1a71bbe
7.56
12
import re import fnmatch import logging from typing import List import mayaUsd.lib as mayaUsdLib from pxr import Sdf def log_errors(fn): """Decorator to log errors on error""" def wrap(*args, **kwargs): try: return fn(*args, **kwargs) except Exception as exc: logging...
ynput/ayon-maya
client/ayon_maya/api/chasers/export_filter_properties.py
.py
20a7d0a8d7422a27
7.52
10
# -*- coding: utf-8 -*- """AYON script commands to be used directly in Maya.""" from maya import cmds from ayon_api import get_project, get_folder_by_path from ayon_core.pipeline import get_current_project_name, get_current_folder_path class ToolWindows: _windows = {} @classmethod def get_window(cls, ...
ynput/ayon-maya
client/ayon_maya/api/commands.py
.py
a8876b2cc0ac73b3
7.52
10
"""Host API required Work Files tool""" import os from maya import cmds def file_extensions(): return [".ma", ".mb"] def has_unsaved_changes(): return cmds.file(query=True, modified=True) def save_file(filepath): cmds.file(rename=filepath) ext = os.path.splitext(filepath)[1] if ext == ".mb": ...
ynput/ayon-maya
client/ayon_maya/api/workio.py
.py
7212c283d3c6df56
7.52
10
from ayon_applications import PreLaunchHook, LaunchTypes class MayaPreAutoLoadPlugins(PreLaunchHook): """Define -noAutoloadPlugins command flag. Note: This also relies on `pre_open_workfile_post_initialization.py` to ensure workfiles opening on launch open after initialization so we have the right co...
ynput/ayon-maya
client/ayon_maya/hooks/pre_auto_load_plugins.py
.py
c533588d62263a8c
7.52
10
from ayon_applications import PreLaunchHook, LaunchTypes from ayon_maya.lib import create_workspace_mel class PreCopyMel(PreLaunchHook): """Copy workspace.mel to workdir. Hook `GlobalHostDataHook` must be executed before this hook. """ app_groups = {"maya", "mayapy"} launch_types = {LaunchTypes.l...
ynput/ayon-maya
client/ayon_maya/hooks/pre_copy_mel.py
.py
6cbc3a47d7c817a5
7.52
10
import os from ayon_applications import PreLaunchHook, LaunchTypes class MayaPreOpenWorkfilePostInitialization(PreLaunchHook): """Define whether open last workfile should run post initialize.""" # Before AddLastWorkfileToLaunchArgs. order = 9 app_groups = {"maya"} launch_types = {LaunchTypes.loc...
ynput/ayon-maya
client/ayon_maya/hooks/pre_open_workfile_post_initialization.py
.py
0414e509ca096d0f
7.52
10
from ayon_maya.api import ( lib, plugin ) from ayon_core.lib import BoolDef class CreateCamera(plugin.MayaCreator): """Single baked camera""" identifier = "io.openpype.creators.maya.camera" label = "Camera" product_base_type = "camera" product_type = product_base_type icon = "video-ca...
ynput/ayon-maya
client/ayon_maya/plugins/create/create_camera.py
.py
63a38204d6a61c56
7.52
10
from ayon_maya.api import ( plugin, lib ) from ayon_core.lib import ( BoolDef, TextDef ) class CreateLook(plugin.MayaCreator): """Shader connections defining shape look""" identifier = "io.openpype.creators.maya.look" label = "Look" product_base_type = "look" product_type = produc...
ynput/ayon-maya
client/ayon_maya/plugins/create/create_look.py
.py
b454b91a25b3954f
7.52
10
from ayon_maya.api import ( lib, plugin ) from ayon_core.lib import BoolDef class CreateMatchmove(plugin.MayaCreator): """Instance for more complex setup of cameras. Might contain multiple cameras, geometries etc. It is expected to be extracted into .abc or .ma """ identifier = "io.open...
ynput/ayon-maya
client/ayon_maya/plugins/create/create_matchmove.py
.py
748aa3560de1b9f1
7.52
10
from ayon_maya.api import plugin from ayon_core.lib import EnumDef class CreateMayaUsdLayer(plugin.MayaCreator): """Create Maya USD Export from `mayaUsdProxyShape` layer""" identifier = "io.openpype.creators.maya.mayausdlayer" label = "Maya USD Export Layer" product_base_type = "usd" product_type...
ynput/ayon-maya
client/ayon_maya/plugins/create/create_maya_usd_layer.py
.py
e5069c5e073ab1bd
7.52
10
from ayon_maya.api import plugin from ayon_core.lib import ( BoolDef, TextDef ) class CreateModel(plugin.MayaCreator): """Polygonal static geometry""" identifier = "io.openpype.creators.maya.model" label = "Model" product_base_type = "model" product_type = product_base_type icon = "cu...
ynput/ayon-maya
client/ayon_maya/plugins/create/create_model.py
.py
c638770e62bca197
7.52
10
import collections from ayon_api import ( get_folder_by_name, get_folder_by_path, get_folders, get_tasks, ) from maya import cmds # noqa: F401 from ayon_maya.api import plugin from ayon_core.lib import EnumDef, TextDef from ayon_core.pipeline import ( Creator, get_current_folder_path, get...
ynput/ayon-maya
client/ayon_maya/plugins/create/create_multishot_layout.py
.py
ae459232591969df
7.52
10
import inspect from ayon_maya.api import plugin class CreateOxRig(plugin.MayaCreator): """Output for Ornatrix nodes""" identifier = "io.ayon.creators.maya.oxrig" label = "Ornatrix Rig" product_base_type = "oxrig" product_type = product_base_type icon = "usb" description = "Ornatrix Rig" ...
ynput/ayon-maya
client/ayon_maya/plugins/create/create_ornatrix_rig.py
.py
a36d40f9f5302295
7.52
10
# -*- coding: utf-8 -*- """Creator of Redshift proxy product types.""" from ayon_maya.api import plugin, lib from ayon_core.lib import BoolDef class CreateRedshiftProxy(plugin.MayaCreator): """Create instance of Redshift Proxy product.""" identifier = "io.openpype.creators.maya.redshiftproxy" label = "R...
ynput/ayon-maya
client/ayon_maya/plugins/create/create_redshift_proxy.py
.py
bc5eb783971e7bbd
7.52
10
from pydantic import validate_call from albert.collections.base import BaseCollection from albert.core.session import AlbertSession from albert.core.shared.enums import OrderBy from albert.core.shared.identifiers import TaskId from albert.resources.batch_data import BatchData, BatchDataType, BatchValuePatchPayload c...
albert-labs/albert-python
src/albert/collections/batch_data.py
.py
d620056b8dca481b
7.54
11
from collections.abc import Iterator from pydantic import validate_call from albert.collections.base import BaseCollection from albert.core.pagination import AlbertPaginator from albert.core.session import AlbertSession from albert.core.shared.enums import PaginationMode from albert.core.shared.identifiers import BTD...
albert-labs/albert-python
src/albert/collections/btdataset.py
.py
c4b5e718954218ff
7.54
11
from collections.abc import Iterator from pydantic import validate_call from albert.collections.base import BaseCollection from albert.core.pagination import AlbertPaginator from albert.core.session import AlbertSession from albert.core.shared.enums import OrderBy, PaginationMode from albert.core.shared.identifiers i...
albert-labs/albert-python
src/albert/collections/btinsight.py
.py
0fb5aac4338248cc
7.54
11
import re import warnings from collections.abc import Iterator from typing import Any from pydantic import validate_call from albert.collections.base import BaseCollection from albert.collections.lists import ListsCollection from albert.core.pagination import AlbertPaginator from albert.core.session import AlbertSess...
albert-labs/albert-python
src/albert/collections/cas.py
.py
3397417db3ef3030
7.54
11
from __future__ import annotations from collections.abc import AsyncIterator from pydantic import validate_call from albert.core.async_session import AsyncAlbertSession from albert.core.pagination import AsyncAlbertPaginator from albert.resources.chats import ChatFolder class ChatFolderCollection: """Manage fo...
albert-labs/albert-python
src/albert/collections/chat_folders.py
.py
477a1dda06e746ed
7.54
11
from collections.abc import Iterator from pydantic import validate_call from albert.collections.base import BaseCollection from albert.core.logging import logger from albert.core.pagination import AlbertPaginator, PaginationMode from albert.core.session import AlbertSession from albert.core.shared.identifiers import ...
albert-labs/albert-python
src/albert/collections/companies.py
.py
8f09fd18fdc2f1b8
7.54
11
from collections.abc import Iterator from pydantic import validate_call from albert.collections.base import BaseCollection from albert.core.pagination import AlbertPaginator from albert.core.session import AlbertSession from albert.core.shared.enums import PaginationMode from albert.core.shared.identifiers import Cus...
albert-labs/albert-python
src/albert/collections/custom_fields.py
.py
9aaaa2672b534d44
7.54
11
import logging from collections.abc import Iterator from pydantic import validate_call from albert.collections.base import BaseCollection from albert.core.pagination import AlbertPaginator from albert.core.session import AlbertSession from albert.core.shared.enums import OrderBy, PaginationMode from albert.core.share...
albert-labs/albert-python
src/albert/collections/data_columns.py
.py
789893460f19f0d2
7.54
11
from collections.abc import Iterator from pydantic import validate_call from albert.collections.base import BaseCollection from albert.core.pagination import AlbertPaginator, PaginationMode from albert.core.session import AlbertSession from albert.core.shared.enums import OrderBy from albert.core.shared.identifiers i...
albert-labs/albert-python
src/albert/collections/entity_types.py
.py
a78905096551b4ff
7.54
11
from pydantic import validate_call from albert.collections.base import BaseCollection from albert.core.session import AlbertSession from albert.resources.hazards import HazardStatement, HazardSymbol class HazardsCollection(BaseCollection): """Fetch the platform's reference lists of GHS hazard symbols and stateme...
albert-labs/albert-python
src/albert/collections/hazards.py
.py
6329adc4caa08472
7.54
11
from collections.abc import Iterator from pydantic import validate_call from albert.collections.base import BaseCollection from albert.core.pagination import AlbertPaginator from albert.core.session import AlbertSession from albert.core.shared.enums import PaginationMode from albert.core.shared.identifiers import Lin...
albert-labs/albert-python
src/albert/collections/links.py
.py
9239455fa2012e93
7.54
11
from collections.abc import Iterator from albert.collections.base import BaseCollection from albert.core.pagination import AlbertPaginator from albert.core.session import AlbertSession from albert.core.shared.enums import OrderBy, PaginationMode from albert.resources.lists import ListItem, ListItemCategory class Lis...
albert-labs/albert-python
src/albert/collections/lists.py
.py
f61ce1385aa4975d
7.54
11
from collections.abc import Iterator from albert.collections.base import BaseCollection from albert.core.pagination import AlbertPaginator from albert.core.session import AlbertSession from albert.core.shared.enums import PaginationMode from albert.core.utils import ensure_list from albert.exceptions import BadRequest...
albert-labs/albert-python
src/albert/collections/locations.py
.py
ad7fe4d2b2fd48a1
7.54
11
from albert.collections.base import BaseCollection from albert.core.session import AlbertSession from albert.core.shared.enums import OrderBy from albert.resources.notes import Note class NotesCollection(BaseCollection): """Manage Notes in the Albert platform. A Note is a free-text comment attached to anothe...
albert-labs/albert-python
src/albert/collections/notes.py
.py
f9194a64ef6e4790
7.54
11
import logging from collections.abc import Iterator from pydantic import validate_call from albert.collections.base import BaseCollection from albert.core.pagination import AlbertPaginator from albert.core.session import AlbertSession from albert.core.shared.enums import OrderBy, PaginationMode from albert.core.share...
albert-labs/albert-python
src/albert/collections/parameters.py
.py
709faaa019e27f42
7.54
11
from typing import Any from pydantic import validate_call from albert.collections.base import BaseCollection from albert.core.session import AlbertSession from albert.resources.pdf_generator import PDFOptions, PDFS3Storage, PDFTemplate class PDFGeneratorCollection(BaseCollection): """Manage PDF, barcode, and QR...
albert-labs/albert-python
src/albert/collections/pdf_generator.py
.py
944fd2cf637fd32d
7.54
11
from pydantic import validate_call from albert.collections.base import BaseCollection from albert.core.session import AlbertSession from albert.core.shared.enums import OrderBy from albert.core.shared.identifiers import InventoryId from albert.core.shared.models.patch import PatchDatum, PatchOperation, PatchPayload fr...
albert-labs/albert-python
src/albert/collections/pricings.py
.py
1e9a6fcafde4c19c
7.54
11
from typing import Literal from pydantic import validate_call from albert.collections.base import BaseCollection from albert.core.session import AlbertSession from albert.core.shared.identifiers import InventoryId from albert.resources.product_design import UnpackedProductDesign class ProductDesignCollection(BaseCo...
albert-labs/albert-python
src/albert/collections/product_design.py
.py
da26c221ef2cb4c4
7.54
11
from albert.collections.base import BaseCollection from albert.core.session import AlbertSession from albert.resources.report_templates import ( ReportTemplate, ReportTemplateCategory, ) class ReportTemplateCollection(BaseCollection): """Manage Report Templates in the Albert platform. A Report Templa...
albert-labs/albert-python
src/albert/collections/report_templates.py
.py
a9ec327dfefac4e7
7.54
11
import urllib from albert.collections.base import BaseCollection from albert.core.session import AlbertSession from albert.resources.roles import Role class RoleCollection(BaseCollection): """Manage Roles in the Albert platform. A Role defines a set of access permissions (policies) within a tenant. Role...
albert-labs/albert-python
src/albert/collections/roles.py
.py
f11801a4c108a6a5
7.54
11
from typing import Any from pydantic import validate_call from albert.collections.base import BaseCollection from albert.collections.inventory import InventoryCollection from albert.collections.product_design import ProductDesignCollection from albert.core.session import AlbertSession from albert.exceptions import Al...
albert-labs/albert-python
src/albert/collections/sds.py
.py
b0ab470acd15c8cd
7.54
11
from collections.abc import Iterator from pydantic import validate_call from albert.collections.base import BaseCollection from albert.core.pagination import AlbertPaginator from albert.core.session import AlbertSession from albert.core.shared.enums import PaginationMode from albert.core.shared.identifiers import Pro...
albert-labs/albert-python
src/albert/collections/smart_datasets.py
.py
4e298f4363c1b88d
7.54
11
from pydantic import validate_call from albert.collections.base import BaseCollection from albert.core.session import AlbertSession from albert.resources.storage_classes import StorageClass class StorageClassesCollection(BaseCollection): """Access hazardous-materials Storage Classes in the Albert platform. ...
albert-labs/albert-python
src/albert/collections/storage_classes.py
.py
ab719954c2c375bf
7.54
11
import logging from collections.abc import Iterator from albert.collections.base import BaseCollection from albert.core.logging import logger from albert.core.pagination import AlbertPaginator, MappedPaginator from albert.core.session import AlbertSession from albert.core.shared.enums import PaginationMode from albert...
albert-labs/albert-python
src/albert/collections/storage_locations.py
.py
d86001abcdc0f670
7.54
11
import json from albert.collections.base import BaseCollection from albert.core.session import AlbertSession from albert.resources.substance import SubstanceInfo, SubstanceResponse class SubstanceCollection(BaseCollection): """Look up regulatory and hazard information for chemical substances. A Substance is...
albert-labs/albert-python
src/albert/collections/substance.py
.py
785652a8380a9edf
7.54
11
""" Application Context for Dependency Injection. Manages all application-wide controllers and services. """ from __future__ import annotations from dataclasses import dataclass, field from typing import TYPE_CHECKING, Optional if TYPE_CHECKING: from src.lock.lock import GPIOController from src.messaging.ema...
morzan1001/Kiosk
src/app_context.py
.py
fcd69e23b08ae0dc
7.42
6
"""Database connection helpers. The application initializes the database once at startup and then provides SQLAlchemy sessions via a singleton `SessionManager`. To keep side effects contained, the module stores runtime state in a single state object instead of multiple module-level globals. """ from dataclasses impo...
morzan1001/Kiosk
src/database/connection.py
.py
911201b7cb9277ed
7.42
6
"""Shared CRUD mixin used by SQLAlchemy models.""" from typing import List, Optional, Type, TypeVar T = TypeVar("T", bound="CRUDMixin") class CRUDMixin: """Mixin that adds convenience methods for CRUD (Create, Read, Update, Delete) operations.""" def create(self, session, commit=True): """Adds this...
morzan1001/Kiosk
src/database/crud_mixin.py
.py
c1d0bd918bd5f6f5
7.42
6
"""This file holds the item model.""" from typing import Optional from sqlalchemy import Column, Float, Integer, LargeBinary, String from src.database.connection import Base from src.database.crud_mixin import CRUDMixin # Define the Item model class Item(Base, CRUDMixin): __tablename__ = "items" __table_ar...
morzan1001/Kiosk
src/database/models/item.py
.py
fa05a1b5371cfe4f
7.42
6
"""Translation loading and access helpers. This module loads the locale-specific JSON file into a global cache via initialize_translations() and exposes it via get_translations(). """ import json import locale from dataclasses import dataclass from typing import Optional from src.logmgr import logger from src.utils....
morzan1001/Kiosk
src/localization/translator.py
.py
69172893581c7217
7.42
6
""" GPIO Manager Module. Provides initialization and access functions for the GPIOController. """ from typing import Optional from src.app_context import get_app_context from src.lock.lock import GPIOController from src.logmgr import logger def initialize_gpio(chip: str = "/dev/gpiochip0", line_number: int = 4) -> ...
morzan1001/Kiosk
src/lock/gpio_manager.py
.py
84db7149b871fbc8
7.42
6
""" GPIO Controller Module. Provides hardware control for the kiosk lock mechanism. """ from typing import Optional import gpiod from gpiod.line import Direction, Value class GPIOController: """ Controller for GPIO-based lock mechanism. Attributes: chip: The GPIO chip device path. line_...
morzan1001/Kiosk
src/lock/lock.py
.py
547e0a0ff53ffd81
7.42
6
"""Logging utilities. This project historically used a small wrapper (`LogMgr`) around Python's `logging` module to simplify usage and automatically rotate log files monthly. The wrapper is kept for backwards compatibility, but its public methods now accept the standard logging API shape (`msg, *args, **kwargs`) so c...
morzan1001/Kiosk
src/logmgr/logmgr.py
.py
02a0e807f54b0da8
7.42
6
""" Main module for the Kiosk application. Initializes the application, database, and UI. """ import os import sys from time import sleep from typing import Optional import customtkinter from customtkinter import CTk, set_appearance_mode sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))...
morzan1001/Kiosk
src/main.py
.py
2b7250b4b162351a
7.42
6
""" Base Messaging Controller Module. Provides an abstract base class for all messaging channels. """ import queue import threading from abc import ABC, abstractmethod from typing import Any, Dict, Optional, Union from src.localization.translator import get_translations from src.logmgr import logger class BaseMessa...
morzan1001/Kiosk
src/messaging/base_messaging_controller.py
.py
db73c4cc76e19226
7.42
6
"""Email messaging controller implementation.""" import os import smtplib from datetime import datetime from email.mime.image import MIMEImage from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from jinja2 import Environment, FileSystemLoader, TemplateError from src.localization.tran...
morzan1001/Kiosk
src/messaging/email/email_controller.py
.py
6f31a0680d472391
7.42
6
""" Email Manager Module. Provides initialization and access functions for the EmailController. """ from typing import Any, Dict, Optional from src.app_context import get_app_context from src.database.connection import get_new_session from src.database.models.user import User from src.localization.translator import g...
morzan1001/Kiosk
src/messaging/email/email_manager.py
.py
e5112d7fc3656dfc
7.42
6
"""Mattermost messaging controller implementation.""" import requests from src.localization.translator import get_translations from src.logmgr import logger from src.messaging.base_messaging_controller import BaseMessagingController class MattermostController(BaseMessagingController): """Controller for Mattermo...
morzan1001/Kiosk
src/messaging/mattermost/mattermost_controller.py
.py
3727739acc34f7c2
7.42
6
""" Mattermost Manager Module. Provides initialization and access functions for the MattermostController. """ from typing import Any, Dict, Optional from src.app_context import get_app_context from src.database.connection import get_db from src.database.models.user import User from src.localization.translator import ...
morzan1001/Kiosk
src/messaging/mattermost/mattermost_manager.py
.py
a8c633fb47981776
7.42
6
""" Utility functions for messaging modules. """ from datetime import datetime, timedelta from apscheduler.schedulers.background import BackgroundScheduler from apscheduler.triggers.cron import CronTrigger from src.database.models.item import Item from src.database.models.transaction import Transaction from src.logm...
morzan1001/Kiosk
src/messaging/utils.py
.py
d02de180fe01d57d
7.42
6
""" NFC Reader Module. Provides continuous NFC card reading in a separate thread. """ import threading import time from typing import Callable, List, Optional from py532lib.i2c import Pn532_i2c from py532lib.mifare import Mifare from src.logmgr import logger pn532: Pn532_i2c = Pn532_i2c() pn532.SAMconfigure() mifar...
morzan1001/Kiosk
src/nfc_reader/nfc_reader.py
.py
26f60a5b3010f2ee
7.42
6
""" Sound Controller Module. Manages audio playback for positive and negative feedback sounds. """ import os import queue import secrets import threading from typing import List, Literal, Optional import numpy as np import sounddevice as sd import soundfile as sf from numpy.typing import NDArray from scipy import sig...
morzan1001/Kiosk
src/sounds/sound_controller.py
.py
90b65b2d7042347a
7.42
6
""" Sound Manager Module. Provides initialization and access functions for the SoundController. """ from typing import Optional from src.app_context import get_app_context from src.logmgr import logger from src.sounds.sound_controller import SoundController def initialize_sound_controller(pos_dir: str, neg_dir: str...
morzan1001/Kiosk
src/sounds/sound_manager.py
.py
0d736b6397ed9d62
7.42
6
"""Transient message overlay component.""" import os from customtkinter import CTkFrame, CTkImage, CTkLabel from PIL import Image from src.logmgr import logger from src.utils.paths import get_image_path class ShowMessage(CTkFrame): """Simple message frame with icon, heading and text.""" def __init__(self,...
morzan1001/Kiosk
src/ui/components/Message.py
.py
0b46325443ac2880
7.42
6
"""Admin dashboard card component.""" import tkinter as tk from typing import Optional from customtkinter import CTkFrame, CTkImage, CTkLabel from PIL import Image from src.logmgr import logger from src.utils.paths import get_image_path class DashboardCardFrame(CTkFrame): """ A unified card for the admin d...
morzan1001/Kiosk
src/ui/components/dashboard_card_frame.py
.py
ebd151b9c755b7a5
7.42
6
"""Reusable screen heading with back (and optional delete) action.""" from customtkinter import CTkButton, CTkFrame, CTkImage, CTkLabel from PIL import Image from src.logmgr import logger from src.utils.paths import get_image_path class HeadingFrame(CTkFrame): """Heading bar used across screens.""" def __i...
morzan1001/Kiosk
src/ui/components/heading_frame.py
.py
42753842fccc8924
7.42
6
from io import BytesIO from typing import Optional from customtkinter import CTkFrame, CTkImage, CTkLabel from PIL import Image class InfoCardFrame(CTkFrame): """ A generic frame for displaying an image (left) and two lines of text (right). Used for Items and Users in lists. """ def __init__( ...
morzan1001/Kiosk
src/ui/components/info_card_frame.py
.py
4ebe47c943f020fd
7.42
6
import os from io import BytesIO from typing import Optional from customtkinter import ( CTkButton, CTkEntry, CTkFrame, CTkImage, CTkLabel, CTkOptionMenu, filedialog, ) from PIL import Image, UnidentifiedImageError from src.localization.translator import get_translations from src.logmgr im...
morzan1001/Kiosk
src/ui/components/item_form.py
.py
254b1a70f7a63215
7.42
6
"""Quantity selector component used in the user cart.""" import tkinter as tk from customtkinter import CTkButton, CTkEntry, CTkFrame, CTkImage from PIL import Image from src.utils.paths import get_image_path class QuantityFrame(CTkFrame): def __init__(self, master, data, update_total_price, item_price: float,...
morzan1001/Kiosk
src/ui/components/quantity_frame.py
.py
5c68caee6603416e
7.42
6
"""NFC scan prompt component.""" from customtkinter import CTkButton, CTkFrame, CTkImage, CTkLabel from PIL import Image from src.localization.translator import get_translations from src.logmgr import logger from src.nfc_reader import NFCReader from src.ui.components.heading_frame import HeadingFrame from src.utils.p...
morzan1001/Kiosk
src/ui/components/scan_card.py
.py
b58e60b01d13fe64
7.42
6
"""Admin dashboard screen. Shows high-level counters (users/items) and provides navigation into admin flows. """ from customtkinter import CTkFrame, CTkImage, CTkLabel from PIL import Image from src.database import Item, User, get_db from src.localization.translator import get_translations from src.logmgr import log...
morzan1001/Kiosk
src/ui/screens/admin_main.py
.py
6f1bcbca618463f9
7.42
6
"""Item listing screen. Provides a scrollable list of items for admin flows. """ import time from typing import List from customtkinter import CTkButton, CTkFrame, CTkScrollableFrame from src.database import Item, get_db from src.localization.translator import get_translations from src.logmgr import logger from src...
morzan1001/Kiosk
src/ui/screens/item_listing.py
.py
1f79205ca1f34e2b
7.42
6
""" Sim3PluckerData — static .pkl files (pre-generated offline) Expected .pkl layout: <data_dir>/<dataset>_train/ matches.pkl list of (2, n_inliers) int32 arrays plucker1.pkl list of (n_lines, 6) float32 arrays plucker2.pkl list of (n_lines, 6) float32 arrays R_gt.p...
rueyday/ScalePluckerNet
lib/dataloader.py
.py
7d558c80cbf5dfc3
7.45
7
from typing import Any from typing import Awaitable from typing import Callable from aiogram import BaseMiddleware from aiogram.types import TelegramObject from src.db.dal import DataAccessLayer class DataAccessLayerMiddleware(BaseMiddleware): """ Access to DAL from handlers """ def __init__(self, ...
bralbral/telegram-stream-notifier
src/bot/middlewares/dal.py
.py
2df8c18f90317650
7.52
10
from typing import Any from typing import Awaitable from typing import Callable from typing import Optional from aiocache import Cache from aiogram.dispatcher.middlewares.base import BaseMiddleware from aiogram.types import Message from src.db import DataAccessLayer from src.db.models import UserModel from src.db.mod...
bralbral/telegram-stream-notifier
src/bot/middlewares/role.py
.py
f26ce8576579b51a
7.52
10
"""Sphinx configuration for the bbg-fetch documentation.""" import os project = "bbg-fetch" author = "Artur Sepp" copyright = "2026, Artur Sepp" version = "3.1" release = "3.1.0" extensions = [ "sphinx.ext.autodoc", ] root_doc = "index" source_suffix = ".rst" exclude_patterns = ["_build"] html_theme = "alabast...
ArturSepp/BloombergFetch
docs/conf.py
.py
149f37bfc5776b9f
7.65
19
"""BLOOMBERG TERMINAL REQUIRED: fetch a trailing dividend yield.""" from enum import Enum from bbg_fetch import fetch_div_yields class Locals(Enum): """Available dividend-history example workflows.""" DIVIDEND_YIELD = 1 def run_local(local: Locals) -> None: """Fetch and print the trailing dividend yi...
ArturSepp/BloombergFetch
examples/fetch_div_history.py
.py
90dad66733687b5b
7.65
19
"""BLOOMBERG TERMINAL REQUIRED: fetch an option chain and recover its forward. Run on the Bloomberg machine. bbg_fetch.option_chain.run() does the work — fetch the chain, infer spot and the year fraction from it, recover the parity forward and rate — and returns an OptionChainResult. Pass a currently listed expiry on ...
ArturSepp/BloombergFetch
examples/fetch_option_chain.py
.py
54d92aba4784acf4
7.65
19
"""NO TERMINAL: verify installation with a deterministic public-API workflow.""" import platform from enum import Enum from importlib.metadata import version import numpy as np import pandas as pd import bbg_fetch SPOT = 100.0 FORWARD = 102.0 RATE = 0.03 YEAR_FRACTION = 0.25 class Locals(Enum): """Available ...
ArturSepp/BloombergFetch
examples/quickstart_no_terminal.py
.py
cafb08fdebaf6742
7.65
19
""" Test: cash-adjusted PX_LAST vs TOT_RETURN_INDEX_GROSS_DVDS for dividend-heavy equities. Validates that fetch_field_timeseries_per_tickers with CshAdjNormal=True, CshAdjAbnormal=True produces return series economically equivalent to the Bloomberg total return index. Expected behavior: - Daily return correlation ...
ArturSepp/BloombergFetch
src/bbg_fetch/tests/bbg_adj_price_vs_tri_test.py
.py
03d16e63d444f273
8.15
19
""" every axis=1 ``pd.concat`` in library code states ``sort=`` explicitly. ``pd.concat(objs, axis=1)`` joins the frames on their index, and whether the resulting union is sorted has been changing under us. pandas 2.2 sorted the union of DatetimeIndexes whatever ``sort=`` said; pandas 3.0 honours an explicit ``sort=Fa...
ArturSepp/BloombergFetch
tests/test_concat_sort_convention.py
.py
85c2916f13013a3e
8.15
19
"""Repository checks for the Sphinx documentation foundation.""" import re import runpy import textwrap from pathlib import Path from types import SimpleNamespace from xml.etree import ElementTree import bbg_fetch REPOSITORY_ROOT = Path(__file__).resolve().parents[1] DOCS_ROOT = REPOSITORY_ROOT / "docs" CANONICAL_D...
ArturSepp/BloombergFetch
tests/test_docs_surface.py
.py
feb9b9016d7074a2
8.15
19
"""Repository-owned package identity and release-metadata checks.""" from pathlib import Path REPOSITORY_ROOT = Path(__file__).resolve().parents[1] CANONICAL_DESCRIPTION = ( "Bloomberg Desktop API request/response data in pandas DataFrames for quantitative research" ) DOCUMENTATION_URL = "https://bloombergfetch....
ArturSepp/BloombergFetch
tests/test_identity_metadata.py
.py
c977774dd9885c64
8.15
19
"""Contracts separating pytest modules, development runners, and examples.""" from __future__ import annotations import ast from pathlib import Path REPOSITORY_ROOT = Path(__file__).resolve().parents[1] PACKAGE_ROOT = REPOSITORY_ROOT / "src" / "bbg_fetch" TESTS_ROOT = REPOSITORY_ROOT / "tests" EXAMPLES_ROOT = REPOSI...
ArturSepp/BloombergFetch
tests/test_module_layout.py
.py
ef39c2b098298bec
8.15
19
"""Repository-only packaging layout checks.""" from pathlib import Path REPOSITORY_ROOT = Path(__file__).resolve().parents[1] def test_import_package_uses_src_layout() -> None: """Keep the import package isolated from the repository root.""" package_root = REPOSITORY_ROOT / "src" / "bbg_fetch" assert ...
ArturSepp/BloombergFetch
tests/test_repository_layout.py
.py
0119ce93ff990fce
8.15
19
""" Script to remove company history entries that are not present in the company list files """ import json import sys from src.companies import Companies from src.logging_utils import get_logger logger = get_logger(__name__) def cleanup_history(history_file: str, company_list: list, label: str) -> tuple[int, int]:...
crypto-jobs-fyi/crawler
cleanup_history_all.py
.py
e2c9fe27a28f06d0
7.48
8
""" Script to remove job links from jobs age files that are not in the jobs.json files """ import json import sys import re from src.logging_utils import get_logger logger = get_logger(__name__) def extract_url_from_html_link(html_link: str) -> str: """Extract URL from HTML link tag like <a href='url'>text</a>"...
crypto-jobs-fyi/crawler
cleanup_jobs_age.py
.py
74dec37cec7e354e
7.48
8
import json from src.companies import Companies from src.logging_utils import get_logger # Filter companies specifically for the AI category company_list = Companies.filter_companies(category="ai") Companies.write_companies('ai_companies.json', company_list) logger = get_logger(__name__) # Main output file for AI job...
crypto-jobs-fyi/crawler
merge_ai_jobs.py
.py
e8530ca8480db29d
7.48
8
import json from src.companies import Companies from src.logging_utils import get_logger # Filter companies specifically for the Crypto category company_list = Companies.filter_companies(category="crypto") Companies.write_companies('crypto_companies.json', company_list) logger = get_logger(__name__) # Main output fil...
crypto-jobs-fyi/crawler
merge_crypto_jobs.py
.py
96e46743b626a8ff
7.48
8