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
#!/usr/bin/env python3 """Test Runner & QA Script for lastfm-collage-generator. Executes pytest test suites, coverage reports, and linters with unified summary metrics. """ import argparse import os import subprocess import sys from typing import List, Optional, Tuple class TestRunner: """Orchestrates test exec...
paurieraf/lastfm-collage-generator
.gemini/skills/poetry-test-runner/scripts/run_tests.py
.py
29909f1a649d8dbf
8.09
14
#!/usr/bin/env python3 """Generates authentic visual preview assets for README.md.""" import os import sys from unittest.mock import MagicMock PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) SRC_PATH = os.path.join(PROJECT_ROOT, "src") if PROJECT_ROOT not in sys.path: sys.path.insert...
paurieraf/lastfm-collage-generator
scripts/generate_readme_assets.py
.py
d7b0cd178cfb70a6
7.59
14
from typing import List, Optional, Tuple, Union try: from typing import Protocol except ImportError: # pragma: no cover from typing_extensions import Protocol from PIL import Image, ImageOps, ImageStat from lastfmcollagegenerator.theme import Theme, parse_color class ImageFilter(Protocol): """Protocol...
paurieraf/lastfm-collage-generator
src/lastfmcollagegenerator/effects.py
.py
1f9aae904c6a9c57
7.59
14
class LastfmCollageGeneratorError(Exception): """Base exception for lastfm-collage-generator.""" def __init__( self, msg="An error occurred in lastfm-collage-generator", *args, **kwargs ): super().__init__(msg, *args, **kwargs) class ArtistNotFound(LastfmCollageGeneratorError): def __...
paurieraf/lastfm-collage-generator
src/lastfmcollagegenerator/exceptions.py
.py
11d302da49b49343
7.59
14
"""Export utilities for composite collage images.""" import os from typing import Optional, Tuple, Union from PIL import Image SUPPORTED_EXPORT_FORMATS = ("PNG", "JPEG", "WEBP") EXTENSION_TO_FORMAT = { ".png": "PNG", ".jpg": "JPEG", ".jpeg": "JPEG", ".webp": "WEBP", } def infer_format(output_path: ...
paurieraf/lastfm-collage-generator
src/lastfmcollagegenerator/export.py
.py
d9e90abca5b34115
7.59
14
import asyncio import functools from typing import Any, Callable, List, TypeVar import pylast from pylast import User, TopItem T = TypeVar("T") async def _to_thread(func: Callable[..., T], *args: Any, **kwargs: Any) -> T: if hasattr(asyncio, "to_thread"): return await asyncio.to_thread(func, *args, **kw...
paurieraf/lastfm-collage-generator
src/lastfmcollagegenerator/lastfm/client.py
.py
4b25c7a395968735
7.59
14
from typing import Any, Optional, Tuple from PIL import ImageFont def wrap_text_to_width( font: Any, text: str, max_width: int, max_lines: Optional[int] = None, ) -> str: """Wrap text to fit within a given pixel width using word boundaries. Falls back to character-level splitting for words wi...
paurieraf/lastfm-collage-generator
src/lastfmcollagegenerator/typography.py
.py
fd01c0cca474f280
7.59
14
import os import tempfile import pytest from PIL import Image from lastfmcollagegenerator import ( CollageGenerator, export_image, infer_format, ) def test_infer_format(): assert infer_format("test.png") == "PNG" assert infer_format("test.PNG") == "PNG" assert infer_format("test.jpg") == "JPE...
paurieraf/lastfm-collage-generator
tests/test_export.py
.py
a49cbcffc9c87b2e
7.09
14
from unittest.mock import MagicMock import pytest from lastfmcollagegenerator.collage import ( BaseCollageBuilder, CollageBuilderConfig, CollageTile, ) from tests.conftest import SyntheticImageFactory def test_canvas_dimensions(): config = CollageBuilderConfig(cols=3, rows=2, period="overall") b...
paurieraf/lastfm-collage-generator
tests/test_geometry.py
.py
f5c546533502e5ab
7.09
14
import os import subprocess import unittest # gh-checks.sh lives one directory up from this test (src/gh-checks.sh). SCRIPT = os.path.join(os.path.dirname(__file__), "..", "gh-checks.sh") def classify(output: str) -> str: """Source gh-checks.sh and run pr_checks_state on the given output.""" result = subproc...
kustomize-everything/action-promote
src/tests/gh_checks_test.py
.py
41606c9ab9cbc735
7.92
6
import time import typing from datetime import timedelta import pytest class PytestExecutionTimer: """ A timer for the phases of Pytest's execution. Distinctly different from `--durations=N` in that this reports times spent **outside** tests. Not every hook is instrumented yet, only the ones...
miketheman/pytest-execution-timer
pytest_execution_timer/plugin.py
.py
903977e5c75f9cc6
8.06
12
"""The Poolstation integration.""" import logging from datetime import timedelta from typing import Final import aiohttp from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_EMAIL, CONF_PASSWORD, CONF_TOKEN from homeassistant.core import HomeAssistant from homeassistant.exceptions ...
cibernox/homeassistant-poolstation
custom_components/poolstation/__init__.py
.py
dd68f3fe343f6f60
7.6
15
"""Support for Poolstation binary sensors.""" from __future__ import annotations from collections.abc import Callable from dataclasses import dataclass from homeassistant.components.binary_sensor import ( BinarySensorDeviceClass, BinarySensorEntity, BinarySensorEntityDescription, ) from homeassistant.conf...
cibernox/homeassistant-poolstation
custom_components/poolstation/binary_sensor.py
.py
af9f2e582774d207
7.6
15
"""Config flow for PoolStation integration.""" from __future__ import annotations import logging from typing import Any, Final import voluptuous as vol from aiohttp import ClientResponseError, DummyCookieJar from homeassistant import config_entries from homeassistant.const import CONF_EMAIL, CONF_PASSWORD from homeas...
cibernox/homeassistant-poolstation
custom_components/poolstation/config_flow.py
.py
47f3312b133eb74b
7.6
15
"""Base class for Poolstation entity.""" from __future__ import annotations from homeassistant.helpers.update_coordinator import CoordinatorEntity from pypoolstation import Pool from . import PoolstationDataUpdateCoordinator from .const import DOMAIN class PoolEntity(CoordinatorEntity): """Representation of a p...
cibernox/homeassistant-poolstation
custom_components/poolstation/entity.py
.py
a5263a8297e435fc
7.6
15
"""Support for Poolstation numbers.""" from __future__ import annotations from collections.abc import Awaitable, Callable from dataclasses import dataclass from typing import Any from homeassistant.components.number import ( NumberDeviceClass, NumberEntity, NumberEntityDescription, ) from homeassistant.co...
cibernox/homeassistant-poolstation
custom_components/poolstation/number.py
.py
4fdaa423880b9f3d
7.6
15
"""Support for Poolstation sensors.""" from __future__ import annotations from collections.abc import Callable from dataclasses import dataclass from homeassistant.components.sensor import ( SensorDeviceClass, SensorEntity, SensorEntityDescription, SensorStateClass, ) from homeassistant.config_entries...
cibernox/homeassistant-poolstation
custom_components/poolstation/sensor.py
.py
934bfc91915cedc8
7.6
15
"""Support for Poolstation switches.""" from __future__ import annotations from typing import Any from homeassistant.components.switch import SwitchEntity from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity_platform import AddEn...
cibernox/homeassistant-poolstation
custom_components/poolstation/switch.py
.py
f8aa51c4386c50b9
7.6
15
"""Shared fixtures and helpers for the poolstation integration tests.""" from __future__ import annotations import logging from unittest.mock import AsyncMock, MagicMock, patch import pytest from homeassistant import config_entries as config_entries_module from homeassistant import loader as loader_module from homeas...
cibernox/homeassistant-poolstation
tests/conftest.py
.py
d044366aaae6f982
8.1
15
"""Tests for the sensor, number, switch and binary_sensor platforms.""" from __future__ import annotations from unittest.mock import AsyncMock, MagicMock, patch from conftest import make_pool, make_relay from custom_components.poolstation import PoolstationDataUpdateCoordinator from custom_components.poolstation.bin...
cibernox/homeassistant-poolstation
tests/test_platforms.py
.py
2a8c33300a8b124a
7.1
15
"""Smoke tests: the integration imports and entities can be instantiated.""" from __future__ import annotations from unittest.mock import MagicMock from conftest import make_pool, make_relay from homeassistant.core import CoreState from custom_components.poolstation import PoolstationDataUpdateCoordinator from custo...
cibernox/homeassistant-poolstation
tests/test_smoke.py
.py
7762e2913bd65784
8.1
15
""" CLI utilities """ import os import click import numpy as np from netCDF4 import Dataset from pyrolib import __name__ as pyrolib_name from pyrolib import __version__ as pyrolib_version from pyrolib.fuelmap.utility import fire_array_3d_to_2d def add_version(f): """ Add the version of the tool to the help...
Aurel31/pyrolib
src/pyrolib/cli_post.py
.py
62a5f1205b7fc9dd
7.42
6
"""Post-processing of FireFlux I raw data """ from datetime import datetime, timedelta import csv import numpy as np _MTHeight = [0.1, 0.5, 0.75, 2, 4.5, 10, 15, 20, 25, 28, 30, 35, 43, 0.13, 1.47, 2.1] _DataFileName = "tc_data_1hz_3.dat" FireFluxDataPath = "FireFlux_Raw" def set_data_path(path): """Set path t...
Aurel31/pyrolib
src/pyrolib/data_processing/firefluxI.py
.py
ac848fda49c635a8
7.42
6
""" Fuel classes """ from abc import ABC, abstractmethod from math import atan, cos, pow, radians, sin, sqrt import numpy as np class FuelProperty: """Represents a property for a fuel. Store property name, description and value. Attributes ---------- name : str Short name of the proper...
Aurel31/pyrolib
src/pyrolib/fuelmap/fuels.py
.py
cce4cbff56c29343
7.42
6
""" Patch classes """ from abc import ABC, abstractmethod import numpy as np def bresenham(x0, y0, x1, y1): """Yield the integer coordinates on the line from (x0, y0) to (x1, y1). Input coordinates must be integers. Both the start and the end point are part of the result. Vendored from the `bresen...
Aurel31/pyrolib
src/pyrolib/fuelmap/patch.py
.py
8b19499d81814c11
7.42
6
""" FuelMap utility tools """ from math import ceil, floor import numpy as np try: from numba import njit has_numba = True except ImportError: has_numba = False print("WARNING: Failed to find numba, loop acceleration will be not activated") pass def njit_wrapper(function): if has_numba: ...
Aurel31/pyrolib
src/pyrolib/fuelmap/utility.py
.py
c350441355430925
7.42
6
""" Test blaze.py functions """ import numpy as np import pyrolib.blaze as blz import pytest @pytest.fixture(scope="function") def level_set_case(request): if request.param == "no fire": # No fire test case return np.zeros((3, 3), dtype=np.float64) if request.param == "full fire": # F...
Aurel31/pyrolib
tests/func/test_fct_blaze.py
.py
c5b1aec2921c9dea
7.92
6
""" unit tests blaze.py functions """ import numpy as np from pyrolib.blaze.subgrid_burning_area import _surf68, _surf22, _surf70 import pytest def test_surf68(): assert np.isclose(_surf68(1, 0.5, 0.5), 0.5) def test_surf22(): assert np.isclose(_surf22(0.5, 0.5, 1), 0.5) def test_surf70(): assert np....
Aurel31/pyrolib
tests/unit/test_blaze.py
.py
62762d5e68fca5bc
7.42
6
""" unit tests fuels.py functions """ import pytest import pyrolib.fuelmap as pl from pyrolib.fuelmap.fuels import FuelProperty from pyrolib.fuelmap.utility import convert_lon_lat_to_x_y from numpy import isclose from math import cos, radians """ Parameter """ def test_property_init(): fuelproperty = FuelPrope...
Aurel31/pyrolib
tests/unit/test_fuels.py
.py
4993781b234e9c2a
7.92
6
"""Helper for filtering based on artifact definitions.""" import logging from artifacts import definitions as artifacts_definitions from dfvfs.helpers import file_system_searcher as dfvfs_file_system_searcher from dfimagetools import path_resolver class ArtifactDefinitionFiltersGenerator: """Generator of filt...
log2timeline/dfimagetools
dfimagetools/artifact_filters.py
.py
cc7662c83f676617
7.62
16
"""Helper to write data streams.""" import os from dfimagetools import definitions class DataStreamWriter: """Data stream writer.""" # Class constant that defines the default read buffer size. _READ_BUFFER_SIZE = 16 * 1024 * 1024 _INVALID_PATH_CHARACTERS = [ os.path.sep, "!", ...
log2timeline/dfimagetools
dfimagetools/data_stream_writer.py
.py
1a64998b4c50c2b5
7.62
16
"""Function decorators.""" import warnings def deprecated(function): # pylint: disable=invalid-name """Decorator to mark functions or methods as deprecated.""" def IssueDeprecationWarning(*args, **kwargs): """Issue a deprecation warning.""" warnings.simplefilter("default", DeprecationWarnin...
log2timeline/dfimagetools
dfimagetools/decorators.py
.py
b3e94daa816f53fb
7.62
16
"""Windows environment variables collector.""" from dfimagetools import resources class WindowsEnvironmentVariablesCollector: """Windows environment variables collector.""" _ENVIRONMENT_KEY_PATH = ( "HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\" "Session Manager\\Environment" ...
log2timeline/dfimagetools
dfimagetools/environment_variables.py
.py
54991b4988c12a55
7.62
16
"""Helper to list file entries.""" import logging from dfvfs.helpers import file_system_searcher from dfvfs.helpers import volume_scanner from dfvfs.helpers import windows_path_resolver from dfvfs.lib import definitions as dfvfs_definitions from dfvfs.lib import errors as dfvfs_errors from dfvfs.path import factory a...
log2timeline/dfimagetools
dfimagetools/file_entry_lister.py
.py
ae8cdcbd9d5df189
7.62
16
"""Helper for filtering based on a path.""" import re from dfvfs.helpers import file_system_searcher as dfvfs_file_system_searcher class PathFiltersGenerator: """Generator of filters based on a path.""" _PARTITION_REGEX = re.compile(r"^p[1-9][0-9]*$") def __init__(self, path): """Initializes a...
log2timeline/dfimagetools
dfimagetools/path_filters.py
.py
2db76b980e1b4f2d
7.62
16
#!/usr/bin/env python3 """Helper to recursively calculate a message digest hash of data streams.""" import hashlib import logging from dfimagetools import definitions class RecursiveHasher: """Recursively calculates message digest hashes of data streams.""" _ESCAPE_CHARACTERS = {"/": "\\/", ":": "\\:", "\\...
log2timeline/dfimagetools
dfimagetools/recursive_hasher.py
.py
d273834f61f40694
7.62
16
"""Various resource classes.""" class EnvironmentVariable: """Environment variable. Attributes: case_sensitive (bool): True if environment variable name is case sensitive. name (str): environment variable name such as "SystemRoot" as in "%SystemRoot%" or "HOME" as in "$HOME". valu...
log2timeline/dfimagetools
dfimagetools/resources.py
.py
2688ab051677412b
7.62
16
#!/usr/bin/env python3 """Helper to recursively check for volumes and file systems.""" import locale import os from dfvfs.credentials import manager as credentials_manager from dfvfs.helpers import source_scanner as dfvfs_source_scanner from dfvfs.lib import definitions as dfvfs_definitions from dfvfs.resolver import...
log2timeline/dfimagetools
dfimagetools/source_analyzer.py
.py
a7a909da9e2018ba
7.62
16
"""Helpers to collect information from the Windows Registry.""" from dfvfs.file_io import file_io as dfvfs_file_io from dfvfs.helpers import windows_path_resolver from dfvfs.lib import definitions as dfvfs_definitions from dfvfs.resolver import resolver as dfvfs_resolver from dfwinreg import creg as dfwinreg_creg fro...
log2timeline/dfimagetools
dfimagetools/windows_registry.py
.py
c54802efd10bede4
7.62
16
#!/usr/bin/env python3 """Tests for the helper for filtering based on artifact definitions.""" import unittest from artifacts import reader as artifacts_reader from artifacts import registry as artifacts_registry from dfimagetools import artifact_filters from dfimagetools import resources from tests import test_lib...
log2timeline/dfimagetools
tests/artifact_filters.py
.py
9a5e8774e2e8666c
7.12
16
#!/usr/bin/env python3 """Tests for the helper to generating bodyfile entries.""" import unittest from dfvfs.lib import definitions as dfvfs_definitions from dfvfs.resolver import resolver from dfvfs.path import factory as path_spec_factory from dfimagetools import bodyfile from dfimagetools import file_entry_lister...
log2timeline/dfimagetools
tests/bodyfile.py
.py
6999a55456c022ee
8.12
16
#!/usr/bin/env python3 """Tests for the helper to write data streams.""" import os import unittest from dfvfs.lib import definitions as dfvfs_definitions from dfvfs.resolver import resolver from dfvfs.path import factory as path_spec_factory from dfimagetools import data_stream_writer from dfimagetools import file_e...
log2timeline/dfimagetools
tests/data_stream_writer.py
.py
38b4e794e032ec67
8.12
16
#!/usr/bin/env python3 """Tests for the Windows environment variables collector.""" import unittest from dfwinreg import definitions as dfwinreg_definitions from dfwinreg import fake as dfwinreg_fake from dfwinreg import registry as dfwinreg_registry from dfimagetools import environment_variables from tests import ...
log2timeline/dfimagetools
tests/environment_variables.py
.py
0fe126a2d2081715
8.12
16
#!/usr/bin/env python3 """Tests for the helper to list file entries.""" import unittest from dfvfs.lib import definitions as dfvfs_definitions from dfvfs.resolver import resolver from dfvfs.path import factory as path_spec_factory from dfimagetools import file_entry_lister from tests import test_lib class FileEnt...
log2timeline/dfimagetools
tests/file_entry_lister.py
.py
8da2e8c253f39579
7.12
16
#!/usr/bin/env python3 """Tests for the helper for filtering based on a path.""" import unittest from dfimagetools import path_filters from tests import test_lib class PathFiltersGeneratorTest(test_lib.BaseTestCase): """Tests for the path filters generator.""" # pylint: disable=protected-access def t...
log2timeline/dfimagetools
tests/path_filters.py
.py
f7849fcad237877a
7.12
16
#!/usr/bin/env python3 """Tests for the helper to volumes and file systems in a storage media image.""" import unittest from dfimagetools import source_analyzer from tests import test_lib class SourceAnalyzerTest(test_lib.BaseTestCase): """Tests for the source analyzer.""" def testAnalyze(self): "...
log2timeline/dfimagetools
tests/source_analyzer.py
.py
faa4ead2704dcf3f
8.12
16
"""Shared test case.""" import os import shutil import tempfile import unittest # The path to top of the source tree. PROJECT_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) # The paths below are all derived from the project path directory. # They are enumerated explicitly here so that they can...
log2timeline/dfimagetools
tests/test_lib.py
.py
c149a3bcb303d9ea
8.12
16
"""Helper to check for availability and version of dependencies.""" import configparser import os import re class DependencyDefinition: """Dependency definition. Attributes: dpkg_name (str): name of the dpkg package that provides the dependency. is_optional (bool): True if the dependency is opti...
log2timeline/dfimagetools
utils/dependencies.py
.py
6205b984c3038190
7.62
16
import copy import time import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib import seaborn as sns from pyrepo_mcda.mcda_methods import VIKOR from pyrepo_mcda.mcda_methods import VIKOR_SMAA from pyrepo_mcda.additions import rank_preferences from pyrepo_mcda import correlations as c...
energyinpython/pyrepo-mcda
examples/main_crispyn.py
.py
b884b9080b9241bc
7.57
13
import numpy as np import matplotlib.pyplot as plt import seaborn as sns import pandas as pd import matplotlib # example 1 involving the decision problem of selecting the best wind farm location based on: """ Ziemba, P., Wątróbski, J., Zioło, M., & Karczmarczyk, A. (2017). Using the PROSA method in offshore wind far...
energyinpython/pyrepo-mcda
examples/main_pyrepo_mcda_update.py
.py
91f9f7361685599e
7.57
13
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import copy from pyrepo_mcda.additions import rank_preferences from pyrepo_mcda.mcda_methods import VMCM, TOPSIS, EDAS, VIKOR, PROMETHEE_II, PROSA_C, COCOSO from pyrepo_mcda import normalizations as norms from pyrepo_mcda impo...
energyinpython/pyrepo-mcda
examples/main_pyrepo_mcda_update2.py
.py
519b76005374a1e3
7.57
13
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import copy from pyrepo_mcda.mcda_methods import TOPSIS, VIKOR, CODAS, SPOTIS, PROMETHEE_II, COPRAS from pyrepo_mcda.additions import rank_preferences from pyrepo_mcda import weighting_methods as mcda_weights from pyrepo_mcda ...
energyinpython/pyrepo-mcda
examples/main_visualizations.py
.py
326a2e18e8fc1a37
7.57
13
import numpy as np from .mcda_method import MCDA_method from ..normalizations import sum_normalization class ARAS(MCDA_method): """ Additive Ratio Assessment (ARAS) method used to evaluate and rank alternatives according to their utility degree relative to the ideal solution. """ def __init...
energyinpython/pyrepo-mcda
src/pyrepo_mcda/mcda_methods/aras.py
.py
3e7d3457cd401cd8
7.57
13
import numpy as np from ..normalizations import minmax_normalization from .mcda_method import MCDA_method class COCOSO(MCDA_method): """ Combined Compromise Solution (CoCoSo) method for evaluating and ranking alternatives using a combination of additive and multiplicative aggregation strategies. """ ...
energyinpython/pyrepo-mcda
src/pyrepo_mcda/mcda_methods/cocoso.py
.py
c4ffb8fe64d89ca5
7.57
13
import itertools import numpy as np from ..normalizations import linear_normalization from ..distance_metrics import euclidean from .mcda_method import MCDA_method class CODAS(MCDA_method): """ Combinative Distance-based Assessment (CODAS) method for ranking alternatives based on their distances from the...
energyinpython/pyrepo-mcda
src/pyrepo_mcda/mcda_methods/codas.py
.py
90af5067acf2483c
7.57
13
import numpy as np from ..normalizations import sum_normalization from .mcda_method import MCDA_method class COPRAS(MCDA_method): """ Complex Proportional Assessment (COPRAS) method for evaluating and ranking alternatives based on their proportional significance and utility degree. """ def __...
energyinpython/pyrepo-mcda
src/pyrepo_mcda/mcda_methods/copras.py
.py
d96655e06a226f26
7.57
13
import numpy as np from .mcda_method import MCDA_method from ..normalizations import linear_normalization class CRADIS(MCDA_method): """ Compromise Ranking of Alternatives from Distance to Ideal Solution (CRADIS) method for ranking alternatives according to their distances from ideal and anti-ideal s...
energyinpython/pyrepo-mcda
src/pyrepo_mcda/mcda_methods/cradis.py
.py
f4760b6cef0dba30
7.57
13
import numpy as np from .mcda_method import MCDA_method class EDAS(MCDA_method): """ Evaluation based on Distance from Average Solution (EDAS) method for ranking alternatives according to their positive and negative distances from the average solution. """ def __init__(self): """C...
energyinpython/pyrepo-mcda
src/pyrepo_mcda/mcda_methods/edas.py
.py
7a5b54bf956de166
7.57
13
import numpy as np from ..normalizations import minmax_normalization from .mcda_method import MCDA_method class MABAC(MCDA_method): """ Multi-Attributive Border Approximation Area Comparison (MABAC) method for ranking alternatives according to their distances from the border approximation area. ""...
energyinpython/pyrepo-mcda
src/pyrepo_mcda/mcda_methods/mabac.py
.py
32e8ac0c4062fb35
7.57
13
import numpy as np from .mcda_method import MCDA_method class MARCOS(MCDA_method): """ Measurement Alternatives and Ranking according to Compromise Solution (MARCOS) method for ranking alternatives based on their utility degrees relative to ideal and anti-ideal solutions. """ def __init_...
energyinpython/pyrepo-mcda
src/pyrepo_mcda/mcda_methods/marcos.py
.py
2a45c70d30c7f1d2
7.57
13
from abc import ABC import numpy as np class MCDA_method(ABC): def __call__(self, matrix, weights, types): """ Score alternatives from decision matrix `matrix` using criteria weights `weights` and criteria types `types` Parameters ---------- matrix : ndarray ...
energyinpython/pyrepo-mcda
src/pyrepo_mcda/mcda_methods/mcda_method.py
.py
151fce322bf73d6d
7.57
13
import itertools from .mcda_method import MCDA_method from ..promethee_preference_functions import * class PROMETHEE_II(MCDA_method): """ Preference Ranking Organization Method for Enrichment Evaluation II (PROMETHEE II) for ranking alternatives based on positive, negative, and net preference flows. ...
energyinpython/pyrepo-mcda
src/pyrepo_mcda/mcda_methods/promethee.py
.py
ccae9e08c7680b1d
7.57
13
import itertools import numpy as np from .promethee import PROMETHEE_II # PROSA Examining Sustainability at the Criteria Level (PROSA-C) class PROSA_C(PROMETHEE_II): """ PROMETHEE for Sustainability Assessment - Criteria (PROSA-C) method for ranking alternatives using preference flows and a compensat...
energyinpython/pyrepo-mcda
src/pyrepo_mcda/mcda_methods/prosa_c.py
.py
5e4b15b9dde67c72
7.57
13
import numpy as np class PVM(): """ Preference Vector Method (PVM) for evaluating and ranking alternatives based on their similarity to motivating and dissimilarity to demotivating preference vectors. """ def __init__(self): """ Create the PVM method object """ ...
energyinpython/pyrepo-mcda
src/pyrepo_mcda/mcda_methods/pvm.py
.py
f07e0368d9c77acf
7.57
13
import numpy as np from .mcda_method import MCDA_method from ..normalizations import linear_normalization class SAW(MCDA_method): """ Simple Additive Weighting (SAW) method for ranking alternatives based on the weighted sum of normalized criterion values. """ def __init__(self, normalizatio...
energyinpython/pyrepo-mcda
src/pyrepo_mcda/mcda_methods/saw.py
.py
e69631e4a674c9fb
7.57
13
import numpy as np from .mcda_method import MCDA_method class SPOTIS(MCDA_method): """ Stable Preference Ordering Towards Ideal Solution (SPOTIS) method for ranking alternatives according to their distances from the ideal solution defined within criterion bounds. """ def __init__(self): ...
energyinpython/pyrepo-mcda
src/pyrepo_mcda/mcda_methods/spotis.py
.py
5e24b099b60a048b
7.57
13
from typing import Callable import numpy as np import pandas as pd from .promethee import PROMETHEE_II from .daria import DARIA class Temporal_PROMETHEE_II: """ Temporal extension of the PROMETHEE II method that incorporates variability of preferences over multiple time periods using DARIA. """ ...
energyinpython/pyrepo-mcda
src/pyrepo_mcda/mcda_methods/temporal_promethee.py
.py
8ad374d2395929e7
7.57
13
import numpy as np from ..normalizations import minmax_normalization from ..distance_metrics import euclidean from .mcda_method import MCDA_method class TOPSIS(MCDA_method): """ Technique for Order Preference by Similarity to Ideal Solution (TOPSIS) method for ranking alternatives according to their dista...
energyinpython/pyrepo-mcda
src/pyrepo_mcda/mcda_methods/topsis.py
.py
4df19c025185110a
7.57
13
import numpy as np from .mcda_method import MCDA_method class VIKOR(MCDA_method): """ VIseKriterijumska Optimizacija I Kompromisno Resenje (VIKOR) method for ranking alternatives and identifying compromise solutions based on group utility and individual regret measures. """ def __init__(...
energyinpython/pyrepo-mcda
src/pyrepo_mcda/mcda_methods/vikor.py
.py
e47b169e27cfcc66
7.57
13
import numpy as np from .vikor import VIKOR from ..additions import rank_preferences class VIKOR_SMAA(): """ VIKOR method combined with Stochastic Multicriteria Acceptability Analysis (SMAA) for ranking alternatives under uncertain criteria weights. """ def __init__(self, normalization_method = ...
energyinpython/pyrepo-mcda
src/pyrepo_mcda/mcda_methods/vikor_smaa.py
.py
fc1cf07ecad8ff99
7.57
13
import numpy as np from ..normalizations import linear_normalization from .mcda_method import MCDA_method class WASPAS(MCDA_method): """ Weighted Aggregated Sum Product Assessment (WASPAS) method for ranking alternatives by combining the Weighted Sum Model and Weighted Product Model. """ ...
energyinpython/pyrepo-mcda
src/pyrepo_mcda/mcda_methods/waspas.py
.py
b4a1e3deb1eb2c03
7.57
13
import unittest import numpy as np from scipy.stats import pearsonr from pyrepo_mcda import correlations as corrs # Test for Spearman rank correlation coefficient class Test_Spearman(unittest.TestCase): def test_spearman(self): """Test based on paper Sałabun, W., & Urbaniak, K. (2020, June). A new coeffi...
energyinpython/pyrepo-mcda
tests/test_correlations.py
.py
3178b71abcaee4c5
7.07
13
import unittest import numpy as np from pyrepo_mcda.mcda_methods import CODAS from pyrepo_mcda.mcda_methods import TOPSIS from pyrepo_mcda.mcda_methods import WASPAS from pyrepo_mcda.mcda_methods import VIKOR from pyrepo_mcda.mcda_methods import SPOTIS from pyrepo_mcda.mcda_methods import EDAS from pyrepo_mcda.mcda_me...
energyinpython/pyrepo-mcda
tests/test_mcda_methods_1.py
.py
8c0a7569ab7da078
8.07
13
import unittest import numpy as np from pyrepo_mcda import weighting_methods as mcda_weights from pyrepo_mcda import normalizations as norms # Test for CRITIC weighting class Test_CRITIC(unittest.TestCase): def test_critic(self): """Test based on paper Tuş, A., & Aytaç Adalı, E. (2019). The new combinat...
energyinpython/pyrepo-mcda
tests/test_weighting_methods.py
.py
e85a0bf22636cb79
7.07
13
#!/usr/bin/env python3 """Generate release metadata (versions.json and release notes) for clang-tools-static-binaries. Usage: python3 release.py --tag 2026.06.04-a1b2c3d4 This script is called from the CI workflow (.github/workflows/build.yml) in the ``draft-release`` job to produce: * ``versions.json`` – machin...
cpp-linter/clang-tools-static-binaries
release.py
.py
128055b23b98f3f9
7.64
18
""" ``clang_tools.install`` ----------------------- The module that performs the installation of clang-tools. """ import os import re import shutil import subprocess import sys from pathlib import Path, PurePath from typing import cast from . import ( MAX_VERSION, MIN_VERSION, RESET_COLOR, YELLOW, ...
cpp-linter/clang-tools-pip
clang_tools/install.py
.py
7f5429c579f1343f
7.52
10
""" ``clang_tools.util`` ----------------------- A module containing utility functions. """ import hashlib import platform import urllib.request from functools import cache from http.client import HTTPResponse from pathlib import Path from urllib.error import HTTPError def check_install_arch() -> str: """Identi...
cpp-linter/clang-tools-pip
clang_tools/util.py
.py
929bf40c1dee41c8
7.52
10
""" ``clang_tools.wheel_install`` ----------------------------- Self-contained wheel installation via PyPI. Tool versions are resolved dynamically from the PyPI JSON API — no hardcoded version list is maintained in-tree. """ import json import logging import re import shutil import subprocess import sys import urlli...
cpp-linter/clang-tools-pip
clang_tools/wheel_install.py
.py
70fdeb817189c697
7.52
10
"""Generate CLI argument documentation pages for MkDocs. This script is used as a `gen-files` plugin to auto-generate the `cli_args.md` page from argparse. """ import argparse from io import StringIO import mkdocs_gen_files from clang_tools.main import get_parser REQUIRED_VERSIONS = { "0.1.0": ["command", "ver...
cpp-linter/clang-tools-pip
docs/gen_cli_docs.py
.py
e57c9a14da88626c
7.52
10
import nox @nox.session def lint(session: nox.Session) -> None: """Run linter""" session.install("pre-commit") session.run("pre-commit", "run", "--all-files", external=True) @nox.session def test(session: nox.Session) -> None: """Run tests""" session.install("--upgrade", "pip") session.insta...
cpp-linter/clang-tools-pip
noxfile.py
.py
561cbbf8f76a7b12
7.52
10
"""Tests related to installing a clang tool.""" import os import subprocess from pathlib import Path, PurePath from unittest.mock import Mock import pytest from clang_tools import install_arch, install_os, suffix from clang_tools.install import ( clang_tools_binary_url, create_sym_link, install_clang_too...
cpp-linter/clang-tools-pip
tests/test_install.py
.py
6e69d502588d788c
7.02
10
"""Tests related to the utility functions.""" import hashlib from pathlib import Path, PurePath from unittest.mock import Mock from urllib.error import HTTPError import pytest from clang_tools import install_arch, install_os, suffix from clang_tools.install import clang_tools_binary_url from clang_tools.util import ...
cpp-linter/clang-tools-pip
tests/test_util.py
.py
b84e165b9aade3ac
8.02
10
"""Contains hooks which are executed after the template is rendered.""" from __future__ import annotations import shutil import subprocess from contextlib import suppress from pathlib import Path def find_executable(name: str) -> str: """Find an executable on PATH.""" executable = shutil.which(name) if ...
pytask-dev/cookiecutter-pytask-project
hooks/post_gen_project.py
.py
99d9e072c65048c8
7.5
9
import os import shutil import subprocess import sys import pytest _PYTHON_VERSION = ".".join(map(str, sys.version_info[:2])) def _find_executable(name: str) -> str: executable = shutil.which(name) if executable is None: # pragma: no cover msg = f"Could not find {name!r} on PATH." raise Run...
pytask-dev/cookiecutter-pytask-project
tests/test_cookie.py
.py
3c854ceacbc0e63c
7
9
""" Plot3 example with Lorenz attractor """ import numpy as np import mlpyqtgraph as mpg def lorenz(x, *, s=10, r=28, b=2.667): """ Parameters ---------- x : array-like, shape (3,) Point of interest in three-dimensional space. s, r, b : float Parameters defining the Lorenz attractor...
swvanbuuren/mlpyqtgraph
examples/lorenz_attractor.py
.py
b18780774d9701d3
7.45
7
""" __init__.py for mlpyqtgraph, only functions and classes which are meant to be used as interface """ from pyqtgraph.Qt import QtCore from pqthreads import config as pqthreads_config from pqthreads.decorator import DecoratorCore, Decorator from mlpyqtgraph import windows from mlpyqtgraph import axes from mlpyqtgraph...
swvanbuuren/mlpyqtgraph
mlpyqtgraph/__init__.py
.py
63df33bb79948f54
7.45
7
""" The colors module defines classes to define colors """ from mlpyqtgraph.config import options class ColorDefinitions: """ Provide color definitions """ line_colors = { 'matlab': ( ( 0, 113, 188), (216, 82, 24), (118, 171, 47), (236, 176, 31), ...
swvanbuuren/mlpyqtgraph
mlpyqtgraph/colors.py
.py
c378312ae954d6f5
7.45
7
""" Matplotlib-like functions for easy figure and plot definitions """ from pqthreads import refs def figure(*args, **kwargs): """ Create, raise or modify FigureWorker objects """ container = refs.worker.get('figure') if not args: return container.create(**kwargs) figure_worker = args[0] ...
swvanbuuren/mlpyqtgraph
mlpyqtgraph/ml_functions.py
.py
0c468f1169b6a0d0
7.45
7
""" Module to determine nice ticklabels """ import math import numpy as np class NiceTicks: """ Determine nice tick label values """ fractions = (1, 2, 5, 10) limit_fractions = ((1.5, 1), (3, 2), (7, 5)) def __init__(self, minv, maxv, max_no_ticks=6): self.max_no_ticks = max_no_ticks ...
swvanbuuren/mlpyqtgraph
mlpyqtgraph/utils/ticklabels.py
.py
f846086141cb1d7e
7.45
7
""" This module contains all classes for handling the GUI figures and axes in mlpyqtgraph """ import sys from pyqtgraph.Qt import QtWidgets from pyqtgraph.Qt import QtCore import pyqtgraph as pg from pqthreads import refs pg.setConfigOption('background', 'w') pg.setConfigOption('foreground', 'k') pg.setConfigOption...
swvanbuuren/mlpyqtgraph
mlpyqtgraph/windows.py
.py
74f7beeda0f282d1
7.45
7
""" This modules defines all worker thread related classes and instances """ from pqthreads import containers from pqthreads import refs class AxisWorker(containers.WorkerItem): """ Worker thread axis to Control AxisWidget on the GUI thread """ factory = containers.WorkerItem.get_factory() row = factory....
swvanbuuren/mlpyqtgraph
mlpyqtgraph/workers.py
.py
280afdf128390336
7.45
7
#!/usr/bin/env python3 """ Analyze differences between input StudyDescription/Modality combinations and the existing mapping table. Output unmapped items to pending directory. Also provides validation of the mapping table for consistency. This script compares DICOM metadata from data collection sites against the harmo...
MIDRC/midrc_dicom_harmonization
util/analyze_in_out.py
.py
c7fbca57c0f71658
7.52
10
#!/usr/bin/env python3 """ Extract rows from specified Excel sheets where LOINC LCN column is non-empty. Outputs the collated results to a TSV file. Supports comparison with earlier version for duplicate detection and merging. Example usage: * merge with the diff mapping in a specific sheet of an Excel spreadsheet: ...
MIDRC/midrc_dicom_harmonization
util/xlsx2tsv.py
.py
82f41befb26d267b
7.52
10
from typing import Optional import click from rich.table import Table from _incydr_cli import console from _incydr_cli import logging_options from _incydr_cli import render from _incydr_cli.cmds.options.output_options import columns_option from _incydr_cli.cmds.options.output_options import single_format_option from ...
code42/incydr_python
src/_incydr_cli/cmds/alert_rules.py
.py
7107ffafbc8a6ccb
7.5
9
import json from typing import Optional import click from click import echo from _incydr_cli import console from _incydr_cli import logging_options from _incydr_cli.cmds.options.output_options import single_format_option from _incydr_cli.cmds.options.output_options import SingleFormat from _incydr_cli.core import Inc...
code42/incydr_python
src/_incydr_cli/cmds/departments.py
.py
bdea54bedaa632f7
7.5
9
import click from rich.panel import Panel from _incydr_cli import console from _incydr_cli import logging_options from _incydr_cli import render from _incydr_cli.cmds.options.output_options import columns_option from _incydr_cli.cmds.options.output_options import single_format_option from _incydr_cli.cmds.options.outp...
code42/incydr_python
src/_incydr_cli/cmds/devices.py
.py
97c87221c80a4824
7.5
9
from typing import Optional import click from _incydr_cli import console from _incydr_cli import logging_options from _incydr_cli import render from _incydr_cli.cmds.options.output_options import table_format_option from _incydr_cli.cmds.options.output_options import TableFormat from _incydr_cli.core import IncydrCom...
code42/incydr_python
src/_incydr_cli/cmds/directory_groups.py
.py
a70b0ce48cb1e233
7.5
9
import os from pathlib import Path import click from _incydr_cli import logging_options from _incydr_cli.core import IncydrCommand from _incydr_cli.core import IncydrGroup from _incydr_sdk.core.client import Client path_option = click.option( "--path", help='The file path where to save the file. The path mus...
code42/incydr_python
src/_incydr_cli/cmds/files.py
.py
b88fcb1760b52772
7.5
9
# CLI - specific utils.py file to avoid circular imports from functools import wraps from signal import getsignal from signal import SIGINT from signal import signal import click from click import echo from click import style from _incydr_sdk.actors.client import ActorNotFoundError def deprecation_warning(text): ...
code42/incydr_python
src/_incydr_cli/cmds/utils.py
.py
7ef1fd4371e26641
7.5
9
import difflib import re import click from requests import HTTPError from _incydr_cli.exceptions import IncydrCLIException from _incydr_cli.exceptions import LoggedCLIError from _incydr_sdk.core.settings import IncydrSettings from _incydr_sdk.exceptions import AuthMissingError from _incydr_sdk.exceptions import Incyd...
code42/incydr_python
src/_incydr_cli/core.py
.py
d1b7503acff8626f
7.5
9