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 |
|---|---|---|---|---|---|---|
#! python3
# -*- coding: utf-8 -*-
"""Internal module with Bench class for timing code execution."""
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
import datetime
from typing import Optional
from .module import LazyModule, LazyProperty
__version__ = "0.7.0"
Print = Laz... | egigoka/commands | commands/bench.py | .py | 337858be9895928f | 7.15 | 1 |
#! python3
# -*- coding: utf-8 -*-
"""Internal module to work with bytes."""
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from typing import Any, Callable, Optional, Union
from .module import LazyModule
__version__ = "0.0.2"
chardet = LazyModule("chardet")
class Bytes:... | egigoka/commands | commands/bytes.py | .py | 29eedf959f996c26 | 7.15 | 1 |
#! python3
# -*- coding: utf-8 -*-
"""Internal module to work with commandline interfaces."""
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
import datetime
from typing import Any, List, Optional, Union, cast
from .console import Console
from .const import backsla... | egigoka/commands | commands/cli.py | .py | 612a080485190fe3 | 7.15 | 1 |
#! python3
# -*- coding: utf-8 -*-
"""Internal module to work with dicts."""
from __future__ import annotations
from typing import Any, TYPE_CHECKING
if TYPE_CHECKING:
from ast import literal_eval
from collections import OrderedDict
from typing import Callable, Dict as DictType, ItemsView, Mapping, NoRetur... | egigoka/commands | commands/dict.py | .py | 5ac1bfc670f0fbd7 | 7.15 | 1 |
#! python3
# -*- coding: utf-8 -*-
"""Internal module with utility functions."""
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from typing import Any, NoReturn, Optional, Type
from .module import LazyModule, LazyProperty
__version__ = "3.4.3"
sitebuiltins = LazyModule("_si... | egigoka/commands | commands/funcs.py | .py | f2dce9c17ed533eb | 7.15 | 1 |
#! python3
# -*- coding: utf-8 -*-
"""Internal module to simplify work with git."""
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
import os
from typing import Optional
from .bash import Bash
from .console import Console
from .path import Path
from .module imp... | egigoka/commands | commands/git.py | .py | 3165ced1bd82ddb6 | 7.15 | 1 |
#! python3
# -*- coding: utf-8 -*-
"""Global Interpreter Variables."""
from __future__ import annotations
from .module import LazyModule, LazyProperty
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from typing import Any, Optional, cast
from .json import JsonDict
from .path import Path
else:
def ca... | egigoka/commands | commands/giv.py | .py | 3796f1ffc76e9daf | 7.15 | 1 |
#! python3
# -*- coding: utf-8 -*-
"""Internal module, import it like "from commands.int8 import Int"."""
from __future__ import annotations
import builtins
from .module import LazyModule, LazyProperty
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from typing import List, Optional, Union
__version__ = "0.0.5... | egigoka/commands | commands/int.py | .py | e74c22bca8696470 | 7.15 | 1 |
#! python3
# -*- coding: utf-8 -*-
"""Internal module to work with JSON."""
from __future__ import annotations
from .module import LazyModule, LazyProperty
from typing import Any, Iterator, TYPE_CHECKING, cast
if TYPE_CHECKING:
import json
import os
from typing import List, Mapping, Optional, Protocol, Uni... | egigoka/commands | commands/json.py | .py | 380b9232530c2d83 | 7.15 | 1 |
#! python3
# -*- coding: utf-8 -*-
"""Internal module with functions to work with keyboard."""
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from typing import Any
from .module import LazyModule
__version__ = "0.2.2"
pyautogui = LazyModule("pyautogui", optional=True)
cl... | egigoka/commands | commands/keyboard.py | .py | 07e3a33461ba7848 | 7.15 | 1 |
#! python3
# -*- coding: utf-8 -*-
"""Internal module to work with lists."""
from __future__ import annotations
from .module import LazyModule, LazyProperty
from typing import TYPE_CHECKING
if TYPE_CHECKING:
import builtins
import collections
import copy
import fnmatch
import random
from collec... | egigoka/commands | commands/list.py | .py | ef73a02f446a08e3 | 7.15 | 1 |
"""Lazy module loading for fast startup and optional dependencies."""
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from typing import Any
def _import_module(name: str, package: Any) -> Any:
importlib = __import__("importlib", fromlist=["import_module"])
return im... | egigoka/commands | commands/module.py | .py | e7e1cc0106b7d358 | 7.15 | 1 |
#! python3
# -*- coding: utf-8 -*-
"""Internal module with functions to work with mouse."""
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from typing import Any, Optional, Tuple
from .module import LazyModule, LazyProperty
__version__ = "1.6.0"
Time = LazyProperty(".time",... | egigoka/commands | commands/mouse.py | .py | 10d7e49c181aad1e | 7.15 | 1 |
#! python3
# -*- coding: utf-8 -*-
"""Internal module for object utilities."""
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from typing import Any, List, Optional, Type
__version__ = "0.0.1"
class Obj:
"""Object casting helpers."""
@classmethod
def cast_to(c... | egigoka/commands | commands/obj.py | .py | b7783f1c39b1e84f | 7.15 | 1 |
#! python3
# -*- coding: utf-8 -*-
"""Internal module to check some environment properties."""
from __future__ import annotations
from typing import Optional, TYPE_CHECKING, cast
if TYPE_CHECKING:
import os
import platform
import shutil
import socket
import sys
from typing import Any, Iterable,... | egigoka/commands | commands/os.py | .py | 5f915b6613392863 | 7.15 | 1 |
#! python3
# -*- coding: utf-8 -*-
"""Internal module with functions to work with path strings."""
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
import os
import string
import sys
import tempfile
from typing import Any, Optional, Tuple, cast
else:
def cas... | egigoka/commands | commands/path.py | .py | 33e3e70eeba64d31 | 7.15 | 1 |
#! python3
# -*- coding: utf-8 -*-
"""Internal module with functions for print to console."""
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
import pprint
from contextlib import suppress
from threading import Lock
from typing import Any, List, Optional, Sequence, ... | egigoka/commands | commands/print.py | .py | 7c7100d662aecaa1 | 7.15 | 1 |
#! python3
# -*- coding: utf-8 -*-
"""Internal module with functions for managing processes."""
from __future__ import annotations
from .module import LazyModule, LazyProperty
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from typing import Any, Optional, Union, cast
else:
def cast(_type, value):
... | egigoka/commands | commands/process.py | .py | 25e98034e5e9a901 | 7.15 | 1 |
#! python3
# -*- coding: utf-8 -*-
"""Internal module with functions for creating some random values."""
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
import random
import string
from typing import Any, Dict, List, Optional, Sequence, Tuple, Union
from .str impor... | egigoka/commands | commands/random.py | .py | a284f18333921472 | 7.15 | 1 |
#! python3
# -*- coding: utf-8 -*-
"""Internal module with functions for screen capture."""
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from typing import Optional, Tuple, Union
from .module import LazyModule, LazyProperty
__version__ = "0.0.1"
sys = LazyModule("sys")
p... | egigoka/commands | commands/screen.py | .py | a77ddccebcb7ac6d | 7.15 | 1 |
#! python3
# -*- coding: utf-8 -*-
"""Internal module with functions to work with ssh."""
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from typing import Any, List, Optional, Tuple, cast
else:
def cast(_type, value):
"""Return value unchanged for runtime typing ... | egigoka/commands | commands/ssh.py | .py | 69e504340fa4522c | 7.15 | 1 |
#! python3
# -*- coding: utf-8 -*-
"""Module with time functions."""
from __future__ import annotations
from typing import TYPE_CHECKING
from .module import LazyModule, LazyProperty
__version__ = "1.2.5"
if TYPE_CHECKING:
import datetime as datetime_module
import time
from typing import Any, Dict, List, ... | egigoka/commands | commands/time.py | .py | 755e1731641b3090 | 7.15 | 1 |
#! python3
# -*- coding: utf-8 -*-
"""Internal module to simplify work with tkinter."""
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from typing import Optional
__version__ = "0.0.2"
class Tkinter: # pylint: disable=too-few-public-methods
"""Class to simplify work w... | egigoka/commands | commands/tkinter.py | .py | 3f16100736538e99 | 7.15 | 1 |
#! python3
# -*- coding: utf-8 -*-
"""Internal module to work with video."""
from __future__ import annotations
from typing import Any, Optional, Tuple, TypedDict, cast
from .module import LazyModule
__version__ = "0.2.1"
json = LazyModule("json")
subprocess = LazyModule("subprocess")
class Video:
"""Class to... | egigoka/commands | commands/video.py | .py | 00f1d0fd3fc4c225 | 7.15 | 1 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | openstack/etcd3gw | etcd3gw/lease.py | .py | bbb9b40db8ff5416 | 7.35 | 4 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | openstack/etcd3gw | etcd3gw/lock.py | .py | be036709fb486d46 | 7.35 | 4 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | openstack/etcd3gw | etcd3gw/types.py | .py | c7b3afbe92ed8989 | 7.35 | 4 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | openstack/etcd3gw | etcd3gw/utils.py | .py | 26e72e648f9633f3 | 7.35 | 4 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | openstack/etcd3gw | etcd3gw/watch.py | .py | 6c5192509bdb7869 | 7.35 | 4 |
"""Lightweight connection handling for MCP servers."""
from abc import ABC, abstractmethod
from contextlib import AsyncExitStack
from typing import Any
from mcp import ClientSession, StdioServerParameters
from mcp.client.sse import sse_client
from mcp.client.stdio import stdio_client
from mcp.client.streamable_http i... | Tapppi/dotfiles | config/agent-skills/anthropics/skills/mcp-builder/scripts/connections.py | .py | 9403668a20415687 | 7.15 | 1 |
"""MCP Server Evaluation Harness
This script evaluates MCP servers by running test questions against them using Claude.
"""
import argparse
import asyncio
import json
import re
import sys
import time
import traceback
import xml.etree.ElementTree as ET
from pathlib import Path
from typing import Any
from anthropic im... | Tapppi/dotfiles | config/agent-skills/anthropics/skills/mcp-builder/scripts/evaluation.py | .py | 49ed1d17cdce5da1 | 7.15 | 1 |
#!/usr/bin/env python3
"""
Aggregate individual run results into benchmark summary statistics.
Reads grading.json files from run directories and produces:
- run_summary with mean, stddev, min, max for each metric
- delta between with_skill and without_skill configurations
Usage:
python aggregate_benchmark.py <ben... | Tapppi/dotfiles | config/agent-skills/anthropics/skills/skill-creator/scripts/aggregate_benchmark.py | .py | 123ef128ea5ccc01 | 7.15 | 1 |
#!/usr/bin/env python3
"""Generate an HTML report from run_loop.py output.
Takes the JSON output from run_loop.py and generates a visual HTML report
showing each description attempt with check/x for each test case.
Distinguishes between train and test queries.
"""
import argparse
import html
import json
import sys
fr... | Tapppi/dotfiles | config/agent-skills/anthropics/skills/skill-creator/scripts/generate_report.py | .py | 13df7118a3c50c83 | 7.15 | 1 |
#!/usr/bin/env python3
"""Improve a skill description based on eval results.
Takes eval results (from run_eval.py) and generates an improved description
by calling `claude -p` as a subprocess (same auth pattern as run_eval.py —
uses the session's Claude Code auth, no separate ANTHROPIC_API_KEY needed).
"""
import arg... | Tapppi/dotfiles | config/agent-skills/anthropics/skills/skill-creator/scripts/improve_description.py | .py | 87d864570220b699 | 7.15 | 1 |
#!/usr/bin/env python3
"""
Skill Packager - Creates a distributable .skill file of a skill folder
Usage:
python utils/package_skill.py <path/to/skill-folder> [output-directory]
Example:
python utils/package_skill.py skills/public/my-skill
python utils/package_skill.py skills/public/my-skill ./dist
"""
im... | Tapppi/dotfiles | config/agent-skills/anthropics/skills/skill-creator/scripts/package_skill.py | .py | 1a33059b0db1ef73 | 7.15 | 1 |
"""
Task registry and scheduling queues for smallOS.
The runtime needs two different access patterns:
- look up a task quickly by PID
- choose the next runnable task by priority
This module keeps those responsibilities together so the scheduler can stay
small and focused. PID lookup uses a dictionary, ready tasks liv... | MikiEEE/SmallOS | SmallPackage/OSlist.py | .py | 3bffc28142f49190 | 7 | 0 |
"""
Configuration helpers for smallOS runtime sizing.
The scheduler already exposes a few core sizing knobs through constructor
arguments, but a small project-level config object makes those settings easier
to document, load from disk, and share between desktop and MicroPython entry
points.
"""
from __future__ import... | MikiEEE/SmallOS | SmallPackage/SmallConfig.py | .py | baecc45e6cbc64df | 7 | 0 |
"""
Terminal-oriented I/O helpers for smallOS.
The runtime keeps application output and shell/OS output intentionally separate.
Normal task prints go through the app channel. When the shell terminal is open,
those app messages are buffered so shell output can stay readable. Switching
back to app view flushes the buffe... | MikiEEE/SmallOS | SmallPackage/SmallIO.py | .py | a449823565cc9a54 | 7 | 0 |
from __future__ import annotations
class SmallPID:
'''
@class smallPID() - Creates and keeps track of avialable
Process ID's
'''
def __init__(self, max: int = 2**16) -> None:
'''
@function __init__() - Initializes essential maintenence
structures.
@para... | MikiEEE/SmallOS | SmallPackage/SmallPID.py | .py | 6e53aab27f6fbc1a | 7 | 0 |
"""
Signal-facing helpers used by ``SmallTask``.
This module preserves the intent of the original signal API while adapting it
to the new native async runtime. The methods here do not perform scheduling on
their own; they only record signal state and return smallOS-owned awaitables.
``SmallOS`` later interprets those ... | MikiEEE/SmallOS | SmallPackage/SmallSignals.py | .py | 3b2172326147f54b | 7 | 0 |
"""
Task object for the native smallOS coroutine runtime.
Each ``SmallTask`` owns the per-coroutine state that used to be split between
generator helpers and ``asyncio`` tasks: pending resume values, terminal
results, exceptions, and join bookkeeping. The scheduler can stay relatively
small because most task-local lif... | MikiEEE/SmallOS | SmallPackage/SmallTask.py | .py | 04407555612b5c74 | 7 | 0 |
"""Shared static types for smallOS.
Runtime modules import these definitions only while type checking so embedded
targets do not need to provide the :mod:`typing` module.
"""
from __future__ import annotations
from collections.abc import Awaitable, Callable, Iterable, Mapping, Sequence
from typing import TYPE_CHECKI... | MikiEEE/SmallOS | SmallPackage/_types.py | .py | c84353c06099c982 | 7 | 0 |
"""Thread-safe completion queue with a readiness notification socket."""
from __future__ import annotations
import queue
import socket
import threading
from .base import AdapterCompletion
from .errors import AdapterUnavailableError
class CompletionChannel:
"""Move completions between threads without touching s... | MikiEEE/SmallOS | SmallPackage/adapters/_completion.py | .py | 6fe1b4517fbc48d8 | 7 | 0 |
"""Shared execution-adapter instruction and completion contracts."""
from __future__ import annotations
try:
from typing import TYPE_CHECKING as _type_checking
except ImportError: # pragma: no cover - constrained runtimes
_type_checking = False
if _type_checking:
from collections.abc import Callable
... | MikiEEE/SmallOS | SmallPackage/adapters/base.py | .py | d2fdadb36f0dbd13 | 7 | 0 |
"""Dependency-free errors shared by SmallOS execution adapters."""
from __future__ import annotations
class AdapterError(Exception):
"""Base class for execution-adapter failures."""
class AdapterUnavailableError(AdapterError):
"""Raised when an adapter cannot run with the active runtime or kernel."""
clas... | MikiEEE/SmallOS | SmallPackage/adapters/errors.py | .py | b9f7577a570110c0 | 7 | 0 |
"""
Awaitable helpers for the native smallOS runtime.
The scheduler does not attempt to understand arbitrary Python awaitables.
Instead, every smallOS primitive returns an object whose ``__await__`` method
emits a ``TaskInstruction``. ``SmallOS`` consumes those instructions and decides
when the task should run again.
... | MikiEEE/SmallOS | SmallPackage/awaitables.py | .py | c6333e53d908c290 | 7 | 0 |
"""
SmallOS-native MQTT helpers.
This module implements a compact MQTT 3.1.1 client aimed at the common hobbyist
workflow: connect to a broker, publish messages at QoS 0/1/2, subscribe, and
receive messages cooperatively without threads or ``asyncio``.
"""
import warnings
from ._client_config import MISSING, resolve... | MikiEEE/SmallOS | SmallPackage/clients/SmallMQTT.py | .py | 1ba61a87dc6c8439 | 7 | 0 |
"""
SmallOS-native Redis client helpers.
The goal here is not to replace a full desktop Redis library. Instead, this
module gives smallOS tasks a simple, dependency-free way to speak Redis over
the runtime's cooperative socket layer on both Unix and MicroPython targets.
"""
import warnings
from ._client_config impor... | MikiEEE/SmallOS | SmallPackage/clients/SmallRedis.py | .py | 258db877d2cea59d | 7 | 0 |
"""
Shared non-blocking byte-stream helper for smallOS protocol clients.
The scheduler already knows how to suspend a task until a socket becomes
readable or writable. This module packages that pattern into one reusable
stream abstraction so higher-level clients like Redis and MQTT can focus on
their wire protocols in... | MikiEEE/SmallOS | SmallPackage/clients/SmallStream.py | .py | b666533565c079e4 | 7 | 0 |
"""
Helpers for reading client defaults from the active smallOS runtime config.
Each client still accepts explicit constructor arguments, but when a task is
already attached to a runtime these helpers let the protocol layer inherit
project-wide defaults from ``SmallOSConfig.client_defaults``.
"""
MISSING = object()
... | MikiEEE/SmallOS | SmallPackage/clients/_client_config.py | .py | c936718f3b57dd5d | 7 | 0 |
'''
@file linkedList - modules to create and manipulate doubly linked list.
'''
from __future__ import annotations
def insertPrev(root: Node, newNode: Node) -> None:
'''
@function insertPrev() - takes in a rootNode and newNode and
inserts the newNode behind the rootNode.
@param root - Node() -... | MikiEEE/SmallOS | SmallPackage/list_util/linkedList.py | .py | 5063c49d4de82536 | 7 | 0 |
"""
Shell helpers for smallOS.
The runtime itself is intentionally small and scheduler-focused. This module
adds a light command shell on top so users can inspect task state, send
signals, toggle the shell/app terminal view, and run small debugging snippets
without reaching into runtime internals manually.
The shell ... | MikiEEE/SmallOS | SmallPackage/shells.py | .py | 97e6190fea614ebf | 7 | 0 |
"""
Shared demo helpers for desktop and board-specific smallOS examples.
These helpers keep the individual demo files short while still showing the
recommended public API: load a config file, choose a kernel, install an error
handler, spawn tasks, and start the runtime.
"""
from __future__ import annotations
import ... | MikiEEE/SmallOS | demos/common.py | .py | e5af2ddd5229f5cd | 7 | 0 |
"""
ESP32-oriented demo entry point.
This can run as a desktop example for structure review, but the optional Wi-Fi
connection path is intended for MicroPython boards that expose ``network.WLAN``.
"""
from common import build_runtime, default_tasks
from SmallPackage.Kernel import ESP32
WIFI_SSID = None
WIFI_PASSWO... | MikiEEE/SmallOS | demos/esp32_demo.py | .py | 19913c0210f8d334 | 7 | 0 |
"""MicroPython demo that picks a built-in board profile from the machine string."""
from common import build_runtime, default_tasks
from SmallPackage.Kernel import build_micropython_kernel
WIFI_SSID = None
WIFI_PASSWORD = None
def maybe_connect_wifi(kernel):
"""Use Wi-Fi only when the kernel supports it and c... | MikiEEE/SmallOS | demos/micropython_autodetect_demo.py | .py | a4493786c676a0b1 | 7 | 0 |
"""
Raspberry Pi Pico W oriented demo entry point.
The Pico W profile exposes optional country and power-management defaults in
addition to the shared MicroPython socket/timer APIs.
"""
from common import build_runtime, default_tasks
from SmallPackage.Kernel import PicoW
WIFI_SSID = None
WIFI_PASSWORD = None
WIFI_... | MikiEEE/SmallOS | demos/pico_w_demo.py | .py | 3d3f4094d961f702 | 7 | 0 |
"""
Showcase demo for the native smallOS runtime.
This is the new home for the original root-level `demo.py` examples. It keeps
the same spirit as the earlier demo, but now leans on the higher-level HTTP
client instead of handcrafting the request socket logic inline.
"""
from common import build_runtime
from SmallPa... | MikiEEE/SmallOS | demos/runtime_demo.py | .py | 589d0806485d2bdc | 7 | 0 |
"""Demo showing a shell session running alongside other cooperative tasks."""
from common import build_runtime
from SmallPackage import SmallTask, Unix
from SmallPackage.shells import BaseShell
async def background_worker(task):
"""Keep producing app output while the shell inspects the runtime."""
for step ... | MikiEEE/SmallOS | demos/shell_demo.py | .py | d277e0febcf933bd | 7 | 0 |
"""Natural ("human") sort: img2 < img10, Episode 9 < Episode 10, case-insensitive. Use it everywhere files are listed."""
import os
import re
from typing import Iterable, List
_CHUNK = re.compile(r"(\d+)")
def natural_key(text: str):
"""sorted(names, key=natural_key)"""
return [int(t) if t.isdigit() else t.c... | hclivess/titulkovac | naturalsort.py | .py | 7721f104c6f49694 | 7.15 | 1 |
import logging
import argparse
from flask import Flask, render_template
from datetime import datetime
from registration import Registration
from registrator import Registrator
from configuration import Configuration
from myservice import myservice
# default config file (use -c parameter on command line specify a cu... | WSE-research/Spring-Boot-Admin-Python-component | app.py | .py | e422fb1c9990a1e2 | 7.35 | 4 |
import configparser
import os.path
import logging
class Configuration:
"""
parse and validates information provided by
"""
demandedConfigurationKeys = []
configfile = ""
def __init__(self, configfile, demandedConfigurationKeys=[]):
self.configfile = configfile
if os.path... | WSE-research/Spring-Boot-Admin-Python-component | configuration.py | .py | c1259c766fc6630a | 7.35 | 4 |
from flask import Blueprint, jsonify, request
myservice = Blueprint('myservice', __name__, template_folder='templates')
"""
simple endpoints to show the external definition of a custom service
"""
@myservice.route("/", methods=['GET'])
def index():
"""an examplary GET endpoint returning "hello world2 (Strin... | WSE-research/Spring-Boot-Admin-Python-component | myservice.py | .py | 7c94b4648b8b63db | 7.35 | 4 |
class Registration:
"""
a similar implementation of the corresponding Spring Boot Admin class
c.f,. https://github.com/codecentric/spring-boot-admin/blob/master/spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/server/domain/values/Registration.java
"""
name = None
manag... | WSE-research/Spring-Boot-Admin-Python-component | registration.py | .py | e93697b8abe88c1a | 7.35 | 4 |
import threading
import time
import requests
import json
import logging
from requests.auth import HTTPBasicAuth
class Registrator(threading.Thread):
"""
class running as thread to contact the Spring Boot Admin Server
"""
jsonHeaders = {"Content-type": "application/json",
"Accep... | WSE-research/Spring-Boot-Admin-Python-component | registrator.py | .py | d1d9d90f29e425f0 | 7.35 | 4 |
"""Tests for configuration.Configuration: parsing a config file and validating
that all demanded keys are present."""
import pytest
from configuration import Configuration
CONF = """[ServiceConfiguration]
springbootadminserverurl = http://localhost:8080
servicename = my-service
serviceport = 5000
servicehost = http:/... | WSE-research/Spring-Boot-Admin-Python-component | tests/unit/test_configuration.py | .py | 0b059b0118535055 | 7.85 | 4 |
"""Tests for registrator.Registrator.callAdminServer with requests faked.
We never start the thread's infinite run() loop; we call callAdminServer
directly and assert it builds the right request and swallows failures.
"""
import json
from unittest.mock import MagicMock, patch
from registration import Registration
fro... | WSE-research/Spring-Boot-Admin-Python-component | tests/unit/test_registrator.py | .py | 1e0860cdfe4e8c24 | 7.85 | 4 |
#!/usr/bin/env python3
"""Run the eval + improve loop until all pass or max iterations reached.
Combines run_eval.py and improve_description.py in a loop, tracking history
and returning the best description found. Supports train/test split to prevent
overfitting.
"""
import argparse
import json
import random
import s... | analog-alex/university | .agents/skills/skill-creator/scripts/run_loop.py | .py | 7bd6f67420316852 | 7.15 | 1 |
import logging
from homeassistant.components.button import ENTITY_ID_FORMAT, ButtonEntity
from homeassistant.helpers.entity import async_generate_entity_id, DeviceInfo
from .const import *
_LOGGER = logging.getLogger(__name__)
async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up SmartVi... | jnimmo/hass-smartvideohub | custom_components/smartvideohub/button.py | .py | bec4368a78cb45ba | 7.35 | 4 |
# config_flow.py
from __future__ import annotations
import logging
import asyncio
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.core import HomeAssistant
from homeassistant.data_entry_flow import FlowResult
from .const import DOMAIN, CONF_HOST, CONF_PORT, DEFAULT_PORT
from .pyv... | jnimmo/hass-smartvideohub | custom_components/smartvideohub/config_flow.py | .py | f00c0626b316a6b4 | 7.35 | 4 |
"""
Support for interfacing with Black Magic Smart Video Hub.
"""
from __future__ import annotations
import logging
from homeassistant.components.media_player import (
MediaPlayerEntity,
MediaPlayerState,
MediaPlayerEntityFeature,
MediaPlayerDeviceClass,
ENTITY_ID_FORMAT,
)
from homeassistant.core... | jnimmo/hass-smartvideohub | custom_components/smartvideohub/media_player.py | .py | b2d500244c7c7fcc | 7.35 | 4 |
import logging
from homeassistant.components.switch import ENTITY_ID_FORMAT, SwitchEntity, SwitchDeviceClass
from homeassistant.helpers.entity import async_generate_entity_id, DeviceInfo
from .const import *
_LOGGER = logging.getLogger(__name__)
async def async_setup_entry(hass, config_entry, async_add_entities):
... | jnimmo/hass-smartvideohub | custom_components/smartvideohub/switch.py | .py | 5e07b8dd47ff32ec | 7.35 | 4 |
import logging
from homeassistant.components.text import TextEntity, TextMode, ENTITY_ID_FORMAT
from homeassistant.helpers.entity import async_generate_entity_id, DeviceInfo
from .const import *
_LOGGER = logging.getLogger(__name__)
async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up S... | jnimmo/hass-smartvideohub | custom_components/smartvideohub/text.py | .py | fe6a9e578666548c | 7.35 | 4 |
"""
Create colored radar images from raw 16-bit PNG files.
Reads raw PNG files from input directory and creates colored visualizations.
Optionally adds a basemap under the radar layer.
"""
import argparse
import logging
import time
from datetime import datetime, timedelta, timezone
from pathlib import Path
import co... | aapris/WeatherLamp | fmi_radar/colorize_radar.py | .py | 6f44ac77d5d648ad | 7 | 0 |
"""
Download FMI radar data and store GeoTIFF and raw PNG files.
Output directory structure:
output/
2025-12-07/
geotiff/
radar_suomi_rr_eureffin_20251207T100000Z.geotiff[.gz]
raw-png/
radar_raw_20251207_100000.png
"""
import argparse
import gzip
import logging
import time
import xml... | aapris/WeatherLamp | fmi_radar/download_radar.py | .py | 13f477e65b48b705 | 7 | 0 |
import io
import itertools
import json
import logging
import os
from collections import OrderedDict
from logging.config import dictConfig
import pandas as pd
from starlette.applications import Starlette
from starlette.exceptions import HTTPException
from starlette.requests import Request
from starlette.responses impor... | aapris/WeatherLamp | starlette_server/endpoint/app.py | .py | eecd93d417e29183 | 7 | 0 |
"""
time python endpoint/create_video_frames.py --lat 60.217 --lon 24.987 --interval 30 --targetdir /tmp/kuvat/ --yrdirs ~/WeatherLampAnimation/history/2021-1* --tbdirs ~/WeatherLampAnimation/testbed/20211* --log DEBUG 2>&1 |grep -v STREAM
"""
import argparse
import datetime
import json
import logging
import time
fr... | aapris/WeatherLamp | starlette_server/endpoint/create_video_frames.py | .py | 606934485bf38100 | 7 | 0 |
import datetime
import logging
import re
import astral
import astral.sun
import pandas as pd
# A dict to map weather symbol to particular RGB color
symbolmap = {
**dict.fromkeys(
[
"clearsky",
"fair",
],
"CLEARSKY",
),
**dict.fromkeys(
[
... | aapris/WeatherLamp | starlette_server/endpoint/yranalyzer.py | .py | 074fbeb9e7ffe01a | 7 | 0 |
import argparse
import dataclasses
import datetime
import json
import logging
import pathlib
import httpx
from httpx import RequestError
from shapely import wkt
from shapely.geometry import Point
API_URL: str = "https://api.met.no/weatherapi/{}/2.0/complete"
USER_AGENT: str = "WeatherLamp/0.4 github.com/aapris/Weathe... | aapris/WeatherLamp | starlette_server/endpoint/yrapiclient.py | .py | 4ab6fbdec8fc3d6a | 7 | 0 |
import datetime
from datetime import timedelta
from pyspark.sql import functions as F
from sqlalchemy.dialects.postgresql import insert
from sqlalchemy.exc import IntegrityError
from sqlalchemy.orm import sessionmaker
from tqdm import tqdm
from fitnick.activity.models.activity import ActivityLogRecord, activity_log_t... | kcinnick/fitnick | fitnick/activity/activity.py | .py | 57099bb8674cb513 | 7.15 | 1 |
from datetime import datetime
from sqlalchemy.dialects.postgresql import insert
from sqlalchemy.exc import IntegrityError
from sqlalchemy.orm import sessionmaker
from fitnick.base.base import get_authorized_client
from fitnick.body.models.bodyfat import BodyFatRecord, bodyfat_table
from fitnick.database.database impo... | kcinnick/fitnick | fitnick/body/bodyfat/bodyfat.py | .py | 7f2ef5ca1ba189aa | 7.15 | 1 |
import os
from datetime import date, datetime
from flask import Flask, make_response, render_template, request
from fitnick.flask_app.forms import DateForm
from fitnick.activity.activity import Activity
from fitnick.apis.get_steps import get_steps_for_day
from fitnick.database.database import Database
from fitnick.he... | kcinnick/fitnick | fitnick/flask_app/main.py | .py | d53f090239ed3736 | 7.15 | 1 |
from sqlalchemy.dialects.postgresql import insert
from sqlalchemy.exc import IntegrityError
from sqlalchemy.orm import sessionmaker
from fitnick.base.base import get_authorized_client
from fitnick.sleep.models import SleepSummary, SleepLevel, sleep_summary_table, sleep_level_table
from fitnick.time_series import TimeS... | kcinnick/fitnick | fitnick/sleep/time_series.py | .py | 2227164762b8608d | 7.15 | 1 |
from flask import request
from flask_restx import Resource
from ..util.dto import BuyerDto
from ..service.buyer_service import register, login
api = BuyerDto.api
_buyer_login = BuyerDto.buyer_login
_buyer_register = BuyerDto.buyer_register
@api.route('/register')
class BuyerRegister(Resource):
@api.response(201... | rohitjain00/SIH-farmerPortal-backend | app/main/controller/buyer_controller.py | .py | da26faeccfd733c3 | 7.15 | 1 |
from flask import request
from flask_restx import Resource
from ..service.crop_service import get_crops, get_predicted_price, get_sellers, get_crop_rating, add_rating, \
get_crop_availability, get_seller_inventory, add_to_seller_inventory, update_seller_inventory
from ..util.dto import CropDTO
api = CropDTO.api
_... | rohitjain00/SIH-farmerPortal-backend | app/main/controller/crop_controller.py | .py | 15ee335f00b3667b | 7.15 | 1 |
from flask import request
from flask_restx import Resource
from ..util.dto import OrderDTO
from ..service.order_service import get_orders, place_order, set_payment, get_payment, set_delivery, get_delivery
api = OrderDTO.api
_order = OrderDTO.order
_place_order = OrderDTO.place_order
_set_flag = OrderDTO.set_flag
@a... | rohitjain00/SIH-farmerPortal-backend | app/main/controller/order_controller.py | .py | 020c86d46b4d93ba | 7.15 | 1 |
from flask import request
from flask_restx import Resource
from ..util.dto import SellerDTO
from ..service.seller_service import register, login
api = SellerDTO.api
_seller_login = SellerDTO.seller_login
_seller_registration = SellerDTO.seller_registration
@api.route('/register')
class SellerRegister(Resource):
... | rohitjain00/SIH-farmerPortal-backend | app/main/controller/seller_controller.py | .py | 88eb93d028cb2ae9 | 7.15 | 1 |
from app.main import get_db
from datetime import date , datetime
"""
To use database :
1. import the db variable from app.main
2. check out the CRUD operation here : https://api.mongodb.com/python/current/tutorial.html
"""
def buyer_already_exist(phone_number):
"""
Check if a buyer exists
:param... | rohitjain00/SIH-farmerPortal-backend | app/main/model/buyer.py | .py | e3e77d38b6f8713c | 7.15 | 1 |
from app.main.model.buyer import buyer_already_exist, buyer_exist, add_new_buyer
from app.main.util.auth import password_hash, get_authentication_token
def register(data):
"""
check if the user exists in the database and if not registers the user to the database
:param data: {'password' : 'asdf', 'phoneNu... | rohitjain00/SIH-farmerPortal-backend | app/main/service/buyer_service.py | .py | a4eeaddc7a3fdc9d | 7.15 | 1 |
from app.main.model.seller import seller_already_exist, add_new_seller, seller_exist
from app.main.util.auth import password_hash, get_authentication_token
def register(data):
"""
check if the seller exists in the database and if not registers the seller to the database
:param data: {"password": "asdfghjk... | rohitjain00/SIH-farmerPortal-backend | app/main/service/seller_service.py | .py | 569797444745ea20 | 7.15 | 1 |
from .. import flask_bcrypt
import datetime
import jwt
from ..config import key
def password_hash(password):
return flask_bcrypt.generate_password_hash(password).decode('utf-8')
def get_authentication_token(phone_number):
"""
Creates a JWT token for users
:param phone_number: phone numner to encode ... | rohitjain00/SIH-farmerPortal-backend | app/main/util/auth.py | .py | 054dd9b8bc0a87ac | 7.15 | 1 |
"""Blind state matching over bit-array transition tables."""
from bitstring import BitArray
TRANSITION_TABLE: list[tuple[BitArray, BitArray]] = [
(BitArray(bin="101001"), BitArray(bin="101010")),
(BitArray(bin="010110"), BitArray(bin="010101")),
]
def match(state_bin: str) -> str:
"""Evaluate next state... | sdoolman/blindly_follows | blind_operations/blind_match.py | .py | 6e8072396a77eed0 | 7 | 0 |
#!/usr/bin/env python3
"""Utility script for generating random text input files for testing."""
import random
import string
from pathlib import Path
from progressbar import progressbar
LINE_LENGTH: int = 100
FILE_LENGTH: int = 50 * 1024**2
def generate_random_file(
output_path: Path | str = "some_text.txt",
... | sdoolman/blindly_follows | create_random_text.py | .py | 7d2f5708db1bcfed | 7 | 0 |
"""Error correction for Chinese Remainder Theorem."""
import random
import numpy as np
from secret_sharing.mathlib import garner_algorithm
def damage_r(r: list[int]) -> None:
"""Inject a random single-element error into the share array."""
if not r:
return
i = random.randrange(len(r))
r[i] ... | sdoolman/blindly_follows | crt/error_correct.py | .py | 805e22b189c4d828 | 7 | 0 |
"""Generic functions for Chinese Remainder Theorem (CRT) and Mignotte threshold schemes."""
import itertools
import math
import random
import sys
from collections.abc import Iterable, Sequence
import numpy as np
import primefac
def xgcd(a: int, b: int) -> tuple[int, int, int]:
"""Return (g, x, y) such that a*x ... | sdoolman/blindly_follows | crt/generic_functions.py | .py | 998dfcd646b9b933 | 7 | 0 |
"""Shamir's Secret Sharing Scheme over finite fields."""
import functools
import random
from collections.abc import Sequence
# 12th Mersenne Prime (2^127 - 1)
_PRIME: int = 2**127 - 1
_RINT = functools.partial(random.SystemRandom().randint, 0)
def eval_at(poly: Sequence[int], x: int, prime: int) -> int:
"""Eval... | sdoolman/blindly_follows | polynomials/shamir.py | .py | ceb4aa863674beeb | 7 | 0 |
"""Unit tests for blind match operations."""
import pytest
from blind_operations.blind_match import match
def test_blind_match_known_transitions():
# Input matching state 0: '101001' -> '101010'
res0 = match("101001")
assert res0 == "101010"
# Input matching state 1: '010110' -> '010101'
res1 =... | sdoolman/blindly_follows | tests/test_blind_operations.py | .py | b8f8481efafe1ed5 | 7.5 | 0 |
"""Unit tests and edge cases for CRT and Mignotte threshold schemes."""
import math
import random
import pytest
from crt.generic_functions import (
generate_primes,
get_mignotte_params,
mulinv,
xgcd,
)
from secret_sharing.mathlib import garner_algorithm
class TestCRTBasics:
def test_xgcd_and_mu... | sdoolman/blindly_follows | tests/test_crt.py | .py | 4a1aa90f371f9f4d | 7.5 | 0 |
"""Unit tests, stress inputs, and edge cases for secret sharing and primality testing."""
import pytest
from polynomials.shamir import make_random_shares, recover_secret
from secret_sharing.bloom import AsmuthBloom
from secret_sharing.mathlib import (
bit_len,
get_consecutive_primes,
get_prime,
get_sg... | sdoolman/blindly_follows | tests/test_secret_sharing.py | .py | 2a603ec24cdc8bed | 7.5 | 0 |
#!/usr/bin/env python3
#
# Copyright (C) 2019 Red Hat, 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 la... | GerritCodeReview/zuul_ops | playbooks/library/update_checkers.py | .py | 654b8ab28d647d56 | 7 | 0 |
#!/usr/bin/env python
'''
MIT License
Copyright (c) 2019 Curt Henrichs
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, ... | curthenrichs/planner_fluid_visualization | src/path_saver.py | .py | ac1d7dfc3ddd721e | 7 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.