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
""" OHLC (Open-High-Low-Close) Aggregation Example This example demonstrates: - Producing stock tick/trade data to a Redis stream - Consuming ticks and aggregating into OHLC candles using TimeSeriesBuffer - Real-time candlestick chart data generation Run with: python ohlc_aggregation.py """ import asyncio import rand...
trbck/streammachine
examples/ohlc_aggregation.py
.py
808da729376841f4
7.48
8
""" StreamMachine CLI entry point. Allows running StreamMachine as a module: python -m streammachine [command] Commands: mcp Run the MCP server (default) --help Show help """ import sys def _is_missing_mcp_dependency(exc: ImportError) -> bool: """Return True when the import error comes...
trbck/streammachine
src/streammachine/__main__.py
.py
c67965fdf5178048
7.48
8
""" Fast OHLC aggregation with Cython acceleration and Python fallback. This module provides high-performance OHLC candle aggregation for real-time market data. It uses Cython when available for maximum speed, falling back to pure Python when Cython is not compiled. Performance: - Cython: ~500k ticks/second, <5µs per...
trbck/streammachine
src/streammachine/fast_ohlc.py
.py
7b12ffd542789c24
7.48
8
#!/usr/bin/env python3 """ MCP Server entry point. Usage: # From the streammachine source directory: mcp dev src/streammachine/mcp_entry.py # Or after installation: mcp dev $(python -c "import streammachine.mcp_entry; print(streammachine.mcp_entry.__file__)") """ from __future__ import annotations i...
trbck/streammachine
src/streammachine/mcp_entry.py
.py
fb54c7ffe26d4239
7.48
8
""" StreamMachine Redis Object Storage Module This module provides RedisObjectStorage for storing Python objects in Redis with automatic pickle serialization. Why pickle? Redis stores bytes, and pickle provides: - Serialization of arbitrary Python objects - Handles complex types (nested dicts, custom clas...
trbck/streammachine
src/streammachine/objstorage/redisobjstore.py
.py
b32f15ba4332465f
7.48
8
""" StreamMachine Storage Module This module provides a singleton Storage class for sharing state between agents, timers, and across process boundaries. Why multiprocessing.Manager? Python's multiprocessing.Manager creates a separate process that manages shared state. This is essential for cross-process commu...
trbck/streammachine
src/streammachine/storage.py
.py
6757e49eb8d00b61
7.48
8
""" StreamMachine Utility Module This module provides decorators and utilities for task registration and async/sync bridging. Decorator Discovery with Venusian: Venusian enables "deferred decorator" patterns. Instead of executing immediately at import time, decorators attach metadata that can be scanned l...
trbck/streammachine
src/streammachine/util.py
.py
166e7d5ad88fab4d
7.48
8
"""Define an API object to interact with the Pinboard API.""" from __future__ import annotations import logging from typing import Any, cast from aiohttp import ClientSession, ClientTimeout from aiohttp.client_exceptions import ClientError from aiopinboard.bookmark import BookmarkAPI from aiopinboard.errors import ...
bachya/aiopinboard
aiopinboard/api.py
.py
1c8e71911ba3b3c3
7.52
10
"""Define API endpoints for nodes.""" from __future__ import annotations from collections.abc import Awaitable, Callable from dataclasses import dataclass from datetime import datetime from typing import Any, cast import arrow from aiopinboard.helpers.types import DictType, ResponseType @dataclass class Note: ...
bachya/aiopinboard
aiopinboard/note.py
.py
5e33a820c8602bd1
7.52
10
"""Define dynamic test fixtures.""" from __future__ import annotations import json from typing import Any, cast import pytest from tests.common import load_fixture @pytest.fixture(name="error_response", scope="session") def error_response_fixture() -> dict[str, Any]: """Return a fixture for a failed auth resp...
bachya/aiopinboard
tests/conftest.py
.py
26837f07753ece41
8.02
10
import logging from typing import Union, Optional from django.contrib.auth.models import User from django.http.request import HttpRequest from rest_framework.exceptions import NotAuthenticated from rest_framework.request import Request logger = logging.getLogger(__name__) def get_auth_user(request: Union[Request, Ht...
kajala/django-jutil
jutil/auth.py
.py
770ff6b909d97d44
7.45
7
import logging from typing import Optional, TYPE_CHECKING, Any, Sequence, List logger = logging.getLogger(__name__) class CachedFieldsMixin: """ Cached fields mixin. Usage: 1) List cached field names in cached_fields list 2) Implement get_xxx functions where xxx is cached field name 3) Call updat...
kajala/django-jutil
jutil/cache.py
.py
0173997ab2fab6e7
7.45
7
import logging import traceback from datetime import datetime from typing import Tuple, List, Any from django.core.management import get_commands, load_command_class from django.core.management.base import BaseCommand, CommandParser from django.utils.timezone import now from django.conf import settings from jutil.dates...
kajala/django-jutil
jutil/command.py
.py
a5a277416b81569f
7.45
7
from django.utils.formats import date_format def formatted_date(description=None, ordering=None, fmt: str = "SHORT_DATE_FORMAT"): """Decorator for formatting date/datetime field in Django admin. Args: description: Short description of the function (default is "short date"). ordering: Admin or...
kajala/django-jutil
jutil/decorators.py
.py
54bfd79bb9c0f24f
7.45
7
import logging from typing import Any from django.core.exceptions import ValidationError as DjangoValidationError try: from rest_framework.exceptions import ValidationError as DRFValidationError # type: ignore from rest_framework.views import exception_handler as drf_exception_handler # type: ignore except E...
kajala/django-jutil
jutil/drf_exceptions.py
.py
ba06fa79815cb8d9
7.45
7
import os from typing import List from django.utils.translation import gettext as _ from jutil.format import is_media_full_path, strip_media_root def list_files(dir_name: str, suffix: str = "", ignore_case: bool = True, use_media_root: bool = False, recurse: bool = False) -> List[str]: """Lists all files under sp...
kajala/django-jutil
jutil/files.py
.py
74898091e69df072
7.45
7
import logging import traceback from typing import Dict, Optional from urllib.parse import urlencode from django.conf import settings from django.http import HttpRequest from django.utils import timezone from ipware import get_client_ip # type: ignore from jutil.email import send_email logger = logging.getLogger(__na...
kajala/django-jutil
jutil/middleware.py
.py
2a22ef1402314124
7.45
7
from datetime import timedelta, datetime from django.db.models.fields import Field from django.utils.encoding import force_str from time import sleep from typing import Type, List, Tuple, Any, Optional, Sequence from django.db.models import Model from django.utils.timezone import now from jutil.format import choices_la...
kajala/django-jutil
jutil/model.py
.py
10dee399af005f80
7.45
7
import logging from datetime import datetime, time, date, timezone from typing import Optional, Any from django.core.exceptions import ValidationError from django.utils.translation import gettext as _ from django.utils.dateparse import parse_datetime as django_parse_datetime from django.utils.dateparse import parse_dat...
kajala/django-jutil
jutil/parse.py
.py
2744a102cbfeb3b6
7.45
7
from rest_framework import permissions class UserIsOwner(permissions.BasePermission): """Object-level permission to only allow authorized users of an object to edit it. Assumes the model instance has an `user` attribute (can be overriden with user_field). """ user_field = "user" def has_object_p...
kajala/django-jutil
jutil/permissions.py
.py
2697af5b87bc49a5
7.45
7
import logging from typing import List, Tuple from django.utils.translation import get_language, gettext_lazy as _ from django.contrib.admin import SimpleListFilter from jutil.redis_helpers import redis_get_json, redis_set_json logger = logging.getLogger(__name__) class RedisCachedSimpleListFilter(SimpleListFilter):...
kajala/django-jutil
jutil/redis_admin_helpers.py
.py
4b5fc2d97282e1bf
7.45
7
import logging from typing import Tuple, Optional from django.conf import settings import requests import socket from ipware import get_client_ip # type: ignore logger = logging.getLogger(__name__) class GeoIP: """ Basic geolocation information of IP-address. """ ip: str country_name: str c...
kajala/django-jutil
jutil/request.py
.py
af6a57271c9fd969
7.45
7
import mimetypes import os from typing import Any, List from django.http import HttpResponse, FileResponse, Http404 from django.utils.translation import gettext as _ from jutil.format import format_xml_file, format_xml_bytes, format_csv class FileSystemFileResponse(FileResponse): """File system download HTTP resp...
kajala/django-jutil
jutil/responses.py
.py
99bddb51c713ad32
7.45
7
import logging from typing import Optional from uuid import uuid1 from django.contrib.auth import get_user_model from django.contrib.auth.models import User from rest_framework.test import APIClient from rest_framework.authtoken.models import Token logger = logging.getLogger(__name__) class TestSetupMixin: @stat...
kajala/django-jutil
jutil/testing.py
.py
d0145a4b209cec1c
7.95
7
import re from typing import Optional, Iterable, Dict, Any, List from xml import etree from xml.etree.ElementTree import Element, SubElement def _xml_element_value(el: Element, is_int: bool = False) -> Any: """Gets XML Element value. Args: el: Element is_int: If True return value is converted...
kajala/django-jutil
jutil/xml.py
.py
ae5af7b777f8c323
7.45
7
from typing import cast from ..dialogue.manager import MMDialogueManager from ..models.http import SkillInvokeRequest, SkillInvokeResponse from ..models.mindmeld import DialogueState, ProcessedQuery from ..supress_warnings import suppress_warnings from .base import BaseAPI class MindmeldAPI(BaseAPI): def __init_...
cisco/webex-assistant-sdk
webex_skills/api/mindmeld.py
.py
8185c35d935b80a0
7.57
13
import json from pathlib import Path import typer CONFIG_DIR = Path(typer.get_app_dir('skills-cli', force_posix=True)) CONFIG_FILE = CONFIG_DIR / 'config.json' def get_skill_config(name: str): """Return the configuration for a named skill""" remotes = get_remotes() return remotes.get(name) def get_rem...
cisco/webex-assistant-sdk
webex_skills/cli/config.py
.py
0fd174736f1cdc23
7.57
13
from pprint import pformat from typing import Optional import typer from .config import get_app_dir from .helpers import create_nlp app = typer.Typer(help='Commands for working with NLP models') # take name to find app path, otherwise default to cwd @app.command() def build(name: Optional[str] = typer.Argument(Non...
cisco/webex-assistant-sdk
webex_skills/cli/nlp.py
.py
bf0e356aae55ef4c
7.57
13
import json from pathlib import Path import secrets import shutil from typing import Optional import typer from ..crypto import generate_keys from .config import CONFIG_DIR, CONFIG_FILE, get_remotes, get_skill_config from .helpers import create_nlp app = typer.Typer(name='project') @app.command(name='init') def in...
cisco/webex-assistant-sdk
webex_skills/cli/project.py
.py
861af58675eb2ec7
7.57
13
import base64 import binascii from typing import cast from cryptography.exceptions import UnsupportedAlgorithm from cryptography.fernet import Fernet from cryptography.hazmat.primitives import hashes, serialization from cryptography.hazmat.primitives.asymmetric.padding import MGF1, OAEP from cryptography.hazmat.primit...
cisco/webex-assistant-sdk
webex_skills/crypto/messages.py
.py
f6d43cd54372ea5d
7.57
13
import inspect import re from typing import List, Optional from ..models.mindmeld import DialogueState from ..types import DialogueHandler, DialogueQuery, RuleMap from .rules import MMDialogueStateRule, SimpleDialogueStateRule class MissingHandler(Exception): pass class DialogueManager: def __init__(self, ...
cisco/webex-assistant-sdk
webex_skills/dialogue/manager.py
.py
29c130a719dba779
7.57
13
from __future__ import annotations import json from typing import Any, Callable, Dict, Sequence, TypeVar from ast import literal_eval T = TypeVar("T", bound=Dict[str, Any]) def type_caster(prefix: str, cast_fun: Callable) -> Any: """Base type caster""" def _caster(value: str, fail_raises: bool = True) -> ...
pwwang/python-simpleconf
simpleconf/caster.py
.py
a879de829d456736
7.45
7
import warnings import io from pathlib import Path from typing import Any, Awaitable, Dict from diot import Diot from ..utils import require_package from ..caster import ( cast, int_caster, float_caster, bool_caster, none_caster, python_caster, py_caster, json_caster, toml_caster, )...
pwwang/python-simpleconf
simpleconf/loaders/env.py
.py
70e6196c7934f0ca
7.45
7
from __future__ import annotations import warnings from typing import Any, Awaitable, Dict from pathlib import Path from diot import Diot from ..utils import require_package from ..caster import ( cast, int_caster, float_caster, bool_caster, none_caster, python_caster, py_caster, json_...
pwwang/python-simpleconf
simpleconf/loaders/ini.py
.py
6bc6a1248cf0db84
7.45
7
import json from typing import Any, Awaitable, Dict from . import ( Loader, NoConvertingPathMixin, LoaderModifierMixin, J2ModifierMixin, LiqModifierMixin, ) class JsonLoader(Loader, LoaderModifierMixin): """Json file loader""" def loading(self, conf: Any, ignore_nonexist: bool) -> Dict[s...
pwwang/python-simpleconf
simpleconf/loaders/json.py
.py
d0d4ca07d262741f
7.45
7
from typing import Any, Dict, Awaitable from ..utils import require_package from ..caster import ( none_caster, null_caster, ) from . import ( Loader, NoConvertingPathMixin, LoaderModifierMixin, J2ModifierMixin, LiqModifierMixin, ) toml = require_package("rtoml", "tomllib", "tomli") clas...
pwwang/python-simpleconf
simpleconf/loaders/toml.py
.py
3890ae920fd1df39
7.45
7
from typing import Any, Dict, Awaitable from . import ( Loader, NoConvertingPathMixin, LoaderModifierMixin, J2ModifierMixin, LiqModifierMixin, ) from ..utils import require_package yaml = require_package("yaml") class YamlLoader(Loader, LoaderModifierMixin): """Yaml file loader""" def l...
pwwang/python-simpleconf
simpleconf/loaders/yaml.py
.py
22828c690179cb91
7.45
7
import sys import pytest from simpleconf.exceptions import FormatNotSupported from simpleconf.utils import ( config_to_ext, detect_loader_directive, detect_loadenv_directive, load_dotenv_file, get_loader, require_package, ) from diot import Diot pytest_plugins = ["tests.fixt_simpleconf"] @py...
pwwang/python-simpleconf
tests/test_utils.py
.py
d55c9562534bb0fb
7.95
7
""" API for running backtests on investment portfolios. This module provides a static utility class `Backtest` that wraps core backtesting functionality, including downloading portfolio history, calculating share allocations, rebalancing portfolios, and visualizing results against benchmark portfolios. """ from datet...
ajitnilakantan/backtest-portfolio
src/backtest_portfolio/api.py
.py
0371d220574925ba
7.92
6
from __future__ import annotations import os import sqlite3 import tempfile from datetime import datetime from typing import Final import pandas as pd class NullContextManager: """A safe placeholder context manager that does nothing and returns None.""" def __enter__(self) -> None: return None ...
ajitnilakantan/backtest-portfolio
src/backtest_portfolio/db_cache.py
.py
5c47826652a753ea
7.92
6
"""Holding and portfolio structures for backtesting. This module defines dataclasses and enums used to represent investment holdings and portfolios, along with default benchmark and example portfolios for backtesting scenarios. """ import re from dataclasses import dataclass, field from enum import StrEnum from typin...
ajitnilakantan/backtest-portfolio
src/backtest_portfolio/holding.py
.py
e409be7b49b0b4a5
7.92
6
"""The ``walsh`` command-line interface: ``walsh compress`` / ``walsh extract``.""" from __future__ import annotations import logging import click from walsh.exceptions import EXPECTED_ERRORS from walsh.task import ( DEFAULT_CHROMA_BLOCK_SIZE, DEFAULT_PACKED_BLOCK_SIZE, DEFAULT_Y_BLOCK_SIZE, Action,...
oskar-j/walsh-hadamard-transform
src/walsh/cli.py
.py
db376eca04b2d58f
7.42
6
"""Small caching helper used to memoise expensive matrix construction.""" from __future__ import annotations import functools from collections.abc import Callable, Hashable from typing import Any, Generic, ParamSpec, TypeVar __all__ = ["Memo", "cached"] P = ParamSpec("P") R = TypeVar("R") #: Separates positional f...
oskar-j/walsh-hadamard-transform
src/walsh/decorators.py
.py
e98b3b3bbdadb436
7.42
6
"""Exception types raised by the package, and the groupings callers act on. This module deliberately imports nothing from the rest of ``walsh``, so any module can import it without risking a cycle. """ from __future__ import annotations import struct __all__ = [ "EXPECTED_ERRORS", "UnsupportedFileFormatErro...
oskar-j/walsh-hadamard-transform
src/walsh/exceptions.py
.py
e5de502e7f75b952
7.42
6
"""The in-memory contract every raster format in this package shares.""" from __future__ import annotations from abc import ABC, abstractmethod from collections.abc import Sequence from walsh.image._io import FileSource __all__ = ["Pixel", "RasterImage"] #: One pixel as ``(red, green, blue)``, each channel a 0-255...
oskar-j/walsh-hadamard-transform
src/walsh/image/base.py
.py
6221ca5b1e0ceaef
7.42
6
"""24-bit uncompressed Windows bitmaps. BMP disagrees with this package's in-memory contract on two counts, and :class:`BMPImage` reconciles both: * pixels are stored blue-green-red, not red-green-blue; * rows are stored bottom-up when the header height is positive. A negative height means top-down, which is why th...
oskar-j/walsh-hadamard-transform
src/walsh/image/bmp.py
.py
e4e28d136e5d7324
7.42
6
"""The custom ``.cim`` container holding truncated spectral blocks. Layout: ``<II`` width and height, then three ``<HHH`` :class:`BlockDescription` records in the order Y, Cb, Cr, then each channel's blocks row-major as little-endian ``int16``. It is a project-specific format; nothing else reads it. """ from __future...
oskar-j/walsh-hadamard-transform
src/walsh/image/cim.py
.py
b42d4c749f24e70a
7.42
6
"""Portable Pixmap (PPM) images, from the Netpbm suite. PPM is the closest Unix equivalent to the uncompressed BMP this codec started with: a tiny ASCII header followed by raw samples, no compression, no palette. Two variants exist and both are read: * **P6**, binary, one byte per sample. This is what :meth:`PPMImag...
oskar-j/walsh-hadamard-transform
src/walsh/image/ppm.py
.py
b00105c7c57882ca
7.42
6
"""Uncompressed baseline TIFF images. TIFF is a container rather than a single layout, so this reader deliberately handles one profile and rejects the rest rather than guessing: uncompressed (``Compression = 1``), RGB (``PhotometricInterpretation = 2``), 8 bits per sample, three samples per pixel, chunky (``PlanarConf...
oskar-j/walsh-hadamard-transform
src/walsh/image/tiff.py
.py
4c1cfd312689edbb
7.42
6
from __future__ import annotations import struct from pathlib import Path from typing import Any import pytest from walsh.image import BMP_HEADER_FORMAT, BMP_PIXEL_OFFSET, BMP_SIGNATURE, align DATA_DIR = Path(__file__).resolve().parent.parent / "data" Pixel = tuple[int, int, int] def write_bmp(path: Path, width:...
oskar-j/walsh-hadamard-transform
tests/conftest.py
.py
67f54d20e2b12f76
7.92
6
from __future__ import annotations import numpy as np import pytest from walsh.transforms import WalshHadamardTransform, _sign_changes @pytest.fixture def transform() -> WalshHadamardTransform: return WalshHadamardTransform() @pytest.mark.parametrize("size", [2, 4, 8, 16]) def test_matrix_is_orthonormal(trans...
oskar-j/walsh-hadamard-transform
tests/test_transforms.py
.py
e8063d6354c79c60
7.92
6
"""Read and provide runtime configuration. Currently restricted to a subset of overall app configuration. """ from functools import cache from pathlib import Path from pydantic import Field from pydantic_settings import BaseSettings, SettingsConfigDict from wags_tails.utils.storage import get_data_dir from metakb.s...
cancervariants/metakb
server/src/metakb/config.py
.py
acf79d841839eff2
7.6
15
"""A module for the Harvester base class""" import logging from abc import ABC, abstractmethod from enum import StrEnum from pathlib import Path from metakb.source_data import SourceDataStore _logger = logging.getLogger(__name__) class FetchMode(StrEnum): """Define options for fetching data""" FORCE_REFRE...
cancervariants/metakb
server/src/metakb/harvesters/base.py
.py
f5838c4e48b9a2a7
7.6
15
"""Harvest data from cBioPortal studies.""" import logging import shutil import tarfile from pathlib import Path from typing import NamedTuple import pandas as pd from wags_tails.base_source import UnversionedDataSource, get_latest_local_file from wags_tails.utils.downloads import download_http from metakb.harvester...
cancervariants/metakb
server/src/metakb/harvesters/cbioportal.py
.py
1c07dce85608f32a
7.6
15
"""A module for the CIViC harvester.""" from pathlib import Path from civicpy import civic as civicpy from metakb.harvesters.base import FetchMode, Harvester class CivicHarvester(Harvester): """A class for the CIViC harvester.""" def harvest(self, fetch_mode: FetchMode = FetchMode.CHECK_STALE) -> Path: ...
cancervariants/metakb
server/src/metakb/harvesters/civic.py
.py
ff1deeec38a8938f
7.6
15
"""Fetch curated FDA pediatric oncology drug approval data. This class shouldn't need to do much other than grabbing it from the source repo and stashing it locally. """ import json from pathlib import Path import requests from ga4gh.va_spec.base import Statement from pydantic import BaseModel from wags_tails.base_s...
cancervariants/metakb
server/src/metakb/harvesters/fda_poda.py
.py
38d48865b0e81841
7.6
15
"""Fetch NCH Molecular Characterization Initiative (MCI) structured knowledge""" import json import re from pathlib import Path import requests from ga4gh.va_spec.aac_2017.models import VariantClinicalSignificanceStatement from pydantic import BaseModel from wags_tails.base_source import DataSource from wags_tails.ut...
cancervariants/metakb
server/src/metakb/harvesters/mci.py
.py
e49c98dc6a072025
7.6
15
"""A module for the Molecular Oncology Almanac harvester""" import logging from http import HTTPStatus from pathlib import Path import requests import requests_cache from metakb.harvesters.base import FetchMode, Harvester from metakb.schemas.data import MoaHarvestedData logger = logging.getLogger(__name__) class ...
cancervariants/metakb
server/src/metakb/harvesters/moa.py
.py
3fe1b4536c2fc4be
7.6
15
"""Initialize logging""" import logging from metakb.config import get_config from metakb.schemas.api import ServiceEnvironment def _quiet_upstream_libs() -> None: """Turn off debug logging for chatty upstream library loggers.""" for lib in ( "boto3", "botocore", "urllib3", "h...
cancervariants/metakb
server/src/metakb/log_config.py
.py
2f2f416588a76836
7.6
15
"""Main application entrypoint.""" import logging from collections.abc import AsyncGenerator from contextlib import asynccontextmanager from enum import StrEnum from pathlib import Path from fastapi import FastAPI, Request from fastapi.middleware.cors import CORSMiddleware from fastapi.staticfiles import StaticFiles ...
cancervariants/metakb
server/src/metakb/main.py
.py
eb86f9a37b62bf49
7.6
15
"""Declare base repository interface + associated helper functions.""" import abc from ga4gh.core.models import MappableConcept from ga4gh.va_spec.base import Statement from pydantic import BaseModel class RepositoryStats(BaseModel): """Define structure for reporting entity counts from the DB""" num_genes:...
cancervariants/metakb
server/src/metakb/repository/base.py
.py
55d79654da53b149
7.6
15
"""Provide API endpoints for meta-level service information""" from typing import Annotated from fastapi import APIRouter, Depends from metakb.config import get_config from metakb.repository.base import AbstractRepository, RepositoryStats from metakb.restapi.dependencies import get_repository from metakb.schemas.api...
cancervariants/metakb
server/src/metakb/restapi/meta.py
.py
6ea75c171d5851f7
7.6
15
"""Create schemas for API""" from enum import Enum, StrEnum from typing import Literal from ga4gh.cat_vrs import CATVRS_VERSION from ga4gh.cat_vrs import __version__ as cat_vrs_python_version from ga4gh.cat_vrs.models import CategoricalVariant from ga4gh.va_spec import VASPEC_VERSION from ga4gh.va_spec import __versi...
cancervariants/metakb
server/src/metakb/schemas/api.py
.py
729c8c799a9cd3a6
7.6
15
"""Module containing app schemas and enums""" from enum import StrEnum class SourceName(StrEnum): """Define enum for sources that are supported""" CIVIC = "civic" MOA = "moa" CBIOPORTAL = "cbioportal" FDA_PODA = "fda_poda" MCI = "mci" def as_print_case(self) -> str: """Provide e...
cancervariants/metakb
server/src/metakb/schemas/app.py
.py
ac5900ddfd4e4ace
7.6
15
"""Handle data exchange formats for ingest/loading""" from enum import StrEnum from ga4gh.va_spec.base import Statement from pydantic import BaseModel class MoaHarvestedData(BaseModel): """Define output for harvested data from MOA""" assertions: list[dict] sources: list[dict] class CBioPortalStudyNam...
cancervariants/metakb
server/src/metakb/schemas/data.py
.py
f4725aa5ed4f5bed
7.6
15
# -*- encoding: utf-8 -*- import datetime import logging import pkg_resources import re from email.utils import parseaddr, formataddr from configparser import ConfigParser, NoOptionError, NoSectionError, DuplicateSectionError logger = logging.getLogger("nikas") default_config_file = pkg_resources.resource_filename(...
Nikas-Project/Server
nikas/config.py
.py
9b2eba72c25bd5a4
7.54
11
# -*- encoding: utf-8 -*- import sqlite3 import logging import operator import os.path from collections import defaultdict logger = logging.getLogger("nikas") from nikas.db.comments import Comments from nikas.db.threads import Threads from nikas.db.spam import Guard from nikas.db.preferences import Preferences cl...
Nikas-Project/Server
nikas/db/__init__.py
.py
2f091bc73434fe15
7.54
11
# -*- encoding: utf-8 -*- import sys import os import logging from glob import glob from werkzeug.middleware.dispatcher import DispatcherMiddleware from werkzeug.wrappers import Response from nikas import make_app, wsgi, config logger = logging.getLogger("nikas") class Dispatcher(DispatcherMiddleware): """ ...
Nikas-Project/Server
nikas/dispatch.py
.py
85f5b8abb1d5737f
7.54
11
# -*- encoding: utf-8 -*- import unittest import io from nikas import config class TestConfig(unittest.TestCase): def test_parser(self): parser = config.NikasParser() parser.read_file(io.StringIO(""" [foo] bar = 1h baz = 12 spam = a, b, cdef ...
Nikas-Project/Server
nikas/tests/test_config.py
.py
636244da72f67609
7.04
11
# -*- encoding: utf-8 -*- import unittest from nikas import utils from nikas.utils import parse class TestUtils(unittest.TestCase): def test_anonymize(self): examples = [ (u'12.34.56.78', u'12.34.56.0'), (u'1234:5678:90ab:cdef:fedc:ba09:8765:4321', u'1234:5678:90ab...
Nikas-Project/Server
nikas/tests/test_utils.py
.py
61935a1ce290abc3
7.04
11
"""Find the complete documentation online. https://dfetch.rtfd.org """ import argparse import sys from collections.abc import Sequence from rich.console import Console import dfetch.commands.add import dfetch.commands.check import dfetch.commands.diff import dfetch.commands.environment import dfetch.commands.format...
dfetch-org/dfetch
dfetch/__main__.py
.py
888ab3810d7355bd
7.57
13
"""To check if your projects are up-to-date, you can let dfetch check it. For each project the local version (based on tag or revision) will be compared against the available version. If there are new versions available this will be shown. .. uml:: /static/uml/check.puml .. tabs:: .. tab:: Git .. scenario...
dfetch-org/dfetch
dfetch/commands/check.py
.py
37b2f64d21f82e8e
7.57
13
"""A generic command.""" import argparse import re import sys from abc import ABC, abstractmethod from argparse import ArgumentParser # pylint: disable=unused-import from typing import TYPE_CHECKING, TypeVar if TYPE_CHECKING and sys.version_info >= (3, 10): from typing import TypeAlias SubparserActionType: ...
dfetch-org/dfetch
dfetch/commands/command.py
.py
9c5cdcc1f111c71f
7.57
13
"""Module for common command operations.""" import os import yaml from dfetch.log import get_logger from dfetch.manifest.manifest import Manifest from dfetch.manifest.parse import get_submanifests from dfetch.manifest.project import ProjectEntry logger = get_logger(__name__) def check_sub_manifests(manifest: Mani...
dfetch-org/dfetch
dfetch/commands/common.py
.py
3e6c2c0873161abc
7.57
13
"""*Dfetch* can create a patch file with your local changes to the external project. If you've found any issues with the remote project, you can fix them within the context of your project. To help the upstream project, you can generate a patch file that can be applied by the upstream maintainer. The patch will be gen...
dfetch-org/dfetch
dfetch/commands/diff.py
.py
f13d9810740cf3ec
7.57
13
"""*Dfetch* can report information about its working environment. ``dfetch environment`` prints: * **Platform** — operating system name and kernel version. * **VCS tool versions** — the version of each supported VCS client (Git, SVN) found on ``PATH``. Run this command when setting up a new machine to confirm that...
dfetch-org/dfetch
dfetch/commands/environment.py
.py
ee0b4da23397e116
7.57
13
"""*Dfetch* can convert your Git submodules or SVN externals based project to Dfetch. Dfetch will look for all submodules or externals in the current project and generate a manifest with the current versions of the repository. After importing, you will need to remove the submodules or externals, and then you can let ...
dfetch-org/dfetch
dfetch/commands/import_.py
.py
afadbeeab868d5db
7.57
13
"""*Dfetch* can generate a starting manifest. Running ``dfetch init`` creates a ``dfetch.yaml`` file in the current directory. The file contains a minimal template that you can open and edit directly, or populate incrementally using :ref:`dfetch add <add>`. Once you have listed your dependencies, fetch them with :ref...
dfetch-org/dfetch
dfetch/commands/init.py
.py
7620818d0f37589b
7.57
13
"""Remove projects from the manifest and delete their directories. Use ``dfetch remove <project>`` to remove one or more projects. See :ref:`remove-a-project` for the full guide. .. scenario-include:: ../features/remove-project.feature """ import argparse import shutil import dfetch.commands.command from dfetch.lo...
dfetch-org/dfetch
dfetch/commands/remove.py
.py
a808feb03bb461a6
7.57
13
"""*Dfetch* can generate reports about the projects in your manifest. Two report types are available via the ``-t`` / ``--type`` flag: ``stdout`` (default) Prints a dependency inventory to the terminal. For each project it shows the remote URL, branch/tag/revision, last-fetch timestamp, applied patches, a...
dfetch-org/dfetch
dfetch/commands/report.py
.py
2bf8fe887dbf39c2
7.57
13
"""Fetch every project listed in the manifest. VCS type (Git, SVN, archive) is detected automatically. See :ref:`updating-projects` for the full guide. .. uml:: /static/uml/update.puml .. scenario-include:: ../features/fetch-git-repo.feature .. scenario-include:: ../features/fetch-svn-repo.feature .. scenario-incl...
dfetch-org/dfetch
dfetch/commands/update.py
.py
70b46ecde149eaae
7.57
13
"""Updating patches. *Dfetch* allows you to keep local changes to external projects in the form of patch files. When those local changes evolve over time, an existing patch can be updated to reflect the new state of the project. The ``update-patch`` command automates the otherwise manual process of refreshing a patch...
dfetch-org/dfetch
dfetch/commands/update_patch.py
.py
603292d8d375d912
7.57
13
"""*Dfetch* can validate a manifest without fetching anything. ``dfetch validate`` parses ``dfetch.yaml`` and checks every field against the manifest schema — project names, URLs, version strings, source paths, and integrity hashes are all verified. Any structural or type error is reported immediately with a clear mes...
dfetch-org/dfetch
dfetch/commands/validate.py
.py
cd5528b7d4b79e9c
7.57
13
"""Logging related items.""" from __future__ import annotations import logging import os import sys import types from contextlib import nullcontext from logging import LogRecord from typing import TYPE_CHECKING, Any, ClassVar, cast from rich.console import Console, ConsoleRenderable from rich.highlighter import Null...
dfetch-org/dfetch
dfetch/log.py
.py
07c89de0c8b7e5ab
7.57
13
"""Utilities for finding manifest files.""" import os import pathlib from dfetch import DEFAULT_MANIFEST_NAME from dfetch.log import get_logger from dfetch.manifest.manifest import Manifest from dfetch.util.util import ( check_no_path_traversal, find_file, prefix_runtime_exceptions, ) logger = get_logger...
dfetch-org/dfetch
dfetch/manifest/parse.py
.py
8a56f64044355e94
7.57
13
"""Remotes are the external repository where the code should be retrieved from. The ``remotes:`` section is not mandatory. If only one remote is added this is assumed to be the default. If multiple remotes are listed ``default:`` can be explicitly specified. If multiple remotes are marked as default, the first marked ...
dfetch-org/dfetch
dfetch/manifest/remote.py
.py
3f408a4873268353
7.57
13
"""Version of a project.""" from typing import NamedTuple class Version(NamedTuple): """Version of a project. In DFetch a version consists of a tag, branch or revision. A tag has precedence over branches/revisions. """ tag: str = "" branch: str = "" revision: str = "" def __eq__(se...
dfetch-org/dfetch
dfetch/manifest/version.py
.py
9903d7c2e134da9b
7.57
13
"""All Project related items.""" import os import pathlib import dfetch.manifest.project from dfetch.log import get_logger from dfetch.manifest.manifest import Manifest from dfetch.manifest.parse import find_manifest from dfetch.project.archivesubproject import ArchiveSubProject from dfetch.project.gitsubproject impo...
dfetch-org/dfetch
dfetch/project/__init__.py
.py
e3f8f7d6666161b6
7.57
13
"""Archive (tar/zip) specific implementation. Archives are a third VCS type alongside ``git`` and ``svn``. They represent versioned dependencies that are distributed as ``.tar.gz``, ``.tgz``, ``.tar.bz2``, ``.tar.xz`` or ``.zip`` files reachable via ``http://``, ``https://``, or ``file://`` URLs. Unlike git and SVN,...
dfetch-org/dfetch
dfetch/project/archivesubproject.py
.py
50b4d3bf46a58a68
7.57
13
"""Git specific implementation.""" from pathlib import Path from dfetch.log import get_logger from dfetch.manifest.project import ProjectEntry from dfetch.manifest.version import Version from dfetch.project.metadata import Dependency from dfetch.project.subproject import SubProject from dfetch.util.license import LIC...
dfetch-org/dfetch
dfetch/project/gitsubproject.py
.py
a7dc2d80e99f6cf1
7.57
13
"""Git Super project abstraction. This module provides the specific GitSuperProject class which represents a git project that contains the `dfetch.yaml` manifest file (the "super project"). """ from __future__ import annotations import os import pathlib from collections.abc import Sequence from dfetch.log import ge...
dfetch-org/dfetch
dfetch/project/gitsuperproject.py
.py
74926df590ec40cd
7.57
13
"""SVN specific implementation.""" import os import pathlib import urllib.parse from dfetch.log import get_logger from dfetch.manifest.project import ProjectEntry from dfetch.manifest.version import Version from dfetch.project.metadata import Dependency from dfetch.project.subproject import SubProject from dfetch.uti...
dfetch-org/dfetch
dfetch/project/svnsubproject.py
.py
c662c440ecca8ef3
7.57
13
"""Svn Super project abstraction. This module provides the specific SvnSuperProject class which represents a svn project that contains the `dfetch.yaml` manifest file (the "super project"). """ from __future__ import annotations import os import pathlib from collections.abc import Sequence from dfetch.log import ge...
dfetch-org/dfetch
dfetch/project/svnsuperproject.py
.py
d735460975955b27
7.57
13
"""Various reporters for generating reports.""" from enum import Enum from dfetch.reporting.reporter import Reporter from dfetch.reporting.sbom_reporter import SbomReporter from dfetch.reporting.stdout_reporter import StdoutReporter class ReportTypes(Enum): """Enum giving a name to a type of reporter.""" S...
dfetch-org/dfetch
dfetch/reporting/__init__.py
.py
33d84024270584a9
7.57
13
"""*Dfetch* can generate a report that is parsable by GitLab/Code Climate from the :ref:`check` results. Depending on the state of the projects it will create a report with information. If all project are up-to-date, nothing will be added to the report. The information has several severities: * ``major`` : An unfetc...
dfetch-org/dfetch
dfetch/reporting/check/code_climate_reporter.py
.py
52e389c4b52c17b5
7.57
13
"""*Dfetch* can generate a report that is parseable by Jenkins from the :ref:`check` results. Depending on the state of the projects, it will create a report with relevant information. If all projects are up-to-date, nothing will be added to the report. The information has several severities: * ``high`` : An unfetch...
dfetch-org/dfetch
dfetch/reporting/check/jenkins_reporter.py
.py
392f9227e687c5a6
7.57
13
"""Report issues found during check. *DFetch* can report the results of :ref:`check` in a format usable by several other tools. See the respective sections for details about using and configuring those reporters. All reports can contain the following results: * ``unfetched-project`` Project was never fetched. Fe...
dfetch-org/dfetch
dfetch/reporting/check/reporter.py
.py
cfd5607ff7cf3f16
7.57
13
"""Abstract reporting interface.""" from abc import ABC, abstractmethod from dfetch.manifest.manifest import Manifest from dfetch.manifest.project import ProjectEntry from dfetch.util.license import LicenseScanResult class Reporter(ABC): """Reporter for generating report.""" name: str = "abstract" def...
dfetch-org/dfetch
dfetch/reporting/reporter.py
.py
2f1b6935b4bf4b25
7.57
13
"""Resources needed when dfetch is distributed.""" import importlib.resources as importlib_resources from contextlib import AbstractContextManager from pathlib import Path def _resource_path(filename: str) -> AbstractContextManager[Path]: """Get the path to the resource.""" return importlib_resources.as_file...
dfetch-org/dfetch
dfetch/resources/__init__.py
.py
44c88274c821fa03
7.57
13
from __future__ import annotations from enum import Enum from typing import Any, Final, get_args, get_origin _DATAIO_METADATA_PACKAGE: Final = "fmu.datamodels" def _is_dataio(annotation: Any) -> bool: if isinstance(annotation, str): return annotation.startswith(_DATAIO_METADATA_PACKAGE) return annot...
equinor/fmu-dataio
docs/ext/pydantic_autosummary/pydantic.py
.py
b3c2417a24a64e02
7.52
10