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
""" Test utilities for use by consumers of openedx-events. Provides mixins that help isolate Open edX event state between test classes. """ from openedx_events.tooling import OpenEdxPublicSignal class FreezeSignalCacheMixin: """ A mixin to be used by TestCases to avoid new signals persisting in the OpenEdxP...
openedx/openedx-events
openedx_events/testing.py
.py
31ea2762c45bf8e5
7.07
13
""" Tests for consume_events command. """ from unittest.mock import patch from django.core.management import call_command from django.test import TestCase from openedx_events.management.commands.consume_events import Command class TestCommand(TestCase): """ Tests for the consume_events management command ...
openedx/openedx-events
openedx_events/tests/test_consume_events_command.py
.py
24c8748cde8e2e54
7.07
13
""" Tests for openedx_events.data module.""" from datetime import datetime, timezone from uuid import UUID import ddt from django.test import TestCase from django.test.utils import override_settings from openedx_events.data import EventsMetadata @ddt.ddt class TestEventsMetadata(TestCase): """ Tests for the...
openedx/openedx-events
openedx_events/tests/test_data.py
.py
f717fc4b15a3e7fc
8.07
13
"""Tests for generate_avro_schemas.""" import os from importlib import import_module from unittest.mock import call, mock_open, patch from django.core.management import call_command from django.test import TestCase from openedx_events.event_bus.avro.tests.test_utilities import create_simple_signal from openedx_events...
openedx/openedx-events
openedx_events/tests/test_generate_avro_schemas.py
.py
5b86844ba4cf3b52
8.07
13
""" This file contains all test for the tooling.py file. Classes: EventsToolingTest: Test events tooling. """ import datetime import sys from contextlib import contextmanager from unittest.mock import Mock, patch from uuid import UUID, uuid1 import attr import ddt import pytest from django.test import TestCase, o...
openedx/openedx-events
openedx_events/tests/test_tooling.py
.py
8f6fefa6cae8509a
7.07
13
""" Tests for openedx_events/testing.py. """ from django.test import TestCase from openedx_events.testing import FreezeSignalCacheMixin, OpenEdxEventsTestMixin from openedx_events.tooling import OpenEdxPublicSignal, load_all_signals class OpenEdxEventsTestMixinIsolationTest(FreezeSignalCacheMixin, TestCase): """...
openedx/openedx-events
openedx_events/tests/test_utils.py
.py
33642578ca29419b
8.07
13
""" Tooling necessary to use Open edX events. """ import pkgutil import warnings from importlib import import_module from logging import getLogger from django.conf import settings from django.db import connection from django.dispatch import Signal from edx_django_utils.cache import RequestCache from openedx_events.da...
openedx/openedx-events
openedx_events/tooling.py
.py
79d32855e98d2a9d
7.57
13
""" Utilities for Open edX events usage. """ import collections import traceback from pprint import PrettyPrinter class ResponsePrettyPrinter(PrettyPrinter): """ Custom printer for Open edX Events responses. This class pretty-prints the response of common Django Signals. """ # pylint: disable-ne...
openedx/openedx-events
openedx_events/utils.py
.py
f6ccb53879f12758
7.57
13
#!/usr/bin/env python3 # Copyright 2024 Jon Seager (@jnsgruk) # See LICENSE file for licensing details. """Charmed Operator for Zinc; a lightweight elasticsearch alternative.""" import logging import secrets import ops from charms.grafana_k8s.v0.grafana_dashboard import GrafanaDashboardProvider from charms.loki_k8s....
jnsgruk/zinc-k8s-operator
src/charm.py
.py
cc8c868c39af8cb7
7.52
10
#!/usr/bin/env python3 # Copyright 2024 Jon Seager (@jnsgruk) # See LICENSE file for licensing details. """Assist with client interactions with Zinc.""" import json import logging import time import urllib.request logger = logging.getLogger(__name__) class Zinc: """Represent a Zinc instance in the workload."""...
jnsgruk/zinc-k8s-operator
src/zinc.py
.py
d486dac8d78a6d11
7.52
10
# Copyright 2024 Jon Seager (@jnsgruk) # See LICENSE file for licensing details. import functools import logging import time ZINC = "zinc-k8s" TRAEFIK = "traefik-k8s" def retry(retry_num, retry_sleep_sec): def decorator(func): @functools.wraps(func) def wrapper(*args, **kwargs): for i...
jnsgruk/zinc-k8s-operator
tests/integration/__init__.py
.py
d5e90bdf2ff059de
7.02
10
# Copyright 2021 Canonical Ltd. # See LICENSE file for licensing details. import os import subprocess import time from collections.abc import Callable from pathlib import Path import jubilant import yaml from pytest import fixture from . import TRAEFIK @fixture(scope="module") def juju(): with jubilant.temp_mo...
jnsgruk/zinc-k8s-operator
tests/integration/conftest.py
.py
e1c71815adb3ef2d
8.02
10
#!/usr/bin/env python3 # Copyright 2024 Jon Seager (@jnsgruk) # See LICENSE file for licensing details. import base64 import gzip import json from urllib.request import Request, urlopen import jubilant import yaml from . import ZINC, retry def _get_password(juju: jubilant.Juju) -> str: result = juju.cli( ...
jnsgruk/zinc-k8s-operator
tests/integration/test_charm_basic.py
.py
80cbcf9ace31a1fa
7.02
10
#!/usr/bin/env python3 # Copyright 2024 Jon Seager (@jnsgruk) # See LICENSE file for licensing details. import json from urllib.request import Request, urlopen import jubilant from . import TRAEFIK, ZINC, retry def test_deploy(juju: jubilant.Juju, zinc_charm, zinc_oci_image): """Test that Zinc can be related ...
jnsgruk/zinc-k8s-operator
tests/integration/test_ingress_traefik.py
.py
9e6eb084551f9f3d
8.02
10
#!/usr/bin/env python3 # Copyright 2024 Jon Seager (@jnsgruk) # See LICENSE file for licensing details. import jubilant from pytest import mark from . import ZINC O11Y_CHARMS = ["prometheus-k8s", "grafana-k8s", "loki-k8s", "parca-k8s"] O11Y_RELS = ["metrics-endpoint", "grafana-dashboard", "log-proxy", "profiling-en...
jnsgruk/zinc-k8s-operator
tests/integration/test_observability_relations.py
.py
3255cdb4d3c245aa
7.02
10
#!/usr/bin/env python3 # Copyright 2024 Jon Seager (@jnsgruk) # See LICENSE file for licensing details. import json from urllib.request import Request, urlopen import jubilant from . import TRAEFIK, ZINC, retry def test_deploy(juju: jubilant.Juju, zinc_charm, zinc_oci_image): """Test that Zinc can be related w...
jnsgruk/zinc-k8s-operator
tests/integration/test_path_ingress_traefik.py
.py
1122df4ffa3318f7
8.02
10
# Copyright 2026 Canonical Ltd. # See LICENSE file for licensing details. import subprocess import pytest from tests.integration.conftest import _get_traefik_lb_ip def test_get_traefik_lb_ip_waits_until_service_has_ip(): """Return the first non-empty Traefik LoadBalancer IP.""" calls = [] outputs = [""...
jnsgruk/zinc-k8s-operator
tests/unit/test_ingress_helpers.py
.py
b0d11bbb7b0025f1
8.02
10
"""Helper methods and variables for acceptance tests.""" import os def absjoin(*paths: str) -> str: return os.path.abspath(os.path.join(*paths)) thisdir: str = os.path.split(__file__)[0] scratch_dir: str = absjoin(thisdir, "../_scratch") # scratch output docx file ------------- saved_docx_path: str = absjoin(...
lsaint/python-docx-oss
features/steps/helpers.py
.py
8e5efcd19ac1fe46
7.57
13
"""Directly exposed API functions and classes, :func:`Document` for now. Provides a syntactically more convenient API for interacting with the OpcPackage graph. """ from __future__ import annotations import io import os from typing import IO, TYPE_CHECKING, cast from docx.opc.constants import CONTENT_TYPE as CT fro...
lsaint/python-docx-oss
src/docx/api.py
.py
8c8a235d6e084431
7.57
13
# pyright: reportImportCycles=false """Block item container, used by body, cell, header, etc. Block level items are things like paragraph and table, although there are a few other specialized ones like structured document tags. """ from __future__ import annotations from typing import TYPE_CHECKING, Iterator from ...
lsaint/python-docx-oss
src/docx/blkcntnr.py
.py
ff17bb533dd1042c
7.57
13
"""Collection providing access to comments added to this document.""" from __future__ import annotations import datetime as dt from typing import TYPE_CHECKING, Iterator from docx.blkcntnr import BlockItemContainer if TYPE_CHECKING: from docx.oxml.comments import CT_Comment, CT_Comments from docx.parts.comm...
lsaint/python-docx-oss
src/docx/comments.py
.py
32668fed4f6664e5
7.57
13
"""DrawingML objects related to color, ColorFormat being the most prominent.""" from __future__ import annotations from typing import TYPE_CHECKING, cast from typing_extensions import TypeAlias from docx.enum.dml import MSO_COLOR_TYPE from docx.oxml.simpletypes import ST_HexColorAuto from docx.shared import Element...
lsaint/python-docx-oss
src/docx/dml/color.py
.py
3bbc5e570b426ce3
7.57
13
# pyright: reportImportCycles=false # pyright: reportPrivateUsage=false """|Document| and closely related objects.""" from __future__ import annotations import io from typing import IO, TYPE_CHECKING, Iterator, List, Sequence from docx.api import Document as open_document from docx.blkcntnr import BlockItemContaine...
lsaint/python-docx-oss
src/docx/document.py
.py
b3da2895183d5b7e
7.57
13
"""DrawingML-related objects are in this subpackage.""" from __future__ import annotations from typing import TYPE_CHECKING from docx.oxml.drawing import CT_Drawing from docx.shared import Parented if TYPE_CHECKING: import docx.types as t from docx.image.image import Image class Drawing(Parented): """...
lsaint/python-docx-oss
src/docx/drawing/__init__.py
.py
84c6fe615dd015df
7.57
13
"""Base classes and other objects used by enumerations.""" from __future__ import annotations import enum import textwrap from typing import TYPE_CHECKING, Any, Dict, Type, TypeVar if TYPE_CHECKING: from typing_extensions import Self _T = TypeVar("_T", bound="BaseXmlEnum") class BaseEnum(int, enum.Enum): ...
lsaint/python-docx-oss
src/docx/enum/base.py
.py
ae1ea6168c14e2a0
7.57
13
"""Enumerations used by DrawingML objects.""" from .base import BaseEnum, BaseXmlEnum class MSO_COLOR_TYPE(BaseEnum): """Specifies the color specification scheme. Example:: from docx.enum.dml import MSO_COLOR_TYPE assert font.color.type == MSO_COLOR_TYPE.SCHEME MS API name: `MsoColorT...
lsaint/python-docx-oss
src/docx/enum/dml.py
.py
0eaaa4631974f625
7.57
13
"""Enumerations related to styles.""" from .base import BaseEnum, BaseXmlEnum class WD_BUILTIN_STYLE(BaseEnum): """Alias: **WD_STYLE** Specifies a built-in Microsoft Word style. Example:: from docx import Document from docx.enum.style import WD_STYLE document = Document() ...
lsaint/python-docx-oss
src/docx/enum/style.py
.py
67d70147b3779829
7.57
13
"""Enumerations related to text in WordprocessingML files.""" from __future__ import annotations import enum from docx.enum.base import BaseXmlEnum class WD_PARAGRAPH_ALIGNMENT(BaseXmlEnum): """Alias: **WD_ALIGN_PARAGRAPH** Specifies paragraph justification type. Example:: from docx.enum.tex...
lsaint/python-docx-oss
src/docx/enum/text.py
.py
a3a6dda49a2dda26
7.57
13
"""Exceptions used with python-docx. The base exception class is PythonDocxError. """ class PythonDocxError(Exception): """Generic error class.""" class InvalidSpanError(PythonDocxError): """Raised when an invalid merge region is specified in a request to merge table cells.""" class InvalidXmlError(P...
lsaint/python-docx-oss
src/docx/exceptions.py
.py
59688ccb766db1f2
7.07
13
from .constants import MIME_TYPE from .helpers import LITTLE_ENDIAN, StreamReader from .image import BaseImageHeader class Bmp(BaseImageHeader): """Image header parser for BMP images.""" @classmethod def from_stream(cls, stream): """Return |Bmp| instance having header properties parsed from the B...
lsaint/python-docx-oss
src/docx/image/bmp.py
.py
c3f261bba841c807
7.57
13
# encoding: utf-8 from .constants import MIME_TYPE from .helpers import LITTLE_ENDIAN, StreamReader from .image import BaseImageHeader class Emf(BaseImageHeader): """ Image header parser for EMF images """ @property def content_type(self): """ MIME content type for this image, un...
lsaint/python-docx-oss
src/docx/image/emf.py
.py
0b6dac0690eeeafc
7.57
13
"""Exceptions specific the the image sub-package.""" class InvalidImageStreamError(Exception): """The recognized image stream appears to be corrupted.""" class UnexpectedEndOfFileError(Exception): """EOF was unexpectedly encountered while reading an image stream.""" class UnrecognizedImageError(Exception)...
lsaint/python-docx-oss
src/docx/image/exceptions.py
.py
ffaae48d75dc6c5c
7.07
13
from struct import Struct from .constants import MIME_TYPE from .image import BaseImageHeader class Gif(BaseImageHeader): """Image header parser for GIF images. Note that the GIF format does not support resolution (DPI) information. Both horizontal and vertical DPI default to 72. """ @classmeth...
lsaint/python-docx-oss
src/docx/image/gif.py
.py
d11ecbd2bee48dff
7.57
13
from struct import Struct from .exceptions import UnexpectedEndOfFileError BIG_ENDIAN = ">" LITTLE_ENDIAN = "<" class StreamReader: """Wraps a file-like object to provide access to structured data from a binary file. Byte-order is configurable. `base_offset` is added to any base value provided to calcu...
lsaint/python-docx-oss
src/docx/image/helpers.py
.py
8f2d1f401a887ecb
7.57
13
"""Provides objects that can characterize image streams. That characterization is as to content type and size, as a required step in including them in a document. """ from __future__ import annotations import hashlib import io import os from typing import IO, Tuple from docx.image.exceptions import UnrecognizedImag...
lsaint/python-docx-oss
src/docx/image/image.py
.py
0ccc3a0e780cafee
7.57
13
"""Functions to train and adjust a dataset using a bias-adjustment algorithm.""" import ast import logging import warnings from copy import deepcopy import xarray as xr import xclim as xc import xsdba from xsdba.processing import from_additive_space, to_additive_space from .catutils import parse_from_ds from .config...
Ouranosinc/xscen
src/xscen/biasadjust.py
.py
22929aef3ba4b0c7
7.65
19
""" Configuration module. Configuration in this module is taken from yaml files. Functions wrapped by :py:func:`parse_config` have their kwargs automatically patched by values in the config. The ``CONFIG`` dictionary contains all values, structured by submodules and functions. For example, for function ``function`` ...
Ouranosinc/xscen
src/xscen/config.py
.py
f1149c0d9992e6d7
7.65
19
"""Functions to compute xclim indicators.""" import logging import os from collections.abc import Sequence from functools import partial from pathlib import Path from types import ModuleType import pandas as pd import xarray as xr import xclim as xc from intake_esm import DerivedVariableRegistry from xclim.core.calen...
Ouranosinc/xscen
src/xscen/indicators.py
.py
76eab98dccdd83fd
7.65
19
"""Functions to regrid datasets.""" import datetime import operator import os import random import string import warnings from copy import deepcopy from pathlib import Path import cartopy.crs as ccrs import cf_xarray as cfxr import xarray as xr from xclim.core.units import convert_units_to try: import xesmf as ...
Ouranosinc/xscen
src/xscen/regrid.py
.py
44890717c42a2000
7.65
19
# noqa: D100 import shutil from pathlib import Path import pytest import xscen as xs from xscen.testing import datablock_3d as _datablock_3d notebooks = Path(__file__).parent.parent / "docs" / "notebooks" SAMPLES_DIR = notebooks / "samples" / "tutorial" @pytest.fixture(scope="session", autouse=True) def cleanup_n...
Ouranosinc/xscen
tests/conftest.py
.py
313ac68997524458
8.15
19
import logging import warnings from pathlib import Path import pytest import xarray as xr import xscen as xs from xscen import CONFIG ROOT = Path(__file__).parent.parent CONFIG_FILE1 = str(ROOT / "templates/1-basic_workflow_with_config/config1.yml") CONFIG_FILE2 = str(ROOT / "templates/2-indicators_only/config2.yml...
Ouranosinc/xscen
tests/test_config.py
.py
ade171ea6bcb87e5
7.15
19
# Made by your friend: Freaku __version__ = '1.7.44+' # Starting versioning of terminal.py henceforth, # since many users complained problems which was actually caused due to them using an older version of us. # Defines a simple plugin that allows you to: ### See any errors of your mods (if present) in folder BombSq...
Freaku17/BombSquad-Mods-byFreaku
Utilities/terminal.py
.py
049c069a0d1675d1
7.48
8
from docutils import nodes def handle_missing_reference(app, env, node, contnode): """ Handle unresolved {ref}`...` references in MyST/Sphinx. If a ref target cannot be resolved, substitute a link to fallback_ref_baseurl + target. """ reftype = node.get("reftype") target = node.get("reftarg...
godot-escoria/escoria-docs
_ext/fallback_ref/__init__.py
.py
7fe2b835e1bc7bcc
7.57
13
import functools import json import base64 from logging import getLogger from typing import Any from aiohttp import ClientSession, ClientResponse, FormData from datetime import datetime, timedelta from .const import AWS_APIKEYS from .util_http import request_with_logging from .errors import SessionError, LoginError ...
dahlb/blueair_api
src/blueair_api/http_aws_blueair.py
.py
4d0fea7923bc9343
7.59
14
import typing from typing import Any from collections.abc import Iterable from logging import getLogger import dataclasses import base64 type ScalarType = str | float | bool | int | None type MappingType = dict[str, "ObjectType"] type SequenceType = list["ObjectType"] type ObjectType = ScalarType | MappingType | Seque...
dahlb/blueair_api
src/blueair_api/intermediate_representation_aws.py
.py
bf18104dbb6ae15c
7.59
14
"""MQTT client for Blueair AWS IoT real-time updates. Connects to the Blueair cloud MQTT broker via WebSocket Secure (WSS) using credentials from the existing c/login API response. Provides real-time sensor data and device state change callbacks. On unexpected disconnect, paho's built-in reconnect loop handles reconn...
dahlb/blueair_api
src/blueair_api/mqtt_aws_blueair.py
.py
f7100289e1d641db
7.59
14
"""Tests for ``request_with_errors`` (the AWS response error classifier). Regression coverage for a production incident: the Blueair AWS/Cognito endpoints occasionally answer with an empty or otherwise non-JSON body (observed as a zero-byte body during a cloud-side hiccup). Before this fix, ``response.json()`` raised ...
dahlb/blueair_api
tests/test_http_aws_blueair_error_classification.py
.py
cce805c29781c304
8.09
14
"""Tests for the gigya_region / cloud_region split on ``HttpAwsBlueair``. These verify: * Existing single-``region`` callers behave identically (back-compat). * ``gigya_region`` and ``cloud_region`` can be set independently. * Each URL builder picks up the *correct* region (Gigya hosts use ``gigya_region``; BlueClo...
dahlb/blueair_api
tests/test_http_aws_blueair_regions.py
.py
e8dffa1411fede8b
8.09
14
from logging.config import fileConfig from sqlalchemy import engine_from_config from sqlalchemy import pool from alembic import context # Application from core.settings import settings from base import BaseModel import models # this is the Alembic Config object, which provides # access to the values within the .ini...
BlackIQ/amirhossein.info
backend/migrations/env.py
.py
19d2555d10aede1a
7.6
15
"""002_default Revision ID: 26f2eee51f72 Revises: b57d48968d4e Create Date: 2026-08-10 15:15:03.970389 """ from typing import Sequence, Union from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision: str = '26f2eee51f72' down_revision: Union[str, Sequence[str], None] = 'b57d...
BlackIQ/amirhossein.info
backend/migrations/versions/26f2eee51f72_002_default.py
.py
e7991f4983aa1849
7.6
15
from functools import cached_property from PyHelpersForPDXWikis.localsettings import AOW4DIR from common.paradox_lib import Game class AgeOfWonders4(Game): """Never construct this object manually. Use the variable aow4game instead. This way all data can be cached without having to pass on references to the g...
grotaclas/PyHelpersForPDXWikis
aow4/game.py
.py
b89ac5e5f5f337b0
7.54
11
import pickle # import numpy from functools import wraps from common.paradox_lib import Game class NoParserPickler(pickle.Pickler): """replaces instances of the game's parser with a persistent id, because the parser contains references which can't be pickled, and it would not be a good idea to pickle t...
grotaclas/PyHelpersForPDXWikis
common/cache.py
.py
cc347885e74f61af
7.54
11
import re from functools import cached_property from typing import Iterator class Localizer: # allows the overriding of localization strings localizationOverrides = {} localization_folder_iterator: Iterator @cached_property def _localization_dict(self) -> dict[str, str]: return {} d...
grotaclas/PyHelpersForPDXWikis
common/localization.py
.py
14808e5aa5a7f22b
7.54
11
import json import subprocess from functools import cached_property from pathlib import Path import UnityPy from UnityPy import Environment from PyHelpersForPDXWikis.localsettings import TYPE_TREE_GENERATOR from common.paradox_lib import Game class UnityReader: def __init__(self, data_folder: Path, game: Game,...
grotaclas/PyHelpersForPDXWikis
common/unity_reader.py
.py
6caeecf47d684738
7.54
11
import re from decimal import Decimal import math from typing import List class WikiTextFormatter: roman_letters = (('M', 1000), ('CM', 900), ('D', 500), ('CD', 400), ('C', 100), ('XC', 90), ...
grotaclas/PyHelpersForPDXWikis
common/wiki.py
.py
cb44bae0acecb29b
7.54
11
import re import shutil from dataclasses import dataclass, field from functools import cached_property from pathlib import Path from typing import Any from PIL import Image from common.wiki import WikiTextFormatter @dataclass class WikiImageFileReference: """There can be multiple references for the same file, p...
grotaclas/PyHelpersForPDXWikis
common/wiki_image.py
.py
999fd50d30114ee2
7.54
11
from enum import Enum, Flag from functools import cached_property from operator import attrgetter class CS2BaseEnum(Enum): def __bool__(self): # treat _None as false return self.name != '_None' @cached_property def display_name(self) -> str: from cs2.game import cs2game re...
grotaclas/PyHelpersForPDXWikis
cs2/cs2_enum.py
.py
f1b935e01036a255
7.54
11
import json import re from functools import cached_property from PyHelpersForPDXWikis.localsettings import CS2DIR from common.paradox_lib import Game from cs2.localization import CS2Localization class CitiesSkylines2(Game): """Never construct this object manually. Use the variable cs2game instead. This way a...
grotaclas/PyHelpersForPDXWikis
cs2/game.py
.py
b1700bf0ffda1aea
7.54
11
import pprint import zipfile from enum import Enum from io import BufferedReader from pathlib import Path from leb128 import u from PyHelpersForPDXWikis.localsettings import CS2DIR class CS2Localization: """Implementation of the custom localization format of Cities Skylines II""" # allows the overriding of ...
grotaclas/PyHelpersForPDXWikis
cs2/localization.py
.py
f08780d8d1b3b859
7.54
11
import math from typing import List from common.wiki import WikiTextFormatter class CS2WikiTextFormatter(WikiTextFormatter): def format_with_units(self, number, units: List[str], unit_weights: List[int] = None): if unit_weights is None: unit_weights = [] unit_weight = 1 ...
grotaclas/PyHelpersForPDXWikis
cs2/text_formatter.py
.py
c727e6641f267606
7.54
11
from functools import cached_property from eu4.paths import eu4outpath try: # when used by PyHelpersForPDXWikis from PyHelpersForPDXWikis.localsettings import EU4DIR except: # when used by ck2utils from localpaths import eu4dir EU4DIR = eu4dir from common.paradox_lib import Game from common.file_gener...
grotaclas/PyHelpersForPDXWikis
eu4/eu4_file_generator.py
.py
002294d5677528af
7.54
11
from functools import cached_property from pathlib import Path from common.paradox_lib import Game from PyHelpersForPDXWikis.localsettings import EU5DIR, EU5DIR_DOCUMENTS try: from PyHelpersForPDXWikis.localsettings import EU5_LANGUAGE except ImportError: EU5_LANGUAGE = 'english' class EuropaUniversalisV(Gam...
grotaclas/PyHelpersForPDXWikis
eu5/game.py
.py
679be44fa4f15958
7.54
11
""" Generates lua data modules """ import luadata import os import sys # add the parent folder to the path so that imports work even if this file gets executed directly sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))) from eu5.eu5_file_generator import Eu5FileGenerator class LuaDataGen...
grotaclas/PyHelpersForPDXWikis
eu5/generate_lua_data.py
.py
bdf2c7dc134a49bc
7.54
11
# Copyright (C) 2022 Jørgen Schartum Dokken # # This file is part of Oasisx # SPDX-License-Identifier: MIT from enum import Enum from typing import Callable from petsc4py import PETSc as _PETSc import dolfinx.fem as _fem import dolfinx.fem.petsc as _petsc import dolfinx.mesh as _dmesh import numpy as np import n...
ComputationalPhysiology/oasisx
src/oasisx/bcs.py
.py
1f3b132145fcd47c
7.42
6
# Copyright (C) 2022 Jørgen Schartum Dokken # # This file is part of Oasisx # SPDX-License-Identifier: MIT from petsc4py import PETSc as _petsc import dolfinx.fem.petsc import ufl class Projector: """ Projector for a given function. Solves Ax=b, where .. highlight:: python .. code-block:: p...
ComputationalPhysiology/oasisx
src/oasisx/function.py
.py
a6bff5c6c0bf8cb6
7.42
6
# Copyright (C) 2022 Jørgen Schartum Dokken # # This file is part of Oasisx # SPDX-License-Identifier: MIT import typing from mpi4py import MPI from petsc4py import PETSc as _PETSc import dolfinx.fem as _fem class KSPSolver: _prefix: str _ksp: _PETSc.KSP # type: ignore def __init__( self, ...
ComputationalPhysiology/oasisx
src/oasisx/ksp.py
.py
0416707b0a2e0493
7.42
6
# Copyright (C) 2022 Jørgen Schartum Dokken # # This file is part of Oasisx # SPDX-License-Identifier: MIT from mpi4py import MPI from petsc4py import PETSc import dolfinx import numpy as np import numpy.typing as npt import pytest import scipy.sparse import ufl from oasisx import DirichletBC, FractionalStep_AB_C...
ComputationalPhysiology/oasisx
test/test_tentative_velocity.py
.py
221c399bf85a5b26
7.92
6
"""Command line interface for the EVNEX Cloud API client. Run without installing anything via uv: uvx evnex auth login uvx evnex status uvx evnex charge-points list uvx evnex sessions list uvx evnex charge now Credentials come from EVNEX_CLIENT_USERNAME / EVNEX_CLIENT_PASSWORD (or are prompted fo...
hardbyte/python-evnex
evnex/cli/__init__.py
.py
5df112b3e55e9f82
7.56
12
"""Typed errors raised by the EVNEX client. All authentication problems derive from EvnexAuthError; catch that to handle "the session is not usable" generically, or a subclass to react to a specific condition. """ import warnings class EvnexAuthError(ValueError): """Base for authentication and session lifecycle...
hardbyte/python-evnex
evnex/errors.py
.py
777334f296c70d5e
7.56
12
from dataclasses import dataclass @dataclass class EvnexModelInfo: name: str connector: str cable_length: str colour: str power: str = "N/A" # Only for X-series power_sensor: str = "N/A" # Only for X-series configuration: str = "N/A" # Only for X-series # Lookup tables CONNECTOR_MAP =...
hardbyte/python-evnex
evnex/models.py
.py
5ded15fddb424101
7.56
12
import time from datetime import UTC, datetime, timedelta from unittest.mock import DEFAULT, MagicMock import jwt import pytest from blockbuster import blockbuster_ctx from tenacity import wait_none from evnex.api import Evnex from evnex.auth import EvnexAuth, TokenSet def make_jwt(expires_in: timedelta = timedelta...
hardbyte/python-evnex
tests/conftest.py
.py
61137bce499ea7d6
8.06
12
"""Schema regression tests built from captured API payloads.""" from evnex.schema.user import EvnexGetUserResponse from evnex.schema.v3.charge_points import EvnexChargePointConnectorMeter def test_user_without_name_validates(): # The API omits the name field entirely for accounts that never set one payload =...
hardbyte/python-evnex
tests/test_schema.py
.py
49ae38a4e5ca690e
8.06
12
"""poetry run python -m scripts.bitvavo.bitvavo""" import json import time from datetime import datetime from pprint import pprint from scripts.common import setup_django_environment setup_django_environment() # Initialize broker registry for standalone script usage from stonks_overwatch.core.registry_setup import ...
ctasada/stonks-overwatch
scripts/bitvavo/bitvavo.py
.py
9bbd939a8206b03f
7.54
11
import logging import os import sys def setup_python_path(): """Add the src directory to Python path. This allows scripts to import from the stonks_overwatch package without requiring Django setup. Returns: None """ # Add the src directory to the Python path src_path = os.path.jo...
ctasada/stonks-overwatch
scripts/common.py
.py
9537f331dc0b1ad0
7.54
11
"""Imports all necessary data from DeGiro. Django Database Dump/Load Script This script provides functionality to: 1. Dump Django database content to a JSON file 2. Load database content from a JSON dump file Usage: poetry run python -m scripts.dump_db --help poetry run python -m scripts.dump_db dump [--outp...
ctasada/stonks-overwatch
scripts/dump_db.py
.py
1edd1a0446d96bad
7.54
11
"""Imports all necessary data from DeGiro. The script is used to update or re-create the DB with all the necessary data from DeGiro. Usage: poetry run python -m scripts.init_db --help """ import logging import os import textwrap from argparse import Namespace from datetime import date from scripts.common import...
ctasada/stonks-overwatch
scripts/init_db.py
.py
ed43929408cc9f9f
7.54
11
import os import subprocess import sys import threading import toga from toga.style import Pack from stonks_overwatch.app.utils.dialog_utils import center_window_on_parent from stonks_overwatch.services.utilities.github_release_service import GitHubReleaseService from stonks_overwatch.utils.core.logger import StonksL...
ctasada/stonks-overwatch
src/stonks_overwatch/app/dialogs/download_dialog.py
.py
6427f0dcfc7faf3f
7.54
11
import asyncio import os import toga from toga.style import Pack from toga.style.pack import COLUMN, ROW class LogStreamWindow(toga.Window): def __init__(self, title, log_path): super().__init__(title=title, size=(800, 500)) self.log_path = log_path self.last_position = 0 self.sea...
ctasada/stonks-overwatch
src/stonks_overwatch/app/ui/logs_window.py
.py
925fd499ad52e7ee
7.54
11
from pathlib import Path from typing import Optional from .exceptions import ( AddonNotFound, AddonNotFoundInvalidManifest, AddonNotFoundNoInit, AddonNotFoundNoManifest, AddonNotFoundNotADirectory, AddonNotFoundNotInstallable, ) from .manifest import InvalidManifest, Manifest, get_manifest_path...
acsone/manifestoo-core
src/manifestoo_core/addon.py
.py
49016e023cade5c0
7.48
8
"""Information about core Odoo addons.""" import sys from functools import lru_cache from typing import Set if sys.version_info >= (3, 9): from importlib.resources import files as package_files else: from importlib_resources import files as package_files from ..odoo_series import OdooEdition, OdooSeries __a...
acsone/manifestoo-core
src/manifestoo_core/core_addons/__init__.py
.py
3c150e7e5f4cb131
7.48
8
import os import subprocess import sys from pathlib import Path from typing import Iterator, List, Optional, TextIO from packaging.version import parse as parse_version if sys.version_info >= (3, 8): from typing import Final else: from typing_extensions import Final from .addon import Addon from .exceptions ...
acsone/manifestoo-core
src/manifestoo_core/git_postversion.py
.py
d444b14e4c4b38b5
7.48
8
import ast from pathlib import Path from typing import Any, Callable, Dict, List, Optional, Tuple, TypeVar from .exceptions import InvalidManifest T = TypeVar("T") VT = TypeVar("VT") __all__ = ["MANIFEST_NAMES", "InvalidManifest", "Manifest", "get_manifest_path"] MANIFEST_NAMES = ("__manifest__.py", "__openerp__.py...
acsone/manifestoo-core
src/manifestoo_core/manifest.py
.py
e8d97afc8347c9ab
7.48
8
"""Odoo Series and Editions.""" from enum import Enum from typing import Optional, Set from .addons_set import AddonsSet from .exceptions import UnsupportedOdooSeries __all__ = [ "OdooEdition", "OdooSeries", "detect_from_addon_version", "detect_from_addons_set", ] MIN_VERSION_PARTS = 5 class Odoo...
acsone/manifestoo-core
src/manifestoo_core/odoo_series.py
.py
2e8086cca941b1a1
7.48
8
"""Core client class for python-openevse-http.""" from __future__ import annotations import asyncio import inspect import json import logging import threading from collections.abc import Callable, Mapping, MutableMapping from typing import Any import aiohttp from aiohttp.client_exceptions import ContentTypeError, Se...
firstof9/python-openevse-http
openevsehttp/client.py
.py
6f24b3849f52294d
7.45
7
"""Property accessors for the OpenEVSE charger.""" from __future__ import annotations import logging import warnings from collections.abc import Mapping from datetime import datetime, timedelta, timezone from typing import Any, cast from .const import MAX_AMPS, MIN_AMPS, states from .exceptions import UnsupportedFea...
firstof9/python-openevse-http
openevsehttp/properties.py
.py
f4025e29ab54e1f5
7.45
7
"""Utility functions for python-openevse-http.""" import logging import re from awesomeversion import AwesomeVersion _LOGGER = logging.getLogger(__name__) def normalize_version(version: str) -> str: """Normalize the version string to strip 'dev' tag.""" if "dev" in version: _LOGGER.debug("Stripping...
firstof9/python-openevse-http
openevsehttp/utils.py
.py
7cf5162fae201534
7.45
7
"""Websocket class for OpenEVSE HTTP.""" from __future__ import annotations import asyncio import datetime import inspect import logging from collections.abc import Awaitable, Callable from typing import Any import aiohttp from .const import ( ERROR_SESSION_LOOP_MISMATCH, ERROR_SESSION_REQUIRED, ) _LOGGER ...
firstof9/python-openevse-http
openevsehttp/websocket.py
.py
c8cb8b36c076a986
7.45
7
# Copyright (c) 2026 Centre National d'Etudes Spatiales (CNES). # # This file is part of PANDORA_MCCNN # # https://github.com/CNES/Pandora_MCCNN # # 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 Licen...
CNES/Pandora_MCCNN
src/mc_cnn/cost_volume/cost_volume_base.py
.py
505fc7d611cddea3
7.62
16
# Copyright (c) 2026 Centre National d'Etudes Spatiales (CNES). # # This file is part of PANDORA_MCCNN # # https://github.com/CNES/Pandora_MCCNN # # 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 Licen...
CNES/Pandora_MCCNN
src/mc_cnn/cost_volume/cost_volume_pixel_major_cpp.py
.py
b0a5a403cf5d2bad
7.62
16
# Copyright (c) 2026 Centre National d'Etudes Spatiales (CNES). # # This file is part of PANDORA_MCCNN # # https://github.com/CNES/Pandora_MCCNN # # 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 Licen...
CNES/Pandora_MCCNN
src/mc_cnn/cost_volume/cost_volume_pybaseline.py
.py
c9718f53e2bd4932
7.62
16
#!/usr/bin/env python # coding: utf8 # # Copyright (c) 2015, Jure Zbontar <jure.zbontar@gmail.com> # Copyright (c) 2026 Centre National d'Etudes Spatiales (CNES). # # This file is part of PANDORA_MCCNN # # https://github.com/CNES/Pandora_MCCNN # # Licensed under the Apache License, Version 2.0 (the "License"); # yo...
CNES/Pandora_MCCNN
src/mc_cnn/dataset_generator/datas_fusion_contest_generator.py
.py
ee28b7c30d6a5072
8.12
16
#!/usr/bin/env python # coding: utf8 # # Copyright (c) 2015, Jure Zbontar <jure.zbontar@gmail.com> # Copyright (c) 2026 Centre National d'Etudes Spatiales (CNES). # # This file is part of PANDORA_MCCNN # # https://github.com/CNES/Pandora_MCCNN # # Licensed under the Apache License, Version 2.0 (the "License"); # yo...
CNES/Pandora_MCCNN
src/mc_cnn/dataset_generator/middlebury_generator.py
.py
ea72793d81760744
7.62
16
# Copyright (c) 2026 Centre National d'Etudes Spatiales (CNES). # # This file is part of PANDORA_MCCNN # # https://github.com/CNES/Pandora_MCCNN # # 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 Licen...
CNES/Pandora_MCCNN
src/mc_cnn/inference_engine/inference_engine_base.py
.py
173f39259f2cdfd9
7.62
16
# Copyright (c) 2026 Centre National d'Etudes Spatiales (CNES). # # This file is part of PANDORA_MCCNN # # https://github.com/CNES/Pandora_MCCNN # # 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 Licen...
CNES/Pandora_MCCNN
src/mc_cnn/inference_engine/inference_engine_onnx.py
.py
5b1061c87180eced
7.62
16
# Copyright (c) 2026 Centre National d'Etudes Spatiales (CNES). # # This file is part of PANDORA_MCCNN # # https://github.com/CNES/Pandora_MCCNN # # 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 Licen...
CNES/Pandora_MCCNN
src/mc_cnn/inference_engine/inference_engine_pytorch.py
.py
ede6f4a8886542a4
7.62
16
# Copyright (c) 2024 Centre National d'Etudes Spatiales (CNES). # # This file is part of PANDORA_MCCNN # # https://github.com/CNES/Pandora_MCCNN # # 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 Licen...
CNES/Pandora_MCCNN
src/mc_cnn/model/mc_cnn_fast.py
.py
aa48a02ef164be2b
7.62
16
# Copyright (c) 2026 Centre National d'Etudes Spatiales (CNES). # # This file is part of PANDORA_MCCNN # # https://github.com/CNES/Pandora_MCCNN # # 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 Licen...
CNES/Pandora_MCCNN
src/mc_cnn/model/mc_cnn_fast_dw.py
.py
913041b02b9da564
7.62
16
#!/usr/bin/env python # coding: utf8 # # Copyright (c) 2026 Centre National d'Etudes Spatiales (CNES). # # This file is part of PANDORA_MCCNN # # https://github.com/CNES/Pandora_MCCNN # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the Licens...
CNES/Pandora_MCCNN
src/mc_cnn/preprocessing/preprocessing_beefrost_data_fusion_contest.py
.py
dadca35646fbac79
8.12
16
# Copyright (c) 2026 Centre National d'Etudes Spatiales (CNES). # # This file is part of PANDORA_MCCNN # # https://github.com/CNES/Pandora_MCCNN # # 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 Licen...
CNES/Pandora_MCCNN
src/mc_cnn/profiling.py
.py
86c160c5d54faa81
7.62
16
# Copyright (c) 2026 Centre National d'Etudes Spatiales (CNES). # # This file is part of PANDORA_MCCNN # # https://github.com/CNES/Pandora_MCCNN # # 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 Licen...
CNES/Pandora_MCCNN
tests/functional_tests/conftest.py
.py
d251d29cbbd59734
7.12
16