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 typing import Sequence
import polars as pl
from polars import LazyFrame
from open_icu.callbacks.proto import AstValue, CallbackProtocol, CallbackResult, to_col_name, to_expr
from open_icu.callbacks.registry import register_callback_cls
@register_callback_cls
class DropNa(CallbackProtocol):
def __init__(sel... | aidh-ms/OpenICU | src/open_icu/callbacks/_callbacks/filter.py | .py | 9d979e0b01680267 | 7.52 | 10 |
from functools import wraps
from typing import Any, Hashable
from open_icu.callbacks.proto import CallbackProtocol
from open_icu.utils.name import camel_to_snake
class CallbackRegistry:
"""registry for callbacks."""
def __init__(self) -> None:
"""Initialize the registry storage."""
self._reg... | aidh-ms/OpenICU | src/open_icu/callbacks/registry.py | .py | 2fa8c7fbe6aab294 | 7.52 | 10 |
"""Dataset configuration inheritance across versions and variants.
A dataset version directory (``configs/datasets/<dataset>/<version>/``) may
contain an ``extends.yml`` marker that references another version as its base:
```yaml
dataset: eicu-crd
version: "2.0"
```
Configuration files in the version's subdirectorie... | aidh-ms/OpenICU | src/open_icu/config/inheritance.py | .py | ff77ec22cf79013c | 7.52 | 10 |
"""Registry system for managing configuration objects.
This module provides a generic registry class for storing, retrieving,
and persisting configuration objects, with support for loading from
and saving to YAML files.
"""
from abc import ABC
from pathlib import Path
from typing import cast
from pydantic import Val... | aidh-ms/OpenICU | src/open_icu/config/registry.py | .py | 8a8dc7419ae4e586 | 7.52 | 10 |
"""Centralized logging configuration for OpenICU.
This module provides a standardized logging setup that can be used throughout the OpenICU project.
It supports console logging with configurable levels and formats.
Usage:
# Get a logger for your module
from open_icu.logging import get_logger
logger = get... | aidh-ms/OpenICU | src/open_icu/logging.py | .py | 2979d57ce00a5b80 | 7.52 | 10 |
"""Configuration classes for processing steps.
This module defines Pydantic models for configuring processing steps,
including dataset metadata, configuration file references, and step-specific
settings.
"""
from abc import ABCMeta
from pydantic import BaseModel, Field
from open_icu.config.base import BaseConfig
... | aidh-ms/OpenICU | src/open_icu/steps/base/config.py | .py | fcec4937d4771368 | 7.52 | 10 |
"""Abstract base class for configurable processing steps.
This module defines the core abstraction for processing steps in OpenICU's
data pipeline, providing a template for extraction, transformation, and
dataset generation workflows.
"""
import shutil
from abc import ABCMeta, abstractmethod
from pathlib import Path
... | aidh-ms/OpenICU | src/open_icu/steps/base/step.py | .py | ce61de2eb1a392a1 | 7.52 | 10 |
from typing import TYPE_CHECKING, Literal, Protocol, cast
from pydantic import ConfigDict, Field, PrivateAttr, computed_field
from open_icu.config.base import BaseDatasetConfig
from open_icu.utils.importer import import_callable
if TYPE_CHECKING:
from open_icu.steps.concept.config.concept import ConceptConfig
... | aidh-ms/OpenICU | src/open_icu/steps/concept/config/complex.py | .py | 1f77b6bfae8c4f17 | 7.52 | 10 |
from pathlib import Path
from typing import Annotated, Self
import yaml
from pydantic import BaseModel, Field, TypeAdapter, ValidationError, computed_field, model_validator
from open_icu.config.base import BaseConfig
from open_icu.config.inheritance import has_extends, resolve_effective_configs
from open_icu.logging ... | aidh-ms/OpenICU | src/open_icu/steps/concept/config/concept.py | .py | 8ee10791b7259264 | 7.52 | 10 |
from typing import Literal
from pydantic import BaseModel, Field
from open_icu.config.base import BaseDatasetConfig
class MappingColumnConfig(BaseModel):
"""Configuration for a concept mapping.
Attributes:
numeric_value: Column name for numeric values
text_value: Column name for text values... | aidh-ms/OpenICU | src/open_icu/steps/concept/config/simple.py | .py | 6363bba5e90c2e33 | 7.52 | 10 |
"""Concept step configuration models.
This module defines the configuration structure for the concept step,
including dataset-specific concept configuration paths and extraction step references.
"""
from pydantic import BaseModel, Field
from open_icu.steps.base.config import BaseStepConfig
class DatasetConfig(Base... | aidh-ms/OpenICU | src/open_icu/steps/concept/config/step.py | .py | f91a0dbf5787a8eb | 7.52 | 10 |
"""KDIGO acute kidney injury staging as windowed-concept transformers.
KDIGO stages AKI on two independent criteria — serum creatinine and urine
output — and takes the higher of the two. They are implemented here as two
separate concepts, :class:`AkiCreatinineTransformer` and
:class:`AkiUrineOutputTransformer`, with :... | aidh-ms/OpenICU | src/open_icu/steps/concept/transformer/aki.py | .py | fb7692f22bb0ff8f | 7.52 | 10 |
"""Base class for complex concept transformers.
A *complex* concept is one that cannot be expressed as a mapping over a single
source table: it is computed from the output of other concepts, which the
pipeline has already harmonised and written as per-dataset parquet. This module
factors out everything such a concept ... | aidh-ms/OpenICU | src/open_icu/steps/concept/transformer/base.py | .py | 207a73e730c613fd | 7.52 | 10 |
"""SOFA sub-scores and total as thin windowed-concept transformers.
Each organ sub-score is a piecewise-constant grade (0-4) over one or two
inputs, (re)evaluated in continuous time at every contributing measurement.
All alignment and windowing lives in
:class:`~open_icu.steps.concept.transformer.windowed.WindowedConc... | aidh-ms/OpenICU | src/open_icu/steps/concept/transformer/sofa.py | .py | fde8109f026f455e | 7.52 | 10 |
"""Field configuration models for table columns.
This module defines configurations for table column definitions including
type specifications and optional type conversion parameters.
"""
from typing import Any
from polars.datatypes import DataTypeClass
from pydantic import BaseModel, ConfigDict, Field, computed_fie... | aidh-ms/OpenICU | src/open_icu/steps/extraction/config/column.py | .py | e3b5d2f8f61be257 | 7.52 | 10 |
"""Event configuration models for MEDS column mappings.
This module defines Pydantic models for configuring how source table columns
map to MEDS event columns (subject_id, time, code, numeric_value, text_value).
"""
from typing import Any
from pydantic import BaseModel, Field
def _get_or_default(data: dict[str, An... | aidh-ms/OpenICU | src/open_icu/steps/extraction/config/event.py | .py | 3036baa9d57acaa6 | 7.52 | 10 |
"""Extraction step configuration models.
This module defines the configuration structure for the extraction step,
including dataset path specifications and custom extraction settings.
"""
from pathlib import Path
from pydantic import BaseModel, Field
from open_icu.steps.base.config import BaseStepConfig
class Dat... | aidh-ms/OpenICU | src/open_icu/steps/extraction/config/step.py | .py | 32ccc9a68ba54217 | 7.52 | 10 |
"""Table configuration models for data extraction.
This module defines configurations for source tables, including column definitions,
callback transformations, join specifications, and event extraction rules.
"""
from abc import ABCMeta
from enum import StrEnum, auto
from typing import Any, ClassVar
from polars.dat... | aidh-ms/OpenICU | src/open_icu/steps/extraction/config/table.py | .py | 740be49b2599a660 | 7.52 | 10 |
"""Extraction step implementation for converting ICU data to MEDS format.
This module implements the ExtractionStep class that orchestrates the extraction
of data from source CSV files, applies transformations via callbacks, performs
joins, and outputs MEDS-compliant Parquet files.
"""
import gc
from pathlib import P... | aidh-ms/OpenICU | src/open_icu/steps/extraction/step.py | .py | 112ff4b815c44d44 | 7.52 | 10 |
"""
Date: 2023-10-23 18:24:50
LastEditors: Kumo
LastEditTime: 2024-09-28 17:05:25
Description:
"""
from .utils.logger import LoggerManager
import smtplib, ssl
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.header import Header
from email.mime.application i... | Freddd13/autoscore | auto_score/email.py | .py | 2a9731b54cb24de5 | 7.63 | 17 |
"""
Date: 2023-10-24 11:00:30
LastEditors: Kumo
LastEditTime: 2024-09-28 17:16:15
Description: New oauth2 method to send smtp mail with outlook (https://learn.microsoft.com/en-us/exchange/client-developer/legacy-protocols/how-to-authenticate-an-imap-pop-smtp-application-by-using-oauth)
"""
import microsoftgraph... | Freddd13/autoscore | auto_score/ms_auth.py | .py | e45c806e529b9565 | 7.63 | 17 |
'''
Date: 2023-10-23 23:09:59
LastEditors: Kumo
LastEditTime: 2024-09-22 19:45:46
Description:
'''
from .proxy_decorator import AUTHOR_PROXY
import requests
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
class BaseRequest:
def __init__(self):
... | Freddd13/autoscore | auto_score/utils/base_request.py | .py | fc81e4c7a4cc73dc | 7.63 | 17 |
'''
Date: 2023-10-23 18:06:56
LastEditors: Kumo
LastEditTime: 2023-10-23 18:06:56
Description:
'''
'''
Date: 2023-10-05 12:42:59
LastEditors: Kumo
LastEditTime: 2023-10-05 17:24:55
Description:
'''
import logging.config
import os
class LoggerManager:
log_dir_prefix = 'log'
def __init__(self, log_file):
... | Freddd13/autoscore | auto_score/utils/logger.py | .py | eb8f648fd5055ddd | 7.63 | 17 |
"""
Date: 2023-10-23 18:24:31
LastEditors: Kumo
LastEditTime: 2024-09-28 17:21:58
Description:
"""
from auto_score.deploy_stragegies import *
from auto_score.utils.proxy_decorator import IS_AUTHOR_ENV
from auto_score.utils.singleton import get_instance, get_handler, GetHandlers
from auto_score.utils.logge... | Freddd13/autoscore | main.py | .py | e2b7be288b2614c8 | 7.63 | 17 |
'''
Date: 2023-09-20 23:46:03
LastEditors: kumo
LastEditTime: 2023-09-20 23:55:50
Description:
'''
import os
import time
from datetime import datetime, timedelta
def update_last_success_time(latest_time_str):
# 将时间写入当前目前.last_success_time文件
with open('.last_success_time', 'w') as f:
f... | Freddd13/autoscore | test/test_local_update_time.py | .py | 62a56971e6a259a6 | 8.13 | 17 |
"""
Sanity checks for src.constants.
These guard against accidental edits that would silently break the
extension (e.g. a typo in a version identifier or an inverted threshold).
"""
from src import constants
class TestVersionIdentifiers:
"""MassCode version identifiers must stay distinct and stable."""
def... | mathe00/ulauncher-extension-masscode-integration | tests/test_constants.py | .py | bc650fa084336a53 | 7.92 | 6 |
"""
Tests for the error handler module (src.utils.error_handler).
Simple logging facade — verified through caplog capture.
"""
import logging
from src.utils.error_handler import log_debug, log_error, log_info, log_warning
class TestLogError:
"""log_error formatting combinations."""
def test_error_alone(se... | mathe00/ulauncher-extension-masscode-integration | tests/test_error_handler.py | .py | 51e5549aa221f0eb | 7.92 | 6 |
"""
Tests for load_snippets() version dispatch in src.database.loader.
The dispatcher routes to the correct backend based on masscode_version.
Unknown/legacy values must fall back to the V3 JSON loader.
"""
import pytest
from src.database.loader import load_snippets
@pytest.fixture
def spy_backends(monkeypatch):
... | mathe00/ulauncher-extension-masscode-integration | tests/test_loader_dispatch.py | .py | e6ed48ed76fc2e04 | 7.92 | 6 |
"""
Tests for the V3 JSON snippet loader (src.database.loader.load_snippets_json).
Covers:
- Happy path loading with isDeleted filtering
- Missing file, invalid JSON, wrong root type
- SQLite file passed to the V3 loader (type mismatch guard)
- Path expansion (~)
"""
import json
import os
import sqlite3
impo... | mathe00/ulauncher-extension-masscode-integration | tests/test_loader_json.py | .py | 12a2f65564779cf9 | 7.92 | 6 |
import os
import re
def check(message: str, /, *, message_type="commit message") -> str:
"""Check that message begins with valid semantic version prefix and return prefix"""
error_message = f"""{message_type[0].upper() + message_type[1:]} must contain prefix to increment semantic version
For backwards-incomp... | canonical/data-platform-workflows | _cli/data_platform_workflows_cli/check_semantic_version_prefix.py | .py | 3b141e9f70a12bd5 | 7.45 | 7 |
# Copied from https://github.com/canonical/charmcraftcache/blob/main/charmcraftcache/_platforms.py
import pathlib
import yaml
_SYNTAX_DOCS = "https://github.com/canonical/data-platform-workflows/blob/main/.github/workflows/build_charm.md#required-charmcraftyaml-syntax"
class Platform(str):
"""Platform in charmc... | canonical/data-platform-workflows | _cli/data_platform_workflows_cli/craft_tools/charmcraft_platforms.py | .py | 7e275b799fcdbd6f | 7.45 | 7 |
# Copyright 2022 Canonical Ltd.
# See LICENSE file for licensing details.
"""Collect platforms to build
charmcraft: Only ST124 shorthand notation `platforms` are supported
snapcraft: (ST124 not supported) core22 `architectures` and core24 shorthand `platforms` supported
rockcraft: (ST124 not supported) shorthand `plat... | canonical/data-platform-workflows | _cli/data_platform_workflows_cli/craft_tools/collect_platforms.py | .py | 4d2dfd7ab9aac25c | 7.45 | 7 |
import argparse
import dataclasses
import enum
import logging
import pathlib
import subprocess
import sys
import requests
import yaml
logging.basicConfig(level=logging.INFO, stream=sys.stdout)
class Direction(enum.StrEnum):
FROM = "from"
TO = "to"
class Risk(enum.StrEnum):
"""Charmhub risk"""
# I... | canonical/data-platform-workflows | _cli/data_platform_workflows_cli/craft_tools/promote_legacy_1.py | .py | 618200e2460f8d5d | 7.45 | 7 |
"""Python API for GitHub Actions
Supports:
- Workflow commands: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions
- Default environment variables: https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
Does not include support for GitHub R... | canonical/data-platform-workflows | _cli/data_platform_workflows_cli/github_actions/__init__.py | .py | fe895d1205505c27 | 7.45 | 7 |
import csv
import dataclasses
import logging
import pathlib
import re
import shutil
import sys
import requests
import yaml
logging.basicConfig(level=logging.INFO, stream=sys.stdout)
DOCS_LOCAL_PATH = pathlib.Path("docs/")
def get_topic(topic_id_: str):
"""Get markdown content of a discourse.charmhub.io topic"""... | canonical/data-platform-workflows | _cli/data_platform_workflows_cli/sync_docs.py | .py | 1f9f73cd21fe14b3 | 7.45 | 7 |
# Copyright 2022 Canonical Ltd.
# See LICENSE file for licensing details.
"""Update charm revisions in bundle YAML file"""
import argparse
import ast
import copy
import dataclasses
import json
import pathlib
import re
import subprocess
import requests
import yaml
from . import github_actions
@dataclasses.dataclass(... | canonical/data-platform-workflows | _cli/data_platform_workflows_cli/update_bundle.py | .py | 0c6fc3de115915aa | 7.45 | 7 |
"""Version-matched Agent Skills bundled with macpymessenger."""
from __future__ import annotations
import re
from dataclasses import dataclass
from importlib.resources import files
from typing import Final, Self
_SKILL_NAMES: Final = ("core",)
_MAX_SKILL_NAME_LENGTH: Final = 64
_MAX_SKILL_DESCRIPTION_LENGTH: Final =... | ethan-wickstrom/macpymessenger | src/macpymessenger/agent_skills.py | .py | 2a92a776603912d5 | 7.48 | 8 |
"""The public messaging client."""
from __future__ import annotations
import logging
from typing import TYPE_CHECKING, NamedTuple
from .delivery import MessageDelivery
from .exceptions import MessageSendError
from .templates import TemplateCallable, TemplateManager
from .transport import AppleScriptTransport
if TYP... | ethan-wickstrom/macpymessenger | src/macpymessenger/client.py | .py | 3ebd68c95d118335 | 7.48 | 8 |
"""Message delivery through one domain transport."""
from __future__ import annotations
import subprocess
from typing import TYPE_CHECKING
from .exceptions import MessageSendError
from .transport import SendRequest
if TYPE_CHECKING:
import logging
from .transport import MessageTransport
__all__ = ["Messag... | ethan-wickstrom/macpymessenger | src/macpymessenger/delivery.py | .py | 47bbf4494afca075 | 7.48 | 8 |
"""Template storage and rendering with Python 3.14 t-strings."""
from __future__ import annotations
from collections.abc import Callable, Mapping
from string.templatelib import Interpolation, Template, convert
from .exceptions import TemplateAlreadyExistsError, TemplateNotFoundError, TemplateTypeError
TemplateCalla... | ethan-wickstrom/macpymessenger | src/macpymessenger/templates.py | .py | 5dea831592b4f0fc | 7.48 | 8 |
"""Message transport for the local macOS Messages app."""
from __future__ import annotations
import base64
import subprocess
from dataclasses import dataclass
from importlib.resources import files
from typing import Protocol
from .exceptions import InvalidDelayTypeError, NegativeDelayError, ScriptNotFoundError
_OSA... | ethan-wickstrom/macpymessenger | src/macpymessenger/transport.py | .py | d850568aad12d522 | 7.48 | 8 |
import datetime
import uuid
from collections.abc import Iterable
from typing import Any, Collection, TypeVar
import polars as pl
T = TypeVar("T")
def _litify(items: Collection[Any]) -> list[pl.Expr]:
return [pl.lit(item) for item in items]
def _get_unique_name(n: int = 10) -> str:
if n < 8:
raise ... | jrycw/turtle-island | src/turtle_island/_utils.py | .py | 9a0873b94370d19a | 7.52 | 10 |
import polars as pl
__all__ = [
"make_index",
]
def _make_index(start: int, end: int | pl.Expr) -> pl.Expr:
return pl.int_range(start, end, dtype=pl.UInt32)
def make_index(offset: int = 0, *, name: str = "index") -> pl.Expr:
"""
Returns a Polars expression that creates a virtual row index.
Bor... | jrycw/turtle-island | src/turtle_island/exprs/core.py | .py | 73559e7f57645a32 | 7.52 | 10 |
import polars as pl
import pytest
from polars.testing import assert_frame_equal
import turtle_island as ti
def test_make_index(df_x):
name = "index"
expr = ti.make_index()
assert expr.meta.output_name() == name
df_ti = df_x.select(expr, pl.all())
df_pl = df_x.with_row_index()
assert_frame_... | jrycw/turtle-island | tests/exprs/test_core.py | .py | 758303399c7cba55 | 7.02 | 10 |
# Copyright (C) 2024 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, includi... | ansys/ansys-tools-visualization-interface | examples/00-basic-pyvista-examples/tree_menu.py | .py | 3c7b7cd7ea31b3f9 | 7.63 | 17 |
# Copyright (C) 2024 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, includi... | ansys/ansys-tools-visualization-interface | examples/00-basic-pyvista-examples/tree_struct.py | .py | 448dbc60b6dbbad2 | 7.63 | 17 |
# Copyright (C) 2024 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, includi... | ansys/ansys-tools-visualization-interface | src/ansys/tools/visualization_interface/backends/_base.py | .py | f6014a4dd682d4b1 | 7.63 | 17 |
# Copyright (C) 2024 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, includi... | ansys/ansys-tools-visualization-interface | src/ansys/tools/visualization_interface/backends/plotly/plotly_dash.py | .py | 13ac5d61fba53d9b | 7.63 | 17 |
# Copyright (C) 2024 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, includi... | ansys/ansys-tools-visualization-interface | src/ansys/tools/visualization_interface/backends/plotly/widgets/button_manager.py | .py | 78408018e363baa4 | 7.63 | 17 |
# Copyright (C) 2024 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, includi... | ansys/ansys-tools-visualization-interface | src/ansys/tools/visualization_interface/backends/plotly/widgets/dropdown_manager.py | .py | d7cde899d409f49f | 7.63 | 17 |
# Copyright (C) 2024 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, includi... | ansys/ansys-tools-visualization-interface | src/ansys/tools/visualization_interface/backends/pyvista/animation.py | .py | b78aa76e4be7d01d | 7.63 | 17 |
# Copyright (C) 2024 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, includi... | ansys/ansys-tools-visualization-interface | src/ansys/tools/visualization_interface/backends/pyvista/picker.py | .py | f24f11578c737a7a | 7.63 | 17 |
# Copyright (C) 2024 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, includi... | ansys/ansys-tools-visualization-interface | src/ansys/tools/visualization_interface/backends/pyvista/trame_service.py | .py | ed1a9b4b1ac14339 | 7.63 | 17 |
# Copyright (C) 2024 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, includi... | ansys/ansys-tools-visualization-interface | src/ansys/tools/visualization_interface/backends/pyvista/widgets/button.py | .py | e953550df70d9e3b | 7.63 | 17 |
# Copyright (C) 2024 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, includi... | ansys/ansys-tools-visualization-interface | src/ansys/tools/visualization_interface/backends/pyvista/widgets/dark_mode.py | .py | aca23292435948aa | 7.63 | 17 |
# Copyright (C) 2024 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, includi... | ansys/ansys-tools-visualization-interface | src/ansys/tools/visualization_interface/backends/pyvista/widgets/displace_arrows.py | .py | 000e44d7eba1781f | 7.63 | 17 |
# Copyright (C) 2024 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, includi... | ansys/ansys-tools-visualization-interface | src/ansys/tools/visualization_interface/backends/pyvista/widgets/dynamic_tree_menu.py | .py | 0788fbcee7612e97 | 7.63 | 17 |
# Copyright (C) 2024 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, includi... | ansys/ansys-tools-visualization-interface | src/ansys/tools/visualization_interface/backends/pyvista/widgets/hide_buttons.py | .py | c6ab28a8bf0b20c9 | 7.63 | 17 |
# Copyright (C) 2024 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, includi... | ansys/ansys-tools-visualization-interface | src/ansys/tools/visualization_interface/backends/pyvista/widgets/measure.py | .py | 282adea2fa1531a3 | 7.63 | 17 |
# Copyright (C) 2024 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, includi... | ansys/ansys-tools-visualization-interface | src/ansys/tools/visualization_interface/backends/pyvista/widgets/mesh_slider.py | .py | 3a0c415d0d6b0291 | 7.63 | 17 |
# Copyright (C) 2024 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, includi... | ansys/ansys-tools-visualization-interface | src/ansys/tools/visualization_interface/backends/pyvista/widgets/parallel_projection.py | .py | 7cc8e908ba371cc4 | 7.63 | 17 |
# Copyright (C) 2024 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, includi... | ansys/ansys-tools-visualization-interface | src/ansys/tools/visualization_interface/backends/pyvista/widgets/pick_rotation_center.py | .py | 7a3999679de4853e | 7.63 | 17 |
# Copyright (C) 2024 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, includi... | ansys/ansys-tools-visualization-interface | src/ansys/tools/visualization_interface/backends/pyvista/widgets/play_pause_button.py | .py | 111afdbcc298298a | 7.63 | 17 |
# Copyright (C) 2024 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, includi... | ansys/ansys-tools-visualization-interface | src/ansys/tools/visualization_interface/backends/pyvista/widgets/ruler.py | .py | 2d03d3b127a8376f | 7.63 | 17 |
import importlib.util
import os
import typing
def is_oras_py() -> bool:
"""Check if the oras Python library is available."""
return importlib.util.find_spec("oras") is not None
def _extract_hostname(reference: str) -> str:
"""Extract the registry hostname from an OCI image reference.
"""
ref = r... | containers/olot | olot/backend/oras_py.py | .py | e83239346d9d4afe | 7.63 | 17 |
import os
import shutil
import subprocess
import typing
def is_skopeo() -> bool :
return shutil.which("skopeo") is not None
def skopeo_pull(base_image: str, dest: str | os.PathLike, params: typing.Sequence[str]=()):
if isinstance(dest, os.PathLike):
dest = str(dest)
return subprocess.run(["skope... | containers/olot | olot/backend/skopeo.py | .py | ef2c66ef7777539c | 7.63 | 17 |
from collections.abc import Sequence
from enum import Enum
class CustomStrEnum(str, Enum):
"""To polyfill back to 3.9"""
@classmethod
def values(cls) -> Sequence[str]:
return [e.value for e in cls]
class RemoveOriginals(CustomStrEnum):
"""Strategy to be applied when removing original fil... | containers/olot | olot/enums.py | .py | eedfeb66a30125d4 | 7.63 | 17 |
# originally generated by datamodel-codegen:
# filename: image-manifest-schema.json
# timestamp: 2024-12-04T11:34:21+00:00
from __future__ import annotations
import logging
import os
import subprocess
from pathlib import Path
from typing import Annotated
from pydantic import BaseModel, Field
from olot.oci.oci_... | containers/olot | olot/oci/oci_image_manifest.py | .py | b928d403ad89fdba | 7.63 | 17 |
import ipaddress
import re
_host_re = re.compile(r"^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$")
# OCI reference validation patterns
# Repository component: lowercase alphanumerics with separators (., -, _, __)
# Note: __ (double underscore) must be che... | containers/olot | olot/utils/validation.py | .py | 730fc11a6c3a7a76 | 7.63 | 17 |
import os
import shutil
import subprocess
import time
from pathlib import Path
import docker # type: ignore
import pytest
from olot.backend.oras_cp import is_oras, oras_pull, oras_push
from olot.basics import oci_layers_on_top
from olot.oci.oci_image_index import read_ocilayout_root_index
from olot.oci.oci_image_lay... | containers/olot | tests/backend/test_oras_cp.py | .py | 020ca675f5a91296 | 7.13 | 17 |
import os
import shutil
import subprocess
import time
from pathlib import Path
import docker # type: ignore
import pytest
from olot.backend.oras_py import is_oras_py, oras_py_pull, oras_py_push
from olot.basics import oci_layers_on_top
from olot.oci.oci_image_index import read_ocilayout_root_index
from olot.oci.oci_... | containers/olot | tests/backend/test_oras_py.py | .py | b5f84d257c71ed48 | 7.13 | 17 |
import os
import shutil
import subprocess
import time
from pathlib import Path
import docker # type: ignore
import pytest
from olot.backend.skopeo import is_skopeo, skopeo_inspect, skopeo_pull, skopeo_push
from olot.basics import oci_layers_on_top
from olot.oci.oci_image_index import read_ocilayout_root_index
from o... | containers/olot | tests/backend/test_skopeo.py | .py | fe4c52657718519c | 7.13 | 17 |
"""
Test for Docker distribution manifest to OCI conversion.
"""
import shutil
from pathlib import Path
from pprint import pprint
from olot.basics import oci_layers_on_top
from olot.dockerdist.convert import (
check_if_oci_layout_contains_docker_manifests,
convert_docker_manifests_to_oci,
)
from tests.common ... | containers/olot | tests/dockerdist/convert_test.py | .py | 0a131a45bf9aa28f | 8.13 | 17 |
from olot.modelpack import Model
def test_model_deserialization_minimal():
"""Test that Model can deserialize a minimal JSON structure."""
json_data = {
"descriptor": {
"name": "xyz-3-8B-Instruct",
"version": "3.1"
},
"config": {},
"modelfs": {
... | containers/olot | tests/modelpack/model_config_test.py | .py | ad568600eb407c4f | 8.13 | 17 |
from olot.oci.oci_image_index import read_ocilayout_root_index
from tests.common import get_test_data_path
def test_read_ocilayout_root_index():
"""Read correctly the ocilayout_root_index in a given oci-layout
"""
ocilayout3_path = get_test_data_path() / "ocilayout3"
mut = read_ocilayout_root_index(oc... | containers/olot | tests/oci/oci_image_index_test.py | .py | ac3238c3fabd2d27 | 7.13 | 17 |
from olot.utils.validation import is_valid_oci_reference, is_valid_registry_host_port
def test_valid_ipv4_address():
"""Test valid IPv4 addresses"""
assert is_valid_registry_host_port("192.168.1.1")
assert is_valid_registry_host_port("127.0.0.1")
assert is_valid_registry_host_port("0.0.0.0")
asser... | containers/olot | tests/utils/validation_test.py | .py | 4cc7c3aa1ae9da12 | 8.13 | 17 |
# Copyright 2023-2026 GÉANT Vereniging.
# 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 w... | workfloworchestrator/lso | lso/config.py | .py | 47046436dec059c0 | 7.6 | 15 |
# Copyright 2023-2025 GÉANT Vereniging.
# 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 w... | workfloworchestrator/lso | lso/execute.py | .py | 201e7d945bbb98a9 | 7.6 | 15 |
# Copyright 2023-2026 GÉANT Vereniging.
# 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 w... | workfloworchestrator/lso | lso/playbook.py | .py | 4551e3328d99ea2b | 7.6 | 15 |
# Copyright 2023-2026 GÉANT Vereniging.
# 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 w... | workfloworchestrator/lso | lso/routes/execute.py | .py | c8c15dd785c3cc16 | 7.6 | 15 |
# Copyright 2023-2026 GÉANT Vereniging.
# 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 w... | workfloworchestrator/lso | lso/routes/playbook.py | .py | 8bd7ffbc5f448517 | 7.6 | 15 |
# Copyright 2024-2026 GÉANT Vereniging.
# 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 w... | workfloworchestrator/lso | lso/schema.py | .py | e9119ffc82320f18 | 7.6 | 15 |
# Copyright 2024-2026 GÉANT Vereniging.
# 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 w... | workfloworchestrator/lso | lso/tasks.py | .py | 972af13ebf6ac71d | 7.6 | 15 |
# Copyright 2024-2025 GÉANT Vereniging.
# 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 w... | workfloworchestrator/lso | lso/utils.py | .py | ac77d60259befde9 | 7.6 | 15 |
# Copyright 2023-2024 GÉANT Vereniging.
# 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 w... | workfloworchestrator/lso | test/conftest.py | .py | 5b51e54f335d8b2a | 8.1 | 15 |
from pathlib import Path
from unittest.mock import MagicMock, patch
from uuid import UUID
import pytest
import responses
from fastapi import status
from fastapi.testclient import TestClient
from lso.config import ExecutorType
from lso.schema import JobStatus
from test.utils import temp_executable_env
TEST_CALLBACK_U... | workfloworchestrator/lso | test/routes/test_execute.py | .py | 19d11d464e44822d | 8.1 | 15 |
# Copyright 2023-2024 GÉANT Vereniging.
# 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 w... | workfloworchestrator/lso | test/routes/test_playbook.py | .py | 980d2f7dfbdcaedf | 7.1 | 15 |
import subprocess
from pathlib import Path
from uuid import UUID
import pytest
import responses
from lso.config import ExecutorType
from lso.execute import get_executable_path, run_executable_async, run_executable_sync
from lso.schema import JobStatus
from lso.tasks import CallbackFailedError
from test.utils import t... | workfloworchestrator/lso | test/test_execute.py | .py | 77a835505a3dda70 | 8.1 | 15 |
# Copyright 2026 GÉANT Vereniging.
# 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 writin... | workfloworchestrator/lso | test/test_path_containment.py | .py | eda8680839e1f75e | 8.1 | 15 |
# Copyright 2024 GÉANT Vereniging.
# 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 writin... | workfloworchestrator/lso | test/test_playbook.py | .py | 18ac65805341e83f | 8.1 | 15 |
# Copyright 2026 GÉANT Vereniging.
# 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 writin... | workfloworchestrator/lso | test/test_worker.py | .py | ed2ee21bae0d44da | 8.1 | 15 |
import os
import shutil
import subprocess
from pathlib import Path
from .installer import Installer
from .config import (
tmp_dir,
mihomo_url,
mihomo_geodata_urls,
mihomo_bin_dir,
mihomo_config_dir,
mihomo_service_dir,
mihomo_service_content,
)
class ClashInstaller:
@staticmethod
... | stevenissleepy/dotfiles | installers/clash.py | .py | 076944be6c311a42 | 7.5 | 9 |
#!/usr/bin/env python3
import argparse
import os
import typing as t
from datetime import date, timedelta
from sefa.parser.demat.etrade import etrade_benefit_history_parser
from sefa.parser.demat.etrade import etrade_holdings_bystatus_parser
from sefa.parser.demat.indmoney import indmoney_us_stocks_parser
from sefa.pa... | atulgpt/SeFA | src/sefa/cli.py | .py | ee3d7d844dbb22a6 | 7.54 | 11 |
#!/usr/bin/env python3
"""Refresh the reference rate workbook at `RATES_FILE_ABS_PATH` from FBIL.
The ITR parser (utils/rates/rbi_rates_utils.py) reads the `RATES_SHEET_NAME`
sheet whose header sits on the third row (two title rows above it) with columns
"Date" (%d %b %Y), "Time", "Currency Pairs" (e.g. "INR / 1 USD")... | atulgpt/SeFA | src/sefa/historic_data/rates/rbi/refresh_rbi_rates.py | .py | b4ce4890707dcd40 | 7.54 | 11 |
#!/usr/bin/env python3
"""Refresh historic_data/shares/<ticker>/data.csv from Yahoo Finance via yfinance.
The ITR parser (utils/share_data_utils.py) reads a single-header CSV with a
"Date" column in %Y-%m-%d format and a "Close" column. yfinance returns a
MultiIndex column frame whose default to_csv output has extra h... | atulgpt/SeFA | src/sefa/historic_data/shares/refresh_historic_data.py | .py | 48abc2009d2eb791 | 7.54 | 11 |
from dataclasses import dataclass
import typing as t
from sefa.models.org import Organization
from sefa.utils import date_utils
from sefa.utils.date_utils import DateObj
# A key is the column heading the section A3 template states, so the type is both
# the row and the header of the file it is written to. The ITR uti... | atulgpt/SeFA | src/sefa/models/itr/faa3.py | .py | 274a0866335a4786 | 7.54 | 11 |
import typing as t
from collections.abc import MutableSequence
from sefa.models.asset_sale import AssetSale
from sefa.models.itr.faa3 import FAA3
from sefa.models.section_type import SectionType
# What a parser can hand back for a section: a realized sale for a schedule CG
# section, a foreign holding for schedule FA... | atulgpt/SeFA | src/sefa/models/section_data.py | .py | a2cf04f8fa5c33ee | 7.54 | 11 |
from dataclasses import dataclass
from sefa.utils.date_utils import DateObj
@dataclass
class Price:
price: float
currency_code: str
@dataclass
class Transaction:
date: DateObj
fmv: Price
quantity: float
def total_value(self) -> float:
"""
Value of the whole leg in the curren... | atulgpt/SeFA | src/sefa/models/transaction.py | .py | 0a59839ae2d3617e | 7.04 | 11 |
import typing as t
import pandas as pd
from sefa.utils import date_utils
from sefa.utils import logger
from sefa.utils.excel_utils import (
cell_text,
optional_cell_text,
assert_sheet_names,
to_float,
)
from sefa.models.transaction import Transaction, Price
from sefa.models.asset_sale import (
Ass... | atulgpt/SeFA | src/sefa/parser/demat/groww/groww_indian_mf_parser.py | .py | 98e46f6fda1f199e | 7.54 | 11 |
import typing as t
import pandas as pd
from sefa.utils import date_utils
from sefa.utils import logger
from sefa.utils.excel_utils import (
cell_text,
optional_cell_text,
assert_sheet_names,
to_float,
)
from sefa.models.transaction import Transaction, Price
from sefa.models.asset_sale import (
Ass... | atulgpt/SeFA | src/sefa/parser/demat/groww/groww_indian_stocks_parser.py | .py | 75c5e0fb3c14742b | 7.54 | 11 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.