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
""" File: Factorial.py Authors: - Amey Thakur (https://github.com/Amey-Thakur) - Mega Satish (https://github.com/msatmod) Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS Release Date: January 9, 2022 License: MIT License Description: A high-fidelity implementation for calculating the factorial of...
Amey-Thakur/PYTHON-SHORTS
Source Code/Factorial/Factorial.py
.py
09a9fe2e222332b0
7.48
8
""" File: FastFourierTransform.py Authors: - Amey Thakur (https://github.com/Amey-Thakur) - Mega Satish (https://github.com/msatmod) Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS Release Date: January 9, 2022 License: MIT License Description: This module implements the Fast Fourier Transform (F...
Amey-Thakur/PYTHON-SHORTS
Source Code/Fast Fourier Transform/FastFourierTransform.py
.py
d07c8a9ce34b3d2b
7.48
8
""" File: FibbonacciSequence.py Authors: - Amey Thakur (https://github.com/Amey-Thakur) - Mega Satish (https://github.com/msatmod) Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS Release Date: January 9, 2022 License: MIT License Description: A memory-efficient generator for the Fibonacci sequenc...
Amey-Thakur/PYTHON-SHORTS
Source Code/Fibonacci Sequence/FibbonacciSequence.py
.py
8fae0ccee5f68849
7.48
8
""" File: Fibonacci.py Authors: - Amey Thakur (https://github.com/Amey-Thakur) - Mega Satish (https://github.com/msatmod) Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS Release Date: January 9, 2022 License: MIT License Description: A high-fidelity implementation for calculating the n-th Fibonac...
Amey-Thakur/PYTHON-SHORTS
Source Code/Fibonacci/Fibonacci.py
.py
087b3925dcbb40e1
7.48
8
""" File: FileEncryptor.py Authors: - Amey Thakur (https://github.com/Amey-Thakur) - Mega Satish (https://github.com/msatmod) Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS Release Date: January 9, 2022 License: MIT License Description: This module implements a file encryption and decryption ser...
Amey-Thakur/PYTHON-SHORTS
Source Code/File Encryptor/FileEncryptor.py
.py
5aaf8f16a4d76804
7.48
8
""" File: GameOfLife.py Authors: - Amey Thakur (https://github.com/Amey-Thakur) - Mega Satish (https://github.com/msatmod) Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS Release Date: January 9, 2022 License: MIT License Description: This module implements Conway's Game of Life, a cellular autom...
Amey-Thakur/PYTHON-SHORTS
Source Code/Game of Life/GameOfLife.py
.py
aeeca93e93d753fb
7.48
8
""" File: Graph.py Authors: - Amey Thakur (https://github.com/Amey-Thakur) - Mega Satish (https://github.com/msatmod) Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS Release Date: January 9, 2022 License: MIT License Description: A high-fidelity implementation of a Graph data structure using Adja...
Amey-Thakur/PYTHON-SHORTS
Source Code/Graph/Graph.py
.py
de1fda243dc0d0de
7.48
8
""" File: GuessTheNumber.py Authors: - Amey Thakur (https://github.com/Amey-Thakur) - Mega Satish (https://github.com/msatmod) Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS Release Date: January 9, 2022 License: MIT License Description: An interactive simulation of a number-guessing game. The m...
Amey-Thakur/PYTHON-SHORTS
Source Code/Guess The Number/GuessTheNumber.py
.py
934ff2c0a8f6f3d4
7.48
8
""" File: HangmanGame.py Authors: - Amey Thakur (https://github.com/Amey-Thakur) - Mega Satish (https://github.com/msatmod) Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS Release Date: January 9, 2022 License: MIT License Description: A high-fidelity implementation of the Hangman word-guessing g...
Amey-Thakur/PYTHON-SHORTS
Source Code/Hangman Game/HangmanGame.py
.py
b174a2ee50d158cd
7.48
8
""" File: HashingFile.py Authors: - Amey Thakur (https://github.com/Amey-Thakur) - Mega Satish (https://github.com/msatmod) Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS Release Date: January 9, 2022 License: MIT License Description: A cryptographic utility for calculating the hash sum of files...
Amey-Thakur/PYTHON-SHORTS
Source Code/Hashing File/HashingFile.py
.py
9c0995496e7f85f2
7.48
8
""" File: HeapSort.py Authors: - Amey Thakur (https://github.com/Amey-Thakur) - Mega Satish (https://github.com/msatmod) Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS Release Date: January 9, 2022 License: MIT License Description: A high-fidelity implementation of the Heap Sort algorithm. This ...
Amey-Thakur/PYTHON-SHORTS
Source Code/Heap Sort/HeapSort.py
.py
d898677bd887eb9b
7.48
8
""" File: Hello_World.py Authors: - Amey Thakur (https://github.com/Amey-Thakur) - Mega Satish (https://github.com/msatmod) Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS Release Date: January 9, 2022 License: MIT License Description: The canonical initialization program. This implementation dem...
Amey-Thakur/PYTHON-SHORTS
Source Code/Hello World/Hello_World.py
.py
eff8620f7ea27b86
7.48
8
""" File: HuffmanCoding.py Authors: - Amey Thakur (https://github.com/Amey-Thakur) - Mega Satish (https://github.com/msatmod) Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS Release Date: January 9, 2022 License: MIT License Description: This module implements Huffman Coding, a popular algorithm ...
Amey-Thakur/PYTHON-SHORTS
Source Code/Huffman Coding/HuffmanCoding.py
.py
90a145d2b5c3d358
7.48
8
""" File: ImageMetadataExtractor.py Authors: - Amey Thakur (https://github.com/Amey-Thakur) - Mega Satish (https://github.com/msatmod) Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS Release Date: January 9, 2022 License: MIT License Description: This module implements an Image Metadata Extractio...
Amey-Thakur/PYTHON-SHORTS
Source Code/Image Metadata Extractor/ImageMetadataExtractor.py
.py
4defca5fa9b91dbb
7.48
8
""" File: InsertionSort.py Authors: - Amey Thakur (https://github.com/Amey-Thakur) - Mega Satish (https://github.com/msatmod) Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS Release Date: January 9, 2022 License: MIT License Description: A high-fidelity implementation of the Insertion Sort algori...
Amey-Thakur/PYTHON-SHORTS
Source Code/Insertion Sort/InsertionSort.py
.py
d5b2e16936c82240
7.48
8
""" File: Isogram.py Authors: - Amey Thakur (https://github.com/Amey-Thakur) - Mega Satish (https://github.com/msatmod) Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS Release Date: January 9, 2022 License: MIT License Description: A high-fidelity implementation of an Isogram verifier. This modul...
Amey-Thakur/PYTHON-SHORTS
Source Code/Isogram/Isogram.py
.py
c3f28dff86051a4a
7.48
8
""" File: KnapsackProblem.py Authors: - Amey Thakur (https://github.com/Amey-Thakur) - Mega Satish (https://github.com/msatmod) Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS Release Date: January 9, 2022 License: MIT License Description: This module implements the 0/1 Knapsack Problem using Dyn...
Amey-Thakur/PYTHON-SHORTS
Source Code/Knapsack Problem/KnapsackProblem.py
.py
084a6be4cf458201
7.48
8
""" File: LeastCommonMultiple.py Authors: - Amey Thakur (https://github.com/Amey-Thakur) - Mega Satish (https://github.com/msatmod) Repository: https://github.com/Amey-Thakur/PYTHON-SHORTS Release Date: January 9, 2022 License: MIT License Description: An efficient implementation for calculating the Least...
Amey-Thakur/PYTHON-SHORTS
Source Code/Least Common Multiple/LeastCommonMultiple.py
.py
2318d117585e8c52
7.48
8
import enum import json import os import subprocess import sys from typing import Any, Dict, List, Optional, Union import requests # GitHub API Client copied and adapted from # https://github.com/alstr/todo-to-issue-action/blob/25c80e9c4999d107bec208af49974d329da26370/main.py # Originally licensed under MIT license ...
actions-rust-lang/audit
audit.py
.py
9e8b8eafa23c4436
7.64
18
from typing import Dict from bitpay.clients.bitpay_client import BitPayClient from bitpay.clients.response_parser import ResponseParser from bitpay.exceptions.bitpay_exception_provider import BitPayExceptionProvider from bitpay.models.currency import Currency class CurrencyClient: __bitpay_client = BitPayClient ...
bitpay/python-bitpay-client
src/bitpay/clients/currency_client.py
.py
064adfbd5771a247
7.65
19
from typing import List from bitpay.clients.bitpay_client import BitPayClient from bitpay.clients.response_parser import ResponseParser from bitpay.exceptions.bitpay_exception_provider import BitPayExceptionProvider from bitpay.models.facade import Facade from bitpay.models.ledger.ledger import Ledger from bitpay.mode...
bitpay/python-bitpay-client
src/bitpay/clients/ledger_client.py
.py
b591aeaa26b76b8b
7.65
19
from typing import List from bitpay.clients.bitpay_client import BitPayClient from bitpay.clients.response_parser import ResponseParser from bitpay.exceptions.bitpay_exception_provider import BitPayExceptionProvider from bitpay.models.wallet.wallet import Wallet class WalletClient: __bitpay_client = BitPayClient...
bitpay/python-bitpay-client
src/bitpay/clients/wallet_client.py
.py
a3ae49f45660fc53
7.65
19
from typing import Union from bitpay.exceptions.bitpay_exception import BitPayException class BitPayApiException(BitPayException): """ BitPayApiException """ __message: str __code: Union[str, None] = None def __init__(self, message: str, code: Union[str, None]): """ Construc...
bitpay/python-bitpay-client
src/bitpay/exceptions/bitpay_api_exception.py
.py
93b6fa7c918887ec
7.65
19
""" BitPay Exception gets raised when some unexpected error occurs while processing a request """ class BitPayException(Exception): """ BitPayException """ __message: str def __init__(self, message: str): """ Construct the BitPayException. :param message: The Exception m...
bitpay/python-bitpay-client
src/bitpay/exceptions/bitpay_exception.py
.py
4ebfb88eea12134a
7.15
19
""" Bill """ from datetime import datetime, timezone from typing import List, Union from pydantic import field_serializer from .item import Item from ..bitpay_model import BitPayModel class Bill(BitPayModel): """ Bills are payment requests addressed to specific buyers. Bill line items have fixed prices...
bitpay/python-bitpay-client
src/bitpay/models/bill/bill.py
.py
490dc65e86f969a9
7.65
19
from datetime import datetime from typing import Union from pydantic import BaseModel, field_validator, ConfigDict from bitpay.exceptions.bitpay_exception_provider import BitPayExceptionProvider from bitpay.utils.model_util import ModelUtil def snake_to_camel(snake_case: str) -> str: return ModelUtil.convert_sn...
bitpay/python-bitpay-client
src/bitpay/models/bitpay_model.py
.py
c687db3335f156eb
7.65
19
from .aead_interface import AEADInterface from .aead_key import AEADKey from .aead_key_interface import AEADKeyInterface from .consts import AEADId class AEAD(AEADInterface): """ An AEAD(Authenticated Encapsulation with Additional Data) context. """ def __init__(self, aead_id: AEADId): """ ...
dajiaji/pyhpke
src/pyhpke/aead.py
.py
b54643a9ffd10039
7.57
13
from .aead_key_interface import AEADKeyInterface from .consts import AEADId from .keys.aes_gcm_key import AESGCMKey from .keys.chacha20_poly1305_key import ChaCha20Poly1305Key class AEADKey: """ A :class:`AEADKeyInterface <hpke.AEADKeyInterface>` Builder. """ @classmethod def from_bytes(cls, aead...
dajiaji/pyhpke
src/pyhpke/aead_key.py
.py
4e212b818c6b00b7
7.57
13
class AEADKeyInterface: """ The AEAD key interface. """ def seal(self, pt: bytes, nonce: bytes, aad: bytes = b"") -> bytes: """ Encrypts the specified message. Args: pt (bytes): A plain text to be encrypted. nonce (bytes): A nonce for encryption. ...
dajiaji/pyhpke
src/pyhpke/aead_key_interface.py
.py
4afec713f0fe63ba
7.57
13
import struct from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import hashes, hmac from .consts import HPKE_VERSION, KDFId from .kdf_interface import KDFInterface class KDF(KDFInterface): """ A KDF(Key Derivation Function) context. """ def __init__(self, ...
dajiaji/pyhpke
src/pyhpke/kdf.py
.py
568af019664b1e67
7.57
13
import struct from typing import Any from .consts import KDFId, KEMId from .kdf import KDF from .kem_interface import KEMInterface from .kem_key import KEMKeyPair from .kem_key_interface import KEMKeyInterface from .kem_primitives.ec import EC from .kem_primitives.x448 import X448 from .kem_primitives.x25519 import X2...
dajiaji/pyhpke
src/pyhpke/kem.py
.py
017f50d74cefeffc
7.57
13
import json from typing import Any from cryptography.hazmat.primitives.asymmetric.ec import ( EllipticCurvePrivateKey, EllipticCurvePublicKey, ) from cryptography.hazmat.primitives.asymmetric.x448 import X448PrivateKey, X448PublicKey from cryptography.hazmat.primitives.asymmetric.x25519 import ( X25519Priv...
dajiaji/pyhpke
src/pyhpke/kem_key.py
.py
71ea99e815bda3e3
7.57
13
from typing import Any class KEMKeyInterface: """ The KEM key interface. """ def __init__(self, key: Any): self._key = key @property def raw(self) -> Any: return self._key def to_private_bytes(self) -> bytes: """ Serializes the key to a byte string if it ...
dajiaji/pyhpke
src/pyhpke/kem_key_interface.py
.py
9955b8bd265aeea5
7.57
13
from cryptography.hazmat.primitives.ciphers import aead from ..aead_key_interface import AEADKeyInterface class AESGCMKey(AEADKeyInterface): """ The AES-GCM key. """ def __init__(self, key: bytes, size: int): if size != 16 and size != 32: raise ValueError(f"Invalid key size: {len...
dajiaji/pyhpke
src/pyhpke/keys/aes_gcm_key.py
.py
fd21a60ce07bf3fe
7.57
13
from cryptography.hazmat.primitives.ciphers import aead from ..aead_key_interface import AEADKeyInterface class ChaCha20Poly1305Key(AEADKeyInterface): """ The ChaCha20-Poly1305 key. """ def __init__(self, key: bytes): if len(key) != 32: raise ValueError(f"Invalid key size: {len(k...
dajiaji/pyhpke
src/pyhpke/keys/chacha20_poly1305_key.py
.py
0899b9fd36eb64c8
7.57
13
from typing import Any, cast from cryptography.hazmat.primitives.asymmetric import ec from cryptography.hazmat.primitives.asymmetric.ec import ( EllipticCurvePrivateKey, EllipticCurvePublicKey, ) from cryptography.hazmat.primitives.serialization import Encoding, PublicFormat from ..consts import HPKE_SUPPORTE...
dajiaji/pyhpke
src/pyhpke/keys/ec_key.py
.py
41e6859107f549c9
7.57
13
from typing import Any from cryptography.hazmat.primitives.asymmetric.x25519 import ( X25519PrivateKey, X25519PublicKey, ) from cryptography.hazmat.primitives.serialization import Encoding, PublicFormat from ..kem_key_interface import KEMKeyInterface from ..utils import base64url_decode class X25519Key(KEMK...
dajiaji/pyhpke
src/pyhpke/keys/x25519_key.py
.py
85d9352d98824fdc
7.57
13
from typing import Any from cryptography.hazmat.primitives.asymmetric.x448 import X448PrivateKey, X448PublicKey from cryptography.hazmat.primitives.serialization import Encoding, PublicFormat from ..kem_key_interface import KEMKeyInterface from ..utils import base64url_decode class X448Key(KEMKeyInterface): """...
dajiaji/pyhpke
src/pyhpke/keys/x448_key.py
.py
27af69e8cb418fb3
7.57
13
from pyhpke import AEADId, CipherSuite, KDFId, KEMId, KEMKey class TestSample: """ Tests for sample code. """ def test_hpke_ec(self) -> None: # The sender side: suite_s = CipherSuite.new(KEMId.DHKEM_P256_HKDF_SHA256, KDFId.HKDF_SHA256, AEADId.AES128_GCM) pkr = KEMKey.from_jwk(...
dajiaji/pyhpke
tests/test_sample.py
.py
9aad816aa5260cc3
7.07
13
import json import os from typing import Any import pytest from pyhpke import AEADId, CipherSuite, KDFId, KEMId, KEMKeyInterface, KEMKeyPair class TestWithOfficialTestVectors: """ Tests with official test vectors. """ @pytest.mark.parametrize( "v", json.load( open( # no...
dajiaji/pyhpke
tests/test_with_official_test_vectors.py
.py
30b364da3e790eb8
8.07
13
""" Configuration Management This module provides functionality to manage configuration settings for OpenSearch CLI. """ import os import yaml from rich.console import Console # Create a console instance for rich formatting console = Console() class Config: """ Class for managing configuration settings ...
opensearch-project/sql-cli
src/main/python/opensearchsql_cli/config/config.py
.py
985455fe6d217dbc
7.5
9
""" OpenSearch Literals This module provides access to OpenSearch SQL and PPL keywords and functions for auto-completion. """ import os import json from rich.text import Text class Literals: """Class for handling OpenSearch literals (keywords and functions).""" @staticmethod def get_literals(language="...
opensearch-project/sql-cli
src/main/python/opensearchsql_cli/literals/opensearch_literals.py
.py
d39ad997c16cb67c
7.5
9
""" Error Formatting This module provides functionality for formatting enhanced error reports from OpenSearch SQL/PPL. Inspired by the color-eyre Rust crate for beautiful error display. """ import json from typing import Optional, Dict, Any, Tuple from rich.console import Console from rich.panel import Panel from ric...
opensearch-project/sql-cli
src/main/python/opensearchsql_cli/query/error_formatter.py
.py
57fe8614764f9ece
7.5
9
""" Query Execution This module provides functionality for executing queries and formatting results. """ from rich.console import Console from rich.status import Status from rich.markup import escape from .query_results import QueryResults from .explain_results import ExplainResults from .error_formatter import Error...
opensearch-project/sql-cli
src/main/python/opensearchsql_cli/query/execute_query.py
.py
1f99d11d65b9fab3
7.5
9
import json import re class ExplainResults: """ Class for formatting explain results """ def explain_legacy(result): """ Format legacy explain Args: result: legacy explain result Returns: string: format_result """ data = json....
opensearch-project/sql-cli
src/main/python/opensearchsql_cli/query/explain_results.py
.py
83d5577b26358e01
7.5
9
""" Query Result Handling This module provides table formatting for query results. Other formats are handled by the Java formatters in the SQL library. """ import json from rich.console import Console from rich.table import Table from rich.box import HEAVY_HEAD # Create a console instance for rich formatting console...
opensearch-project/sql-cli
src/main/python/opensearchsql_cli/query/query_results.py
.py
221c5b2ca0837aab
7.5
9
""" SQL Library Connection Management Handles connection to SQL library and OpenSearch Cluster configuration. """ from py4j.java_gateway import JavaGateway, GatewayParameters import sys import json import requests from requests.auth import HTTPBasicAuth from rich.console import Console from .sql_library_manager impor...
opensearch-project/sql-cli
src/main/python/opensearchsql_cli/sql/sql_connection.py
.py
af9f2654c5ad2838
7.5
9
""" SQL Library Management Handles initialization and cleanup of the SQL Library. """ import os import sys import atexit import logging import subprocess import time import threading import socket from datetime import datetime from .sql_version import sql_version from ..config.config import config_manager # sql-cli/...
opensearch-project/sql-cli
src/main/python/opensearchsql_cli/sql/sql_library_manager.py
.py
927b2c34fe6c1eed
7.5
9
""" SQL Version Management Handles version selection for OpenSearch CLI. """ import os import re import subprocess import requests import shutil from pathlib import Path from bs4 import BeautifulSoup from packaging import version from rich.console import Console from rich.status import Status # Create a console inst...
opensearch-project/sql-cli
src/main/python/opensearchsql_cli/sql/sql_version.py
.py
03b622cdc28d8150
7.5
9
""" OpenSearch Connection Verification Handles verification of connections to OpenSearch clusters using opensearchpy. """ import ssl import urllib3 import boto3 import sys import warnings from rich.console import Console from opensearchpy import OpenSearch, RequestsHttpConnection from opensearchpy.exceptions import (...
opensearch-project/sql-cli
src/main/python/opensearchsql_cli/sql/verify_cluster.py
.py
ff9cd8e736edbaad
7.5
9
""" Pytest fixtures for configuration tests. This module contains shared fixtures for testing the configuration functionality. """ import yaml import pytest from unittest.mock import patch, mock_open @pytest.fixture def mock_config_data(): """ Fixture providing mock configuration data. """ return { ...
opensearch-project/sql-cli
src/main/python/opensearchsql_cli/tests/config/conftest.py
.py
75441fb67e4b7111
8
9
""" Tests for Configuration Management. This module contains tests for the Configuration Management functionality. """ import os import yaml import pytest from unittest.mock import patch, mock_open, MagicMock from opensearchsql_cli.config.config import Config class TestConfig: """ Test class for Config. ...
opensearch-project/sql-cli
src/main/python/opensearchsql_cli/tests/config/test_config.py
.py
47365402e2e5bb1d
8
9
""" Pytest configuration file for opensearchsql-cli main tests. This file contains fixtures and configuration for pytest tests. """ import os import sys import pytest from unittest.mock import MagicMock, patch @pytest.fixture def mock_sql_connection(): """ Fixture that returns a mock SQL connection. """...
opensearch-project/sql-cli
src/main/python/opensearchsql_cli/tests/conftest.py
.py
9b61446f1e21e6ee
7
9
""" Pytest fixtures for literals tests. This module contains shared fixtures for testing the literals functionality. """ import os import json import pytest from unittest.mock import patch, mock_open @pytest.fixture def mock_ppl_literals_data(): """ Fixture providing mock PPL literals data. """ retu...
opensearch-project/sql-cli
src/main/python/opensearchsql_cli/tests/literals/conftest.py
.py
66b7c15b54ea3b21
8
9
""" Tests for OpenSearch Literals. This module contains tests for the OpenSearch Literals functionality. """ import os import json import pytest from unittest.mock import patch, mock_open from rich.text import Text from opensearchsql_cli.literals.opensearch_literals import Literals class TestLiterals: """ T...
opensearch-project/sql-cli
src/main/python/opensearchsql_cli/tests/literals/test_literals.py
.py
89a461d69cfa492b
8
9
""" Pytest configuration file for opensearchsql-cli query tests. This file contains fixtures and configuration for pytest tests. """ import os import sys import json import pytest import tempfile import warnings from unittest.mock import MagicMock, patch # Fixtures for query execution @pytest.fixture def mock_csv_r...
opensearch-project/sql-cli
src/main/python/opensearchsql_cli/tests/query/conftest.py
.py
a5c2476a2ecfe218
7
9
""" Tests for the error_formatter module. This module contains tests for the enhanced error formatting functionality. """ import pytest import json from unittest.mock import MagicMock from opensearchsql_cli.query.error_formatter import ErrorFormatter from rich.text import Text class TestErrorFormatter: """ ...
opensearch-project/sql-cli
src/main/python/opensearchsql_cli/tests/query/test_error_formatter.py
.py
00095e5d98a903b8
7
9
""" Tests for the execute_query module. This module contains tests for the query execution functionality. """ import pytest import json from rich.console import Console from unittest.mock import patch, MagicMock from opensearchsql_cli.query.execute_query import ExecuteQuery from opensearchsql_cli.query.query_results ...
opensearch-project/sql-cli
src/main/python/opensearchsql_cli/tests/query/test_query.py
.py
83393f8443210576
7
9
""" Pytest fixtures for SQL tests. This module contains fixtures used by the SQL tests. """ import pytest import subprocess from unittest.mock import MagicMock, PropertyMock, patch # Fixtures for test_sql_library.py @pytest.fixture def mock_process(): """ Fixture that returns a mock subprocess.Popen instanc...
opensearch-project/sql-cli
src/main/python/opensearchsql_cli/tests/sql/conftest.py
.py
37d5a39e9bcf230c
7
9
""" Tests for SQL Connection. This module contains tests for the SqlConnection class that handles connection to SQL library and OpenSearch Cluster configuration. """ import pytest from unittest.mock import patch, MagicMock, call from opensearchsql_cli.sql.sql_connection import SqlConnection class TestSqlConnection:...
opensearch-project/sql-cli
src/main/python/opensearchsql_cli/tests/sql/test_sql_connection.py
.py
14a21a6e905a82aa
8
9
from sklearn.model_selection import train_test_split import numpy as np try: import jax import jax.numpy as jnp except ImportError: _has_jax = False else: _has_jax = True def split_arrays(*arrays, test_size, valid_size=0): """ Split arrays into train, test and (optionally) validation sets. ...
al-jshen/prfr
prfr/utils.py
.py
7cd8ed12b9712910
7.42
6
"""Shared helpers for extracting and normalizing config entry values.""" from __future__ import annotations from collections.abc import Mapping from typing import Any from homeassistant.config_entries import ConfigEntry from .const import CONF_API_URL def get_entry_value(entry: ConfigEntry, key: str, default: Any...
Xerolux/violet-hass
custom_components/violet_pool_controller/config_entry_helpers.py
.py
339275bc4a9668cf
7.42
6
"""Basic tests that the CLI runs without crashing.""" import importlib from pathlib import Path from typing import Optional ## Helper to inject system CA Certificates to avoid HTTP certificate errors import truststore from pytest import fixture, mark, skip from sqlalchemy import make_url from typer.testing import Cli...
UW-Macrostrat/macrostrat
conftest.py
.py
a626224e212af06f
8
9
import sys from . import match_scripts from .base import Base class Match(Base): """ macrostrat match <script> <source_id>: Scripts for matching geologic maps to columns Available scripts: strat_names units liths fossils_strat_names Usage: macrostrat mat...
UW-Macrostrat/macrostrat
py-modules/cli/macrostrat/cli/commands/match.py
.py
f3bc43f49d0189be
7.5
9
import datetime import sys import time from psycopg2.extensions import AsIs from psycopg2.extras import NamedTupleCursor from ..base import Base """ select coll_strata.lat, coll_strata.lng, grp, formation from macrostrat.lookup_strat_names, pbdb.coll_strata,pbdb.coll_matrix where coll_strata.col...
UW-Macrostrat/macrostrat
py-modules/cli/macrostrat/cli/commands/match_scripts/fossils_strat_names.py
.py
4f8ce3b3705d9ee0
7.5
9
import datetime import sys from psycopg2.extensions import AsIs from .base import Base class Process(Base): """ macrostrat process <command> <source_id>: Scripts for processing geologic map data Available commands: burwell_lookup <source_id> - Refresh the appropriate lookup tables for a...
UW-Macrostrat/macrostrat
py-modules/cli/macrostrat/cli/commands/process.py
.py
5493d66609c00c73
7.5
9
import sys from ..base import Base # from ..match_scripts import liths, strat_names from .carto import Carto from .carto_lines import CartoLines # from .legend import Legend class MapSource(Base): """ macrostrat process map_source <source_id>: Run all the necessary scripts for ingesting a given map...
UW-Macrostrat/macrostrat
py-modules/cli/macrostrat/cli/commands/process_scripts/map_source.py
.py
0249a1d1958882b5
7.5
9
"""Load CSV files into the database, inferring a table structure from the data. This is a working-data convenience: it behaves more or less like [cyan]COPY[/], except that the destination table is created to match the file's inferred schema. Tables land in the [cyan]temp[/] schema by default. """ from io import Bytes...
UW-Macrostrat/macrostrat
py-modules/cli/macrostrat/cli/database/load_csv.py
.py
2f13ceba9dbf5c26
7.5
9
"""Load geospatial files into the database, inferring a table structure. The geospatial counterpart to [cyan]load-csv[/], with the same semantics: the destination table is created to match the file, named after it, and placed in the [cyan]temp[/] schema by default. Reading is done with [cyan]pyogrio[/], a direct GDAL...
UW-Macrostrat/macrostrat
py-modules/cli/macrostrat/cli/database/load_geo.py
.py
aa0964676b654124
7.5
9
"""Shared machinery for the [cyan]load-csv[/] and [cyan]load-geo[/] commands. Both commands work the same way: infer a table structure from a file, create it (by default in the [cyan]temp[/] schema, named after the file), and stream the data in with [cyan]COPY[/]. Everything they have in common lives here so the two c...
UW-Macrostrat/macrostrat
py-modules/cli/macrostrat/cli/database/load_utils.py
.py
53eb06ec8daac2c7
7.5
9
from pathlib import Path from sys import stdin from sqlalchemy.engine.url import URL from typer import Argument, Context, Typer from macrostrat.utils.shell import run from ..utils import docker_internal_url from .postgresql_migration import migrate_mariadb_to_postgresql from .restore import dump_mariadb, restore_mar...
UW-Macrostrat/macrostrat
py-modules/cli/macrostrat/cli/database/mariadb/__init__.py
.py
146ab17d4979dba6
7.5
9
import asyncio from contextlib import contextmanager from pathlib import Path from sys import stdin from typing import Union import aiofiles from rich.console import Console from sqlalchemy.engine import URL, Engine from macrostrat.core.exc import MacrostratError from macrostrat.database import database_exists from m...
UW-Macrostrat/macrostrat
py-modules/cli/macrostrat/cli/database/mariadb/restore.py
.py
5c1413e7b056b088
7.5
9
from contextlib import contextmanager from typing import Optional from uuid import uuid4 from psycopg.sql import Identifier from rich import print from sqlalchemy.engine import Engine, create_engine from sqlalchemy.engine.url import URL, make_url from macrostrat.core.config import settings from macrostrat.database im...
UW-Macrostrat/macrostrat
py-modules/cli/macrostrat/cli/database/utils.py
.py
770bfa45004b2ceb
7.5
9
""" Functions for working with a Macrostrat instance in a Kubernetes cluster. """ import base64 import json from os import environ from subprocess import run from typing import Optional from rich import print from typer import Argument, Option, Typer from macrostrat.core import app as app_ settings = app_.settings ...
UW-Macrostrat/macrostrat
py-modules/cli/macrostrat/cli/kubernetes/__init__.py
.py
5522f31ade062261
7.5
9
"""Raster data management. The registration surface comes wholesale from `macrostrat.raster_index`, mounted against Macrostrat's own database configuration. The only thing added here is the legacy COG-conversion command from the prototype `macrostrat.raster_cli`, kept as a deprecated subcommand while its replacement i...
UW-Macrostrat/macrostrat
py-modules/cli/macrostrat/cli/rasters.py
.py
e52122ebd2263abe
7.5
9
""" Write a Macrostrat map to the CriticalMAAS TA1 Geopackage format - https://github.com/DARPA-CRITICALMAAS/ta1-geopackage - https://github.com/DARPA-CRITICALMAAS/schemas/tree/main/ta1 """ from asyncio import run from pathlib import Path from criticalmaas.ta1_geopackage import GeopackageDatabase from rich import pr...
UW-Macrostrat/macrostrat
py-modules/cli/macrostrat/cli/subsystems/criticalmaas/__init__.py
.py
e1610c2a1e2471e3
7.5
9
"""Constants for Napoleon eFIRE devices.""" from __future__ import annotations from dataclasses import dataclass, field from enum import Enum, IntEnum, StrEnum from typing import Self # Package format constants HEADER = 0xAB REQUEST_HEADER = 0xAA RESPONSE_HEADER = 0xBB FOOTER = 0x55 MIN_MESSAGE_LENGTH = 6 MAX_FLAME...
kaechele/bonaparte
src/bonaparte/const.py
.py
ebd70b164958889b
7.5
9
"""A generic device class for Napoleon eFIRE devices.""" from __future__ import annotations import asyncio import logging from typing import TYPE_CHECKING, Any, Concatenate from bleak.exc import BleakDBusError, BleakError from bleak_retry_connector import ( BLEAK_RETRY_EXCEPTIONS as BLEAK_EXCEPTIONS, BleakCl...
kaechele/bonaparte
src/bonaparte/device.py
.py
33fd4e4caaa28657
7.5
9
"""Parsers used in the Bonaparte library.""" from __future__ import annotations from .const import LedMode, LedState def parse_ble_version(payload: bytes | bytearray) -> str: """Return a string of the BLE version.""" return str(payload[1]) def parse_mcu_version(payload: bytes | bytearray) -> str: """R...
kaechele/bonaparte
src/bonaparte/parser.py
.py
a61dfa37bb2f8588
7.5
9
"""Helper functions and utilities used in the Bonaparte library.""" from __future__ import annotations from functools import reduce from .const import FOOTER, HEADER, REQUEST_HEADER def checksum(payload: bytearray | bytes) -> int: """Calculate the checksum for a command payload.""" if len(payload) < 1: ...
kaechele/bonaparte
src/bonaparte/utils.py
.py
3ee785a360f969e7
7.5
9
"""Tests for constants and enums.""" from bonaparte.const import ( CONFIG_DESC_UUID, FOOTER, HEADER, MAX_BLOWER_SPEED, MAX_FLAME_HEIGHT, MAX_NIGHT_LIGHT_BRIGHTNESS, MIN_MESSAGE_LENGTH, MODEL_NBR_UUID, READ_CHAR_UUID, REQUEST_HEADER, RESPONSE_HEADER, SERVICE_UUID, WRI...
kaechele/bonaparte
tests/test_const.py
.py
8c7585fcea50f5da
8
9
"""Tests for device.py functionality.""" from bleak.backends.device import BLEDevice import pytest from bonaparte.const import FOOTER, HEADER from bonaparte.device import EfireDevice from bonaparte.exceptions import EfireMessageValueError def test_message_validation_too_short() -> None: """Test that messages th...
kaechele/bonaparte
tests/test_device.py
.py
21503a5aac81ecbe
7
9
"""Tests for exception handling.""" import pytest from bonaparte.exceptions import ( AuthError, CharacteristicMissingError, CommandFailedException, DisconnectedException, EfireException, EfireMessageValueError, FeatureNotSupported, ) def test_efire_exception_is_base() -> None: """Tes...
kaechele/bonaparte
tests/test_exceptions.py
.py
80f90715b90cddaa
8
9
"""Tests for Fireplace class functionality.""" from bleak.backends.device import BLEDevice import pytest from bonaparte import Fireplace, FireplaceFeatures, FireplaceState def test_fireplace_initialization() -> None: """Test that Fireplace initializes correctly.""" ble_device = BLEDevice("aa:bb:cc:dd:ee:ff"...
kaechele/bonaparte
tests/test_fireplace.py
.py
163a808ef040db3b
8
9
"""Message related tests.""" from bonaparte.utils import build_message, checksum_message from .mock_messages import request def test_checksum() -> None: """Test checksum generation using known good messages.""" for message in request.values(): assert checksum_message(message) == message[-2] def te...
kaechele/bonaparte
tests/test_messages.py
.py
832c0fee5b9e265a
8
9
"""Miscellaneous tests.""" from bleak.backends.device import BLEDevice import pytest from bonaparte import Fireplace, FireplaceFeatures from bonaparte.const import LedMode, LedState fp = Fireplace(BLEDevice("aa:bb:cc:dd:ee:ff", "Fireplace", details=None)) full_valid_set = {"aux", "blower", "led_lights", "night_ligh...
kaechele/bonaparte
tests/test_misc.py
.py
65ee185cb87ec8e0
8
9
"""Additional tests for parser edge cases and error handling.""" from bonaparte.const import LedMode from bonaparte.parser import ( parse_ble_version, parse_ifc_cmd1_state, parse_ifc_cmd2_state, parse_led_color, parse_led_controller_state, parse_mcu_version, parse_timer, ) def test_parse_...
kaechele/bonaparte
tests/test_parser_edge_cases.py
.py
97bc163f4103c9f2
8
9
"""Parsing related tests.""" from bonaparte.const import LedMode from bonaparte.parser import ( parse_ble_version, parse_ifc_cmd1_state, parse_ifc_cmd2_state, parse_led_color, parse_led_controller_state, parse_mcu_version, parse_timer, ) from .mock_messages import response def test_ble_v...
kaechele/bonaparte
tests/test_parsers.py
.py
e7c5c5c9eb575977
7
9
"""Additional tests for utility functions.""" import pytest from bonaparte.utils import build_message, checksum, checksum_message def test_checksum_empty() -> None: """Test checksum with empty payload.""" with pytest.raises( ValueError, match="Payload must contain at least one byte for check...
kaechele/bonaparte
tests/test_utils.py
.py
ce31fdc3e4ade549
8
9
"""Integration tests for message validation and edge cases.""" from bleak.backends.device import BLEDevice from bonaparte.const import ( MAX_BLOWER_SPEED, MAX_FLAME_HEIGHT, MAX_NIGHT_LIGHT_BRIGHTNESS, LedMode, ) from bonaparte.fireplace import Fireplace, FireplaceFeatures, FireplaceState def test_se...
kaechele/bonaparte
tests/test_validation.py
.py
78443f4ea4efbaf2
8
9
"""Lotka-Volterra predator-prey model (v2): predation uses derived stoichiometry.""" from mxlpy import KineticModelBuilder, fns from mxlpy.types import Derived __all__ = ["create_model"] def _prey_growth( alpha: float, prey: float, ) -> float: """Prey intrinsic growth: Alpha * Prey.""" return alpha ...
Computational-Biology-Aachen/MxlPy
src/example_models/lotka_volterra.py
.py
3663e63fe5d7df99
7.62
16
"""Compartmental models of infectious disease spread. These models are based on the SIR (Susceptible-Infectious-Recovered) framework, which is commonly used to model the spread of infectious diseases. """ from __future__ import annotations from mxlpy import KineticModelBuilder, fns __all__ = ["get_sir", "get_sird"...
Computational-Biology-Aachen/MxlPy
src/example_models/sir.py
.py
95b197227e8dae32
7.62
16
"""Test nested function calls in MXLpy.""" from __future__ import annotations from mxlpy import KineticModelBuilder from mxlpy.fns import constant __all__ = ["get_model", "wrapper"] def wrapper(x: float) -> float: """Wrapper function to call a constant function.""" return constant(x) def get_model() -> K...
Computational-Biology-Aachen/MxlPy
src/example_models/test_nested.py
.py
9874db893915d428
8.12
16
"""Topological searches for dependencies.""" from dataclasses import dataclass from queue import Empty, SimpleQueue from wadler_lindig import pformat __all__ = [ "CircularDependencyError", "Dependency", "MissingDependenciesError", "get_all_dependencies_of", "sort_all", "sort_dependencies", ] ...
Computational-Biology-Aachen/MxlPy
src/mxlpy/_topo.py
.py
79a872310ef7ea9b
7.62
16
"""Hierarchical model composition. Merge multiple :class:`~mxlpy.model.Model` instances into a single model, identifying shared components by name. This enables building large models from smaller, independently tested submodules (e.g. a metabolic core plus a regulatory layer) rather than as one monolithic model. """ ...
Computational-Biology-Aachen/MxlPy
src/mxlpy/composition.py
.py
55197ad029456180
7.62
16
"""String-based DSL for specifying reaction networks.""" from __future__ import annotations import re from typing import TYPE_CHECKING import sympy from mxlpy import fns from mxlpy.fns import hill_1s, michaelis_menten_1s if TYPE_CHECKING: from mxlpy._kinetic_builder import KineticModelBuilder from mxlpy.ty...
Computational-Biology-Aachen/MxlPy
src/mxlpy/dsl.py
.py
cf8f7344e8794ec6
7.62
16
"""Diffing utilities for comparing models.""" from __future__ import annotations from dataclasses import dataclass, field from typing import TYPE_CHECKING from wadler_lindig import pformat from mxlpy.types import Derived if TYPE_CHECKING: from collections.abc import Mapping from mxlpy._kinetic_builder imp...
Computational-Biology-Aachen/MxlPy
src/mxlpy/experimental/diff.py
.py
43029a85eb1fdafa
7.62
16
"""Fuzzy / bayesian fitting methods.""" from __future__ import annotations import multiprocessing from concurrent.futures import TimeoutError as FuturesTimeoutError from dataclasses import dataclass, field from functools import partial from math import ceil from typing import TYPE_CHECKING, Self import numpy as np i...
Computational-Biology-Aachen/MxlPy
src/mxlpy/fuzzy.py
.py
b8701fc3dfa91f06
7.62
16
"""Assimulo integrator for solving ODEs.""" from __future__ import annotations import contextlib import os from dataclasses import dataclass from typing import TYPE_CHECKING, Literal import numpy as np from mxlpy.integrators.abstract import ( AbstractIntegrator, TimeCourse, ) from mxlpy.integrators.utils im...
Computational-Biology-Aachen/MxlPy
src/mxlpy/integrators/int_assimulo.py
.py
7b7823625379725e
7.62
16
"""Batched ensemble simulation utilities for JAX/equinox models.""" from collections.abc import Callable, Iterable from pathlib import Path from typing import Any import equinox as eqx import jax import jax.numpy as jnp from mxlpy.jax import io as jax_io __all__ = [ "batch_simulate", "load_stacked_models", ...
Computational-Biology-Aachen/MxlPy
src/mxlpy/jax/ensemble.py
.py
a78fcd300b6eca15
7.62
16