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
# pylint: disable=duplicate-code """ test for Errors() """ import unittest from stricto import StrictoError, STypeError, SError class TestError(unittest.TestCase): """ Test error type () """ def test_error_format(self): """ test the error format string """ a = Strict...
backo-stricto/stricto
tests/test_error.py
.py
18d1bb470288246f
7.92
6
# pylint: disable=duplicate-code """ test for event_manager """ import unittest from stricto import Int def check_pair(value, o): # pylint: disable=unused-argument """ return true if pair """ return not value % 2 class TestEvent(unittest.TestCase): """ Test event """ def __init__(...
backo-stricto/stricto
tests/test_event.py
.py
cd7731dfb9289c2d
7.92
6
# pylint: disable=duplicate-code """ test for views() """ # pylint: disable=no-member import unittest import json from datetime import datetime from stricto import ( Datetime, Dict, Int, StrictoEncoder, Bytes, Complex, FreeDict, STypeError, SError, ) class TestExtend(unittest.Test...
backo-stricto/stricto
tests/test_extend.py
.py
8e2d4f22f1ca2e20
7.92
6
# pylint: disable=duplicate-code """ test for In() """ import unittest from stricto import In, String, Int, STypeError, SConstraintError class TestIn(unittest.TestCase): """ test for In() """ def test_set(self): """ set type error """ a = In([Int(), String()]) ...
backo-stricto/stricto
tests/test_in.py
.py
3551ec182dbea93f
7.92
6
# pylint: disable=duplicate-code """ test for Kparse() """ import unittest from typing import Callable from stricto import Kparse class TestKparse(unittest.TestCase): """ Test error type () """ def test_kparse_1(self): """ test kparse """ verif = {"name|Name|nom": st...
backo-stricto/stricto
tests/test_kparse.py
.py
e20c2595b50486d2
7.92
6
# pylint: disable=duplicate-code """ test for Meta informations() """ # pylint: disable=no-member import unittest from stricto import String, Int, Dict, List, Bool, SSyntaxError, SAttributeError class TestMeta(unittest.TestCase): # pylint: disable=too-many-public-methods """ test for Meta informations() ...
backo-stricto/stricto
tests/test_meta.py
.py
b15a98b58c329755
7.92
6
import threading import time from enum import Enum, auto from threading import Lock from typing import Callable import numpy as np import pyautogui as pyautogui # Import all images import utilities.vision_images as vio from utilities.coordinates import Coordinates from utilities.daily_farming_logic import DailyFarmer...
PhantomPilots/AutoFarming
scripts/utilities/accounts_farming_logic.py
.py
6d0729aa960b8dd6
7.62
16
"""Lightweight GUI-facing helpers extracted from utilities.utilities. This module is deliberately kept dependency-light (only stdlib + yaml + requests) so the AutoFarmers GUI can import it at startup without dragging in cv2, sklearn, numpy, pyautogui, dill, or the ~470 image reads triggered by vision_images. """ impo...
PhantomPilots/AutoFarming
scripts/utilities/app_config.py
.py
0111fd6b1e8db78d
7.62
16
from numbers import Integral import numpy as np from termcolor import cprint from utilities.card_data import Card, CardRanks, CardTypes from utilities.utilities import determine_card_merge def process_card_move(house_of_cards: list[Card], origin_idx: int, target_idx: int): """If we're moving a card, how does the...
PhantomPilots/AutoFarming
scripts/utilities/battle_utilities.py
.py
c9835b1ac028849f
7.62
16
import time import numpy as np import utilities.vision_images as vio from utilities.card_data import Card from utilities.coordinates import Coordinates from utilities.general_fighter_interface import FightingStates, IFighter from utilities.utilities import capture_window, find, find_and_click class BirdFighter(IFigh...
PhantomPilots/AutoFarming
scripts/utilities/bird_fighter.py
.py
35a6881bff2ed1df
7.62
16
import time from enum import Enum, auto import utilities.vision_images as vio from utilities.coordinates import Coordinates from utilities.general_farmer_interface import IFarmer from utilities.logging_utils import LoggerWrapper, logging from utilities.utilities import ( capture_window, check_for_reconn...
PhantomPilots/AutoFarming
scripts/utilities/boss_battle_farming_logic.py
.py
3e0bf9cf34d75ff0
7.62
16
"""This file should be improved in the future to account for a variable game window.""" from utilities.capture_window import capture_window class Coordinates: """Namespace-like class to group all the hardcoded coordinates""" # Screen coordinates for each floor __coordinates = { # General ...
PhantomPilots/AutoFarming
scripts/utilities/coordinates.py
.py
d1a50c9384b43441
7.62
16
import time from typing import Callable import cv2 import numpy as np import utilities.vision_images as vio from utilities.card_data import Card from utilities.coordinates import Coordinates from utilities.fighting_strategies import IBattleStrategy from utilities.general_fighter_interface import FightingStates, IFight...
PhantomPilots/AutoFarming
scripts/utilities/deer_fighter.py
.py
c3f69bed9409adeb
7.62
16
import numpy as np import utilities.vision_images as vio from utilities.card_data import Card, CardTypes from utilities.deer_utilities import ( is_blue_card, is_buff_removal_card, is_green_card, is_red_card, reorder_buff_removal_card, ) from utilities.fighting_strategies import IBattleStrategy, Smar...
PhantomPilots/AutoFarming
scripts/utilities/deer_fighting_strategies.py
.py
14fb9c2c0acc7eb9
7.62
16
from typing import Callable import numpy as np import utilities.vision_images as vio from utilities.card_data import Card, CardRanks, CardTypes from utilities.utilities import find # TODO Add cards from new team def is_red_card(card: Card) -> bool: return card.card_type != CardTypes.DISABLED and ( find(...
PhantomPilots/AutoFarming
scripts/utilities/deer_utilities.py
.py
2dcb69ee9b2eaf4f
7.62
16
import sys import threading import time from enum import Enum, auto import numpy as np import pyautogui as pyautogui import utilities.vision_images as vio from utilities.card_data import CardColors from utilities.dk_fighter import DemonKingFighter from utilities.dk_hard_fighting_strategies import DemonKingHardBattleSt...
PhantomPilots/AutoFarming
scripts/utilities/demon_king_farming_logic.py
.py
0ca677832b51a21e
7.62
16
import abc import threading import time from enum import Enum import numpy as np import pyautogui as pyautogui import utilities.vision_images as vio from utilities.app_config import get_minutes_to_wait_before_login from utilities.coordinates import Coordinates from utilities.general_farmer_interface import CHECK_IN_HO...
PhantomPilots/AutoFarming
scripts/utilities/demonic_beast_farming_logic.py
.py
71848025d4aec88b
7.62
16
import time from collections import defaultdict import numpy as np import utilities.vision_images as vio from utilities.card_data import Card, CardColors, CardTypes from utilities.coordinates import Coordinates from utilities.general_fighter_interface import FightingStates, IFighter from utilities.utilities import ( ...
PhantomPilots/AutoFarming
scripts/utilities/dk_fighter.py
.py
408061fb684aa335
7.62
16
import numpy as np import utilities.vision_images as vio from utilities.card_data import Card, CardColors, CardRanks, CardTypes from utilities.coordinates import Coordinates from utilities.fighting_strategies import IBattleStrategy, SmarterBattleStrategy from utilities.pattern_match_strategies import TemplateMatchingSt...
PhantomPilots/AutoFarming
scripts/utilities/dk_hard_fighting_strategies.py
.py
9d1f20eda568c1d0
7.62
16
import numpy as np import utilities.vision_images as vio from utilities.card_data import Card, CardRanks, CardTypes from utilities.coordinates import Coordinates from utilities.fighting_strategies import IBattleStrategy, SmarterBattleStrategy from utilities.utilities import capture_window, crop_region, find class Dem...
PhantomPilots/AutoFarming
scripts/utilities/dk_hell_fighting_strategies.py
.py
40218a7746f98d7b
7.62
16
# Copyright 2023 SkyAPM org # # 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,...
SkyAPM/R3
logger.py
.py
75b6a983244ef1a8
7.56
12
# SPDX-License-Identifier: MIT # URI-DRAIN NOTE: Masking should be kept very simple for URI-DRAIN. import abc import re from typing import Collection, Optional class AbstractMaskingInstruction(abc.ABC): def __init__(self, mask_with: str): self.mask_with = mask_with @abc.abstractmethod def mask(s...
SkyAPM/R3
models/uri_drain/masking.py
.py
4734469dfafddb4c
7.56
12
# SPDX-License-Identifier: MIT import base64 import logger import re import time import zlib from collections import defaultdict from typing import Optional, List, NamedTuple import jsonpickle from cachetools import LRUCache, cachedmethod # from drain3.jaccard_drain import JaccardDrain # MODIFIED:: NOT USED AT ALL f...
SkyAPM/R3
models/uri_drain/template_miner.py
.py
58b357c63d955ac9
7.56
12
# Copyright 2023 SkyAPM org # # 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,...
SkyAPM/R3
models/utils/logger.py
.py
ea6cffbfa4c97e76
7.56
12
# Copyright 2023 SkyAPM org # # 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, softw...
SkyAPM/R3
servers/simple/results_manager.py
.py
0ba88eb0cef96523
7.56
12
# Copyright 2023 SkyAPM org # # 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, softw...
SkyAPM/R3
servers/tests/test_shared_object.py
.py
939cda994ffa4310
7.06
12
# Copyright 2023 SkyAPM org # # 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,...
SkyAPM/R3
test/e2e/client.py
.py
73a630aa078ac08d
8.06
12
# Copyright 2023 SkyAPM org # # 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,...
SkyAPM/R3
tools/grpc_gen.py
.py
04c85246e187aca1
7.56
12
import reflex as rx from mex.drop.file_history.models import FileDetails from mex.drop.file_history.state import ListState from mex.drop.layout import page def render_file_row(file: FileDetails) -> rx.Component: """Render a row for the file history display.""" return rx.table.row( rx.table.row_header...
robert-koch-institut/mex-drop
mex/drop/file_history/main.py
.py
816adbd863e2d045
7.42
6
import pathlib from aiofile import async_open from fastapi import HTTPException, UploadFile from starlette import status from mex.common.exceptions import MExError ALLOWED_CONTENT_TYPES = { "application/json": ".json", "application/xml": ".xml", "application/vnd.ms-excel": ".xls", "application/vnd.op...
robert-koch-institut/mex-drop
mex/drop/files_io.py
.py
76e6ed4026d92a95
7.42
6
from typing import cast import reflex as rx from mex.drop.models import NavItem, User from mex.drop.state import State def user_button() -> rx.Component: """Return a user button with an icon that indicates their access rights.""" return rx.button( rx.icon("user_round_cog"), variant="ghost", ...
robert-koch-institut/mex-drop
mex/drop/layout.py
.py
33759d1ef60677d3
7.42
6
import reflex as rx from reflex.event import EventSpec from mex.drop.security import get_current_authorized_x_systems, is_authorized from mex.drop.state import State, User class LoginState(State): """State management for the login page.""" api_key: str x_system: str @rx.event def set_api_key(se...
robert-koch-institut/mex-drop
mex/drop/login/state.py
.py
566e4d139736a949
7.42
6
import os import sys from pathlib import Path import uvicorn from reflex.config import environment, get_config from reflex.constants import Env, LogLevel from reflex.reflex import run from reflex.state import reset_disk_state_manager from reflex.utils.build import setup_frontend_prod from reflex.utils.console import s...
robert-koch-institut/mex-drop
mex/drop/main.py
.py
dc24770a856c6805
7.42
6
from typing import Annotated from fastapi import Depends, HTTPException from fastapi.security import APIKeyHeader from starlette import status from mex.drop.settings import DropSettings from mex.drop.types import APIKey, UserDatabase, XSystem X_API_KEY = APIKeyHeader(name="X-API-Key", auto_error=False) def get_aut...
robert-koch-institut/mex-drop
mex/drop/security.py
.py
2f9b80bec3ecdb3b
7.42
6
import reflex as rx from reflex.event import EventSpec from mex.drop.models import NavItem, User class State(rx.State): """The app state.""" user: User | None = None nav_items: list[NavItem] = [ NavItem( title="Upload", route_ids=["/", "/index"], raw_path="/",...
robert-koch-institut/mex-drop
mex/drop/state.py
.py
80ef7c6f9307adb6
7.42
6
import pathlib import reflex as rx from reflex.event import EventSpec from mex.drop.files_io import ALLOWED_CONTENT_TYPES, write_to_file from mex.drop.settings import DropSettings from mex.drop.state import State from mex.drop.upload.models import TempFile class UploadState(State): """The state for the upload p...
robert-koch-institut/mex-drop
mex/drop/upload/state.py
.py
5770f8dba4e73b89
7.42
6
from collections.abc import Callable from pathlib import Path from typing import Any import pytest from fastapi.testclient import TestClient from mex.drop.api.main import api from mex.drop.settings import DropSettings from mex.drop.state import State, User from mex.drop.types import APIKey, UserDatabase pytest_plugi...
robert-koch-institut/mex-drop
tests/conftest.py
.py
05c3b81261288942
7.92
6
from datetime import UTC, datetime from unittest.mock import Mock import pytest from pytest import MonkeyPatch from mex.drop.file_history.models import FileDetails from mex.drop.file_history.state import ListState from mex.drop.settings import DropSettings from mex.drop.state import State @pytest.fixture def list_s...
robert-koch-institut/mex-drop
tests/file_history/test_state.py
.py
d94035345279c9a5
7.92
6
# Note: initially copied from https://github.com/florimondmanca/httpx-sse/blob/master/src/httpx_sse/_decoders.py from __future__ import annotations import json import inspect from types import TracebackType from typing import TYPE_CHECKING, Any, Generic, TypeVar, Iterator, Optional, AsyncIterator, cast from typing_ext...
dodopayments/dodopayments-python
src/dodopayments/_streaming.py
.py
8ba524d7dd7715bb
7.56
12
from __future__ import annotations from os import PathLike from typing import ( IO, TYPE_CHECKING, Any, Dict, List, Type, Tuple, Union, Mapping, TypeVar, Callable, Iterable, Iterator, Optional, Sequence, AsyncIterable, ) from typing_extensions import ( ...
dodopayments/dodopayments-python
src/dodopayments/_types.py
.py
da81d39d76885009
7.56
12
from __future__ import annotations from typing import Any from typing_extensions import override from ._proxy import LazyProxy class ResourcesProxy(LazyProxy[Any]): """A proxy for the `dodopayments.resources` module. This is used so that we can lazily import `dodopayments.resources` only when needed *a...
dodopayments/dodopayments-python
src/dodopayments/_utils/_resources_proxy.py
.py
518c4a548bb4fc2f
7.56
12
"""Shared functions for platform detection.""" from __future__ import annotations import pathlib import platform import shlex import subprocess # noqa: S404 -- pip/pip-tools don't have importable APIs import sys PYTHON_IMPLEMENTATION_MAP = { # noqa: WPS407 'cpython': 'cp', 'ironpython': 'ip', 'jython'...
ansible/awx-plugins
bin/pip_constraint_helpers.py
.py
eed92d5c5d175212
7.5
9
"""Sphinx extension for making the spelling directive noop.""" from sphinx.application import Sphinx from sphinx.config import Config as _SphinxConfig from sphinx.util import logging from sphinx.util.docutils import SphinxDirective from sphinx.util.nodes import nodes try: from enchant.tokenize import ( # noqa: ...
ansible/awx-plugins
docs/_ext/spelling_stub_ext.py
.py
d24ef0803fd03d9f
7.5
9
"""Shared interface type definitions for credential plugin schemes.""" import typing as _t class FieldDict(_t.TypedDict): """A single UI field schema.""" id: str label: str type: _t.NotRequired[str] format: _t.NotRequired[str] secret: _t.NotRequired[bool] multiline: _t.NotRequired[bool] ...
ansible/awx-plugins
src/awx_plugins/credentials/_types.py
.py
ca0554b81a849f58
7.5
9
"""Microsoft Azure Key Vault Lookup Plugin. This module defines a credential lookup plugin to authenticate and retrieve secrets from an Azure Key Vault. If the Client ID, Tenant ID, and Client Secret are provided it will create a credential with those. If one is missing, it will attempt to use the Managed Identity of ...
ansible/awx-plugins
src/awx_plugins/credentials/azure_kv.py
.py
f858a2b7fb5d3a90
7.5
9
# FIXME: the following violations must be addressed gradually and unignored # mypy: disable-error-code="arg-type, no-untyped-call, no-untyped-def" import base64 import binascii from urllib.parse import quote, urljoin from awx_plugins.interfaces._temporary_private_django_api import ( # noqa: WPS436 gettext_noop a...
ansible/awx-plugins
src/awx_plugins/credentials/conjur.py
.py
d821f798e0ceffa3
7.5
9
"""GitHub App Installation Access Token Credential Plugin. This module defines a credential plugin for making use of the GitHub Apps mechanism, allowing authentication via GitHub App installation-scoped access tokens. Functions: - :func:`extract_github_app_install_token`: Generates a GitHub App Installation token....
ansible/awx-plugins
src/awx_plugins/credentials/github_app.py
.py
5870b85d8acd45fe
7.5
9
# FIXME: the following violations must be addressed gradually and unignored # mypy: disable-error-code="no-untyped-def" import os import tempfile import typing from requests.exceptions import HTTPError from . import _types class CredentialPlugin(typing.NamedTuple): """Schema for credential plugins.""" nam...
ansible/awx-plugins
src/awx_plugins/credentials/plugin.py
.py
777e7aa9cc12a0c8
7.5
9
"""Tests Azure Key Vault credential plugin.""" import pytest from pytest_mock import MockerFixture from azure.core.exceptions import AzureError from azure.identity import CredentialUnavailableError from azure.keyvault.secrets import ( KeyVaultSecret, SecretClient, SecretProperties, ) from awx_plugins.cre...
ansible/awx-plugins
tests/azure_kv_test.py
.py
e82595f441d23892
8
9
"""Tests for GitHub App Installation access token extraction plugin.""" from typing import TypedDict import pytest from pytest_mock import MockerFixture from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives.asymmetric.rsa import ( RSAPrivateKey, RSAPublicKey, genera...
ansible/awx-plugins
tests/github_app_test.py
.py
367ebaec8b58cd01
8
9
# %% import cartopy.crs as ccrs import matplotlib.gridspec as gridspec import matplotlib.image as mpimg import matplotlib.pyplot as plt import numpy as np import xarray as xr from plotting_functions import ( _ctd_distance_along_expedition, plot_adcp, plot_ctd, plot_drifters, ) SAMPLE_DIR = "sample_exp...
Parcels-code/virtualship
docs/paper/figure1.py
.py
69c6e5662a98c355
7.57
13
"""N.B. Quick, inflexible (under active development) version whilst experimenting best approaches!""" # noqa: D400 # TODO: WORK IN PROGRESS # %% import os from glob import glob import cmocean.cm as cmo import matplotlib as mpl import numpy as np import plotly.graph_objects as go import xarray as xr var = "temperatu...
Parcels-code/virtualship
docs/user-guide/teacher-content/UU-ocean-of-future/plot_3D.py
.py
df221293acb59e5e
7.57
13
"""N.B. Quick (under active development) version whilst experimenting best approaches!""" # noqa: D400 # TODO: WORK IN PROGRESS # %% import os from glob import glob import cmocean.cm as cmo import matplotlib as mpl import numpy as np import plotly.graph_objs as go import xarray as xr var = "primary_production" # c...
Parcels-code/virtualship
docs/user-guide/teacher-content/UU-ocean-of-future/plot_slider.py
.py
86891522aa5d42da
7.57
13
from pathlib import Path import click from virtualship.cli._plan import _plan from virtualship.cli._run import _run from virtualship.utils import ( COPERNICUSMARINE_BGC_VARIABLES, COPERNICUSMARINE_PHYS_VARIABLES, EXPEDITION, get_example_expedition, mfp_to_yaml, ) @click.command() @click.argument...
Parcels-code/virtualship
src/virtualship/cli/commands.py
.py
2ce1438ae184949f
7.57
13
""" Utils for validating inputs to Pydantic model fields in a Textual setting and generating Textual input validators. Note, all validator functions require docstrings which describe the condition (used in error messaging). Presence is checked by require_docstring() helper function. """ import datetime def requir...
Parcels-code/virtualship
src/virtualship/cli/validator_utils.py
.py
8d0e928b4316512e
7.57
13
"""simulate_schedule function and supporting classes.""" from __future__ import annotations from dataclasses import dataclass, field from datetime import datetime, timedelta from typing import ClassVar import pyproj from virtualship.instruments.argo_float import ArgoFloat from virtualship.instruments.ctd import CTD...
Parcels-code/virtualship
src/virtualship/expedition/simulate_schedule.py
.py
96e9c95b4d339bbb
7.57
13
from __future__ import annotations import abc import collections from datetime import timedelta from itertools import pairwise from pathlib import Path from typing import TYPE_CHECKING, ClassVar import copernicusmarine import xarray as xr from parcels import FieldSet from yaspin import yaspin from virtualship.errors...
Parcels-code/virtualship
src/virtualship/instruments/base.py
.py
7a1af31858f58f6f
7.57
13
from __future__ import annotations from enum import Enum class InstrumentType(Enum): """Types of the instruments.""" CTD = "CTD" DRIFTER = "DRIFTER" ARGO_FLOAT = "ARGO_FLOAT" XBT = "XBT" ADCP = "ADCP" UNDERWATER_ST = "UNDERWATER_ST" @property def is_underway(self) -> bool: ...
Parcels-code/virtualship
src/virtualship/instruments/types.py
.py
e64d7abca5d3bc1a
7.07
13
"""ctd_make_realistic function.""" import random from pathlib import Path import numpy as np import opensimplex import xarray as xr def ctd_make_realistic( zarr_path: str | Path, out_dir: str | Path, prefix: str, ) -> list[Path]: """ Take simulated CTD data, add noise, then save in CNV format (1...
Parcels-code/virtualship
src/virtualship/make_realistic/ctd_make_realistic.py
.py
a5b88cea24a78058
7.57
13
"""Location class. See class description.""" from dataclasses import dataclass @dataclass(frozen=True) class Location: """A location on a sphere.""" latitude: float longitude: float def __post_init__(self) -> None: """ Verify this location has valid latitude and longitude. ...
Parcels-code/virtualship
src/virtualship/models/location.py
.py
f268879269c2c6ba
7.57
13
from datetime import datetime from pathlib import Path from unittest.mock import MagicMock import pytest import yaml from textual.widgets import Button, Collapsible, Input, Switch from virtualship.cli._plan import ExpeditionEditor, PlanApp, _default_sensors from virtualship.instruments.sensors import SensorType from ...
Parcels-code/virtualship
tests/cli/test_plan.py
.py
f8269e0c96305c87
7.07
13
from datetime import datetime from pathlib import Path from unittest.mock import MagicMock from virtualship.cli._run import _run, _unique_id from virtualship.expedition.simulate_schedule import ( MeasurementsToSimulate, ScheduleOk, ) from virtualship.instruments.types import InstrumentType from virtualship.uti...
Parcels-code/virtualship
tests/cli/test_run.py
.py
133f2e86b07cfd50
8.07
13
"""Test configuration that is run for every test.""" import pytest @pytest.fixture def tmp_file(tmp_path): file = tmp_path / "test.txt" file.touch() return file @pytest.fixture(autouse=True) def test_in_working_dir(request, monkeypatch): """ Set the working directory for each test to the direct...
Parcels-code/virtualship
tests/conftest.py
.py
7c1d96db04984116
7.57
13
from datetime import datetime, timedelta import numpy as np import pyproj from virtualship.expedition.simulate_schedule import ( ScheduleOk, ScheduleProblem, simulate_schedule, ) from virtualship.models import Expedition, Location, Schedule, Waypoint def test_simulate_schedule_feasible() -> None: ""...
Parcels-code/virtualship
tests/expedition/test_simulate_schedule.py
.py
75d7fee75eceba6e
8.07
13
"""Test the simulation of ADCP instruments.""" import datetime import numpy as np import pydantic import pytest import xarray as xr from parcels import FieldSet from virtualship.instruments.adcp import ADCPInstrument from virtualship.instruments.sensors import SensorType from virtualship.instruments.types import Ins...
Parcels-code/virtualship
tests/instruments/test_adcp.py
.py
9e91a8adfb7a2760
8.07
13
"""Test the simulation of Argo floats.""" from datetime import datetime, timedelta import numpy as np import pydantic import pytest import xarray as xr from parcels import FieldSet from virtualship.instruments.argo_float import ArgoFloat, ArgoFloatInstrument from virtualship.instruments.sensors import SensorType fro...
Parcels-code/virtualship
tests/instruments/test_argo_float.py
.py
fa3b0523ee06ed35
8.07
13
import numpy as np from scipy.sparse import coo_matrix from sklearn.preprocessing import normalize def filter_overlap(file, max_hang=1000, int_frac=0.05): ''' Filter out dangling overlaps of a paf file. Reference: https://github.com/lh3/miniasm/blob/master/miniasm.h#L86 Parmeters: max_hang: ...
xinehc/argo
src/argo/utils.py
.py
7e83a6919eb2891d
7.62
16
from cli.core.errors import wrap_mpt_api_error from cli.core.mpt.models import Token from mpt_api_client import MPTClient # TODO: Remove or refactor verbose logging. # This class currently does not handle verbose logs. # Pending global logging refactor to add optional verbose support. class MPTAccountService: """...
softwareone-platform/swo-marketplace-cli
cli/core/accounts/api/account_api_service.py
.py
c90eb4c81ac8d316
7.56
12
from cli.core.accounts.models import Account from mpt_api_client.auth import BearerTokenAuthentication class CLIAuthenticator(BearerTokenAuthentication): """Authenticate with the bearer token of a CLI-stored account.""" def __init__(self, account: Account) -> None: """Initialize the bearer token from...
softwareone-platform/swo-marketplace-cli
cli/core/accounts/auth.py
.py
716aed2158f873a3
7.06
12
from cli.core.accounts.auth import CLIAuthenticator from cli.core.accounts.loader import load_account from cli.core.accounts.models import Account from cli.core.accounts.transport import CLITransport from cli.core.console import console from mpt_api_client import MPTClient, TransportSettings from mpt_api_client.auth im...
softwareone-platform/swo-marketplace-cli
cli/core/accounts/client.py
.py
18aa2900263f7c98
7.56
12
from operator import attrgetter from cli.core.accounts.handlers import JsonFileHandler from cli.core.accounts.models import Account from cli.core.errors import AccountNotFoundError, NoActiveAccountFoundError def get_or_create_accounts() -> list[Account]: """Extract the list of accounts from the passed file or cr...
softwareone-platform/swo-marketplace-cli
cli/core/accounts/flows.py
.py
bd588f6072693754
7.56
12
import json from pathlib import Path from typing import Any from cli.core.handlers import FileHandler class JsonFileHandler(FileHandler): """File handler for JSON file operations.""" # TBD: should this be configurable by the user or moved to a constant? _default_file_path: Path = Path.home() / ".swocli"...
softwareone-platform/swo-marketplace-cli
cli/core/accounts/handlers/json_file_handler.py
.py
ffbef61b3478e086
7.56
12
import json from pathlib import Path from cli.core.accounts.flows import find_account, find_active_account from cli.core.accounts.handlers import JsonFileHandler from cli.core.accounts.models import Account from cli.core.errors import CLIAccountError from pydantic import ValidationError def load_account(file_path: P...
softwareone-platform/swo-marketplace-cli
cli/core/accounts/loader.py
.py
9d94685fcf9dd4b4
7.56
12
from typing import TYPE_CHECKING, Self from pydantic import BaseModel if TYPE_CHECKING: from cli.core.mpt.models import Token class Account(BaseModel): """Model representing a user account.""" id: str name: str type: str token: str token_id: str environment: str is_active: bool ...
softwareone-platform/swo-marketplace-cli
cli/core/accounts/models.py
.py
b389de4df8146052
7.56
12
from cli.core.accounts.models import Account NEW_TOKEN_MASK_PREFIX_LENGTH = 22 TOKEN_MASK_PREFIX_LENGTH = 4 def wrap_account_type(account_type: str) -> str: """Apply rich color formatting for account type.""" match account_type: case "Vendor": return f"[cyan]{account_type}" case "...
softwareone-platform/swo-marketplace-cli
cli/core/accounts/table_formatters.py
.py
a3ebd9c308f724be
7.56
12
from dataclasses import dataclass from typing import override from cli.core.accounts.models import Account from mpt_api_client import TransportSettings API_REQUEST_TIMEOUT = 60.0 @dataclass class CLITransport(TransportSettings): """Transport settings that target the environment of a CLI-stored account. Att...
softwareone-platform/swo-marketplace-cli
cli/core/accounts/transport.py
.py
786207663092844c
7.56
12
from typer._click.core import Command, Context from typer.core import TyperGroup class AliasTyperGroup(TyperGroup): """Provides ability to make commands with s and without s at the end. Examples: mpt-cli account add mpt-cli accounts add """ def get_command(self, ctx: Context, cmd_nam...
softwareone-platform/swo-marketplace-cli
cli/core/alias_group.py
.py
ae5586e6028e9193
7.56
12
from cli.core.accounts.models import Account from cli.core.accounts.table_formatters import wrap_account_type, wrap_active, wrap_token from rich import box from rich.table import Table class AccountsTableRenderer: """Render account collections as rich tables.""" def render(self, title: str, accounts: list[Ac...
softwareone-platform/swo-marketplace-cli
cli/core/console/renderers/accounts.py
.py
c31962cf46a90c47
7.56
12
from typing import Any from rich import box from rich.panel import Panel from rich.table import Table class AuditRecordsRenderer: """Render audit record collections.""" def render(self, records: list[dict[str, Any]]) -> Table: """Build the audit-record list table.""" table = Table(title="Ava...
softwareone-platform/swo-marketplace-cli
cli/core/console/renderers/audit.py
.py
250c971f275936de
7.56
12
import pathlib import sys from dataclasses import dataclass from cli.core.console.base import console from pyfiglet import Figlet from rich.text import Text HEXADECIMAL_BASE = 16 @dataclass(frozen=True) class RGBColor: """Represent a terminal color as red, green, and blue channels.""" red: int green: i...
softwareone-platform/swo-marketplace-cli
cli/core/console/renderers/banner.py
.py
4005c112d26f75ee
7.56
12
from cli.core.mpt.models import Product as MPTProduct from cli.core.products.table_formatters import wrap_product_status, wrap_vendor from rich import box from rich.table import Table class ProductsTableRenderer: """Render product collections as rich tables.""" def render(self, title: str, products: list[MPT...
softwareone-platform/swo-marketplace-cli
cli/core/console/renderers/products.py
.py
bb33693b8fe2b1a9
7.56
12
from cli.core.stats import StatsCollector from rich import box from rich.table import Table class StatsTableRenderer: """Render stats collectors as rich tables.""" def render(self, stats: StatsCollector) -> Table: """Build the stats table for console output.""" table = Table(stats.table_title...
softwareone-platform/swo-marketplace-cli
cli/core/console/renderers/stats.py
.py
b2fc452e33b826ff
7.56
12
from collections.abc import Callable from typing import ParamSpec, TypeVar, cast from cli.core.error_wrappers import ApiErrorWrapper, HttpErrorWrapper CallableParams = ParamSpec("CallableParams") RetType = TypeVar("RetType") class CLIError(Exception): """Base exception class for CLI-related errors.""" class M...
softwareone-platform/swo-marketplace-cli
cli/core/errors.py
.py
6991e2163c380bba
7.56
12
class ExcelFileHandlerError(Exception): """Base exception class for Excel file handler related errors.""" _default_message = "Excel file handler error" def __init__(self, message: str | None = None, details: list | None = None): self.message = self._default_message if message is None else message ...
softwareone-platform/swo-marketplace-cli
cli/core/handlers/errors.py
.py
a9c74984fb5201a4
7.56
12
from dataclasses import dataclass from pathlib import Path from cli.core.handlers import FileHandler from cli.core.handlers.excel_mixins import ExcelAccessMixin, ExcelSheetMixin from openpyxl.workbook import Workbook from openpyxl.worksheet.worksheet import Worksheet @dataclass(frozen=True) class CellPosition: "...
softwareone-platform/swo-marketplace-cli
cli/core/handlers/excel_file_handler.py
.py
7874f6a42a66644c
7.56
12
from cli.core.handlers.excel_mixins.read import ExcelReadMixin from cli.core.handlers.excel_mixins.validation import ExcelValidationMixin from cli.core.handlers.excel_mixins.workbook import ExcelWorkbookMixin from cli.core.handlers.excel_mixins.worksheet import ExcelWorksheetMixin from cli.core.handlers.excel_mixins.wr...
softwareone-platform/swo-marketplace-cli
cli/core/handlers/excel_mixins/composites.py
.py
50d9d3dbc3e83df1
7.56
12
import re from typing import Any from cli.core.handlers.excel_mixins.types import ( ColumnPatterns, SheetData, SheetDataGenerator, ) from openpyxl.utils import get_column_letter from openpyxl.worksheet.worksheet import Worksheet class ExcelReadMixin: # noqa: WPS214 """Provide read helpers for Excel ...
softwareone-platform/swo-marketplace-cli
cli/core/handlers/excel_mixins/read.py
.py
777335974a1ea711
7.56
12
from typing import Any from cli.core.handlers.errors import ( RequiredFieldsError, RequiredFieldValuesError, RequiredSheetsError, ) class ExcelValidationMixin: """Provide validation helpers for Excel sheets.""" _get_fields_from_horizontal_worksheet: Any _get_fields_from_vertical_worksheet: A...
softwareone-platform/swo-marketplace-cli
cli/core/handlers/excel_mixins/validation.py
.py
c1eba92a4a67e3fa
7.56
12
from pathlib import Path import openpyxl from openpyxl.reader.excel import load_workbook from openpyxl.workbook import Workbook from openpyxl.worksheet.worksheet import Worksheet class ExcelWorkbookMixin: """Provide workbook lifecycle helpers.""" _workbook_cache: Workbook | None _worksheets_cache: dict[...
softwareone-platform/swo-marketplace-cli
cli/core/handlers/excel_mixins/workbook.py
.py
633a3e07ae6a4b65
7.56
12
from pathlib import Path from typing import TYPE_CHECKING, Any from cli.core.handlers.excel_mixins.types import SheetData from openpyxl.styles import NamedStyle from openpyxl.utils import get_column_letter from openpyxl.workbook import Workbook from openpyxl.worksheet.datavalidation import DataValidation from openpyxl...
softwareone-platform/swo-marketplace-cli
cli/core/handlers/excel_mixins/write.py
.py
cec770eae06a699e
7.56
12
from abc import ABC, abstractmethod from pathlib import Path from typing import Any class FileHandler(ABC): """Abstract base class for handling file operations. This class provides a common interface for file handlers that manage different file types and formats. """ def __init__(self, file_path...
softwareone-platform/swo-marketplace-cli
cli/core/handlers/file_handler.py
.py
1f68a9c368f25af8
7.56
12
import re from abc import ABC, abstractmethod from collections.abc import Mapping from pathlib import Path from typing import Any, ClassVar from cli.core.handlers.excel_file_handler import ExcelFileHandler from openpyxl.worksheet.datavalidation import DataValidation class ExcelFileManager(ABC): """Abstract base ...
softwareone-platform/swo-marketplace-cli
cli/core/handlers/file_manager.py
.py
7e04ad81f90d1d0c
7.56
12
from abc import abstractmethod from collections.abc import Generator, Mapping from typing import TYPE_CHECKING, Any, ClassVar, override from cli.core.handlers.constants import ERROR_COLUMN_NAME from cli.core.handlers.excel_file_handler import CellPosition from cli.core.handlers.excel_styles import get_number_format_st...
softwareone-platform/swo-marketplace-cli
cli/core/handlers/horizontal_tab_file_manager.py
.py
730ca124b1de3601
7.56
12
from collections.abc import Mapping from typing import TYPE_CHECKING, Any, ClassVar, override from cli.core.handlers.constants import ERROR_COLUMN_NAME from cli.core.handlers.excel_file_handler import CellPosition from cli.core.handlers.excel_styles import general_tab_title_style from cli.core.handlers.file_manager im...
softwareone-platform/swo-marketplace-cli
cli/core/handlers/vertical_tab_file_manager.py
.py
eed3d893981d676a
7.56
12
import datetime as dt import logging from collections.abc import MutableMapping from uuid import uuid4 import requests from requests.adapters import HTTPAdapter from urllib3.util.retry import Retry from adobe_vipm.adobe.config import Config, get_config from adobe_vipm.adobe.dataclasses import APIToken, Authorization ...
softwareone-platform/swo-adobe-vipm-extension
adobe_vipm/adobe/client.py
.py
ad58b5def522019f
7.6
15
import json from collections.abc import MutableMapping from importlib.resources import files from pathlib import Path from django.conf import settings from mpt_extension_sdk.mpt_http.utils import find_first from adobe_vipm.adobe.dataclasses import ( Authorization, Country, Reseller, ) from adobe_vipm.adob...
softwareone-platform/swo-adobe-vipm-extension
adobe_vipm/adobe/config.py
.py
9296ac739814c8cc
7.6
15
import datetime as dt from dataclasses import dataclass @dataclass(frozen=True) class Authorization: """Authorization representation.""" authorization_uk: str authorization_id: str | None name: str client_id: str client_secret: str currency: str distributor_id: str def __repr__(s...
softwareone-platform/swo-adobe-vipm-extension
adobe_vipm/adobe/dataclasses.py
.py
7901f28c3c0379c1
7.6
15
import json import logging from collections.abc import Callable from functools import wraps from typing import NoReturn, ParamSpec, TypeVar from requests import HTTPError, JSONDecodeError, PreparedRequest from requests.exceptions import ConnectionError as RequestsConnectionError from requests.exceptions import Request...
softwareone-platform/swo-adobe-vipm-extension
adobe_vipm/adobe/errors.py
.py
152d7ad132dbb146
7.6
15
from urllib.parse import urljoin from adobe_vipm.adobe.constants import AdobeDeploymentStatus from adobe_vipm.adobe.errors import wrap_http_error class DeploymentClientMixin: """Adobe Client Mixin to manage Deployments flows of Adobe VIPM.""" @wrap_http_error def get_customer_deployments( self, ...
softwareone-platform/swo-adobe-vipm-extension
adobe_vipm/adobe/mixins/deployment.py
.py
ab2336a75b2d1e3a
7.6
15
from django.conf import settings from django.core.exceptions import ImproperlyConfigured from mpt_extension_sdk.runtime.djapp.apps import DjAppConfig from adobe_vipm.extension import ext class ExtensionConfig(DjAppConfig): """Django configuration for extension.""" name = "adobe_vipm" verbose_name = "SWO...
softwareone-platform/swo-adobe-vipm-extension
adobe_vipm/apps.py
.py
1ea0877ab3b22d20
7.6
15