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 |
|---|---|---|---|---|---|---|
"""Example showing stuff found in the cloud."""
# noqa F401
import asyncio
import logging
import os
import aiohttp # type: ignore[import-not-found]
from rich import print # type: ignore[import-not-found]
from rich.logging import RichHandler # type: ignore[import-not-found]
from intellifire4py import UnifiedFirepl... | jeeftor/intellifire4py | example_cloud_info.py | .py | 7a68997500623b33 | 7.5 | 9 |
"""Smoke test."""
import asyncio
import os
from rich import print
from intellifire4py import UnifiedFireplace
from intellifire4py.cloud_interface import IntelliFireCloudInterface
from intellifire4py.const import IntelliFireApiMode
import logging
logging.basicConfig(level=logging.DEBUG)
logging.getLogger("aiohttp")... | jeeftor/intellifire4py | example_unified_smoke_test.py | .py | 58398fdf40193247 | 8 | 9 |
"""IntelliFire CLoud API."""
from __future__ import annotations
import time
import asyncio
from datetime import datetime, timezone
from asyncio import Task
from typing import Any
import json
import aiohttp
from aiohttp import CookieJar, ClientSession, ClientTimeout
from .exceptions import CloudError
from .model impo... | jeeftor/intellifire4py | intellifire4py/cloud_api.py | .py | e357edf1be578281 | 7.5 | 9 |
"""Main API access to the Cloud enumerations for the fireplaces."""
from __future__ import annotations
import inspect
import logging
import aiohttp
from .const import USER_AGENT
from aiohttp import ClientSession
from intellifire4py import (
IntelliFireAPICloud,
IntelliFireLocations,
IntelliFireFirepla... | jeeftor/intellifire4py | intellifire4py/cloud_interface.py | .py | 5192c65ff52aa93b | 7.5 | 9 |
"""Constants and Globals."""
from enum import Enum
from aenum import MultiValueEnum
import importlib.metadata
PACKAGE_VERSION = importlib.metadata.version("intellifire4py")
USER_AGENT = f"intellifire4py/{PACKAGE_VERSION}"
class IntelliFireApiMode(Enum):
"""API Operation Mode (Local or Cloud)."""
LOCAL =... | jeeftor/intellifire4py | intellifire4py/const.py | .py | a12802040288e7fd | 7.5 | 9 |
"""IntelliFire Control Logic."""
from __future__ import annotations
from datetime import datetime
from .const import IntelliFireCommand, IntelliFireApiMode
from abc import ABC, abstractmethod
from .model import IntelliFirePollData
class IntelliFireController(ABC):
"""Abstract base class to allow for the contr... | jeeftor/intellifire4py | intellifire4py/control.py | .py | de710ef2365d61ca | 7.5 | 9 |
"""IntelliFire Exceptions."""
class CloudError(Exception):
"""Error with the API call."""
class InputRangError(Exception):
"""Input out of bounds."""
def __init__(self, field: str, min_value: int, max_value: int):
"""Initialize the exception."""
self.message = (
f"{field} is... | jeeftor/intellifire4py | intellifire4py/exceptions.py | .py | 9ab18d99efca6c03 | 7 | 9 |
"""Model definitions."""
from __future__ import annotations
from http.cookies import SimpleCookie
from pydantic import ConfigDict, Field
from pydantic import BaseModel
from .const import IntelliFireErrorCode, IntelliFireApiMode
from aiohttp import CookieJar
class IntelliFirePollData(BaseModel):
"""Base model ... | jeeftor/intellifire4py | intellifire4py/model.py | .py | d29be5169f3eebb5 | 7.5 | 9 |
"""IntelliFire abstract read class."""
from __future__ import annotations
from abc import ABC, abstractmethod
from datetime import datetime
from .model import IntelliFirePollData
class IntelliFireDataProvider(ABC):
"""Abstract base class to provide read logic."""
def __init__(self) -> None:
"""Def... | jeeftor/intellifire4py | intellifire4py/read.py | .py | b7a1fd0e9f7d908b | 7.5 | 9 |
"""UDP utilities and protocols for intellifire4py."""
import asyncio
import json
import socket
from typing import Any
import logging
_log = logging.getLogger(__name__)
class IFTDiscoveryReaderProtocol(asyncio.DatagramProtocol):
"""UPD Reader protocol for IFT Discovery.
When testing this you can fire off a ... | jeeftor/intellifire4py | intellifire4py/udp.py | .py | 8cc4fc8b69972783 | 7.5 | 9 |
"""Utility functions."""
from .const import IntelliFireCommand
from .exceptions import InputRangError
def _range_check(command: IntelliFireCommand, value: int) -> None:
"""Perform a value range check.
Args:
command (IntelliFireCommand): The command enum.
value (int): The value to be checked.... | jeeftor/intellifire4py | intellifire4py/utils.py | .py | 99a46bc1f3419bf3 | 7.5 | 9 |
"""Shared config file."""
import asyncio
import os
from collections.abc import Generator
from contextlib import ExitStack
from unittest.mock import patch, AsyncMock
import aiohttp
import pytest
from aioresponses import aioresponses
from intellifire4py.const import IntelliFireApiMode
from intellifire4py.model import ... | jeeftor/intellifire4py | tests/conftest.py | .py | 5e0b1253810ef0d6 | 7 | 9 |
"""Extended tests for cloud_api.py to improve coverage."""
import pytest
import json
import pytest_asyncio
from aiohttp import CookieJar, ClientResponseError, RequestInfo
from aioresponses import aioresponses
from multidict import CIMultiDict, CIMultiDictProxy
from yarl import URL
from intellifire4py.cloud_api import... | jeeftor/intellifire4py | tests/test_cloud_api_extended.py | .py | 275347825c732c03 | 7 | 9 |
"""Extended tests for cloud_interface.py to improve coverage."""
import pytest
from aiohttp import ClientError
from aioresponses import aioresponses
from intellifire4py.cloud_interface import IntelliFireCloudInterface
from intellifire4py.exceptions import LoginError
@pytest.mark.asyncio
async def test_login_with_cr... | jeeftor/intellifire4py | tests/test_cloud_interface_extended.py | .py | ea08a1ee8e6657d8 | 8 | 9 |
"""Basic error code test case."""
from unittest import TestCase
from intellifire4py.const import IntelliFireErrorCode
class TestErrors(TestCase):
"""Test Case."""
def test_errors(self) -> None:
"""Test Function."""
e = IntelliFireErrorCode(642)
assert e == IntelliFireErrorCode.OFFLI... | jeeftor/intellifire4py | tests/test_const.py | .py | c433cb808ee71937 | 8 | 9 |
"""Test enums and constants for intellifire4py."""
def test_enums_and_constants():
"""Test enums and constants for coverage."""
from intellifire4py import const
# Cover version and user agent
assert isinstance(const.PACKAGE_VERSION, str)
assert isinstance(const.USER_AGENT, str)
# Cover enums
... | jeeftor/intellifire4py | tests/test_const_enum.py | .py | 8a7c7c2f124bf036 | 7 | 9 |
"""Test control module for intellifire4py."""
import pytest
from intellifire4py.const import IntelliFireApiMode, IntelliFireCommand
from intellifire4py.control import IntelliFireController
class DummyController(IntelliFireController):
"""Dummy controller for testing."""
async def send_command(self, command,... | jeeftor/intellifire4py | tests/test_control.py | .py | 3533f16effb1c440 | 8 | 9 |
"""Additional tests to boost coverage for remaining uncovered lines."""
import pytest
import pytest_asyncio
import asyncio
from unittest.mock import AsyncMock, MagicMock, patch
from aiohttp import CookieJar, ClientResponseError, RequestInfo
from aioresponses import aioresponses
from multidict import CIMultiDict, CIMul... | jeeftor/intellifire4py | tests/test_coverage_boost.py | .py | ded9519ddf689fb7 | 7 | 9 |
"""Tests for intellifire4py development utilities."""
import asyncio
import pytest
from unittest.mock import patch, MagicMock, AsyncMock
from intellifire4py.const import IntelliFireApiMode
from intellifire4py.model import IntelliFirePollData
@pytest.fixture
def mock_fp(mock_common_data_local, local_poll_json):
... | jeeftor/intellifire4py | tests/test_dev.py | .py | f79cafab730ebc97 | 8 | 9 |
"""Test exceptions for intellifire4py."""
import pytest
from intellifire4py.exceptions import CloudError, InputRangError
def test_cloud_error():
"""Test CloudError exception."""
with pytest.raises(CloudError):
raise CloudError("API call failed")
def test_input_range_error():
"""Test InputRangEr... | jeeftor/intellifire4py | tests/test_exceptions.py | .py | 3c62c539320a1729 | 8 | 9 |
"""Test Local API Calls."""
from __future__ import annotations
from json import JSONDecodeError
import aiohttp
import asyncio
import pytest
from unittest.mock import patch, AsyncMock
from intellifire4py import UnifiedFireplace
from intellifire4py.cloud_interface import IntelliFireCloudInterface
from intellifire4py.... | jeeftor/intellifire4py | tests/test_local_api.py | .py | e6fcda6e67162c3f | 8 | 9 |
"""Extended tests for local_api.py to improve coverage."""
import pytest
import asyncio
from unittest.mock import AsyncMock, patch
from aioresponses import aioresponses
import aiohttp
from intellifire4py.local_api import IntelliFireAPILocal
@pytest.fixture
def local_api():
"""Create a local API instance for tes... | jeeftor/intellifire4py | tests/test_local_api_extended.py | .py | d3f75635a76e9663 | 7 | 9 |
"""Test File."""
from pydantic import ValidationError
from intellifire4py.model import IntelliFirePollData
def test_json_files(local_poll_json: str, poll_response_text_error_6_642: str) -> None:
"""Test Function."""
for json_text in [local_poll_json, poll_response_text_error_6_642]:
try:
... | jeeftor/intellifire4py | tests/test_model.py | .py | 21628bc042ad9e19 | 8 | 9 |
"""Test IntelliFirePollData dataclass for intellifire4py."""
from intellifire4py.model import IntelliFirePollData
def test_poll_data_properties():
"""Test properties and methods of IntelliFirePollData."""
d = IntelliFirePollData()
# Access all properties and methods
assert hasattr(d, "serial")
# ... | jeeftor/intellifire4py | tests/test_model_dataclass.py | .py | cef2bd6bac64981f | 7 | 9 |
"""Test IntelliFireDataProvider and related read logic for intellifire4py."""
from datetime import datetime, timezone
from intellifire4py.read import IntelliFireDataProvider
from intellifire4py.model import IntelliFirePollData
class DummyProvider(IntelliFireDataProvider):
"""Dummy provider for testing."""
@... | jeeftor/intellifire4py | tests/test_read.py | .py | bb01b7dcc51a5047 | 8 | 9 |
"""Test UDP discovery and protocol for intellifire4py."""
import asyncio
import json
import pytest
from unittest import mock
from intellifire4py.udp import (
IFTDiscoveryReaderProtocol,
IFTDiscoverySenderProtocol,
UDPFireplaceFinder,
)
@pytest.mark.asyncio
async def test_ift_discovery_reader_protocol_add... | jeeftor/intellifire4py | tests/test_udp.py | .py | c2e58b3b452c025a | 8 | 9 |
"""Unified tests."""
import logging
from unittest.mock import patch, PropertyMock, AsyncMock
import pytest
from aiohttp import ClientError
from intellifire4py import UnifiedFireplace
from intellifire4py.cloud_interface import IntelliFireCloudInterface
from intellifire4py.const import IntelliFireApiMode
@pytest.ma... | jeeftor/intellifire4py | tests/test_unified.py | .py | 3eb983f2a0ceba1a | 7 | 9 |
"""Tests for utils.py."""
from intellifire4py.utils import _range_check, _convert_aiohttp_response_to_curl
from intellifire4py.const import IntelliFireCommand
from intellifire4py.exceptions import InputRangError
import pytest
def test_valid_range() -> None:
"""Test with a valid value within the range."""
com... | jeeftor/intellifire4py | tests/test_utils.py | .py | 5c03a56e883293e1 | 7 | 9 |
"""
Minimal auto review example for single-document submissions.
"""
from operator import attrgetter
from typing import Any
from indico import IndicoClient
from indico.filters import SubmissionFilter
from indico.queries import ListSubmissions, RetrieveStorageObject, SubmitReview
from indico_toolkit import results
... | IndicoDelivery/indico-toolkit-python | examples/results_autoreview.py | .py | ae8abf785e6ea462 | 7.5 | 9 |
"""
Dump classifications and extractions from result files to a CSV file.
"""
import csv
from collections.abc import Iterable, Iterator
from pathlib import Path
import arguably
from indico_toolkit import results
def final_predictions(result: results.Result) -> Iterator[dict[str, object]]:
for prediction in res... | IndicoDelivery/indico-toolkit-python | examples/results_to_csv.py | .py | f656b43c90e0fea2 | 7.5 | 9 |
from abc import ABC, abstractmethod
from collections import defaultdict
from typing import Dict, List, Union
from ..types import Extractions
class Association(ABC):
"""
Base class for matching tokens to extraction predictions.
"""
def __init__(self, predictions: Union[List[dict], Extractions]):
... | IndicoDelivery/indico-toolkit-python | indico_toolkit/association/association.py | .py | 1cf5e22fd5710c77 | 7.5 | 9 |
from typing import List, Union
from ..types import Extractions
from .association import Association, _check_if_token_match_found, sequences_overlap
# TODO: add test that 'errored_predictions' actually works with ValueErrors
class ExtractedTokens(Association):
"""
Class to collect all extracted tokens, e.g. ... | IndicoDelivery/indico-toolkit-python | indico_toolkit/association/extracted_tokens.py | .py | ceb49ad27251a2b3 | 7.5 | 9 |
"""Associate row items"""
from collections import defaultdict
from copy import deepcopy
from typing import Iterable, List, Union
from ..types import Extractions
from .association import Association, _check_if_token_match_found, sequences_overlap
class LineItems(Association):
"""
Class for associating line i... | IndicoDelivery/indico-toolkit-python | indico_toolkit/association/line_items.py | .py | e5b00360ed78ccc6 | 7.5 | 9 |
from typing import Callable, Dict, List
class AutoReviewFunction:
"""
Class for hosting functions to manipulate predictions before sending to
auto review
Args:
function (Callable): method to be invoked when applying reviews.
The Callable must have the following arguments in the fo... | IndicoDelivery/indico-toolkit-python | indico_toolkit/auto_review/auto_reviewer.py | .py | 83f35e41cf2874bb | 7.5 | 9 |
from dataclasses import dataclass
from typing import Final
from .utils import get
@dataclass(frozen=True)
class Box:
page: int
top: int
left: int
right: int
bottom: int
def __bool__(self) -> bool:
return self != NULL_BOX
def __and__(self, other: "Box") -> "Box":
"""
... | IndicoDelivery/indico-toolkit-python | indico_toolkit/etloutput/box.py | .py | 02425fbbd3fc2719 | 7.5 | 9 |
from dataclasses import dataclass
from enum import Enum
from typing import Final
from .box import NULL_BOX, Box
from .range import NULL_RANGE, Range
from .span import NULL_SPAN, Span
from .utils import get
class CellType(Enum):
HEADER = "header"
CONTENT = "content"
@dataclass(frozen=True)
class Cell:
t... | IndicoDelivery/indico-toolkit-python | indico_toolkit/etloutput/cell.py | .py | 37a94bc52ba34d19 | 7.5 | 9 |
import itertools
from bisect import bisect_left, bisect_right
from collections import namedtuple
from dataclasses import dataclass
from functools import cached_property
from operator import attrgetter
from typing import TYPE_CHECKING
from .box import Box
from .table import Table
from .token import NULL_TOKEN, Token
i... | IndicoDelivery/indico-toolkit-python | indico_toolkit/etloutput/etloutput.py | .py | 24d08274cf35b044 | 7.5 | 9 |
from dataclasses import dataclass
from typing import Final
from .utils import get
@dataclass(order=True, frozen=True)
class Range:
row: int
column: int
rowspan: int
columnspan: int
rows: "tuple[int, ...]"
columns: "tuple[int, ...]"
def __bool__(self) -> bool:
return self != NULL_... | IndicoDelivery/indico-toolkit-python | indico_toolkit/etloutput/range.py | .py | f3ea3febc8c7cecf | 7.5 | 9 |
from dataclasses import dataclass
from typing import Any, Final
from .utils import get
@dataclass(order=True, frozen=True)
class Span:
page: int
start: int
end: int
@property
def slice(self) -> slice:
return slice(self.start, self.end)
def __bool__(self) -> bool:
return self... | IndicoDelivery/indico-toolkit-python | indico_toolkit/etloutput/span.py | .py | 98aa599d671522e4 | 7.5 | 9 |
from dataclasses import dataclass
from operator import attrgetter
from typing import Final
from .box import NULL_BOX, Box
from .cell import Cell
from .span import NULL_SPAN, Span
from .utils import get
@dataclass(frozen=True)
class Table:
box: Box
spans: "tuple[Span, ...]"
cells: "tuple[Cell, ...]"
r... | IndicoDelivery/indico-toolkit-python | indico_toolkit/etloutput/table.py | .py | 7be7f8fa3789f210 | 7.5 | 9 |
from dataclasses import dataclass
from typing import Final
from .box import NULL_BOX, Box
from .span import NULL_SPAN, Span
from .utils import get
@dataclass(frozen=True)
class Token:
text: str
box: Box
span: Span
def __bool__(self) -> bool:
return self != NULL_TOKEN
@staticmethod
d... | IndicoDelivery/indico-toolkit-python | indico_toolkit/etloutput/token.py | .py | 7889971dd550a7ca | 7.5 | 9 |
import json
from typing import Any, TypeVar
Value = TypeVar("Value")
def get(value: object, value_type: "type[Value]", *keys: "str | int") -> Value:
"""
Return the value of type `value_type` obtained by traversing `value` using `keys`.
Raise an error if a key doesn't exist or the value has the wrong type... | IndicoDelivery/indico-toolkit-python | indico_toolkit/etloutput/utils.py | .py | c1fe8978d1138c78 | 7.5 | 9 |
import os
from io import StringIO
from indico import IndicoClient, IndicoRequestError
from indico.queries import (
CreateExport,
DownloadExport,
GraphQLRequest,
RetrieveStorageObject,
)
from indico.types.export import Export
from ..errors import ToolkitInputError
from ..retry import retry
try:
im... | IndicoDelivery/indico-toolkit-python | indico_toolkit/indico_wrapper/download.py | .py | c49e8d18690c6814 | 7.5 | 9 |
from typing import List, Union
from indico import IndicoClient
from indico.errors import IndicoRequestError
from indico.queries import (
AddModelGroupComponent,
CreateStorageURLs,
GraphQLRequest,
JobStatus,
ModelGroupPredict,
RetrieveStorageObject,
)
from indico.types import Dataset, ModelGroup... | IndicoDelivery/indico-toolkit-python | indico_toolkit/indico_wrapper/indico_wrapper.py | .py | 635d90e714fa35f0 | 7.5 | 9 |
import json
from typing import Iterator
from indico import IndicoClient
from indico.queries import GraphQLRequest
# valid model option parameters
TEXT_EXTRACTION_PARAMS = {
"max_empty_chunk_ratio": lambda value: 0 <= value <= 1.0e5,
"auto_negative_scaling": [True, False],
"optimize_for": [
"predic... | IndicoDelivery/indico-toolkit-python | indico_toolkit/indico_wrapper/modelop.py | .py | 95231bb9c80b04bf | 7.5 | 9 |
import io
from os import PathLike
from typing import Dict, List, Union
from indico import IndicoClient
from indico.queries import (
GetSubmission,
GetWorkflow,
JobStatus,
ListSubmissions,
Submission,
SubmissionFilter,
SubmitReview,
UpdateSubmission,
UpdateWorkflowSettings,
WaitF... | IndicoDelivery/indico-toolkit-python | indico_toolkit/indico_wrapper/workflow.py | .py | f9145fa6ad601298 | 7.5 | 9 |
from typing import List
from ..association.association import sequences_exact, sequences_overlap
from ..errors import ToolkitInputError
from ..types.extractions import Extractions
class CompareGroundTruth:
"""
Compare a set of ground truths against a set of model predictions on a per document
basis.
... | IndicoDelivery/indico-toolkit-python | indico_toolkit/metrics/compare_ground_truth.py | .py | 8c60060fc527c74b | 7.5 | 9 |
from collections import namedtuple
from typing import List, Set, Tuple
from indico import IndicoClient
from ..errors import ToolkitInputError
from .metrics import ExtractionMetrics
from .plotting import Plotting
try:
import pandas as pd
_PANDAS_INSTALLED = True
except ImportError as error:
_PANDAS_INSTA... | IndicoDelivery/indico-toolkit-python | indico_toolkit/metrics/compare_models.py | .py | ca046f7fb3332380 | 7.5 | 9 |
from typing import Iterable, Union
try:
import plotly as py
import plotly.graph_objects as go
_PLOTLY_INSTALLED = True
except ImportError as error:
_PLOTLY_INSTALLED = False
_IMPORT_ERROR = error
class Plotting:
def __init__(self):
if not _PLOTLY_INSTALLED:
raise RuntimeE... | IndicoDelivery/indico-toolkit-python | indico_toolkit/metrics/plotting.py | .py | c6cd3dfc402e88a3 | 7.5 | 9 |
import json
import os
import shutil
from os.path import isfile
from pathlib import Path
from typing import Iterable, List, Tuple, Union
class FileProcessing:
"""
Class to support common file processing operations
"""
def __init__(self, file_paths: List[str] = None):
if file_paths is None:
... | IndicoDelivery/indico-toolkit-python | indico_toolkit/pipelines/file_processing.py | .py | 681323a3083f3ef5 | 7.5 | 9 |
#!/usr/bin/env python3
#
# Designed and developed by 2026 ashtanko (Oleksii Shtanko)
#
# 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 ... | ashtanko/compose-android-template | scripts/localization/cli.py | .py | 1421868d4b1d7b5e | 7.52 | 10 |
#!/usr/bin/env python3
#
# Designed and developed by 2026 ashtanko (Oleksii Shtanko)
#
# 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 ... | ashtanko/compose-android-template | scripts/localization/exchange.py | .py | bd4778a6fdc9b394 | 7.52 | 10 |
#!/usr/bin/env python3
#
# Designed and developed by 2026 ashtanko (Oleksii Shtanko)
#
# 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 ... | ashtanko/compose-android-template | scripts/localization/orphans.py | .py | 6ac4f07c4fbde100 | 7.52 | 10 |
#!/usr/bin/env python3
#
# Designed and developed by 2026 ashtanko (Oleksii Shtanko)
#
# 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 ... | ashtanko/compose-android-template | scripts/localization/report.py | .py | 19bad596d065f7e6 | 7.52 | 10 |
#!/usr/bin/env python3
#
# Designed and developed by 2026 ashtanko (Oleksii Shtanko)
#
# 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 ... | ashtanko/compose-android-template | scripts/localization/warnings.py | .py | e320a9f3be5b65df | 7.52 | 10 |
#!/usr/bin/env python3
#
# Designed and developed by 2026 ashtanko (Oleksii Shtanko)
#
# 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 ... | ashtanko/compose-android-template | scripts/localization/web.py | .py | 2e1cbde576a0aee9 | 7.52 | 10 |
#!/usr/bin/env python3
#
# Designed and developed by 2026 ashtanko (Oleksii Shtanko)
#
# 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 ... | ashtanko/compose-android-template | scripts/localization/writer.py | .py | 035afe53717eaaea | 7.52 | 10 |
#!/usr/bin/env python3
#
# Designed and developed by 2026 ashtanko (Oleksii Shtanko)
#
# 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 ... | ashtanko/compose-android-template | scripts/tests/test_exchange.py | .py | e5de2acbffce49a0 | 8.02 | 10 |
#!/usr/bin/env python3
#
# Designed and developed by 2026 ashtanko (Oleksii Shtanko)
#
# 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 ... | ashtanko/compose-android-template | scripts/tests/test_localization.py | .py | 832e97dacfa703bd | 8.02 | 10 |
#!/usr/bin/env python3
#
# Designed and developed by 2026 ashtanko (Oleksii Shtanko)
#
# 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 ... | ashtanko/compose-android-template | scripts/tests/test_orphans.py | .py | 961197ba3abee6c7 | 8.02 | 10 |
#!/usr/bin/env python3
#
# Designed and developed by 2026 ashtanko (Oleksii Shtanko)
#
# 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 ... | ashtanko/compose-android-template | scripts/tests/test_report.py | .py | 2b23f925d9cf97ed | 8.02 | 10 |
#!/usr/bin/env python3
#
# Designed and developed by 2026 ashtanko (Oleksii Shtanko)
#
# 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 ... | ashtanko/compose-android-template | scripts/tests/test_warnings.py | .py | 12baa6a74b5a905e | 7.02 | 10 |
#!/usr/bin/env python3
#
# Designed and developed by 2026 ashtanko (Oleksii Shtanko)
#
# 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 ... | ashtanko/compose-android-template | scripts/tests/test_web.py | .py | e4459ba307eed35a | 8.02 | 10 |
#!/usr/bin/env python3
#
# Designed and developed by 2026 ashtanko (Oleksii Shtanko)
#
# 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 ... | ashtanko/compose-android-template | scripts/tests/test_writer.py | .py | 562801a5b85f0cc2 | 8.02 | 10 |
"""Parsing and validation for Telegram bot commands."""
import re
def showhelp():
return (
"How to use Meido\n\n"
"Tap “Get anime” for the guided button flow, or use the quick "
"command:\n"
"/getanime <name>, <season>, <episode>\n\n"
"Example:\n"
"/getanime Death ... | Araon/Meido | bot/commands.py | .py | f232ac649d452b5d | 7.62 | 16 |
"""Stable contracts shared by the worker and downloader adapters."""
from dataclasses import dataclass
from enum import Enum
from pathlib import Path
from typing import Callable
@dataclass(frozen=True)
class DownloadRequest:
title: str
season: int
episode: int
output_dir: Path
request_id: str
... | Araon/Meido | downloaderService/contracts.py | .py | 0237f82400ad87b8 | 7.62 | 16 |
import os
from os.path import basename, join
from pathlib import Path
from docx import ImagePart, Document
from pofile import get_files, mkdir
from poprogress import simple_progress
from win32com import client
from win32com.client import constants, gencache
class MainWord():
def __init__(self):
self.app... | CoderWanFeng/poword | poword/core/WordType.py | .py | b4c173fe2d6cd3e7 | 7.45 | 7 |
import os
import shutil
import stat
from pathlib import Path
import subprocess
import tomllib
from pathlib import Path
import glob
import yaml
def copy_file(path: str, source_folder: str, target_folder: str) -> None:
"""Copy file from a path in 'source_folder' to the same path inside 'target_folder'."""
head,... | FraunhIEE-UniKassel-PowSysStability/powfacpy | meta/helpers.py | .py | 640e05e6f9b78d6f | 7.59 | 14 |
from powfacpy.base.active_project import ActiveProjectCached, ActiveProject
from powfacpy.pf_class_protocols import PFApp
class ApplicationBase:
"""Base class for applications. Allows to create versions with
- ActiveProjectCached (recommended when only one project stays active)
- or ActiveProject (recomme... | FraunhIEE-UniKassel-PowSysStability/powfacpy | src/powfacpy/applications/application_base.py | .py | fa418cb2fb7cca14 | 7.59 | 14 |
"""Module to cache attributes and methods of PF objects to improve performance.
"""
from powfacpy.pf_classes.protocols import PFGeneral
def cache_attr(obj: PFGeneral, attr: str):
obj.__dict__[attr] = obj.__getattr__(attr)
def cache_attrs(obj: PFGeneral, attrs: list[str]):
for attr in attrs:
obj.__... | FraunhIEE-UniKassel-PowSysStability/powfacpy | src/powfacpy/applications/caching.py | .py | 243fd7278358465d | 7.59 | 14 |
""" """
from __future__ import annotations
import sys, os, shutil
from fnmatch import fnmatchcase
from typing import Callable, Iterable, Any, OrderedDict
import importlib, inspect
import copy
import markdown
from markdown.extensions.toc import slugify
from pathlib import Path
import pandas as pd
import numpy as np
f... | FraunhIEE-UniKassel-PowSysStability/powfacpy | src/powfacpy/applications/dynamic_model_docs.py | .py | f7ed498a96e23f67 | 7.59 | 14 |
"""
This module provides an interface to import/export data in CGMES format.
"""
from powfacpy.applications.application_base import ApplicationBase
from powfacpy.pf_classes.protocols import PFApp, CimArchive, ElmNet
class CGMES(ApplicationBase):
"""Interface for CGMES integration in PowerFactory."""
def __i... | FraunhIEE-UniKassel-PowSysStability/powfacpy | src/powfacpy/applications/model_exchange.py | .py | 9d9940ef3face011 | 7.59 | 14 |
"""
Interface with pandapower.
Tutorial on internal data structure and matrices of pandapower: https://github.com/e2nIEE/pandapower/blob/develop/tutorials/internal_datastructure.ipynb
"""
from abc import abstractmethod
from typing import Callable
import copy
import pandapower as pp
from pandapower.converter.powerfact... | FraunhIEE-UniKassel-PowSysStability/powfacpy | src/powfacpy/applications/pandapower_interface.py | .py | d78d79dbe376b682 | 7.59 | 14 |
from typing import Any, Callable, Generator
import math
import numpy as np
from icecream import ic
from powfacpy.applications.application_base import ApplicationBase
from powfacpy.applications.dynamic_simulation import DynamicSimulation
from powfacpy.applications.results import Results
from powfacpy.pf_classes.protoco... | FraunhIEE-UniKassel-PowSysStability/powfacpy | src/powfacpy/applications/parameter_studies.py | .py | 51e4aba3736ec5ea | 7.59 | 14 |
"""Module with interface for static calculations (load flow, short circuits,..)"""
from warnings import warn
from os import getcwd, remove
import pandas as pd
import numpy as np
from icecream import ic
from powfacpy.applications.application_base import ApplicationBase
from powfacpy.applications.results import Resul... | FraunhIEE-UniKassel-PowSysStability/powfacpy | src/powfacpy/applications/static_calc.py | .py | 75b6442ed7204bf9 | 7.59 | 14 |
from __future__ import annotations
from functools import cached_property
from abc import ABC, abstractmethod
from collections.abc import Iterator
import numpy as np
import pandas as pd
from icecream import ic
from powfacpy.applications.application_base import ApplicationBase
from powfacpy.pf_class_protocols impor... | FraunhIEE-UniKassel-PowSysStability/powfacpy | src/powfacpy/applications/subsystems.py | .py | f05c59a189fb0410 | 7.59 | 14 |
from __future__ import annotations
from icecream import ic
from powfacpy.pf_classes.protocols import PFGeneral
from powfacpy.applications.caching import (
cache_attr,
cache_method,
)
class BaseObjectStatic:
"""Base class that can be used to store a PF object (in attribute '_obj'). Adds functionality for... | FraunhIEE-UniKassel-PowSysStability/powfacpy | src/powfacpy/base/base.py | .py | 835708071462ba34 | 7.59 | 14 |
"""Functional interface.
powfacpy is mainly object oriented and builds upon base classes like 'Folder' or 'ActiveProject'.
This is a collection of helper functions (utils) to be used as an alternative and that can be more performant (for example, only PF objects are accepted and not their path string).
"""
from typi... | FraunhIEE-UniKassel-PowSysStability/powfacpy | src/powfacpy/base/functional.py | .py | d8f8fe2184145533 | 7.59 | 14 |
import re
from powfacpy.pf_class_protocols import PFApp
class PFStringManipulation:
"""Class to manipulate strings in the PF context."""
@staticmethod
def replace_between_characters(
char1: str, char2: str, replacement: str, original: str
):
"""Replace between 'char1' and 'char2' in... | FraunhIEE-UniKassel-PowSysStability/powfacpy | src/powfacpy/base/string_manipulation.py | .py | d02cd3df1631ce21 | 7.59 | 14 |
"""Helper functions in the electrical and power engineering domain."""
import math
import numpy as np
from numpy import ndarray
def get_R_and_X_from_RX_ratio(RX_ratio, Z_abs):
"""Get the resistor and reactance from R/X-ratio
and absolte impedance.
Derivation:
sqrt(R^2 + X^2) = Z_abs
--> sqrt((X... | FraunhIEE-UniKassel-PowSysStability/powfacpy | src/powfacpy/engineering_helpers.py | .py | 070d66f4204ccd45 | 7.59 | 14 |
"""
The name 'def' is not allowed for python modules, so the module is named 'definition'.
"""
from __future__ import annotations
from typing import Any, Callable
import re
import math
from numpy import diff
from icecream import ic
from powfacpy.base.active_project import ActiveProjectCached
from powfacpy.base.base ... | FraunhIEE-UniKassel-PowSysStability/powfacpy | src/powfacpy/pf_classes/blk/definition.py | .py | f6e22e60c71e0455 | 7.59 | 14 |
from __future__ import annotations
from typing import Any, Callable
from numpy import diff
from icecream import ic
from powfacpy.base.active_project import ActiveProjectCached
from powfacpy.base.base import BaseChildStatic
from powfacpy.pf_classes.protocols import BlkSlot
class Slot(BaseChildStatic):
def __ini... | FraunhIEE-UniKassel-PowSysStability/powfacpy | src/powfacpy/pf_classes/blk/slot.py | .py | 1e5cd43a4582c3cf | 7.59 | 14 |
from __future__ import annotations
import numpy as np
from powfacpy.pf_classes.protocols import ElmArea, ElmTerm, PFGeneral
from powfacpy.pf_classes.elm.elm_base import ElmBase
from powfacpy.pf_classes.elm.grouping_base import AreaZoneBase
from powfacpy.result_variables import ResVar
from powfacpy.base.active_project... | FraunhIEE-UniKassel-PowSysStability/powfacpy | src/powfacpy/pf_classes/elm/area.py | .py | f59c19eefe4e424e | 7.59 | 14 |
from __future__ import annotations
from typing import Callable
from powfacpy.base.active_project import ActiveProjectCached
from powfacpy.applications.results import Results
import powfacpy.applications.topology
from powfacpy.pf_classes.protocols import ElmBoundary, PFGeneral, ElmZone, ElmNet
from powfacpy.pf_classes... | FraunhIEE-UniKassel-PowSysStability/powfacpy | src/powfacpy/pf_classes/elm/boundary.py | .py | 9ed53eb2f8f4907d | 7.59 | 14 |
from __future__ import annotations
from icecream import ic
from powfacpy.base.active_project import ActiveProjectCached
from powfacpy.pf_classes.protocols import PFGeneral, BlkSlot, ElmComp, ElmDsl
from powfacpy.pf_classes.elm.elm_base import ElmBase
from powfacpy.pf_classes.blk.slot import Slot
from powfacpy.pf_clas... | FraunhIEE-UniKassel-PowSysStability/powfacpy | src/powfacpy/pf_classes/elm/comp.py | .py | 04659a20912a85ea | 7.59 | 14 |
from __future__ import annotations
from textwrap import indent
import os
import numpy as np
from icecream import ic
import pandas as pd
from powfacpy.base.active_project import ActiveProjectCached
from powfacpy.pf_classes.protocols import PFGeneral, BlkSlot, ElmDsl
from powfacpy.pf_classes.elm.elm_base import ElmBa... | FraunhIEE-UniKassel-PowSysStability/powfacpy | src/powfacpy/pf_classes/elm/dsl.py | .py | 5bd8850d858b9fac | 7.59 | 14 |
from __future__ import annotations
from abc import ABC
from typing import Callable
from powfacpy.exceptions import PFInvalidCondition
from powfacpy.pf_classes.protocols import ElmComp, PFGeneral, ElmNet
from powfacpy.base.base import BaseChildStatic
from powfacpy.base.active_project import ActiveProject
from powfacpy.... | FraunhIEE-UniKassel-PowSysStability/powfacpy | src/powfacpy/pf_classes/elm/elm_plant_controlled_base.py | .py | 069ade992207f58c | 7.59 | 14 |
from __future__ import annotations
import os
from os import replace
import pandas as pd
import numpy as np
from icecream import ic
from powfacpy.pf_classes.protocols import ElmFile
from powfacpy.pf_classes.elm.elm_base import ElmBase
from powfacpy.base.active_project import ActiveProjectCached
class MeasurementFil... | FraunhIEE-UniKassel-PowSysStability/powfacpy | src/powfacpy/pf_classes/elm/file.py | .py | 9f2ad459259a6758 | 7.59 | 14 |
from __future__ import annotations
from abc import ABC, abstractmethod
from typing import Callable
import numpy as np
from icecream import ic
from powfacpy.base.active_project import ActiveProjectCached
from powfacpy.pf_classes.protocols import ElmArea, ElmZone, PFGeneral, ElmRes, StaPll
from powfacpy.pf_classes.elm... | FraunhIEE-UniKassel-PowSysStability/powfacpy | src/powfacpy/pf_classes/elm/grouping_base.py | .py | afbf624041435961 | 7.59 | 14 |
from __future__ import annotations
from fnmatch import fnmatch
from typing import Callable
import numpy as np
from powfacpy.base.active_project import ActiveProjectCached
from powfacpy.pf_classes.protocols import ElmSym, PFGeneral, TypSym, ElmTerm, ElmDsl
from powfacpy.pf_classes.elm.elm_base import (
ElmBase,
... | FraunhIEE-UniKassel-PowSysStability/powfacpy | src/powfacpy/pf_classes/elm/sym.py | .py | 17a4e3dd3d0a5020 | 7.59 | 14 |
from __future__ import annotations
from typing import Callable
from powfacpy.base.active_project import ActiveProjectCached
from powfacpy.pf_classes.protocols import ElmTerm, PFGeneral, StaCubic, StaPll
from powfacpy.pf_classes.elm.elm_base import ElmBase
from powfacpy.result_variables import ResVar
RMS_BAL = ResVa... | FraunhIEE-UniKassel-PowSysStability/powfacpy | src/powfacpy/pf_classes/elm/term.py | .py | 9acd928daa8079ba | 7.59 | 14 |
from __future__ import annotations
from typing import Callable
from powfacpy.pf_classes.protocols import ElmTerm, ElmZone, PFGeneral
from powfacpy.pf_classes.elm.elm_base import ElmBase
from powfacpy.pf_classes.elm.grouping_base import AreaZoneBase
from powfacpy.result_variables import ResVar
from powfacpy.base.activ... | FraunhIEE-UniKassel-PowSysStability/powfacpy | src/powfacpy/pf_classes/elm/zone.py | .py | e9cb10d29d23bbd1 | 7.59 | 14 |
#!/usr/bin/env python3
# Copyright (c) 2015-2021 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from argparse import ArgumentParser
from base64 import urlsafe_b64encode
from getpass import getpass
from... | flare-foundation/connected-chains-docker | config-testnet/bitcoin/rpcauth.py | .py | e95f506fc060380a | 7.98 | 8 |
#!/usr/bin/env python3
# Copyright (c) 2015-2021 The litecoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from argparse import ArgumentParser
from base64 import urlsafe_b64encode
from getpass import getpass
fro... | flare-foundation/connected-chains-docker | config-testnet/litecoin/rpcauth.py | .py | 11d653398a0dafc6 | 7.98 | 8 |
#!/usr/bin/env python3
# Copyright (c) 2015-2021 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from argparse import ArgumentParser
from base64 import urlsafe_b64encode
from getpass import getpass
from... | flare-foundation/connected-chains-docker | config-testnet/xrpl/rpcauth.py | .py | f6a458bf34d9522f | 7.98 | 8 |
#!/usr/bin/env python3
# Copyright (c) 2015-2021 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from argparse import ArgumentParser
from base64 import urlsafe_b64encode
from getpass import getpass
from... | flare-foundation/connected-chains-docker | config/xrpl/rpcauth.py | .py | dc8321ba8a793c75 | 7.48 | 8 |
# Copyright (c) 2022 Orange Chair Labs LLC
#
# 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 ag... | higherbar-ai/py-surveydata | src/surveydata/surveyplatform.py | .py | 94ebc427d5695c23 | 7.48 | 8 |
# License: MIT
# Copyright © 2022 Frequenz Energy-as-a-Service GmbH
"""Benchmark for Anycast channels."""
import asyncio
import csv
import timeit
from collections.abc import Coroutine
from typing import Any
from frequenz.channels import Anycast, Receiver, Sender
async def send_msg(num_messages: int, chan: Sender[i... | frequenz-floss/frequenz-channels-python | benchmarks/benchmark_anycast.py | .py | 9df87eca2ad4d64c | 7.52 | 10 |
# License: MIT
# Copyright © 2022 Frequenz Energy-as-a-Service GmbH
"""Benchmark for Broadcast channels."""
import asyncio
import csv
import timeit
from collections.abc import Callable, Coroutine
from functools import partial
from typing import Any
from frequenz.channels import Broadcast, Receiver, Sender
async de... | frequenz-floss/frequenz-channels-python | benchmarks/benchmark_broadcast.py | .py | 8ce804360dc0f5b9 | 7.52 | 10 |
# License: MIT
# Copyright © 2023 Frequenz Energy-as-a-Service GmbH
"""This module defines macros for use in Markdown files."""
from frequenz.repo.config.mkdocs.mkdocstrings_macros import hook_env_with_everything
from griffe import ModulesCollection, Object
from mkdocs_macros.plugin import MacrosPlugin
from mkdocstri... | frequenz-floss/frequenz-channels-python | docs/_scripts/macros.py | .py | c249ca6b02767150 | 7.52 | 10 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.