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
import abc from typing import Any, Callable, List from src.config import ModelConfig, VadInitialPromptMode from src.hooks.progressListener import ProgressListener from src.modelCache import GLOBAL_MODEL_CACHE, ModelCache from src.prompts.abstractPromptStrategy import AbstractPromptStrategy class AbstractWhisperCallb...
MeherwerAli/whisper-webui
src/whisper/abstractWhisperContainer.py
.py
26c1c53dc52ef5c0
7
0
from typing import List import ffmpeg from src.config import ModelConfig from src.hooks.progressListener import ProgressListener from src.modelCache import ModelCache from src.prompts.abstractPromptStrategy import AbstractPromptStrategy from src.whisper.abstractWhisperContainer import AbstractWhisperCallback, Abstract...
MeherwerAli/whisper-webui
src/whisper/dummyWhisperContainer.py
.py
61e8098c18fe9f68
7
0
# External programs import abc import os import sys from typing import List from urllib.parse import urlparse import torch import urllib3 from src.hooks.progressListener import ProgressListener import whisper from whisper import Whisper from src.config import ModelConfig, VadInitialPromptMode from src.hooks.whisperPr...
MeherwerAli/whisper-webui
src/whisper/whisperContainer.py
.py
5072cba27aca0439
7
0
import numpy as np import pandas as pd from scipy.stats import gompertz from sklearn.datasets import make_blobs def _build_shapes(dim): """ Build the cause/censoring/scale shape functions for a given dim. dim must be even (it is split into two equal halves) and >= 2. """ if dim < 2 or dim % 2 != 0...
Jeanselme/CompetingRiskFairness
examples/generate.py
.py
76dcedf4dc532b9d
7
0
#!/usr/bin/env python3 # coding=utf-8 # # Copyright (c) 2022 Huawei Device Co., Ltd. # 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 # # Unle...
openharmony/testfwk_xdevice
plugins/devicetest/controllers/tools/screen_agent.py
.py
7877bfb50c3f3fb5
7.5
0
#!/usr/bin/env python3 # coding=utf-8 # # Copyright (c) 2022 Huawei Device Co., Ltd. # 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 # # Unle...
openharmony/testfwk_xdevice
plugins/devicetest/report/generation.py
.py
32351a7545bb70b5
7.5
0
#!/usr/bin/env python3 # coding=utf-8 # # Copyright (c) 2020-2022 Huawei Device Co., Ltd. # 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 # #...
openharmony/testfwk_xdevice
plugins/ohos/src/ohos/constants.py
.py
3a96642ef5d90942
7
0
"""Progress-bar buffering for downloads. `snaffle.http_client` delegates a single decision here: whether the client should ask for an unread body and drain it itself, so that a progress bar can be fed as the bytes arrive. Everything that decision entails lives in this module -- the size threshold, the deferred `tqdm` ...
maltemindedal/snaffle
src/snaffle/_download.py
.py
c77336b11d97ef76
7
0
"""Command-line interface for making HTTP requests. This module provides a command-line interface (CLI) for making HTTP requests using the snaffle HTTP client. It supports common HTTP methods, custom headers, JSON data, and other features. The HTTP client (and with it ``requests``) is imported lazily so that ``--help...
maltemindedal/snaffle
src/snaffle/cli.py
.py
6f3e6dee2e756df6
7
0
"""HTTP client for making HTTP requests with retries. This module provides a flexible HTTP client for making RESTful API calls, with support for customizable timeouts, automatic retries on failures, and optional progress bars for large downloads. The client keeps a pooled :class:`requests.Session` alive for its lifet...
maltemindedal/snaffle
src/snaffle/http_client.py
.py
ef6e4dabeed125c8
7
0
"""Test cases for the CLI module.""" from __future__ import annotations import io import subprocess import sys import unittest from types import SimpleNamespace from unittest.mock import MagicMock, patch from snaffle.cli import EXAMPLES, main from snaffle.exceptions import HTTPClientError MAKE_REQUEST = "snaffle.ht...
maltemindedal/snaffle
tests/test_cli.py
.py
9d5a2175573c040e
7.5
0
"""Test cases for the progress-bar download buffering.""" from __future__ import annotations import io import unittest from typing import Any, cast from unittest.mock import MagicMock, call, patch import requests from snaffle._download import buffer_into, should_buffer MIB = 1024 * 1024 def _unread_response(cont...
maltemindedal/snaffle
tests/test_download.py
.py
d1ccf5c883f4cccf
7.5
0
"""Test cases for the exceptions module.""" from __future__ import annotations import unittest from snaffle.exceptions import HTTPClientError class TestHTTPClientError(unittest.TestCase): """Test cases for the HTTPClientError exception.""" def test_http_client_error_message(self) -> None: """Test ...
maltemindedal/snaffle
tests/test_exceptions.py
.py
d402cf92891672a2
7.5
0
"""Test cases for the package's public surface and lazy attribute resolution.""" from __future__ import annotations import subprocess import sys import unittest from importlib.metadata import version import snaffle class TestPublicAPI(unittest.TestCase): """Test cases for what `import snaffle` exposes.""" ...
maltemindedal/snaffle
tests/test_init.py
.py
5b163f329e6842b3
7.5
0
"""Test cases for the package entry point.""" from __future__ import annotations import io import unittest from unittest.mock import MagicMock, patch from snaffle.__main__ import run CLI_MAIN = "snaffle.__main__.main" class TestRun(unittest.TestCase): """Test cases for `run`, the console script and `python -m...
maltemindedal/snaffle
tests/test_main.py
.py
b9c49ced50835594
7.5
0
from django.apps import AppConfig from shopify_webhook.signals import webhook_received from shopify_sync.handlers import webhook_received_handler class ShopifySyncConfig(AppConfig): """ Application configuration for the Shopify Sync application. """ name = "shopify_sync" verbose_name = "Shopify ...
thelabnyc/django-shopify-sync
shopify_sync/apps.py
.py
a8a6efb9dce3450d
7.15
1
from django.core.serializers.json import DjangoJSONEncoder import shopify def empty_list(): return [] class ShopifyDjangoJSONEncoder(DjangoJSONEncoder): """As per: https://docs.djangoproject.com/en/1.6/topics/serialization/, this is a special encoder that handles lazily evaluated strings.""" def de...
thelabnyc/django-shopify-sync
shopify_sync/encoders.py
.py
1f09d652aeacc102
7.15
1
import logging log = logging.getLogger(__name__) def get_topic_model(topic, data): from .models import ( CustomCollection, Customer, Metafield, Order, Product, Shop, SmartCollection, ) """ Return the model related to the given topic, if it's a ...
thelabnyc/django-shopify-sync
shopify_sync/handlers.py
.py
d3e470f5062420f4
7.15
1
from contextlib import contextmanager from django.db import models from shopify import Session as ShopifySession from shopify import ShopifyResource API_VERSION = "2025-10" class Session(models.Model): token = models.CharField(max_length=255) site = models.CharField(max_length=511) class Meta: ...
thelabnyc/django-shopify-sync
shopify_sync/models/session.py
.py
2d2d528af1ef3bb9
7.15
1
from datetime import datetime from decimal import Decimal from dateutil import parser from shopify_webhook.tests import WebhookTestCase class SyncTestCase(WebhookTestCase): """ Base class providing helpers for running synchronisation-based tests. """ def assertSynced(self, session, data, model): ...
thelabnyc/django-shopify-sync
shopify_sync/tests/__init__.py
.py
b37faf04ab16c9c4
7.65
1
from pprint import pformat from unittest import mock import json from django.test import SimpleTestCase import shopify from ..encoders import ShopifyDjangoJSONEncoder from ..models import Product from . import SyncTestCase from .recipes import SessionRecipe class FulfillmentEncodingTestCase(SimpleTestCase): """...
thelabnyc/django-shopify-sync
shopify_sync/tests/test_json_encoding.py
.py
963d9851a3d36b24
7.65
1
""" FairDM Documentation CLI Tool Provides command-line interface for building and validating Sphinx documentation with sensible defaults for FairDM-powered research data portals. """ import os import socket import subprocess import sys from pathlib import Path from typing import Annotated import typer from fairdm_...
FAIR-DM/fairdm-docs
fairdm_docs/cli.py
.py
25a4b003fcd50c33
7
0
""" Configuration loading and validation for FairDM-Docs CLI. Reads configuration from [tool.fairdm.docs] section in pyproject.toml, merges with sensible defaults, and validates all settings. """ from dataclasses import dataclass, field from pathlib import Path from typing import Any from fairdm_docs.utils import fi...
FAIR-DM/fairdm-docs
fairdm_docs/config.py
.py
8a00fda850780232
7
0
""" Sphinx extension for auto-documenting Django models using Jinja2 templates. This extension provides the `autodoc-model` directive that automatically generates documentation for Django models using configurable Jinja2 templates. """ from pathlib import Path from typing import Any import django from django.apps im...
FAIR-DM/fairdm-docs
fairdm_docs/extensions/autodoc_models.py
.py
52a32c231a1f141b
7
0
""" Shared utility functions for FairDM-Docs package. Provides common functionality for finding and loading pyproject.toml files used across the package (conf.py, config.py, CLI, etc.). """ import os # Use tomllib for Python 3.11+, tomli for 3.10 import tomllib from pathlib import Path from typing import Any def f...
FAIR-DM/fairdm-docs
fairdm_docs/utils.py
.py
bf59f97872f6fa81
7
0
""" Test branding asset detection with custom brand assets in docs/_static/brand/ This script validates T056: Test branding asset detection Tests the _resolve_branding_assets() logic without requiring Django """ import os import shutil from pathlib import Path def _resolve_branding_assets() -> dict[str, str]: "...
FAIR-DM/fairdm-docs
specs/001-pyproject-auto-config/test_branding.py
.py
e528088588829d98
7.5
0
"""Tests for fairdm_docs.utils. The search runs upward from the current working directory, which is why every test here changes into a directory it has just built. Sphinx executes conf.py with the working directory set to the configuration directory, so this is the real condition the code meets. """ import pytest fr...
FAIR-DM/fairdm-docs
tests/test_utils.py
.py
1dd51045d1436f45
7.5
0
# Modified version of: # https://github.com/dcwatson/bbcode/blob/main/src/bbcode/__init__.py from .formatter import parser as formatter from .regexes import regex, _bbcode_url_re from .objects import TagOptions from .parser import Parser import urllib.parse def url_hotfix(input_text: str) -> str: """Fix the for...
osuTitanic/common
bbcode/__init__.py
.py
2139bf526a688f19
7.15
1
from collections.abc import Mapping, MutableMapping from collections import OrderedDict # Taken from https://github.com/psf/requests/blob/eedd67462819f8dbf8c1c32e77f9070606605231/requests/structures.py#L15 class CaseInsensitiveDict(MutableMapping): def __init__(self, data=None, **kwargs): self._store = Or...
osuTitanic/common
bbcode/objects.py
.py
a4b673da927d5246
7.15
1
from typing import Tuple, Dict, Generator, Callable, Any from threading import Thread from redis import Redis import logging import json class EventQueue: def __init__(self, name: str, connection: Redis) -> None: self.name = name self.redis = connection self.events: Dict[str, Callable] = ...
osuTitanic/common
cache/events.py
.py
7e6056963336113c
7.15
1
#!/usr/bin/env python3 """ APE thin adapter — Claude Code UserPromptSubmit hook. Philosophy: the hook stays cheap. It does a fast local triage to decide whether the APE spec is even worth injecting, instead of dumping the full spec on every prompt. Heavy transformation logic lives in the spec (ape-transform-v2.md), re...
chrysa/pre-commit-tools
.claude/ape/ape_hook.py
.py
93e7e2cf1b31931d
7
0
#!/usr/bin/python3 """Hook to require a DECISIONS.md update when architecture-sensitive files are added.""" from __future__ import annotations import argparse import fnmatch import subprocess from collections.abc import Sequence from pathlib import Path _DEFAULT_TRIGGER_PATTERNS: list[str] = [ 'pyproject.toml', ...
chrysa/pre-commit-tools
pre_commit_hooks/adr_gate.py
.py
ed346d7136e975bc
7
0
#!/usr/bin/python3 """Hook to validate the front matter of Claude Code subagents (``agents/*.md``). A subagent definition is a Markdown file whose YAML front matter declares at least ``name`` and ``description``; the body is the agent's system prompt. An agent whose front matter is missing or malformed is never regist...
chrysa/pre-commit-tools
pre_commit_hooks/claude_agent_frontmatter.py
.py
9d70ae95d979471c
7
0
#!/usr/bin/python3 """Hook to detect a chrysa repository whose ``.claude/`` mirror is missing. The shared skills and agents are distributed as versioned copies into every repo. Nothing checked that they were still there: a repo whose ``.claude/skills`` had been wiped kept working, silently, with no skill loaded — the ...
chrysa/pre-commit-tools
pre_commit_hooks/claude_assets_present.py
.py
f6f81efda07c1be2
7
0
#!/usr/bin/python3 """Hook to validate Claude Code MCP server configuration (``.mcp.json``). An MCP server entry is either *stdio* (a ``command`` plus optional ``args``) or remote (a ``url`` with an ``http``/``sse`` transport). Mixing both, or declaring a transport that contradicts the keys present, yields a server th...
chrysa/pre-commit-tools
pre_commit_hooks/claude_mcp_config.py
.py
6bb2b11ffb4f4439
7
0
#!/usr/bin/python3 """Hook to validate the front matter of Claude Code skills (``SKILL.md``). A skill is only discoverable when its ``SKILL.md`` opens with a YAML front matter block declaring at least ``name`` and ``description``. Legacy skills written as a plain ``# Skill: <title>`` heading carry no front matter and ...
chrysa/pre-commit-tools
pre_commit_hooks/claude_skill_frontmatter.py
.py
1b8368316c7947bc
7
0
#!/usr/bin/python3 """Hook to detect compose dev services that cannot hot-reload. Enforces the shared-standards rule *Dev stage must hot-reload*: a ``dev`` service whose source is baked into the image reflects an edit only after a rebuild, which makes it a production image wearing a dev label. The check is static — it...
chrysa/pre-commit-tools
pre_commit_hooks/compose_dev_hot_reload.py
.py
f8a1169727cc4ac0
7
0
#!/usr/bin/python3 """Hook to detect sections in per-repo copilot-instructions.md already present in workspace instructions.""" from __future__ import annotations import argparse import difflib from collections.abc import Sequence from pathlib import Path _DISABLE_COMMENT = 'detect-duplicated-copilot-instructions: d...
chrysa/pre-commit-tools
pre_commit_hooks/copilot_instructions_duplication.py
.py
610fb3d905786d5c
7
0
#!/usr/bin/python3 """Hook to detect duplicate/overridden CSS property declarations and duplicate ID selectors.""" from __future__ import annotations import re from collections.abc import Sequence from pathlib import Path from pre_commit_hooks.tools.pre_commit_tools import PreCommitTools # (filename, duplicate_line...
chrysa/pre-commit-tools
pre_commit_hooks/css_duplicate_property_detection.py
.py
9db96449e59bea67
7
0
#!/usr/bin/python3 """Hook to detect CSS custom properties (--var) declared but never used.""" from __future__ import annotations import re from collections.abc import Sequence from pathlib import Path from pre_commit_hooks.tools.pre_commit_tools import PreCommitTools _DISABLE_COMMENT = '/* css-unused-variable: dis...
chrysa/pre-commit-tools
pre_commit_hooks/css_unused_variable.py
.py
b48bfec0dfb4bb41
7
0
#!/usr/bin/python3 """Hook to detect dead/unused code using vulture. On top of vulture's static analysis this hook adds two capabilities: * **Dynamic-import awareness** (default-on): names reached only through ``importlib.import_module``, ``__import__``, ``getattr``/``setattr``/``hasattr``, ``globals()``/``vars()...
chrysa/pre-commit-tools
pre_commit_hooks/dead_code_detection.py
.py
2e2e2ff75f070fd6
7
0
#!/usr/bin/python3 """Hook to keep the Dependabot config in sync with declared Python dependencies. Every dependency declared in the project manifests (``setup.cfg`` ``install_requires`` / ``extras_require`` and ``pyproject.toml`` PEP 621 dependencies) must be matched by a Dependabot group. Semantic groups (curated, p...
chrysa/pre-commit-tools
pre_commit_hooks/dependabot_classified_deps.py
.py
8065965b28be6d3b
7
0
#!/usr/bin/python3 """Hook to detect hardcoded secrets in Django/Python settings files.""" from __future__ import annotations import re from collections.abc import Sequence from pathlib import Path from pre_commit_hooks.tools.pre_commit_tools import PreCommitTools _DISABLE_COMMENT = '# django-hardcoded-secret: disa...
chrysa/pre-commit-tools
pre_commit_hooks/django_hardcoded_secret.py
.py
46bce95c1551a7d5
7
0
#!/usr/bin/python3 """Hook to detect ``docker run`` invocations that mount the repo as root. Enforces the shared-standards rule *Any container that bind-mounts a repo runs as the host UID*: a throwaway container started without ``--user`` runs as root, and anything it writes into the bind mount lands root-owned. Those...
chrysa/pre-commit-tools
pre_commit_hooks/docker_run_host_user.py
.py
c4c199f69b454483
7
0
#!/usr/bin/python3 """Hook to detect Dockerfiles missing a HEALTHCHECK instruction.""" from __future__ import annotations import re from collections.abc import Sequence _DISABLE_COMMENT = '# dockerfile-healthcheck: disable' _FROM_RE = re.compile(r'^\s*FROM\s+', re.IGNORECASE) _HEALTHCHECK_RE = re.compile(r'^\s*HEALT...
chrysa/pre-commit-tools
pre_commit_hooks/dockerfile_healthcheck.py
.py
2f41f8e371696193
7
0
#!/usr/bin/python3 """Hook to detect Dockerfiles that are missing a multi-stage build pattern.""" from __future__ import annotations import re from collections.abc import Sequence _DISABLE_COMMENT = '# dockerfile-multi-stage-check: disable' _FROM_RE = re.compile(r'^\s*FROM\s+\S+', re.IGNORECASE) _STAGE_RE = re.compi...
chrysa/pre-commit-tools
pre_commit_hooks/dockerfile_multi_stage_check.py
.py
b4e339fbd16faba5
7
0
#!/usr/bin/python3 """Hook to detect `FROM image:latest` in Dockerfiles.""" from __future__ import annotations import re from collections.abc import Sequence _DISABLE_COMMENT = '# dockerfile-no-latest: disable' _FROM_LATEST_RE = re.compile(r'^\s*FROM\s+\S+:latest(\s|$)', re.IGNORECASE) _FROM_SCRATCH_RE = re.compile(...
chrysa/pre-commit-tools
pre_commit_hooks/dockerfile_no_latest.py
.py
249cce0d3b8873d9
7.5
0
#!/usr/bin/python3 """Hook to keep generated docs in sync with the code. Regenerates code-derived docs via a make target, then fails if the working tree drifts from the committed copy. Intended to run at the ``pre-push`` stage so the developer is blocked before the push reaches CI. The consuming repo owns the genera...
chrysa/pre-commit-tools
pre_commit_hooks/docs_drift_gate.py
.py
96c60c340a354d60
7
0
#!/usr/bin/python3 """Hook to check that .env and .env.example files are in sync (same keys).""" from __future__ import annotations import argparse import os import re from collections.abc import Sequence from pathlib import Path _KEY_RE = re.compile(r'^([A-Za-z_]\w*)\s*=', re.MULTILINE) _COMMENT_RE = re.compile(r'^...
chrysa/pre-commit-tools
pre_commit_hooks/env_example_sync.py
.py
873151e65f63290e
7
0
#!/usr/bin/python3 """Hook to detect insecure set_cookie() calls missing secure/httponly/samesite (RGPD/ePrivacy).""" from __future__ import annotations import argparse import re from collections.abc import Sequence from pathlib import Path _SET_COOKIE = re.compile(r'\.set_cookie\s*\(') _SECURE = re.compile(r'secure...
chrysa/pre-commit-tools
pre_commit_hooks/fastapi_cookie_insecure.py
.py
d7539a5139dab01a
7
0
#!/usr/bin/python3 """Hook to detect FastAPI routes whose response model lacks a 'links' field (HATEOAS).""" from __future__ import annotations import ast import sys from collections.abc import Sequence from pathlib import Path from pre_commit_hooks.tools.pre_commit_tools import PreCommitTools Violation = tuple[str...
chrysa/pre-commit-tools
pre_commit_hooks/fastapi_missing_links.py
.py
9df81388b335ddaa
7
0
#!/usr/bin/python3 """Hook to detect FastAPI routes missing a response_model parameter.""" from __future__ import annotations import ast import sys from collections.abc import Sequence from pathlib import Path from pre_commit_hooks.tools.pre_commit_tools import PreCommitTools Violation = tuple[str, int, str] # Fas...
chrysa/pre-commit-tools
pre_commit_hooks/fastapi_missing_response_model.py
.py
3daf234ec20b13cc
7
0
#!/usr/bin/python3 """Hook to format Dockerfiles: add shebang, merge consecutive identical instructions.""" from __future__ import annotations import json import logging import re import tempfile import time import tomllib import urllib.error import urllib.request from collections.abc import Sequence from dataclasses...
chrysa/pre-commit-tools
pre_commit_hooks/format_dockerfile.py
.py
652c9ca53595302d
7
0
#!/usr/bin/python3 """Hook to detect Python functions exceeding the maximum line count (default 50).""" from __future__ import annotations import argparse import ast from collections.abc import Sequence from pathlib import Path def _disabled(source_lines: list[str], lineno: int) -> bool: idx = lineno - 1 re...
chrysa/pre-commit-tools
pre_commit_hooks/function_too_long.py
.py
c6433ae5fd9728be
7
0
#!/usr/bin/python3 """Hook to run helm lint --strict on Helm charts.""" from __future__ import annotations import argparse import shutil import subprocess import sys from pathlib import Path def _find_charts(search_root: Path) -> list[Path]: """Return chart directories at <root>/<namespace>/<service>/.""" c...
chrysa/pre-commit-tools
pre_commit_hooks/helm_lint.py
.py
e2dafa1fa1365379
7
0
#!/usr/bin/python3 """Hook to sort the entries of ignore files (.gitignore, .dockerignore, …). By default, entries are sorted alphabetically (case-insensitive) within each contiguous run of pattern lines. Comment lines and blank lines act as fixed anchors: they keep their position, so section headers and their groupin...
chrysa/pre-commit-tools
pre_commit_hooks/ignore_file_sorter.py
.py
505c3f69140d60f0
7
0
#!/usr/bin/python3 """Hook to validate syntax of JavaScript and Google Apps Script (.gs) files using Node.js.""" from __future__ import annotations import subprocess import sys import tempfile from collections.abc import Sequence from pathlib import Path from pre_commit_hooks.tools.pre_commit_tools import PreCommitT...
chrysa/pre-commit-tools
pre_commit_hooks/js_syntax_check.py
.py
f71ad571fe2ffaee
7
0
#!/usr/bin/python3 """Hook to sort JSON files keys alphabetically.""" from __future__ import annotations import json from collections.abc import Sequence from pathlib import Path from typing import Any from pre_commit_hooks.tools.pre_commit_tools import PreCommitTools def sort_json(data: Any) -> Any: """Sort a...
chrysa/pre-commit-tools
pre_commit_hooks/json_sorter.py
.py
42959e4d08ed068e
7
0
#!/usr/bin/python3 """Hook to enforce the chrysa archetype-tiered Makefile contract. See chrysa/shared-standards EXECUTION_STANDARD.md §1 for the contract this enforces. Each Makefile must declare its tier on a marker line:: # makefile-tier: lib # one of: lib | python-app | fullstack | infra The hook the...
chrysa/pre-commit-tools
pre_commit_hooks/makefile_check.py
.py
37ccdc15f696bf60
7
0
import numpy as np from itertools import product import time from tqdm import tqdm import pandas as pd from collections import defaultdict, OrderedDict import os def generate_standard_square_slats(slat_count=32): """ Generates a base array for a square megastructure design :param slat_count: Number of han...
mattaq31/Hash-CAD
crisscross_kit/crisscross/core_functions/slat_design.py
.py
365367310e1ac8db
7.3
3
import os import zipfile from itertools import product from string import ascii_uppercase import numpy as np import pandas as pd import re from pathlib import Path dna_complement = {'A': 'T', 'C': 'G', 'G': 'C', 'T': 'A'} # attempts to isolate code package base directory location _here = Path(__file__).resolve() bas...
mattaq31/Hash-CAD
crisscross_kit/crisscross/helper_functions/__init__.py
.py
455a2cfdfb3fae93
7.3
3
from crisscross.plate_mapping import get_plateclass from crisscross.core_functions.plate_handling import read_dna_plate_mapping from crisscross.plate_mapping.plate_constants import cckz_h5_handle_plates, cckz_h2_antihandle_plates, assembly_handle_plate_folder, latest_assembly_handle_plate_folder, seed_plate_folder, car...
mattaq31/Hash-CAD
crisscross_kit/crisscross/plate_mapping/hash_cad_plates.py
.py
3f804af42b225ffb
7.3
3
from crisscross.plate_mapping.non_standard_plates import BasePlate from crisscross.plate_mapping.plate_constants import sanitize_plate_map import math class CrisscrossHandlePlates(BasePlate): """ Mix of multiple plates containing all possible 32x32x2 combinations of crisscross handles. In this system, car...
mattaq31/Hash-CAD
crisscross_kit/crisscross/plate_mapping/non_standard_plates/crisscross_plates.py
.py
dd8c0997bd7b5dad
7.3
3
from abc import ABC, abstractmethod from copy import copy from typing import Any, Callable, List import logging # from constant import Interval, Direction, Offset from datatypes import BarData, TickData, OrderData, TradeData, Offset, Direction from utility import virtual from datetime import datetime from .base impor...
yanyanzl/quanttrading
quanttrading/backtester/template.py
.py
3f7cf3ba74e77238
7.5
0
# from data.ibkr.IbGateway import IbGateway, IbApi # # from ibapi.client import EClient # # from ibapi.wrapper import EWrapper # from ibapi.client import * # from ibapi.wrapper import * # from ibapi.contract import Contract # from OrderSamples import * # from ContractSamples import * # from cmdtrading_utility import * ...
yanyanzl/quanttrading
quanttrading/cmdtrading_client copy.py
.py
d7819b3332871ebf
7
0
from decimal import Decimal from ordermanagement import MainEngine import os, sys from cmdtrading_setting import SETTINGS, load_settings, SETTING_FILE_NAME from cmdtrading_utility import getLogger import logging logger = getLogger(__file__) logger.setLevel(logging.INFO) INPUT_PROMPT:str = "" def get_input_prompt...
yanyanzl/quanttrading
quanttrading/cmdtrading_input_process.py
.py
5d68b52c0b8fc63f
7
0
from dataclasses import dataclass from datetime import datetime from enum import Enum import logging from typing import Literal from threading import Condition class bcolors: HEADER = '\033[95m' OKBLUE = '\033[94m' OKCYAN = '\033[96m' OKGREEN = '\033[92m' WARNING = '\033[93m' FAIL = '\033[91m' ...
yanyanzl/quanttrading
quanttrading/cmdtrading_utility.py
.py
50106a39ea0c1466
7
0
""" General constant enums used in the trading platform. """ from enum import Enum from typing import List # from .locale import _ # LOCAL_TZ = ZoneInfo(get_localzone_name()) def _(name): """ use _() as a function to translate the locale. could be replaced by locale in the future when needed. """ ...
yanyanzl/quanttrading
quanttrading/constant.py
.py
58896e4f4be5b1b9
7
0
""" Copyright (C) 2019 Interactive Brokers LLC. All rights reserved. This code is subject to the terms and conditions of the IB API Non-Commercial License or the IB API Commercial License, as applicable. """ from ibapi.object_implem import Object from ibapi.scanner import ScannerSubscription class ScannerSubscrip...
yanyanzl/quanttrading
quanttrading/data/ibkr/ScannerSubscriptionSamples.py
.py
c878072688f888ee
7
0
import tkinter as tk from tkinter.scrolledtext import ScrolledText from setting import Aiconfig import logging import threading import requests import os class Message_Area(): messagearea = "" def __init__(self) -> None: pass def display_message(message:str, st:ScrolledText=None): """ Displa...
yanyanzl/quanttrading
quanttrading/data/ibkr/aitools.py
.py
c327dfdc65a48712
7
0
# this is a learning file for IB TWS connection from ibapi.account_summary_tags import AccountSummaryTags from ibapi.contract import Contract # from ibapi.ticktype import TickTypeEnum # from ibapi.execution import Execution from ibapi.common import * # @UnusedWildImport from ibapi.utils import * # @UnusedWildImport...
yanyanzl/quanttrading
quanttrading/data/ibkr/ibkrgateway_not_used.py
.py
dc5e9a6bc98b96ae
7
0
""" Technical analysis technical indicators. signals. """ import pandas as pd import numpy as np import talib.abstract as ta import yfinance as yf from datetime import datetime, timedelta import logging import requests_cache from typing import get_args from .base import TickerData, TICKER_DATA_KEYS from database impor...
yanyanzl/quanttrading
quanttrading/data/techanalysis.py
.py
1944c762a74c85d6
7
0
from abc import ABC from types import ModuleType from typing import Optional, List, Callable from importlib import import_module from datatypes import HistoryRequest, TickData, BarData from setting import SETTINGS from constant import _ class BaseDatafeed(ABC): """ Abstract datafeed class for connecting to d...
yanyanzl/quanttrading
quanttrading/datafeed.py
.py
5266a9ba9f4eb1e8
7
0
""" Event-driven framework. """ from collections import defaultdict from queue import Empty, Queue from threading import Thread import logging from time import sleep from typing import Any, Callable, List EVENT_TIMER = "eTimer" logger = logging.getLogger(__name__) class Event: """ Event object consists of a ...
yanyanzl/quanttrading
quanttrading/event/engine.py
.py
f8a13b357d4f2cda
7
0
""" optimization module which provide the optimization functions for the stratigies developed. The strategy developed may contain some parameters to DEAP is a novel evolutionary computation framework for rapid prototyping and testing of ideas. It seeks to make algorithms explicit and data structures transparent. I...
yanyanzl/quanttrading
quanttrading/optimize.py
.py
9e3318720194720c
7
0
import sys from PySide6.QtGui import Qt from PySide6 import QtGui # from PySide6.Qt import AlignmentFlag from PySide6.QtWidgets import ( QApplication, QCheckBox, QComboBox, QDateEdit, QDateTimeEdit, QDial, QDoubleSpinBox, QFontComboBox, QLabel, QLCDNumber, QLineEdit, QMa...
yanyanzl/quanttrading
quanttrading/qwidgettest.py
.py
67c9e99983b95cb4
7.5
0
"""Click-compatible export of the Typer CLI for great-docs reference generation. great-docs expects a `click.Command` or `click.Group` and reads help text via `Command.get_help()`. The runtime CLI is a `typer.Typer`; `typer.main.get_command` returns a Click-compatible object, but Typer's Rich help override writes to t...
posit-dev/images-shared
posit-bakery/posit_bakery/cli/click_app.py
.py
ea5c32e9c745157b
7.24
2
import functools import inspect import json import logging import tempfile from pathlib import Path from typing import Annotated, Optional, Any, TYPE_CHECKING import typer from pydantic import ValidationError from posit_bakery.config.dependencies import ( get_dependency_versions_class, get_dependency_constrai...
posit-dev/images-shared
posit-bakery/posit_bakery/cli/common.py
.py
4cf28e46ef036d51
7.24
2
"""Map a PR's changed files to the image/version build matrix it affects. The classifiers (:func:`classify_changes` and :func:`classify_bakery_yaml_diff`) are pure so they can be unit-tested with synthetic inputs; git I/O lives in :func:`git_changed_files` and :func:`git_show_file`. """ from __future__ import annotat...
posit-dev/images-shared
posit-bakery/posit_bakery/config/changeset.py
.py
adb9282f320efa9a
7.24
2
from typing import Annotated, Union from pydantic import Field from . import const from .dependency import DependencyVersion, DependencyConstraint, DependencyVersions from .positron import PositronDependencyConstraint, PositronDependencyVersions from .python import PythonDependencyConstraint, PythonDependencyVersions...
posit-dev/images-shared
posit-bakery/posit_bakery/config/dependencies/__init__.py
.py
0dabeecb91df1901
7.24
2
import abc import typing from typing import Annotated, ClassVar from pydantic import Field, field_validator, model_serializer, AliasChoices from posit_bakery.config.shared import BakeryYAMLModel from .version import DependencyVersion, VersionConstraint class Dependency(BakeryYAMLModel, abc.ABC): """Base class f...
posit-dev/images-shared
posit-bakery/posit_bakery/config/dependencies/dependency.py
.py
fc029d78c900ef70
7.24
2
import abc import copy from functools import cache from typing import Annotated, Literal, ClassVar from pydantic import ConfigDict, Field from posit_bakery.config.shared import BakeryYAMLModel from posit_bakery.util import cached_session from .const import POSITRON_DAILY_URL_TEMPLATE, POSITRON_RELEASES_URL_TEMPLATE, ...
posit-dev/images-shared
posit-bakery/posit_bakery/config/dependencies/positron.py
.py
aabb8601abf2c7f8
7.24
2
import abc import copy from functools import cache from typing import Literal, ClassVar from pydantic import ConfigDict from posit_bakery.config.shared import BakeryYAMLModel from posit_bakery.util import cached_session from .const import UV_PYTHON_DOWNLOADS_JSON_URL, SupportedDependencies from .dependency import Dep...
posit-dev/images-shared
posit-bakery/posit_bakery/config/dependencies/python.py
.py
c316ca4b715d07e4
7.24
2
import abc import copy from functools import cache from typing import Annotated, Literal, ClassVar from pydantic import ConfigDict, Field, field_validator from ruamel.yaml import YAML from posit_bakery.config.shared import BakeryYAMLModel from posit_bakery.util import cached_session from .const import QUARTO_DOWNLOAD...
posit-dev/images-shared
posit-bakery/posit_bakery/config/dependencies/quarto.py
.py
fe8c628798e85574
7.24
2
import abc import copy from functools import cache from typing import Literal, ClassVar from pydantic import ConfigDict from posit_bakery.config.shared import BakeryYAMLModel from posit_bakery.util import cached_session from .const import R_VERSIONS_URL, SupportedDependencies from .dependency import DependencyVersion...
posit-dev/images-shared
posit-bakery/posit_bakery/config/dependencies/r.py
.py
c9942df95fd73238
7.24
2
import re from typing import Annotated, Self, Any from packaging.version import InvalidVersion, Version from pydantic import Field, model_validator, field_validator from ruamel.yaml.scalarfloat import ScalarFloat from ruamel.yaml.scalarint import ScalarInt from posit_bakery.config.shared import BakeryYAMLModel _STR...
posit-dev/images-shared
posit-bakery/posit_bakery/config/dependencies/version.py
.py
75508eb92788f720
7.24
2
"""Compare two rendered version directories and render a markdown comment. Used by ``bakery create version --diff-against`` to show reviewers what changed between a newly-created release edition and a previous one, since both are wholesale re-renders rather than incremental edits. Unrelated to ``config/changeset.py``'...
posit-dev/images-shared
posit-bakery/posit_bakery/config/dirdiff.py
.py
10b198668f208d80
7.24
2
from typing import Annotated from pydantic import Field from posit_bakery.config.shared import BakeryYAMLModel class BuildSecret(BakeryYAMLModel): """A build secret passed to `docker buildx build` via `--secret id=<id>,env=<envVar>`. The secret is then available in the Containerfile by adding `--mount=...
posit-dev/images-shared
posit-bakery/posit_bakery/config/image/build_secret.py
.py
a714f36d84504ff7
7.24
2
import abc import logging from copy import deepcopy from typing import Annotated, Self from pydantic import Field, field_validator, model_validator from posit_bakery.config.image.build_os import DEFAULT_PLATFORMS from posit_bakery.config.image.posit_product.const import ReleaseChannelEnum from posit_bakery.config.ima...
posit-dev/images-shared
posit-bakery/posit_bakery/config/image/dev_version/base.py
.py
6f2b0f98043f9a45
7.24
2
import logging from typing import Literal, Annotated import requests from pydantic import Field, ValidationError, model_validator from posit_bakery.config.image.build_os import DEFAULT_OS, DEFAULT_PLATFORMS from posit_bakery.config.image.dev_version.base import BaseImageDevelopmentVersion from posit_bakery.config.ima...
posit-dev/images-shared
posit-bakery/posit_bakery/config/image/dev_version/channel.py
.py
d81c34528682d05d
7.24
2
from typing import Annotated, Literal from pydantic import Field, field_validator from posit_bakery.config.dependencies import get_dependency_constraint_class, get_dependency_versions_class from posit_bakery.config.dependencies.const import SupportedDependencies from posit_bakery.config.dependencies.version import Ve...
posit-dev/images-shared
posit-bakery/posit_bakery/config/image/dev_version/dependency.py
.py
352b62b593e3629c
7.24
2
"""Parsed version representation for Posit calver-flavored semver strings. Provides ``ParsedVersion``, a value type that round-trips the input string, supports comparison per semver §11, and warns (rather than raising) on unparseable input. """ import logging import re from dataclasses import dataclass from typing im...
posit-dev/images-shared
posit-bakery/posit_bakery/config/image/parsed_version.py
.py
a7245f763005ed23
7.24
2
class DispatchVersionMismatchError(Exception): """Raised when a dispatched version override does not match the upstream manifest. Must NOT subclass ValueError or RequestException so it escapes the per-OS catch in _resolve_os_urls and the skip-on-error catch in load_dev_versions. """ class ArtifactNot...
posit-dev/images-shared
posit-bakery/posit_bakery/config/image/posit_product/errors.py
.py
537077b560d34fc0
7.24
2
from collections import OrderedDict from typing import Annotated from urllib.parse import quote import requests from pydantic import BaseModel, Field, computed_field, HttpUrl from posit_bakery.config.image.build_os import BuildOS from posit_bakery.config.image.posit_product import resolvers from posit_bakery.config.i...
posit-dev/images-shared
posit-bakery/posit_bakery/config/image/posit_product/main.py
.py
eb4730c75c85e7f1
7.24
2
import abc from typing import Any, List, Dict class AbstractResolver(abc.ABC): """ABC for resolvers, a general term for classes that take input data (usually a dict or str) and return a value.""" def __init__(self): self.metadata = {} def set_metadata(self, metadata: Dict): """Provided a...
posit-dev/images-shared
posit-bakery/posit_bakery/config/image/posit_product/resolvers.py
.py
ead4a4898ab58f1c
7.24
2
import logging from typing import Annotated, Union from pydantic import Field from posit_bakery.config.tag import TagPattern from posit_bakery.config.shared import BakeryYAMLModel, ExtensionField, TagDisplayNameField from posit_bakery.config.tools import ToolField, default_tool_options, ToolOptions log = logging.get...
posit-dev/images-shared
posit-bakery/posit_bakery/config/image/variant.py
.py
ce9c1482259f3b41
7.24
2
import logging import re from typing import Annotated, Union from pydantic import BaseModel, Field, field_validator, field_serializer from pydantic_core.core_schema import ValidationInfo from posit_bakery.config.shared import BakeryYAMLModel, ExtensionField, TagDisplayNameField from .build_os import BuildOS, SUPPORTE...
posit-dev/images-shared
posit-bakery/posit_bakery/config/image/version_os.py
.py
5c18f8a82c6ee465
7.24
2
from typing import Annotated from pydantic import ConfigDict, Field from posit_bakery.config.shared import BakeryYAMLModel class BaseRegistry(BakeryYAMLModel): """Model representing an image registry in the Bakery configuration.""" model_config = ConfigDict(extra="forbid") host: Annotated[str, Field(d...
posit-dev/images-shared
posit-bakery/posit_bakery/config/registry.py
.py
5185bec1b61b5147
7.24
2
"""Utility for initialization ensuring functions are called only once.""" import abc import asyncio import collections.abc import enum import functools import inspect import threading import typing import weakref from . import _iterator_wrappers from typing import ParamSpec def _is_method(func: collections.abc.Cal...
DelfinaCare/once
once/__init__.py
.py
bde197646867e5d6
7.35
4
import asyncio import abc import collections.abc import enum import functools import threading import time import typing # Before we begin, a note on the assert statements in this file: # Why are we using assert in here, you might ask, instead of implementing "proper" error handling? # In this case, it is actually not...
DelfinaCare/once
once/_iterator_wrappers.py
.py
1f0ff72934323ac8
7.35
4