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 |
|---|---|---|---|---|---|---|
#
# Module `demo`: implements demos for `diskinfo` package.
# Peter Sulyok (C) 2022-2026.
#
import sys
from rich import print as rprint
from rich.panel import Panel
from rich.table import Table
from rich import box
from rich.console import Group
from diskinfo import DiskType, Disk, DiskInfo, size_in_hrf, time_in_... | petersulyok/diskinfo | src/diskinfo/demo.py | .py | b0cdb92bffcddcac | 7.56 | 12 |
#
# Module `diskinfo`: implements `DiskInfo` class.
# Peter Sulyok (C) 2022-2026.
#
from typing import List
from pyudev import Context
from diskinfo.disktype import DiskType
from diskinfo.disk import Disk
class DiskInfo:
"""This class implements disk exploration functionality. At class initialization time a... | petersulyok/diskinfo | src/diskinfo/diskinfo.py | .py | 61503e402d8aaa04 | 7.56 | 12 |
#
# Module `disksmart`: implements `DiskSmartData`, SmartAttribute, and NvmeAttributes classes.
# Peter Sulyok (C) 2022-2026.
#
from typing import List
class SmartAttribute:
"""This class implements a SMART attribute. It stores ten values from `smartctl` command.
Example:
This class presents on... | petersulyok/diskinfo | src/diskinfo/disksmart.py | .py | 5f5948ed7fff42fb | 7.56 | 12 |
#
# Module `filesystem`: implements `FileSystem` class.
# Peter Sulyok (C) 2022-2026.
#
import os
import re
from typing import Tuple
from pyudev import Device
from diskinfo.utils import size_in_hrf, _pyudev_getenc
# Path to the kernel mount table.
_PROC_MOUNTS = "/proc/mounts"
# Octal escape sequence used by th... | petersulyok/diskinfo | src/diskinfo/filesystem.py | .py | c541741e7436ab20 | 7.56 | 12 |
import json
import os
import re
import sys
import requests
import dotenv
# Color constants
# Reference: https://gist.github.com/chrisopedia/8754917
COLERR="\033[0;31m"
COLINFO="\033[0;35m"
COLRESET="\033[m"
baseurl = 'https://api.github.com'
DUMP_CARDS_PATH = os.getcwd()
DOTENV_PATH = f"{DUMP_CARDS_PATH}/.env"
dot... | atsign-company/dump_cards | atdumpcards.py | .py | ab485a4e966a4f66 | 7.48 | 8 |
from __future__ import absolute_import
import errno
import logging
import os
import pygo_plugin
from pygo_plugin._examples.kv.shared import kv_pb2, kv_pb2_grpc
class KVPlugin(pygo_plugin.Plugin):
"""
Our plugin implementation for a client and server to
use the KV service
"""
def client_class(sel... | justinfx/pygo-plugin | src/pygo_plugin/_examples/kv/shared/kv_plugin.py | .py | 40e4f1af7926d805 | 7.48 | 8 |
from __future__ import absolute_import
from . import _native
from . import plugin
__all__ = ['Client', 'ClientConfig', 'Cmd', 'ReattachConfig']
class Cmd(object):
def __init__(self, args=None):
"""
Args:
args (str or list[str]): Command and arguments to run
"""
self.... | justinfx/pygo-plugin | src/pygo_plugin/client.py | .py | 4d39b1316e8c19ed | 7.48 | 8 |
from __future__ import absolute_import
import abc
import grpc
__all__ = ['Plugin', 'HandshakeConfig']
class HandshakeConfig(object):
"""
Plain, dependency-free stand-in for the Go-bound ``plugin.HandshakeConfig``
struct, so a plugin subprocess can build one without pulling in the
compiled gopy ext... | justinfx/pygo-plugin | src/pygo_plugin/plugin.py | .py | 59d57af6d2562b49 | 7.48 | 8 |
from __future__ import absolute_import
import contextlib
import os
import shutil
import sys
import tempfile
import threading
import rpyc
from rpyc.utils.factory import unix_connect
from rpyc.utils.server import ThreadedServer
import pygo_plugin
import pygo_plugin.utils
__all__ = ['RpycInterpPlugin', 'handshake_con... | justinfx/pygo-plugin | src/pygo_plugin/pyinterp/plugin.py | .py | e139c337c0b7b4ff | 7.48 | 8 |
from __future__ import absolute_import, print_function
import threading
from concurrent import futures
import logging
import multiprocessing
import os
import sys
import tempfile
import typing
import grpc
from grpc_health.v1.health import HealthServicer
from grpc_health.v1 import health_pb2, health_pb2_grpc
from grpc_... | justinfx/pygo-plugin | src/pygo_plugin/server.py | .py | 816e0f446005fbc7 | 7.48 | 8 |
from __future__ import absolute_import
import contextlib
import socket
_MAX_PORT = 65535
def find_free_port(min_port=1024, max_port=_MAX_PORT):
"""
Find a free port between a given range.
If min_port=0, return a completely random free port.
Args:
min_port (int): first port number to try
... | justinfx/pygo-plugin | src/pygo_plugin/utils.py | .py | d78d26866f1fd589 | 7.48 | 8 |
"""
This code performs simple file checks, with particular consideration of geospatial files.
Author: Philip G. Brodrick, philip.brodrick@jpl.nasa.gov
"""
import os
from osgeo import gdal
import logging
import numpy as np
from spectral.io import envi
def check_cloudfraction(mask_file: str, mask_band: int | list = 5... | emit-sds/emit-utils | emit_utils/file_checks.py | .py | 8b31aaa146492062 | 7.48 | 8 |
"""
This code does some useful manipulations on multiple raster files.
Author: Philip G. Brodrick, philip.brodrick@jpl.nasa.gov
"""
from osgeo import gdal
import numpy as np
import logging
import os
def get_bounding_extent(file_list: np.array, return_pixel_offsets=False, return_spatial_offsets=False,
... | emit-sds/emit-utils | emit_utils/multi_raster_info.py | .py | dce56d3dccceb011 | 7.48 | 8 |
"""
Module storing the implementation of a circular progress bar in kivy.
.. note::
Refer to the in-code documentation of the class and its methods to learn about the tool. Includes a usage example.
Authorship: Kacper Florianski
"""
from kivy.uix.widget import Widget
from kivy.app import App
from kivy.core.text... | EtalumaSupport/LumaViewPro | custom_widgets/circular_progress_bar.py | .py | f3b6bd29c9035414 | 7.56 | 12 |
'''
MIT License
Copyright (c) 2024 Etaluma, Inc.
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... | EtalumaSupport/LumaViewPro | labware.py | .py | fc8461c7e1e819d3 | 7.56 | 12 |
#!/usr/bin/python3
'''
MIT License
Copyright (c) 2024 Etaluma, Inc.
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, modi... | EtalumaSupport/LumaViewPro | lvp_logger.py | .py | f15afca221c27b8e | 7.56 | 12 |
'''
MIT License
Copyright (c) 2024 Etaluma, Inc.
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... | EtalumaSupport/LumaViewPro | modules/labware_loader.py | .py | b5131f626e18f503 | 7.56 | 12 |
'''
MIT License
Copyright (c) 2024 Etaluma, Inc.
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... | EtalumaSupport/LumaViewPro | modules/objectives_loader.py | .py | 2a339d80a8232cca | 7.56 | 12 |
try:
from kivy.clock import Clock
except ImportError:
# Subprocess mode - dummy Clock
class Clock:
@staticmethod
def schedule_once(func, timeout):
# In subprocess, call immediately without UI scheduling
if callable(func):
try:
fun... | EtalumaSupport/LumaViewPro | modules/sequential_io_executor.py | .py | 7cc73086414266e0 | 7.56 | 12 |
"""
Environment facts worth having when something looks wrong.
Written after a run of blank toolbar icons that took three rounds to explain:
the venv's PyQt6 wheel bundles QtSvg, the distribution package does not, and
nothing in the app said so. Everything here is collected as plain data so it
can be asserted in tests... | nexusriot/s3duck | diagnostics.py | .py | a9ae5127a3b076f4 | 7.45 | 7 |
from PyQt6.QtCore import *
from PyQt6.QtWidgets import *
from PyQt6.QtGui import *
from utils import center_on_screen, release_worker_on_finish
class _SizeWorker(QObject):
"""Sums a prefix's size off the main thread (a recursive listing)."""
done = pyqtSignal(object, object) # (size_or_None, exception_or_N... | nexusriot/s3duck | properties_window.py | .py | 907361156947c3d5 | 7.45 | 7 |
# type: ignore
import os
from lamp_py.aws.s3 import file_list_from_s3_with_details
from lamp_py.runtime_utils.remote_files import S3_SPRINGBOARD
import polars as pl
import plotly.express as px
import pyarrow.dataset as pd
import pyarrow.parquet as pq
from pyarrow.fs import S3FileSystem
# Problem: Looking into data qua... | mbta/lamp | analysis/prism.py | .py | 3782d22777123325 | 7.6 | 15 |
from datetime import timedelta
import datetime
import os
from typing import List
from lamp_py.bus_performance_manager.events_joined import TMDailyWorkPiece
from lamp_py.tableau.conversions import convert_gtfs_rt_trip_updates, convert_gtfs_rt_vehicle_position
from lamp_py.tableau.hyper import HyperJob
from lamp_py.tabl... | mbta/lamp | runners/run_gtfs_rt_parquet_converter.py | .py | b2b8a84ddef7c831 | 7.6 | 15 |
# pylint: disable=too-many-positional-arguments,too-many-arguments, too-many-locals, redefined-outer-name, R0801
from concurrent.futures import ThreadPoolExecutor
import logging
import os
from datetime import date, datetime, timedelta
from pathlib import Path
from queue import Queue
from typing import Dict, Iterable, ... | mbta/lamp | src/lamp_py/ad_hoc/backfill_runner.py | .py | 90bb818a5a0d0fb9 | 7.6 | 15 |
import os
from datetime import date
from datetime import timedelta
import pyarrow.parquet as pq
from lamp_py.runtime_utils.process_logger import ProcessLogger
from lamp_py.postgres.postgres_utils import start_rds_writer_process
from lamp_py.runtime_utils.remote_files import S3_ARCHIVE
from lamp_py.runtime_utils.remot... | mbta/lamp | src/lamp_py/ad_hoc/runner_001.py | .py | c2da40b76b68404a | 7.6 | 15 |
import os
from datetime import datetime, timedelta
import sqlalchemy as sa
import pyarrow
from lamp_py.performance_manager.flat_file import S3Archive
from lamp_py.performance_manager.gtfs_utils import static_version_key_from_service_date
from lamp_py.postgres.rail_performance_manager_schema import (
StaticRoutes,... | mbta/lamp | src/lamp_py/ad_hoc/runner_002.py | .py | 0a196502387ca91d | 7.6 | 15 |
import time
import os
import sys
from multiprocessing import Process
from queue import Queue
from typing import Any, Optional
import boto3
from lamp_py.runtime_utils.process_logger import ProcessLogger
def handle_ecs_sigterm(_: int, __: Any) -> None:
"""
handler function for when ECS recieves ECS SIGTERM
... | mbta/lamp | src/lamp_py/aws/ecs.py | .py | f0053ab47a845804 | 7.6 | 15 |
from typing import List, Dict, Optional
import json
import boto3
from lamp_py.runtime_utils.process_logger import ProcessLogger
class KinesisReader:
"""
Wrapper class for reading a Kinesis Stream, keeping alive a shard
"""
def __init__(self, stream_name: str) -> None:
"""
initialize... | mbta/lamp | src/lamp_py/aws/kinesis.py | .py | 899fc9f00f4c0f0a | 7.6 | 15 |
import dataframely as dy
import polars as pl
from lamp_py.bus_performance_manager.events_gtfs_rt import remove_rare_variant_route_suffix
from lamp_py.bus_performance_manager.events_tm_schedule import TransitMasterSchedule
from lamp_py.bus_performance_manager.events_gtfs_schedule import GTFSBusSchedule
from lamp_py.run... | mbta/lamp | src/lamp_py/bus_performance_manager/combined_bus_schedule.py | .py | bf3b5a0be054110d | 7.6 | 15 |
import re
from typing import Optional, Dict, List
from datetime import timedelta, date
import polars as pl
from lamp_py.aws.s3 import file_list_from_s3_with_details, dt_from_obj_path, get_last_modified_object
from lamp_py.runtime_utils.remote_files import (
springboard_rt_vehicle_positions,
tm_stop_crossing,
... | mbta/lamp | src/lamp_py/bus_performance_manager/event_files.py | .py | 4090d0c3517f6f2c | 7.6 | 15 |
from datetime import date
from typing import List
import dataframely as dy
import polars as pl
from pyarrow.fs import S3FileSystem
import pyarrow.compute as pc
from lamp_py.bus_performance_manager.events_gtfs_schedule import BusBaseSchema
from lamp_py.utils.gtfs_utils import bus_route_ids_for_service_date
from lamp_p... | mbta/lamp | src/lamp_py/bus_performance_manager/events_gtfs_rt.py | .py | 1e96d414e073f610 | 7.6 | 15 |
from typing import List, Tuple
from datetime import date
import dataframely as dy
import polars as pl
from lamp_py.bus_performance_manager.events_joined import TMDailyWorkPiece
from lamp_py.bus_performance_manager.combined_bus_schedule import join_tm_schedule_to_gtfs_schedule
from lamp_py.bus_performance_manager.even... | mbta/lamp | src/lamp_py/bus_performance_manager/events_metrics.py | .py | 2e89c4bbd5c64377 | 7.6 | 15 |
from datetime import datetime
import random
from typing import List
import dataframely as dy
import polars as pl
from lamp_py.bus_performance_manager.events_gtfs_schedule import BusBaseSchema
from lamp_py.bus_performance_manager.events_tm_schedule import TransitMasterSchedule
from lamp_py.runtime_utils.remote_files i... | mbta/lamp | src/lamp_py/bus_performance_manager/events_tm.py | .py | 1903e1ab8edb85db | 7.6 | 15 |
import os
from datetime import date
import dataframely as dy
import polars as pl
from lamp_py.bus_performance_manager.events_gtfs_schedule import BusBaseSchema
from lamp_py.runtime_utils.process_logger import ProcessLogger
from lamp_py.runtime_utils.remote_files import (
tm_daily_sched_adherence_waiver_file,
... | mbta/lamp | src/lamp_py/bus_performance_manager/events_tm_schedule.py | .py | 0c48592c5973a1db | 7.6 | 15 |
#!/usr/bin/env python
import argparse
import logging
import os
import sched
import signal
import sys
import time
from typing import List
from lamp_py.aws.ecs import handle_ecs_sigterm, check_for_sigterm
from lamp_py.runtime_utils.env_validation import validate_environment
from lamp_py.runtime_utils.process_logger imp... | mbta/lamp | src/lamp_py/bus_performance_manager/pipeline.py | .py | 6164611f1a1233c6 | 7.6 | 15 |
from datetime import date, timedelta
import os
import tempfile
from typing import Optional
from polars.exceptions import ComputeError
import pyarrow.parquet as pq
from lamp_py.bus_performance_manager.event_files import event_files_to_load, service_date_from_filename
from lamp_py.bus_performance_manager.events_metrics... | mbta/lamp | src/lamp_py/bus_performance_manager/write_events.py | .py | 1502efd48d73b195 | 7.6 | 15 |
from rdkit import Chem
from .atom import GetSeenIndex
from .conf import GetRoundedDihedral
from .tokens import BOND_SYMBOL_FOR_DIHEDRAL, E, Z
def _kekulized_bond_type(b):
"""Return the Kekulized bond type, caching the Kekulized mol on first call."""
mol = b.GetOwningMol()
if not hasattr(mol, "_kekulized"... | hstern2/amsr | amsr/bond.py | .py | c7513908c8e80009 | 7.54 | 11 |
from typing import Optional
from rdkit import Chem
from .decode import ToMol
from .encode import FromMol
def CheckMol(m1: Chem.Mol, stringent: Optional[bool] = True) -> bool:
"""Do round trip from RDKit mol m to AMSR.
Compare InChI strings (with -FixedH) before and after round trip.
:param m: RDKit Mol... | hstern2/amsr | amsr/check.py | .py | 14abb428234ff93c | 7.54 | 11 |
from re import escape, match
from typing import Optional
from rdkit import Chem
from .atom import Atom
from .bfs import BFSTree
from .bond import Bond
from .groups import DecodeGroups
from .parity import IsEvenParity
from .pibonds import PiBonds
from .tokens import (
DIHEDRAL_FOR_BOND_SYMBOL,
L_BRACKET,
R... | hstern2/amsr | amsr/decode.py | .py | 4f4d8c189be15dc4 | 7.54 | 11 |
import math
from random import shuffle
from typing import Optional
from rdkit import Chem
from rdkit.Chem import rdMolTransforms
from .atom import Atom, GetSeenIndex, IsSeen, SetSeenIndex, UnSee
from .bfs import BFSFind
from .bond import Bond
from .groups import EncodeGroups
from .tokens import DOT, MOLSEP, SKIP, _re... | hstern2/amsr | amsr/encode.py | .py | 93c09b42c6cb9fc3 | 7.54 | 11 |
from random import choices
from typing import Any, Optional
from rdkit import Chem
from .count import Count
from .encode import FromMolToTokens
START_TOKEN = "[START]"
END_TOKEN = "[END]"
class Markov:
"""generate molecules using a simple Markov model
:param mols: rdkit Mols, from which to draw token freq... | hstern2/amsr | amsr/markov.py | .py | 4af8504304993894 | 7.54 | 11 |
from random import expovariate, randrange
from typing import Optional
from rdkit import Chem
from .decode import ToMol
from .encode import FromMolToTokens
from .lstm import LSTMModel
class Modifier:
"""modify a molecule by shuffling atom order, deleting tokens,
then adding tokens
:param mols: rdkit Mol... | hstern2/amsr | amsr/modifier.py | .py | 5e4697e529e3de61 | 7.54 | 11 |
from Levenshtein import editops
from rdkit import Chem
from .decode import ToMol
from .encode import FromSmilesToTokens
class Morph:
"""morph between two molecules, by taking the minimum-edit pathway
between their string representations
:param s: list of AMSR tokens
:param t: list of AMSR tokens
... | hstern2/amsr | amsr/morph.py | .py | 09478f7567f24d78 | 7.54 | 11 |
from re import compile, escape
# 12 dihedral symbols: 30 degree discretization
DIHEDRALS = ["^^", "^\\", "<\\", ">>", "</", "_/", "__", "\\_", "\\>", "<<", "/>", "/^"]
# 24 dihedral symbols: 15 degree discretization
# DIHEDRALS = [f"/{chr(x)}" for x in range(ord("a"), ord("y"))]
N_DIHEDRALS = len(DIHEDRALS)
Z = DIHE... | hstern2/amsr | amsr/tokens.py | .py | abdcf0ddb86283f6 | 7.54 | 11 |
from rdkit import Chem
from rdkit.Chem import AllChem
import amsr
from amsr.tokens import ToTokens, _insert_implicit_carbon, _remove_implicit_carbon
caffeine_smi = "Cn1cnc2c1c(=O)n(C)c(=O)n2C"
taxol_smi = (
"CC1=C2[C@H](C(=O)[C@@]3([C@H](C[C@@H]4[C@]([C@H]3[C@@H]"
"([C@@](C2(C)C)(C[C@@H]1OC(=O)[C@@H]([C@H](C5... | hstern2/amsr | tests/test_basic.py | .py | 0f126d3313693a98 | 7.04 | 11 |
import datetime
import re
import logging
from constants import (
COLORED_DIESEL,
DIESEL,
GASOLINE_95,
GASOLINE_98,
CURRENT_WEEK,
PREVIOUS_WEEK,
START_DATE_KEY,
END_DATE_KEY,
GAS_KEY,
DIESEL_TW,
GASOLINE_95_TW,
GASOLINE_98_TW,
)
# Configure logging
logging.basicConfig(le... | carlosrsabreu/devo-abastecer | functions.py | .py | e263264688419315 | 7.52 | 10 |
import os
import logging
from atproto import Client
from functions import format_social_media_message
# Configure logging
logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(message)s")
def create_client_bluesky():
return Client()
def make_bsky_post_image(post_message, image_path):
"""
Upl... | carlosrsabreu/devo-abastecer | post_bsky.py | .py | a27f630002b88b10 | 7.52 | 10 |
import os
import logging
import tweepy
from functions import format_social_media_message
# Configure logging
logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(message)s")
def create_client_twitter():
consumer_key = os.getenv("CONSUMER_KEY")
consumer_secret = os.getenv("CONSUMER_SECRET")
a... | carlosrsabreu/devo-abastecer | post_tweet.py | .py | 2031cc7b5cc9b2f3 | 7.52 | 10 |
import datetime
from functions import (
retrieve_week_by_date,
return_next_week_by_date,
replace_gas_keys_names,
)
from constants import GASOLINE_95, DIESEL, COLORED_DIESEL
def test_retrieve_week_by_date():
# Test with a known Monday (2024-05-20)
date_monday = datetime.datetime(2024, 5, 20)
ex... | carlosrsabreu/devo-abastecer | tests/test_functions.py | .py | 01695ac1e91c88a0 | 7.02 | 10 |
#!/usr/bin/env python3
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = r'''
---
module: versa_device_get_operations
short_description: Versa Networks Module to perform get device BGP/route-table related operational data using REST API calls against Versa Direct... | versa-networks/devops | ansible/Versa Custom Ansible Module/modules/versa_device_get_rt_operations.py | .py | e3262690514e6d55 | 7.52 | 10 |
#!/usr/bin/env python
import cmd
import getpass
#import sites_list
import json
import jsondiff
import urllib3
import os
import yaml
import requests
import click
import time
#from clint import resources
#from clint import arguments
from datetime import datetime
#from jsndiff import diff
#from files import File
#from s... | versa-networks/devops | python/Copy Files in Bulk to Appliances/main.py | .py | 1a165af8a3552bb1 | 7.52 | 10 |
from logging.config import fileConfig
from sqlalchemy import engine_from_config, pool
from alembic import context
# 加载项目配置
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
from app.config import settings
from app.models import Base
# this is the Alembic Config object
config = co... | Palpitate-xus/hoimsystem | fastapi_be/alembic/env.py | .py | 22043b5c50f75e81 | 7.52 | 10 |
"""initial migration
Revision ID: 1f24ea8140a3
Revises:
Create Date: 2026-05-10 15:40:06.488574
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = '1f24ea8140a3'
down_revision: Union[str, Sequence[str], None] = None
branch... | Palpitate-xus/hoimsystem | fastapi_be/alembic/versions/1f24ea8140a3_initial_migration.py | .py | 54483563d11d2fc3 | 7.52 | 10 |
"""expand user role length
Revision ID: 20260608_user_role
Revises: 1f24ea8140a3
Create Date: 2026-06-08 00:00:00.000000
"""
from collections.abc import Sequence
import sqlalchemy as sa
from alembic import op
revision: str = "20260608_user_role"
down_revision: str | Sequence[str] | None = "1f24ea8140a3"
branch_lab... | Palpitate-xus/hoimsystem | fastapi_be/alembic/versions/20260608_expand_user_role_length.py | .py | 15a061229808390b | 7.52 | 10 |
from __future__ import annotations
import sys
from typing import Any
from .exception_classes import HandlerException
if sys.version_info >= (3, 11):
from datetime import UTC, datetime
else:
from datetime import datetime, timezone
import hashlib
import math
from time import time
from .const import API_KEY, A... | Ludy87/pyxplora_api | src/pyxplora_api/handler_gql.py | .py | 25966748f8551d8d | 7.56 | 12 |
"""Exception Class.""" # numpydoc ignore=ES01,EX01
from __future__ import annotations
from collections.abc import Callable
from typing import TypeVar
import warnings
T = TypeVar("T")
def deprecated(func: Callable[..., T], alias_func: str | None = None) -> Callable[..., T]: # numpydoc ignore=ES01,PR01,PR02,PR04,P... | Ludy87/pyecotrend-ista | src/pyecotrend_ista/exception_classes.py | .py | 7b883eb428181795 | 7.62 | 16 |
"""Login helper for Keycloak.""" # numpydoc ignore=EX01,ES01
from __future__ import annotations
import html
import logging
import re
from typing import Any, cast
import urllib.parse
import requests
from requests.adapters import HTTPAdapter, Retry
from .const import (
CLIENT_ID,
DEMO_USER_ACCOUNT,
GRANT... | Ludy87/pyecotrend-ista | src/pyecotrend_ista/login_helper.py | .py | 597dbaedf44bf45b | 7.62 | 16 |
# numpydoc ignore=EX01
"""
Types for PyEcotrendIsta.
This module defines various TypedDicts used in the PyEcotrendIsta client to represent
responses and data structures from the ista EcoTrend API.
See Also
--------
PyEcotrendIsta : The main client class for interacting with the ista EcoTrend API.
"""
from typing imp... | Ludy87/pyecotrend-ista | src/pyecotrend_ista/types.py | .py | ad430a31d6d30841 | 7.62 | 16 |
"""Tests for `get_consumption_unit_details` method."""
from http import HTTPStatus
import pytest
import requests
from requests_mock.mocker import Mocker as RequestsMock
from syrupy.assertion import SnapshotAssertion
from pyecotrend_ista import LoginError, ParserError, PyEcotrendIsta, ServerError
from pyecotrend_ista... | Ludy87/pyecotrend-ista | tests/test_consumption_unit_details.py | .py | 0048a026aff53845 | 8.12 | 16 |
"""Tests for _set_account methods."""
from http import HTTPStatus
import pytest
import requests
from requests_mock.mocker import Mocker as RequestsMock
from syrupy.assertion import SnapshotAssertion
from syrupy.filters import paths
from pyecotrend_ista import LoginError, ParserError, PyEcotrendIsta, ServerError
from... | Ludy87/pyecotrend-ista | tests/test_consumptions.py | .py | e5be45e3fb14474f | 8.12 | 16 |
"""Tests for Login methods."""
from http import HTTPStatus
import pytest
import requests
from requests_mock.mocker import Mocker as RequestsMock
from syrupy.assertion import SnapshotAssertion
from pyecotrend_ista import ParserError, PyEcotrendIsta, ServerError
from pyecotrend_ista.const import API_BASE_URL
from test... | Ludy87/pyecotrend-ista | tests/test_login.py | .py | 78cf1cc4b78a222b | 7.12 | 16 |
"""Tests for utility methods."""
from typing import cast
import pytest
from syrupy.assertion import SnapshotAssertion
from pyecotrend_ista import PyEcotrendIsta
from pyecotrend_ista.const import VERSION
from pyecotrend_ista.types import AccountResponse
def test_get_uuids(ista_client: PyEcotrendIsta) -> None:
... | Ludy87/pyecotrend-ista | tests/test_other.py | .py | 5a71bcd033f85029 | 7.12 | 16 |
"""Tests for _set_account methods."""
from http import HTTPStatus
import pytest
import requests
from requests_mock.mocker import Mocker as RequestsMock
from syrupy.assertion import SnapshotAssertion
from pyecotrend_ista import LoginError, ParserError, PyEcotrendIsta, ServerError
from pyecotrend_ista.const import API... | Ludy87/pyecotrend-ista | tests/test_set_account.py | .py | 7152c692a4f37f82 | 8.12 | 16 |
"""Group of methods for working with payment addresses."""
import json
import logging
import pathlib as pl
from cardano_clusterlib import clusterlib_helpers
from cardano_clusterlib import helpers
from cardano_clusterlib import structs
from cardano_clusterlib import types as itp
LOGGER = logging.getLogger(__name__)
... | input-output-hk/cardano-clusterlib-py | cardano_clusterlib/address_group.py | .py | bae5c74fef7440cb | 7.66 | 20 |
"""Helper functions for `ClusterLib`."""
import dataclasses
import datetime
import json
import logging
import pathlib as pl
import re
import time
import typing as tp
from cardano_clusterlib import exceptions
from cardano_clusterlib import types as itp
LOGGER = logging.getLogger(__name__)
SPECIAL_ARG_CHARS_RE = re.c... | input-output-hk/cardano-clusterlib-py | cardano_clusterlib/clusterlib_helpers.py | .py | eb501ae6a5382f3a | 7.66 | 20 |
"""Wrapper for cardano-cli for working with cardano cluster."""
import json
import logging
import pathlib as pl
import subprocess
import time
from packaging import version
from cardano_clusterlib import address_group
from cardano_clusterlib import clusterlib_helpers
from cardano_clusterlib import compat_group
from c... | input-output-hk/cardano-clusterlib-py | cardano_clusterlib/clusterlib_klass.py | .py | 442bcb651aadffca | 7.66 | 20 |
"""Group of subgroups for cardano-cli 'compatible' commands (legacy eras)."""
import logging
from cardano_clusterlib import compat_common
from cardano_clusterlib import types as itp
LOGGER = logging.getLogger(__name__)
class CompatibleAlonzoGroup:
"""Wrapper exposing the generic compat groups for the Alonzo er... | input-output-hk/cardano-clusterlib-py | cardano_clusterlib/compat_group.py | .py | 88518066b63b125d | 7.66 | 20 |
import enum
import typing as tp
DEFAULT_COIN: tp.Final[str] = "lovelace"
MAINNET_MAGIC: tp.Final[int] = 764824073
CONFIRM_BLOCKS_NUM: tp.Final[int] = 2
# The SUBCOMMAND_MARK is used to mark the beginning of a subcommand. It is used to differentiate
# between options and subcommands. That is needed for CLI coverage re... | input-output-hk/cardano-clusterlib-py | cardano_clusterlib/consts.py | .py | f6274aad4fc639d2 | 7.66 | 20 |
"""Group of methods related to genesis block."""
import logging
import pathlib as pl
from cardano_clusterlib import clusterlib_helpers
from cardano_clusterlib import exceptions
from cardano_clusterlib import helpers
from cardano_clusterlib import structs
from cardano_clusterlib import types as itp
LOGGER = logging.g... | input-output-hk/cardano-clusterlib-py | cardano_clusterlib/genesis_group.py | .py | 5700739d0f494440 | 7.66 | 20 |
"""Group of subgroups for governance in Conway+ eras."""
import logging
from cardano_clusterlib import gov_action_group
from cardano_clusterlib import gov_committee_group
from cardano_clusterlib import gov_drep_group
from cardano_clusterlib import gov_vote_group
from cardano_clusterlib import types as itp
LOGGER = l... | input-output-hk/cardano-clusterlib-py | cardano_clusterlib/gov_group.py | .py | 9f857b0f8d8def7f | 7.66 | 20 |
import itertools
import pathlib as pl
import random
import string
from cardano_clusterlib import exceptions
from cardano_clusterlib import types as itp
def get_rand_str(length: int = 8) -> str:
"""Return random ASCII lowercase string."""
if length < 1:
return ""
return "".join(random.choice(strin... | input-output-hk/cardano-clusterlib-py | cardano_clusterlib/helpers.py | .py | 298f711293cb5d09 | 7.66 | 20 |
"""Group of methods for working with key commands."""
import logging
import pathlib as pl
import typing as tp
from cardano_clusterlib import clusterlib_helpers
from cardano_clusterlib import consts
from cardano_clusterlib import helpers
from cardano_clusterlib import types as itp
LOGGER = logging.getLogger(__name__)... | input-output-hk/cardano-clusterlib-py | cardano_clusterlib/key_group.py | .py | 62a34c48e2d50c11 | 7.66 | 20 |
"""Support for interfacing with Nuvo Multi-Zone Amplifier via serial/RS-232."""
import logging
import voluptuous as vol
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import config_validation as cv, entity_platform
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoTyp... | brmccrary/nuvo_simple | custom_components/nuvo_simple/binary_sensor.py | .py | 9a940e8d52994cdf | 7.42 | 6 |
"""Python interface for Fresh Intellivent Sky bathroom ventilation fan."""
from __future__ import annotations
import asyncio
import logging
from typing import Any, Union
from uuid import UUID
from bleak import BleakClient
from bleak.backends.device import BLEDevice
from bleak.exc import BleakError
from bleak_retry_c... | LaStrada/pyfreshintellivent | pyfreshintellivent/__init__.py | .py | db58b05300ef91f3 | 7.56 | 12 |
"""Helper functions for Fresh Intellivent Sky devices."""
from typing import Union
DETECTION_LOW = "Low"
DETECTION_MEDIUM = "Medium"
DETECTION_HIGH = "High"
def validated_authentication_code(value: Union[bytes, bytearray, str]) -> bytearray:
"""Validate authentication code input."""
if value is None:
... | LaStrada/pyfreshintellivent | pyfreshintellivent/helpers.py | .py | 7bf30c0d5ccaa94b | 7.56 | 12 |
"""Parser for Fresh Intellivent Sky mode settings."""
from struct import pack, unpack
from typing import Any, Union
from . import helpers as h
class SkyModeParser:
"""Parser for Fresh Intellivent Sky mode settings."""
def airing_read(
self, value: Union[bytes, bytearray]
) -> dict[str, Union[bo... | LaStrada/pyfreshintellivent | pyfreshintellivent/parser.py | .py | 3464768b94856b3e | 7.56 | 12 |
"""BLE device scanner for Fresh Intellivent Sky devices."""
from bleak import BleakScanner
from bleak.backends.device import BLEDevice
from bleak.backends.scanner import AdvertisementData
from . import characteristics, consts
async def scan(timeout: float = 20.0) -> BLEDevice | None:
"""Scan for Fresh Intellive... | LaStrada/pyfreshintellivent | pyfreshintellivent/scanner.py | .py | a339689fcc94cc11 | 7.56 | 12 |
"""Sensor data parsing for Fresh Intellivent Sky devices."""
from math import log
from struct import unpack
from typing import Any, Union
MODE_UNKNOWN = "Unknown"
_MODES = {
0: "Off",
6: "Pause",
16: "Constant speed",
34: "Light",
35: "Timer",
49: "Humidity",
52: "VOC",
103: "Boost",
... | LaStrada/pyfreshintellivent | pyfreshintellivent/sensors.py | .py | 5edfffba879e199d | 7.56 | 12 |
import pytest
from pyfreshintellivent.sensors import SkySensors
sensors = SkySensors()
def test_skysensors_valid():
# TODO: Add humidity tests
sensors.parse_data(bytearray.fromhex("00009001CE090000E8033C0A000000"))
assert sensors.status is False
assert sensors.temperature == 25.1
assert sensors.... | LaStrada/pyfreshintellivent | tests/test_sky_sensors.py | .py | 13b5242a4e7ebd00 | 7.06 | 12 |
"""This linter checks for Note and Warning notation for a particular format"""
import os
import re
import sys
from typing import Pattern, List
SEARCH_NOTE_PATTERN: Pattern[str] = re.compile(r'^\[\!NOTE\]')
SEARCH_TIP_PATTERN: Pattern[str] = re.compile(r'^\[\!TIP\]')
SEARCH_IMPORTANT_PATTERN: Pattern[str] = re.compile(... | oppia/oppia-web-developer-docs | scripts/linter.py | .py | 7413422e67365ffa | 7.64 | 18 |
"""
This is the package init for UQTestFuns.
"""
import sys
from .core import Marginal
from .core import ProbInput
from .core import (
UQTestFunBareABC,
UQTestFunABC,
UQTestFunFixDimABC,
UQTestFunVarDimABC,
)
from .core import UQTestFun
from .core import FunParams
from .core import RealVariable
from .... | damar-wicaksono/uqtestfuns | src/uqtestfuns/__init__.py | .py | 2194eed7edd9509d | 8.04 | 11 |
"""
Module with an abstract class for defining a design variable.
"""
from __future__ import annotations
import numpy as np
from abc import ABC, abstractmethod
from typing import Optional
__all__ = ["DesignVariableABC"]
class DesignVariableABC(ABC):
_rng: Optional[np.random.Generator] = None
_rng_seed: O... | damar-wicaksono/uqtestfuns | src/uqtestfuns/core/design_vars/design_variable_abc.py | .py | 866bcffa04abb640 | 8.04 | 11 |
"""
Module with concrete implementation of real (continuous) design variables.
"""
from __future__ import annotations
import numpy as np
from numpy.random._generator import Generator
from typing import Optional, Union
from .design_variable_abc import DesignVariableABC
class RealVariable(DesignVariableABC):
""... | damar-wicaksono/uqtestfuns | src/uqtestfuns/core/design_vars/real_variable.py | .py | 437b2c55895d31c1 | 8.04 | 11 |
"""
This module contains the implementation of FunParams a class that stores
UQ Test function parameters.
"""
from __future__ import annotations
import numpy as np
import textwrap
import warnings
from collections.abc import Mapping, Iterator
from tabulate import tabulate
from typing import Any, Dict, List, Optional
... | damar-wicaksono/uqtestfuns | src/uqtestfuns/core/parameters.py | .py | 38b4fc3301b8cdf6 | 8.04 | 11 |
"""
Module with an implementation of ``Marginal`` class.
This module provides the :class:`Marginal` class, which models a single random
variable through a parametric probability distribution. It is intended as
the building block for probabilistic input models, where each input dimension
is described by one marginal di... | damar-wicaksono/uqtestfuns | src/uqtestfuns/core/prob_input/marginal.py | .py | 975bdd6d3d93effc | 7.04 | 11 |
"""
Module with an implementation of ``ProbInput`` class.
The ``ProbInput`` class represents a probabilistic input model.
Each probabilistic input has a set of one-dimensional marginals each of which
is defined by an instance of the ``Marginal`` class.
"""
from __future__ import annotations
import numpy as np
import... | damar-wicaksono/uqtestfuns | src/uqtestfuns/core/prob_input/probabilistic_input.py | .py | 0284ee26ae8240b3 | 8.04 | 11 |
"""
Module with an implementation of `ProbInput` class.
This module provides a `ProbInput` class for building, sampling, evaluating,
and transforming the probabilistic input model of an uncertainty quantification
test function.
Copula-based dependence is reserved for future support.
"""
from __future__ import annota... | damar-wicaksono/uqtestfuns | src/uqtestfuns/core/prob_input/probabilistic_input_new.py | .py | 8072a09a9a1c3679 | 7.04 | 11 |
"""
Module with routines involving the Beta probability distribution.
The Beta distribution in UQTestFuns is parameterized by four parameters:
``r``, ``s``, ``a``, and ``b``. ``r`` and ``s`` are the shape parameters,
while ``a`` and ``b`` are the lower and upper bounds, respectively.
The underlying implementation is ... | damar-wicaksono/uqtestfuns | src/uqtestfuns/core/prob_input/univariate_distributions/beta.py | .py | d69fe70e3a82fe30 | 7.04 | 11 |
"""
Module with routines involving the exponential probability distribution.
The exponential distribution in UQTestFuns is parametrized by a single
parameter: the rate parametere.
The underlying implementation is based on the implementation from scipy.stats.
In the SciPy convention, the rate parameter corresponds to ... | damar-wicaksono/uqtestfuns | src/uqtestfuns/core/prob_input/univariate_distributions/exponential.py | .py | 0b09853dacf3b1cb | 7.04 | 11 |
"""
Module with routines involving the Gumbel maximum probability distribution.
The Gumbel distribution in UQTestFuns is parameterized by two parameters:
``mu`` and ``beta``.
The underlying implementation is based on the implementation from scipy.stats
(specifically, ``gumbel_r`` the right-skewed Gumbel).
In the Sci... | damar-wicaksono/uqtestfuns | src/uqtestfuns/core/prob_input/univariate_distributions/gumbel.py | .py | 3ab6672a10f8220c | 7.04 | 11 |
"""
Module with routines involving the logit-normal probability distribution.
A logit-normal random variable is a random variable whose logit transformation
is a normal random variable.
The logit-normal distribution in UQTestFuns is parametrized by two parameters:
mu and sigma, the mean and standard deviation of the ... | damar-wicaksono/uqtestfuns | src/uqtestfuns/core/prob_input/univariate_distributions/logitnormal.py | .py | 3bef6a0898eb6323 | 7.04 | 11 |
"""
Module with routines involving the lognormal probability distribution.
The lognormal distribution in UQTestFuns is parameterized by two parameters:
``mu`` and ``sigma``, the mean and standard deviation of the underlying normal
distribution, respectively.
The underlying implementation is based on the implementatio... | damar-wicaksono/uqtestfuns | src/uqtestfuns/core/prob_input/univariate_distributions/lognormal.py | .py | 672746310a80d496 | 7.04 | 11 |
"""
Module with routines involving the normal (Gaussian) probability distribution.
The normal distribution in UQTestFuns is parametrized by two parameters:
mu and sigma, the mean and standard deviation, respectively.
The underlying implementation is based on the implementation from scipy.stats.
In the SciPy conventio... | damar-wicaksono/uqtestfuns | src/uqtestfuns/core/prob_input/univariate_distributions/normal.py | .py | b700413e06485855 | 7.04 | 11 |
"""
Module with routines involving the Triangular probability distribution.
The Triangular distribution in UQTestFuns is parameterized
by three parameters: a, b, and c.
These are the lower bound, upper bound, and the mid-point (i.e., modal value),
respectively.
The density value at the modal value is computed such th... | damar-wicaksono/uqtestfuns | src/uqtestfuns/core/prob_input/univariate_distributions/triangular.py | .py | b7617f5d01988987 | 7.04 | 11 |
"""
Module with routines involving the truncated Gumbel (max.) probability dist.
The truncated Gumbel (max.) distribution in UQTestFuns is parameterized by
four parameters: ``mu``, ``beta``, ``lb``, and ``ub`` that correspond to
the mode, the scale, lower bound, and upper bound, respectively.
The underlying implement... | damar-wicaksono/uqtestfuns | src/uqtestfuns/core/prob_input/univariate_distributions/trunc_gumbel.py | .py | 1549a4c12026c26b | 7.04 | 11 |
"""
Module with routines involving the truncated normal probability distribution.
The truncated normal distribution in UQTestFuns is parameterized by four
parameters: ``mu``, ``sigma``, ``lb``, and ``ub`` that correspond to
the mean, the standard deviation, lower bound, and upper bound, respectively.
The underlying i... | damar-wicaksono/uqtestfuns | src/uqtestfuns/core/prob_input/univariate_distributions/trunc_normal.py | .py | f9c520d62179e2c1 | 7.04 | 11 |
"""
Module with routines involving the uniform probability distribution.
The uniform distribution in UQTestFuns is parametrized by two parameters:
the lower and upper bounds.
"""
import numpy as np
from .utils import postprocess_icdf, verify_param_nums
from ....global_settings import ARRAY_FLOAT
DISTRIBUTION_NAME =... | damar-wicaksono/uqtestfuns | src/uqtestfuns/core/prob_input/univariate_distributions/uniform.py | .py | 9bc7e320ad397758 | 7.04 | 11 |
"""
Utility module for univariate distribution calculations.
"""
import numpy as np
def postprocess_icdf(
xx: np.ndarray,
lower_bound: float,
upper_bound: float,
) -> np.ndarray:
"""Postprocess the computed ICDF values.
The postprocessing ensures that the output is an array and always
within... | damar-wicaksono/uqtestfuns | src/uqtestfuns/core/prob_input/univariate_distributions/utils.py | .py | 29e895cb653e70e0 | 8.04 | 11 |
"""
Utility module for probabilistic input modeling.
"""
from numpy.typing import ArrayLike
from types import ModuleType
from typing import Tuple
from .univariate_distributions import (
beta,
exponential,
normal,
gumbel,
lognormal,
triangular,
trunc_gumbel,
trunc_normal,
logitnorma... | damar-wicaksono/uqtestfuns | src/uqtestfuns/core/prob_input/utils.py | .py | f8b6cf87944ead95 | 7.04 | 11 |
"""Registry entry data structures for UQ test function metadata.
This module defines the data structures used to store metadata about
uncertainty quantification (UQ) test functions in the registry.
The metadata is parsed from YAML specification files and used for
function discovery and instantiation.
"""
from datacla... | damar-wicaksono/uqtestfuns | src/uqtestfuns/core/registry/entries.py | .py | b2995110afed5967 | 8.04 | 11 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.