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
"""Utils for tests.""" from dol import TextFiles import os from functools import partial _dflt_keys = ( "pluto", "planets/mercury", "planets/venus", "planets/earth", "planets/mars", "fruit/apple", "fruit/banana", "fruit/cherry", ) def mk_test_store_from_keys( keys=_dflt_keys, ...
i2mint/dol
dol/tests/utils_for_tests.py
.py
179f9880b6b090c6
7.89
5
"""Cross-platform file trash/recycle bin functionality for dol. This module provides configurable file deletion strategies with support for moving files to trash/recycle bin instead of permanent deletion. Available deletion strategies: - default_delete_func: Safe trash with warning on fallback to os.remove - ...
i2mint/dol
dol/trash.py
.py
cae3a7a9d36f0912
7.39
5
# Author: Michael Dennis (https://github.com/mdennis281) # Project Repository: https://github.com/mdennis281/cloudflare-dns-sync # License: MIT (https://en.wikipedia.org/wiki/MIT_License) """Command line entry point.""" from __future__ import annotations import argparse import logging import sys from typing import Se...
mdennis281/cloudflare-dns-sync
cfdns/cli.py
.py
400af90e48a99c5b
7.3
3
# Author: Michael Dennis (https://github.com/mdennis281) # Project Repository: https://github.com/mdennis281/cloudflare-dns-sync # License: MIT (https://en.wikipedia.org/wiki/MIT_License) """A very small Cloudflare API v4 client: zone lookup and DNS record CRUD.""" from __future__ import annotations import logging fr...
mdennis281/cloudflare-dns-sync
cfdns/cloudflare.py
.py
74fd7805ac4b73a7
7.3
3
# Author: Michael Dennis (https://github.com/mdennis281) # Project Repository: https://github.com/mdennis281/cloudflare-dns-sync # License: MIT (https://en.wikipedia.org/wiki/MIT_License) """Loads config.ini into validated models. A record is either the legacy ``[DNS]`` section or any ``[DNS:<name>]`` section. ``[DNS]...
mdennis281/cloudflare-dns-sync
cfdns/config.py
.py
22c3d7a33bd60fcd
7.3
3
# Author: Michael Dennis (https://github.com/mdennis281) # Project Repository: https://github.com/mdennis281/cloudflare-dns-sync # License: MIT (https://en.wikipedia.org/wiki/MIT_License) """Discovers this machine's public IP by asking a few echo services.""" from __future__ import annotations import ipaddress import...
mdennis281/cloudflare-dns-sync
cfdns/public_ip.py
.py
e31cea58dc1e1698
7.3
3
# Author: Michael Dennis (https://github.com/mdennis281) # Project Repository: https://github.com/mdennis281/cloudflare-dns-sync # License: MIT (https://en.wikipedia.org/wiki/MIT_License) """Points every configured DNS record at the current public IP.""" from __future__ import annotations import logging from typing i...
mdennis281/cloudflare-dns-sync
cfdns/sync.py
.py
74e100af92aa249b
7.3
3
#!/usr/bin/env python3 import glob import logging import os import subprocess as sp from pathlib import Path logging.basicConfig(level=logging.INFO) OUTPUT_PATH = Path("packages") def replace_in_file(infile: Path, replacements, outfile=None): """Reads in a file, replaces the given data using python formatting ...
zwicker-group/emulsim
docs/source/run_autodoc.py
.py
be15176564716b87
7.15
1
import re from sphinx.directives.other import TocTree class TocTreeFilter(TocTree): """Directive to filter table-of-contents entries.""" hasPat = re.compile(r"^\s*:(.+):(.+)$") # Remove any entries in the content that we dont want and strip # out any filter prefixes that we want but obviously don't...
zwicker-group/emulsim
docs/sphinx_ext/toctree_filter.py
.py
adcb77aadbaf34ce
7.15
1
"""Provides an actor for simulating active particles moving according to their direction. .. autosummary:: :nosignatures: ~ActiveParticleActor .. codeauthor:: David Zwicker <david.zwicker@ds.mpg.de> """ from __future__ import annotations from collections.abc import Callable import numba as nb import numpy a...
zwicker-group/emulsim
emulsim/actors/autonomous/active_particles.py
.py
d58223972b43ad4e
7.15
1
"""Provides an actor that confines particles inside a box. .. autosummary:: :nosignatures: ~BoxActor .. codeauthor:: David Zwicker <david.zwicker@ds.mpg.de> """ from __future__ import annotations from collections.abc import Callable from typing import Any import numpy as np from pde.backends.numba.utils im...
zwicker-group/emulsim
emulsim/actors/autonomous/box.py
.py
8b46f48a8285135f
7.15
1
"""Provides an actor for simulating Brownian motion. .. autosummary:: :nosignatures: ~BrownianMotionActor .. codeauthor:: David Zwicker <david.zwicker@ds.mpg.de> """ from __future__ import annotations from collections.abc import Callable import numpy as np from pde.backends.numba.utils import jit from pde....
zwicker-group/emulsim
emulsim/actors/autonomous/brownian_motion.py
.py
4b976720dced5fa3
7.15
1
"""Provides an actor for simulating droplet coalescence. .. autosummary:: :nosignatures: ~CoalescenceDropletActor .. codeauthor:: David Zwicker <david.zwicker@ds.mpg.de> """ from __future__ import annotations from collections.abc import Callable import numpy as np from numba import literal_unroll from numba...
zwicker-group/emulsim
emulsim/actors/autonomous/coalescence.py
.py
f3016cc61eeb74f5
7.15
1
"""Provides a simple actor that emits mass into a field at predefined positions. .. autosummary:: :nosignatures: ~EmittersActor .. codeauthor:: David Zwicker <david.zwicker@ds.mpg.de> """ from __future__ import annotations from collections.abc import Callable from typing import Any import numpy as np from ...
zwicker-group/emulsim
emulsim/actors/autonomous/emitters.py
.py
239727b5f51ec1cc
7.15
1
"""Supplies the base class for actors. .. autosummary:: :nosignatures: ~ActorBase ~find_actors .. codeauthor:: David Zwicker <david.zwicker@ds.mpg.de> """ from __future__ import annotations import inspect import itertools import logging from abc import ABCMeta, abstractmethod from collections.abc import C...
zwicker-group/emulsim
emulsim/actors/base.py
.py
e7372f95f11499a0
7.15
1
"""Provides an actor nucleating droplets from a field. .. codeauthor:: David Zwicker <david.zwicker@ds.mpg.de> """ from __future__ import annotations from collections.abc import Callable from typing import Any import numpy as np from droplets.tools import spherical from pde import CartesianGrid, ScalarField from p...
zwicker-group/emulsim
emulsim/actors/coupling/nucleation.py
.py
218c90fb8dd0f7d0
7.15
1
"""Provides an actor coupling point-like droplets to a field. .. codeauthor:: David Zwicker <david.zwicker@ds.mpg.de> """ from __future__ import annotations import math from collections.abc import Callable import numpy as np from droplets.tools import spherical from pde.backends.numba.utils import jit from pde.too...
zwicker-group/emulsim
emulsim/actors/coupling/point_droplet.py
.py
38e946cb8a9af499
7.15
1
"""Provides a simulation element representing multicomponent droplets. .. autosummary:: :nosignatures: ~MulticomponentDroplet ~MulticomponentDropletsElement .. codeauthor:: David Zwicker <david.zwicker@ds.mpg.de> """ from __future__ import annotations from collections.abc import Callable import numpy as ...
zwicker-group/emulsim
emulsim/elements/multicomponent_droplets.py
.py
1c8e3b0ca0d95cb6
7.15
1
"""Provides a simulation element representing spherical droplets. .. autosummary:: :nosignatures: ~SphericalDropletsElement .. codeauthor:: David Zwicker <david.zwicker@ds.mpg.de> """ from __future__ import annotations from typing import Any import numpy as np from droplets import Emulsion, SphericalDrople...
zwicker-group/emulsim
emulsim/elements/spherical_droplets.py
.py
435d8c1c7b85bbf3
7.15
1
"""Provides a class representing the full system state of multiple elements. .. autosummary:: :nosignatures: ~State .. inheritance-diagram:: State :parts: 1 .. codeauthor:: David Zwicker <david.zwicker@ds.mpg.de> """ from __future__ import annotations import itertools import warnings from collections im...
zwicker-group/emulsim
emulsim/state.py
.py
73287d0de687d97d
7.15
1
#!/usr/bin/env python3 """ Custom Brownian motion class ============================ Demonstrates the custom implementation of Brownian motion. """ import numpy as np import emulsim class BrownianParticlesActor(emulsim.ActorBase): diffusivity = 1 def evolve(self, elements, t, dt): """Evolve the pa...
zwicker-group/emulsim
examples/custom_brownian_particles.py
.py
e493f177ed93be25
7.15
1
#!/usr/bin/env python3 """ Biased droplet dynamics ======================= Demonstrates how droplet dynamics can be biased using an external field, which is here read from an image. """ from numba import jit from droplets import SphericalDroplet from pde import CartesianGrid, ScalarField, UnitGrid, get_backend impo...
zwicker-group/emulsim
examples/droplets_image_based.py
.py
562f740358b2d366
7.15
1
#!/usr/bin/env python3 """ Random field actor ================== Demonstrates a custom actor class that sets a field to random values """ import numba as nb import numpy as np from pde import UnitGrid import emulsim class RandomFieldActor(emulsim.ActorBase): """Actor that sets a new random field each time ste...
zwicker-group/emulsim
examples/random_field_actor.py
.py
9d0acceabb694c96
7.15
1
#!/usr/bin/env python3 import argparse import os import subprocess as sp import sys from pathlib import Path PACKAGE = "emulsim" # name of the package that needs to be tested PACKAGE_PATH = Path(__file__).resolve().parents[1] # base path of the package def run_test_codestyle(*, verbose: bool = True): """Run t...
zwicker-group/emulsim
scripts/run_tests.py
.py
9c8c32ec5aebec48
7.65
1
"""Unit tests for all functions in csv_utils.py file""" import os import pytest from urpautils import csv_read_rows, csv_create_file, csv_append_row, Csv_dict_writer def test_csv_file(tmpdir): """Test all functions on one csv file""" header = ["this", "is", "header"] row = ["this", "is", "a row"] p...
ultimaterpa/urpautils
tests/test_csv_utils.py
.py
cfc3a300a6db4627
7.74
2
"""Unit tests for all functions in file_utils.py file""" import os import time import pytest from urpautils import file_utils, universal def test_prepare_and_remove_dir(tmpdir): """Test for creating and removing a directory""" dir_path = os.path.join(tmpdir, "test_dir") file_utils.prepare_dir(dir_path)...
ultimaterpa/urpautils
tests/test_file_utils.py
.py
74e0a9dd55b96eaf
7.74
2
"""Unit tests for all functions in universal.py file""" import datetime from typing import Union import pytest from freezegun import freeze_time from urpautils import universal @freeze_time("2012-01-14") class Test_timestamp: """Test timestamp function""" def test_timestamp_padded(self): assert u...
ultimaterpa/urpautils
tests/test_universal.py
.py
befaac0f61555b4e
7.74
2
"""Module containing universal functions for file operations that can be used with urpa robots""" import datetime import glob import json import logging import os import shutil import time import traceback from typing import Optional from .universal import timestamp logger = logging.getLogger(__name__) def remove...
ultimaterpa/urpautils
urpautils/file_utils.py
.py
4b45feaed3736b10
7.24
2
"""Module containing universal functions that can be used with urpa robots""" import datetime import functools import logging import os import re import smtplib import subprocess import time from typing import List, Optional, Callable from email import charset from email.header import Header from email.mime.applicati...
ultimaterpa/urpautils
urpautils/universal.py
.py
ab715c73098e2be0
7.24
2
# -*- coding: utf-8 -*- """ Module to interact with a Agilent33220A series waveform generator. Uses pyVISA to communicate with the GPIB device. Version 1.1 (2020-06-15) Daan Wielens - PhD at ICE/QTM University of Twente daan@daanwielens.com """ import pyvisa as visa class WrongInstrErr(Exception): """ A conn...
ICE-QTM/QTMtoolbox
instruments/Agilent33220A.py
.py
5f48cb23b9208d87
7.39
5
# -*- coding: utf-8 -*- """ Module to interact with a Agilent DSO-X 4024A oscilloscope. Uses pyVISA to communicate with the USB device. --- If GPIB is used, modify the __init__ section of the class. --- Version 1.0 (2022-03-21) Daan Wielens - Researcher at ICE/QTM University of Twente daan@daanwielens.com """ import ...
ICE-QTM/QTMtoolbox
instruments/AgilentDSOX4024A.py
.py
949f8cf3d32ced89
7.39
5
# -*- coding: utf-8 -*- """ Module to interact with a Agilent33220A series waveform generator. Uses pyVISA to communicate with the GPIB device. Version 1.0 (2020-06-11) Daan Wielens - PhD at ICE/QTM University of Twente daan@daanwielens.com """ import visa class WrongInstrErr(Exception): """ A connection was...
ICE-QTM/QTMtoolbox
instruments/AgilentE8241A.py
.py
f623a45a8f3fce0b
7.39
5
# -*- coding: utf-8 -*- """ Module to interact with a Cryomagnetics 4G-100 magnet power supply. Uses pyVISA to communicate with the GPIB device. Assumes GPIB address is of the form GPIB0::<xx>::INSTR where <xx> is the device address (number). Version 1.0 (2022-05-23) Daan Wielens - PhD at ICE/QTM University of Twente ...
ICE-QTM/QTMtoolbox
instruments/CM4G100.py
.py
ad92a8655057c31c
7.39
5
# -*- coding: utf-8 -*- """ Module to interact with a Delft IVVI DAC module. Uses the pySerial module to communicate with the device. Assumes the address is of the form COM<xx> where <xx> is the relevant port. We assume that the IVVI rack has 16 DACs and that all DACs are in BIPOLAR mode (+/- 2 V). Script based on: ht...
ICE-QTM/QTMtoolbox
instruments/IVVI.py
.py
6fe640f3cbd4d953
7.39
5
# -*- coding: utf-8 -*- """ Module to interact with a Keithley 2000 Multimeter. Uses pyVISA to communicate with the GPIB device. Assumes GPIB address is of the form GPIB0::<xx>::INSTR where <xx> is the device address (number). Version 1.1 (2022-01-10) Daan Wielens - PhD at ICE/QTM University of Twente daan@daanwielens...
ICE-QTM/QTMtoolbox
instruments/Keithley2000.py
.py
eaf0348a0f43b5d2
7.39
5
# -*- coding: utf-8 -*- """ Module to interact with a Keithley 2182A Nanovoltmeter. Uses pyVISA to communicate with the GPIB device. Assumes GPIB address is of the form GPIB0::<xx>::INSTR where <xx> is the device address (number). Version 1.1 (2024-10-18) Daan Wielens - Researcher at ICE/QTM University of Twente """ ...
ICE-QTM/QTMtoolbox
instruments/Keithley2182A.py
.py
6b6be48d43bc4855
7.39
5
# -*- coding: utf-8 -*- """ Module to interact with a Keithley 6500 Multimeter. Uses pyVISA to communicate with the GPIB device. Assumes GPIB address is of the form GPIB0::<xx>::INSTR where <xx> is the device address (number). Version 2.0 (2023-12-03) Daan Wielens - Researcher at ICE/QTM University of Twente daan@daan...
ICE-QTM/QTMtoolbox
instruments/Keithley6500.py
.py
dc194b380325cfa1
7.39
5
# -*- coding: utf-8 -*- """ Module to interact with a Keysight 33500B series waveform generator. Uses pyVISA to communicate with the USB/GPIB device. Version 1.3 (2023-05-24) Daan Wielens - Researcher at ICE/QTM University of Twente d.h.wielens@utwente.nl """ import pyvisa as visa class WrongInstrErr(Exception): ...
ICE-QTM/QTMtoolbox
instruments/Keysight33500B.py
.py
f7554978d6c959b5
7.39
5
# -*- coding: utf-8 -*- """ Module to interact with a LakeShore 332 Temperature Controller. Uses pyVISA to communicate with the GPIB device. Assumes GPIB address is of the form GPIB0::<xx>::INSTR where <xx> is the device address (number). Version 1.0 (2018-08-24) Daan Wielens - PhD at ICE/QTM University of Twente daan...
ICE-QTM/QTMtoolbox
instruments/Lake332.py
.py
3a1f32603a409cee
7.39
5
# -*- coding: utf-8 -*- """ Module to interact with a NI USB-6009. Requirements: - Downloading NI-DAQmx 2023 Q2 (download at NI site) - pip install nidaqmx Version 1.0 (2023-05-09) Daan Wielens - Researcher at ICE/QTM University of Twente d.h.wielens@utwente.nl """ import nidaqmx class NIusb6009: type = ...
ICE-QTM/QTMtoolbox
instruments/NIusb6009.py
.py
ed106ff4993847d6
7.39
5
# -*- coding: utf-8 -*- """ Module to interact with a Tektronix AFG1022. Uses pyVISA to communicate with the USB/GPIB device. Version 1.0 (2018-10-09) Daan Wielens - PhD at ICE/QTM University of Twente daan@daanwielens.com """ import pyvisa as visa class WrongInstrErr(Exception): """ A connection was establi...
ICE-QTM/QTMtoolbox
instruments/TekAFG1022.py
.py
99f67089f63f9b98
7.39
5
# -*- coding: utf-8 -*- """ Module to interact with a Tektronix AFG1022. Uses pyVISA to communicate with the USB/GPIB device. Version 2.1 (2023-05-09) Daan Wielens - Researcher at ICE/QTM University of Twente daan@daanwielens.com """ import pyvisa as visa import numpy as np import ast from struct import unpack clas...
ICE-QTM/QTMtoolbox
instruments/TekTDS3012C.py
.py
a5e910d4fafd46a9
7.39
5
# -*- coding: utf-8 -*- """ Module to interact with an Rohde & Schwarz Vector Network Analyzer. Uses sockets to communicate with the ethernet device. Version 1.1 (2026-03-14) Daan Wielens - Researcher at ICE/QTM University of Twente """ import socket import numpy as np class ZNLE18: type = 'RohdeSc...
ICE-QTM/QTMtoolbox
instruments/ZNLE18.py
.py
720e8c617257be4b
7.39
5
# -*- coding: utf-8 -*- """ Module to request the current time in different formats. The module can not be named 'time' as this would interfere with the built-in 'time' module of Python. Note: timestamps are given since the epoch (01-01-1970 00:00:00). Version 1.1.1 (2026-08-10) Daan Wielens - Researcher at ICE/QTM U...
ICE-QTM/QTMtoolbox
instruments/curtime.py
.py
83e9765711feefe3
7.39
5
# -*- coding: utf-8 -*- """ Module to serve as dummy. The dummy instrument can read/write values. The latency option determines the time it takes for the dummy instrument to 'respond' to the main python code. Default = 1 ms. The response of the device is zero by default, and takes on write_val values instantly. Vers...
ICE-QTM/QTMtoolbox
instruments/dummy.py
.py
72ced0dcb06e18d1
7.39
5
# -*- coding: utf-8 -*- """ Module to interact with a HP 34401A Multimeter. Uses pyVISA to communicate with the GPIB device. Assumes GPIB address is of the form GPIB0::<xx>::INSTR where <xx> is the device address (number). Version 1.1 (2021-02-03) Daan Wielens - PhD at ICE/QTM University of Twente daan@daanwielens.com...
ICE-QTM/QTMtoolbox
instruments/hp34401A.py
.py
f12910cf1f8df4f5
7.39
5
# -*- coding: utf-8 -*- """ Module to interact with a Scientific Instruments 9700 Temperature Controller. Uses pyVISA to communicate with the GPIB device. Assumes GPIB address is of the form GPIB0::<xx>::INSTR where <xx> is the device address (number). Version 1.0 (2018-10-16) Daan Wielens - PhD at ICE/QTM University ...
ICE-QTM/QTMtoolbox
instruments/si9700.py
.py
342314e6d56be497
7.39
5
# -*- coding: utf-8 -*- """ Module to interact with a Stanford Research 830 Lock-In Amplifier. Uses pyVISA to communicate with the GPIB device. Assumes GPIB address is of the form GPIB0::<xx>::INSTR where <xx> is the device address (number). Version 1.2 (2024-05-02) Daan Wielens - PhD at ICE/QTM University of Twente d...
ICE-QTM/QTMtoolbox
instruments/sr830.py
.py
f2e69d1e8157e017
7.39
5
# -*- coding: utf-8 -*- """ Module to interact with a Stanford Research 860 Lock-In Amplifier. Uses pyVISA to communicate with the GPIB device. Assumes GPIB address is of the form GPIB0::<xx>::INSTR where <xx> is the device address (number). Version 0.1 (2026-08-04) Daan Wielens - Researcher at ICE/QTM University of T...
ICE-QTM/QTMtoolbox
instruments/sr860.py
.py
217bdf3dac77b7e7
7.39
5
""" Date parsing and formatting helpers. """ import locale import re from collections.abc import Iterable from datetime import date, datetime, timedelta, timezone from typing import Literal, cast from ._awareness import is_aware_datetime as _is_aware_datetime _MAX_TZ_OFFSET_HOURS = 23 _MAX_TZ_OFFSET_MINUTES = 59 _MA...
chetmancini/dateutils-python
dateutils/parsing.py
.py
0bb2f0874145d1de
7
0
""" Timezone utilities. """ from datetime import date, datetime, timedelta, timezone, tzinfo from functools import lru_cache from typing import Literal from zoneinfo import ZoneInfo, ZoneInfoNotFoundError, available_timezones from ._awareness import is_aware_datetime as _is_aware_datetime _SECONDS_IN_MINUTE = 60 _SE...
chetmancini/dateutils-python
dateutils/timezones.py
.py
d2e1559adf289ccf
7
0
#!/usr/bin/env python3 """ Intelligently update CHANGELOG.md with new version information. Analyzes git changes between the most recent tag and HEAD to generate meaningful entries. Used by Makefile version bump commands. """ import argparse import re import shutil import subprocess from collections import Counter from...
chetmancini/dateutils-python
scripts/update_changelog.py
.py
84ec1a208f265486
7
0
#!/usr/bin/env python3 """Validate public module doctests and executable README examples.""" import argparse import doctest import io import traceback from contextlib import redirect_stderr, redirect_stdout from pathlib import Path from types import ModuleType from dateutils import dateutils as dateutils_module from ...
chetmancini/dateutils-python
scripts/validate_docs.py
.py
9879d050393046c3
7
0
#!/usr/bin/env python3 """Validate that a release tag matches the project version.""" import argparse import re from pathlib import Path DEFAULT_PYPROJECT_PATH = Path(__file__).resolve().parent.parent / "pyproject.toml" def read_project_version(pyproject_path: Path = DEFAULT_PYPROJECT_PATH) -> str: """Read and ...
chetmancini/dateutils-python
scripts/validate_release_tag.py
.py
4c5a0d3f01930edb
7
0
# Copyright 2024 Canonical Ltd. # See LICENSE file for licensing details. """Sync AlertManager rules from an upstream repository. This script fetches AlertManager rules definitions from a specified version of the kube-prometheus project and adjusts them for compatibility with COS. """ import logging import shutil im...
charmed-kubernetes/charm-kubernetes-worker
scripts/update_alert_rules.py
.py
a2f4c56d1e3a4498
7.24
2
# Copyright 2024 Canonical # See LICENSE file for licensing details. """CIS Benchmark action for Kubernetes Worker.""" import contextlib import dataclasses import json import logging import os import shlex import shutil import subprocess import tempfile from pathlib import Path from typing import Optional import ops...
charmed-kubernetes/charm-kubernetes-worker
src/actions/cis_benchmark.py
.py
2e42ff33b406f8c1
7.24
2
# Copyright 2024 Canonical # See LICENSE file for licensing details. """Cloud Integration for Charmed Kubernetes Worker.""" import logging from typing import Union import charms.contextual_status as status import ops from ops.interface_aws.requires import AWSIntegrationRequires from ops.interface_azure.requires impo...
charmed-kubernetes/charm-kubernetes-worker
src/cloud_integration.py
.py
fdff094e87826726
7.24
2
# Copyright 2024 Canonical Ltd. # See LICENSE file for licensing details. """COS Integration module.""" import logging from dataclasses import dataclass from typing import Dict, List from ops import CharmBase log = logging.getLogger(__name__) @dataclass class JobConfig: """Data class representing the configur...
charmed-kubernetes/charm-kubernetes-worker
src/cos_integration.py
.py
cec8ad2c90c88360
7.24
2
from pathlib import Path from tempfile import NamedTemporaryFile, TemporaryDirectory import os import subprocess import nox ROOT = Path(__file__).parent PYPROJECT = ROOT / "pyproject.toml" DOCS = ROOT / "docs" PACKAGE = ROOT / "mkpkg" SUPPORTED = ["3.13", "3.14"] LATEST = SUPPORTED[-1] nox.options.default_venv_back...
Julian/mkpkg
noxfile.py
.py
0d3d952bd6f3c8f7
7
0
""" If all the servers have the same login, and the IP list is a simple sequence, then the server list can be generated automatically """ from SETTINGS import net, seq, include, exclude, param def get_exclude_list(begin, end): list_ = [] for i in range(begin, end + 1): list_.append(str(i)) return ...
MinistrBob/SSHRobot
ssh_SL_generator.py
.py
faab2d4af6333aba
7
0
#!/usr/bin/env python3 """ Search and Install Windows Updates Usage: winupdates.py [options] search <host> winupdates.py [options] update <host> Options: -h --help Display this message -d DEBUG_LVL --debug DEBUG_LVL Enable debug output [Default: 0] -p PORT --port PO...
OSWatcher/pywinupdate
winupdate/__main__.py
.py
abefa0e319613ffd
7
0
import logging import subprocess import time from collections import Counter from dataclasses import dataclass from queue import Queue from typing import Dict, Iterator, List, Optional, Tuple, Union from winupdate.ansible import WinUpdateCmd, WinUpdatePlaybook DEFAULT_WINRM_PORT = 5985 DEFAULT_USER = "vagrant" DEFAUL...
OSWatcher/pywinupdate
winupdate/winupdate.py
.py
bae029d6b70f9282
7
0
""" Ensure a pull request has exactly one version label """ import os import sys import json VALID_LABELS = {'Patch', 'Minor', 'Major', "no-release"} def extract_labels_from_event(event_file: str) -> set[str]: """Extract label names from a GitHub event JSON file. Args: event_file: Path to the JSO...
unthreaded/git-hooks
scripts/pr_label_check.py
.py
90e9dfcce2bb0e64
7.15
1
""" This file handles command line arguments and invoking the hook """ import logging import os import sys from src.main.config.commit_hook_config import CommitHookConfig from src.main.config.commit_hook_config_base_impl import CommitHookConfigDefaultImpl from src.main.config.commit_hook_config_ini_impl import Co...
unthreaded/git-hooks
src/main/commit_msg_hook.py
.py
094a87aebc541385
7.15
1
""" Default configuration """ from src.main.config.commit_hook_config import CommitHookConfig class CommitHookConfigDefaultImpl(CommitHookConfig): """ Default values for all configuration items """ def get_issue_url_format(self, ticket: str = "") -> str: return f"https://github.com/un...
unthreaded/git-hooks
src/main/config/commit_hook_config_base_impl.py
.py
57dbf9a697c441fb
7.15
1
""" Load configuration from INI file """ import logging from configparser import ConfigParser from src.main.config.commit_hook_config import CommitHookConfig class CommitHookConfigINIImpl(CommitHookConfig): """ Pull configuration from INI file object passed to constructor """ CONFIG_FILE_NAM...
unthreaded/git-hooks
src/main/config/commit_hook_config_ini_impl.py
.py
ec2c888ba762223e
7.15
1
import unittest from unittest.mock import patch class BaseUnitTest: """ By wrapping BaseTestCase in this class, the test runner will not attempt to run it """ class BaseTestCase(unittest.TestCase): """ We will need this mocking in most, if not all, of our unit tests ""...
unthreaded/git-hooks
src/test/base_unit_test.py
.py
812c2ed9230c2d53
7.65
1
"""Execute a using schedule_id.""" import datetime import subprocess import signal import threading import time import uuid from typing import NamedTuple, Optional from cicada.lib import postgres from cicada.lib import scheduler from cicada.lib import utils DB_ALERT_DELAY_MINUTES = 15 DB_RETRY_DELAY_SECONDS = 5 CHI...
transferwise/cicada
cicada/commands/exec_schedule.py
.py
2a7dfac1b4a2606d
7.39
5
"""Spread schedules accross servers.""" import datetime import sys from cicada.lib import postgres from cicada.lib import scheduler from cicada.lib import utils def csv_to_list(comma_separated_string: str) -> [int]: """Convert list of string to a list of integers""" try: return list(map(int, comma_s...
transferwise/cicada
cicada/commands/spread_schedules.py
.py
a6bda1758d8e8c2b
7.39
5
"""Backend PostgreSQL database library""" # 2015-07-01 Louis Pieterse from contextlib import contextmanager import psycopg2 from cicada.lib import utils # Create a PgSQL database connection based on definition requested def db_cicada(dbname=None): """Connect to PostgreSQL backend database""" definitions ...
transferwise/cicada
cicada/lib/postgres.py
.py
69d4ca611648f8f5
7.39
5
from __future__ import annotations import math from typing import Optional from croniter import croniter import datetime from cicada.lib.scheduler import get_median_run_time class Schedule: schedule_id: str server_id: int interval_mask: str frequency_minutes: int median_runtime_minutes: int sh...
transferwise/cicada
cicada/lib/smart_scheduling/domain.py
.py
1e042fef1bdf8218
7.39
5
from __future__ import annotations from typing import List, Mapping, Optional, Sequence import numpy as np import pygad from cicada.lib.smart_scheduling.config import GAConfig from cicada.lib.smart_scheduling.domain import Schedule from cicada.lib.smart_scheduling.evaluation import evaluate_usage_and_peak class GAPy...
transferwise/cicada
cicada/lib/smart_scheduling/ga_pygad.py
.py
cb9b27c579312133
7.39
5
"""Utility library.""" import sys import traceback import backoff import os import yaml from typing import Dict from slack_sdk import WebClient from slack_sdk.errors import SlackApiError from functools import wraps def suppress_exception(func): """Decorator to suppress an Exception created by attempting to send...
transferwise/cicada
cicada/lib/utils.py
.py
aa55dee839ca253a
7.39
5
""" test_functional_archive_logs.py Test archiving schedule_log entries into schedule_log_historical """ from unittest import result import pytest import os import datetime import psycopg2 from cicada.commands import archive_schedule_log @pytest.fixture(scope="session", autouse=True) def get_env_vars(): ...
transferwise/cicada
tests/test_functional_archive_logs.py
.py
291c8993c1458f6f
7.89
5
"""test_lib_postgres.py""" from cicada.lib import postgres def test_cicada_db_connection(): """test_cicada_db_connection""" db_conn = postgres.db_cicada() assert db_conn.autocommit def test_cicada_db_connection_close(): """test_cicada_db_connection_close""" db_conn = postgres.db_cicada() db...
transferwise/cicada
tests/test_lib_postgres.py
.py
43e41b1ce9075ea0
7.89
5
import os from pydantic import field_validator from pydantic_settings import BaseSettings class Config(BaseSettings): """ Config class provides a model for application configuration settings, which includes the path to the configuration file. Attributes: config_file (str): The path to the co...
mitchelllisle/monstermash
src/monstermash/config.py
.py
03e9ef619daf3d83
7.24
2
from nacl.encoding import HexEncoder, RawEncoder from nacl.public import Box, PrivateKey, PublicKey from pydantic import SecretStr from monstermash.datamodels import KeyPair class Crypt: """ Crypt class provides methods for encryption and decryption of messages using NaCl (Salt) cryptographic library. A...
mitchelllisle/monstermash
src/monstermash/crypt.py
.py
8ffce857698f79d4
7.24
2
from typing import Optional, Tuple from pydantic import ValidationError from monstermash.config import Config from monstermash.datamodels import ProfileConfig from monstermash.parser import ConfigManager def read_profile(config_manager: ConfigManager, profile: str) -> ProfileConfig: """Read and validate a store...
mitchelllisle/monstermash
src/monstermash/keys.py
.py
d9182eb75baa84e5
7.24
2
import os from configparser import ConfigParser class ConfigManager: """ConfigManager ConfigManager class manages the reading and writing operations to a configuration file. This is useful for generating a set of keys (using `monstermash generate`) that will be used for future encryption and decryption ...
mitchelllisle/monstermash
src/monstermash/parser.py
.py
ba12a4ac9cdd1089
7.24
2
import json import re from typing import Union from pydantic import Json NEW_LINE_EXPR = re.compile(r'[\n\r]') def open_file(file) -> Union[Json, str]: """ Open a file and return its contents. For JSON files, the contents are returned as a dictionary. For non-JSON files, the contents are returned as a s...
mitchelllisle/monstermash
src/monstermash/utils/file.py
.py
5b2b12f0807ea1a7
7.24
2
import asyncio import pytest from monstermash.crypt import KeyPair from monstermash.mcp_server import ( add_contact, configure, decrypt, encrypt, generate_keypair, list_profiles, mcp, ) @pytest.fixture def temp_config(tmp_path, monkeypatch): """Point the Monstermash config file at a ...
mitchelllisle/monstermash
tests/test_mcp_server.py
.py
0039fd986e29d49d
7.74
2
"""Pure Python helpers used by the feature engineering pipeline.""" import math from collections.abc import Sequence def time_difference_list(values: Sequence) -> list[float]: """Return elapsed seconds between consecutive datetime values.""" if len(values) < 2: return [0] return [ (second...
keklikci/customer-behavior-modeling-for-ecommerce
feature_math.py
.py
2bfb71e108a548d7
7
0
#!/usr/bin/env python3 """ Background Image Fetcher Fetches real images from Pexels for slide backgrounds. Uses web scraping (no API key required) or WebFetch tool integration. """ import json import csv import re import sys from pathlib import Path # Project root relative to this script PROJECT_ROOT = Path(__file__)...
ptkvaibhav/ptkvaibhav
.agents/skills/design-system/scripts/fetch-background.py
.py
cecedad0a9054e6e
7
0
#!/usr/bin/env python3 """ HTML Design Token Validator Ensures all HTML assets (slides, infographics, etc.) use design tokens. Source of truth: assets/design-tokens.css Usage: python html-token-validator.py # Validate all HTML assets python html-token-validator.py --type slides # Validate o...
ptkvaibhav/ptkvaibhav
.agents/skills/design-system/scripts/html-token-validator.py
.py
9556a65e7aacda23
7
0
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Slide Search Core - BM25 search engine for slide design databases """ import csv import re from pathlib import Path from math import log from collections import defaultdict # ============ CONFIGURATION ============ DATA_DIR = Path(__file__).parent.parent / "data" MAX...
ptkvaibhav/ptkvaibhav
.agents/skills/design-system/scripts/slide_search_core.py
.py
2464050ae338eb50
7
0
"""Regression tests for validate-tokens.cjs. The validator used to skip any line containing ``var(--`` outright, so a hardcoded value sharing a line with a token reference (extremely common in real CSS, and universal in minified CSS where everything is one line) went undetected. These tests drive the CLI via ``node`` ...
ptkvaibhav/ptkvaibhav
.agents/skills/design-system/scripts/tests/test_validate_tokens.py
.py
a32f34a9e89542a3
7.5
0
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ CIP Design Core - BM25 search engine for Corporate Identity Program design guidelines """ import csv import re from pathlib import Path from math import log from collections import defaultdict # ============ CONFIGURATION ============ DATA_DIR = Path(__file__).parent...
ptkvaibhav/ptkvaibhav
.agents/skills/design/scripts/cip/core.py
.py
78a78a51f12d2382
7
0
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ CIP Design Generator - Generate corporate identity mockups using Gemini Nano Banana Uses Gemini's native image generation (Nano Banana Flash/Pro) for high-quality mockups. Supports text-and-image-to-image generation for using actual brand logos. - gemini-2.5-flash-im...
ptkvaibhav/ptkvaibhav
.agents/skills/design/scripts/cip/generate.py
.py
2745040c9b534cf4
7
0
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ CIP HTML Presentation Renderer Generates a professional HTML presentation from CIP mockup images with detailed descriptions, concepts, and brand guidelines. """ import argparse import json import os import sys import base64 from pathlib import Path from datetime impo...
ptkvaibhav/ptkvaibhav
.agents/skills/design/scripts/cip/render-html.py
.py
a49a89a017ea4a2c
7
0
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ CIP Design Search CLI - Search corporate identity design guidelines """ import argparse import json import sys from pathlib import Path # Add parent directory for imports sys.path.insert(0, str(Path(__file__).parent)) from core import search, search_all, get_cip_brie...
ptkvaibhav/ptkvaibhav
.agents/skills/design/scripts/cip/search.py
.py
6619fbbe71983003
7
0
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Icon Generation Script using Gemini 3.1 Pro Preview API Generates SVG icons via text generation (SVG is XML text format) Model: gemini-3.1-pro-preview - best thinking, token efficiency, factual consistency Usage: python generate.py --prompt "settings gear icon" -...
ptkvaibhav/ptkvaibhav
.agents/skills/design/scripts/icon/generate.py
.py
1a6be99dc233f6d9
7
0
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Logo Design Core - BM25 search engine for logo design guidelines """ import csv import re from pathlib import Path from math import log from collections import defaultdict # ============ CONFIGURATION ============ DATA_DIR = Path(__file__).parent.parent.parent / "dat...
ptkvaibhav/ptkvaibhav
.agents/skills/design/scripts/logo/core.py
.py
4f8b36ffe538e599
7
0
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Logo Generation Script using Gemini Nano Banana API Uses Gemini 2.5 Flash Image and Gemini 3 Pro Image Preview models Models: - Nano Banana (default): gemini-2.5-flash-image - fast, high-volume, low-latency - Nano Banana Pro (--pro): gemini-3-pro-image-preview - profe...
ptkvaibhav/ptkvaibhav
.agents/skills/design/scripts/logo/generate.py
.py
6e4358f21cd85fec
7
0
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Logo Design Search - CLI for searching logo design guidelines Usage: python search.py "<query>" [--domain <domain>] [--max-results 3] python search.py "<query>" --design-brief [-p "Brand Name"] Domains: style, color, industry """ import argparse from core impo...
ptkvaibhav/ptkvaibhav
.agents/skills/design/scripts/logo/search.py
.py
693b3a1824831f12
7
0
#!/usr/bin/env python3 """ Tailwind CSS Configuration Generator Generate tailwind.config.js/ts with custom theme configuration. Supports colors, fonts, spacing, breakpoints, and plugin recommendations. """ import argparse import json import re import sys from pathlib import Path from typing import Any, Dict, List, Op...
ptkvaibhav/ptkvaibhav
.agents/skills/ui-styling/scripts/tailwind_config_gen.py
.py
2e264ec871499681
7
0
"""Tests for tailwind_config_gen.py""" import shutil import subprocess from pathlib import Path import pytest # Add parent directory to path for imports import sys sys.path.insert(0, str(Path(__file__).parent.parent)) from tailwind_config_gen import TailwindConfigGenerator class TestTailwindConfigGenerator: "...
ptkvaibhav/ptkvaibhav
.agents/skills/ui-styling/scripts/tests/test_tailwind_config_gen.py
.py
4efa59fdbe318d55
7.5
0
"""Tasks for maintaining the project. Execute 'invoke --list' for guidance on using Invoke """ import platform from pathlib import Path from typing import Dict, Optional from invoke import call, task from invoke.context import Context from invoke.runners import Result ROOT_DIR = Path(__file__).parent PYTHON_TARGETS...
fedejaure/ansible-role-rpi-lcd
tasks.py
.py
8036f7ec776142e7
7.24
2
import sys from typing import cast import importlib import importlib.util from .abstract import cwipc_abstract_filter from ..net.abstract import * from . import passthrough, analyze, voxelize, transform, transform44, crop, remove_outliers, colorize, noise, simulatecams, direction, randomize_floor all_filters = [passth...
cwi-dis/cwipc_util
python/cwipc/filters/__init__.py
.py
6e2aac930d8406a8
7.24
2
from abc import ABC, abstractmethod from ..util import cwipc_pointcloud_wrapper class cwipc_abstract_filter(ABC): @abstractmethod def filter(self, pc: cwipc_pointcloud_wrapper) -> cwipc_pointcloud_wrapper: """Feed a point cloud to the filter. Returns the resulting point cloud. """ ... ...
cwi-dis/cwipc_util
python/cwipc/filters/abstract.py
.py
c329db736dc3aa0a
7.24
2
import time import numpy.random from typing import Union, List, Tuple, Optional, Dict, Sequence, Any from .abstract import cwipc_abstract_filter from ..util import cwipc_pointcloud_wrapper, cwipc_from_numpy_matrix class NoiseFilter(cwipc_abstract_filter): """ noise - Add noise to the point coordinates. ...
cwi-dis/cwipc_util
python/cwipc/filters/noise.py
.py
ae2c92fbb1aea8f8
7.24
2