text
stringlengths
185
73.3k
repo
stringlengths
7
100
path
stringlengths
4
146
language
stringclasses
7 values
hash
stringlengths
16
16
score
float64
7
8.5
stars
int64
0
237k
from __future__ import annotations import math from collections import Counter from typing import TYPE_CHECKING if TYPE_CHECKING: from collections.abc import Iterable class Reranker: """Re-rank beam candidates by interpolating model score with a char LM. Following IndicXlit (Aksharantar, EMNLP Findings...
in-rolls/indicate
indicate/rerank.py
.py
e0656e3dcfcb2177
7.63
17
"""Locate packaged data files, local-first then Hugging Face. Model weights are too large for the wheel and the lookup tables derive from corpora with their own license and provenance constraints, so both are resolved the same way: use the file in ``indicate/data/`` if a checkout provides it, otherwise download and ca...
in-rolls/indicate
indicate/resources.py
.py
efb98cf526671e3d
7.63
17
"""The local seq2seq decoder, as one loadable object per language pair. This used to be a class hierarchy -- ``Seq2SeqTransliterator`` with a subclass per direction, holding its weights in *class* attributes on a ``__new__``-cached singleton. Adding a language meant adding a module, and the mutable class state leaked ...
in-rolls/indicate
indicate/transliterator.py
.py
14172bf3cfdf83e8
7.63
17
from __future__ import annotations import json from pathlib import Path from typing import TYPE_CHECKING import torch if TYPE_CHECKING: from collections.abc import Iterable from .decoder import Decoder from .encoder import Encoder START_TOKEN = "^" # noqa: S105 - seq2seq framing token, not a secret EN...
in-rolls/indicate
indicate/utils.py
.py
8743c5c2c66796cf
7.63
17
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Convert Biaobei-style Praat TextGrid files to Merlin phone_align labels. Usage: python gen_monolab_from_TextGrid.py <textgrid_dir> <output_dir> - Reads the tier named "Phon" (fallback: first IntervalTier) - Strips tone digits from phone names (a2 -> a, uai4 -> uai...
feelins/merlin_Mandarin
egs/build_your_own_voice/s2/scripts/gen_monolab_from_TextGrid.py
.py
2fb7383de2c08873
7.5
9
#!/usr/bin/python """ A simple discretionary locking system for /dev/nvidia devices. Iain Murray, November 2009, January 2010, January 2011. """ import os, os.path _dev_prefix = '/dev/nvidia' #URL = 'http://www.cs.toronto.edu/~murray/code/gpu_monitoring/' URL = 'http://homepages.inf.ed.ac.uk/imurray2/code/gpu_monit...
feelins/merlin_Mandarin
egs/slt_arctic/s2/scripts/gpu_lock.py
.py
02bfb481a6f0ad43
7.5
9
''' Copyright 2011-2013 Pawel Swietojanski 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 THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CON...
feelins/merlin_Mandarin
misc/scripts/alignment/state_align/htk_io.py
.py
bb85514880a4fd96
7.5
9
# Copyright (c) 2007 Carnegie Mellon University # # You may copy and modify this freely under the same terms as # Sphinx-III """Read and write HTK feature files. This module reads and writes the acoustic feature files used by HTK """ __author__ = "David Huggins-Daines <dhuggins@cs.cmu.edu>" __version__ = "$Revision ...
feelins/merlin_Mandarin
misc/scripts/alignment/state_align/htkmfc.py
.py
6cc4471eb5a57fff
7.5
9
# coding=utf-8 #!/usr/bin/python # Created on 2018-03-22 17:06 # @author: Administrator # @name: ReadWrite.py # @info: import os def addLineBreak(_in_list): """每一个元素,增加一个换行符""" _print_result = [] for ls in _in_list: if (ls != "" and ls[-1] != '\n') or ls == "": _print_result.append(ls...
feelins/merlin_Mandarin
misc/scripts/frontend/gen_lab_cn_mandarin/IO.py
.py
4636ec907ee41dc2
7.5
9
#!usr/bin/env python # -*- coding:utf-8 _*- """ @author:shaopf @file: gen_pinyin_combos.py @version: @time: 2019/04/09 09:57:57 @email:feipengshao@163.com @function: gen monolab from TextGrid """ import os from TextGrid import * import IO plist = [] def cleanName(_in_phon_name, _strange_marks:list) -> str: """替换掉...
feelins/merlin_Mandarin
misc/scripts/frontend/gen_lab_cn_mandarin/gen_monolab_from_TextGrid.py
.py
81ffcae42da4095c
7.5
9
#!usr/bin/env python # -*- coding:utf-8 _*- """ @author:shaopf @file: gen_pinyin_combos.py @version: @time: 2019/04/09 09:57:57 @email:feipengshao@163.com @function: gen Mandarin Pinyin combos """ import IO def getVowels(): """gen vowel list""" vowel_path = r'docs/Vowel.lst' return IO.readList(vowel_pa...
feelins/merlin_Mandarin
misc/scripts/frontend/gen_lab_cn_mandarin/gen_pinyin_combos.py
.py
2b5f3851595a5c66
7.5
9
#!usr/bin/env python # -*- coding:utf-8 _*- """ @author:shaopf @file: prepare_data_for_Montreal_Align.py @version: @time: 2019/04/09 14:20:45 @email:feipengshao@163.com @function: prepare labels and dict for Montreal Alignment, need input pinyin file """ import IO import os def createPYtoSY(): """gen sheng yun...
feelins/merlin_Mandarin
misc/scripts/frontend/gen_lab_cn_mandarin/prepare_data_for_Montreal_Align.py
.py
75c1543ec67cc3d3
7.5
9
#!usr/bin/env python # -*- coding:utf-8 _*- """ @author:shaopf @file: trans_prosody_HanLP.py @version: @time: 2019/04/09 11:35:19 @email:feipengshao@163.com @function: transfer HanLP result to prosody input_pinyin_file: 0001|句子内容是什么 ... input_pinyin_file: 0001|ju4 zi5 # nei4 rong2 # shi4 # shen2 me5 % output_prosody...
feelins/merlin_Mandarin
misc/scripts/frontend/gen_lab_cn_mandarin/trans_prosody_HanLP.py
.py
b8315518e10f82e8
7.5
9
#!usr/bin/env python # -*- coding:utf-8 _*- """ @author:shaopf @file: trans_prosody_by_monolab.py @version: @time: 2019/04/09 19:11:51 @email:feipengshao@163.com @function: transfer Prosody by new monolab """ import IO import os import re def createMonos(monolab_file): """monolab to monos""" tmp_monos = IO...
feelins/merlin_Mandarin
misc/scripts/frontend/gen_lab_cn_mandarin/trans_prosody_by_monolab.py
.py
9670f1c38c6dcb96
7.5
9
import numpy from binary_io import BinaryIOCollection class AlignFeats(object): def __init__(self): self.io_funcs = BinaryIOCollection() def align_src_feats(self, src_feat_file, src_aligned_feat_file, feat_dim, dtw_path_dict): ''' align source feats as per the dtw path (matching targ...
feelins/merlin_Mandarin
misc/scripts/voice_conversion/align_feats.py
.py
febff0c9c1e4176b
7.5
9
from __future__ import annotations import enum import typing from importlib import import_module from pyflocker.ciphers import exc _DEFAULT_BACKEND = None if typing.TYPE_CHECKING: # pragma: no cover import types from types import ModuleType class Backends(enum.Enum): """The backends of PyFLocker.""" ...
arunanshub/pyflocker
src/pyflocker/ciphers/backends/__init__.py
.py
280b01ddcf35eba5
7.45
7
"""Implementation of AES cipher.""" from __future__ import annotations import contextlib import typing from types import MappingProxyType from typing import TYPE_CHECKING from Cryptodome.Cipher import AES from pyflocker.ciphers import base, exc, modes from pyflocker.ciphers.backends.symmetric import FileCipherWrapp...
arunanshub/pyflocker
src/pyflocker/ciphers/backends/cryptodome_/AES.py
.py
9966c713e207625b
7.45
7
from __future__ import annotations import typing from Cryptodome.Cipher import ( ChaCha20 as _ChaCha20, ChaCha20_Poly1305 as _ChaCha20_Poly1305, ) from pyflocker.ciphers.backends.symmetric import FileCipherWrapper from .symmetric import AEADCipherTemplate, NonAEADCipherTemplate if typing.TYPE_CHECKING: ...
arunanshub/pyflocker
src/pyflocker/ciphers/backends/cryptodome_/ChaCha20.py
.py
8a4d6ef41eb49489
7.45
7
from __future__ import annotations import typing from Cryptodome.Hash import ( SHA3_224, SHA3_256, SHA3_384, SHA3_512, SHA224, SHA256, SHA384, SHA512, SHAKE128, SHAKE256, BLAKE2b, BLAKE2s, KangarooTwelve, TupleHash128, TupleHash256, cSHAKE128, cSHAKE...
arunanshub/pyflocker
src/pyflocker/ciphers/backends/cryptodome_/Hash.py
.py
be924eaf6a8f3d12
7.45
7
from __future__ import annotations import typing from Cryptodome.Cipher import PKCS1_OAEP from Cryptodome.Signature import DSS, eddsa, pss from pyflocker.ciphers.backends import asymmetric if typing.TYPE_CHECKING: # pragma: no cover from Cryptodome.PublicKey.ECC import EccKey from Cryptodome.PublicKey.RSA ...
arunanshub/pyflocker
src/pyflocker/ciphers/backends/cryptodome_/asymmetric.py
.py
e3e7f6f54a8bef96
7.45
7
from __future__ import annotations import typing from types import MappingProxyType from cryptography.hazmat.primitives import hashes from pyflocker.ciphers import base, exc HASHES = MappingProxyType( { "sha1": hashes.SHA1, "sha224": hashes.SHA224, "sha256": hashes.SHA256, "sha38...
arunanshub/pyflocker
src/pyflocker/ciphers/backends/cryptography_/Hash.py
.py
1565621de2c889c1
7.45
7
""" Miscellaneous Tools: Tools that are not common to symmetric or asymmetric. """ from __future__ import annotations from cryptography.hazmat.primitives.ciphers import ( Cipher, algorithms as algo, ) from cryptography.hazmat.primitives.kdf.hkdf import HKDF from pyflocker.ciphers.base import BaseHash from ....
arunanshub/pyflocker
src/pyflocker/ciphers/backends/cryptography_/misc.py
.py
ef2fc23d2e41c3d1
7.45
7
"""Interface to AES cipher""" from __future__ import annotations import typing from pyflocker.ciphers.backends import load_algorithm as _load_algo from pyflocker.ciphers.modes import Modes if typing.TYPE_CHECKING: # pragma: no cover import io from pyflocker.ciphers import base from pyflocker.ciphers.b...
arunanshub/pyflocker
src/pyflocker/ciphers/interfaces/AES.py
.py
d3bdfedadd64abb5
7.45
7
"""Interface to Camellia cipher""" from __future__ import annotations import typing from pyflocker.ciphers.backends import ( Backends, load_algorithm as _load_algo, ) if typing.TYPE_CHECKING: # pragma: no cover import io from pyflocker.ciphers import base from pyflocker.ciphers.backends.symmet...
arunanshub/pyflocker
src/pyflocker/ciphers/interfaces/Camellia.py
.py
79e6347597c7fcaa
7.45
7
"""Interface to hashing algorithms.""" from __future__ import annotations import typing from pyflocker.ciphers.backends import ( Backends as _Backends, load_algorithm as _load_algo, ) if typing.TYPE_CHECKING: # pragma: no cover from pyflocker.ciphers.base import BaseHash def algorithms_available( ...
arunanshub/pyflocker
src/pyflocker/ciphers/interfaces/Hash.py
.py
dc72ae59af20896f
7.45
7
from __future__ import annotations from pyflocker.ciphers.backends import Backends def make_buffer(data: bytes, offset: int = 15) -> memoryview: """ Construct a buffer for in-place encryption/decryption. Offset should be a positive integer. """ return memoryview(bytearray(data) + bytearray(offset...
arunanshub/pyflocker
tests/base.py
.py
029ca1b7fdafac4b
7.95
7
"""Check this library's runtime dependency floors against Home Assistant's pins. HA pins its core dependencies exactly (e.g. `aiohttp==3.14.3`), so our floors must equal those pins: - a floor *below* HA's pin claims support for versions we never test against; - a floor *above* what HA stable pins makes the librar...
zxdavb/evohome-async
.github/scripts/check-hass-pins.py
.py
1b227f4f685ab61c
7.6
15
"""evohomeasync provides an async client for the v0 Resideo TCC API.""" from __future__ import annotations import json import logging from abc import ABC, abstractmethod from http import HTTPMethod, HTTPStatus from typing import TYPE_CHECKING, Any, Final import aiohttp import voluptuous as vol from . import excepti...
zxdavb/evohome-async
src/_evohome/auth.py
.py
5d43b6e1fb41ae60
7.6
15
"""evohomeasync provides an async client for the v0 Resideo TCC API.""" from __future__ import annotations import json from http import HTTPMethod from typing import TYPE_CHECKING, Any, Final import aiohttp from . import exceptions as exc from .auth import _payload from .const import ERR_MSG_LOOKUP_BASE, HINT_CHECK...
zxdavb/evohome-async
src/_evohome/credentials.py
.py
96c716323cd5b1c3
7.6
15
"""evohomeasync provides an async client for the Resideo TCC API.""" from __future__ import annotations from datetime import datetime as dt, timedelta as td, tzinfo from typing import TYPE_CHECKING, Final from .windows_zones import WINDOWS_TO_IANA_LOOKUP if TYPE_CHECKING: from evohomeasync2.typedefs import EvoT...
zxdavb/evohome-async
src/_evohome/time_zone.py
.py
4b3566be529f4cb2
7.6
15
"""evohome_cli - a credentials manager for the evohome CLI.""" from __future__ import annotations import json import logging import os from datetime import UTC, datetime as dt, timedelta as td from pathlib import Path from typing import TYPE_CHECKING, Any, Final, NotRequired, TypedDict import aiofiles import keyring...
zxdavb/evohome-async
src/evohome_cli/auth.py
.py
174b774ff7d6ca8f
7.6
15
"""evohomeasync provides an async client for the v0 Resideo TCC API. It is an async port of https://github.com/watchforstock/evohome-client Further information at: https://evohome-client.readthedocs.io """ from __future__ import annotations from datetime import UTC, datetime as dt, timedelta as td from typing impor...
zxdavb/evohome-async
src/evohomeasync/__init__.py
.py
4673b449a8a2bc1d
7.6
15
"""evohomeasync provides an async client for the v0 Resideo TCC API.""" from __future__ import annotations import logging from abc import ABC, abstractmethod from datetime import UTC, datetime as dt, timedelta as td from typing import TYPE_CHECKING, Any, Final, TypedDict import voluptuous as vol from _evohome.auth ...
zxdavb/evohome-async
src/evohomeasync/auth.py
.py
1afb209a3f5ba864
7.6
15
"""evohomeasync provides an async client for the v0 Resideo TCC API.""" from __future__ import annotations import logging from http import HTTPStatus from typing import TYPE_CHECKING, Final from _evohome.helpers import camel_to_snake from . import exceptions as exc from .auth import AbstractSessionManager, Auth fro...
zxdavb/evohome-async
src/evohomeasync/main.py
.py
51656523dbe2380b
7.6
15
"""evohomeasync schema - shared types. These mirror the voluptuous schemas in schemas.py (after their keys are converted to snake_case), and so a key is NotRequired here whenever it is vol.Optional there: that is, whenever this library does not need it. This is deliberately not the same thing as the vendor omitting it...
zxdavb/evohome-async
src/evohomeasync/typedefs.py
.py
edd80edef0614fe9
7.6
15
"""evohomeasync provides an async client for the v2 Resideo TCC API. It is an async port of https://github.com/watchforstock/evohome-client Further information at: https://evohome-client.readthedocs.io """ from __future__ import annotations from datetime import UTC, datetime as dt from typing import Self import ai...
zxdavb/evohome-async
src/evohomeasync2/__init__.py
.py
ff62affa520962f7
7.6
15
"""evohomeasync provides an async client for the v2 Resideo TCC API.""" from __future__ import annotations import base64 import logging from abc import ABC, abstractmethod from datetime import UTC, datetime as dt, timedelta as td from http import HTTPStatus from typing import TYPE_CHECKING, Any, Final, TypedDict imp...
zxdavb/evohome-async
src/evohomeasync2/auth.py
.py
e2eb4c6a7b1270fe
7.6
15
"""Provides handling of TCC temperature control systems.""" from __future__ import annotations import json from functools import cached_property from typing import TYPE_CHECKING, Final, overload from _evohome.helpers import as_aware_dtm, as_local_time from . import exceptions as exc from .const import ( SZ_ACTI...
zxdavb/evohome-async
src/evohomeasync2/control_system.py
.py
67b1d9cc0273df77
7.6
15
"""Provides handling of TCC gateways.""" from __future__ import annotations from functools import cached_property from typing import TYPE_CHECKING, Final from .const import ( SZ_ACTIVE_FAULTS, SZ_GATEWAY_ID, SZ_GATEWAY_INFO, SZ_MAC, SZ_SYSTEM_ID, SZ_TEMPERATURE_CONTROL_SYSTEMS, ) from .contro...
zxdavb/evohome-async
src/evohomeasync2/gateway.py
.py
803371810d0b53a0
7.6
15
"""Provides handling of TCC DHW zones.""" # TODO: extend set_mode() for non-evohome modes from __future__ import annotations from functools import cached_property from typing import TYPE_CHECKING, Final from _evohome.helpers import as_aware_dtm, as_local_time from . import exceptions as exc from .const import ( ...
zxdavb/evohome-async
src/evohomeasync2/hotwater.py
.py
d02bc06643415947
7.6
15
"""Provides handling of TCC v2 locations. The entity hierarchy is: Location -> Gateway -> TCS -> DHW | Zone. """ from __future__ import annotations import logging from datetime import UTC, datetime as dt, tzinfo from functools import cached_property from typing import TYPE_CHECKING from aiozoneinfo import async_get...
zxdavb/evohome-async
src/evohomeasync2/location.py
.py
bdaf1b4370cef5b9
7.6
15
"""evohomeasync provides an async client for the v2 Resideo TCC API.""" from __future__ import annotations import logging from http import HTTPStatus from typing import TYPE_CHECKING, Final from zoneinfo import ZoneInfo, ZoneInfoNotFoundError from aiozoneinfo import async_get_time_zone from . import exceptions as e...
zxdavb/evohome-async
src/evohomeasync2/main.py
.py
40a5ec2e94c141a0
7.6
15
"""Schema for the vendor's TCC v2 API - for GET account of User, etc. These TypedDict & StrEnums serve as documentation of the vendor's API, even if they are unused by this library. There are corresponding factory functions for the voluptuous schemas, which can be used to validate/coerce the vendor's responses. The v...
zxdavb/evohome-async
src/evohomeasync2/schemas/account.py
.py
f0183464a72657ea
7.6
15
"""Schema for the vendor's TCC v2 API - for GET config of user's Installation. These TypedDict & StrEnums serve as documentation of the vendor's API, even if they are unused by this library. There are corresponding factory functions for the voluptuous schemas, which can be used to validate/coerce the vendor's response...
zxdavb/evohome-async
src/evohomeasync2/schemas/config.py
.py
c06e3a51966dc783
7.6
15
"""Helper utilities for the vendor's TCC v2 API.""" from __future__ import annotations from datetime import datetime as dt from enum import StrEnum from typing import TYPE_CHECKING import voluptuous as vol from _evohome.helpers import camel_to_snake if TYPE_CHECKING: from collections.abc import Callable # Th...
zxdavb/evohome-async
src/evohomeasync2/schemas/helpers.py
.py
24a57b7839d2f553
7.6
15
"""Schema for the vendor's TCC v2 API - for PUT state of TCS/Zone/DHW. These TypedDict & StrEnums serve as documentation of the vendor's API, even if they are unused by this library. There are corresponding factory functions for the voluptuous schemas, which can be used to validate/coerce the vendor's responses. The ...
zxdavb/evohome-async
src/evohomeasync2/schemas/state.py
.py
3a35f9e7348bd2fc
7.6
15
"""Tests for evohome-async.""" from __future__ import annotations import json from datetime import UTC, datetime as dt, timedelta as td from typing import TYPE_CHECKING import pytest from evohome_cli.auth import TokenCacheManager from evohomeasync import EvohomeClient as EvohomeClientV0 from evohomeasync2 import Ev...
zxdavb/evohome-async
tests/conftest.py
.py
efd2268eecc02b66
7.1
15
"""Tests for evohome-async - helper functions.""" from __future__ import annotations import inspect import json from datetime import datetime as dt from functools import cached_property from pathlib import Path from typing import TYPE_CHECKING, Any import pytest import yaml from freezegun.api import FakeDatetime # ...
zxdavb/evohome-async
tests/tests/common.py
.py
b38daf3448cedbcc
8.1
15
"""Tests for evohome-async v2 schema - validate completeness of constants and enums.""" from __future__ import annotations import inspect from enum import StrEnum import evohomeasync2.const as evo_const import evohomeasync2.schemas.const as tcc_const from _evohome.helpers import camel_to_snake # Pythonic SZ_* const...
zxdavb/evohome-async
tests/tests/test_const.py
.py
086a818441ee6d20
8.1
15
"""Module for publishing directories / files in OS Swift.""" # Made with Python fire for easy creation, may be improved in the future. import subprocess # nosec import os import sys import logging import asyncio import time import swift_x_account_sharing_bind import fire logging.basicConfig( format="%(level...
CSCfi/swift-browser-ui
bindings/python/publish.py
.py
9b3ad0e758a9bbad
7.6
15
"""Authentication support module.""" import hmac import logging import os import secrets import time import typing import aiohttp.web LOGGER = logging.getLogger("swift_browser_ui.common.signature") LOGGER.setLevel(os.environ.get("LOG_LEVEL", "INFO")) def sign_api_request( path: str, valid_for: int = 3600, key:...
CSCfi/swift-browser-ui
swift_browser_ui/common/signature.py
.py
c9abd6d6ef506e1d
7.6
15
"""Module containing launchers for the different services.""" import swift_browser_ui.request.server import swift_browser_ui.sharing.server import swift_browser_ui.ui.shell import swift_browser_ui.upload.server def run_ui() -> None: """Run the UI.""" swift_browser_ui.ui.shell.main() def run_sharing() -> No...
CSCfi/swift-browser-ui
swift_browser_ui/launcher.py
.py
e91561f7c7e076c3
7.6
15
"""Share request backend module.""" import asyncio import logging import sys import typing import aiohttp.web import uvloop import swift_browser_ui.common.common_handlers import swift_browser_ui.common.common_middleware import swift_browser_ui.common.common_util import swift_browser_ui.common.db from swift_browser_u...
CSCfi/swift-browser-ui
swift_browser_ui/request/server.py
.py
050f667905b32fd2
7.6
15
"""Sharing backend server module.""" import asyncio import logging import sys import typing import aiohttp.web import uvloop import swift_browser_ui.common.common_handlers import swift_browser_ui.common.common_middleware import swift_browser_ui.common.common_util import swift_browser_ui.common.db from swift_browser_...
CSCfi/swift-browser-ui
swift_browser_ui/sharing/server.py
.py
90e0db9dcd9ab351
7.6
15
"""Miscallaneous convenience functions used during the project. Module contains funcions for e.g. authenticating against openstack v3 identity API, cache manipulation, cookies etc. """ import logging import os import secrets import ssl import typing import aiohttp import aiohttp.web import aiohttp_session import cer...
CSCfi/swift-browser-ui
swift_browser_ui/ui/_convenience.py
.py
ced8d1c2c59bf378
7.6
15
"""Middlewares for the swift-browser-ui.""" import time import typing import aiohttp_session from aiohttp import web from swift_browser_ui.ui.settings import setd AiohttpHandler = typing.Callable[ [web.Request], typing.Coroutine[typing.Awaitable[typing.Any], typing.Any, web.Response], ] def return_error_r...
CSCfi/swift-browser-ui
swift_browser_ui/ui/middlewares.py
.py
4cc9148c7067ddde
7.6
15
"""Container and object replication handlers using aiohttp.""" import base64 import logging import math import os import secrets import uuid from typing import Any import aiohttp.web import botocore.exceptions import swift_browser_ui.common.vault_client LOGGER = logging.getLogger(__name__) LOGGER.setLevel(os.enviro...
CSCfi/swift-browser-ui
swift_browser_ui/ui/replicate.py
.py
c0e4be2aa96fa63e
7.6
15
"""swift_browser_ui server related convenience functions.""" # Generic imports import asyncio import base64 import logging import secrets import ssl import sys import typing import aiohttp.web import aiohttp_session import aiohttp_session.redis_storage import cryptography.fernet import uvloop from idpyoidc.client.rp_...
CSCfi/swift-browser-ui
swift_browser_ui/ui/server.py
.py
ae15306cf1a956e7
7.6
15
"""CLI for configuring and launching the server.""" import logging import sys import typing import click from swift_browser_ui.__init__ import __version__ from swift_browser_ui.ui.server import run_server_insecure, run_server_secure, servinit from swift_browser_ui.ui.settings import FORMAT, set_key, setd @click.gr...
CSCfi/swift-browser-ui
swift_browser_ui/ui/shell.py
.py
eee6551f8e440816
7.6
15
"""Common resources for swift-upload-runner.""" import logging import os import typing import aiohttp.web LOGGER = logging.getLogger(__name__) LOGGER.setLevel(os.environ.get("LOG_LEVEL", "INFO")) VAULT_CLIENT = "vault_client" SEGMENTS_CONTAINER = "_segments" def generate_download_url( host: str, containe...
CSCfi/swift-browser-ui
swift_browser_ui/upload/common.py
.py
7e3b0046d798cdbc
7.6
15
"""Class for session crypt upload/download websocket.""" import asyncio import base64 import logging import os import random import secrets import ssl import typing import aiohttp.client import aiohttp.web import certifi import msgpack from aiohttp import ClientTimeout import swift_browser_ui.common.vault_client as ...
CSCfi/swift-browser-ui
swift_browser_ui/upload/cryptupload.py
.py
dc11b54e066b06eb
7.6
15
"""Container and object replication handlers using aiohttp.""" import base64 import logging import os import ssl import typing import aiohttp.client import aiohttp.web import certifi from aiohttp import ClientTimeout import swift_browser_ui.common.vault_client from swift_browser_ui.upload import common LOGGER = log...
CSCfi/swift-browser-ui
swift_browser_ui/upload/replicate.py
.py
8517a53002065701
7.6
15
"""Server initialization functions.""" import asyncio import logging import os import sys import typing import aiohttp.client import aiohttp.web import uvloop import swift_browser_ui.common.common_middleware import swift_browser_ui.common.common_util import swift_browser_ui.common.db from swift_browser_ui.common.vau...
CSCfi/swift-browser-ui
swift_browser_ui/upload/server.py
.py
37ad21d156ad3e53
7.6
15
# -*- coding: utf-8 -*- """Basic EnergySystem class This file is part of project oemof.network. It's copyrighted by the contributors recorded in the version control history of the file, available from its original location oemof/oemof/energy_system.py SPDX-FileCopyrightText: Stephan Günther <> SPDX-FileCopyrightText...
oemof/oemof-network
src/oemof/network/energy_system.py
.py
8de8128383f5134d
7.56
12
# -*- coding: utf-8 -*- """All you need to create groups of stuff in your energy system. This file is part of project oemof (github.com/oemof/oemof). It's copyrighted by the contributors recorded in the version control history of the file, available from its original location oemof/oemof/groupings.py SPDX-FileCopyri...
oemof/oemof-network
src/oemof/network/groupings.py
.py
de77ed5cdbd28c6d
7.56
12
# -*- coding: utf-8 -*- """This package contains the class Edge used to model energy systems. SPDX-FileCopyrightText: Stephan Günther <> SPDX-FileCopyrightText: Uwe Krien <uwe.krien@ifam.fraunhofer.de> SPDX-FileCopyrightText: Simon Hilpert <> SPDX-FileCopyrightText: Cord Kaldemeyer <> SPDX-FileCopyrightText: Patrik S...
oemof/oemof-network
src/oemof/network/network/edge.py
.py
9f3751366ede4718
7.56
12
# -*- coding: utf-8 -*- """This package contains the abstract entity classes used to model energy systems. SPDX-FileCopyrightText: Stephan Günther <> SPDX-FileCopyrightText: Uwe Krien <uwe.krien@ifam.fraunhofer.de> SPDX-FileCopyrightText: Simon Hilpert <> SPDX-FileCopyrightText: Cord Kaldemeyer <> SPDX-FileCopyrightT...
oemof/oemof-network
src/oemof/network/network/entity.py
.py
e049dd0780ea7ea1
7.56
12
# -*- coding: utf-8 -*- """This package contains helpers used by Entities of the energy systems. SPDX-FileCopyrightText: Stephan Günther <> SPDX-FileCopyrightText: Uwe Krien <uwe.krien@ifam.fraunhofer.de> SPDX-FileCopyrightText: Simon Hilpert <> SPDX-FileCopyrightText: Cord Kaldemeyer <> SPDX-FileCopyrightText: Patri...
oemof/oemof-network
src/oemof/network/network/helpers.py
.py
fd1f6c923b037a14
7.56
12
# -*- coding: utf-8 -*- """This package contains the differnt types of Node for modelling an energy system graph. SPDX-FileCopyrightText: Stephan Günther <> SPDX-FileCopyrightText: Uwe Krien <uwe.krien@ifam.fraunhofer.de> SPDX-FileCopyrightText: Simon Hilpert <> SPDX-FileCopyrightText: Cord Kaldemeyer <> SPDX-FileCopy...
oemof/oemof-network
src/oemof/network/network/nodes.py
.py
f4caafaf5f323264
7.56
12
"""Specific tests for the `oemof.groupings` module. Most parts of the `groupings` module are tested via other tests, but certain code paths don't get covered by those, which is what this module is for. This file is part of project oemof (github.com/oemof/oemof). It's copyrighted by the contributors recorded in the ve...
oemof/oemof-network
tests/test_groupings/test_groupings_advanced.py
.py
2e86b2c328490554
7.06
12
# -*- coding: utf-8 - """Basic tests. This file is part of project oemof.network (github.com/oemof/oemof-network). SPDX-FileCopyrightText: Stephan Günther <> SPDX-FileCopyrightText: Uwe Krien <uwe.krien@ifam.fraunhofer.de> SPDX-FileCopyrightText: Simon Hilpert <> SPDX-FileCopyrightText: Cord Kaldemeyer <> SPDX-FileC...
oemof/oemof-network
tests/test_groupings/test_groupings_in_es.py
.py
54e293bb1f5d525e
8.06
12
# -*- coding: utf-8 - """Test the created constraints against approved constraints. This file is part of project oemof (github.com/oemof/oemof). It's copyrighted by the contributors recorded in the version control history of the file, available from its original location oemof/tests/test_network_classes.py SPDX-File...
oemof/oemof-network
tests/test_network_classes.py
.py
34ecb9af2b833592
8.06
12
import pytest from oemof.network import Node class TestNode: """Tests for Node class""" def test_init_basic(self): """Basic initialisation""" subnet = Node("test_subnet") assert subnet.label == "test_subnet" assert subnet.parent is None assert subnet.depth == 0 ...
oemof/oemof-network
tests/test_nodes.py
.py
7cacb1a9340ea6af
8.06
12
from pathlib import Path from typing import Any from fastlabel.exceptions import FastLabelInvalidException from fastlabel.lerobot import v3 from fastlabel.lerobot.common import ( Camera, check_dependencies, detect_version, load_info, ) from fastlabel.lerobot.converter import LeRobotConverter from fastl...
fastlabel/fastlabel-python-sdk
fastlabel/lerobot/__init__.py
.py
c2ee717890a8c7b5
7.62
16
import json from pathlib import Path from typing import Any, NamedTuple from fastlabel.exceptions import FastLabelInvalidException class Camera(NamedTuple): """A dataset camera. Shared contract between data access and converter. path is the video directory (v3: videos/observation.images.X). key is the o...
fastlabel/fastlabel-python-sdk
fastlabel/lerobot/common.py
.py
b38ef0215a0e31ca
7.62
16
from collections.abc import Callable from typing import Annotated, Any, ClassVar from fastlabel.exceptions import FastLabelInvalidException from fastlabel.lerobot.common import Camera # Format-agnostic domain types. Deliberately generic (not v3-specific) so this # module stays decoupled from any dataset version. Meta...
fastlabel/fastlabel-python-sdk
fastlabel/lerobot/converter.py
.py
e9fa607e3b46575c
7.62
16
import json import logging import shutil import tempfile from pathlib import Path from typing import Any, TypedDict import cv2 from fastlabel.exceptions import FastLabelInvalidException from fastlabel.lerobot.common import Camera logger = logging.getLogger(__name__) class VideoInfo(TypedDict): """Per-episode l...
fastlabel/fastlabel-python-sdk
fastlabel/lerobot/v3.py
.py
4043f013f66eca18
7.62
16
import base64 import json import os from typing import List from uuid import uuid4 import cv2 import geojson import numpy as np from fastlabel import const from .mask_image_util import mask_to_segmentation # noqa: F401 def base64_encode(file_path: str) -> str: with open(file_path, "rb") as f: return b...
fastlabel/fastlabel-python-sdk
fastlabel/utils/__init__.py
.py
a730340101a283c9
7.62
16
import rnapolis.annotator import rnapolis.parser from eltetrado.analysis import eltetrado from eltetrado.cli import handle_input_file, read_secondary_structure_from_dssr from eltetrado.dto import convert_nucleotides, convert_tetrads, generate_dto def test_convert_nucleotides(): """ Load structure in nucleic_...
tzok/eltetrado
tests/test_dto.py
.py
3520879eccbdfe4d
7.16
20
"""Setup for pytest.""" def pytest_addoption(parser): """Add command line options to pytest.""" parser.addoption("--token", action="store", default=None) def pytest_generate_tests(metafunc): """Parametrize tests with command line options.""" option_value = metafunc.config.option.token if "token"...
plus3it/satsuki
tests/conftest.py
.py
f39901c45cec1cd9
7.56
12
# -*- coding: utf-8 -*- # pylint: disable=redefined-outer-name """Test Satsuki module.""" import os import uuid from unittest.mock import patch, MagicMock import pytest import github import satsuki from satsuki import Arguments, ReleaseMgr TEST_UUID = str(uuid.uuid1()) TEST_SLUG = "plus3it/satsuki-tests" TEST_TAG = ...
plus3it/satsuki
tests/test_satsuki.py
.py
dba2c95b7d540278
7.06
12
# Copyright 2023 AstroLab Software # Author: Julien Peloton # # 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 applicabl...
astrolabsoftware/ztf.fink-portal.org
apps/euclid/utils.py
.py
1787979244eae68c
7.54
11
# Copyright 2023-2024 AstroLab Software # Author: Julien Peloton # # 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 appl...
astrolabsoftware/ztf.fink-portal.org
apps/mining/utils.py
.py
a78eae14d6192a7f
7.54
11
# Copyright 2025 AstroLab Software # Authors: Julian Hamo, Julien Peloton # # 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 require...
astrolabsoftware/ztf.fink-portal.org
apps/observability/utils.py
.py
7b80acce148bd0c2
7.54
11
# Copyright 2021-2022 AstroLab Software # Author: Julien Peloton # # 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 appl...
astrolabsoftware/ztf.fink-portal.org
apps/statistics.py
.py
31d2dc57b2059ed6
7.54
11
# Copyright 2023 AstroLab Software # Author: Julien Peloton # # 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 applicabl...
astrolabsoftware/ztf.fink-portal.org
assets/spark_elasticc_transfer.py
.py
7ce402452f0c1eca
7.54
11
#!/usr/bin/env python # Copyright 2023-2025 AstroLab Software # Author: Julien Peloton # # 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 # # U...
astrolabsoftware/ztf.fink-portal.org
assets/spark_ztf_transfer.py
.py
6a353dfbb1ded06f
7.54
11
#!/usr/bin/env python # Copyright 2025-2026 AstroLab Software # Author: Julien Peloton # # 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 # # U...
astrolabsoftware/ztf.fink-portal.org
assets/spark_ztf_xmatch.py
.py
d25c4b9bb194fadd
7.54
11
# Copyright 2024 AstroLab Software # Author: Sergey Karpov # # 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...
astrolabsoftware/ztf.fink-portal.org
telemetry.py
.py
bba6ba303f0db429
7.54
11
""" E2Eの実行履歴(tests/e2e/conftest.pyが書く .e2e-runs/<run_id>.json)をSQLiteに 取り込む。「常連フレーキーの中に直せるものがあるか」「フレーキーだと思っている テストが実は壊れているか」を判定するための生データを溜める(#128)。分析はまだ 無い(活用は後回し。まず漏らさず残す)。 Usage: uv run --no-project python scripts/e2e_history.py ingest # .e2e-runs/*.json を取り込む uv run --no-project python scripts/...
asobann/asobann_app
scripts/e2e_history.py
.py
db1c5be5cbdbf51a
7.45
7
""" Summarize one or two run_load_suite.sh result directories into a Markdown table, joining each configuration's CloudWatch CPU utilization (looked up by its recorded UTC start/end time) with the latency/loss numbers already in its result JSON. Usage: uv run --no-project --with boto3 python scripts/summarize_load...
asobann/asobann_app
scripts/summarize_load_suite.py
.py
a4cdc13b77c9d7ad
7.45
7
import asyncio import os from pathlib import Path from urllib.parse import urlsplit import boto3 import socketio from pymongo import AsyncMongoClient from quart import Quart, render_template, request, redirect, url_for, jsonify, json, make_response, send_file from werkzeug.datastructures import FileStorage import aso...
asobann/asobann_app
src/asobann/app/__init__.py
.py
3b48158ce81f6cde
7.45
7
import random import json from pathlib import Path import datetime tables = None table_metas = None def generate_new_tablename(): return str(random.randint(0, 9999)) + ''.join([random.choice('abddefghijklmnopqrstuvwxyz') for i in range(3)]) async def get(tablename): data = await tables.find_one({"tablename...
asobann/asobann_app
src/asobann/store/tables.py
.py
649b0ecc506e9d19
7.45
7
import os import socket import subprocess import sys import time from typing import Optional, Dict import pytest debug_server_config = {} # Launch the server with the interpreter that's already running the tests, rather than a # hardcoded /usr/local/bin/pipenv. The e2e image (Dockerfile.e2e) is built on the # produc...
asobann/asobann_app
tests/conftest.py
.py
d859fcc64464175b
7.95
7
import argparse from types import MappingProxyType from typing import Final import gitlab from gitlab.v4.objects import Project from kira_setup.logging import report_progress from kira_setup.pipelines import ( container_registry, labels, merge_requests, project, protected, ) PIPELINE_STEPS: Final...
wemake-services/kira-setup
kira_setup/api.py
.py
f480f176da00a9f9
7.52
10
from collections.abc import Callable from contextlib import suppress from functools import wraps from typing import ParamSpec, TypeVar from gitlab.exceptions import GitlabCreateError ParamT = ParamSpec('ParamT') ReturnT = TypeVar('ReturnT') def idempotent( function: Callable[ParamT, ReturnT], ) -> Callable[Para...
wemake-services/kira-setup
kira_setup/decorators.py
.py
efa6bd330da67cb0
7.52
10
from collections.abc import Callable from functools import wraps from typing import ParamSpec, TypeVar from termcolor import colored ParamT = ParamSpec('ParamT') ReturnT = TypeVar('ReturnT') def report_progress( function: Callable[ParamT, ReturnT], ) -> Callable[ParamT, ReturnT]: """Decorates a function to ...
wemake-services/kira-setup
kira_setup/logging.py
.py
d1188c259bedd402
7.52
10
from types import MappingProxyType from typing import Final from gitlab.v4.objects import Project from kira_setup.decorators import idempotent _LABELS: Final = MappingProxyType({ # Common: 'bug': '#FF0000', 'feature': '#428BCA', 'documentation': '#69D100', 'research': '#5843AD', 'dependencies...
wemake-services/kira-setup
kira_setup/pipelines/labels.py
.py
996a18e71ebdaf14
7.52
10
from gitlab.exceptions import GitlabGetError, GitlabParsingError from gitlab.v4.objects import Project from kira_setup.decorators import idempotent #: Used to enforce one-task = one-branch, #: also has a fallback for dependabot updates: branch_regex = r'^(issue-\d+)|(dependabot.*)|(renovate.*)|(master)$' #: Enforces...
wemake-services/kira-setup
kira_setup/pipelines/project.py
.py
7a782bd41b5355c9
7.52
10
from gitlab import const from gitlab.v4.objects import Project from kira_setup.decorators import idempotent @idempotent def branches(project: Project) -> None: """ Creates protected branch rules. API: https://docs.gitlab.com/api/protected_branches/ """ project.protectedbranches.create({ ...
wemake-services/kira-setup
kira_setup/pipelines/protected.py
.py
d0d927d7b05a818a
7.52
10