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
from __future__ import annotations from shutil import copyfileobj from typing import TYPE_CHECKING from urllib.request import urlopen from zipfile import ZipFile import tarfile if TYPE_CHECKING: from pathlib import Path __all__ = [ 'download_file', 'extract_archive', ] def download_file(url: str, targe...
sublimelsp/lsp_utils
lsp_utils/_util/download_file.py
.py
e2bf46efea1817b2
7.65
19
from __future__ import annotations from abc import ABC from abc import abstractmethod from typing import Any from typing import Callable __all__ = [ 'ApiWrapperInterface', ] class ApiWrapperInterface(ABC): """ An interface for sending and receiving requests and notifications from and to the server. ...
sublimelsp/lsp_utils
lsp_utils/api_wrapper_interface.py
.py
93e556195d20cf8b
7.65
19
from __future__ import annotations from hashlib import md5 from os import PathLike from typing import Any from typing import Callable from typing import Tuple from typing import TYPE_CHECKING import os import shutil import sublime import subprocess # noqa: S404 import sys import threading if TYPE_CHECKING: from ...
sublimelsp/lsp_utils
lsp_utils/helpers.py
.py
d402f28e5262b41a
7.65
19
from __future__ import annotations from abc import ABC from abc import abstractmethod from typing import final __all__ = [ 'ServerResourceInterface', 'ServerStatus', ] @final class ServerStatus: """A :class:`ServerStatus` enum for use as a return value from :func:`ServerResourceInterface.get_status()`."...
sublimelsp/lsp_utils
lsp_utils/server_resource_interface.py
.py
1f9e1abebc0ac492
7.65
19
# Copyright @ 2020 Yves Vogl, adesso as a service GmbH # # 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...
yves-vogl/aws-eks-helm-deploy
pipe/helm/client.py
.py
44affb396ee502de
7.5
9
# Copyright @ 2020 Yves Vogl, adesso as a service GmbH # # 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...
yves-vogl/aws-eks-helm-deploy
pipe/test.py
.py
bb09e2c15b604ed9
7
9
"""Phase 6 / SEC-04 / D2 — .trivyignore grammar parser. Enforces the D2 grammar: CVE-XXXX-NNNNN # expires=YYYY-MM-DD rationale="…" reviewer=<github-handle> Rules: - expires=YYYY-MM-DD must be in the future AND within 180 days of today. - rationale="…" must be non-empty. - reviewer=<github-handle> must be pre...
yves-vogl/aws-eks-helm-deploy
scripts/_trivyignore_parser.py
.py
16b81a7b5465b79f
7.5
9
"""Trivy SARIF parser + dedup-aware GitHub Issue creator (Phase 6 / SEC-07). Reads a Trivy-generated SARIF file, deduplicates findings against existing open issues with the `area/security` label by (image_digest, cve_id) hash, and opens new issues for CRITICAL (priority/p0) and HIGH (priority/p1) findings. This scrip...
yves-vogl/aws-eks-helm-deploy
scripts/rescan-issue-creator.py
.py
82beddba201d17e6
7.5
9
"""Phase 6 / SEC-10 / D3 -- .scorecard-exception.md review_date enforcement. Parses the YAML frontmatter of .scorecard-exception.md and fails if any entry's review_date is past OR more than 180 days in the future. """ from __future__ import annotations import pathlib import re import sys from datetime import date fr...
yves-vogl/aws-eks-helm-deploy
scripts/scorecard-exception-check.py
.py
7a555187d4317a9d
7.5
9
"""DiffAction — orchestration root for helm diff upgrade (ACTION=diff / DRY_RUN=true). Requirements traceability: PIPE-02: DiffAction.run orchestrates ACTION=diff and DRY_RUN=true routing (CONTEXT D2) SEC-06: diff output flows through HelmClient.diff's redactor (CONTEXT D1); DiffAction emit...
yves-vogl/aws-eks-helm-deploy
src/aws_eks_helm_deploy/actions/diff.py
.py
47fcf1ec6927a15e
7.5
9
"""RollbackAction — orchestration root for helm rollback (ACTION=rollback). Requirements traceability: PIPE-04: RollbackAction.run orchestrates ACTION=rollback with pre-flight check PIPE-05: pre-flight uses SAFE_UPGRADE_DESCRIPTION to detect revisions deployed with --wait --rollback-on-failu...
yves-vogl/aws-eks-helm-deploy
src/aws_eks_helm_deploy/actions/rollback.py
.py
9de1052ed943f0e3
7.5
9
"""UpgradeAction — orchestration root for helm upgrade --install. Requirements traceability: CHART-01: end-to-end: select_chart_source -> HelmClient.upgrade_install CHART-05: pipe.success emits exact format per CONTEXT D7 PIPE-01: full chain (auth -> token -> kubeconfig -> chart -> helm) wired PIPE...
yves-vogl/aws-eks-helm-deploy
src/aws_eks_helm_deploy/actions/upgrade.py
.py
365e1eb9ef13dab1
7.5
9
"""Composable STS AssumeRole on top of any AuthStrategy. Requirements traceability: - AUTH-02: AssumeRoleStrategy wraps any base AuthStrategy and calls STS AssumeRole on top of its credentials, returning short-lived AwsCredentials with an expiration. Rationale: This strategy is intentionally stateless — it ...
yves-vogl/aws-eks-helm-deploy
src/aws_eks_helm_deploy/auth/assume_role.py
.py
8c3cf362e16e2d62
7.5
9
"""AuthStrategy Protocol and AwsCredentials value object for aws-eks-helm-deploy. Requirements traceability: - AUTH-01: defines the AuthStrategy Protocol (structural typing contract) and the AwsCredentials frozen dataclass consumed by all strategy implementations. Security note (STRIDE T-02-02-01 / T-02-02-02 /...
yves-vogl/aws-eks-helm-deploy
src/aws_eks_helm_deploy/auth/base.py
.py
4cf56a23be130d21
7.5
9
"""OidcWebIdentityStrategy — exchanges a Bitbucket OIDC JWT for short-lived AWS credentials. Requirements traceability: - AUTH-03: implements the OIDC web-identity credential provider using STS AssumeRoleWithWebIdentity with botocore.UNSIGNED (unauthenticated call). Security note (STRIDE T-04-03-01 / T-04-03-03...
yves-vogl/aws-eks-helm-deploy
src/aws_eks_helm_deploy/auth/oidc.py
.py
446d4ee34594c42f
7.5
9
"""Static-keys strategy — wraps env-supplied keys into an AwsCredentials. No AWS calls. Requirements traceability: - AUTH-01: StaticKeysStrategy is a concrete implementation of the AuthStrategy Protocol. It accepts explicitly-provided AWS key material and returns a plain AwsCredentials value object without m...
yves-vogl/aws-eks-helm-deploy
src/aws_eks_helm_deploy/auth/static_keys.py
.py
0ad7d9dfc961f69a
7.5
9
"""chart subpackage — ChartSource Protocol + LocalChart / RepoChart / OciChart resolvers. Phase 4 factory: select_chart_source(settings) -> ChartSource routes by settings.chart prefix. - oci:// -> OciChart (Phase 4 — Plan 04-07 shipped) - repo:// -> RepoChart (Phase 4 — Plan 04-06 shipped) - else -> Local...
yves-vogl/aws-eks-helm-deploy
src/aws_eks_helm_deploy/chart/__init__.py
.py
0343e78daef21685
7.5
9
"""ChartSource Protocol + ResolvedChart value object. Uniform interface for LocalChart, RepoChart, OciChart. Requirements traceability: - CHART-02 (Phase 4): RepoChart will implement this Protocol. - CHART-03 (Phase 4): OciChart will implement this Protocol. - CHART-01 (Phase 3): LocalChart (refactored from res...
yves-vogl/aws-eks-helm-deploy
src/aws_eks_helm_deploy/chart/base.py
.py
182c75aa969a8c51
7.5
9
"""Local-path chart resolver for aws-eks-helm-deploy. Requirements traceability: - CHART-01: validates a local-path Helm chart directory and produces a ResolvedChart value object consumed by HelmClient.upgrade_install(). - CHART-05: ResolvedChart.name + .version surface in the success message emitted by ac...
yves-vogl/aws-eks-helm-deploy
src/aws_eks_helm_deploy/chart/local.py
.py
492b3c7a8b332eed
7.5
9
"""OciChart — OCI-registry chart source + optional Cosign keyless verification. Requirements traceability: - CHART-03 (Phase 4): consumer sets CHART=oci://<registry>/<chart> + optional CHART_VERSION + REGISTRY_USERNAME/PASSWORD. The module logs in (if creds set) + pulls the chart into a tempdir and yields a ...
yves-vogl/aws-eks-helm-deploy
src/aws_eks_helm_deploy/chart/oci.py
.py
d737371b432675a0
7.5
9
"""RepoChart — Helm repository chart source. Requirements traceability: - CHART-02 (Phase 4): consumer sets CHART=repo://<name>/<chart> + REPO_URL + optional CHART_VERSION; this module runs `helm repo add` + `helm repo update` + `helm pull <name>/<chart>` into a tempdir and yields a ResolvedChart whose s...
yves-vogl/aws-eks-helm-deploy
src/aws_eks_helm_deploy/chart/repo.py
.py
7fb7b29c729e1bfa
7.5
9
"""CLI entry point for aws-eks-helm-deploy. main(argv) is the console_scripts entry point registered in pyproject.toml. It is also called by __main__.py for `python -m aws_eks_helm_deploy`. Phase 3: ACTION=upgrade dispatches to UpgradeAction. Phase 5+ adds DiffAction + RollbackAction. Closes Phase 1 OBS-01 PARTIAL g...
yves-vogl/aws-eks-helm-deploy
src/aws_eks_helm_deploy/cli.py
.py
89519315662d1071
7.5
9
"""ClusterAccess value object + boto3 describe_cluster wrapper for aws-eks-helm-deploy. Requirements traceability: - PIPE-01 prerequisite: provides the endpoint + CA data that kube/kubeconfig.py writes into the helm-readable kubeconfig. Security note (T-03-01): ca_data is base64-encoded public certificate mater...
yves-vogl/aws-eks-helm-deploy
src/aws_eks_helm_deploy/eks/cluster.py
.py
e52d4fae8b27ce87
7.5
9
"""Error hierarchy for aws-eks-helm-deploy. All pipe-originated exceptions inherit from PipeError. cli.main() catches PipeError and maps it to a typed exit code. Bare Exception is caught as exit 99. Exit code reference: 1 — PipeError (base) / ConfigurationError 2 — AuthenticationError 3 — ClusterAccess...
yves-vogl/aws-eks-helm-deploy
src/aws_eks_helm_deploy/errors.py
.py
58ad5883f2a5a5e5
7.5
9
"""Secure kubeconfig tempfile writer for aws-eks-helm-deploy. Requirements traceability: - CHART-01 prerequisite: provides the kubeconfig path that HelmClient consumes. - PIPE-01 prerequisite: the kubeconfig bridges the EKS cluster descriptor to the helm subprocess via a 0600-permissioned tempfile. Security n...
yves-vogl/aws-eks-helm-deploy
src/aws_eks_helm_deploy/kube/kubeconfig.py
.py
286e220d2d88d478
7.5
9
"""Structured logging for the pipe. OBS-01: stable field names listed in STABLE_FIELDS. Phase 2+ binds them at the top of each action via bind_safe_context(); Phase 1 only provides the infrastructure. OBS-02: credential blocklist enforced by bind_safe_context(). The ONLY sanctioned wrapper for adding keys to structlo...
yves-vogl/aws-eks-helm-deploy
src/aws_eks_helm_deploy/logging.py
.py
d4f3977bf5d3a911
7.5
9
"""Thin adapter around bitbucket-pipes-toolkit for success/fail output. STUB MODULE: This is a deliberate Phase 1 placeholder. The Pipe instance is initialized lazily without schema validation. Phase 2 will replace this with a schema-driven adapter using Pipe(pipe_metadata=..., schema=...) once the CLUSTER_NAME-requir...
yves-vogl/aws-eks-helm-deploy
src/aws_eks_helm_deploy/pipe_io.py
.py
b86bb6667c11acc5
7.5
9
# Copyright @ 2020 Yves Vogl, adesso as a service GmbH # # 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...
yves-vogl/aws-eks-helm-deploy
test/acceptance/test_pipe.py
.py
203d46ea98ea6a84
8
9
"""Sphinx extension to inject ``noindex`` meta tag on low-value pages. Pages generated by ``sphinx.ext.viewcode`` (``_modules/``), the general index, module index, search page, and OpenSearch page provide little value to search engines and can dilute indexing quality. This extension adds ``<meta name="robots" content...
noshita/ktch
doc/sphinxext/noindex_utilities.py
.py
1eb8276fbe03dd02
7.62
16
"""Parameter conversion between theoretical morphological models.""" # Copyright 2026 Koji Noshita # # 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/LICEN...
noshita/ktch
ktch/coiling/_convert.py
.py
9e5cf571884f6efc
7.62
16
"""Utility functions for generating curves, surface assemblies, and sampling grids.""" # Copyright 2026 Koji Noshita # # 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....
noshita/ktch
ktch/coiling/_generating_curve.py
.py
4c947a9f0b7b3d88
7.62
16
"""Input normalization for the coiling estimators. A coiling specimen is a variable-length sequence of measured points, optionally with domain coordinates and per-specimen scalars. """ # Copyright 2026 Koji Noshita # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except ...
noshita/ktch
ktch/coiling/_panel.py
.py
36d917ac7ef4c89b
7.62
16
"""Tests for shared generating curve assembly and sampling grids.""" import numpy as np import pytest from ktch.coiling._generating_curve import ( _aperture_plane_basis, _assemble_surface, whorl_s_range, whorl_theta_range, ) def test_assemble_surface_cylinder(): # Straight axis along x with iden...
noshita/ktch
ktch/coiling/tests/test_generating_curve.py
.py
78e40ed68e26a94f
8.12
16
"""Base IO code for small sample datasets""" # Copyright 2023 Koji Noshita # # 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 requir...
noshita/ktch
ktch/datasets/_sample_generator.py
.py
893ba1171ccfd5a0
7.62
16
"""Tests for the Passiflora leaf image dataset.""" import os from unittest.mock import patch import pytest _skip_network = pytest.mark.skipif( os.environ.get("KTCH_NETWORK_TESTS") != "1", reason="Set KTCH_NETWORK_TESTS=1 to run network tests", ) class TestLoadImagePassifloraLeaves: """Tests for load_im...
noshita/ktch
ktch/datasets/tests/test_image_passiflora_leaves.py
.py
0fb482ff3f32337d
7.12
16
"""Tests for the trilobite cephala landmark dataset.""" import numpy as np import pandas as pd from ktch.datasets import load_landmark_trilobite_cephala class TestLoadLandmarkTrilobiteCephala: """Tests for load_landmark_trilobite_cephala function.""" def test_default_loading(self): """Test default ...
noshita/ktch
ktch/datasets/tests/test_landmark_trilobite_cephala.py
.py
9dee2d90d3a14257
8.12
16
"""Tests for the synthetic 3D leaf bending outline dataset.""" import numpy as np import pandas as pd from ktch.datasets import load_outline_leaf_bending class TestLoadOutlineLeafBending: """Tests for load_outline_leaf_bending function.""" def test_default_loading(self): """Test default loading ret...
noshita/ktch
ktch/datasets/tests/test_outline_leaf_bending.py
.py
0164e6888520c38f
8.12
16
"""Tests for _safe_extractall in ktch.datasets._base.""" import io import zipfile import pytest from ktch.datasets._base import _safe_extractall class TestSafeExtractall: """Tests for _safe_extractall().""" def test_normal_extraction(self, tmp_path): """Flat files should be extracted correctly."""...
noshita/ktch
ktch/datasets/tests/test_safe_extractall.py
.py
403918b7afcb28a5
7.12
16
"""Tests for the synthetic 3D leaf bending surface dataset.""" import os from unittest.mock import patch import pytest _skip_network = pytest.mark.skipif( os.environ.get("KTCH_NETWORK_TESTS") != "1", reason="Set KTCH_NETWORK_TESTS=1 to run network tests", ) class TestLoadSurfaceLeafBending: """Tests fo...
noshita/ktch
ktch/datasets/tests/test_surface_leaf_bending.py
.py
6ad50200b17d2ddb
8.12
16
"""Tests for shared harmonic registration utilities.""" import numpy as np import pytest from numpy.testing import assert_allclose from ktch.harmonic._registration import ( moment_frame, moment_register, validate_registration, ) def _random_rotation(n_dim, rng): """Random proper rotation (det = +1)....
noshita/ktch
ktch/harmonic/tests/test_registration.py
.py
ad71e6752e2a1bbd
7.12
16
"""Chain code file I/O functions.""" # Copyright 2025 Koji Noshita # # 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 ap...
noshita/ktch
ktch/io/_chc.py
.py
c31ee0c9508f991f
7.62
16
"""Conversion functions between file-format and processing-ready representations.""" # Copyright 2026 Koji Noshita # # 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.or...
noshita/ktch
ktch/io/_converters.py
.py
2f1a0d3af8f2d182
7.62
16
"""Normalized EFD file I/O functions.""" # Copyright 2026 Koji Noshita # # 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 b...
noshita/ktch
ktch/io/_nef.py
.py
e43c7b4c153cba2f
7.62
16
"""Private OFF (Object File Format) parser.""" # Copyright 2026 Koji Noshita # # 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 requ...
noshita/ktch
ktch/io/_off.py
.py
96344fbba35cdfac
7.62
16
"""Protocol and mixin for morphometric data containers.""" # Copyright 2026 Koji Noshita # # 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 # #...
noshita/ktch
ktch/io/_protocols.py
.py
b36264464872741b
7.62
16
"""SPHARM-PDM file (_para.vtk, _surf.vtk, and .coef) I/O functions""" # Copyright 2023 Koji Noshita # # 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/LICE...
noshita/ktch
ktch/io/_spharm_pdm.py
.py
44f6bd18bd2083a0
7.62
16
import argparse import logging import pathlib from sys import stderr from .downloader import download from .server import server def server_cli() -> int: """ CLI entrypoint to start the API server. :return: 0 on success """ parser = argparse.ArgumentParser(description="Backend API server for You...
Caligatio/youtube-archiver
backend/src/youtube_archiver/cli.py
.py
f805946a88f2e51e
7.54
11
from __future__ import annotations import json import logging import os import shutil from functools import partial from pathlib import Path from subprocess import run from tempfile import mkdtemp from typing import Any from janus import Queue from yt_dlp import YoutubeDL from yt_dlp.postprocessor.ffmpeg import FFmpe...
Caligatio/youtube-archiver
backend/src/youtube_archiver/downloader.py
.py
fd3bf708de63de36
7.54
11
from __future__ import annotations import asyncio import logging import pathlib import shutil from concurrent.futures import ThreadPoolExecutor from functools import partial from json.decoder import JSONDecodeError from uuid import uuid4 from weakref import WeakSet from aiohttp import WSCloseCode, WSMsgType, web from...
Caligatio/youtube-archiver
backend/src/youtube_archiver/server.py
.py
75e8f5c14b8171f6
7.54
11
"""Tests for the form_post callback handler's multi-value preservation. The OIDC form_post response mode (response_mode=form_post) delivers the authorization response as a POST body to the RP's callback URL. Single- value fields like ``code``, ``state``, ``id_token`` are the common case, but starlette's ``FormData`` i...
jamescrowley321/identity-model
conformance/tests/test_callback_post_multivalue.py
.py
4ca809e74a9e60f0
7.92
6
import asyncio from logging.config import fileConfig from sqlalchemy import pool from sqlalchemy.engine import Connection from sqlalchemy.ext.asyncio import async_engine_from_config from alembic import context from src.core.config import settings from src.core.database import Base from src import models # noqa: F401...
bosens-China/blog
apps/blog-server/alembic/env.py
.py
363c830f0d8e6cdb
7.52
10
from configs.base import BaseConfig from configs.llm import LLMConfig class Settings(BaseConfig, LLMConfig): """ 主应用配置聚合类 包含:基础环境、GitHub、路径、LLM 配置 不包含:存储/部署配置 (见 configs/storage.py) """ class Config(BaseConfig.Config, LLMConfig.Config): env_file = ".env" env_file_encoding = "u...
bosens-China/blog
packages/blog-core/src/config.py
.py
bae7949bb6afb9d5
7.02
10
import os import tomllib from pathlib import Path from pydantic import Field from pydantic_settings import BaseSettings class BaseConfig(BaseSettings): """基础通用配置""" # --- 环境配置 --- APP_ENV: str = Field( default_factory=lambda: "ci" if os.getenv("GITHUB_ACTIONS") == "true" else "development", ...
bosens-China/blog
packages/blog-core/src/configs/base.py
.py
8882ba63ad376544
7.52
10
from pydantic import Field, ValidationInfo, field_validator from pydantic_settings import BaseSettings class LLMConfig(BaseSettings): """大模型相关配置""" BLOG_CORE_LLM_API_KEY: str | None = Field(default=None, description="文章构建 LLM API 密钥。") BLOG_CORE_LLM_API_BASE: str = Field( default="https://api.dee...
bosens-China/blog
packages/blog-core/src/configs/llm.py
.py
62fee6cebae94f35
7.52
10
from pydantic import Field from pydantic_settings import BaseSettings class StorageConfig(BaseSettings): """存储与部署配置 (DogeCloud)""" # --- 多吉云 (DogeCloud) OSS 配置 --- DOGECLOUD_ACCESS_KEY: str | None = Field(default=None, description="多吉云 AccessKey。") DOGECLOUD_SECRET_KEY: str | None = Field(default=Non...
bosens-China/blog
packages/blog-core/src/configs/storage.py
.py
13541469bcbafdad
7.52
10
from datetime import datetime from pydantic import BaseModel, ConfigDict, Field class SEOData(BaseModel): description: str = Field(description="SEO description") keywords: list[str] = Field(description="Keywords/Tags") class Article(BaseModel): """ 文章模型。 配置 extra='allow' 以保留所有 GitHub Issue 的原始字...
bosens-China/blog
packages/blog-core/src/schemas.py
.py
58b16f9a38cd8d87
7.52
10
""" Provide apidoc like functionality for C projects. """ import argparse import os from pathlib import Path from typing import Optional, Sequence from sphinx.util.template import ReSTRenderer def get_parser() -> argparse.ArgumentParser: """ Gets the argument parser for this module Returns: ar...
speedyleion/sphinx-c-autodoc
src/sphinx_c_autodoc/apidoc/__init__.py
.py
61bdb7473bc4de0b
7.6
15
""" Expose some CXComment functionality to python for libclang """ import ctypes from typing import Any, Optional from clang import cindex def cxstring_to_str(value: Any) -> Optional[str]: """Convert a CXString unless the clang bindings already converted it.""" # No cover because coverage uses clang 21, bu...
speedyleion/sphinx-c-autodoc
src/sphinx_c_autodoc/clang/comments.py
.py
a84b6bd14df7f9a9
7.6
15
""" Patches to extend the C domain that comes with sphinx. In particular: * Allow for nesting of type/structure defines. The current c domain doesn't handle nested structures correctly. * Add a `module` option to most C directives. This allows for proper cross referencing with viewcode. """ from typing import A...
speedyleion/sphinx-c-autodoc
src/sphinx_c_autodoc/domains/c.py
.py
c0327bc02a72931c
7.6
15
""" Extend napoleon to provide a `Members` section for C structs and unions similar to the `Attributes` section in python objects. """ from functools import partial from typing import Any, Callable, Dict, List, Optional, Union, cast from sphinx.application import Sphinx from sphinx.config import Config from sphinx.ex...
speedyleion/sphinx-c-autodoc
src/sphinx_c_autodoc/napoleon/__init__.py
.py
1c2a3e46d5faabd1
7.6
15
""" Handles viewcode for c. The processing idea: 1. Walk through every node in the document finding out if it is a C construct. Then find out which file, if any it is associated with: a. Create a pending cross reference to the file. b. Add the file to the environment list of files to create source listings...
speedyleion/sphinx-c-autodoc
src/sphinx_c_autodoc/viewcode/__init__.py
.py
e66e354e6bc818ed
7.6
15
""" Test the usage of the compilation database """ import json import os from textwrap import dedent import pytest from sphinx.ext.autodoc.directive import AutodocDirective ROOT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "assets")) compile_commands = [ { "directory": ROOT_DIR, ...
speedyleion/sphinx-c-autodoc
tests/clang/test_compiler_options.py
.py
09f21cac1087e763
7.1
15
""" Focus on testing the patching of clang """ from sphinx_c_autodoc.clang.patches import patch_clang from clang import cindex def test_re_patch(): """ Tests that re-patching doesn't cause issues. The first patching happens by import, this second patching ensures that this doesn't add another entry ...
speedyleion/sphinx-c-autodoc
tests/clang/test_patch_clang.py
.py
73fb80caa4df3041
7.1
15
""" Common pytest configuration for the test suites """ import os import pytest import sphinx from docutils.parsers.rst.states import RSTStateMachine, Struct, Inliner, state_classes from docutils.parsers.rst.languages import en from docutils.statemachine import StringList from docutils.utils import new_document from...
speedyleion/sphinx-c-autodoc
tests/conftest.py
.py
7745d01c5074af44
8.1
15
""" Test the parsing of c data (variables) objects """ from textwrap import dedent import pytest import importlib from sphinx.ext.autodoc.directive import AutodocDirective CLANG_VERSION = tuple([int(v) for v in importlib.metadata.version("clang").split(".")]) class TestAutoCData: """ Testing class for the...
speedyleion/sphinx-c-autodoc
tests/directives/test_autocdata.py
.py
e6635483bb62a5f5
8.1
15
""" Test the parsing of c enum objects """ from textwrap import dedent import pytest from sphinx.ext.autodoc.directive import AutodocDirective some_enum = """\ enum some_enum If you want to document the enumerators with napoleon then you use the section title Enumerators:. enumerator THE_FIRST_ENUM...
speedyleion/sphinx-c-autodoc
tests/directives/test_autocenum.py
.py
27d44eb76f669943
7.1
15
""" Test autocfunction directive """ from textwrap import dedent import pytest from sphinx.ext.autodoc.directive import AutodocDirective class TestAutoCFunction: """ Testing class for the autocfunction directive .. note:: Parens are missing in the signature for astext(), but they show up in ht...
speedyleion/sphinx-c-autodoc
tests/directives/test_autocfunction.py
.py
7803e6c984e87357
8.1
15
""" Test the parsing of c macro objects """ from textwrap import dedent import pytest from sphinx.ext.autodoc.directive import AutodocDirective class TestAutoCMacro: """ Testing class for the autocmacro directive """ my_d_fine = """\ MY_D_FINE A define of something.""" documen...
speedyleion/sphinx-c-autodoc
tests/directives/test_autocmacro.py
.py
876226c5a5a2786a
8.1
15
""" Test autocmodule directive """ from textwrap import dedent import pytest from sphinx.ext.autodoc.directive import AutodocDirective class TestAutoCModule: """ Testing class for the autocmodule directive """ module_c = """\ This is a file comment void my_func(void) This...
speedyleion/sphinx-c-autodoc
tests/directives/test_autocmodule.py
.py
2f85839f83c55844
7.1
15
""" Test autoctype directive """ from textwrap import dedent import pytest from sphinx.ext.autodoc.directive import AutodocDirective class TestAutoCStruct: """ Testing class for the autocstruct directive """ my_struct_type = """\ struct my_struct_type A struct that is actually anon...
speedyleion/sphinx-c-autodoc
tests/directives/test_autocstruct.py
.py
9399a4402a6ee83f
8.1
15
""" Test autoctype directive """ from textwrap import dedent import pytest from sphinx.ext.autodoc.directive import AutodocDirective class TestAutoCType: """ Testing class for the autoctype directive """ my_int = """\ typedef int my_int This is basic typedef from a native type to a...
speedyleion/sphinx-c-autodoc
tests/directives/test_autoctype.py
.py
8a94f7656cacd9e6
8.1
15
""" Test autoctype directive """ from textwrap import dedent import pytest from sphinx.ext.autodoc.directive import AutodocDirective class TestAutoCUnion: """ Testing class for the autocunion directive """ a_union_type = """\ union a_union_type A union type that can be documented ...
speedyleion/sphinx-c-autodoc
tests/directives/test_autocunion.py
.py
f1cbad64f33b3466
8.1
15
import pytest from sphinx.ext.autodoc.directive import DocumenterBridge from docutils.parsers.rst.states import Struct @pytest.fixture() def documenter_bridge(sphinx_state): """ Common documenter bridge used for creating directives. This only provides what's been deemed necessary for testing so anything ...
speedyleion/sphinx-c-autodoc
tests/documenters/conftest.py
.py
067ed5e383d16112
7.1
15
""" Test the loading of C files into the needed pieces. """ import json import os import pytest from sphinx_c_autodoc import loader SCRIPT_DIR = os.path.dirname(__file__) testdata = [ ( "one_function.c", { "doc": "This is a file comment", "name": "one_function.c", ...
speedyleion/sphinx-c-autodoc
tests/loader/test_loader.py
.py
71d7239e0379b098
8.1
15
""" Test the napoleon extension provided by this package. """ from textwrap import dedent import pytest from sphinx.ext.autodoc.directive import AutodocDirective from sphinx_c_autodoc.napoleon import CAutoDocString class CustomNapoleonDocString(CAutoDocString): def __init__( self, docstring, ...
speedyleion/sphinx-c-autodoc
tests/napoleon/test_napoleon.py
.py
a11b0bfbbf9ad479
8.1
15
""" Test the pre-parse hook """ from textwrap import dedent from sphinx.ext.autodoc.directive import AutodocDirective NEW_FILE_CONTENTS = """\ /** * A comment for a variable that doesn't exist in original file */ static int compilation_db_define; """ new_contents_int = """\ static int comp...
speedyleion/sphinx-c-autodoc
tests/pre_process/test_pre_process.py
.py
f1db543be4ef9920
8.1
15
""" Performs end to end testing of the c extension For all of these tests warnigns are treated as errors so that any warnings from bad logic can more easily be seen in the test output """ import re import os import shutil from sphinx.cmd.build import main SCRIPT_DIR = os.path.dirname(__file__) def test_autodoc_of_...
speedyleion/sphinx-c-autodoc
tests/sphinx_project/test_sphinx_build.py
.py
f486ad77ce3ee5b2
8.1
15
""" View code is basically a post processing of a parsed document tree. In order to more easily test this it generates an entire sphinx project and then the resultant html files are analyzed to ensure they have the right content. For all of these tests warnigns are treated as errors so that any warnings from bad logic...
speedyleion/sphinx-c-autodoc
tests/viewcode/test_viewcode.py
.py
1a3b4c3ff3700920
7.1
15
""" To understand why this file is here, please read: http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django """ from django.conf import settings from django.db import migrations def update_site_forward(apps, schema_editor): """Set site d...
uccser/codewof
codewof/contrib/sites/migrations/0003_set_site_domain_and_name.py
.py
ef69576670016952
7.56
12
"""Module for the custom Django create_admin command.""" from django.core import management from django.conf import settings from django.contrib.auth import get_user_model from users.models import UserType from allauth.account.models import EmailAddress LOG_HEADER = '\n{}\n' + ('-' * 20) class Command(management.ba...
uccser/codewof
codewof/general/management/commands/create_admin.py
.py
1eeacbb8cb11e40d
7.56
12
"""Module for the custom Django sample_data command.""" from django.core import management from django.conf import settings from django.contrib.auth import get_user_model from users.models import UserType from allauth.account.models import EmailAddress from tests.users.factories import UserFactory from tests.programmi...
uccser/codewof
codewof/general/management/commands/sample_data.py
.py
05af8b14187dd7e6
7.56
12
"""Module for the custom Django update_data command.""" from django.core import management class Command(management.base.BaseCommand): """Required command class for the custom Django update_data command.""" help = "Update data in database." def add_arguments(self, parser): """Interprets argumen...
uccser/codewof
codewof/general/management/commands/update_data.py
.py
c589d8cb096661f4
7.56
12
"""Views for general application.""" from django.urls import reverse_lazy from django.conf import settings from django.views.generic import ( TemplateView, FormView, ) from general.forms import ContactForm class HomeView(TemplateView): """View for website homepage.""" template_name = 'general/home.h...
uccser/codewof
codewof/general/views.py
.py
c7f2ec6100ff3bb9
7.56
12
"""Admin configuration for programming.""" from django.contrib import admin from django.contrib.auth import get_user_model from programming.models import ( Attempt, TestCaseAttempt, QuestionTypeProgram, QuestionTypeFunction, QuestionTypeParsons, QuestionTypeDebugging, Profile, Achieveme...
uccser/codewof
codewof/programming/admin.py
.py
1cae13c09b8fca0a
7.56
12
""" Utility functions for codeWOF system. Involves points, achievements, and backdating points and achievements per user. """ import datetime import json import logging import time import statistics from dateutil.relativedelta import relativedelta from programming.models import ( Profile, Attempt, Achiev...
uccser/codewof
codewof/programming/codewof_utils.py
.py
1b348d1f79ce28da
7.56
12
""" Copyright BOOSTRY 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 Unless required by applicable law or agreed to in writing, software distr...
BoostryJP/ibet-SmartContract
tests/anvil_manager.py
.py
bdbe76665c0d547d
8.14
18
""" Copyright BOOSTRY 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 Unless required by applicable law or agreed to in writing, software distr...
BoostryJP/ibet-SmartContract
tests/local_anvil_config.py
.py
90fa9b89c1991819
8.14
18
""" Copyright BOOSTRY 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 Unless required by applicable law or agreed to in writing, software distr...
BoostryJP/ibet-SmartContract
tests/utils/test_P256Wallet.py
.py
cb22e5b8310b992b
8.14
18
""" Helpers """ import ee def filter_magnitude(collection, magnitude, index='nbr'): """ Mask out pixels with magnitude greater or equal than first item of tuple and lower than the last item """ band = '{}_magnitude'.format(index) values = ee.List(list(magnitude)) def wrap(image): mag = ima...
fitoprincipe/pygeeltr
pygeeltr/helpers.py
.py
086bab2c8a5f2305
7.64
18
# coding=utf-8 """ Module with some tools for IPython Jupyter Notebook and Lab """ import ee def add2map(landtrendr, map, scale=30, name='{band}_ltr', range=None): """ add a Tab to Map (geetools.ipymap) to plot a LandTrendr result :param landtrendr: a landtrendr object :type landtrendr: landtrendr.LandT...
fitoprincipe/pygeeltr
pygeeltr/ipytools.py
.py
a134a5fcfb2e3f21
7.64
18
import csv from sys import platform if platform.startswith("linux") or platform == "darwin": from bullet import Bullet elif platform == "win32": from consolemenu import SelectionMenu else: raise EnvironmentError("Unsupported Platform") def usingWindows(): """Helper function for determining if user i...
dsavransky/grading
cornellGrading/cornellInterface.py
.py
bd2c59151947e228
7.42
6
#!python import argparse import csv from bullet import Bullet import cornellGrading def getArgs(): parser = argparse.ArgumentParser( description="Set up complex due dates based on CSV file" ) parser.add_argument( "-cn", "--courseNum", type=int, help="Canvas cours...
dsavransky/grading
cornellGrading/dueDatesFromCSV.py
.py
4fbeb5a9165b3b68
7.42
6
from html.parser import HTMLParser import re import os import pdf2image import tempfile class pandocHTMLParser(HTMLParser): """Parser for pandoc produced html from LaTeX source""" def __init__(self, hwd, upfolder): """Create parser for pandoc html output to reformat for Canvas elements Args:...
dsavransky/grading
cornellGrading/pandocHTMLParser.py
.py
718ec2d35c1430dd
7.42
6
from datetime import datetime, timedelta import re import os.path import json import copy def genSemesterCalendar( classdays=[0, 2, 4], datesfile="semester_dates.json", outfile="lecture_dates.txt" ): """ Generate semester calendar for specific class meeting days. classdays is an array of days of the w...
dsavransky/grading
scripts/genSemesterCalendar.py
.py
d50607d2f935f8bf
7.42
6
#!/usr/bin/env python3 """ Check all open PRs in esphome.io for linked esphome PRs. Flags docs PRs where the linked esphome PR has been merged. Only *confirmed* pairs count: a docs PR body mentioning a code PR is not enough, the code PR has to reference the docs PR back. Docs PR bodies routinely name code PRs in prose...
esphome/esphome-release
check_docs_prs.py
.py
e1d2ce15c10d4e69
7.5
9
import functools from collections import defaultdict from datetime import datetime from typing import Dict, List, Tuple from github3.pulls import PullRequest from .changelog_filter import resolve_changelog_labels from .model import BranchType, Version from .project import EsphomeDocsProject, EsphomeProject, Project f...
esphome/esphome-release
esphomerelease/changelog.py
.py
ba413256107d44af
7.5
9
"""Pure helpers for choosing the changelog body used in release PRs and releases. Import-clean: depends only on :mod:`esphomerelease.model` (stdlib + typing). It imports nothing from ``.config`` or ``.project``, so it is unit-testable without a real ``config.json`` or the sibling repository checkouts that the release ...
esphome/esphome-release
esphomerelease/changelog_url.py
.py
40c3d552d1a34bd7
7.5
9
import functools import json from datetime import datetime from typing import Optional from github3.exceptions import NotFoundError from .github import get_session from .project import EsphomeDocsProject from .supporters import ( Supporter, format_supporter_lines, is_bot_account, render_supporters_tem...
esphome/esphome-release
esphomerelease/docs.py
.py
5257d47642c1c53d
7.5
9
"""Pure logic for pairing ``esphome/esphome`` PRs with their ``esphome/esphome.io`` PRs. Kept deliberately import-clean (stdlib ``re`` only) so it is unit-testable without a configured working copy, GitHub session, or ``config.json``. Both consumers use it: the ``check_docs_prs.py`` CLI helper (which talks to the ``gh...
esphome/esphome-release
esphomerelease/docs_pr_links.py
.py
9e7be6f160885919
7.5
9
import subprocess from datetime import datetime import github3.session from github3 import GitHub from .config import CONFIG from .exceptions import EsphomeReleaseError GITHUB_SESSION = None GITHUB_TOKEN: str | None = None # The gh OAuth token needs the `repo` scope to create releases and pull # requests. Without ...
esphome/esphome-release
esphomerelease/github.py
.py
e7426a1032464187
7.5
9