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
# License: MIT # Copyright © 2022 Frequenz Energy-as-a-Service GmbH """A channel for sending data across async tasks.""" from __future__ import annotations import logging from asyncio import Condition from collections import deque from typing import Generic, TypeVar from typing_extensions import deprecated, overrid...
frequenz-floss/frequenz-channels-python
src/frequenz/channels/_anycast.py
.py
bbc808f9d6db563a
7.52
10
# License: MIT # Copyright © 2022 Frequenz Energy-as-a-Service GmbH """Base exception classes. # Exceptions All exceptions generated by this library inherit from the [`Error`][..Error] exception. Exceptions generated by channels inherit from the [`ChannelError`][..ChannelError] exception. When there is an attempt t...
frequenz-floss/frequenz-channels-python
src/frequenz/channels/_exceptions.py
.py
25e6f965df44d021
7.52
10
# License: MIT # Copyright © 2024 Frequenz Energy-as-a-Service GmbH """Caches the latest value received from a [`Receiver`][..Receiver]. It provides a way to look up the latest value in a stream whenever required, as long as there has been one value received. [`LatestValueCache`][..LatestValueCache] takes a [`Receiv...
frequenz-floss/frequenz-channels-python
src/frequenz/channels/_latest_value_cache.py
.py
924aa6b112e4543d
8.02
10
# License: MIT # Copyright © 2022 Frequenz Energy-as-a-Service GmbH """Merge messages coming from multiple receivers into a single receiver. # Usage If you just need to receive the same type of messages but from multiple sources in one stream, you can use [`merge()`][.merge] to create a new receiver that will receiv...
frequenz-floss/frequenz-channels-python
src/frequenz/channels/_merge.py
.py
12d73e9ce3bb5807
7.52
10
# License: MIT # Copyright © 2026 Frequenz Energy-as-a-Service GmbH """A channel that can send a single message.""" from __future__ import annotations import asyncio import typing from ._generic import ChannelMessageT from ._receiver import Receiver, ReceiverStoppedError from ._sender import Sender, SenderClosedErr...
frequenz-floss/frequenz-channels-python
src/frequenz/channels/_oneshot.py
.py
04673c7aef5069ba
7.52
10
# License: MIT # Copyright © 2023 Frequenz Energy-as-a-Service GmbH """A receiver that can be made ready directly. !!! Tip inline end Read the [`Event`][.Event] documentation for more information. This module contains the following: * [`Event`][.Event]: {{docstring_summary("frequenz.channels.event.Even...
frequenz-floss/frequenz-channels-python
src/frequenz/channels/event.py
.py
43b226860304256d
7.52
10
# License: MIT # Copyright © 2025 Frequenz Energy-as-a-Service GmbH """Caches the latest values in a receiver, grouped by key.""" import asyncio from collections.abc import ( Callable, Hashable, ItemsView, Iterator, KeysView, Mapping, ValuesView, ) from typing import TypeVar, overload fro...
frequenz-floss/frequenz-channels-python
src/frequenz/channels/experimental/_grouping_latest_value_cache.py
.py
7a8c9674ef085e6e
8.02
10
# License: MIT # Copyright © 2025 Frequenz Energy-as-a-Service GmbH """A receiver that will never receive a message. It is useful as a place-holder receiver for use in contexts where a receiver is necessary, but one is not available. """ import asyncio from typing_extensions import override from frequenz.channels ...
frequenz-floss/frequenz-channels-python
src/frequenz/channels/experimental/_nop_receiver.py
.py
b856e2bc1f29650b
7.52
10
# License: MIT # Copyright © 2025 Frequenz Energy-as-a-Service GmbH """A receiver that will wait indefinitely if there is no underlying receiver. The [`OptionalReceiver`][.OptionalReceiver] is useful when the underlying receiver is not set initially. Instead of making `if-else` branches to check if the receiver is se...
frequenz-floss/frequenz-channels-python
src/frequenz/channels/experimental/_optional_receiver.py
.py
ab38d94759ca19bc
7.52
10
# License: MIT # Copyright © 2024 Frequenz Energy-as-a-Service GmbH """Pipe between a receiver and a sender. The [`Pipe`][.Pipe] class takes a receiver and a sender and creates a pipe between them by forwarding all the messages received by the receiver to the sender. """ from __future__ import annotations import as...
frequenz-floss/frequenz-channels-python
src/frequenz/channels/experimental/_pipe.py
.py
be0ec854a915fbee
7.52
10
# License: MIT # Copyright © 2024 Frequenz Energy-as-a-Service GmbH """A Sender for sending messages to multiple senders. The [`RelaySender`][.RelaySender] class takes multiple senders and forwards all the messages sent to it, to the senders it was created with. """ import asyncio from typing_extensions import over...
frequenz-floss/frequenz-channels-python
src/frequenz/channels/experimental/_relay_sender.py
.py
28953fa642a6d289
7.52
10
# License: MIT # Copyright © 2024 Frequenz Energy-as-a-Service GmbH """Composable predicate to cache and compare with the previous message.""" from collections.abc import Callable from typing import Final, Generic, TypeGuard from frequenz.channels._generic import ChannelMessageT class _Sentinel: """A sentinel ...
frequenz-floss/frequenz-channels-python
src/frequenz/channels/experimental/_with_previous.py
.py
9fdafaba0f53e263
7.52
10
# License: MIT # Copyright © 2022 Frequenz Energy-as-a-Service GmbH """A receiver for watching for new, modified or deleted files. !!! Tip inline end Read the [`FileWatcher`][.FileWatcher] documentation for more information. This module contains the following: * [`FileWatcher`][.FileWatcher]: {{docstri...
frequenz-floss/frequenz-channels-python
src/frequenz/channels/file_watcher.py
.py
3bdf94554052fee5
7.52
10
# License: MIT # Copyright © 2024 Frequenz Energy-as-a-Service GmbH """Tests for the Pipe class.""" import asyncio import typing from contextlib import AsyncExitStack, aclosing, closing from frequenz.channels import Broadcast, Receiver from frequenz.channels.experimental import Pipe T = typing.TypeVar("T") class ...
frequenz-floss/frequenz-channels-python
tests/experimental/test_pipe.py
.py
b6c57799bde7393a
8.02
10
# License: MIT # Copyright © 2024 Frequenz Energy-as-a-Service GmbH """Tests for the WithPrevious implementation.""" from dataclasses import dataclass from typing import Callable, Generic, TypeVar import pytest from frequenz.channels.experimental import WithPrevious _T = TypeVar("_T") @dataclass(frozen=True, kw_...
frequenz-floss/frequenz-channels-python
tests/experimental/test_with_previous.py
.py
2d1265cd1e3403e7
8.02
10
# License: MIT # Copyright © 2022 Frequenz Energy-as-a-Service GmbH """Tests for the Broadcast implementation.""" import asyncio from dataclasses import dataclass from typing import TypeGuard, assert_never import pytest from frequenz.channels import ( Broadcast, BroadcastChannel, ChannelClosedError, ...
frequenz-floss/frequenz-channels-python
tests/test_broadcast.py
.py
5f255d09c65a37aa
7.02
10
# License: MIT # Copyright © 2022 Frequenz Energy-as-a-Service GmbH """Tests for `channel.FileWatcher`.""" import pathlib from collections.abc import AsyncGenerator, Iterator, Sequence from typing import Any from unittest import mock import hypothesis import hypothesis.strategies as st import pytest from watchfiles ...
frequenz-floss/frequenz-channels-python
tests/test_file_watcher.py
.py
d7b293a15db5204b
8.02
10
# License: MIT # Copyright © 2023 Frequenz Energy-as-a-Service GmbH """Tests for the select implementation.""" from unittest import mock import pytest from frequenz.channels import Receiver, ReceiverStoppedError, Selected, selected_from class TestSelected: """Tests for the Selected class.""" def test_wit...
frequenz-floss/frequenz-channels-python
tests/test_select.py
.py
8789aa54ac46081c
8.02
10
# License: MIT # Copyright © 2023 Frequenz Energy-as-a-Service GmbH """Integration tests for the timer.""" import asyncio from datetime import timedelta import async_solipsism import pytest from frequenz.channels.timer import SkipMissedAndDrift, Timer @pytest.fixture(autouse=True) def event_loop_policy() -> async...
frequenz-floss/frequenz-channels-python
tests/test_timer_integration.py
.py
a120bc6107895cc7
8.02
10
# Copyright © 2025-2026 Jakub Wilk <jwilk@jwilk.net> # SPDX-License-Identifier: MIT ''' Bluesky ''' import html import re import lib.compat import lib.html from lib.html import text2html from lib.inst import ( AddrParser, Instance, ) from lib.models import ( Attachment, User, Post, ) from lib...
jwilk/zygolophodon
lib/bluesky.py
.py
04da885b4aa0a564
7.65
19
# Copyright © 2022-2026 Jakub Wilk <jwilk@jwilk.net> # SPDX-License-Identifier: MIT ''' zygolophodon CLI ''' import argparse import collections import functools import http.client import os import re import signal import sys import types import urllib.parse import lib.compat import lib.html import lib.inst import li...
jwilk/zygolophodon
lib/cli.py
.py
58c6060743f5976c
7.65
19
# Copyright © 2022-2026 Jakub Wilk <jwilk@jwilk.net> # SPDX-License-Identifier: MIT ''' HTML parsing ''' import html.parser import re import sys import lib.text class HTMLParser(html.parser.HTMLParser): def __init__(self): super().__init__() class state: paras = [] text ...
jwilk/zygolophodon
lib/html.py
.py
0e17218be4552b2e
7.65
19
# Copyright © 2022-2026 Jakub Wilk <jwilk@jwilk.net> # SPDX-License-Identifier: MIT ''' Mastodon (and Mastodon-like) instances ''' import abc import functools import re import urllib.parse import lib.misskey import lib.www from lib.inst import ( AddrParser, Instance, ) from lib.utils import ( Dict, ...
jwilk/zygolophodon
lib/mastodon.py
.py
b977e5cba15bc42a
7.65
19
# Copyright © 2026 Jakub Wilk <jwilk@jwilk.net> # SPDX-License-Identifier: MIT ''' Misskey ''' # Codebase: https://github.com/misskey-dev/misskey # Forks: https://activitypub.software/TransFem-org/Sharkey import html.parser import json import sys import lib.compat from lib.models import ( Attachment, Post,...
jwilk/zygolophodon
lib/misskey.py
.py
16c541bf281ce246
7.65
19
# Copyright © 2025-2026 Jakub Wilk <jwilk@jwilk.net> # SPDX-License-Identifier: MIT ''' Mastodon-shaped data models ''' import dataclasses import datetime import functools import sys import typing dataclass = dataclasses.dataclass if sys.version_info >= (3, 10): dataclass = functools.partial(dataclasses.dataclas...
jwilk/zygolophodon
lib/models.py
.py
3e4771e919e4942f
7.65
19
# Copyright © 2026 Jakub Wilk <jwilk@jwilk.net> # SPDX-License-Identifier: MIT ''' Open Graph support ''' import html.parser import sys class HTMLParser(html.parser.HTMLParser): class Stop(Exception): pass def __init__(self): super().__init__() self.z_state = {} def handle_star...
jwilk/zygolophodon
lib/opengraph.py
.py
9d42bc2eef09e979
7.65
19
# Copyright © 2022-2025 Jakub Wilk <jwilk@jwilk.net> # SPDX-License-Identifier: MIT ''' sys.stdout wrapper ''' import contextlib import http import inspect import io import os import shutil import subprocess import sys def find_command(command): if shutil.which(command): return command return None c...
jwilk/zygolophodon
lib/stdout.py
.py
97b522e21117130f
7.65
19
# Copyright © 2022-2025 Jakub Wilk <jwilk@jwilk.net> # SPDX-License-Identifier: MIT ''' text support ''' import os import re import textwrap import unicodedata columns = int(os.getenv('ZYGOLOPHODON_COLUMNS', '78')) def wcwidth(ch): # poor man's wcwidth(3) wd = unicodedata.east_asian_width(ch) return 1 +...
jwilk/zygolophodon
lib/text.py
.py
bbc8a3864bfda54c
7.65
19
# Copyright © 2022-2026 Jakub Wilk <jwilk@jwilk.net> # SPDX-License-Identifier: MIT ''' misc stuff ''' import abc import functools import re class Dict(dict): __getattr__ = dict.__getitem__ class Promise: def __init__(self, fn, *args, **kwargs): self._deliver = functools.cache( functool...
jwilk/zygolophodon
lib/utils.py
.py
2b6e200e342dd4c7
7.65
19
# Copyright © 2022-2026 Jakub Wilk <jwilk@jwilk.net> # SPDX-License-Identifier: MIT ''' HTTP client ''' import errno import functools import gzip import http.client import json import re import socket import ssl import sys import urllib.parse import urllib.request from lib.utils import ( Dict, ) def _fmt_url_er...
jwilk/zygolophodon
lib/www.py
.py
334e9f63fbd37b36
7.65
19
""" this module defines the model either with numpyro/blackjax or manually """ from astropy import constants as const from astropy import units as u from astropy.cosmology import Planck15 from functools import partial # in case user loads module separately from sapphire.run() from jax import config as jax_config ja...
virajpandya/sapphire
sapphire/inference/explicit_likelihood.py
.py
8ea16c1c40ddc2cb
7.62
16
""" this module does univariate gaussian kernel regression from sapphire batched outputs """ from astropy import constants as const from astropy import units as u from astropy.cosmology import Planck15 from functools import partial # in case user loads module separately from sapphire.run() from jax import config as...
virajpandya/sapphire
sapphire/summaries/gaussian_kernel_regression.py
.py
d3188b22b26486c0
7.62
16
""" This submodule reads in the cooling function, interpolates it, and sends it back to parent module. December 7, 2022: currently only Wiersma+09 and Sutherland & Dopita 1993 are allowed. """ import numpy as np import h5py from scipy.interpolate import RegularGridInterpolator, interp2d from glob import glob impor...
virajpandya/sapphire
sapphire/utils/read_coolfunc.py
.py
d3017fce475d7131
7.62
16
""" this module reads pre-summarized observational constraints from sapphire/data """ # plot-specific modules import matplotlib.pyplot as plt from matplotlib.colors import Normalize import matplotlib.gridspec as gridspec import arviz as az import seaborn as sns from mpl_toolkits.axes_grid1.inset_locator import inset_a...
virajpandya/sapphire
sapphire/utils/read_obs.py
.py
c25ac1588ded3b3d
7.62
16
""" This module includes writer functions that will be loaded based on the types of trees being run on. For large-volume simulations with multiple indivdual subvolumes, output files will be split with a subvolume at the end of the filename. For small numbers of halos from zoom simulations, we can save all outputs into...
virajpandya/sapphire
sapphire/utils/write_results.py
.py
a96b56dcc8d8bbc1
7.62
16
""" Copyright 2022 Ledger SAS Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
LedgerHQ/ragger
src/ragger/backend/ledgercomm.py
.py
2d293e336acc9aa3
7.56
12
""" Copyright 2022 Ledger SAS Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
LedgerHQ/ragger
src/ragger/backend/ledgerwallet.py
.py
aacedebc1e7ec38d
7.56
12
""" Copyright 2022 Ledger SAS Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
LedgerHQ/ragger
src/ragger/backend/physical_backend.py
.py
a971a3474af369df
7.56
12
""" Copyright 2022 Ledger SAS Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
LedgerHQ/ragger
src/ragger/backend/speculos.py
.py
1665bf14c4a2435d
8.06
12
import logging import os import warnings from collections.abc import Generator from dataclasses import fields from pathlib import Path from unittest.mock import MagicMock import pytest from ledgered.devices import Device, Devices from ledgered.manifest import Manifest from ragger.backend import ( BackendInterface...
LedgerHQ/ragger
src/ragger/conftest/base_conftest.py
.py
fa61d4611c9f9e35
7.06
12
""" Copyright 2022 Ledger SAS Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
LedgerHQ/ragger
src/ragger/error.py
.py
a7aa2d789d7d64e6
7.56
12
""" Copyright 2022 Ledger SAS Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
LedgerHQ/ragger
src/ragger/firmware/structs.py
.py
4f47219db21a7efb
7.56
12
from enum import Enum, auto from typing import Any class BaseNavInsID(Enum): """ Base NavInsID class, allowing to define NavInsID specific to one's application while being compatible with all Navigator methods. """ pass class NavInsID(BaseNavInsID): """ Pre-defined instruction ID to nav...
LedgerHQ/ragger
src/ragger/navigator/instruction.py
.py
4ac394cff4304ece
7.56
12
""" Copyright 2022 Ledger SAS Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
LedgerHQ/ragger
src/ragger/navigator/touch_navigator.py
.py
85e9c77a0a612c90
7.56
12
""" Copyright 2026 Ledger SAS Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
LedgerHQ/ragger
src/ragger/pki/signing_partner.py
.py
4185af8993b3201c
7.56
12
""" Copyright 2026 Ledger SAS Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
LedgerHQ/ragger
src/ragger/tlv/enums.py
.py
ce1bbb69aa7e1eec
7.56
12
""" Copyright 2026 Ledger SAS Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
LedgerHQ/ragger
src/ragger/tlv/feature_tags.py
.py
bfc60650f4920cf5
7.56
12
""" Copyright 2026 Ledger SAS Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
LedgerHQ/ragger
src/ragger/tlv/serializable.py
.py
c434593b42c8eb41
7.56
12
""" Copyright 2022 Ledger SAS Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
LedgerHQ/ragger
src/ragger/utils/coverage.py
.py
d036c4d516f10f06
7.56
12
""" Copyright 2022 Ledger SAS Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
LedgerHQ/ragger
src/ragger/utils/structs.py
.py
4f201c99036123cb
7.56
12
import os import logging import shutil from pathlib import Path from typing import List, Tuple from ..utilities.settings import splits, split_dict from ..utilities.FASTA import read_FASTA, overwrite_FASTA, delete_entries_FASTA logger = logging.getLogger(__name__) def filter_fasta_enties_size(fasta_entries: List[an...
J-SNACKKB/autoeval
autoeval/managers/data.py
.py
b995de349113e81f
7.42
6
import argparse import logging from .executer import execute from .settings import split_dict, protocols def create_parser(): """ Creates the parser for the command line interface. The included arguments are: - split: the name of the split to use (from the available ones in FLIP). Mandatory in o...
J-SNACKKB/autoeval
autoeval/utilities/cli.py
.py
8f768f31cf4f167b
7.42
6
#!/usr/bin/env python3 """Validate Jupyter notebooks for syntax and execution. This script validates notebooks in two phases: 1. Syntax validation: Parse all code cells with ast to catch syntax errors 2. Execution validation: Run the notebook with a timeout (default 5 min) Notebooks that timeout are marked as skipped...
uncscode/particula
.github/scripts/validate_notebooks.py
.py
39db2055450173d4
7.56
12
#!/usr/bin/env python3 # ruff: noqa: S101, S106, S311 """ デモ用スクリプト 実際のメルカリにはアクセスせず、擬似的な処理ログを表示します。 tests/fixtures/mercari_item_titles.json からランダムにアイテムを選択し、 値下げ処理のシミュレーションを行います。 Usage: demo.py [-n COUNT] Options: -n COUNT : 処理するアイテム数 [default: 20] """ from __future__ import annotations import json import loggi...
kimata/mercari-bot
src/demo.py
.py
a10f0427fa826f6d
7.54
11
#!/usr/bin/env python3 """ メルカリに出品中のアイテムの価格を自動的に値下げします。 Usage: mercari-bot [-c CONFIG] [-l] [-D] [-R] Options: -c CONFIG : CONFIG を設定ファイルとして読み込んで実行します。 [default: config.yaml] -l : 動作ログを Slack やメールで通知します。 -D : デバッグモードで動作します。(価格変更は行いません) -R : ブラウザ起動失敗時にプロファ...
kimata/mercari-bot
src/mercari_bot/cli.py
.py
4330465a1c3037b2
7.54
11
#!/usr/bin/env python3 """設定ファイルの型定義""" from __future__ import annotations import logging import pathlib from dataclasses import dataclass from typing import Any import my_lib.config from my_lib.notify.mail import MailConfig, MailEmptyConfig from my_lib.notify.slack import ( SlackConfig, SlackEmptyConfig, ) ...
kimata/mercari-bot
src/mercari_bot/config.py
.py
fd1fc2e0a1751073
7.54
11
#!/usr/bin/env python3 """値下げ履歴の記録と売却検知(SQLite) 各実行でアイテム毎の処理結果(値下げ・スキップ理由)を記録し、 前回実行時のアイテム一覧との差分から売却(または取り下げ)を検知します。 """ from __future__ import annotations import enum import logging import pathlib import sqlite3 from dataclasses import dataclass from typing import TYPE_CHECKING, TypeAlias import my_lib.sqlite_util...
kimata/mercari-bot
src/mercari_bot/history.py
.py
2b6309fb0a42e6e0
7.54
11
#!/usr/bin/env python3 """ 純粋ロジック関数群 Selenium や DOM アクセスに依存しない、テスト容易な関数を定義します。 """ from __future__ import annotations import logging import re import mercari_bot.exceptions from mercari_bot.config import ProfileConfig def parse_modified_hour(text: str) -> int: """更新時間テキストを時間単位にパース Args: text: 更新時...
kimata/mercari-bot
src/mercari_bot/logic.py
.py
77fa6db75b4a39db
7.54
11
#!/usr/bin/env python3 """Slack でエラー通知を行います。""" from __future__ import annotations import io import logging import pathlib import random import traceback from typing import TYPE_CHECKING import my_lib.notify.slack import my_lib.selenium_util import PIL.Image from my_lib.notify.slack import AttachImage if TYPE_CHECK...
kimata/mercari-bot
src/mercari_bot/notify_slack.py
.py
3eb4ac2bf6b06a62
7.54
11
#!/usr/bin/env python3 """Rich を使用した進捗表示モジュール TTY 環境では Rich による視覚的な進捗表示を行い、 非 TTY 環境(CI/CD パイプラインなど)では logging にフォールバックします。 my_lib.cui_progress を使用して実装しています。 """ from __future__ import annotations from dataclasses import dataclass, field from typing import TYPE_CHECKING, Protocol, runtime_checkable import my_lib.cu...
kimata/mercari-bot
src/mercari_bot/progress.py
.py
393c72fa9f1c86dc
7.54
11
#!/usr/bin/env python3 # ruff: noqa: S101, S106 """ 共通テストフィクスチャ テスト全体で使用する共通のフィクスチャとヘルパーを定義します。 """ import logging import pathlib import unittest.mock import my_lib.browser_manager import pytest from my_lib.notify.slack import SlackEmptyConfig from my_lib.store.mercari.config import LineLoginConfig, MercariItem, Mer...
kimata/mercari-bot
tests/conftest.py
.py
6f92ee8653dd08d2
8.04
11
#!/usr/bin/env python3 """ 静的型チェックテスト mypy を使用してソースコードの型チェックを実行します。 """ # ruff: noqa: S101, S603 import subprocess import sys def test_mypy_src() -> None: """src ディレクトリの型チェック""" result = subprocess.run( [sys.executable, "-m", "mypy"], capture_output=True, text=True, ) # エラーメ...
kimata/mercari-bot
tests/test_typecheck.py
.py
b5b9037d867bcf38
7.04
11
#!/usr/bin/env python3 # ruff: noqa: S101 """ cli.py のテスト mercari_price_down をモックして UI フローをテストします。 """ import io import pathlib import unittest.mock import pytest from my_lib.notify.slack import SlackEmptyConfig import mercari_bot.cli as app import mercari_bot.progress from mercari_bot.config import AppConfig, Data...
kimata/mercari-bot
tests/unit/test_app.py
.py
8afa8b6d9366427b
7.04
11
#!/usr/bin/env python3 # ruff: noqa: S101 """ demo.py のテスト デモ用スクリプトの動作をテストします。 """ import json import pathlib import unittest.mock import pytest import demo class TestLoadFixture: """_load_fixture のテスト""" def test_load_fixture(self, tmp_path: pathlib.Path): """フィクスチャファイルを読み込む""" # テスト用フィク...
kimata/mercari-bot
tests/unit/test_demo.py
.py
afb1eb08c32a7d80
8.04
11
#!/usr/bin/env python3 # ruff: noqa: S101 """ history モジュールのテスト SQLite への記録・スナップショット・売却検知ロジックをテストします。 """ import pathlib import sqlite3 import pytest from my_lib.store.mercari.config import MercariItem from mercari_bot.history import ( HistoryDb, ItemAction, ItemResult, NullHistoryDb, PriceDownE...
kimata/mercari-bot
tests/unit/test_history.py
.py
1d2281fa8969bf55
8.04
11
#!/usr/bin/env python3 # ruff: noqa: S101, S106 """ logic モジュールのテスト Selenium に依存しない純粋ロジック関数のテストです。 """ import pytest from my_lib.store.mercari.config import LineLoginConfig, MercariLoginConfig import mercari_bot.exceptions import mercari_bot.logic from mercari_bot.config import DiscountConfig, IntervalConfig, Profil...
kimata/mercari-bot
tests/unit/test_logic.py
.py
6d9b649e75583347
7.04
11
#!/usr/bin/env python3 # ruff: noqa: S101 """ notify_slack モジュールのテスト """ import io import pathlib import unittest.mock import PIL.Image import pytest from my_lib.notify.slack import SlackConfig, SlackEmptyConfig import mercari_bot.notify_slack class TestErrorWithScreenshot: """error_with_screenshot のテスト""" ...
kimata/mercari-bot
tests/unit/test_notify_slack.py
.py
20f39ed76dde27a6
7.04
11
#!/usr/bin/env python3 # ruff: noqa: S101 """ progress モジュールのテスト my_lib.cui_progress.ProgressManager を使用した進捗表示のテストです。 """ import unittest.mock import rich.cells from my_lib.store.mercari.config import MercariItem from mercari_bot.progress import ( _PROGRESS_ITEM, ItemRecordingObserver, NullProgressDispl...
kimata/mercari-bot
tests/unit/test_progress.py
.py
6ae9b0b9536f1de9
8.04
11
"""Multivariate elliptical copula module contain class for sample from a multivariate elliptical copula. """ import numpy as np from scipy.stats import norm, t from .base import Multivariate, CopulaTypes class Gaussian(Multivariate): """Class for Gaussian copula """ copula_type = CopulaTypes.GAUSSIAN ...
Aleboul/clayton
build/lib/clayton/rng/elliptical.py
.py
50de56108bf2f98d
7.45
7
import sys import math import itertools import numpy as np import scipy.special as sc DBL_EPSILON = sys.float_info.epsilon def maximum_n(n, x): """ Step 2 of Algorithm 2.2. """ for i in range(1, n): if (x[0] < x[i]): x[0] = x[i] return x[0] def subsets(d): """All sub...
Aleboul/clayton
build/lib/clayton/rng/utils.py
.py
6cf34c59998e2210
7.45
7
"""Test file for base """ import unittest import clayton from clayton.rng.base import Multivariate from clayton.rng.base import Archimedean from clayton.rng.base import Extreme class TestUser(unittest.TestCase): """A simple test class """ def test_multivariate_instantiation(self): """Check if i...
Aleboul/clayton
build/lib/clayton/tests/test_base.py
.py
785c9e2b07c83aaf
7.95
7
"""Test file for base """ import unittest import numpy as np import clayton from clayton.rng.evd import Logistic from clayton.rng.evd import AsymmetricLogistic from clayton.rng.evd import HuslerReiss from clayton.rng.evd import AsyNegLog from clayton.rng.evd import AsyMix from clayton.rng.evd import TEV from clayton.r...
Aleboul/clayton
build/lib/clayton/tests/test_evd.py
.py
de012d39f7f57346
7.95
7
"""Multivariate elliptical copula module contain class for sample from a multivariate elliptical copula. """ import numpy as np from scipy.stats import norm, t from .base import Multivariate, CopulaTypes class Gaussian(Multivariate): """Class for Gaussian copula """ copula_type = CopulaTypes.GAUSSIAN ...
Aleboul/clayton
clayton/rng/elliptical.py
.py
dcf0da60bdf88591
7.45
7
import sys import math import itertools import numpy as np import scipy.special as sc DBL_EPSILON = sys.float_info.epsilon def maximum_n(n, x): """ Step 2 of Algorithm 2.2. """ for i in range(1, n): if (x[0] < x[i]): x[0] = x[i] return x[0] def subsets(d): """All sub...
Aleboul/clayton
clayton/rng/utils.py
.py
b8a3834d54b83a59
7.45
7
""" benchmarks/bench_import.py ========================== Benchmark functions for inewave import operations. For each target module, all `inewave` sub-modules are cleared from `sys.modules` before every iteration so that `importlib.import_module` performs a fresh bytecode-cache load. Only keys starting with "inewave...
rjmalves/inewave
benchmarks/bench_import.py
.py
a412d38521916832
7.66
20
from inewave.newave.modelos.adterm import BlocoUTEAdTerm from cfinterface.files.sectionfile import SectionFile from typing import TypeVar, Optional import pandas as pd # type: ignore[import-untyped] # no pandas-stubs package class Adterm(SectionFile): """ Armazena os dados de entrada do NEWAVE referentes à...
rjmalves/inewave
inewave/newave/adterm.py
.py
33527058ebf23b07
7.66
20
from inewave.newave.modelos.agrint import ( BlocoGruposAgrint, BlocoLimitesPorGrupoAgrint, ) from cfinterface.files.sectionfile import SectionFile from typing import TypeVar, Optional import pandas as pd # type: ignore[import-untyped] # no pandas-stubs package class Agrint(SectionFile): """ Armazen...
rjmalves/inewave
inewave/newave/agrint.py
.py
c05865834459d8ad
7.66
20
from inewave.newave.modelos.blocos.versaomodelo import ( VersaoModelo, VersaoModeloLibs, ) from inewave.newave.modelos.avl_cortesfpha_nwv import ( TabelaAvlCortesFpha28, TabelaAvlCortesFpha, ) from inewave.newave.modelos.arquivoscsv.arquivocsv import ArquivoCSV from typing import Optional, Any import p...
rjmalves/inewave
inewave/newave/avl_cortesfpha_nwv.py
.py
df3d6d7f940739cd
7.66
20
from inewave.newave.modelos.blocos.versaomodelo import VersaoModelo from inewave.newave.modelos.avl_desvfpha_s import TabelaAvlDesvFphaS from cfinterface.files.blockfile import BlockFile from typing import Optional, TypeVar, Any import pandas as pd # type: ignore[import-untyped] # no pandas-stubs package from warni...
rjmalves/inewave
inewave/newave/avl_desvfpha_s.py
.py
d803f619eff7b503
7.66
20
from inewave.newave.modelos.blocos.versaomodelo import VersaoModelo from inewave.newave.modelos.avl_desvfpha_v_q import TabelaAvlDesvFphaVQ from cfinterface.files.blockfile import BlockFile from typing import Optional, TypeVar, Any import pandas as pd # type: ignore[import-untyped] # no pandas-stubs package from wa...
rjmalves/inewave
inewave/newave/avl_desvfpha_v_q.py
.py
0db1affa4fe81ac4
7.66
20
from inewave.newave.modelos.cadic import BlocoCargasAdicionais from cfinterface.files.sectionfile import SectionFile from typing import TypeVar, Optional import pandas as pd # type: ignore[import-untyped] # no pandas-stubs package class Cadic(SectionFile): """ Armazena os dados de entrada do NEWAVE referen...
rjmalves/inewave
inewave/newave/cadic.py
.py
44f972a29f52a8c5
7.66
20
""" The matcher module contains the UrlMatcher class. """ from __future__ import annotations from collections.abc import Iterable, Iterator, Mapping from dataclasses import dataclass, field from itertools import chain from typing import Any from url_matcher.patterns import PatternMatcher, get_pattern_domain, hierarc...
zytedata/url-matcher
url_matcher/matcher.py
.py
4c0ceeee947c2974
7.5
9
""" Utilities to parse patterns and match URLs using them. """ from __future__ import annotations import ipaddress import re import warnings from functools import lru_cache from re import Pattern from typing import NamedTuple from urllib.parse import parse_qs, urlparse from url_matcher.util import get_domain def g...
zytedata/url-matcher
url_matcher/patterns.py
.py
421a06d017643595
7.5
9
from __future__ import annotations from functools import lru_cache from urllib.parse import urlparse from tldextract import tldextract @lru_cache(100) def get_domain(url: str) -> str: """ Return the domain without any subdomain >>> get_domain("http://blog.example.com") 'example.com' >>> get_dom...
zytedata/url-matcher
url_matcher/util.py
.py
53ebd69edb62905e
7.5
9
import hashlib import struct import time from typing import Optional import pandas as pd import sqlalchemy.exc from sqlalchemy import create_engine from sqlalchemy import text as sql_text from sqlalchemy.engine import URL from msal_bearer import BearerAuth, get_user_name # Maximum lifetime of a cached engine, in s...
equinor/pdm-datareader
pdm_datareader/tools.py
.py
40b4255a288a8e4c
7.42
6
# -*- mode:python; coding:utf-8 -*- # Copyright (c) 2023 IBM Corp. All rights reserved. # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # ...
oscal-compass/compliance-trestle-ssp-demo
insert_response_prose.py
.py
a1f3eff662cad05c
7.5
9
import base64 import json import os from dataclasses import dataclass from typing import cast from logger import logger def encode_to_base64(input_string: str) -> str: input_bytes = input_string.encode('utf-8') encoded_bytes = base64.b64encode(input_bytes) return encoded_bytes.decode('utf-8') def impor...
bn222/cluster-deployment-automation
auth.py
.py
59ef2b78bd3eb63a
7.52
10
import os from concurrent.futures import Future, ThreadPoolExecutor from logger import logger from typing import Optional import common import coreosBuilder import host from clustersConfig import BridgeConfig, ClustersConfig, HostConfig, NodeConfig from clusterNode import ClusterNode, X86ClusterNode, VmClusterNode, BF...
bn222/cluster-deployment-automation
clusterHost.py
.py
324b838180f5c342
7.52
10
import os import time import jinja2 from abc import ABC, abstractmethod from logger import logger from k8sClient import K8sClient from enum import Enum from typing import Optional from common import apply_yaml_content class StorageType(str, Enum): """Type of storage to deploy.""" HOSTPATH = "hostpath" ""...
bn222/cluster-deployment-automation
clusterStorage.py
.py
bbe113ccfebe3332
7.52
10
from clustersConfig import ClustersConfig from logger import logger from concurrent.futures import Future from typing import Optional from clustersConfig import ExtraConfigArgs from clustersConfig import NodeConfig import host import time # Standard kernel RPM packages KERNEL_RPM_PACKAGES = [ "kernel", "kerne...
bn222/cluster-deployment-automation
extraConfigKernel.py
.py
e073c1075be8c780
7.52
10
from concurrent.futures import Future from typing import Optional, Any, Dict from k8sClient import K8sClient from logger import logger from clustersConfig import ClustersConfig from clustersConfig import ExtraConfigArgs import host import yaml import time import sys def early_access_microshift() -> str: return ""...
bn222/cluster-deployment-automation
extraConfigMicroshift.py
.py
75725e9662d7666b
7.52
10
"""Config flow for Elro Connects integration.""" from __future__ import annotations import logging from typing import Any import homeassistant.helpers.config_validation as cv import voluptuous as vol from elro.api import K1 from elro.auth import ElroConnectsConnector, ElroConnectsSession from homeassistant import co...
jbouwh/ha-elro-connects
custom_components/elro_connects/config_flow.py
.py
b3d41926ab8f3fc9
7.64
18
"""Elro Connects K1 device communication.""" from __future__ import annotations import asyncio import copy import logging from datetime import timedelta from typing import Any from elro.api import K1 from elro.command import ( GET_ALL_EQUIPMENT_STATUS, GET_DEVICE_NAMES, SET_DEVICE_NAME, CommandAttrib...
jbouwh/ha-elro-connects
custom_components/elro_connects/device.py
.py
c2a2a2236d24548c
7.64
18
"""Helper functions for Elro Connects.""" from __future__ import annotations from elro.device import ATTR_DEVICE_TYPE from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.he...
jbouwh/ha-elro-connects
custom_components/elro_connects/helpers.py
.py
13ec643f62978688
7.64
18
"""The Elro Connects sensor platform.""" from __future__ import annotations import logging from dataclasses import dataclass from elro.device import ( ATTR_BATTERY_LEVEL, ATTR_DEVICE_STATE, ATTR_SIGNAL, STATES_OFFLINE, ) from homeassistant.components.sensor import ( SensorDeviceClass, SensorE...
jbouwh/ha-elro-connects
custom_components/elro_connects/sensor.py
.py
32cbc0b2f146f300
7.64
18
"""The Elro Connects siren platform.""" from __future__ import annotations import logging from dataclasses import dataclass from elro.command import SILENCE_ALARM, TEST_ALARM, TEST_ALARM_ALT, CommandAttributes from elro.device import ( ALARM_CO, ALARM_FIRE, ALARM_HEAT, ALARM_SMOKE, ALARM_WATER, ...
jbouwh/ha-elro-connects
custom_components/elro_connects/siren.py
.py
447a9474fe8a9411
7.64
18
"""The Elro Connects switch platform.""" from __future__ import annotations from dataclasses import dataclass import logging from elro.command import SOCKET_OFF, SOCKET_ON, CommandAttributes from elro.device import ( ATTR_DEVICE_STATE, ATTR_DEVICE_VALUE, DEVICE_VALUE_OFF, DEVICE_VALUE_ON, SOCKET,...
jbouwh/ha-elro-connects
custom_components/elro_connects/switch.py
.py
72a4322cf22ef542
7.64
18
"""Fixtures for testing the Elro Connects integration.""" from unittest.mock import AsyncMock, patch import pytest from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_HOST, CONF_PORT from homeassistant.core import HomeAssistant from pytest_homeassistant_custom_component.common im...
jbouwh/ha-elro-connects
tests/conftest.py
.py
56c20a34711d4f6e
7.14
18
# License: MIT # Copyright © 2022 Frequenz Energy-as-a-Service GmbH """Tests for the frequenz.api.microgrid package.""" import pytest def test_package_import() -> None: """Test that the package can be imported.""" # pylint: disable=import-outside-toplevel from frequenz.api.microgrid import v1alpha18 ...
frequenz-floss/frequenz-api-microgrid
pytests/test_microgrid_v1alpha18.py
.py
1257cb6f805471c3
7.92
6
# License: MIT # Copyright © 2022 Frequenz Energy-as-a-Service GmbH """Tests for the frequenz.api.microgrid package.""" import pytest def test_package_import() -> None: """Test that the package can be imported.""" # pylint: disable=import-outside-toplevel from frequenz.api.microgrid import v1alpha19 ...
frequenz-floss/frequenz-api-microgrid
pytests/test_microgrid_v1alpha19.py
.py
4b8a68821286f227
7.92
6