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 |
|---|---|---|---|---|---|---|
import typing as t
import time
from viur.core.bones.base import CloneBehavior, CloneStrategy
from viur.core.bones.numeric import NumericBone
class SortIndexBone(NumericBone):
"""
The SortIndexBone class is specifically designed to handle sorting indexes for data elements, which are
numeric values that de... | viur-framework/viur-core | src/viur/core/bones/sortindex.py | .py | c879a98520a13165 | 7.62 | 16 |
import logging
import random
import typing as t
from viur.core import i18n, current
from viur.core.bones import NumericBone
from viur.core.bones.base import getSystemInitialized
class SpamBone(NumericBone):
type = "numeric.spam"
def __init__(
self,
descr: str = i18n.translate(
"co... | viur-framework/viur-core | src/viur/core/bones/spam.py | .py | 9977ec4520692714 | 7.62 | 16 |
"""
TreeLeafBone is a subclass of RelationalBone specifically designed to represent a leaf node in a tree-like data
structure. It provides an additional level of hierarchy and organization for relational data in ViUR applications.
"""
from viur.core.bones.relational import RelationalBone
class TreeLeafBone(Relational... | viur-framework/viur-core | src/viur/core/bones/treeleaf.py | .py | 79fc1ac7c310c5d1 | 7.62 | 16 |
import time
import typing as t
from viur.core import db
from viur.core.bones.base import BaseBone, Compute, ComputeInterval, ComputeMethod, UniqueValue, UniqueLockMethod
def generate_number(db_key: db.Key) -> int:
"""
The generate_number method generates a leading number that is always unique per entry.
... | viur-framework/viur-core | src/viur/core/bones/uid.py | .py | 27be38601dd12aab | 7.62 | 16 |
import typing as t
from viur.core import current
from viur.core.bones.relational import RelationalBone
class UserBone(RelationalBone):
"""
A specialized relational bone for handling user references. Extends the functionality of
:class:`viur.core.bones.relational.RelationalBone` to include support for crea... | viur-framework/viur-core | src/viur/core/bones/user.py | .py | 81f346085fd080b7 | 7.62 | 16 |
import logging
import os
from datetime import timedelta
from functools import wraps
from hashlib import sha512
import typing as t
from viur.core import Method, current, db, tasks, utils
from viur.core.config import conf
"""
This module implements a cache that can be used to serve entire requests or cache the outp... | viur-framework/viur-core | src/viur/core/cache.py | .py | 40c8a09d98dbea71 | 7.62 | 16 |
import datetime
import logging
import sys
import typing as t
from viur.core.config import conf
from .types import Entity, Key
MEMCACHE_MAX_BATCH_SIZE = 30
MEMCACHE_NAMESPACE = "viur-datastore"
MEMCACHE_TIMEOUT: int | datetime.timedelta = datetime.timedelta(days=1)
MEMCACHE_MAX_SIZE: t.Final[int] = 1_000_000
TESTBED =... | viur-framework/viur-core | src/viur/core/db/cache.py | .py | b647e6089d145b93 | 7.62 | 16 |
import warnings
from viur.core.config import conf as core_conf
class DBConfig:
"""DEPRECATED"""
"""This class only exists for compatibility reasons and this file will be removed in the future"""
_map = {
"traceQueries": [core_conf.debug.trace_queries, "conf.debug.trace_queries"],
"memcache... | viur-framework/viur-core | src/viur/core/db/config.py | .py | cad389693db48d70 | 7.62 | 16 |
from google.cloud.datastore.helpers import _get_meaning, _get_value_from_value_pb
from google.cloud.datastore_v1.types import entity as entity_pb2
from .types import Entity, Key
def key_from_protobuf(pb): # !!! 100% Copy, only uses our Key Class
"""Factory method for creating a key based on a protobuf.
The... | viur-framework/viur-core | src/viur/core/db/overrides.py | .py | 836893beaa2aa8bc | 7.62 | 16 |
from __future__ import annotations
import logging
import time
import typing as t
from deprecated.sphinx import deprecated
from google.cloud import datastore, exceptions
from .overrides import entity_from_protobuf, key_from_protobuf
from .types import Entity, Key, QueryDefinition, SortOrder, current_db_access_log
fro... | viur-framework/viur-core | src/viur/core/db/transport.py | .py | 66e65de53931348c | 7.62 | 16 |
"""
The constants, global variables and container classes used in the datastore api
"""
from __future__ import annotations
import datetime
import enum
import itertools
import typing as t
from contextvars import ContextVar
from dataclasses import dataclass, field
from ..config import conf
from google.cloud.datastore i... | viur-framework/viur-core | src/viur/core/db/types.py | .py | 1f6efd26291db6ab | 7.62 | 16 |
import datetime
import fnmatch
import sys
import typing as t
from deprecated.sphinx import deprecated
from google.cloud.datastore.transaction import Transaction
from viur.core import current
from viur.core.config import conf
from .transport import __client__, get, put, run_in_transaction
from .types import Entity, Ke... | viur-framework/viur-core | src/viur/core/db/utils.py | .py | 1ad0262f7af1fa54 | 7.62 | 16 |
import typing as t
import logging
from viur.core import current, errors
from viur.core.config import conf
from viur.core.module import Method
__all__ = [
"access",
"exposed",
"force_post",
"force_ssl",
"internal_exposed",
"skey",
"cors",
]
def exposed(func: t.Callable) -> Method:
"""
... | viur-framework/viur-core | src/viur/core/decorators.py | .py | 8cf592064fe2e444 | 7.62 | 16 |
r'''
The data-driven architecture is based on unidirectional message flows between agents.
Here we assume that messages are exchanged through an intermediary, not directly.
Here, an intermediary called Queue Broker implements the producer / consumer pattern.
The broker performs the functions of guaranteed and consiste... | scailer/microagent | microagent/broker.py | .py | c45039e19aff0764 | 7.45 | 7 |
'''
In practice, it is useful to be able to perform some actions before the microagent
starts working or after it stops. For this aim there are internal hooks that allow
you to run methods on pre_start, post_start, and pre_stop.
**pre_start** - is called before the microagent is ready to accept events and
consume mess... | scailer/microagent | microagent/hooks.py | .py | ec7f62a12e33a663 | 7.45 | 7 |
'''
Configuration and launch MicroAgents with shipped launcher.
Configuration file is a python-file with 3 dictionaries:
AGENT, BUS and BROKER, where specified all settings.
Launcher can run microagents from one or several files.
.. code-block:: shell
$ marun myproject.app1 myproject.app2
Each microagent is la... | scailer/microagent | microagent/launcher.py | .py | eff96e68a96548f3 | 7.45 | 7 |
import json
from dataclasses import dataclass, field
from types import ModuleType
from typing import TYPE_CHECKING, ClassVar, TypedDict
from .abc import BoundKey, ConsumerFunc
if TYPE_CHECKING:
from .agent import MicroAgent
class QueueException(Exception):
''' Base queue exception '''
class QueueNotFoun... | scailer/microagent | microagent/queue.py | .py | e0b3f63e3409054d | 7.45 | 7 |
import json
from dataclasses import dataclass
from types import ModuleType
from typing import TYPE_CHECKING, ClassVar, TypedDict
from .abc import BoundKey, ReceiverFunc
if TYPE_CHECKING:
from .agent import MicroAgent
class SignalException(Exception):
''' Base signal exception '''
class SignalNotFound(Si... | scailer/microagent | microagent/signal.py | .py | 9abb309f3b1e0070 | 7.45 | 7 |
'''
:ref:`Queue Broker <broker>` based on :aiormq:`aiormq <>`.
'''
import asyncio
import logging
import time
from collections.abc import Awaitable, Callable
from dataclasses import dataclass, field
from typing import Any
from aiormq import Connection
from aiormq.abc import AbstractChannel, AbstractConnection, Basic, ... | scailer/microagent | microagent/tools/amqp.py | .py | 99f145babe0f8ebe | 7.45 | 7 |
'''
:ref:`Queue Broker <broker>` based on :kafka:`kafka <>`.
'''
import asyncio
import time
from dataclasses import dataclass, field
from typing import Any
from urllib import parse
import aiokafka
from ..broker import AbstractQueueBroker, Consumer
@dataclass
class KafkaBroker(AbstractQueueBroker):
'''
... | scailer/microagent | microagent/tools/kafka.py | .py | 81c8b056fb3ff2ae | 7.45 | 7 |
import asyncio
from collections.abc import Callable
class IterQueue(asyncio.Queue):
''' Queue as async generator '''
def __aiter__(self) -> 'IterQueue':
return self
async def __anext__(self) -> dict[str, int | str | None]:
try:
value = await self.get()
self.task_... | scailer/microagent | microagent/utils.py | .py | 8766a2956cf04295 | 7.45 | 7 |
"""Lyric."""
import logging
from aiohttp import ClientResponse
from .client import LyricClient
from .const import BASE_URL
from .objects.device import LyricDevice
from .objects.location import LyricLocation
from .objects.priority import LyricPriority, LyricRoom
class Lyric:
"""Handles authentication refresh to... | timmo001/aiolyric | aiolyric/__init__.py | .py | 558ca2fcab4584fd | 7.54 | 11 |
"""Lyric client."""
from abc import abstractmethod
import asyncio
import logging
from aiohttp import ClientResponse, ClientSession
from .exceptions import LyricAuthenticationException, LyricException
class LyricClient:
"""Client to handle API calls."""
logger = logging.getLogger(__name__)
def __init_... | timmo001/aiolyric | aiolyric/client.py | .py | 6ca34fe902a3b068 | 7.54 | 11 |
"""Fixtures for testing."""
from collections.abc import AsyncGenerator
from unittest.mock import Mock
from aiohttp import ClientResponse, ClientSession
from aioresponses import aioresponses, core as aioresponses_core
import pytest
from aiolyric.client import LyricClient
from aiolyric.const import AUTH_URL, BASE_URL,... | timmo001/aiolyric | tests/conftest.py | .py | 5be6e295f2bd4049 | 7.04 | 11 |
"""Test __version__ module."""
from pathlib import Path
import re
def get_version() -> str:
"""Get version from setup.py."""
project_root = Path(__file__).resolve().parents[1]
setup_path = project_root / "setup.py"
setup_contents = setup_path.read_text(encoding="utf-8")
match = re.search(r'versio... | timmo001/aiolyric | tests/test__version.py | .py | 324ce2c43dd0d2c0 | 8.04 | 11 |
"""
Commandline interface.
"""
import os
import sys
from pyuploadtool import (
ReleaseMetadata,
ReleasesHostingProviderFactory,
update_metadata_with_user_specified_data,
BuildSystemFactory,
)
from pyuploadtool.logging import make_logger, setup_logging
setup_logging()
logger = make_logger("cli")
# ... | TheAssassin/pyuploadtool | pyuploadtool/__main__.py | .py | e3f7af7757502d98 | 7.66 | 20 |
from .commit import ChangelogEntry
class Changelog:
def __init__(self):
self._data = dict()
for spec in self.structure():
self._data[spec] = list()
def __repr__(self):
print(f"{self.__name__}({self._data})")
def __iter__(self):
return iter(self._data)
def... | TheAssassin/pyuploadtool | pyuploadtool/changelog/changelog.py | .py | 5aa2c96ddea1a1bf | 7.66 | 20 |
import re
from .changelog import Changelog
from .commit import ChangelogEntry
class ConventionalCommitChangelog(Changelog):
@staticmethod
def structure() -> dict:
"""
Returns a structure of the Conventional Commit Spec
according to https://cheatography.com/albelop/cheat-sheets/convent... | TheAssassin/pyuploadtool | pyuploadtool/changelog/changelog_spec.py | .py | 6706e3134274f299 | 8.16 | 20 |
from typing import NamedTuple
from github.Commit import Commit
from .author import Author
class ChangelogEntry:
def __init__(self, author: Author, message: str, sha: str):
self.author = author
self.message = message
self.sha = sha
@classmethod
def from_github_commit(cls, commit:... | TheAssassin/pyuploadtool | pyuploadtool/changelog/commit.py | .py | 4a41739317f5b5b0 | 7.66 | 20 |
from typing import Type
from .. import ChangelogType, Changelog, ConventionalCommitChangelog
SUPPORTED_CHANGELOG_TYPES = {ChangelogType.STANDARD: Changelog, ChangelogType.CONVENTIONAL: ConventionalCommitChangelog}
class ChangelogTypeNotImplemented(NotImplementedError):
pass
class ChangelogFactory:
def __i... | TheAssassin/pyuploadtool | pyuploadtool/changelog/factory/base.py | .py | 513443b861c62563 | 7.66 | 20 |
import github
from typing import Optional
from github import Github
from github.GitRelease import GitRelease
from .. import Changelog
from .base import ChangelogFactory
from ..commit import ChangelogEntry
from ...metadata import ReleaseMetadata
from ...logging import make_logger
class GitHubChangelogFactory(Changel... | TheAssassin/pyuploadtool | pyuploadtool/changelog/factory/github.py | .py | 3286117c3a430595 | 7.66 | 20 |
from .parser import ChangelogParser
class MarkdownChangelogParser(ChangelogParser):
def render_to_markdown(self) -> str:
"""
Parses the changelog to Markdown format
:return: a string containing parsed markdown information
"""
markdown_changelog = list()
# add the ti... | TheAssassin/pyuploadtool | pyuploadtool/changelog/parsers/markdown.py | .py | 3d011055759bbf1a | 7.66 | 20 |
from .. import Changelog
class ChangelogParser:
def __init__(
self,
changelog: Changelog,
title: str = None,
commit_link_prefix: str = None,
):
"""
Generates a changelog by arranging the commits according
to the Conventional Commit Spec
:param t... | TheAssassin/pyuploadtool | pyuploadtool/changelog/parsers/parser.py | .py | a91188bbc367ed97 | 7.66 | 20 |
import json
import re
from operator import itemgetter
from urllib.parse import parse_qs, urlencode, urlparse
import arrow
import scrapy
# The registry publishes an official open-data dataset with all of the party
# details we need. It doesn't say whether a record is a party or a movement,
# nor whether it's still ac... | honzajavorek/czech-political-parties | czech_political_parties/spiders.py | .py | 832eb2e3e44e72ec | 7.42 | 6 |
"""Implementation of the core protocol.
The
`core tus protocol <https://tus.io/protocols/resumable-upload.html#core-protocol>`_
defines how the data upload is handled.
"""
from __future__ import annotations
import asyncio
import base64
import dataclasses
import io
from typing import TYPE_CHECKING
from . import comm... | JenSte/aiotus | aiotus/core.py | .py | 1df47889d5035d10 | 7.63 | 17 |
"""Implementation of the creation extension.
The
`creation extension <https://tus.io/protocols/resumable-upload.html#creation>`_
defines how to reserve space on the server for uploading data to.
"""
from __future__ import annotations
import asyncio
import base64
import io
from typing import TYPE_CHECKING
import yar... | JenSte/aiotus | aiotus/creation.py | .py | b1eec5eebdc5ac1e | 7.63 | 17 |
"""Defines the commands for executing the module directly."""
from __future__ import annotations
import argparse
import asyncio
import logging
import mimetypes
import pathlib
import sys
from typing import TYPE_CHECKING
from . import retry
if TYPE_CHECKING: # pragma: no cover
from collections.abc import Callabl... | JenSte/aiotus | aiotus/entrypoint.py | .py | 2cc7cd7d2d9f093f | 7.63 | 17 |
from __future__ import annotations
import asyncio
import contextlib
import dataclasses
import io
import logging
import math
from typing import TYPE_CHECKING
import aiohttp
import anyio
import pytest
import pytest_asyncio
import yarl
if TYPE_CHECKING: # pragma: no cover
from collections.abc import AsyncGenerator... | JenSte/aiotus | tests/conftest.py | .py | ceb9328c17141d57 | 8.13 | 17 |
"""Test the implementation of the core protocol."""
from __future__ import annotations
import binascii
from typing import TYPE_CHECKING
import aiohttp
import pytest
import aiotus
if TYPE_CHECKING: # pragma: no cover
import io
import pytest_aiohttp
from . import conftest
class TestOffset:
async... | JenSte/aiotus | tests/test_core.py | .py | 85aee25db145557f | 7.13 | 17 |
"""Test the 'upload()' function."""
from __future__ import annotations
import io
import logging
from typing import TYPE_CHECKING
import aiohttp
import pytest
import tenacity
import yarl
import aiotus
if TYPE_CHECKING: # pragma: no cover
from . import conftest
class TestRetry:
async def test_upload_funct... | JenSte/aiotus | tests/test_retry.py | .py | 33657f4381989b7a | 7.13 | 17 |
"""Test uploading to a server behind a TLS proxy."""
from __future__ import annotations
import shutil
import ssl
from typing import TYPE_CHECKING
import aiohttp
import pytest
import aiotus
if TYPE_CHECKING: # pragma: no cover
import io
from . import conftest
@pytest.mark.skipif(shutil.which("nginx") is... | JenSte/aiotus | tests/test_tls.py | .py | 7d794a6190fed0ed | 8.13 | 17 |
"""Aggregation module."""
from __future__ import annotations
import logging
import xarray as xr
from xclim.indices import tas
from miranda.units import check_time_frequency
logger = logging.getLogger("miranda.convert.aggregation")
__all__ = ["aggregate", "aggregations_possible"]
# There needs to be a better way ... | Ouranosinc/miranda | src/miranda/convert/_aggregation.py | .py | fad56f769de280f8 | 7.65 | 19 |
"""DEH Hydrograph Conversion module."""
from __future__ import annotations
import json
import logging
import os
import re
from pathlib import Path
import pandas as pd
import xarray as xr
from xclim.core.units import units as u
logger = logging.getLogger("miranda.convert.deh")
__all__ = ["open_txt"]
# CMOR-like at... | Ouranosinc/miranda | src/miranda/convert/deh.py | .py | 0151bbd1f72df60a | 7.65 | 19 |
"""Environment and Climate Change Canada Data Conversion module."""
from __future__ import annotations
from pathlib import Path
import numpy as np
import pandas as pd
import xarray as xr
from ._data_corrections import dataset_corrections
__all__ = ["convert_canswe"]
def convert_canswe(file: str | Path, output: s... | Ouranosinc/miranda | src/miranda/convert/eccc_canswe.py | .py | 7678ccc46bab43e0 | 7.65 | 19 |
"""Environment and Climate Change Canada RDRS conversion tools."""
from __future__ import annotations
import logging
import os
import pathlib
from pathlib import Path
from typing import Any
import h5py
import xarray as xr
from numpy import unique
from miranda.io import fetch_chunk_config, write_dataset_dict
from mir... | Ouranosinc/miranda | src/miranda/convert/eccc_rdrs.py | .py | 2d6723815ab52557 | 7.65 | 19 |
"""Hydro Quebec Weather Station Data Conversion module."""
from __future__ import annotations
import csv
import datetime as dt
import json
import logging
import os
import re
from pathlib import Path
from typing import Any
import numpy as np
import pandas as pd
import xarray as xr
from xclim.core.units import units as... | Ouranosinc/miranda | src/miranda/convert/hq.py | .py | a61501bf2cae4fa2 | 7.65 | 19 |
"""Conversion Utilities submodule."""
from __future__ import annotations
import hashlib
import logging
import os
import re
import shutil
from pathlib import Path
from typing import Any
import cftime
import pandas as pd
import xarray as xr
from dask.diagnostics import ProgressBar
from pandas._libs import NaTType # no... | Ouranosinc/miranda | src/miranda/convert/utils.py | .py | 5f8411797792567e | 7.65 | 19 |
"""Adjusted and Homogenized Canadian Clime Data module."""
from __future__ import annotations
import calendar
import logging
import os
import shutil
from pathlib import Path
import numpy as np
import pandas as pd
import requests
import xarray as xr
from dask.diagnostics import ProgressBar
from miranda.convert.utils ... | Ouranosinc/miranda | src/miranda/eccc/_homogenized.py | .py | e43ea1bd4b7d5ae4 | 7.65 | 19 |
from __future__ import annotations
import logging
import numpy as np
import xarray as xr
logger = logging.getLogger("miranda.gis")
__all__ = [
"add_ar6_regions",
"subset_domain",
"subsetting_domains",
]
_gis_import_error_message = (
"`{}` requires installation of the miranda GIS libraries. These ca... | Ouranosinc/miranda | src/miranda/gis/_domains.py | .py | 992fdad28173d988 | 7.65 | 19 |
"""IO Utilities module."""
from __future__ import annotations
import importlib.util as ilu
import json
import logging
import os
from collections.abc import Sequence
from pathlib import Path
from typing import Any, cast
import dask.delayed
import h5netcdf
import xarray as xr
HAS_NETCDF4 = bool(ilu.find_spec("netCDF4... | Ouranosinc/miranda | src/miranda/io/utils.py | .py | 8ede4b19905da991 | 7.65 | 19 |
"""Adjusted and Homogenized Canadian Clime Data module."""
from __future__ import annotations
import calendar
import logging
from pathlib import Path
import numpy as np
import pandas as pd
import xarray as xr
from miranda.io import write_dataset
from miranda.io.utils import name_output_file
from miranda.preprocess._... | Ouranosinc/miranda | src/miranda/preprocess/_eccc_ahccd.py | .py | 950b1e42913c4de9 | 7.65 | 19 |
from __future__ import annotations
import logging
from typing import Any
from miranda import __version__ as __miranda_version__
from miranda.treatments.utils import load_json_data_mappings
__all__ = [
"eccc_variable_metadata",
"homogenized_column_definitions",
"obs_column_definitions",
]
def eccc_varia... | Ouranosinc/miranda | src/miranda/preprocess/_metadata.py | .py | 67114cba2f324146 | 7.65 | 19 |
"""ECMWF TIGGE Conversion module."""
from __future__ import annotations
import itertools as it
import logging
import multiprocessing
import os
import shutil
import tempfile
from pathlib import Path
import xarray
from dask.diagnostics import ProgressBar
__all__ = ["tigge_convert"]
# FIXME: Is this function still p... | Ouranosinc/miranda | src/miranda/preprocess/ecmwf_tigge.py | .py | a2dae993cfcb0220 | 7.65 | 19 |
"""
Disk space management.
Classes:
* DiskSpaceError - the exception raised on failure.
* :py:class:`FileMeta` - file and its size.
* :py:class:`StorageState` - storage capacity and availability of a medium.
Functions:
* :py:func:`total_size` - get total size of a list of files.
* :py:func:`size_division` - divi... | Ouranosinc/miranda | src/miranda/storage.py | .py | 538d94a6a62c8a43 | 7.65 | 19 |
import yaml
import asyncio
import concurrent
# import time
import logging
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
from PIL import ImageTransform
# from io import BytesIO
import os
import purerackdiagram
logger = logging.getLogger()
cache = {}
cache_lock = asyncio.Lock()
root_path = o... | sile16/purerackdiagram | purerackdiagram/utils.py | .py | 5cb93e3506e1942c | 7.42 | 6 |
#!/usr/bin/env python
"""
A minimal script to check, whether an ISSN is valid.
$ python validateissn.py 1234-5678
1234-5678 False
$ python validateissn.py 12345679
1234-5679 True
Also calculate check digit:
$ python validateissn.py 4444222
4444222 4444-222X
$ python validat... | miku/issnlister | validateissn.py | .py | f30071a68ad32f62 | 7.57 | 13 |
#!/usr/bin/env python
# -*- coding: utf-8 -*
"""
decomp module
"""
__author__ = "Janus Juul Eriksen, Technical University of Denmark, DK"
__maintainer__ = "Janus Juul Eriksen"
__email__ = "janus@kemi.dtu.dk"
__status__ = "Development"
import numpy as np
from pyscf import gto, scf, dft
from pyscf.pbc import gto as pb... | eriksen-lab/decodense | decodense/decomp.py | .py | fbfb59a3b02eb266 | 7.57 | 13 |
#!/usr/bin/env python
# -*- coding: utf-8 -*
"""
orbitals module
"""
__author__ = "Janus Juul Eriksen, Technical University of Denmark, DK"
__maintainer__ = "Janus Juul Eriksen"
__email__ = "janus@kemi.dtu.dk"
__status__ = "Development"
import numpy as np
from pyscf import gto, scf, dft, lo
from pyscf.pbc import dft... | eriksen-lab/decodense | decodense/orbitals.py | .py | eac7296bcbdef3a5 | 7.57 | 13 |
#!/usr/bin/env python
# -*- coding: utf-8 -*
"""
tools module
"""
__author__ = "Janus Juul Eriksen, Technical University of Denmark, DK"
__maintainer__ = "Janus Juul Eriksen"
__email__ = "janus@kemi.dtu.dk"
__status__ = "Development"
import sys
import logging
import os
import numpy as np
from subprocess import Popen... | eriksen-lab/decodense | decodense/tools.py | .py | f2d7076652421576 | 7.57 | 13 |
#!/usr/bin/env python
# -*- coding: utf-8 -*
import unittest
import numpy as np
from pyscf import gto, scf
import decodense
# decimal tolerance
TOL = 9
# settings
PART = ("orbitals", "eda", "atoms")
OCC_IDX, VIRT_IDX = 18, 22
def format_mf(mf):
mo_coeff = np.asarray((mf.mo_coeff,) * 2)
mo_occ = np.asarra... | eriksen-lab/decodense | tests/test_c5h5n_hf_ndo.py | .py | 6c286cd48052ee81 | 7.07 | 13 |
#!/usr/bin/env python
# -*- coding: utf-8 -*
import unittest
import numpy as np
from pyscf import gto, scf
import decodense
# decimal tolerance
TOL = 9
# settings
PART = ("orbitals", "eda", "atoms")
OCC_IDX, VIRT_IDX = 4, 5
def format_mf(mf):
mo_coeff = np.asarray((mf.mo_coeff,) * 2)
mo_occ = np.asarray(... | eriksen-lab/decodense | tests/test_ch2_hf_ndo.py | .py | 58b7a25bd4cd481d | 7.07 | 13 |
#!/usr/bin/env python
# -*- coding: utf-8 -*
import unittest
import numpy as np
from pyscf import gto, scf
import decodense
# decimal tolerance
TOL = 9
# settings
POP_METHOD = ("mulliken", "lowdin", "meta_lowdin", "becke", "iao")
PART = ("orbitals", "eda", "atoms")
# init molecule
mol = gto.M(
verbose=0,
o... | eriksen-lab/decodense | tests/test_ch2_pbe0_energy_gs.py | .py | 6e0db03bf10d38a6 | 7.07 | 13 |
#!/usr/bin/env python
# -*- coding: utf-8 -*
import unittest
import numpy as np
from pyscf import gto, scf, dft
import decodense
# decimal tolerance
TOL = 9
# settings
POP_METHOD = ("mulliken", "lowdin", "meta_lowdin", "becke", "iao")
PART = ("orbitals", "eda", "atoms")
# 1a2 state
OCC_IDX, VIRT_IDX = 7, 8
def f... | eriksen-lab/decodense | tests/test_ch2o_camb3lyp_energy_ex.py | .py | 320d064961f72707 | 7.07 | 13 |
#!/usr/bin/env python
# -*- coding: utf-8 -*
import unittest
import numpy as np
from pyscf import gto, scf, dft
import decodense
# decimal tolerance
TOL = 9
# settings
POP_METHOD = ("mulliken", "lowdin", "meta_lowdin", "becke", "iao")
PART = ("orbitals", "eda", "atoms")
# init molecule
mol = gto.M(verbose=0, outpu... | eriksen-lab/decodense | tests/test_h2o_b3lyp_dipmom_gs.py | .py | 2142298a68899a1b | 7.07 | 13 |
#!/usr/bin/env python
# -*- coding: utf-8 -*
import unittest
import numpy as np
from pyscf import scf as mol_scf
from pyscf.pbc import df, dft, gto
from pyscf.pbc.tools.k2gamma import k2gamma, to_supercell_ao_integrals
import decodense
# decimal tolerance
TOL = 5
# settings
PART = ("eda", "atoms")
# init cell
cell... | eriksen-lab/decodense | tests/test_h2o_pbc_pbe_energy_gs.py | .py | 6b0e4a876b38b598 | 7.07 | 13 |
#!/usr/bin/env python
# -*- coding: utf-8 -*
import unittest
import numpy as np
from pyscf import gto, dft
import decodense
# decimal tolerance
TOL = 9
# settings
POP_METHOD = ("mulliken", "lowdin", "meta_lowdin", "becke", "iao")
PART = ("orbitals", "eda", "atoms")
# init molecule
mol = gto.M(verbose=0, output=Non... | eriksen-lab/decodense | tests/test_h2o_wb97m_v_energy_gs.py | .py | 5d84731c6aa03a4f | 7.07 | 13 |
"""A script to generate Notebooks for documentation."""
import argparse
import fnmatch
import os
import typing as t
from pathlib import Path
import requests
from jupytext import cli as jupytext_cli
BASE_EXAMPLE_URL = "https://docs.zhinst.com/zhinst-qcodes/en/latest/examples"
EXAMPLES_DIR = Path(__file__).parent.pare... | zhinst/zhinst-qcodes | scripts/generate_notebooks.py | .py | 3df6db1abbff7386 | 7.54 | 11 |
"""Base modules for the Zurich Instrument specific QCoDeS driver."""
import typing as t
from zhinst.qcodes.qcodes_adaptions import ZIInstrument, init_nodetree
from zhinst.toolkit.driver.devices import DeviceType
if t.TYPE_CHECKING:
from qcodes.instrument import Instrument
from zhinst.qcodes.session import Se... | zhinst/zhinst-qcodes | src/zhinst/qcodes/driver/devices/base.py | .py | 4bc6c0a38b154094 | 7.54 | 11 |
"""Autogenerated module for the HDAWG QCoDeS driver."""
import typing as t
from typing import Optional, Union
from zhinst.qcodes.driver.devices.base import ZIBaseInstrument
from zhinst.qcodes.qcodes_adaptions import ZIChannelList, ZINode
from zhinst.toolkit import CommandTable, Sequence, Waveforms
from zhinst.toolkit... | zhinst/zhinst-qcodes | src/zhinst/qcodes/driver/devices/hdawg.py | .py | 0a3daacee79a14fc | 7.54 | 11 |
"""Autogenerated module for the PQSC QCoDeS driver."""
from typing import Optional, Union
from zhinst.qcodes.driver.devices.base import ZIBaseInstrument
from zhinst.toolkit.driver.devices.base import BaseInstrument as TKBaseInstrument
from zhinst.toolkit.driver.devices.pqsc import PQSC as TKPQSC
class PQSC(ZIBaseIn... | zhinst/zhinst-qcodes | src/zhinst/qcodes/driver/devices/pqsc.py | .py | 3190c13229454717 | 7.54 | 11 |
"""Autogenerated module for the SHFSG QCoDeS driver."""
import typing as t
from typing import Optional, Union
from zhinst.qcodes.driver.devices.base import ZIBaseInstrument
from zhinst.qcodes.qcodes_adaptions import ZIChannelList, ZINode
from zhinst.toolkit import CommandTable, Sequence, Waveforms
from zhinst.toolkit... | zhinst/zhinst-qcodes | src/zhinst/qcodes/driver/devices/shfsg.py | .py | 6c176a5b91e5b784 | 7.54 | 11 |
"""Autogenerated module for the UHFLI QCoDeS driver."""
import typing as t
from typing import Optional, Union
from zhinst.qcodes.driver.devices.base import ZIBaseInstrument
from zhinst.qcodes.qcodes_adaptions import ZIChannelList, ZINode
from zhinst.toolkit import CommandTable, Sequence, Waveforms
from zhinst.toolkit... | zhinst/zhinst-qcodes | src/zhinst/qcodes/driver/devices/uhfli.py | .py | e8eb218cb92d8fce | 7.54 | 11 |
"""Autogenerated module for the BaseModule QCoDeS driver."""
import typing as t
from zhinst.qcodes.qcodes_adaptions import (
NodeDict,
ZIInstrument,
ZIParameter,
init_nodetree,
tk_node_to_parameter,
)
from zhinst.toolkit.driver.modules import ModuleType as TKModuleType
from zhinst.toolkit.driver.m... | zhinst/zhinst-qcodes | src/zhinst/qcodes/driver/modules/base_module.py | .py | 7938a017a5eb9bce | 7.54 | 11 |
"""Autogenerated module for the DAQModule QCoDeS driver."""
import typing as t
from zhinst.qcodes.driver.modules.base_module import ZIBaseModule
from zhinst.qcodes.qcodes_adaptions import (
NodeDict,
)
from zhinst.toolkit.driver.modules.daq_module import DAQModule as TKDAQModule
if t.TYPE_CHECKING:
from zhin... | zhinst/zhinst-qcodes | src/zhinst/qcodes/driver/modules/daq_module.py | .py | c9b793f7def2e188 | 7.54 | 11 |
"""Autogenerated module for the DataStreamingModule QCoDeS driver."""
import typing as t
from zhinst.qcodes.driver.modules.base_module import ZIBaseModule
from zhinst.toolkit.driver.modules.data_streaming_module import (
DataStreamingModule as TKDataStreamingModule,
)
if t.TYPE_CHECKING:
from zhinst.qcodes.s... | zhinst/zhinst-qcodes | src/zhinst/qcodes/driver/modules/data_streaming_module.py | .py | 3c2f945f93e7acd4 | 7.54 | 11 |
"""Autogenerated module for the DeviceSettingsModule QCoDeS driver."""
import typing as t
from pathlib import Path
from zhinst.qcodes.driver.modules.base_module import ZIBaseModule
from zhinst.qcodes.qcodes_adaptions import (
NodeDict,
)
from zhinst.toolkit.driver.modules.device_settings_module import (
Devic... | zhinst/zhinst-qcodes | src/zhinst/qcodes/driver/modules/device_settings_module.py | .py | 7f63198428b650fd | 7.54 | 11 |
"""Autogenerated module for the ImpedanceModule QCoDeS driver."""
import typing as t
from typing import Optional
from zhinst.qcodes.driver.modules.base_module import ZIBaseModule
from zhinst.toolkit.driver.modules.impedance_module import (
ImpedanceModule as TKImpedanceModule,
)
if t.TYPE_CHECKING:
from zhin... | zhinst/zhinst-qcodes | src/zhinst/qcodes/driver/modules/impedance_module.py | .py | 5add1b11484bda7a | 7.54 | 11 |
"""Autogenerated module for the PIDAdvisorModule QCoDeS driver."""
import typing as t
from zhinst.qcodes.driver.modules.base_module import ZIBaseModule
from zhinst.toolkit.driver.modules.pid_advisor_module import (
PIDAdvisorModule as TKPIDAdvisorModule,
)
if t.TYPE_CHECKING:
from zhinst.qcodes.session impor... | zhinst/zhinst-qcodes | src/zhinst/qcodes/driver/modules/pid_advisor_module.py | .py | 176295edc1361425 | 7.54 | 11 |
"""Autogenerated module for the PrecompensationAdvisorModule QCoDeS driver."""
import typing as t
from zhinst.qcodes.driver.modules.base_module import ZIBaseModule
from zhinst.toolkit.driver.modules.precompensation_advisor_module import (
PrecompensationAdvisorModule as TKPrecompensationAdvisorModule,
)
if t.TYP... | zhinst/zhinst-qcodes | src/zhinst/qcodes/driver/modules/precompensation_advisor_module.py | .py | bff9a88e700c02c3 | 7.54 | 11 |
"""Autogenerated module for the ScopeModule QCoDeS driver."""
import typing as t
from zhinst.qcodes.driver.modules.base_module import ZIBaseModule
from zhinst.toolkit.driver.modules.scope_module import ScopeModule as TKScopeModule
if t.TYPE_CHECKING:
from zhinst.qcodes.session import Session
class ZIScopeModul... | zhinst/zhinst-qcodes | src/zhinst/qcodes/driver/modules/scope_module.py | .py | 59e88cd1b256064d | 7.54 | 11 |
"""Toolkit adaption for the zhinst.utils.SHFSweeper."""
import typing as t
from zhinst.qcodes.qcodes_adaptions import ZIInstrument, init_nodetree
from zhinst.toolkit.driver.modules.shfqa_sweeper import SHFQASweeper as TKSHFQASweeper
if t.TYPE_CHECKING:
from zhinst.qcodes.driver.devices import DeviceType
from... | zhinst/zhinst-qcodes | src/zhinst/qcodes/driver/modules/shfqa_sweeper.py | .py | 329e02582742e2f0 | 7.54 | 11 |
"""Autogenerated module for the SweeperModule QCoDeS driver."""
import typing as t
from zhinst.qcodes.driver.modules.base_module import ZIBaseModule
from zhinst.toolkit.driver.modules.sweeper_module import (
SweeperModule as TKSweeperModule,
)
if t.TYPE_CHECKING:
from zhinst.qcodes.session import Session
c... | zhinst/zhinst-qcodes | src/zhinst/qcodes/driver/modules/sweeper_module.py | .py | 142a4c99154a11de | 7.54 | 11 |
"""Autogenerated module for the TimelineModule QCoDeS driver."""
import typing as t
from zhinst.qcodes.driver.modules.base_module import ZIBaseModule
from zhinst.toolkit.driver.modules.timeline_module import (
TimelineModule as TKTimelineModule,
)
if t.TYPE_CHECKING:
from zhinst.qcodes.session import Session... | zhinst/zhinst-qcodes | src/zhinst/qcodes/driver/modules/timeline_module.py | .py | 584a56c5010f8a20 | 7.54 | 11 |
import yaml
import os
from glob import glob
from pathlib import Path
EXAMPLES_DIRECTORY = "examples/"
def test_config_existence():
assert os.path.exists(EXAMPLES_DIRECTORY + "test.spec.yml")
def test_example_config():
with open(EXAMPLES_DIRECTORY + "test.spec.yml", "rb") as f:
test_spec = yaml.load... | zhinst/zhinst-qcodes | tests/test_example_config.py | .py | ff2c57a066d0660b | 7.04 | 11 |
#!/usr/bin/env python3
"""
Cross‑platform Jenkins agent cleanup script.
Safe for Windows, macOS, and Linux.
Deletes only disposable directories:
- workspace/*
- remoting/jars/*
- *.tmp files in agent root
Does NOT delete config.xml, secrets/, or identity files.
"""
import os
import shutil
from pathlib import Pat... | clockworksspheres/ramdisk | src/BuildScripts/clean_jenkins_agent.py | .py | ae368bbf512ae840 | 7.45 | 7 |
#!/usr/bin/env -S python -u
"""
"""
#--- Native python libraries
import os
import sys
from optparse import OptionParser
from datetime import datetime
#from PySide6.QtWidgets import QApplication
from PySide6.QtWidgets import QApplication, QMainWindow, QPushButton
from PySide6.QtGui import QPalette, QColor
from PySide6... | clockworksspheres/ramdisk | src/ramdisk-setup.py | .py | f8735ee03381c5ba | 7.45 | 7 |
#!/usr/bin/env -S python -u
"""
"""
import subprocess
import re
import sys
import psutil
from pathlib import Path
# Get the parent directory of the current file's parent directory
# and add it to sys.path
parent_dir = Path(__file__).parent.parent.parent
sys.path.append(str(parent_dir))
#--- non-native python librari... | clockworksspheres/ramdisk | src/ramdisk/lib/dev/getMacosMemStatus.py | .py | 38df299ed1bb9c06 | 7.45 | 7 |
import sys
from pathlib import Path
# Get the parent directory of the current file's parent directory
# and add it to sys.path
parent_dir = Path(__file__).parent.parent.parent
sys.path.append(str(parent_dir))
parent_dir = Path(__file__).parent
sys.path.append(str(parent_dir))
#--- non-native python libraries in th... | clockworksspheres/ramdisk | src/ramdisk/lib/dev/getMemStatus.py | .py | 25140b4cf2460733 | 7.45 | 7 |
#!/usr/bin/env -S python -u
"""
"""
import sys
import ctypes
from pathlib import Path
# Get the parent directory of the current file's parent directory
# and add it to sys.path
parent_dir = Path(__file__).parent.parent.parent
sys.path.append(str(parent_dir))
#--- non-native python libraries in this source tree
from ... | clockworksspheres/ramdisk | src/ramdisk/lib/dev/getWin32MemStatus.py | .py | d05cc3090e786f7d | 7.45 | 7 |
#!/usr/bin/python3
import os
import re
import sys
from pathlib import Path
from ramdisk.lib.loggers import CyLogger
from ramdisk.lib.loggers import LogPriority as lp
class FsHelperTemplate(object):
"""
"""
def __init__(self, logger, **kwargs):
"""
"""
if not logger and isinstance(... | clockworksspheres/ramdisk | src/ramdisk/lib/fsHelper/FsHelperTemplate.py | .py | f5249816ebf56e2f | 7.45 | 7 |
#!/usr/bin/python3
import subprocess
import re
import traceback
from subprocess import Popen
from subprocess import SubprocessError as SubprocessError
import os
import sys
from pathlib import Path
#--- non-native python libraries in this source tree
from ramdisk.lib.loggers import CyLogger
from ramdisk.lib.loggers i... | clockworksspheres/ramdisk | src/ramdisk/lib/fsHelper/linuxFsHelper.py | .py | 54430b8e0c978626 | 7.45 | 7 |
#!/usr/bin/python3
import subprocess
import re
import traceback
# from subprocess import Popen
import os
import sys
import getpass
from pathlib import Path
# Get the parent directory of the current file's parent directory
# and add it to sys.path
parent_dir = Path(__file__).parent.parent.parent
sys.path.append(str(p... | clockworksspheres/ramdisk | src/ramdisk/lib/fsHelper/macosFsHelper.py | .py | 0ffa95b5fe4b3525 | 7.45 | 7 |
#!/usr/bin/python3
import subprocess
import re
import traceback
from subprocess import Popen
import os
import sys
from pathlib import Path
# Get the parent directory of the current file's parent directory
# and add it to sys.path
parent_dir = Path(__file__).parent.parent.parent
sys.path.append(str(parent_dir))
####... | clockworksspheres/ramdisk | src/ramdisk/lib/fsHelper/ntfsFsHelper.py | .py | da3c492ade9cb784 | 7.45 | 7 |
#!/usr/bin/python3
import subprocess
import re
import traceback
from subprocess import Popen
import os
import sys
appendDir = "/".join(os.path.abspath(os.path.dirname(__file__)).split('/')[:-3])
sys.path.append(appendDir)
####
# import ramdisk libraries
#--- non-native python libraries in this source tree
# import ram... | clockworksspheres/ramdisk | src/ramdisk/lib/fsHelper/win32FsHelper.py | .py | 914ac7e09a52fdc6 | 7.45 | 7 |
import os
import re
import subprocess
import traceback
def getDrivePath(path):
"""
get the drive out of the path
"""
drive, tail = os.path.splitdrive(path)
#print(drive)
return drive
def findDrive(path):
"""
Find the drive that the path is connected to -
if exists, return tr... | clockworksspheres/ramdisk | src/ramdisk/lib/fsHelper/winDriveTools.py | .py | 08bd87f6f0912f52 | 7.45 | 7 |
"""API response object."""
from __future__ import annotations
from typing import Any, Dict, Optional
try:
from pydantic.v1 import Field, StrictInt, StrictStr
except ImportError:
from pydantic import Field, StrictInt, StrictStr
class ApiResponse:
"""
API response object
"""
status_code: Option... | Authress/authress-sdk.py | authress/api_response.py | .py | 91844bb8dbd95557 | 7.48 | 8 |
# coding: utf-8
from __future__ import absolute_import
import json
import re
from authress.api.applications_api import ApplicationsApi
from authress.api.connections_api import ConnectionsApi
from authress.api.extensions_api import ExtensionsApi
from authress.api.groups_api import GroupsApi
from authress.api.invites_a... | Authress/authress-sdk.py | authress/authress_client.py | .py | b2c386a494454358 | 7.48 | 8 |
import sys
import os
import numpy as np
from datetime import datetime
import pytest
from wavy.satellite_module import satellite_class as sc
from wavy.consolidate import consolidate_class as cs
def test_consolidate_satellite(test_data):
# satellite consolidate
sco1 = sc(sd="2022-2-1",ed ="2022-2-3",region="Nord... | bohlinger/wavy | tests/test_consolidate.py | .py | e8d81920088104fd | 7 | 9 |
import numpy as np
from numpy.linalg import inv
from numpy.linalg import cholesky, det, lstsq
import scipy as sp
def kernel(X1, X2, l=1.0, sigma_f=1.0):
'''
Isotropic squared exponential kernel. Computes
a covariance matrix from points in X1 and X2.
Args:
X1: Array of m points (m x d).
... | bohlinger/wavy | wavy/GPfcts.py | .py | 0f298fc5ce5dbac9 | 7.5 | 9 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
from copy import deepcopy
def pseudo_wave_age(Hs, U10):
# L. L. Fu and R. Glazman,
# “The effect of the degree of wave development
# on the sea state bias in radar altimetry measurement”
# J. Geophys. Res., vol. 96, no. C1, pp. 829–834,... | bohlinger/wavy | wavy/wave_parameters.py | .py | de691488079a93a5 | 7.5 | 9 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.