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
""" DAG pour supprimer tous les datasets de data.gouv.fr. Ce DAG récupère tous les datasets de l'organisation sur data.gouv.fr et les supprime. """ import pendulum from include.container import DomainContainer as Container from airflow.decorators import dag, task @dag( dag_id="archive_all_from_data_gouv", ...
MTES-MCT/sparte
airflow/dags/data_gouv/archive_all_from_data_gouv.py
.py
feb9d819ba45aea0
7.5
9
""" Ce dag télécharge les données IGN Admin Express (format geopackage) et les importe dans une base de données PostgreSQL via ogr2ogr. Chaque zone est livrée dans une archive 7z contenant un unique fichier .gpkg multi-couches. Les couches `commune`, `departement`, `epci` et `region` sont ingérées chacune dans sa prop...
MTES-MCT/sparte
airflow/dags/ingest_admin_express.py
.py
90e516146641ae15
7.5
9
""" DAG pour ingérer le carroyage LEA de consommation d'espaces NAF. Source: data.gouv.fr - Consommation d'espaces naturels, agricoles et forestiers du 1er janvier 2011 au 1er janvier 2025 (ressource `conso_carroyage.gpkg`). Le millésime 2025 est livré en **geopackage non archivé**, contrairement au millésime 2009-20...
MTES-MCT/sparte
airflow/dags/ingest_carroyage_lea.py
.py
0fe24d5170df7ff0
7.5
9
from telegram import ReplyKeyboardMarkup from telegram.constants import InlineKeyboardMarkupLimit from droos_bot import CONFIG, DATA_COLUMNS def create_keyboard( # noqa: PLR0913 items: list[str], show_back: bool = True, show_pagination: bool = True, show_bullet: bool = True, current_page: int = ...
yshalsager/droos_bot
droos_bot/utils/keyboards.py
.py
03dc3de4a5c98fa3
7.64
18
"""Bot modules dynamic loader.""" import logging from importlib import import_module from pathlib import Path logger = logging.getLogger(__name__) def get_modules(modules_path: Path) -> filter: """Return all modules available in modules directory.""" return filter( lambda x: x.name != "__init__.py" ...
yshalsager/droos_bot
droos_bot/utils/modules_loader.py
.py
9cb70b0218277dd6
7.64
18
from ...model.browser.base.driver import BrowserDriver from ...model.type.xpath import XPath from ..get.element import get_element_without_wait from ..wait.for_element import wait_for_element def click_button(browser_driver: BrowserDriver, xpath: str, timeout: float) -> None: xpath = XPath(xpath) wait_for_ele...
jakob-bagterp/browserist
src/browserist/browser/click/button.py
.py
1170bc008140058e
7.64
18
from selenium.webdriver.common.by import By from selenium.webdriver.remote.webelement import WebElement from ...model.browser.base.driver import BrowserDriver from ...model.type.xpath import XPath from ..wait.for_element import wait_for_element def get_element(browser_driver: BrowserDriver, xpath: str, timeout: floa...
jakob-bagterp/browserist
src/browserist/browser/get/element.py
.py
bcf8dffface93a65
7.64
18
from selenium.webdriver.common.by import By from selenium.webdriver.remote.webelement import WebElement from ...model.browser.base.driver import BrowserDriver from ...model.type.xpath import XPath from ..wait.for_element import wait_for_element def get_elements(browser_driver: BrowserDriver, xpath: str, timeout: flo...
jakob-bagterp/browserist
src/browserist/browser/get/elements.py
.py
04fc02da92c7e075
7.64
18
from .. import helper from .elapsed_time_fractions import ElapsedTimeFractions class TimeFractions: __slots__ = ["time"] def __init__(self, elapsed_time_ns: int) -> None: self.time: ElapsedTimeFractions = helper.time_fractions.calculate_time_fractions(elapsed_time_ns) def count_microseconds_to_f...
jakob-bagterp/timer-for-python
src/timer/model/time_fractions.py
.py
cb07917ac2454bb3
7.45
7
from enum import Enum, unique @unique class TimeUnit(Enum): """Time unit options for the Timer.""" NANOSECONDS = "nanoseconds" MICROSECONDS = "microseconds" MILLISECONDS = "milliseconds" SECONDS = "seconds" MINUTES = "minutes" HOURS = "hours" DAYS = "days" def __str__(self) -> st...
jakob-bagterp/timer-for-python
test/_constant/time_unit.py
.py
cf2b2a2d2b5e7541
7.45
7
from random import choices, randint from string import ascii_uppercase from timer.constant.decimals import MAXIMUM, MINIMUM def random_decimals(max: int = MAXIMUM) -> int: """Get a random number of decimals between the minimum 0 and maximum 9.""" return randint(MINIMUM, max if MINIMUM < max <= MAXIMUM else ...
jakob-bagterp/timer-for-python
test/_helper/random.py
.py
baaedbd18a9b0271
7.95
7
from timer import Timer from timer.model.timer_base import TimerBase def ensure_all_timer_threads_are_stopped() -> TimerBase: """Ensures all threads are stopped.""" timer = Timer() timer._threads = [] return timer def get_timer_with_invalid_thread_type(thread: str) -> TimerBase: """Get a Timer ...
jakob-bagterp/timer-for-python
test/_helper/timer.py
.py
6e5562aaa809f972
7.95
7
from _mock_data.decimals import DECIMALS_RANGE from timer import Timer from timer.constant.decimals import DEFAULT from timer.helper.decimals import mediate # As decimals both can be set on the Timer object and the timer.start() function, # let's ensure that decimals set in the timer.start() function takes precedence...
jakob-bagterp/timer-for-python
test/helper/decimals/mediate_test.py
.py
213d76b0244e8fab
7.95
7
# MIT License # Copyright (c) 2021-2024 Openbitlab Team # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, ...
openbitlab/srvcheck
srvcheck/chains/chain.py
.py
1f2ae18b9585112f
7.56
12
# MIT License # Copyright (c) 2021-2026 Openbitlab Team # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, ...
openbitlab/srvcheck
srvcheck/chains/octra.py
.py
968d538e05bee60c
7.56
12
# MIT License # Copyright (c) 2021-2023 Openbitlab Team # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, ...
openbitlab/srvcheck
srvcheck/tasks/task.py
.py
bcbf9795e0d7bf87
7.56
12
# MIT License # Copyright (c) 2021-2023 Openbitlab Team # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, ...
openbitlab/srvcheck
srvcheck/utils/system.py
.py
591fa9cadcbaf246
7.56
12
# MIT License # Copyright (c) 2021-2023 Openbitlab Team # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, ...
openbitlab/srvcheck
tests/mocks/mocknotification.py
.py
fe72688bf150caa8
7.06
12
# MIT License # Copyright (c) 2021-2023 Openbitlab Team # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, ...
openbitlab/srvcheck
tests/notification_test.py
.py
4f162f046c47bbd1
7.06
12
from django.core import mail from django.test import override_settings, tag, TestCase from django.urls import reverse from .models import ContactMessage @tag('contact', 'views') @override_settings(SECURE_SSL_REDIRECT=False) class TestContactMessageCreateView(TestCase): @classmethod def setUpTestData(cls): ...
Cmastris/django_photo_gallery
photo_gallery/contact/tests.py
.py
7dea97752cb09fdd
7.92
6
""" Django settings - update as appropriate! Review these settings and update them (via the corresponding environment variables) to ensure they are appropriate for the app (e.g. localisation settings) and environment (e.g. debug and security settings). To emphasise: some setting values are not suitable for a live/pr...
Cmastris/django_photo_gallery
photo_gallery/photo_gallery/settings.py
.py
eeff10f466d6c262
7.42
6
from django.test import override_settings, tag, TestCase from unittest.mock import patch from .settings import get_bool_from_env, get_list_from_env @tag('settings') @override_settings(SECURE_SSL_REDIRECT=False) class SettingsTests(TestCase): @tag('get_list_from_env') def test_get_list_from_env_empty(self): ...
Cmastris/django_photo_gallery
photo_gallery/photo_gallery/tests.py
.py
7bdf3431e26364a6
7.92
6
import copy from django.contrib import admin from .models import Collection, Country, Photo class CollectionAdmin(admin.ModelAdmin): fields = ['name', 'description', 'slug', 'photo_count', 'published'] readonly_fields = ['photo_count'] list_display = ('name', 'slug', 'photo_count', 'published') # Gen...
Cmastris/django_photo_gallery
photo_gallery/photos/admin.py
.py
e4b40cfebe3f0d52
7.42
6
"""Reusable platform and VTK version conditional skip markers.""" from __future__ import annotations import os import platform import pytest import pyvista _MARKER_DEFINITIONS = ( ("skip_egl(reason=...)", "skip the test when running with a headless OSMesa/EGL VTK build."), ( "skip_linux(machine=None...
pyvista/pytest-pyvista
pytest_pyvista/_markers.py
.py
7b8a1939a7765fff
8.14
18
"""Autouse fixture that resets PyVista global state between tests.""" from __future__ import annotations import contextlib from typing import TYPE_CHECKING from typing import Any import pytest import pyvista if TYPE_CHECKING: # pragma: no cover from collections.abc import Callable from collections.abc impo...
pyvista/pytest-pyvista
pytest_pyvista/_reset_fixtures.py
.py
2627294219080475
8.14
18
"""Functions users can hook into.""" from __future__ import annotations from typing import TYPE_CHECKING import pytest if TYPE_CHECKING: from .doc_mode import _DocVerifyImageCache from .doc_mode import _VtkszFileSizeTestCase @pytest.hookspec def pytest_pyvista_doc_mode_hook(doc_verify_image_cache: _DocVer...
pyvista/pytest-pyvista
pytest_pyvista/hooks.py
.py
31a4998f37c84abe
7.14
18
from __future__ import annotations # noqa: D100 from typing import TYPE_CHECKING import pytest import pyvista as pv if TYPE_CHECKING: from collections.abc import Generator pytest_plugins = "pytester" # NOTE: close_all_plotters is no longer needed here because the plugin # provides the _close_plotters_clear_t...
pyvista/pytest-pyvista
tests/conftest.py
.py
56c7bed8194e10ed
7.14
18
"""Test the --doc_mode option.""" from __future__ import annotations import functools import logging import os from pathlib import Path import re import subprocess import sys import pytest import pyvista as pv from pytest_pyvista import doc_mode from pytest_pyvista.doc_mode import _DocVerifyImageCache from pytest_p...
pyvista/pytest-pyvista
tests/test_doc_mode.py
.py
b4d4318d41528a3b
7.14
18
"""Tests for the reusable platform and VTK version conditional skip markers.""" from __future__ import annotations import platform import pytest import pyvista from pyvista.plotting.utilities import gl_checks def test_needs_vtk_version_skips_when_higher_required(pytester: pytest.Pytester, monkeypatch: pytest.Monke...
pyvista/pytest-pyvista
tests/test_markers.py
.py
7dec6d3be388a030
7.14
18
"""Tests for the autouse fixture that resets PyVista global state.""" from __future__ import annotations from typing import TYPE_CHECKING from pytest_pyvista import _reset_fixtures from pytest_pyvista._reset_fixtures import _capture_default if TYPE_CHECKING: import pytest def test_reset_pyvista_state_restores...
pyvista/pytest-pyvista
tests/test_reset_fixtures.py
.py
c6c9d7ad096443a3
7.14
18
"""High-level interface to R3 repositories. The `Repository` class should be imported not from this module but from the top-level `r3` package. """ import os from pathlib import Path from typing import Any, Dict, Iterable, List, Set, Union import yaml from executor import execute import r3 import r3.utils from r3.i...
mtangemann/r3
r3/repository.py
.py
db06102b5d7becd0
7.5
9
"""Storage component for R3 repositories.""" import os import shutil import stat import tempfile import uuid import warnings from datetime import datetime from pathlib import Path from typing import Any, Dict, Iterator, Optional, Union import yaml from executor import execute import r3.utils from r3.job import Depen...
mtangemann/r3
r3/storage.py
.py
f2b1154e5ef38b7c
7.5
9
"""Shared pytest fixtures for the R3 test suite.""" import pytest @pytest.fixture(autouse=True) def _isolated_git_identity(monkeypatch: pytest.MonkeyPatch) -> None: """Give every test a self-contained git identity, independent of the machine. Also nulls ``GIT_CONFIG_GLOBAL``/``GIT_CONFIG_SYSTEM`` so machine...
mtangemann/r3
test/conftest.py
.py
86c492487d416878
7
9
"""Unit tests for the R3 command line interface.""" from pathlib import Path from typing import List import pytest import yaml from click.testing import CliRunner from pytest_mock.plugin import MockerFixture from r3.cli import cli from r3.job import Job, JobDependency from r3.repository import Repository DATA_PATH ...
mtangemann/r3
test/test_cli.py
.py
897e2cec77f5e0a2
7
9
"""Tests for package version resolution.""" from pathlib import Path import r3 VERSION_FILE = Path(__file__).parent.parent / "VERSION" def test_version_matches_version_file() -> None: """In a source tree / editable install, ``__version__`` reflects VERSION live. This is the path exercised by the CLI's ``-...
mtangemann/r3
test/test_version.py
.py
217f620cc9593235
7
9
"""MCP server for searching managed service notification logs.""" import json import os from pathlib import Path from typing import Any, Dict, List import chromadb from chromadb.api.models.Collection import Collection from fastmcp import FastMCP from sentence_transformers import SentenceTransformer class Notificati...
openshift/managed-notifications
mcp/main.py
.py
9fa7c75ccf588cc5
7.57
13
"""Build embeddings for managed service notification logs.""" import json import os import re from pathlib import Path from typing import Any, Dict, List, Union, Mapping import chromadb from sentence_transformers import SentenceTransformer def load_embedding_model() -> SentenceTransformer: """Load the sentence ...
openshift/managed-notifications
mcp/scripts/build_embeddings.py
.py
a3baf8926cc8dcd5
7.57
13
#!/usr/bin/env python """Downloads Vale if not downloaded yet and executes it.""" import os import platform import shutil import subprocess import sys import tarfile import tempfile import zipfile from functools import partial from pathlib import Path from typing import Optional, Tuple from urllib.request import urlop...
daniperez/vale-python-package
vale/main.py
.py
871d2558e0638450
7.5
9
#!/usr/bin/env python3 # Copyright 2025 Canonical Ltd. # See LICENSE file for licensing details. """File utilities for charmbuild: copying context, patching YAML, and moving build artefacts.""" import logging import shutil import yaml from pathlib import Path from typing import Optional logger = logging.getLogger(__...
canonical/operator-workflows
charmbuild/src/files.py
.py
0a2e272c839be4d7
7.54
11
#!/usr/bin/env python3 # Copyright 2025 Canonical Ltd. # See LICENSE file for licensing details. """Entry point for charmbuild: wraps charmcraft with build-context support.""" import argparse import logging import os import shutil import subprocess import sys import tempfile from pathlib import Path from charmbuild....
canonical/operator-workflows
charmbuild/src/main.py
.py
49616e07e0d51764
7.54
11
#!/usr/bin/env python3 # Copyright 2024 Canonical Ltd. # See LICENSE file for licensing details. """A charm for tesing charm upload.""" from ops.charm import CharmBase from ops.main import main from ops.model import ActiveStatus class TestUploadCharm(CharmBase): """Charm the service.""" def __init__(self,...
canonical/operator-workflows
tests/workflows/integration/test-alter-rock-name/src/charm.py
.py
e7f5634758fc822a
8.04
11
#!/usr/bin/env python3 # Copyright 2024 Canonical Ltd. # See LICENSE file for licensing details. """A charm for tesing charm upload.""" import typing from ops.charm import CharmBase from ops.main import main from ops.model import ActiveStatus class TestUploadCharm(CharmBase): """Charm the service.""" def...
canonical/operator-workflows
tests/workflows/integration/test-upload-charm/src/charm.py
.py
29f2da291b83f6bd
8.04
11
# Copyright 2024 Canonical Ltd. # See LICENSE file for licensing details. """Unit tests.""" import unittest class TestCharm(unittest.TestCase): """Unit tests.""" def test(self): """Test case.""" pass
canonical/operator-workflows
tests/workflows/integration/test-upload-charm/tests/unit/test_charm.py
.py
fca6651b0525e8f7
7.04
11
import io import sys from collections.abc import Mapping from typing import TYPE_CHECKING import mdformat.renderer import ruamel.yaml from markdown_it import MarkdownIt from mdit_py_plugins.front_matter import front_matter_plugin if TYPE_CHECKING: from mdformat.renderer import RenderContext, RenderTreeNode fr...
butler54/mdformat-frontmatter
mdformat_frontmatter/plugin.py
.py
fc6aa045d5e39b02
7.63
17
import abc import pathlib import tempfile import typing from types import TracebackType from jinja2 import Template from pwhtmltopdf.pw import PlayWrightServer from pwhtmltopdf.structures import PageParameters, PdfParameters from pwhtmltopdf.types import StrPath, StrPathLike class BaseHTP(abc.ABC): def __init__...
vvanglro/pwhtmltopdf
pwhtmltopdf/abc.py
.py
2e1a818a9adbc567
7.63
17
#!/usr/bin/env python3 """Fetch the latest homeassistant tag and generate typing stubs for it.""" from __future__ import annotations import argparse import json import logging import os from pathlib import Path import shutil import subprocess import sys import tempfile import tomllib from typing import TYPE_CHECKING ...
KapJI/homeassistant-stubs
update_stubs.py
.py
6322357b00a8ce48
7.62
16
from __future__ import annotations import os import inspect import logging import datetime import functools from typing import ( TYPE_CHECKING, Any, Union, Generic, TypeVar, Callable, Iterator, AsyncIterator, cast, overload, ) from typing_extensions import Awaitable, ParamSpec, ...
Finch-API/finch-api-python
src/finch/_legacy_response.py
.py
a7771b83d9f95215
7.48
8
# 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...
Finch-API/finch-api-python
src/finch/_streaming.py
.py
bb4b3f21dfe5540a
7.48
8
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 ( ...
Finch-API/finch-api-python
src/finch/_types.py
.py
4186e579bda055cf
7.48
8
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 `finch.resources` module. This is used so that we can lazily import `finch.resources` only when needed *and* so that us...
Finch-API/finch-api-python
src/finch/_utils/_resources_proxy.py
.py
413908064826a539
7.48
8
"""Classes to handle alignments between template structure(s) and target sequence(s). To create an alignment, first declare a class for the given kind of alignment by deriving from subclasses of :class:`AlignmentMode` (e.g. :class:`Global`) and :class:`AlignmentType` (e.g. :class:`Pairwise`). For exampl...
ihmwg/python-modelcif
modelcif/alignment.py
.py
3a17d2a262b4ce28
7.59
14
"""Classes to associate extra files with the system. Typically, one or more :class:`Repository` objects are created and added to :attr:`modelcif.System.repositories`.""" import posixpath import warnings class Repository: """An online location where associated files can be found. These objects are t...
ihmwg/python-modelcif
modelcif/associated.py
.py
50da907346d00357
7.59
14
"""Classes to track inputs/outputs of modeling protocols. See also :class:`modelcif.protocol.Step`. """ class Data: """Some part of the system that is input or output by part of the modeling protocol, and/or stored in a file. Usually a subclass is passed to :class:`modelcif.protocol.Step` ...
ihmwg/python-modelcif
modelcif/data.py
.py
9e55fa43e16b3b94
7.59
14
"""Classes to describe the chemistry of custom chemical components. If a given :class:`ihm.ChemComp` is not defined in either the wwPDB chemical component dictionary (CCD) or the ModelArchive CCD, its chemistry can be described with one or more of these objects. They are passed as the ``descriptors`` argum...
ihmwg/python-modelcif
modelcif/descriptor.py
.py
41cfc6898eb9acb5
7.59
14
import ihm.representation from ihm.model import Atom, ModelGroup # noqa: F401 import modelcif.data from ihm.util import _check_residue_range # Provide ma-specific docs for Atom Atom.__doc__ = """Coordinates of part of the model represented by an atom. See :meth:`Model.get_atoms` for more details. :param asym_unit:...
ihmwg/python-modelcif
modelcif/model.py
.py
0a9ec30afcc9f60c
7.59
14
"""Classes for handling modeling protocols. """ class Step: """A single step in a :class:`Protocol`. This class describes a generic step in a modeling protocol. In most cases, a more specific subclass should be used, such as :class:`TemplateSearchStep`, :class:`ModelingStep`, or :clas...
ihmwg/python-modelcif
modelcif/protocol.py
.py
471c858fa86f2197
7.59
14
import modelcif import modelcif.dumper import modelcif.reader import os import unittest class Tests(unittest.TestCase): def test_basic(self): """Basic install test""" system = modelcif.System(title='test system') entity_a = modelcif.Entity('AAA', description='Subunit A') entity_b ...
ihmwg/python-modelcif
modelcif/test.py
.py
e017652d02d76dbd
8.09
14
import utils import os import unittest TOPDIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) utils.set_search_paths(TOPDIR) import modelcif.alignment class Tests(unittest.TestCase): def test_identity(self): """Test sequence identity classes""" ident = modelcif.alignment.ShorterS...
ihmwg/python-modelcif
test/test_alignment.py
.py
558904528cfd81b6
8.09
14
import utils import os import unittest TOPDIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) utils.set_search_paths(TOPDIR) import modelcif.associated class Tests(unittest.TestCase): def test_local_pairwise_qa_scores_file(self): """Test LocalPairwiseQAScoresFile class""" self.as...
ihmwg/python-modelcif
test/test_associated.py
.py
4f765308af80f5eb
8.09
14
import utils import os import unittest TOPDIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) utils.set_search_paths(TOPDIR) import modelcif.descriptor class Tests(unittest.TestCase): def test_descriptor(self): """Test Descriptor classes""" base = modelcif.descriptor.Descriptor("...
ihmwg/python-modelcif
test/test_descriptor.py
.py
1de5ff39cbb92412
7.59
14
import utils import os import unittest import io TOPDIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) utils.set_search_paths(TOPDIR) import modelcif.reader import modelcif.dumper class Tests(unittest.TestCase): def test_model_with_assembly(self): """Test read of Model with Assembly fol...
ihmwg/python-modelcif
test/test_edit.py
.py
da892ecb7f6e92db
7.09
14
import utils import os import unittest TOPDIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) utils.set_search_paths(TOPDIR) import modelcif.model class Tests(unittest.TestCase): def test_model(self): """Test Model classes""" m = modelcif.model.HomologyModel([]) self.asse...
ihmwg/python-modelcif
test/test_model.py
.py
001f58c9f47725ea
8.09
14
import os import unittest import utils TOPDIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) utils.set_search_paths(TOPDIR) import modelcif.qa_metric class Tests(unittest.TestCase): def test_metric_types(self): """Test MetricType subclasses""" self.assertEqual(modelcif.qa_metric...
ihmwg/python-modelcif
test/test_qa_metric.py
.py
69428d6002df8d1e
7.09
14
import utils import os import unittest TOPDIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) utils.set_search_paths(TOPDIR) import modelcif.reference class Tests(unittest.TestCase): def test_template_reference(self): """Test TemplateReference classes""" ref = modelcif.reference....
ihmwg/python-modelcif
test/test_reference.py
.py
732e87ab3c65b66d
7.09
14
import os import sys import tempfile import contextlib import shutil def set_search_paths(topdir): """Set search paths so that we can import Python modules""" os.environ['PYTHONPATH'] = topdir + os.pathsep \ + os.environ.get('PYTHONPATH', '') sys.path.insert(0, topdir) def get_input_file_name(to...
ihmwg/python-modelcif
test/utils.py
.py
fe9fc7152972af52
8.09
14
import unittest import modelcif.reader import modelcif.dumper import urllib.request import os class Tests(unittest.TestCase): def _read_cif(self, url): with urllib.request.urlopen(url) as fh: s, = modelcif.reader.read(fh) return s def _write_cif(self, s, check=True): with ...
ihmwg/python-modelcif
util/check-db-entries.py
.py
ceae66f511e20ca4
7.59
14
#!/usr/bin/python import os import pathlib import re from pathlib import Path import terraformDocGoMod import terraformDocsUtils # Check if a line is a heading def get_title( line: str, code_block: bool, comment_block: bool ) -> tuple[int, str, bool, bool]: level = 0 for c in line: # set a flag ...
terraform-ibm-modules/common-dev-assets
module-assets/ci/terraformDocOverview.py
.py
728ed83f0b73bc5f
7.48
8
import json import logging import os import shutil import numpy as np import scipy.misc try: from StringIO import StringIO # Python 2.7 except ImportError: from io import BytesIO # Python 3.x import torch import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt class Params(): """...
chto/linna
linna/nnutils.py
.py
1a989796cac8da49
7.45
7
"""The Protocol base class and the decode contract shared by all headers. Decode contract --------------- ``decode(data)`` receives the *entire remaining buffer* — everything from the start of this protocol's header to the end of the captured frame — and must: 1. Parse the fixed portion with the class-level ``struct....
EONRaider/NETProtocols
src/netprotocols/_base.py
.py
9d8f3b481873574a
7.54
11
"""Protocol number registries. This module is intentionally dependency-free: it must never import from the layer modules, so that any protocol class can import an enum from here without creating an import cycle. """ from enum import IntEnum __all__ = ["ARPHardwareType", "ARPOperation", "EtherType", "IPProtocol"] c...
EONRaider/NETProtocols
src/netprotocols/_enums.py
.py
0c2274d1f39e70c6
7.54
11
"""ARP packet header (RFC 826).""" from __future__ import annotations from dataclasses import dataclass from struct import Struct from typing import ClassVar, Self from netprotocols._base import ( Protocol, bytes_to_ipv4, bytes_to_mac, ipv4_to_bytes, mac_to_bytes, ) from netprotocols._enums impor...
EONRaider/NETProtocols
src/netprotocols/layer2/arp.py
.py
09ea96fcc79770c0
7.54
11
"""Ethernet II frame header (IEEE 802.3).""" from __future__ import annotations from dataclasses import dataclass from struct import Struct from typing import ClassVar, Self from netprotocols._base import Protocol, bytes_to_mac, mac_to_bytes from netprotocols._enums import EtherType from netprotocols.utils.mac impor...
EONRaider/NETProtocols
src/netprotocols/layer2/ethernet.py
.py
ef1845df2799291f
7.54
11
"""ICMPv4 (RFC 792) and ICMPv6 (RFC 4443) headers. Both classes model the 8-byte header common to all control messages: type, code, checksum, and the message-specific final 4 bytes (the "rest of header" in ICMPv4, the start of the message body in ICMPv6). Message-specific payloads beyond those 8 bytes are left to the ...
EONRaider/NETProtocols
src/netprotocols/layer3/icmp.py
.py
586b472bfdb7f8a4
7.54
11
"""UDP datagram header (RFC 768).""" from __future__ import annotations from dataclasses import dataclass from struct import Struct from typing import ClassVar, Self from netprotocols._base import Protocol __all__ = ["UDP"] @dataclass(frozen=True, slots=True) class UDP(Protocol): """A UDP header. :param ...
EONRaider/NETProtocols
src/netprotocols/layer4/udp.py
.py
7b2b640dc1ef2489
7.54
11
"""Composition of protocol headers into a serializable packet.""" from __future__ import annotations from netprotocols._base import Protocol from netprotocols.utils.exceptions import InvalidFieldError __all__ = ["Packet"] class Packet: """An ordered stack of protocol headers, outermost first. >>> packet =...
EONRaider/NETProtocols
src/netprotocols/packet.py
.py
999bbe334210f0fb
7.54
11
"""Exception hierarchy for netprotocols. Every exception raised by this library derives from :class:`ProtocolError`, so callers can guard an entire decode pipeline with a single handler. """ __all__ = [ "InvalidFieldError", "InvalidIPv4AddressError", "InvalidMACAddressError", "InvalidManufacturerCodeE...
EONRaider/NETProtocols
src/netprotocols/utils/exceptions.py
.py
937acd6187749a70
7.54
11
"""MAC address validation and generation.""" import re import string from random import choices from netprotocols.utils.exceptions import ( InvalidMACAddressError, InvalidManufacturerCodeError, ) __all__ = ["mac_regex", "random_mac", "validate_mac_addr"] mac_regex = re.compile( r"^(?P<oui>([\dA-F]{2}[:-...
EONRaider/NETProtocols
src/netprotocols/utils/mac.py
.py
ba901da433c291b8
7.54
11
"""Shared fixtures: real header bytes from captured traffic. Sources include the Wireshark sample captures at https://wiki.wireshark.org/SampleCaptures (arp-storm.pcap, among others) and locally captured frames. """ import pytest @pytest.fixture def raw_eth_header() -> bytes: """Ethernet II header of a broadcas...
EONRaider/NETProtocols
tests/conftest.py
.py
dae8991fb778c696
7.04
11
"""Helper script to convert all .puml/.plantuml files stored under docs/diagrams into images.""" from __future__ import annotations from itertools import chain from pathlib import Path from typing import Dict import plantuml from sphinx.application import Sphinx from sphinx.util import logging logger = logging.getL...
DudeNr33/gherlint
docs/exts/convert_plantuml.py
.py
4e4b8ae46a90a51f
7.45
7
""" ``gherlint`` is a linter for Cucumber Gherkin feature files. """ from pathlib import Path import click from gherlint.fixer import LanguageFixer from gherlint.linter import GherkinLinter from gherlint.statistics import compute_metrics @click.group( context_settings={"help_option_names": ["-h", "--help"]}, ...
DudeNr33/gherlint
src/gherlint/__main__.py
.py
65e8b4f96b12d25e
7.45
7
""" Checker focussing of completeness of feature files, e. g. that every scenario must have a name, every parameter that is used in a scenario outline has to be defined in the examples, etc. """ from typing import Set, Union from gherlint.checkers.base_checker import BaseChecker from gherlint.exceptions import Intern...
DudeNr33/gherlint
src/gherlint/checkers/completeness.py
.py
04b26bc93dcc5b1d
7.45
7
from __future__ import annotations from typing import TYPE_CHECKING, Optional if TYPE_CHECKING: from gherlint.objectmodel import nodes class GherlintException(Exception): """Base class for all custom exceptions issued by Gherlint""" class InternalError(GherlintException): """Intended to be used in pla...
DudeNr33/gherlint
src/gherlint/exceptions.py
.py
a8ef6ba30040c371
7.45
7
"""Options and options handling for checkers of other classes.""" from __future__ import annotations from typing import ClassVar from pydantic import BaseModel, Field # pylint: disable=no-name-in-module from gherlint.config import Config class Options(BaseModel): """Options for a checker.""" config_sect...
DudeNr33/gherlint
src/gherlint/options.py
.py
fd78393fb9db9533
7.45
7
from typing import List from gherlint.checkers.base_checker import BaseChecker from gherlint.objectmodel.nodes import Node class ASTWalker: """ A class which walks through the inidvidual notes of an abstract syntax tree representing a Gherkin feature file and calls the callbacks. """ def __init_...
DudeNr33/gherlint
src/gherlint/walker.py
.py
b806abdd997cab90
7.45
7
from contextlib import contextmanager from pathlib import Path from typing import Optional import pytest from gherlint.config import Config from gherlint.linter import GherkinLinter feature_files = list(Path(__file__).parent.rglob("*.feature")) result_files = [file.parent / (file.stem + ".txt") for file in feature_f...
DudeNr33/gherlint
tests/functional/test_functional.py
.py
43012784f26eb65f
7.95
7
from pathlib import Path import pytest from gherlint.fixer import LanguageFixer class TestLanguageFixer: GOOD_FILE = "good_file.feature" MISSING_TAG = "missing_tag.feature" WRONG_TAG = "wrong_tag.feature" @pytest.fixture() def testfiles(self, tmpdir): """Set up some files to test with i...
DudeNr33/gherlint
tests/unittests/test_fixer.py
.py
1530994eed25fa17
7.95
7
#!/usr/bin/env python3 import math from collections.abc import Sequence from pathlib import Path import numpy as np import numpy.typing as npt from pynonthermal.constants import CLIGHT from pynonthermal.constants import EV from pynonthermal.constants import H from pynonthermal.constants import ME from pynonthermal.co...
lukeshingles/pynonthermal
pynonthermal/base.py
.py
7ca3115cff2b7e8a
7.42
6
from functools import lru_cache from pathlib import Path import numpy as np import numpy.typing as npt import polars as pl import pynonthermal from pynonthermal.axelrod import get_binding_energies from pynonthermal.axelrod import get_lotz_xs_ionisation_vec from pynonthermal.axelrod import get_shell_configs from pynon...
lukeshingles/pynonthermal
pynonthermal/collion.py
.py
6d96e4deeddb6764
7.42
6
import math import warnings from pathlib import Path import numpy as np import polars as pl import pytest import pynonthermal pytestmark = pytest.mark.benchmark outputfolder = Path(__file__).absolute().parent / "output" def test_lotz_heavy_element() -> None: # elements heavier than Ni (Z>28) use the Axelrod 19...
lukeshingles/pynonthermal
pynonthermal/tests/test_sfsolve.py
.py
9aa7464118eea9a3
7.92
6
#!/usr/bin/env python3 """ Generate expected entity state events and relationships JSON files from ClickHouse data. This script connects to ClickHouse (via port-forward) and generates JSON files for integration test assertions. It automatically discovers all entity types and relationship types in the database. Prereq...
solarwinds/swi-k8s-opentelemetry-collector
tests/integration/generate_relationships.py
.py
7b63508d7428c578
7.95
7
import json import os import time from typing import Dict, Iterable, List import pytest from clickhouse_client import ClickHouseClient from test_utils import ( get_attribute_key_and_value, parse_value, ) EXPECTED_DIR = os.path.join( os.path.dirname(__file__), "expected_entitystateevents" ) # Cache for e...
solarwinds/swi-k8s-opentelemetry-collector
tests/integration/test_entity_state_events_snapshot.py
.py
da5fb2a63fe1034d
7.95
7
import os from time import sleep import pytest from test_utils import retry_until_ok_clickhouse from clickhouse_client import ClickHouseClient clickhouse_endpoint = os.getenv("CLICKHOUSE_ENDPOINT", "localhost:8123") clickhouse_client = ClickHouseClient(clickhouse_endpoint) ignored_namespace = "test-namespace-ignore" ...
solarwinds/swi-k8s-opentelemetry-collector
tests/integration/test_namespace_exclusion.py
.py
0bded698777ed623
7.95
7
import json import os from test_utils import retry_until_ok_clickhouse from clickhouse_client import ClickHouseClient clickhouse_endpoint = os.getenv("CLICKHOUSE_ENDPOINT", "localhost:8123") clickhouse_client = ClickHouseClient(clickhouse_endpoint) SERVICE_NAME = "trace-gen-test-service" timeout = int(os.getenv("TEST...
solarwinds/swi-k8s-opentelemetry-collector
tests/integration/test_trace_collection.py
.py
81a4b916657f3507
7.95
7
#!/usr/bin/env python3 # coding: utf-8 """ Read a Cellebrite email export parse it and export it out. """ # <<<<<<<<<<<<<<<<<<<<<<<<<< Imports >>>>>>>>>>>>>>>>>>>>>>>>>> import os import re import sys import argparse import openpyxl from datetime import datetime from openpyxl import load_workbook, Workboo...
LincolnLandForensics/HodgePodge
Cellebrite_Parser/CellebriteEmailxlsx2xlsx.py
.py
054e4e35c53a1ddd
7.62
16
#!/usr/bin/env python3 # coding: utf-8 """ Read a case sheet and re-organize the order of the headers It will read the first sheet just change the order of headers on line 127 """ # <<<<<<<<<<<<<<<<<<<<<<<<<< Imports >>>>>>>>>>>>>>>>>>>>>>>>>> import os import sys import argparse import openpyxl from open...
LincolnLandForensics/HodgePodge
ForensicsReporter/Spreadsheet_reorder.py
.py
50d4f7fcc2a3898f
7.62
16
#!/usr/bin/env python3 # coding: utf-8 """ Parse (Garmin) GPX files and write results to Excel. Author: LincolnLandForensics Version: 1.0.0 """ # <<<<<<<<<<<<<<<<<<<<<<<<<< Imports >>>>>>>>>>>>>>>>>>>>>>>>>> import os import re import sys import zipfile import argparse import gpxpy # pip install gpxpy ...
LincolnLandForensics/HodgePodge
GPS2Address/GPX2XLSX.py
.py
2840f94b2e32c42f
7.62
16
import os import re import sys import argparse import threading import queue import tkinter as tk from tkinter import ttk, filedialog, scrolledtext from typing import List, Dict from datetime import datetime from openpyxl import load_workbook # <<<<<<<<<<<<<<<<<<<<<<<<<< Pre-Sets >>>>>>>>>>>>>>>>>>>>>>>>>> ...
LincolnLandForensics/HodgePodge
MarkdownMaker/xlsx2markdown.py
.py
eb95e1ddd68b815c
7.62
16
#!/usr/bin/env python3 # coding: utf-8 """ Read .docx, .txt, or .pdf files and analyze if they were written by AI Author: LincolnLandForensics Version: 0.0.3 """ # <<<<<<<<<<<<<<<<<<<<<<<<<< Imports >>>>>>>>>>>>>>>>>>>>>>>>>> # import os import re import sys import math import hashlib import argparse imp...
LincolnLandForensics/HodgePodge
Misc/AI_Analyze.py
.py
a966def138b27565
7.62
16
import tkinter as tk from tkinter import filedialog, ttk, messagebox import os import re from datetime import datetime from openpyxl import load_workbook from openpyxl.utils import get_column_letter from bs4 import BeautifulSoup # --- Configuration --- VERSION = "1.2" # Final set of headers HEADERS = ["Date", "Tes...
LincolnLandForensics/HodgePodge
Misc/WriteBlocker_parser.py
.py
02a830900ce7d7a7
7.62
16
import os import threading import tkinter as tk from tkinter import ttk, filedialog from PIL import Image import pillow_heif # CRITICAL FIX: Globally disable all metadata, EXIF, and XMP parsing # This forces libheif to completely skip reading the broken metadata blocks. pillow_heif.options.HEIF_THUMBNAILS = False pil...
LincolnLandForensics/HodgePodge
Misc/heic2jpg.py
.py
113dc2493a50b0e2
7.62
16