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 |
|---|---|---|---|---|---|---|
"""Speaker avatar download + cache."""
from __future__ import annotations
import hashlib
import os
import shutil
from pathlib import Path
from urllib.parse import urlparse
import click
import httpx
VALID_EXTENSIONS = (".jpg", ".jpeg", ".png", ".gif", ".webp")
PLACEHOLDER_AVATAR_URL = "https://www.pyohio.org/no-prof... | pyohio/pyohio-static-website | pyohio-cli/src/pyohio_cli/pretalx/avatars.py | .py | a62919e72ef8ed97 | 7.52 | 10 |
"""Build a schedule grid structure from PreTalx slots.
The grid is grouped by day, then by start time. Each row is one of:
- ``talks`` one cell per room, aligned to the day's room order (``None`` for
an empty room at that time)
- ``plenary`` a single full-width item (keynote, opening/closing remarks,
... | pyohio/pyohio-static-website | pyohio-cli/src/pyohio_cli/pretalx/schedule.py | .py | 4c9cc12bc744cb93 | 7.52 | 10 |
"""High-level pipeline: read talk frontmatter, render 1920×1080 title slides.
Mirrors the OG image pipeline (see pyohio_cli.og.generator) but produces
landscape presentation slides for talks. Shared helpers are imported from the
OG module so the two pipelines stay in sync.
"""
from __future__ import annotations
impo... | pyohio/pyohio-static-website | pyohio-cli/src/pyohio_cli/slides/generator.py | .py | b7c6d8f1740a1d90 | 7.52 | 10 |
"""Playwright wrapper for screenshotting title-slide HTML to PNG."""
from __future__ import annotations
from pathlib import Path
from playwright.sync_api import sync_playwright
SLIDE_WIDTH = 1920
SLIDE_HEIGHT = 1080
class SlideRenderer:
"""Reusable Playwright browser+page for rendering many title slides.
... | pyohio/pyohio-static-website | pyohio-cli/src/pyohio_cli/slides/renderer.py | .py | 2f7cc7772e3d439a | 7.52 | 10 |
"""
Shared fixtures: small synthetic FITS cubes with known line properties.
"""
import numpy as np
import pytest
from astropy.io import fits
NV, NY, NX = 60, 12, 16
V0, DV, FNU = 2000.0, 400.0, 1.0
RMS = 0.05
VELAX = np.linspace(0.0, 4000.0, NV)
def make_cube_data(seed=0, pad_nan=True):
"""A Gaussian line plus... | PlanetFormationLab/bettermoments | tests/conftest.py | .py | 2996b3f0a5431f32 | 8.15 | 19 |
"""
End-to-end tests of the command-line interface.
"""
import sys
import numpy as np
import pytest
from astropy.io import fits
from bettermoments.collapse_cube import main
def run_cli(monkeypatch, *args):
monkeypatch.setattr(sys, 'argv', ['bettermoments'] + list(args))
main()
def test_cli_zeroth(cube_pa... | PlanetFormationLab/bettermoments | tests/test_cli.py | .py | 123e5fe80a1b39bc | 8.15 | 19 |
"""
Tests for bettermoments.io: safe output paths, header propagation and unit
handling.
"""
import numpy as np
import pytest
from astropy.io import fits
from bettermoments.io import (_output_path, _read_velocity_axis,
_write_header, load_cube, save_to_FITS)
from .conftest import VELAX, ... | PlanetFormationLab/bettermoments | tests/test_io.py | .py | d5fc8334194709cc | 8.15 | 19 |
# Copyright 2018 IBM Corp. All Rights Reserved.
#
# 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 agre... | zhmcclient/zhmc-prometheus-exporter | tests/test_resource_cache.py | .py | 706c943267ad48f1 | 7.14 | 18 |
# Copyright 2018,2025 IBM Corp. All Rights Reserved.
#
# 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... | zhmcclient/zhmc-prometheus-exporter | zhmc_prometheus_exporter/_exceptions.py | .py | 11df62a61dccb833 | 7.64 | 18 |
# Copyright 2018,2025 IBM Corp. All Rights Reserved.
#
# 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... | zhmcclient/zhmc-prometheus-exporter | zhmc_prometheus_exporter/_logging.py | .py | f0c498252bb86a15 | 7.64 | 18 |
# -*- coding: utf-8 -*-
# pylint: disable=missing-docstring, redefined-outer-name
import pytest
@pytest.fixture(scope="session")
def docker_compose_file(pytestconfig): # pylint: disable=unused-argument
return "docker-compose.aiida-sssp-workflow.yml"
@pytest.fixture(scope="session")
def docker_compose(docker_se... | aiidateam/aiida-sssp-workflow | .docker/tests/conftest.py | .py | 8a199350721965b4 | 7.95 | 7 |
# -*- coding: utf-8 -*-
"""
Adapt from aiida-sssp-workflow as prototype
Will in here refactoring it so no need to use the aiida datatype as inputs.
calculate bands distance
"""
import numpy as np
# from aiida_sssp_workflow.efermi import find_efermi
def get_homo(bands, num_electrons: int):
"""
This function... | aiidateam/aiida-sssp-workflow | src/aiida_sssp_workflow/calculations/calculate_bands_distance.py | .py | 6b9c896c80c98062 | 7.45 | 7 |
# -*- coding: utf-8 -*-
"""
Refactor from calcDelta.py v3.1 write by Kurt Lejaeghere
Copyright (C) 2012 Kurt Lejaeghere <Kurt.Lejaeghere@UGent.be>, Center for
Molecular Modeling (CMM), Ghent University, Ghent, Belgium
"""
import importlib
import json
import numpy as np
from aiida import orm
from aiida.engine import c... | aiidateam/aiida-sssp-workflow | src/aiida_sssp_workflow/calculations/calculate_metric.py | .py | bed0e8bbc9aa5a8c | 7.45 | 7 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Running verification workchain
"""
from typing import List, Tuple
from pathlib import Path
import aiida
import click
from aiida import orm
from aiida.cmdline.params import options, types
from aiida.cmdline.utils import echo
from aiida.engine import ProcessBuilder, run... | aiidateam/aiida-sssp-workflow | src/aiida_sssp_workflow/cli/run.py | .py | bef4657e2b45c149 | 7.45 | 7 |
# -*- coding: utf-8 -*-
"""
Reuse the pure python translate from Nicola's F77 code
Adapt from Austin's repository:
https://github.com/zooks97/bieFermi/tree/main/bieFermi/py
"""
import numpy as np
from scipy.special import erfc
FDCUT = 30.0 # Fermi-Dirac cutoff
HMCUT = 10.0 # Hermite cutoff
POSHMA = -0.5634 # Posit... | aiidateam/aiida-sssp-workflow | src/aiida_sssp_workflow/efermi.py | .py | 9755fc180656d6f5 | 7.45 | 7 |
# ruff: noqa: F403, F405
from .structure import *
from .pseudo import *
from .element import *
from .protocol import *
__all__ = [
"get_default_configuration",
"extract_pseudo_info",
"get_default_dual",
"parse_std_filename",
"LANTHANIDE_ELEMENTS",
"ACTINIDE_ELEMENTS",
"MAGNETIC_ELEMENTS",
... | aiidateam/aiida-sssp-workflow | src/aiida_sssp_workflow/utils/__init__.py | .py | 63394eaabe7ad5f0 | 7.45 | 7 |
import re
from pydantic import BaseModel
from importlib import resources
from enum import Enum
from aiida_pseudo.data.pseudo import UpfData
from .element import HIGH_DUAL_ELEMENTS
REGEX_ELEMENT_V1 = re.compile(r"""(?P<element>[a-zA-Z]{1,2})\s+Element""")
REGEX_ELEMENT_V2 = re.compile(
r"""\s*element\s*=\s*['"]\... | aiidateam/aiida-sssp-workflow | src/aiida_sssp_workflow/utils/pseudo.py | .py | 4276ea4c9ed6a5ad | 7.45 | 7 |
import json
from pathlib import Path
from importlib import resources
from ase import Atoms, io
from aiida import orm
from aiida.engine import calcfunction
from aiida.tools.data.array.kpoints import get_kpoints_path
from .element import MAGNETIC_ELEMENTS
OXIDE_CONFIGURATIONS = ["XO", "XO2", "XO3", "X2O", "X2O3", "X2O... | aiidateam/aiida-sssp-workflow | src/aiida_sssp_workflow/utils/structure.py | .py | 32ca7604c1c43327 | 7.45 | 7 |
# -*- coding: utf-8 -*-
"""utils.py"""
import collections.abc
from aiida import orm
from aiida.engine import calcfunction
from aiida.plugins import DataFactory
UpfData = DataFactory("pseudo.upf")
def update_dict(d, u):
"""update dict by7 another dict, update include all hierarchy
return the update dict ins... | aiidateam/aiida-sssp-workflow | src/aiida_sssp_workflow/utils/utils.py | .py | 64819d1c209c120e | 7.45 | 7 |
from builtins import ConnectionError
from typing import Optional
from paramiko import ssh_exception
from aiida import orm
def get_extra_parameters_for_lanthanides(element, nbnd) -> dict:
"""
In rare earth case, increase the initial number of bands,
otherwise the occupation will not fill up in the highes... | aiidateam/aiida-sssp-workflow | src/aiida_sssp_workflow/workflows/common.py | .py | 2b58836b818e9d43 | 7.45 | 7 |
# -*- coding: utf-8 -*-
"""
Base convergence workchain
This abstract class give the framework of how to run a convergence test on a given property.
The detail parameters for different properties are defined in the subclass that inherit this base class.
"""
from typing import Union
from pathlib import Path
from abc im... | aiidateam/aiida-sssp-workflow | src/aiida_sssp_workflow/workflows/convergence/_base.py | .py | e7029bc9623f782f | 7.45 | 7 |
# -*- coding: utf-8 -*-
"""
Convergence test on bands of a given pseudopotential
"""
from aiida import orm
from aiida.engine import calcfunction
from aiida.plugins import DataFactory
from aiida_sssp_workflow.calculations.calculate_bands_distance import get_bands_distance
from aiida_sssp_workflow.utils import MAGNETIC... | aiidateam/aiida-sssp-workflow | src/aiida_sssp_workflow/workflows/convergence/bands copy.py | .py | 172aa6dd4f9c4bc2 | 7.45 | 7 |
# -*- coding: utf-8 -*-
"""
Convergence test on bands of a given pseudopotential
"""
from pathlib import Path
from typing import Union, Any
import copy
from aiida import orm
from aiida.engine import ProcessBuilder
from aiida_pseudo.data.pseudo import UpfData
from aiida_sssp_workflow.utils import get_default_mpi_opti... | aiidateam/aiida-sssp-workflow | src/aiida_sssp_workflow/workflows/convergence/bands.py | .py | ec71b7618f487c29 | 7.45 | 7 |
# -*- coding: utf-8 -*-
"""
Convergence test on cohesive energy of a given pseudopotential
"""
from aiida import orm
from aiida.engine import calcfunction
from aiida.plugins import DataFactory
from aiida_sssp_workflow.utils import LANTHANIDE_ELEMENTS, update_dict
from aiida_sssp_workflow.workflows.convergence._base i... | aiidateam/aiida-sssp-workflow | src/aiida_sssp_workflow/workflows/convergence/cohesive_energy copy.py | .py | 968a1cd41083f93e | 7.45 | 7 |
# -*- coding: utf-8 -*-
"""
Convergence test on cohesive energy of a given pseudopotential
"""
from pathlib import Path
from typing import Union, Any
from aiida import orm
from aiida.engine import ProcessBuilder
from aiida_pseudo.data.pseudo import UpfData
from aiida_sssp_workflow.utils import get_default_mpi_option... | aiidateam/aiida-sssp-workflow | src/aiida_sssp_workflow/workflows/convergence/cohesive_energy.py | .py | 88cf8063fb8cc8aa | 7.45 | 7 |
# -*- coding: utf-8 -*-
"""
Convergence test on cohesive energy of a given pseudopotential
"""
from aiida import orm
from aiida.engine import calcfunction
from aiida.plugins import DataFactory
from aiida_sssp_workflow.utils import LANTHANIDE_ELEMENTS, update_dict
from aiida_sssp_workflow.workflows.convergence._base i... | aiidateam/aiida-sssp-workflow | src/aiida_sssp_workflow/workflows/convergence/eos copy.py | .py | 8e67581aa992bdd6 | 7.45 | 7 |
# -*- coding: utf-8 -*-
"""
Convergence test on cohesive energy of a given pseudopotential
"""
from pathlib import Path
from typing import Union, Any
from aiida import orm
from aiida.engine import ProcessBuilder
from aiida_pseudo.data.pseudo import UpfData
from aiida_sssp_workflow.calculations.calculate_metric impor... | aiidateam/aiida-sssp-workflow | src/aiida_sssp_workflow/workflows/convergence/eos.py | .py | d1584607c3852f3d | 7.45 | 7 |
# -*- coding: utf-8 -*-
"""
Convergence test on phonon frequencies of a given pseudopotential
"""
from aiida import orm
from aiida.engine import calcfunction
from aiida.plugins import DataFactory
from aiida_sssp_workflow.utils import update_dict
from aiida_sssp_workflow.workflows.convergence._base import _BaseConverg... | aiidateam/aiida-sssp-workflow | src/aiida_sssp_workflow/workflows/convergence/phonon_frequencies copy.py | .py | 1c841f6c0b18933a | 7.45 | 7 |
# -*- coding: utf-8 -*-
"""
Convergence test on phonon frequencies of a given pseudopotential
"""
from typing import Union, Any
from pathlib import Path
from aiida import orm
from aiida.engine import ProcessBuilder
from aiida_pseudo.data.pseudo import UpfData
from aiida_sssp_workflow.workflows.convergence._base impor... | aiidateam/aiida-sssp-workflow | src/aiida_sssp_workflow/workflows/convergence/phonon_frequencies.py | .py | 51ba541832de2e77 | 7.45 | 7 |
# -*- coding: utf-8 -*-
"""
Convergence test on pressure of a given pseudopotential
"""
from pathlib import Path
from typing import Union, Any
from aiida import orm
from aiida.engine import ProcessBuilder
from aiida_pseudo.data.pseudo import UpfData
from aiida_sssp_workflow.utils import get_default_mpi_options
from ... | aiidateam/aiida-sssp-workflow | src/aiida_sssp_workflow/workflows/convergence/pressure.py | .py | 7df069ef45cfc871 | 7.45 | 7 |
# -*- coding: utf-8 -*-
"""
Convergence test on pressure of a given pseudopotential
"""
from aiida import orm
from aiida.engine import calcfunction
from aiida.plugins import DataFactory
from aiida_sssp_workflow.utils import LANTHANIDE_ELEMENTS, update_dict
from aiida_sssp_workflow.workflows.convergence._base import _... | aiidateam/aiida-sssp-workflow | src/aiida_sssp_workflow/workflows/convergence/pressure_copy.py | .py | e7b751d4e6d86b92 | 7.45 | 7 |
from abc import abstractmethod
from aiida_sssp_workflow.workflows import SelfCleanWorkChain
class _BaseEvaluateWorkChain(SelfCleanWorkChain):
"""WorkChain to calculate cohisive energy of input structure"""
@classmethod
def define(cls, spec):
"""Define the process specification."""
# yapf... | aiidateam/aiida-sssp-workflow | src/aiida_sssp_workflow/workflows/evaluate/__init__.py | .py | d1f9e7120b6010c5 | 7.45 | 7 |
# -*- coding: utf-8 -*-
"""
WorkChain calculate the bands for certain pseudopotential
"""
import numpy as np
from aiida import orm
from aiida.engine import ToContext, calcfunction, if_, while_
from aiida.plugins import DataFactory
from . import _BaseEvaluateWorkChain
from ._caching_wise_bands import PwBandsWorkChain
... | aiidateam/aiida-sssp-workflow | src/aiida_sssp_workflow/workflows/evaluate/_bands.py | .py | 6d72bd0391c3738d | 7.45 | 7 |
"""The dobiss integration."""
from asyncio import gather
import logging
from dobissapi import DobissAPI
import voluptuous as vol
from homeassistant.components.light import ATTR_BRIGHTNESS
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
from homeassistant.const import ATTR_ENTITY_ID, CONF_HOST
from... | kesteraernoudt/dobiss | custom_components/dobiss/__init__.py | .py | d0c3f2d0a7a7b186 | 7.62 | 16 |
"""Support for dobiss switches."""
import logging
from dobissapi import DobissBinarySensor
from homeassistant.components.binary_sensor import BinarySensorDeviceClass, BinarySensorEntity
from .const import (
CONF_IGNORE_ZIGBEE_DEVICES,
CONF_INVERT_BINARY_SENSOR,
DOMAIN,
KEY_API,
)
_LOGGER = logging.g... | kesteraernoudt/dobiss | custom_components/dobiss/binary_sensor.py | .py | cf94c033b07bb56d | 7.62 | 16 |
"""Support for dobiss climate control."""
import logging
from dobissapi import DobissTempSensor
import voluptuous as vol
from homeassistant.components.climate import ClimateEntity
from homeassistant.components.climate.const import (
ClimateEntityFeature,
HVACAction,
HVACMode,
)
from homeassistant.const i... | kesteraernoudt/dobiss | custom_components/dobiss/climate.py | .py | dc6d29c2a44cd6f6 | 7.62 | 16 |
"""Config flow for dobiss integration."""
import logging
import dobissapi
import voluptuous as vol
from homeassistant import config_entries, core, exceptions
from homeassistant.const import CONF_HOST
from homeassistant.core import callback
from homeassistant.const import __version__ as HAVERSION # noqa
from awesomev... | kesteraernoudt/dobiss | custom_components/dobiss/config_flow.py | .py | 1e40d0a2fc86db91 | 7.62 | 16 |
"""Support for dobiss lights."""
import logging
from dobissapi import DobissAnalogOutput, DobissLight, DobissOutput
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
LightEntity,
ColorMode,
)
from homeassistant.const import ATTR_ENTITY_ID, ENTITY_MATCH_ALL, ENTITY_MATCH_NONE
from homeassistan... | kesteraernoudt/dobiss | custom_components/dobiss/light.py | .py | b0d779ed5db0254a | 7.62 | 16 |
"""Support for dobiss climate control."""
import logging
from dobissapi import DobissTempSensor
from homeassistant.components.number import NumberEntity
from homeassistant.helpers.restore_state import RestoreEntity
from .const import CONF_IGNORE_ZIGBEE_DEVICES, DOMAIN, KEY_API
_LOGGER = logging.getLogger(__name__)
... | kesteraernoudt/dobiss | custom_components/dobiss/number.py | .py | e74c8eb25e1cafb5 | 7.62 | 16 |
"""Support for dobiss switches."""
import logging
from dobissapi import DobissLightSensor, DobissSensor, DobissTempSensor
from homeassistant.components.sensor import SensorDeviceClass
from homeassistant.const import UnitOfTemperature
from homeassistant.helpers.entity import Entity
from .const import CONF_IGNORE_ZIGBEE... | kesteraernoudt/dobiss | custom_components/dobiss/sensor.py | .py | b52520163d88f2ba | 7.62 | 16 |
"""Support for dobiss switches."""
import logging
from dobissapi import ICON_FROM_DOBISS, DobissSwitch
from homeassistant.components.switch import SwitchEntity
from homeassistant.const import ATTR_ENTITY_ID, ENTITY_MATCH_ALL, ENTITY_MATCH_NONE
from homeassistant.helpers.dispatcher import async_dispatcher_connect
fro... | kesteraernoudt/dobiss | custom_components/dobiss/switch.py | .py | c1f16aa7ba8fcc1f | 7.62 | 16 |
#!/usr/bin/env python3
"""Convert whisper.cpp output JSON to the pipeline's standard transcript shape.
whisper.cpp JSON shape (with -oj):
{
"systeminfo": "...",
"model": {...},
"params": {...},
"result": {"language": "zh"},
"transcription": [
{"timestamps": {"from": "00:00:01,200", "to": "00:00:04,500"},... | meathill/meathill | skills/video-skills/live-replay-video-pipeline/scripts/02b_adapt_whispercpp.py | .py | fdad328da0bc4a81 | 7.66 | 20 |
#!/usr/bin/env python3
"""Apply cut list to the source video.
Two paths, chosen automatically from 03_cut_list.json:
* No segment has a "speed" field (or all == 1.0) -> ORIGINAL fast path:
stream-copy each kept range (re-encode fallback per part), concat -c copy.
Behaviour is unchanged / byte-for-byte with previ... | meathill/meathill | skills/video-skills/live-replay-video-pipeline/scripts/04_edit_video.py | .py | 76e1eb79bac17603 | 7.66 | 20 |
#!/usr/bin/env python3
"""Project transcript onto the (possibly speed-warped) edited timeline, emit SRT.
Uses _cuts for speed-aware mapping: a point t inside kept segment i maps to
cum[i] + (t - start)/speed[i]. Cues that fall inside a sped-up (speed != 1.0)
segment are DROPPED -- a time-lapse has no intelligible spee... | meathill/meathill | skills/video-skills/live-replay-video-pipeline/scripts/05_make_srt.py | .py | b73352bf5d719ff2 | 7.66 | 20 |
#!/usr/bin/env python3
"""Convert out/06_chapters.json (or any chapters JSON) into a `HH:MM:SS title`
text file suitable for pasting into Bilibili / YouTube descriptions.
Bilibili's chapter parser REQUIRES strict `HH:MM:SS` (zero-padded hour)
timestamps — `M:SS` or `H:MM:SS` (no leading zero) won't be recognized.
YouT... | meathill/meathill | skills/video-skills/live-replay-video-pipeline/scripts/06b_chapters_to_txt.py | .py | bd7c64dfd92a6e18 | 7.66 | 20 |
#!/usr/bin/env python3
"""For each chapter, grab a frame from the EDITED video at the midpoint and
overlay the chapter title at the bottom. Output to out/covers/<idx>_<title>.png.
"""
import json, subprocess, sys, re
from pathlib import Path
from PIL import Image, ImageDraw, ImageFont
FONT_CANDIDATES_CJK = [
"/Sys... | meathill/meathill | skills/video-skills/live-replay-video-pipeline/scripts/07_make_covers.py | .py | db0126b33caeb3e3 | 7.66 | 20 |
#!/usr/bin/env python3
"""Insert chapter cover slates into the edited video.
Reads:
out/04_edited.mp4
out/06_chapters.json
out/covers/<idx>_<title>.png
Writes:
out/08_final.mp4 # video with title slates
out/08_final_subtitles.srt # SRT with timestamps shifted to match
out/08_final_c... | meathill/meathill | skills/video-skills/live-replay-video-pipeline/scripts/08_insert_covers.py | .py | 05b6ea34add3b812 | 7.66 | 20 |
#!/usr/bin/env python3
"""Generate a starter `09_publish_package.md` with chapter timestamps and the
section skeleton already filled in. The LLM then reads the transcript +
this starter and replaces every `<TODO: ...>` with real content based on
`prompts/publish_package_prompt.md`.
Reads:
out/08_final_chapters.json ... | meathill/meathill | skills/video-skills/live-replay-video-pipeline/scripts/09_make_publish_starter.py | .py | c81d91fd47159405 | 7.66 | 20 |
#!/usr/bin/env python3
"""Shared cut-list helpers for speed-aware editing.
A 03_cut_list.json entry may carry an optional "speed" field (float, default 1.0):
speed == 1.0 -> kept at original speed, full audio
speed > 1.0 -> time-lapsed by that factor and MUTED (silent)
A kept segment's contribution to the edit... | meathill/meathill | skills/video-skills/live-replay-video-pipeline/scripts/_cuts.py | .py | 0ab945badc3825c6 | 7.66 | 20 |
#!/usr/bin/env python3
"""Produce a human-readable transcript whose timestamps are aligned to the
edited video. Input: 02_transcript.json + 03_cut_list.json. Output:
out/_edited_transcript.txt (used by the LLM step that generates chapters).
Speed-aware via _cuts: sped-up (speed != 1.0) segments carry no intelligible
s... | meathill/meathill | skills/video-skills/live-replay-video-pipeline/scripts/_make_edited_transcript.py | .py | 649f33489832fd7d | 7.66 | 20 |
from string import ascii_lowercase
from wmf_scripts_imports.common import Importer, format_logs
from dcim.models import Device
from ipam.models import IPAddress, Prefix
from extras.scripts import ChoiceVar, ObjectVar, Script
class AddSecondaryIPs(Script, Importer):
class Meta:
name = "Assign additional ... | wikimedia/operations-software-netbox-extras | customscripts/add_secondary_ips.py | .py | 50c9f99c78718409 | 7.52 | 10 |
import configparser
from typing import Union
import requests
from wmf_scripts_imports.common import Importer, CONFIGFILE
from dcim.models import Device
from extras.scripts import Script, StringVar
from virtualization.models import VirtualMachine
class ImportPuppetDB(Script, Importer):
class Meta:
name... | wikimedia/operations-software-netbox-extras | customscripts/import_server_facts.py | .py | f74e411c07ec785c | 7.52 | 10 |
from wmf_scripts_imports.common import format_logs
from dcim.models import Device
from extras.scripts import Script, StringVar
class OfflineDevice(Script):
class Meta:
name = "Offline a device with extra actions"
description = (
"Set the device status to Offline (unracked), unset its ... | wikimedia/operations-software-netbox-extras | customscripts/offline_device.py | .py | 7ede1d3e3f9b617b | 7.52 | 10 |
from wmf_scripts_imports.common import format_logs
from dcim.models import Device
from extras.scripts import BooleanVar, Script, ObjectVar
class ReplaceDevice(Script):
class Meta:
name = "Move devices attributes"
description = (
"Move all attributes (cables, etc) from one device to th... | wikimedia/operations-software-netbox-extras | customscripts/replace_device.py | .py | 5c15d9a6868f6ec0 | 7.52 | 10 |
"""Accounting Netbox report.
Check the consistency of Netbox data against asset information in a Google
Sheet spreadsheet, as maintained by Wikimedia Foundation's accounting
department.
Requires google-api-python-client and google-auth-oauthlib.
"""
import configparser
from datetime import date, datetime, timedelta
... | wikimedia/operations-software-netbox-extras | reports/accounting.py | .py | 1c0db12acd27d6d8 | 7.52 | 10 |
"""Report on various cable, port, and termination related errors.
BLOCKLISTS:
test_blank_cable_label: eqiad
"""
import datetime
import re
from django.contrib.contenttypes.models import ContentType
from dcim.choices import DeviceStatusChoices
from dcim.models import (
Cable,
CableTermination,
ConsolePo... | wikimedia/operations-software-netbox-extras | reports/cables.py | .py | 405785809bbbb43f | 7.52 | 10 |
"""Several integrity/coherence checks against the data."""
from dcim.models import Device
from extras.reports import Report
class Rack(Report):
description = "Several integrity/coherence checks against the rack related data."
def test_connected_unracked(self):
"""Determine if unracked boxes still ha... | wikimedia/operations-software-netbox-extras | reports/coherence.py | .py | f92175bb368f7583 | 7.52 | 10 |
"""Report parity errors between LibreNMS and Netbox."""
import configparser
from functools import lru_cache
import pymysql
from django.db.models import Q
from dcim.choices import DeviceStatusChoices
from dcim.models import Device, InventoryItem
from extras.reports import Report
CONFIG_FILE = "/etc/netbox/reports.c... | wikimedia/operations-software-netbox-extras | reports/librenms.py | .py | 884c1e5b14ccffd6 | 7.52 | 10 |
"""Check certain kinds of devices for the presence of a console port."""
from dcim.choices import DeviceStatusChoices
from dcim.models import Device
from extras.reports import Report
# These are the device type slugs we care about.
# Currently we alert on Core Routers and Core/Access Switch
DEVICE_ROLES = ("cr", "asw... | wikimedia/operations-software-netbox-extras | reports/management.py | .py | 972e8637d2ce7521 | 7.52 | 10 |
"""Report on various network related errors."""
import re
from collections import defaultdict
from dcim.choices import DeviceStatusChoices
from dcim.constants import VIRTUAL_IFACE_TYPES
from dcim.models import Device, Interface
from ipam.constants import IPADDRESS_ROLES_NONUNIQUE
from ipam.models import IPAddress
f... | wikimedia/operations-software-netbox-extras | reports/network.py | .py | c02f17d921772cce | 7.52 | 10 |
"""Report parity errors between PuppetDB and Netbox."""
import configparser
from copy import deepcopy
from functools import lru_cache
import requests
from dcim.choices import DeviceStatusChoices
from dcim.models import Device
from extras.reports import Report
from virtualization.models import VirtualMachine
CONFIG_... | wikimedia/operations-software-netbox-extras | reports/puppetdb.py | .py | cf5c5ace7adad7a5 | 7.52 | 10 |
#!/usr/bin/env python3 # pylint: disable=invalid-name
# TODO: rename file
"""Synchronize Ganeti data to Netbox."""
import argparse
import logging
from collections import Counter
from configparser import ConfigParser
from dataclasses import dataclass, field as dataclass_field
from pathlib import Path
from typing import... | wikimedia/operations-software-netbox-extras | tools/ganeti-netbox-sync.py | .py | 94f74e165946ce2d | 7.52 | 10 |
"""Validator class for the Cable model."""
from circuits.models import CircuitTermination
from dcim.choices import LinkStatusChoices
from dcim.models import Cable, Interface
from extras.validators import CustomValidator
CORE_SITES = ("eqiad", "codfw")
class Main(CustomValidator):
"""Main class referenced in the... | wikimedia/operations-software-netbox-extras | validators/dcim/cable.py | .py | c2b6517fad21729c | 7.52 | 10 |
"""Validator class for the Consoleport model."""
from extras.validators import CustomValidator
ALLOWED_NAMES = ("console0", "console-re0", "console-re1")
class Main(CustomValidator):
"""Main class referenced in the Netbox config"""
def validate(self, instance, request) -> None: # noqa: unused-argument
... | wikimedia/operations-software-netbox-extras | validators/dcim/consoleport.py | .py | 9cba45cbb2fdfc44 | 7.52 | 10 |
"""Validator class for the Consoleserverport model."""
import re
from extras.validators import CustomValidator
class Main(CustomValidator):
"""Main class referenced in the Netbox config"""
def validate(self, instance, request) -> None: # noqa: unused-argument
"""Mandatory entry point"""
# ... | wikimedia/operations-software-netbox-extras | validators/dcim/consoleserverport.py | .py | d1278d1e1935ba26 | 7.02 | 10 |
"""Validator class for the Device model."""
import re
import datetime
from dcim.choices import DeviceStatusChoices
from dcim.models import Device
from extras.validators import CustomValidator
from wmflib.constants import DATACENTER_NUMBERING_PREFIX
ROLES_OK_NO_ASSET_TAG = ("patch-panel",)
ROLES_OK_NO_SERIAL = ("cabl... | wikimedia/operations-software-netbox-extras | validators/dcim/device.py | .py | 48dbda859c38ad07 | 7.52 | 10 |
"""Validator class for the Devicetype model."""
import re
from django.utils.text import slugify
from extras.validators import CustomValidator
POWEREDGE_SLUG_RE = re.compile(r"^poweredge-r\d{3}\w{0,3}(-config\w+){0,1}$")
class Main(CustomValidator):
"""Main class referenced in the Netbox config"""
def val... | wikimedia/operations-software-netbox-extras | validators/dcim/devicetype.py | .py | 32e7a2ba14584330 | 7.52 | 10 |
"""Validator class for the Poweroutlet model."""
from extras.validators import CustomValidator
class Main(CustomValidator):
"""Main class referenced in the Netbox config"""
def validate(self, instance, request): # noqa: unused-argument
"""Mandatory entry point"""
# Name
if not str(i... | wikimedia/operations-software-netbox-extras | validators/dcim/poweroutlet.py | .py | 84de0172fed06462 | 7.02 | 10 |
"""Validator class for the Powerport model."""
from extras.validators import CustomValidator
ALLOWED_NAMES = ("PEM 0", "PEM 1", "Power Supply 0", "Power Supply 1", "PSU1", "PSU2")
class Main(CustomValidator):
"""Main class referenced in the Netbox config"""
def validate(self, instance, request) -> None: #... | wikimedia/operations-software-netbox-extras | validators/dcim/powerport.py | .py | 60cb4c7f3fe5b3f5 | 7.52 | 10 |
"""Validator class for the Site model."""
from extras.validators import CustomValidator
class Main(CustomValidator):
"""Main class referenced in the Netbox config"""
def validate(self, instance, request): # noqa: unused-argument
"""Mandatory entry point"""
# Slug
if len(instance.slu... | wikimedia/operations-software-netbox-extras | validators/dcim/site.py | .py | 3b6b4560f79b8d30 | 7.52 | 10 |
from extras.validators import CustomValidator
class Main(CustomValidator):
"""Main class referenced in the Netbox config"""
def validate(self, instance, request) -> None: # noqa: unused-argument
"""Mandatory entry point"""
# Kubernetes prefixes must have the kubernetes role if their parent h... | wikimedia/operations-software-netbox-extras | validators/ipam/prefix.py | .py | fd0a889242083c68 | 7.52 | 10 |
"""Validator class for the IKEPolicy model."""
from extras.validators import CustomValidator
class Main(CustomValidator):
"""Main class referenced in the Netbox config"""
def validate(self, instance, request) -> None: # noqa: unused-argument
"""Mandatory entry point"""
# Ensure we only defi... | wikimedia/operations-software-netbox-extras | validators/vpn/ikepolicy.py | .py | 2647c36bdc6e05f0 | 7.52 | 10 |
"""Validator class for the IKEProposal models"""
from extras.validators import CustomValidator
class Main(CustomValidator):
"""Main class referenced in the Netbox config"""
def validate(self, instance, request) -> None: # noqa: unused-argument
"""Mandatory entry point"""
# Ensure encryption... | wikimedia/operations-software-netbox-extras | validators/vpn/ikeproposal.py | .py | 3e3af8e702fd63e9 | 7.52 | 10 |
"""Validator class for the IPSecPolicy model."""
from extras.validators import CustomValidator
class Main(CustomValidator):
"""Main class referenced in the Netbox config"""
def validate(self, instance, request) -> None: # noqa: unused-argument
"""Mandatory entry point"""
# Ensure we only de... | wikimedia/operations-software-netbox-extras | validators/vpn/ipsecpolicy.py | .py | e52ad222c2f636f0 | 7.52 | 10 |
"""Validator class for the IPSecProposal model."""
from extras.validators import CustomValidator
class Main(CustomValidator):
"""Main class referenced in the Netbox config"""
def validate(self, instance, request) -> None: # noqa: unused-argument
"""Mandatory entry point"""
# Ensure encrypti... | wikimedia/operations-software-netbox-extras | validators/vpn/ipsecproposal.py | .py | 45dda82d74f0fafe | 7.52 | 10 |
# -*- coding: utf-8 -*-
import inspect
import sys
from json import loads, dumps
class FlowLauncher:
"""
Flow.Launcher python plugin base
"""
def __init__(self):
# defalut jsonrpc
self.rpc_request = {'method': 'query', 'parameters': ['']}
self.debugMessage = ""
... | Flow-Launcher/Flow.Launcher.JsonRPC.Python | flowlauncher/FlowLauncher.py | .py | ffab8ba0feec2582 | 7.5 | 9 |
import numpy as np
class DepthFrames:
"""背景差分を抽出するためのフレームを保存するクラス."""
# 測定有効範囲の深度しきい値
THRESHOLD: int = 5000
frames: list
buffer_frames: list
sum_each_pixel: np.ndarray
sum_each_pixel_square: np.ndarray
valid_frame_count: np.ndarray
max_frame_size: int
min_frame_size: int
... | Rits-Interaction-Laboratory/shigure_core | shigure_core/shigure_core/nodes/bg_subtraction/depth_frames.py | .py | e2f03e89359d8d9a | 7.45 | 7 |
from typing import List, Tuple
import numpy as np
class ProjectionMatrix:
"""透視変換行列を表すクラス."""
def __init__(self, projection_matrix: np.ndarray):
self._projection_matrix = projection_matrix
self._projection_matrix_inv = np.linalg.inv(projection_matrix)
def projection_to_view(self, u: flo... | Rits-Interaction-Laboratory/shigure_core | shigure_core/shigure_core/nodes/common_model/projection_matrix.py | .py | 5a5fc95c5b32b5e8 | 7.45 | 7 |
class Timestamp:
"""タイムスタンプを管理するクラス."""
def __init__(self, sec: int, nano_sec: int):
self._sec: int = sec
self._nano_sec: int = nano_sec
def __copy__(self):
return Timestamp(self._sec, self._nano_sec)
def __str__(self):
return f'{self._sec}.{self._nano_sec}'
@prop... | Rits-Interaction-Laboratory/shigure_core | shigure_core/shigure_core/nodes/common_model/timestamp.py | .py | a00c37bd8b2a1228 | 7.45 | 7 |
import datetime
from itertools import chain
import random
import re
import cv2
import message_filters
from typing import List
import numpy as np
import rclpy
import string
from rcl_interfaces.msg import ParameterDescriptor, ParameterType
from rclpy.qos import QoSProfile, ReliabilityPolicy
from sensor_msgs.msg import I... | Rits-Interaction-Laboratory/shigure_core | shigure_core/shigure_core/nodes/node_yolox_object_detection.py | .py | 2ac8213d7532228b | 7.45 | 7 |
from typing import List
from shigure_core.nodes.object_detection.color_image_frame import ColorImageFrame
class ColorImageFrames:
def __init__(self, buffer_size: int = 100):
self._buffer_size = buffer_size
self._buffer: List[ColorImageFrame] = []
def is_full(self) -> bool:
"""
... | Rits-Interaction-Laboratory/shigure_core | shigure_core/shigure_core/nodes/object_detection/color_image_frames.py | .py | 2851257084d3bb02 | 7.45 | 7 |
class JudgeParams:
"""判定に利用するパラメータ."""
def __init__(self, min_size: int, max_size: int, allow_empty_frame_count: int):
self._min_size = min_size
self._max_size = max_size
self._allow_empty_frame_count = allow_empty_frame_count
@property
def min_size(self) -> int:
return... | Rits-Interaction-Laboratory/shigure_core | shigure_core/shigure_core/nodes/object_detection/judge_params.py | .py | 510d12793d717e22 | 7.45 | 7 |
from __future__ import annotations
import argparse
from cp2k_spm_tools.cp2k_overlap_matrix import Cp2kOverlapMatrix
def build_parser() -> argparse.ArgumentParser:
"""Create the command-line parser for overlap-log conversion."""
parser = argparse.ArgumentParser(description="Convert CP2K AO overlap matrix lo... | nanotech-empa/cp2k-spm-tools | cp2k_spm_tools/cli/overlap_to_sparse_npz.py | .py | fe64b58afa8cb3f5 | 7.6 | 15 |
"""
Tools to perform FT-STS analysis on orbitals evaluated on grid
"""
import numpy as np
ang_2_bohr = 1.0 / 0.52917721067
hart_2_ev = 27.21138602
class FTSTS:
"""
Class to perform FT-STS analysis on gridded orbitals
"""
def __init__(self, cp2k_grid_orb):
"""
Convert all lengths fro... | nanotech-empa/cp2k-spm-tools | cp2k_spm_tools/cp2k_ftsts.py | .py | 08355e5fc4c578ef | 7.6 | 15 |
from __future__ import annotations
import re
import warnings
from dataclasses import dataclass
from pathlib import Path
from typing import Dict, List, Optional, Tuple, Union
import numpy as np
import scipy.sparse as sp
ang_2_bohr = 1.0 / 0.52917721067
hart_2_ev = 27.21138602
@dataclass
class Cp2kOverlapMatrix:
... | nanotech-empa/cp2k-spm-tools | cp2k_spm_tools/cp2k_overlap_matrix.py | .py | e44971b8bd2a2332 | 7.6 | 15 |
"""
Routines regarding gaussian cube files
"""
import ase
import numpy as np
ang_2_bohr = 1.0 / 0.52917721067
hart_2_ev = 27.21138602
class Cube:
"""
Gaussian cube
"""
def __init__(
self,
title=None,
comment=None,
ase_atoms=None,
origin=np.array([0.0, 0.0, 0.... | nanotech-empa/cp2k-spm-tools | cp2k_spm_tools/cube.py | .py | 9cd0ff02a5a0b000 | 7.6 | 15 |
"""
Routines regarding gaussian cube files
"""
import numpy as np
ang_2_bohr = 1.0 / 0.52917721067
hart_2_ev = 27.21138602
def find_vacuum_level_naive(hartree_cube):
"""
In case of a slab, for accurate result, the dipole correction should be enabled.
This case, however, is not handled.
Only free mol... | nanotech-empa/cp2k-spm-tools | cp2k_spm_tools/cube_utils.py | .py | 4922f39f22ffd00e | 7.6 | 15 |
import ase
import ase.io
import ase.neighborlist
import ase.visualize
import numpy as np
def convert_neighbor_list(nl):
new = {}
n_vert = np.max(nl) + 1
for i_v in range(n_vert):
new[i_v] = []
for i_v, j_v in zip(nl[0], nl[1]):
new[i_v].append(j_v)
return new
def find_cycles(i... | nanotech-empa/cp2k-spm-tools | cp2k_spm_tools/cycles.py | .py | af4df13c7c7aa2c6 | 7.6 | 15 |
# @author Hillebrand, Fabian
# @date 2019
import numpy as np
from mpi4py import MPI
def read_PPPos(filename):
"""
Loads the positions obtained from the probe particle model and returns
them as a [3,X,Y,Z]-array together with the lVec (which defines the
non-relaxed grid scan in terms of the lowest p... | nanotech-empa/cp2k-spm-tools | cp2k_spm_tools/hrstm_tools/hrstm_utils.py | .py | 6a8decc7b35713a4 | 7.6 | 15 |
"""Classes for use with IGOR Pro
Code is based on asetk module by Leopold Talirz
(https://github.com/ltalirz/asetk/blob/master/asetk/format/igor.py)
-Kristjan Eimre
"""
import re
import numpy as np
def read_wave(lines):
line = lines.pop(0)
while not re.match("WAVES", line):
if len(lines) == 0:
... | nanotech-empa/cp2k-spm-tools | cp2k_spm_tools/igor.py | .py | 779dc36a0b2a9cdd | 7.6 | 15 |
import os
import re
import xml.etree.ElementTree as et
import ase
import ase.io
import numpy as np
from .cube import Cube
ang_2_bohr = 1.0 / 0.529177210903
def ase_atoms_from_pw_out(pw_out_file):
with open(pw_out_file, "r") as f:
contents = f.read()
final_coords_str = re.search("Begin final coordi... | nanotech-empa/cp2k-spm-tools | cp2k_spm_tools/qe_utils.py | .py | eb8803b2cf1743bf | 7.6 | 15 |
# Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Modifications made by Cloudera are:
# Copyright (c) 2016 Cloudera, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A cop... | cloudera/cdpcli | cdpcli/compat.py | .py | 5bc44bbe6cc5d450 | 7.57 | 13 |
# Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Modifications made by Cloudera are:
# Copyright (c) 2020 Cloudera, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
... | cloudera/cdpcli | cdpcli/config.py | .py | a85ad489e66516d1 | 7.57 | 13 |
# Copyright (c) 2012-2013 Mitch Garnaat http://garnaat.org/
# Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Modifications made by Cloudera are:
# Copyright (c) 2016 Cloudera, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may no... | cloudera/cdpcli | cdpcli/configloader.py | .py | 8a879feaa5bd110d | 7.57 | 13 |
# Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Modifications made by Cloudera are:
# Copyright (c) 2016 Cloudera, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A cop... | cloudera/cdpcli | cdpcli/doc/docstringparser.py | .py | 8399b13cd435e982 | 7.57 | 13 |
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file ex... | cloudera/cdpcli | cdpcli/extensions/df/register.py | .py | 9180e677d813dea0 | 7.57 | 13 |
# Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Modifications made by Cloudera are:
# Copyright (c) 2016 Cloudera, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
... | cloudera/cdpcli | cdpcli/extensions/generatecliskeleton.py | .py | 71638897cb322f71 | 7.57 | 13 |
# Copyright 2026 Cloudera, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. ... | cloudera/cdpcli | cdpcli/extensions/outfile.py | .py | cc7e74a30c04d6cc | 7.57 | 13 |
import time
import random
import string
try:
from streammachine.cython import decode_dict_bytes_to_utf8, _has_cython_decode
has_cython = _has_cython_decode
except ImportError:
decode_dict_bytes_to_utf8 = None
has_cython = False
try:
import ujson
has_ujson = True
except ImportError:
has_ujs... | trbck/streammachine | examples/benchmark_decode.py | .py | 18cbd9dc584ef38b | 7.48 | 8 |
"""
Dashboard Demo - High-Throughput Stream Processing with Monitoring
This example demonstrates the StreamMachine dashboard for monitoring
multiple producers and consumers across different processes.
Architecture:
- Producer processes: Send messages at high rate to streams
- Consumer processes: Process messa... | trbck/streammachine | examples/dashboard_demo.py | .py | 5e7752fc25388ccb | 7.48 | 8 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.