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
#!/usr/bin/env python3 # Quantify editing levels of known sites in a BAM file # Based on Query_Editing_Level.GRCh37.20161110.pl from https://github.com/vsoch/mpileup import argparse import os import subprocess import sys def parse_pileup(pileup_line, minbasequal, offset): """Parse a pileup line and return counts...
PejLab/Pantry
phenotyping/scripts/RNA_editing/query_editing_level.py
.py
546f45d62e07277a
7.66
20
# written by Yang Li for the Leafcutter repo # forked by mdshw5 and converted to Python3 # https://github.com/mdshw5/leafcutter/blob/master/scripts/leafcutter_cluster_regtools.py # Edited for use in Pantry by Daniel Munro # requires regtools installation # https://github.com/griffithlab/regtools # /home/yangili1/t...
PejLab/Pantry
phenotyping/scripts/leafcutter_cluster_regtools_py3.py
.py
c005599f8e39d474
7.66
20
"""Normalize phenotypes in a BED file for direct use in QTL mapping""" import argparse import numpy as np import pandas as pd import scipy.stats as stats from sklearn.impute import KNNImputer def impute_knn(X): """Impute missing values using KNN imputation""" imputer = KNNImputer(n_neighbors=10, weights='uni...
PejLab/Pantry
phenotyping/scripts/normalize_phenotypes.py
.py
5db5b49371d745d2
7.66
20
"""Generate the fastq files and map for the test dataset It subsets 16 randomly chosen Geuvadis samples to reads in the first 2 Mb of chr1. Those complete samples must already be aligned to be able to subset by region. """ import gzip from pathlib import Path from subprocess import run def subset_fastq(fastq: Path, ...
PejLab/Pantry
phenotyping/scripts/test_subset_fastq.py
.py
55879341e56012e0
7.16
20
"""Derive plain-text lines from an OpenAPI document for search indexing.""" from __future__ import annotations import json from pathlib import Path from typing import Any import yaml from sphinx.errors import ExtensionError _HTTP_METHODS = frozenset( ("get", "post", "put", "delete", "patch", "head", "options", ...
SAP/swagger-plugin-for-sphinx
swagger_plugin_for_sphinx/_openapi_index.py
.py
7bb2641cd518673f
7.52
10
"""Sphinx Swagger Plugin.""" from __future__ import annotations import json from collections.abc import Iterator from importlib.metadata import version from pathlib import Path from typing import Any from urllib import request import jinja2 from docutils import nodes from docutils.parsers.rst import directives from ...
SAP/swagger-plugin-for-sphinx
swagger_plugin_for_sphinx/_plugin.py
.py
e47aea9eb7048049
7.52
10
""" Contains pulumi.dynamic.ResourceProvider implementations for Google Groups Memberships """ import textwrap import time from functools import cache from typing import TYPE_CHECKING, Optional, TypedDict from urllib.parse import urlencode import google.auth import googleapiclient.discovery import pulumi.dynamic from...
populationgenomics/cpg-infrastructure
cpg_infra/abstraction/google_group_membership.py
.py
0844175e6e8255f4
7.42
6
# flake8: noqa: ANN001,ARG002 """ Contains pulumi.dynamic.ResourceProvider implementations for Google Groups settings. """ from functools import cache import google.auth import googleapiclient.discovery import pulumi import pulumi.dynamic from google.auth.transport.requests import Request class GoogleGroupSettings(...
populationgenomics/cpg-infrastructure
cpg_infra/abstraction/google_group_settings.py
.py
115a1d552f0173e6
7.42
6
# flake8: noqa: ANN001 """ Pulumi provider for interacting with metamist """ import functools from collections import defaultdict from typing import Any import pulumi from metamist.apis import ProjectApi @functools.cache def get_projects() -> dict[str, dict]: """ Get all projects from metamist, useful to a...
populationgenomics/cpg-infrastructure
cpg_infra/abstraction/metamist.py
.py
b526927527b0e675
7.42
6
# flake8: noqa: PGH003,ANN001,DTZ001,ARG001,ANN002, """ Cloud function that runs once a month that synchronises a portion of data from: FROM: billing-admin-290403.billing.gcp_billing_export_v1_01D012_20A6A2_CBD343 TO: billing-admin-290403.billing_aggregate.aggregate Tasks: - Needs to convert {billing_project_i...
populationgenomics/cpg-infrastructure
cpg_infra/billing_aggregator/aggregate/gcp.py
.py
b4a9b5a20e39f0dc
7.42
6
# flake8: noqa: ARG001,ANN001,ANN002,ANN401,ERA001,PGH003,DTZ001,C901 """ A cloud function that synchronises HAIL billing data to BigQuery TO: billing-admin-290403.billing_aggregate.aggregate Notes: - The service.id should be 'hail' Tasks: - Only want to transfer data from the projects in the server-config - N...
populationgenomics/cpg-infrastructure
cpg_infra/billing_aggregator/aggregate/hail.py
.py
bb11bc5da5d4d34f
7.42
6
# flake8: noqa: PGH003,ANN001,DTZ001,ARG001,ANN002,S105,PD901,DTZ007 """ Cloud function that runs once a day that downloads data billing from ICE Tasks performed: 1. Connect to ICA API to get JWT token 2. Download CSV Billing data for selected dates 3. Upsert data into ICA_RAW_TABLE 4. Convert / migrate data into GCP ...
populationgenomics/cpg-infrastructure
cpg_infra/billing_aggregator/aggregate/ica.py
.py
8db1cb1fa5d71384
7.42
6
""" This cloud function runs every hour, 24 hours behind the regular seqr.py Reason for this is Cromwell billing data processed by seqr.py are updated much later (more than 5 hours) after seqr finishes its job of migrating data Reason we need to create a new function and not reused existing is: We only allow one clou...
populationgenomics/cpg-infrastructure
cpg_infra/billing_aggregator/aggregate/seqr24.py
.py
d6943609aa71d4b4
7.42
6
"""A Cloud Function to process GCP billing budget notifications.""" import base64 import binascii import json import logging import os import socket from typing import Any import flask import functions_framework import slack from google.auth.exceptions import RefreshError, TransportError from google.cloud import secr...
populationgenomics/cpg-infrastructure
cpg_infra/billing_aggregator/gcp_cost_control/main.py
.py
3090703a45726b66
7.42
6
"""Helpers for flagging GCP projects with unlinked (disabled) billing. These live alongside the cost-report Cloud Function so they are bundled into its source archive (see billing_aggregator/driver.py::create_source_archive). The sibling `gcp_cost_control` function has its own `is_billing_enabled` implementation (bui...
populationgenomics/cpg-infrastructure
cpg_infra/billing_aggregator/gcp_cost_report_slack_bot/billing_status.py
.py
dda10329d00d5269
7.42
6
# pylint: disable=too-many-locals """A Cloud Function to send a daily GCP cost report to Slack.""" import calendar import json import logging import os from collections import defaultdict from datetime import datetime, timedelta from functools import lru_cache from math import ceil from typing import Any, Generator, T...
populationgenomics/cpg-infrastructure
cpg_infra/billing_aggregator/gcp_cost_report_slack_bot/main.py
.py
bcde764adb4673ac
7.42
6
# flake8: noqa:DTZ005,DTZ006,DTZ007,PLR2004,C901,PLR2004 """A Cloud Function to update the status of genomic samples.""" import asyncio import json import logging import os from base64 import b64decode from datetime import date, datetime, timedelta from functools import cache import functions_framework import google....
populationgenomics/cpg-infrastructure
cpg_infra/billing_aggregator/monthly_aggregate/main.py
.py
4cae9f9c49faa0ab
7.42
6
# flake8: noqa: ANN401,ARG001 """A Cloud Function to collect budget information from projects billing and store it in the bq table. """ import json import logging import os from functools import cache from typing import Any, Sequence import functions_framework import google.cloud.bigquery as bq import google.cloud.bi...
populationgenomics/cpg-infrastructure
cpg_infra/billing_aggregator/update_budget/main.py
.py
057d44906343217a
7.42
6
""" Base model for CPG infra config Contains some sensible defaults: frozen=True ensures that config isn't mutated after creation extra='forbid' ensures that accidentally misnamed config keys aren't accepted """ from typing import Any, Self from pydantic import BaseModel, ConfigDict class ConfigModel(BaseModel):...
populationgenomics/cpg-infrastructure
cpg_infra/config/base.py
.py
9098daf3057f10ac
7.42
6
# flake8: noqa: ANN102,ANN204,ANN206,C901,ANN401,PLR2004,ERA001 """ This module contains all the configuration objects that are used to describe the CPG infrastructure, including what's required from a specific dataset. """ from enum import Enum from typing import Any, Literal import pulumi from pydantic import Field...
populationgenomics/cpg-infrastructure
cpg_infra/config/config.py
.py
754f4e3dcd96f387
7.42
6
# flake8: noqa: PGH003,ANN204,C901,ERA001,ANN401,SIM102 """ Constants and helper functions used across the driver package. """ from __future__ import annotations import re from typing import Iterable import toml import xxhash from toml_sort import TomlSort AccessLevel = str SM_TEST_READ = 'test-read' SM_TEST_WRIT...
populationgenomics/cpg-infrastructure
cpg_infra/driver/constants.py
.py
8a7fc49b7a6c365b
7.42
6
# flake8: noqa: F401,PGH003,ANN204 """ CPGDatasetInfrastructure - infrastructure for a single dataset across one or more cloud providers. """ from __future__ import annotations from functools import cached_property from typing import TYPE_CHECKING # Side-effect imports: bringing each concrete ``CloudInfraBase`` subc...
populationgenomics/cpg-infrastructure
cpg_infra/driver/dataset_infrastructure.py
.py
75219b2a04f7bd27
7.42
6
# flake8: noqa: ANN204 """ Group data structures: GroupMember, Group, and GroupProvider. """ from __future__ import annotations from collections import defaultdict from typing import TYPE_CHECKING import graphlib from cpg_infra.config import CPGInfrastructureUser if TYPE_CHECKING: from cpg_infra.abstraction.ba...
populationgenomics/cpg-infrastructure
cpg_infra/driver/groups.py
.py
8b9d2553cffeb5a7
7.42
6
# flake8: noqa: ERA001, ANN204, ANN102 """ GitHub Workload Identity Federation (WIF) setup for Pulumi This module provides functionality to set up GitHub repositories with GCP Workload Identity Federation for OIDC authentication and Artifact Registry access. It also includes PAM broker service account setup for Privi...
populationgenomics/cpg-infrastructure
cpg_infra/github_wif/driver.py
.py
9909f1ece346ad91
7.42
6
"""Ability to extend CPG infrastructure with plugins""" import importlib.metadata from cpg_infra.config import CPGInfrastructureConfig PLUGIN_ENTRYPOINT_NAME = 'cpginfra.plugins' class CpgInfrastructurePlugin: """Billing aggregator Infrastructure (as code) for Pulumi""" def __init__( self, ...
populationgenomics/cpg-infrastructure
cpg_infra/plugin/__init__.py
.py
9683461f77726f89
7.42
6
#!/usr/bin/env python3 # flake8: noqa: ANN001 """Removes group memberships matching a given regular expression.""" import re import sys from urllib.parse import urlencode import googleapiclient.discovery CUSTOMER_ID = 'C010ys3gt' PAGE_SIZE = 1000 # How many results to fetch per request. def list_all_groups(servic...
populationgenomics/cpg-infrastructure
groups_cleanup/main.py
.py
b5ea9f06f713126b
7.42
6
""" Sometimes during tricky pulumi imports, the state file can get out of order. This script will check for that and re-order the state file if necessary. DANGER: This operates on state directly, you should very carefully check the output and keep backups before overwriting the state file. """ import json im...
populationgenomics/cpg-infrastructure
reorder_state_file.py
.py
73664f0360f37db1
7.42
6
# flake8: noqa: A003,DTZ005 """ If Pulumi suddenly loses a bunch of resources but they still exist in the cloud, this script can be used to generate statements to import them back into state. It operated on the output of: pulumi preview --diff -p 20 --non-interactive --json It will generate a bunch of statements...
populationgenomics/cpg-infrastructure
scripts/repair_state_202306.py
.py
e7d384b9971496ce
7.42
6
#!/usr/bin/env python3 """Computes aggregate bucket disk usage stats.""" import gzip import json import logging import sys from collections import defaultdict import google.api_core.exceptions from cloudpathlib import AnyPath from google.cloud import storage from humanize import naturalsize from cpg_utils.config im...
populationgenomics/cpg-infrastructure
storage_visualization/disk_usage.py
.py
7b6b7be63c242845
7.42
6
#!/usr/bin/env python3 # flake8: noqa: PLR2004,SLF001 """Main entrypoint for the storage visualization driver.""" import sys # See requirements.txt for why we're disabling the linter warnings here. import hailtop.batch as hb # pylint: disable=import-error from cpg_utils.config import output_path from cpg_utils.git ...
populationgenomics/cpg-infrastructure
storage_visualization/main.py
.py
b523962f51e0cf5e
7.42
6
"""Asynchronous Python client for NET2GRID devices.""" from __future__ import annotations import asyncio import json import socket from dataclasses import dataclass from importlib import metadata from typing import Any, Self from aiohttp import ClientError, ClientSession from aiohttp.hdrs import METH_GET from yarl i...
klaasnicolaas/python-gridnet
src/gridnet/gridnet.py
.py
cc271db15db7f097
7.48
8
"""Models for GridNet.""" from __future__ import annotations from dataclasses import dataclass from typing import Any @dataclass class SmartBridge: """Object representing an SmartBridge response from the device.""" power_flow: int energy_consumption_total: float energy_production_total: float ...
klaasnicolaas/python-gridnet
src/gridnet/models.py
.py
ea1f1243c30983f9
7.48
8
# ruff: noqa: S101 from keywin import KeyCode from keywin.keyboard import hold, hold_unicode, press, release, release_unicode, send_events, write from keywin.keyboard.helpers import KeyboardEvent def test_keyboard_event() -> None: """ Summary ------- test the `KeyboardEvent` NamedTuple """ as...
winstxnhdw/KeyWin
tests/test_keyboard.py
.py
fc4cb963dfeb4767
7.12
16
# ruff: noqa: S101 from keywin.mouse import ( left_click, left_press, left_release, middle_click, middle_press, middle_release, move, move_relative, right_click, right_press, right_release, scroll, scroll_horizontal, send_events, xbutton1_click, xbutton1_...
winstxnhdw/KeyWin
tests/test_mouse.py
.py
930c9c5ad05e44a8
8.12
16
#!/usr/bin/env python3 """ add_conditions_structure.py — Parse DC saving throws and conditions from action/ability descriptions and add structured fields to special_abilities, actions, and legendary_actions. Usage: python3 scripts/add_conditions_structure.py json/en-us/monsters.json --lang en-us python3 script...
alexandregpereira/Monster-Compendium-Content
scripts/add_conditions_structure.py
.py
c89fac83cb55f04a
7.48
8
"""MongoDB connection and collection setup.""" import os import sys DEFAULT_URI = "mongodb://root:devpassword@localhost:27017/compendium?authSource=admin" DEFAULT_DB = "compendium" def _load_dotenv(): path = os.path.join(os.path.dirname(__file__), "..", "..", ".env") path = os.path.abspath(path) if not ...
alexandregpereira/Monster-Compendium-Content
scripts/mongo/db.py
.py
70b26fffb940aa44
7.48
8
"""MongoDB $jsonSchema validators. The enums are taken from the corpus itself rather than from CLAUDE.md, because the two disagree in places. Anything the corpus actually contains must pass -- a validator that rejects existing content would block the editor from saving a document it had just loaded. """ MONSTER_TYPES...
alexandregpereira/Monster-Compendium-Content
scripts/mongo/schemas.py
.py
2d4376e7ef6bc33d
7.48
8
#!/usr/bin/env python3 """ translate_conditions.py — Full pipeline: Google Translate a conditions file, then optionally review with Claude. This script orchestrates the two standalone scripts: - google_translate_conditions.py (translation step) - claude_review_conditions.py (review and fix step) Both can als...
alexandregpereira/Monster-Compendium-Content
scripts/translate_conditions.py
.py
ec62db930c9a7bf6
7.48
8
#!/usr/bin/env python3 """ translate_lore.py — Full pipeline: Google Translate a lore file, then optionally review with Claude. This script orchestrates the two standalone scripts: - google_translate_lore.py (translation step) - claude_review_lore.py (review and fix step) Both can also be run independently w...
alexandregpereira/Monster-Compendium-Content
scripts/translate_lore.py
.py
583e1822be54d462
7.48
8
#!/usr/bin/env python3 """ translate_monster.py — Full pipeline: Google Translate a monsters file, then optionally review with Claude. This script orchestrates the two standalone scripts: - google_translate_monsters.py (translation step) - claude_review_monsters.py (review and fix step) Both can also be run ...
alexandregpereira/Monster-Compendium-Content
scripts/translate_monster.py
.py
86d9555ecbdd6f13
7.48
8
#!/usr/bin/env python3 """ translate_spells.py — Full pipeline: Google Translate a spells file, then optionally review with Claude. This script orchestrates the two standalone scripts: - google_translate_spells.py (translation step) - claude_review_spells.py (review and fix step) Both can also be run indepen...
alexandregpereira/Monster-Compendium-Content
scripts/translate_spells.py
.py
c5203c6993636dfa
7.48
8
"""Download files from Tor websites. Used to download data from ransomware leak sites. Uses streamed file downloads and restarts if a file is not fully downloaded. Gets the list of URLs to download either from a JSON file or from another URL (work in progress). Configuration options can be given in either a JSON file...
Ian-Costa18/TorDownloader
tor_downloader/__main__.py
.py
033ca7f0ffd8994a
7.5
9
"""Shared coercion helpers for configuration and runtime limits.""" from __future__ import annotations from typing import Any, Iterable def coerce_cli_value(raw_value: str) -> Any: """Coerce CLI scalar values using existing project semantics.""" if raw_value.isnumeric(): return int(raw_value) l...
Ian-Costa18/TorDownloader
tor_downloader/utils/config_utils.py
.py
b94295fb4eeb0577
7.5
9
"""Utilities for run-scoped log file management. This module handles: 1) per-run timestamped log file naming, 2) compression of prior plain-text logs, 3) retention cleanup of compressed archives. """ from __future__ import annotations import gzip import shutil from datetime import datetime from pathlib import Path ...
Ian-Costa18/TorDownloader
tor_downloader/utils/log_management.py
.py
5cccb67a6a1a14b0
7.5
9
"""Logging handler and formatter to use with TQDM. Add the logging handler to a logger to write logged data to TQDM output. Add the formatter to format the logs to: "(%(asctime)s) [+/-/?/*/***] %(message)s" """ import logging import tqdm from colorama import Back, Fore, Style, init class TqdmLoggingHandler(logging...
Ian-Costa18/TorDownloader
tor_downloader/utils/logging_handlers.py
.py
01d883223e531369
7.5
9
"""Output path policy for hostless relative layout.""" from __future__ import annotations from pathlib import Path, PurePosixPath from typing import Iterable from urllib.parse import unquote, urlparse def _sanitize_part(part: str) -> str: """Sanitize one path segment while keeping it readable.""" if part in...
Ian-Costa18/TorDownloader
tor_downloader/utils/output_layout.py
.py
263a662ec78fb304
7.5
9
"""Shared URL normalization helpers for HTTP requests.""" from __future__ import annotations from urllib.parse import quote, unquote, urlsplit, urlunsplit def ensure_trailing_slash(url: str) -> str: """Return URL with one trailing slash when non-empty.""" if url == "": return "" return url if ur...
Ian-Costa18/TorDownloader
tor_downloader/utils/url_utils.py
.py
ae1653f82ba5a8af
7.5
9
import argparse import os import exiftool import pathlib def extract_metadata(image_path): """ Extract image metadata using exiftool binary and exiftool wrapper pyexiftool Args: image_path (Path): Path to image Returns: str: metadata """ # TODO: add linux option and move to pa...
mediocreatmybest/gaslightingeveryone
Scripts/working/exif2txt.py
.py
0cf792bcb812c95f
7.52
10
import os from func import walk_path_plus def create_captions(file_path, ext="txt", force=False, debug=False, encoding="utf-8"): """ Create captions with each file, we are ignore filtering, this can be done in the main() """ base_name, _ = os.path.splitext(os.path.basename(file_path)) caption_file_path = o...
mediocreatmybest/gaslightingeveryone
Scripts/working/filename_test.py
.py
5ad6896ac76a1137
7.02
10
import codecs import os # Function to extract nested json data, # https://hackersandslackers.com/extract-data-from-complex-json-python/ def json_extract(obj, key): """ Recursively fetch values from nested JSON """ arr = [] def extract(obj, arr, key): """ Recursively search for values of key in J...
mediocreatmybest/gaslightingeveryone
Scripts/working/func.py
.py
37278ce476fe01c1
7.52
10
import os def os_walk_plus(path, max_depth=None, file_filter=None): """ Recursively go walk about in a directory tree up to a specified maximum depth and optionally filter files by extension. Args: path (str): The root directory to start walking. max_depth (int): The maximum depth of directo...
mediocreatmybest/gaslightingeveryone
Scripts/working/func_os_walk_plus.py
.py
ec627cb582567d9b
7.52
10
import mimetypes import os def sanitise_char(char_string, debug=False): """Removes unwanted characters and extensions from a string, useful for filenames""" # Add additional characters if needed invalid_chars = r'\\/:*?"\'<>|' new_char_string = ''.join(c for c in char_string if c not in invalid_chars...
mediocreatmybest/gaslightingeveryone
Scripts/working/sanitise_func.py
.py
7c34954f32d7407a
7.52
10
# MIT License # # Copyright (c) 2021 Matthew Schweiss # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, me...
mediocreatmybest/gaslightingeveryone
Scripts/working/walkywalk_func.py
.py
da227da567ea4b88
7.52
10
import codecs import os # Function to extract nested json data, # https://hackersandslackers.com/extract-data-from-complex-json-python/ def json_extract(obj, key): """ Recursively fetch values from nested JSON """ arr = [] def extract(obj, arr, key): """ Recursively search for values of key in J...
mediocreatmybest/gaslightingeveryone
tools/func.py
.py
a91d422a4235df4a
7.52
10
import re def strictfilter(textstring, string2remove): """ Simple Regex filter that does not ignore character case""" return re.sub(rf'{string2remove}', '', textstring) def softfilter(textstring, string2remove): """ Simple regex filter that ignores character case """ return re.sub(rf'{string2remove}',...
mediocreatmybest/gaslightingeveryone
tools/func_filter.py
.py
e86bddadf9235222
7.52
10
import os import re def sanitise_char(char_string, debug=False, strict_mode=False): """ Removes unwanted characters and extensions from a string useful for moving files from Linux to Windows and back """ # Split the filename and extension filename, extension = os.path.splitext(char_string) ...
mediocreatmybest/gaslightingeveryone
tools/func_sanitise.py
.py
4d5678dc6ea8e32b
7.52
10
import argparse import hashlib import os from pathlib import Path import pandas as pd import pyarrow as pa import pyarrow.parquet as pq from PIL import Image def create_data_row(filename, image_path, caption_path=None, caption1_path=None, caption2_path=None, url_path=None, tags_path=None): """ Creates a data row...
mediocreatmybest/gaslightingeveryone
tools/images2parq.py
.py
8776bace430d4341
7.52
10
import argparse import json import os import sys from pathlib import Path from tqdm import tqdm def json_extract(obj, key): """ Recursively fetch values from nested JSON: See: https://hackersandslackers.com/extract-data-from-complex-json-python/ """ arr = [] def extract(obj, arr, key): ...
mediocreatmybest/gaslightingeveryone
tools/json2export2url_tags.py
.py
a3563714ea57cedc
7.52
10
import argparse import os from pathlib import Path import pandas as pd # Magic save function def save_file(file_path, data, mode='w', encoding='utf-8', debug=False): """ Function to save a file, defaults to write mode, if wb is passed it will save in binary mode without encoding.""" if not debug: ...
mediocreatmybest/gaslightingeveryone
tools/parq2folder.py
.py
2ca04d0484d3b0e7
7.52
10
from ovos_plugin_manager.utils import PluginConfigTypes, PluginTypes from ovos_utils.log import LOG from ovos_bus_client.util import get_mycroft_bus from ovos_config import Configuration # TODO - restore this log in next release with updated version string #log_deprecation("ovos_plugin_manager.audio has been deprecat...
OpenVoiceOS/ovos-plugin-manager
ovos_plugin_manager/audio.py
.py
e5517544ad592c8c
7.59
14
from typing import Optional from ovos_plugin_manager.utils import PluginTypes, PluginConfigTypes from ovos_plugin_manager.templates.audio2ipa import Audio2IPA from ovos_utils.log import LOG def find_audio2ipa_plugins() -> dict: """ Find all installed plugins @return: dict plugin names to entrypoints "...
OpenVoiceOS/ovos-plugin-manager
ovos_plugin_manager/audio2ipa.py
.py
6ed15b9888c1d6a0
7.59
14
from ovos_plugin_manager.templates.transformers import AudioTransformer, AudioLanguageDetector from ovos_plugin_manager.utils import PluginTypes, PluginConfigTypes def find_audio_transformer_plugins() -> dict: """ Find all installed plugins @return: dict plugin names to entrypoints """ from ovos_p...
OpenVoiceOS/ovos-plugin-manager
ovos_plugin_manager/audio_transformers.py
.py
31bbfd6606e384d3
7.59
14
from ovos_plugin_manager.templates.transformers import DialogTransformer from ovos_plugin_manager.utils import PluginTypes from ovos_plugin_manager.utils import load_plugin, find_plugins # TTS transformer helpers live in ovos_plugin_manager.tts_transformers, # re-exported here for backwards compatibility from ovos_plug...
OpenVoiceOS/ovos-plugin-manager
ovos_plugin_manager/dialog_transformers.py
.py
93db1e09ee56a1d4
7.59
14
from typing import List, Optional from ovos_plugin_manager.utils import PluginTypes, PluginConfigTypes from ovos_plugin_manager.templates.gui import GUIExtension from ovos_utils.log import LOG def find_gui_plugins() -> dict: """ Find all installed plugins @return: dict plugin names to entrypoints """...
OpenVoiceOS/ovos-plugin-manager
ovos_plugin_manager/gui.py
.py
8e97d325374ad439
7.59
14
""" DEPRECATED: Use ovos_hardware_helpers.led instead. This module maintains backwards compatibility with the old Color enum while re-exporting AbstractLed from ovos-hardware-helpers. New code should use ovos_hardware_helpers.led and ovos_color_parser.models.sRGBAColor. """ from enum import Enum from typing import Uni...
OpenVoiceOS/ovos-plugin-manager
ovos_plugin_manager/hardware/led/__init__.py
.py
94f8f0cd90b98441
7.59
14
import os import sys from os.path import exists, dirname from subprocess import PIPE, Popen from typing import Iterator, List, Optional, Tuple, Union import requests from combo_lock import NamedLock from ovos_utils.log import LOG, log_deprecation, deprecated from ovos_plugin_manager.exceptions import PipException fro...
OpenVoiceOS/ovos-plugin-manager
ovos_plugin_manager/installation.py
.py
b3f6f6c386887082
7.59
14
"""Discovery + loading for ``opm.media.provider`` plugins. MediaProvider plugins are the catalog/search layer the OCP pipeline queries in-process, replacing OCP search skills. See :mod:`ovos_plugin_manager.templates.media_provider`. """ from typing import Dict, List, Optional from ovos_utils.log import LOG from ovos...
OpenVoiceOS/ovos-plugin-manager
ovos_plugin_manager/media_provider.py
.py
743f0b3a2119befa
7.59
14
from ovos_config import Configuration from ovos_utils.log import LOG, deprecated import warnings from ovos_plugin_manager.templates.microphone import Microphone from ovos_plugin_manager.utils import PluginTypes def find_microphone_plugins() -> dict: """ Find all installed plugins @return: dict plugin name...
OpenVoiceOS/ovos-plugin-manager
ovos_plugin_manager/microphone.py
.py
3f65c338ab83f01a
7.59
14
from ovos_plugin_manager.utils import PluginTypes from ovos_plugin_manager.templates.ocp import OCPStreamExtractor from ovos_utils.log import LOG from functools import lru_cache from ovos_plugin_manager.utils import find_plugins try: from ovos_plugin_manager.templates.media import AudioPlayerBackend, VideoPlayerB...
OpenVoiceOS/ovos-plugin-manager
ovos_plugin_manager/ocp.py
.py
2a81c7ace529fa81
7.59
14
from typing import Type, Dict, Any from ovos_plugin_manager.templates.agent_tools import ToolBox from ovos_plugin_manager.utils import PluginTypes def find_persona_plugins() -> Dict[str, Dict[str, Any]]: """ Find all installed persona definitions @return: dict plugin names to entrypoints (persona entrypo...
OpenVoiceOS/ovos-plugin-manager
ovos_plugin_manager/persona.py
.py
f49850716faff685
7.59
14
from typing import Any, List, Optional, Union, Dict, Type from ovos_bus_client.client import MessageBusClient from ovos_config import Configuration from ovos_utils.fakebus import FakeBus from ovos_plugin_manager.templates.pipeline import ConfidenceMatcherPipeline, PipelinePlugin from ovos_plugin_manager.utils import ...
OpenVoiceOS/ovos-plugin-manager
ovos_plugin_manager/pipeline.py
.py
dccc8fb7c15c2d1d
7.59
14
from typing import Optional, Type from ovos_plugin_manager.tts import find_tts_plugins from ovos_plugin_manager.stt import find_stt_plugins from ovos_plugin_manager.wakewords import find_wake_word_plugins from ovos_plugin_manager.audio import find_audio_service_plugins from ovos_plugin_manager.utils import load_plugin...
OpenVoiceOS/ovos-plugin-manager
ovos_plugin_manager/plugin_entry.py
.py
09e92978a7141f3a
7.59
14
"""Copy a character to the test database.""" import os from argparse import ArgumentParser from typing import Any from bson import ObjectId from pymongo import MongoClient type Character = dict[str, Any] TEST_GUILD = 826628660450689074 TEST_USER = 229736753676681230 def fetch_char(char_id: ObjectId) -> Character:...
tiltowait/inconnu
scripts/copy-char.py
.py
8ee3074f29ca4cef
7.66
20
"""Export all characters from a guild.""" import json import os import sys from argparse import ArgumentParser, ArgumentTypeError from pathlib import Path from typing import NamedTuple, Self from pymongo import MongoClient MONGO_ENV = "INCONNU_MONGO" # Change if necessary MONGO_URL = os.getenv(MONGO_ENV) class Ar...
tiltowait/inconnu
scripts/guild-export.py
.py
e7f6b37fa3c23386
7.66
20
"""The Inconnu API endpoints.""" import functools import re from datetime import datetime from json import dumps from urllib.parse import urljoin, urlparse import aiohttp import async_timeout from loguru import logger from config import settings from models import VChar # An argument can be made that these should s...
tiltowait/inconnu
src/api.py
.py
f9e72221453033a8
7.66
20
"""Pydantic-settings configuration; validated and loaded from .env or INCONNU_CONFIG_FILE at startup.""" import os from pydantic import AnyHttpUrl, field_validator from pydantic_settings import BaseSettings, SettingsConfigDict CONFIG_FILE = os.getenv("INCONNU_CONFIG_FILE", ".env") class Settings(BaseSettings): ...
tiltowait/inconnu
src/config.py
.py
ec48959db0284ed0
7.66
20
"""AppCtx definitions.""" from typing import TYPE_CHECKING import discord if TYPE_CHECKING: from discord.interactions import InteractionChannel from bot import InconnuBot Channel = InteractionChannel | None else: Channel = ( discord.abc.GuildChannel | discord.abc.PrivateChannel ...
tiltowait/inconnu
src/ctx.py
.py
56111038987f2c4e
7.66
20
"""Shared database instance and collections.""" from typing import Any from beanie import Document, init_beanie from loguru import logger from pymongo import AsyncMongoClient from config import settings from models import RPPost, VChar, VGuild, VUser _client = AsyncMongoClient(settings.mongo_url, serverSelectionTim...
tiltowait/inconnu
src/db.py
.py
4f1317a0d122fc4f
7.66
20
"""character/bio.py - Create/edit/view character bios.""" import discord from discord.ext import pages from loguru import logger import errors import ui from services.haven import haven from utils.text import clean_text __HELP_URL = "https://docs.inconnu.app/command-reference/characters/profiles#profile" @haven(__...
tiltowait/inconnu
src/inconnu/character/bio.py
.py
1c147366a54c0589
7.66
20
"""delete.py - Character deletion facilities.""" import asyncio from typing import cast import discord from discord.ui import InputText, Modal from loguru import logger import api import errors import services import ui from ctx import AppCtx __HELP_URL = "https://docs.inconnu.app/command-reference/characters/delet...
tiltowait/inconnu
src/inconnu/character/delete.py
.py
59bbfa23c24737a5
7.66
20
"""character/display/display.py - Tools for displaying characters.""" from enum import StrEnum from typing import Any import discord import services import ui from constants import Damage from ctx import AppCtx from inconnu.character.display import trackmoji from models import VChar from services.haven import haven ...
tiltowait/inconnu
src/inconnu/character/display/display.py
.py
f1a432cf2718cb2c
7.66
20
"""character/display/trackmoji.py - A tool for converting a stress track to emoji.""" import services def emojify_track(track: str) -> str: """Convert a stress track into an emoji string.""" emoji_track = [] for box in track: emoji_track.append(__emojify_stressbox(box)) gaps = int((len(emoji...
tiltowait/inconnu
src/inconnu/character/display/trackmoji.py
.py
4e391e8a7bd4bc4a
7.66
20
"""Full-size character image display.""" import discord from loguru import logger import api import db import errors import ui from ctx import AppCtx from models import VChar from services.haven import haven from ui.views import ReportingView __HELP_URL = "https://docs.inconnu.app/guides/premium/character-images" ...
tiltowait/inconnu
src/inconnu/character/images/display.py
.py
b390b2ae9b6bb64d
7.66
20
"""Character image uploading.""" from urllib.parse import urlparse import discord from loguru import logger import api import db import ui from ctx import AppCtx from models import VChar from services.haven import haven __HELP_URL = "https://docs.inconnu.app/guides/premium/character-images" VALID_EXTENSIONS = [".pn...
tiltowait/inconnu
src/inconnu/character/images/upload.py
.py
648af117bbc0eb8d
7.66
20
"""character/update/paramupdate.py - Functions for updating a character's non-trait parameters.""" from typing import cast import inconnu import services from constants import Damage from models import VChar from models.vchar import Tracker VALID_SPLATS = ["vampire", "ghoul", "mortal", "thinblood"] async def updat...
tiltowait/inconnu
src/inconnu/character/update/paramupdate.py
.py
ceec3a3af5ad3048
7.66
20
"""character/update/parse.py - Defines an interface for updating character traits.""" import asyncio from collections import OrderedDict import discord from discord.ui import Button import constants import inconnu import services import ui from ctx import AppCtx from inconnu.character.display import DisplayField, di...
tiltowait/inconnu
src/inconnu/character/update/parse.py
.py
518b5f044015b59c
7.66
20
"""experience/award_deduct.py - Award or deduct XP from a character.""" import asyncio import discord import ui from ctx import AppCtx from models import VChar from services.haven import haven from utils import get_avatar __HELP_URL = "https://docs.inconnu.app/advanced/administration/experience-management" @haven...
tiltowait/inconnu
src/inconnu/experience/award_deduct.py
.py
fccc607e0e12b10c
7.66
20
"""experience/bulk.py - Bulk award XP.""" import asyncio import re import discord from discord.ext.commands import Paginator from discord.ui import InputText, Modal import errors import services import ui async def bulk_award_xp(ctx): """Present a modal for bulk-awarding XP.""" modal = _BulkModal(title="Bu...
tiltowait/inconnu
src/inconnu/experience/bulk.py
.py
527f65a2c844f1df
7.66
20
"""experience/remove.py - Remove an XP log entry.""" from typing import cast import discord import inconnu import ui from ctx import AppCtx from models import VChar from models.vchardocs import VCharExperienceEntry from services.haven import haven from ui.views import DisablingView from utils import get_avatar from ...
tiltowait/inconnu
src/inconnu/experience/remove.py
.py
fe9b371da44c08dc
7.66
20
"""Header imports.""" from inconnu.header import posted from inconnu.header.show import header_embed as embed from inconnu.header.show import register_header as register from inconnu.header.show import show_header from inconnu.header.update import update_header from models import VChar __all__ = ( "blush_text", ...
tiltowait/inconnu
src/inconnu/header/__init__.py
.py
a406e62047203297
7.66
20
"""Edit location and temporary effects on a posted RP header.""" from typing import TYPE_CHECKING import discord from loguru import logger import db from ctx import AppCtx, Channel if TYPE_CHECKING: from bot import InconnuBot async def edit_location(ctx: AppCtx, message: discord.Message): """Validate owne...
tiltowait/inconnu
src/inconnu/header/posted/location.py
.py
4c0a788521ec5ec7
7.66
20
"""header/display.py - RP header display facilities.""" import discord from loguru import logger import db import errors import ui from ctx import AppCtx from models import VChar from models.rpheader import HeaderSubdoc from services.haven import haven from utils import get_avatar from utils.permissions import is_sup...
tiltowait/inconnu
src/inconnu/header/show.py
.py
b6aac11803b9b1da
7.66
20
"""inconnu/headers/update.py - Update RP headers.""" import asyncio import discord from loguru import logger import inconnu from ctx import AppCtx from models import VChar from services.haven import haven from utils.text import clean_text __HELP_URL = "https://docs.inconnu.app/command-reference/characters/rp-header...
tiltowait/inconnu
src/inconnu/header/update.py
.py
2640814af65ecd8f
7.66
20
"""macros/roll.py - Rolling character macros.""" import re from uuid import uuid4 import discord from discord.ui import Button, View from loguru import logger import errors import inconnu import ui from ctx import AppCtx from inconnu.macros import macro_common from inconnu.misc import rouse from inconnu.vr import di...
tiltowait/inconnu
src/inconnu/macros/roll.py
.py
95b238b806323c5b
7.66
20
"""macros/show.py - Displaying character macros.""" from types import SimpleNamespace import discord from discord.ext import pages import errors import ui from ctx import AppCtx from models import VChar from services.haven import haven from utils import get_avatar from utils.text import paginate __HELP_URL = "https...
tiltowait/inconnu
src/inconnu/macros/show.py
.py
326538bd76cd7d37
7.66
20
"""macros/update.py - Macro update commands.""" import errors import inconnu import ui from ctx import AppCtx from inconnu.macros import macro_common from models import VChar from services.haven import haven from utils import parse_parameters from utils.text import strtobool __HELP_URL = "https://docs.inconnu.app/com...
tiltowait/inconnu
src/inconnu/macros/update.py
.py
8c8880ff999f8857
7.66
20
"""misc/aggheal.py - Heal aggravated damage.""" from types import SimpleNamespace import errors import inconnu import services from constants import ROUSE_FAIL_COLOR, Damage from models import VChar from services.haven import haven from utils import get_message __HELP_URL = "https://docs.inconnu.app/guides/gameplay-...
tiltowait/inconnu
src/inconnu/misc/aggheal.py
.py
877ed38966d0a6fe
7.66
20
from django import forms from django.db.models import Q from subekashi.models import AuthorAlias CONTACT_CATEGORY_CHOICES = [ ("不具合の報告", "不具合の報告"), ("提案", "提案"), ("質問", "質問"), ("その他", "その他"), ] class ContactForm(forms.Form): category = forms.ChoiceField( choices=CONTACT_CATEGORY_CHOICES,...
izumin2000/subekashi
subekashi/forms.py
.py
f33084e63bbb7813
7.65
19
from config.settings import ROOT_URL def build_new_alias_discord_text(author, alias, editor): """別名新規追加用のDiscordテキストを構築する""" return ( f"別名が追加されました\n" f"{ROOT_URL}/authors/{author.id}/aliases\n\n" f"**作者**:`{author.name}`\n" f"**別名**:`{alias.name}`\n" f"**種別**:`{alias.ge...
izumin2000/subekashi
subekashi/lib/author_alias_service.py
.py
16cb15636c618e1c
7.65
19
""" Author関連のヘルパー関数 """ from subekashi.models import Author, AuthorAlias def _non_empty_names(author_names): return [name for name in author_names if name] # 空文字列をスキップ def get_or_create_authors(author_names): """ 作者名のリストからAuthorオブジェクトのリストを返す 入力がalias_type="past"(以前の名称)のAuthorAlias.nameと完全一致する場合は、 ...
izumin2000/subekashi
subekashi/lib/author_helpers.py
.py
d89543f6a81c707f
7.65
19