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
"""Tests for GEDCOM citation handling.""" import pytest from gedcom7 import const as g7const from gedcom7 import types as g7types from gramps.gen.db import DbWriteBase from gramps.gen.lib import Citation, Person, Source from util import import_to_memory def test_citation_even_without_role(): """Test that EVEN t...
DavidMStraub/gramps-gedcom7
test/test_citation.py
.py
b4edad906ef74e08
7
9
"""Test import of contact fields (PHON, EMAIL, FAX, WWW).""" from gramps.gen.db import DbWriteBase from gramps.gen.db.utils import make_database from gramps.gen.lib import EventType, UrlType from gramps_gedcom7.importer import import_gedcom def test_contact_fields_repository(): """Test import of PHON, FAX, EMAIL...
DavidMStraub/gramps-gedcom7
test/test_contact_fields.py
.py
d361790189fe33c9
8
9
"""Test import of DATE PHRASE structures.""" from gramps.gen.db import DbWriteBase from gramps.gen.db.utils import make_database from gramps.gen.lib import EventType from gramps_gedcom7.importer import import_gedcom def test_date_phrase_on_birth(): """Test import of PHRASE substructure on birth event DATE.""" ...
DavidMStraub/gramps-gedcom7
test/test_date_phrase.py
.py
73fc34967b2b7a9d
8
9
"""Test TIME substructure import.""" import os # Set language BEFORE importing anything else os.environ['LANGUAGE'] = 'en' import pytest from gramps.gen.db import DbWriteBase from gramps.gen.db.utils import make_database from gramps.gen.lib import EventType from gramps_gedcom7.importer import import_gedcom def tes...
DavidMStraub/gramps-gedcom7
test/test_date_time.py
.py
17c442030400b651
7
9
"""Test import of event attributes (AGNC, RELI, CAUS).""" from gramps.gen.db import DbWriteBase from gramps.gen.db.utils import make_database from gramps.gen.lib import AttributeType, EventType from gramps_gedcom7.importer import import_gedcom def test_birth_event_attributes(): """Test import of AGNC, RELI, CAUS...
DavidMStraub/gramps-gedcom7
test/test_event_attributes.py
.py
5dc7280ae35d68fc
7
9
"""Test import of external IDs (EXID and REFN).""" from gramps.gen.db import DbWriteBase from gramps.gen.db.utils import make_database from gramps.gen.lib import AttributeType, EventType from gramps_gedcom7.importer import import_gedcom def test_individual_external_ids(): """Test import of EXID and REFN for indi...
DavidMStraub/gramps-gedcom7
test/test_external_ids.py
.py
aa18ddf6b716c49e
7
9
"""Tests for GEDCOM family record handling.""" import pytest from gedcom7 import const as g7const from gedcom7 import types as g7types from gramps.gen.db import DbWriteBase from gramps.gen.lib import ChildRef, Family, Person from util import import_to_memory GRAMPS_ID = "F1" def get_family( children_structure...
DavidMStraub/gramps-gedcom7
test/test_family.py
.py
28114be035083d5e
7
9
"""Test handling of PHRASE on family relationship structures (HUSB, WIFE, CHIL).""" from gramps.gen.db import DbWriteBase from gramps.gen.db.utils import make_database from gramps_gedcom7.importer import import_gedcom def test_husb_phrase(): """Test that HUSB PHRASE is imported as a note on the family.""" db...
DavidMStraub/gramps-gedcom7
test/test_family_phrase.py
.py
383b4f274787a5ec
7
9
"""Test the GEDCOM to XML conversion.""" import gzip import os import tempfile import pytest from click.testing import CliRunner from gramps_gedcom7.gedcom2xml import main @pytest.fixture def gedcom_file(): """Return the path to a test GEDCOM file.""" return os.path.join(os.path.dirname(__file__), "data", ...
DavidMStraub/gramps-gedcom7
test/test_gedcom2xml.py
.py
dd8a16595cf55954
8
9
"""Tests for GEDCOM individual record handling.""" import pytest from gedcom7 import const as g7const from gedcom7 import types as g7types from gramps.gen.db import DbWriteBase from gramps.gen.lib import ( Citation, Event, EventType, Media, NameType, Note, Person, Source, ) from util i...
DavidMStraub/gramps-gedcom7
test/test_individual.py
.py
22d34b34c452d0f3
8
9
"""Test media reference TITL handling.""" from gramps.gen.db import DbWriteBase from gramps.gen.db.utils import make_database from gramps_gedcom7.importer import import_gedcom def test_media_ref_title(): """Test that OBJE.TITL is stored as an attribute on the media reference.""" gedcom_file = "test/data/medi...
DavidMStraub/gramps-gedcom7
test/test_media_ref_title.py
.py
66faff9d72a69372
7
9
"""Test that notes get appropriate NoteType based on object type.""" import tempfile import os from gramps.gen.db import DbWriteBase from gramps.gen.db.utils import make_database from gramps.gen.lib import NoteType from gramps_gedcom7.importer import import_gedcom def test_family_note_type(): """Test that HUSB/W...
DavidMStraub/gramps-gedcom7
test/test_note_types.py
.py
19602805f9ca2adf
7
9
"""Test place deduplication.""" from gramps.gen.db import DbWriteBase from gramps.gen.db.utils import make_database from gramps_gedcom7.importer import import_gedcom def test_places_are_deduplicated(): """Test that two events with the same place share a single Place object. Two people with birth events...
DavidMStraub/gramps-gedcom7
test/test_place_deduplication.py
.py
2e885f59ddd2a2a1
8
9
"""Test place hierarchy implementation.""" from gramps.gen.db import DbWriteBase from gramps.gen.db.utils import make_database from gramps.gen.lib import PlaceType from gramps_gedcom7.importer import import_gedcom def test_place_hierarchy_created(): """Test that a place with multiple jurisdictions creates a hie...
DavidMStraub/gramps-gedcom7
test/test_place_hierarchy.py
.py
d5948915ae9d7c7a
7
9
"""Test that place properties follow first-event-wins policy for deduplicated places.""" from gramps.gen.db.utils import make_database from gramps_gedcom7.importer import import_gedcom def test_place_properties_first_event_wins(): """Test that when two events have same place with different properties, first win...
DavidMStraub/gramps-gedcom7
test/test_place_properties.py
.py
4e69ac45733b54d1
7
9
"""Test handling of PHRASE on relationship structures.""" import os import pytest from gramps.gen.db import DbWriteBase from gramps.gen.db.utils import make_database from gramps_gedcom7.importer import import_gedcom @pytest.fixture(autouse=True) def set_locale(): """Set locale to English for consistent event t...
DavidMStraub/gramps-gedcom7
test/test_relationship_phrase.py
.py
f2664b618c344f44
7
9
"""Test import of repository addresses.""" from gramps.gen.db import DbWriteBase from gramps.gen.db.utils import make_database from gramps_gedcom7.importer import import_gedcom def test_repository_full_address(): """Test import of full ADDRESS_STRUCTURE for repositories.""" gedcom_file = "test/data/repositor...
DavidMStraub/gramps-gedcom7
test/test_repository_address.py
.py
9ca845c32be261f0
8
9
"""Test MEDI PHRASE handling in SOURCE_REPOSITORY_CITATION.""" from gramps.gen.db import DbWriteBase from gramps.gen.db.utils import make_database from gramps.gen.lib import SourceMediaType from gramps_gedcom7.importer import import_gedcom def test_medi_with_phrase(): """Test that MEDI with PHRASE uses the phra...
DavidMStraub/gramps-gedcom7
test/test_source_medi_phrase.py
.py
7b777452786544aa
8
9
"""Test GEDCOM submitter handling.""" from gramps.gen.db import DbWriteBase from gramps.gen.db.utils import make_database from gramps.gen.lib import UrlType from gramps_gedcom7.importer import import_gedcom def test_submitter_to_researcher(): """Test that HEAD.SUBM becomes the database Researcher.""" gedcom_...
DavidMStraub/gramps-gedcom7
test/test_submitter.py
.py
c24b4d71f2acd8b4
8
9
from gedcom7 import types as g7types from gramps.gen.lib import Date from gramps_gedcom7.util import gedcom_date_value_to_gramps_date def test_gedcom_date_value_to_gramps_date_date(): """Test conversion of a valid GEDCOM date to a Gramps date.""" date_value = g7types.Date(year=2023, month="OCT", day=15, cale...
DavidMStraub/gramps-gedcom7
test/test_util.py
.py
de35d6524c029489
7
9
# GPU LANGEVIN THERMOSTAT, NO ASE ROUND TRIP # # Demonstrates torchanipbe0.md.Langevin driving ANIPBE0_2x directly through # tensors that stay on the GPU for the whole run. Checks that the kinetic # temperature relaxes toward and then fluctuates around the requested bath # temperature. import torch from torchanipbe0 ...
RowleyGroup/MLXDM
tests/langevin_gpu.py
.py
ce9c72d802d3009c
7
9
# GPU LANGEVIN THERMOSTAT ON A LARGE LENNARD-JONES CLUSTER # # Stress-tests torchanipbe0.md.Langevin on a system much bigger than a single # molecule: a several-hundred-atom Lennard-Jones (argon-like) cluster, using # a minimal LJ "potential" that implements the same # ``model((species, coordinates), cell=cell, pbc=pbc...
RowleyGroup/MLXDM
tests/langevin_lj_cluster.py
.py
7ebe969d79546f80
8
9
# GPU LANGEVIN THERMOSTAT WITH THE REAL ANIPBE0_2x + MLXDM_2x POTENTIAL # # Runs torchanipbe0.md.Langevin against the actual combined short-range + # dispersion neural-network potential (not a toy LJ model), on a cluster of # water molecules, entirely through tensors kept on the GPU. Confirms the # integrator works end...
RowleyGroup/MLXDM
tests/langevin_mlxdm_water_cluster.py
.py
571f46e7f6f7384f
7
9
# GPU GEOMETRY OPTIMIZATION AND NVE MOLECULAR DYNAMICS, NO ASE ROUND TRIP # # Demonstrates torchanipbe0.md.optimize_geometry and torchanipbe0.md.VelocityVerlet # driving ANIPBE0_2x and ANIPBE0_2x + MLXDM_2x directly through tensors that stay # on the GPU for the whole run (species/coordinates/masses/velocities/timestep...
RowleyGroup/MLXDM
tests/md_gpu.py
.py
7376b078d9a26480
7
9
# CHECK THE RUNTIME OF EXISTED MODELS # Author: Tu Nguyen Thien Phuc # Last update: 2021-09-30 import numpy as np import time import torchanipbe0 from torchanipbe0 import models import torch import numpy as np import ase from ase import io from ase.md.verlet import VelocityVerlet from ase.lattice.hexagonal impor...
RowleyGroup/MLXDM
tests/runtime.py
.py
d835180b927ea310
7
9
# The neural network dispersion utilities # Author: Tu Nguyen Thien Phuc # Last update: 2021-09-30 import torch import numpy as np from typing import NamedTuple from torch import Tensor BOHR_TO_ANSTROM = 0.529177249 class CAtomic(NamedTuple): atoms: Tensor coefficients: Tensor def cutoff_function(distance, ...
RowleyGroup/MLXDM
torchanipbe0/dispersion/utils.py
.py
0f03c7545b4795e9
7.5
9
import torch from collections import OrderedDict from torch import Tensor from torch.utils.weak import WeakTensorKeyDictionary from typing import Tuple, NamedTuple, Optional from . import utils class SpeciesEnergies(NamedTuple): species: Tensor energies: Tensor class SpeciesCoordinates(NamedTuple): spec...
RowleyGroup/MLXDM
torchanipbe0/nn.py
.py
6f0582a9404fdedf
7.5
9
r"""Unit conversion factors used in torchani The torchani networks themselves works internally entirely in Hartrees (energy), Angstroms (distance) and AMU (mass). In some example code and scripts we convert to other more commonly used units. Our conversion factors are consistent with `CODATA 2014 recommendations`_, wh...
RowleyGroup/MLXDM
torchanipbe0/units.py
.py
1de8618c43a5b400
7.5
9
""" Fuente de abreviaciones: https://www.ieec.org.mx/transparencia/doctos/art74/i/reglamentos/Reglamento_de_elecciones/anexo_7.pdf """ import pandas as pd import plotly.graph_objects as go from textwrap import wrap # La fecha en la que los datos fueron recopilados. FECHA_FUENTE = "enero 2026" ENTID...
lapanquecita/incidencia-delictiva
top10.py
.py
3dd3636d502829cb
7.52
10
"""Config flow for WeatherAPI integration.""" import voluptuous as vol from homeassistant.config_entries import ConfigEntry, ConfigFlow, OptionsFlow from homeassistant.const import CONF_API_KEY, CONF_LATITUDE, CONF_LONGITUDE, CONF_NAME from homeassistant.core import HomeAssistant, callback from homeassistant.data_ent...
iprak/weatherapi
custom_components/weatherapi/config_flow.py
.py
bed0aaaf99141d2a
7.48
8
"""The WeatherAPI data coordinator.""" import asyncio from dataclasses import dataclass from datetime import datetime, timedelta from http import HTTPStatus from typing import Any import aiohttp from aiohttp import ClientSession import requests from homeassistant.components.air_quality import ( ATTR_CO, ATTR...
iprak/weatherapi
custom_components/weatherapi/coordinator.py
.py
fb97a2c2e7882dfa
7.48
8
"""Support for WeatherAPI integration.""" from collections.abc import Mapping from typing import Any from homeassistant.components.weather import ( ATTR_WEATHER_HUMIDITY, ATTR_WEATHER_OZONE, ATTR_WEATHER_PRESSURE, ATTR_WEATHER_TEMPERATURE, ATTR_WEATHER_VISIBILITY, ATTR_WEATHER_WIND_BEARING, ...
iprak/weatherapi
custom_components/weatherapi/weather.py
.py
c4f0c67bae6d9e55
7.48
8
"""Fixtures for testing.""" from datetime import timedelta import json import os import pytest from pytest_homeassistant_custom_component.common import MockConfigEntry from custom_components.weatherapi import coordinator from custom_components.weatherapi.const import DOMAIN, UPDATE_INTERVAL_MINUTES from custom_compo...
iprak/weatherapi
tests/conftest.py
.py
d16dfef320d08e86
7.98
8
from __future__ import annotations from importlib.metadata import entry_points from typing import TYPE_CHECKING if TYPE_CHECKING: # pragma: no cover from collections.abc import Callable from pyvisgen import __version__ from pyvisgen.utils.logging import setup_logger LOGGER = setup_logger(__name__) class Mana...
radionets-project/pyvisgen
src/pyvisgen/_plugin_manager.py
.py
3e369a1f9c6136cd
7.45
7
import sysconfig from dataclasses import dataclass, fields from pathlib import Path import pandas as pd import torch from astropy.coordinates import EarthLocation from pyvisgen.utils.logging import setup_logger LOGGER = setup_logger(namespace=__name__) __all__ = ["Stations", "get_array_layout", "get_array_names"] ...
radionets-project/pyvisgen
src/pyvisgen/layouts/layouts.py
.py
2c1bac3e365dda19
7.45
7
import torch from astropy.utils.decorators import lazyproperty __all__ = ["Array"] class Array: """Class that handles antenna array operations such as calculating antenna pairs for baselines. Parameters ---------- array_layout : :class:`~pyvisgen.layouts.Stations` :class:`~pyvisgen.layou...
radionets-project/pyvisgen
src/pyvisgen/simulation/array.py
.py
acbb81311c537220
7.45
7
import sysconfig import tomllib import warnings from functools import cache from pathlib import Path import torch def _noise_config_dir() -> Path: root = sysconfig.get_path("data", sysconfig.get_default_scheme()) return Path(root) / "share" / "resources" / "noise_configs" def available_telescopes() -> list...
radionets-project/pyvisgen
src/pyvisgen/simulation/noise.py
.py
a38641be4418d686
7.45
7
from __future__ import annotations import gc import torch OOM_EXCEPTIONS = (torch.cuda.OutOfMemoryError, torch.OutOfMemoryError) MIN_BATCH_SIZE = 1 def _cuda_gc(): """Garbage collector for CUDA.""" gc.collect() if torch.cuda.is_available(): # pragma: no cover torch.cuda.empty_cache() def _r...
radionets-project/pyvisgen
src/pyvisgen/utils/batch_size.py
.py
6938888ce468111e
7.45
7
from __future__ import annotations from pathlib import Path from typing import TYPE_CHECKING import h5py import numpy as np from natsort import natsorted if TYPE_CHECKING: from typing import String, Union __all__ = ["load_bundles", "open_bundles"] def load_bundles( data_path: Union(String, Path), dataset_...
radionets-project/pyvisgen
src/pyvisgen/utils/data.py
.py
f96272cdcd326745
7.45
7
import pytest import torch from pyvisgen.simulation.observation import ValidBaselineSubset from pyvisgen.simulation.scan import ( RIMEScan, angular_distance, calc_beam, calc_feed_rotation, calc_fourier, integrate, jinc, ) try: import cufinufft # noqa: F401 _FINUFFT_AVAIL = True ...
radionets-project/pyvisgen
tests/simulation/test_scan.py
.py
ea33a15cf1361856
7.95
7
#!/usr/bin/env python3 """ Script to update ZE_API_VERSION_CURRENT value in a new dump file to match the old dump file. This ensures ABI compatibility by reverting the version to the previous value. """ import re import sys import argparse def get_ze_api_version_current_value(dump_file_path): """Extract the ZE_A...
oneapi-src/level-zero-spec
scripts/update_ze_api_version.py
.py
dab9442f44a8693e
7.65
19
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompan...
amazon-braket/amazon-braket-containers
src/braket_container.py
.py
9224af6095d4b47b
7.63
17
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompan...
amazon-braket/amazon-braket-containers
src/buildspec.py
.py
4efb19173876f033
8.13
17
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompan...
amazon-braket/amazon-braket-containers
src/context.py
.py
2a2b55fe59b1f0a4
7.63
17
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompan...
amazon-braket/amazon-braket-containers
src/image.py
.py
c5d55265ca4cfdeb
7.63
17
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompan...
amazon-braket/amazon-braket-containers
src/image_builder.py
.py
36cc230a38b3724d
7.63
17
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompan...
amazon-braket/amazon-braket-containers
src/metrics.py
.py
80d692dbddb2d94a
7.63
17
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompan...
amazon-braket/amazon-braket-containers
src/output.py
.py
776fa09782b5464e
7.63
17
import argparse import json import boto3 from botocore.exceptions import ClientError def tag_image(): parser = argparse.ArgumentParser(description="Program to tag built images") parser.add_argument("--build", type=str, required=True) parser.add_argument("--tag", type=str, required=True) args = parser....
amazon-braket/amazon-braket-containers
src/tag_image.py
.py
d69d244ac727d6f3
7.63
17
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompan...
amazon-braket/amazon-braket-containers
src/utils.py
.py
acf79d9947e52f68
7.63
17
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompan...
amazon-braket/amazon-braket-containers
test/braket_tests/base/test_mpi.py
.py
4f7ec44640075424
8.13
17
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompan...
amazon-braket/amazon-braket-containers
test/braket_tests/common/braket_jobs_util.py
.py
c012ed13ba5f4933
7.13
17
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompan...
amazon-braket/amazon-braket-containers
test/braket_tests/common/image_run_util.py
.py
6cb3f54e64bc1dcc
8.13
17
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompan...
amazon-braket/amazon-braket-containers
test/braket_tests/common/mpi_checks.py
.py
de338bdd18ab3974
8.13
17
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompan...
amazon-braket/amazon-braket-containers
test/braket_tests/cudaq/test_mpi.py
.py
6b5a076c5a90b883
8.13
17
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompan...
amazon-braket/amazon-braket-containers
test/braket_tests/pytorch/test_mpi.py
.py
b65a80f3079335c6
8.13
17
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompan...
amazon-braket/amazon-braket-containers
test/conftest.py
.py
7bc5c451a9f69c86
7.13
17
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompan...
amazon-braket/amazon-braket-containers
test/perform_additional_setup.py
.py
e00ec8b640b4ec46
8.13
17
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompan...
amazon-braket/amazon-braket-containers
test/resources/qaoa_entry_point.py
.py
13a8228d0de9f17b
7.13
17
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompan...
amazon-braket/amazon-braket-containers
test/sagemaker_tests/test_basics.py
.py
c7fb4ed11572d13f
7.13
17
""" Use the elevator music as a context """ from typing import Callable, Union from script_background_music.play import play_random_music_in_background, PlayThread class BackgroundMusicContext(object): """ Run background music in a given context <b>WARNING: Not verified to work on macOS! Should work the...
timo-reymann/python-script-background-music
script_background_music/context.py
.py
d86217f729f8dbff
7.62
16
""" Infrastructure to facilitate playing songs """ import logging from multiprocessing import Process from typing import Union import psutil from script_background_music.songs import get_random_song from script_background_music.vendor.playsound import get_play_sound class PlayThread(Process): """ Thread to be...
timo-reymann/python-script-background-music
script_background_music/play.py
.py
e2fd68dfac2e8c85
7.62
16
""" Songs to play """ from random import choice from pathlib import Path SONGS = [ "local-forecast", "lofi", "overcast" ] def __get_song(name: str) -> Path: base_directory = Path(__file__).parent return base_directory / f"{name}.mp3" def get_random_song() -> Path: """ Pick random song f...
timo-reymann/python-script-background-music
script_background_music/songs/__init__.py
.py
00d5e5ed6d11c42c
7.12
16
import os import os.path as op import warnings from importlib import resources import yaml from jinja2 import Environment, PackageLoader, StrictUndefined from babs.generate_bidsapp_runscript import generate_bidsapp_runscript from babs.generate_submit_script import generate_submit_script, generate_test_submit_script f...
PennLINC/babs
babs/container.py
.py
871d032cf6599d58
7.57
13
"""Create scripts for a BABS project""" import os.path as op import warnings from jinja2 import Environment, PackageLoader, StrictUndefined from babs.utils import ( RUNNING_PYTEST, container_image_path, replace_placeholder_from_config, var_safe_name, ) def generate_bidsapp_runscript( input_data...
PennLINC/babs
babs/generate_bidsapp_runscript.py
.py
0781daf668a42229
7.57
13
"""Create participant_job.sh""" import warnings from importlib import resources import yaml from jinja2 import Environment, PackageLoader, StrictUndefined from babs.utils import container_image_path, var_safe_name # Multiple scheduler system handling DIRECTIVE_PREFIX = { 'sge': '#$', 'slurm': '#SBATCH', } ...
PennLINC/babs
babs/generate_submit_script.py
.py
c5a19cd71e0da4de
7.57
13
"""This module is for input dataset(s).""" import os import re import warnings import zipfile from collections import defaultdict from glob import glob import datalad.api as dlapi import pandas as pd class InputDataset: """Represent an input dataset.""" _is_input_dataset = True def __init__( s...
PennLINC/babs
babs/input_dataset.py
.py
7284163626012253
7.57
13
"""This module is for input dataset(s).""" from babs.input_dataset import InputDataset, OutputDataset from babs.utils import combine_inclusion_dataframes, validate_sub_ses_processing_inclusion class InputDatasets: """Represent a collection of input datasets.""" def __init__(self, processing_level, datasets)...
PennLINC/babs
babs/input_datasets.py
.py
21dddd95c51f8242
7.57
13
"""This is the main module.""" import json import os.path as op import sys import time import datalad.api as dlapi import numpy as np from babs.base import BABS from babs.scheduler import ( report_job_status, submit_array, ) from babs.status import job_status_counts from babs.utils import ( update_submit...
PennLINC/babs
babs/interaction.py
.py
2ce239018c437da4
7.57
13
import math import os import os.path as op import re import shutil import stat import subprocess import time import warnings import datalad.api as dlapi from babs.base import BABS from babs.utils import get_git_show_ref_shasum def robust_rm_dir(path, max_retries=3, retry_delay=1): """ Robustly remove a dire...
PennLINC/babs
babs/merge.py
.py
80cc024d341e75b7
7.57
13
import os.path as op import re import subprocess from io import StringIO import pandas as pd import yaml from babs.status import job_status_counts from babs.utils import get_username, scheduler_status_columns, status_dtypes def run_squeue(queue, job_id: int) -> str: """Run squeue and return raw pipe-delimited o...
PennLINC/babs
babs/scheduler.py
.py
4fa77008c7ccd8d7
7.57
13
import os.path as op import yaml def validate_queue(queue): """ To validate if the type of the cluster system is valid. For valid ones, the type string will be changed to lower case. If not valid, raise error message. """ list_supported = ['slurm'] if queue.lower() in list_supported: ...
PennLINC/babs
babs/system.py
.py
c45bc4ad98c3ccf0
7.57
13
# This python script will be copied to `analysis/code/check_setup` folder # and will be used during `babs check-setup` import argparse import os import os.path as op import subprocess import sys def cli(): parser = argparse.ArgumentParser() parser.add_argument( '--path-workspace', '--path_wor...
PennLINC/babs
babs/template_test_job.py
.py
29c6692af2a30890
7.07
13
"""This is the main module.""" import os.path as op import datalad.api as dlapi import pandas as pd from babs.base import BABS from babs.status import ( JobStatus, SchedulerState, read_job_status_csv, write_job_status_csv, ) EMPTY_JOB_STATUS_DF = pd.DataFrame( columns=['sub_id', 'ses_id', 'task_...
PennLINC/babs
babs/update.py
.py
c71c419cdb52ea95
7.57
13
"""Test the babs workflow.""" import argparse import json import os import os.path as op import subprocess import time from glob import glob from pathlib import Path from unittest import mock import pandas as pd import pytest from conftest import ( gather_slurm_job_diagnostics, get_config_simbids_path, up...
PennLINC/babs
tests/test_babs_workflow.py
.py
4979fe83228c610c
8.07
13
"""Test the check_setup functionality.""" import grp import os import os.path as op import random import re import stat import subprocess from pathlib import Path from unittest.mock import MagicMock, patch import pandas as pd import pytest import yaml from conftest import get_config_simbids_path, update_yaml_for_run ...
PennLINC/babs
tests/test_base.py
.py
e85ad59d30eb6959
7.07
13
"""Test the check_setup functionality.""" import os import os.path as op import shutil import datalad.api as dlapi import pytest from babs import BABSCheckSetup from babs.constants import CHECK_MARK def add_commit_to_ria(ria_path, temp_path): """Add and commit a file to the repository.""" # Clone the datas...
PennLINC/babs
tests/test_check_setup.py
.py
2251817619f52f68
8.07
13
"""Tests for BABS command-line entry points.""" from importlib.metadata import distribution def test_console_script_entry_points_load(): """Ensure every installed BABS console script resolves to a callable.""" console_scripts = [ entry_point for entry_point in distribution('babs').entry_point...
PennLINC/babs
tests/test_cli.py
.py
81b0278da1136f7d
7.07
13
import subprocess from pathlib import Path import pytest from jinja2 import Environment, PackageLoader, StrictUndefined from babs.generate_submit_script import generate_submit_script from babs.utils import ( read_yaml, var_safe_name, ) input_datasets_prep = [ { 'name': 'bids', 'path_in_ba...
PennLINC/babs
tests/test_generate_submit_script.py
.py
145a48668d6d1160
8.07
13
import datalad.api as dlapi import pytest from babs.input_dataset import InputDataset, OutputDataset from babs.input_datasets import InputDatasets def _bids(**overrides): kwargs = { 'name': 'BIDS', 'origin_url': '/does/not/matter', 'path_in_babs': 'inputs/data/BIDS', 'is_zipped': ...
PennLINC/babs
tests/test_input_datasets.py
.py
95564817ecbdf85c
7.07
13
"""Test merge.py error handling and edge cases.""" import os import shutil import stat import subprocess from unittest.mock import MagicMock, patch import datalad.api as dlapi import pytest from babs.merge import BABSMerge, robust_rm_dir from babs.utils import get_git_show_ref_shasum def test_merge_no_branches(bab...
PennLINC/babs
tests/test_merge.py
.py
7dd726895118137d
7.07
13
"""Tests for Slurm-related functionality in BABS. This module contains tests for Slurm job submission and monitoring functionality. Tests are skipped if Slurm commands (squeue, sbatch) are not available on the system. """ from pathlib import Path from unittest import mock import pandas as pd import pytest from babs...
PennLINC/babs
tests/test_slurm.py
.py
f6af92af5150651d
8.07
13
from importlib import resources import pytest import yaml from babs.system import System def test_system_initialization(): """Test that System initializes with a valid type""" system = System('slurm') assert system.type == 'slurm' assert isinstance(system.dict, dict) def test_system_get_dict(): ...
PennLINC/babs
tests/test_system.py
.py
5f4b624bc2fe7f94
8.07
13
"""Test the template_test_job.py functionality.""" import os import shutil import subprocess import sys import tempfile from pathlib import Path def test_template_job_execution(): """Test that template_test_job.py can be copied and executed successfully.""" # Get the path to the template file template_pa...
PennLINC/babs
tests/test_template_job.py
.py
859e98897db2fe00
7.07
13
"""Test the check_setup functionality.""" from pathlib import Path from babs import BABSCheckSetup, BABSUpdate def test_sync_code(babs_project_sessionlevel): """Test that missing config parts raise an error.""" babs_proj = BABSUpdate(babs_project_sessionlevel) # Edit a file in analysis/code/ (Path...
PennLINC/babs
tests/test_update.py
.py
0be5c7640a5f9a08
7.07
13
"""Test the babs workflow.""" import os import os.path as op import shutil import time from pathlib import Path import datalad.api as dl import pytest from conftest import ( gather_slurm_job_diagnostics, get_config_simbids_path, update_yaml_for_run, ) from babs.cli import ( babs_check_setup_main, ...
PennLINC/babs
tests/test_update_input_data.py
.py
c06a51a0d81db93b
8.07
13
import getpass import io import subprocess from pathlib import Path from unittest.mock import MagicMock, patch import datalad.api as dlapi import pandas as pd import pytest import yaml from babs.utils import ( app_output_settings_from_config, combine_inclusion_dataframes, container_image_path, get_git...
PennLINC/babs
tests/test_utils.py
.py
62ada730b541ab02
7.07
13
#!/usr/bin/env python3 import argparse import os import shutil import tempfile from pathlib import Path import toml ORIGINAL_PACKAGE_NAME = "python_template" PYPROJECT_TOML = "pyproject.toml" PYPROJECT_TOML_PATH = Path(PYPROJECT_TOML) PROJECT_DIR_NAME = PYPROJECT_TOML_PATH.resolve().parent.name parser = argparse.Ar...
CiscoDevNet/essentials
archive/python_template/python_scripts/pyproject_toml.py
.py
dc37403114c6e574
7.45
7
"""Fetch and merge messages from email and Webex into AS2 activities.""" from __future__ import annotations from activitystreams2 import Create from ..normalize import normalize_email, normalize_webex, sort_key class MessageAggregator: """Aggregates messages from Outlook and Webex clients.""" def __init__...
CiscoDevNet/essentials
examples/python/ess-messages/src/ess_messages/aggregator/aggregator.py
.py
e4be670b08a6fc54
7.45
7
"""Click CLI for the unified messages inbox.""" from __future__ import annotations import json import logging import click from ess_outlook.graph import GraphClient from ess_webex.auth import get_access_token from ess_webex.client import WebexClient from .aggregator import MessageAggregator from .normalize import a...
CiscoDevNet/essentials
examples/python/ess-messages/src/ess_messages/cli.py
.py
ef79a3a7f30dd24a
7.45
7
"""Normalize email and Webex messages to Activity Streams 2.0.""" from __future__ import annotations import json from datetime import datetime, timezone from activitystreams2 import Create, Note, Person def _ensure_datetime(value: object) -> datetime: """Coerce a value to a timezone-aware datetime.""" if i...
CiscoDevNet/essentials
examples/python/ess-messages/src/ess_messages/normalize.py
.py
90b12f65a4bf235f
7.45
7
#!/usr/bin/env python3 """ This entry knows how to manipulate Python's module path to jump the queue. """ import sys def use(abs_packages_dirs): """Make an entry that contains an installed pip package the preferred location to import the package from. Usage examples : axs byname numpy_1.16.4_pi...
krai/axs
core_collection/essentials_collection/base_pip_package/code_axs.py
.py
25594b107dce1646
7.42
6
import os def parent_list_from_names(newborn_parent_names, protected=True): protected_parent_list = [ "AS^IS" ] if protected else [] for parent_name in newborn_parent_names: protected_parent_list.append( [ "^", "byname", parent_name ] ) return protected_parent_list def path_to_list(path_or_lis...
krai/axs
core_collection/essentials_collection/entry_creator/code_axs.py
.py
3fee177c9c383c74
7.42
6
#!/usr/bin/env python3 """ This entry knows how to extract files from a given archive. """ import logging import os def detect_archive_format(archive_path): if archive_path.lower().endswith('.tar'): archive_format = 'tar' elif archive_path.lower().endswith( ('.tgz','.tar.gz') ): archive_forma...
krai/axs
core_collection/essentials_collection/extractor/code_axs.py
.py
113ac2a03b2d391c
7.42
6
#!/usr/bin/env python3 """ This entry knows how to install pip packages into generated entries. Usage examples : # install a given pip package: axs byname pip , install numpy # install a specific version of the given pip package: axs byname pip , install numpy 1.16.4 # check ava...
krai/axs
core_collection/essentials_collection/pip/code_axs.py
.py
81eebcc107512818
7.42
6
#!/usr/bin/env python3 """ This entry knows how to run an arbitrary shell command in a given environment and optionally capture the output. """ import logging import os import subprocess import sys def subst_run(template, __entry__=None, **rest): """Substitute data into a given template and run the resultin...
krai/axs
core_collection/essentials_collection/shell/code_axs.py
.py
38fd16f27e9ddb08
7.42
6
#!/usr/bin/env python3 """ This entry knows how to detect and set up shell tools Usage examples : # show the detected tool's name: axs byquery shell_tool,can_download_url , get tool_name # show the detected tool's path: axs byquery shell_tool,can_download_url , get tool_path # sh...
krai/axs
core_collection/essentials_collection/tool_detector/code_axs.py
.py
c40c695cb233715a
7.42
6
"""An example for "remote" axs execution in docker: Make sure docker daemon is running on your host. Build the image (make sure you don't have an outdated axs kernel in docker's build cache!) : axs byquery shell_tool,can_docker , run --cmd_key=build --docker_image=axs_kernel To run a pipeline in that docker imag...
krai/axs
core_collection/remotes_collection/entries_from_docker/code_axs.py
.py
814f1a766b785d88
7.42
6
"""Submit multiple axs queries into SLURM queue and wait on their completion. NB: needs cython Python package installed and pyslurm Python package COMPILED using this cython before running this code. Usage examples : # see this cookbook: axs byname slurm , help ...
krai/axs
core_collection/remotes_collection/slurm/code_axs.py
.py
275b89be82a2d001
7.42
6
#!/usr/bin/env python3 """Example "axs-native" code that can automatically import its documented dependencies before execution. Usage examples: # without any dependency modifications: axs byname numpy_import_test , deps_versions axs byname numpy_import_test , multiply 1 2 3 4 5 6 ...
krai/axs
core_collection/varia_collection/numpy_import_test/code_axs.py
.py
a87f248cb51d7816
7.92
6