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 |
|---|---|---|---|---|---|---|
# Copyright 2018 AT&T Intellectual Property. All other rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | airshipit/shipyard | src/bin/shipyard_airflow/alembic/versions/51b92375e5c4_initial_shipyard_base.py | .py | 640539fbd10562ef | 7.65 | 19 |
"""create notes table
Revision ID: 7486ddec1979
Revises: 51b92375e5c4
Create Date: 2018-10-02 16:10:08.139378
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy import (types, func)
# revision identifiers, used by Alembic.
revision = '7486ddec1979'
down_revision = '51b92375e5c4'
branch_labels = None... | airshipit/shipyard | src/bin/shipyard_airflow/alembic/versions/7486ddec1979_create_notes_table.py | .py | 7f925e2084227e64 | 7.65 | 19 |
# Copyright 2018 AT&T Intellectual Property. All other rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | airshipit/shipyard | src/bin/shipyard_airflow/shipyard_airflow/common/notes/storage_impl_db.py | .py | 3746b8f6fbcc9ab9 | 7.65 | 19 |
# Copyright 2018 AT&T Intellectual Property. All other rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | airshipit/shipyard | src/bin/shipyard_airflow/shipyard_airflow/common/notes/storage_impl_mem.py | .py | ac50f394f3c30dee | 7.65 | 19 |
# Copyright 2017 AT&T Intellectual Property. All other rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | airshipit/shipyard | src/bin/shipyard_airflow/shipyard_airflow/conf/opts.py | .py | 80df000a3b890d23 | 7.65 | 19 |
# Copyright 2017 AT&T Intellectual Property. All other rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | airshipit/shipyard | src/bin/shipyard_airflow/shipyard_airflow/control/af_monitoring/workflows_api.py | .py | 5d7b26b8e58361c4 | 7.65 | 19 |
import os
import imageio
import torchvision
from torchvision import transforms
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from torch.utils.data import TensorDataset, DataLoader, Dataset
from model import *
from train import *
import matplotlib.image
import matplotlib.pyplot as... | HotThoughts/SalGAN | util.py | .py | bb42b601561944a7 | 7.5 | 9 |
import logging
import sys
from pathlib import Path
from typing import Annotated, Optional
from pydantic import AnyHttpUrl, confloat
from pydantic_core import ValidationError
from pydantic_settings import BaseSettings, SettingsConfigDict
from lm_agent.constants import LogLevelEnum
DEFAULT_CACHE_DIR = Path.home() / Pa... | omnivector-solutions/license-manager | lm-agent/lm_agent/config.py | .py | 556b72dd27278bc5 | 7.42 | 6 |
from enum import Enum
class LogLevelEnum(str, Enum):
"""
Log level name enforcement
"""
DEBUG = "DEBUG"
INFO = "INFO"
WARNING = "WARNING"
ERROR = "ERROR"
CRITICAL = "CRITICAL"
class LicenseServerType(str, Enum):
"""
Describe the supported license server types that may be use... | omnivector-solutions/license-manager | lm-agent/lm_agent/constants.py | .py | fb436fd5c4f9efb8 | 7.42 | 6 |
import bz2
import logging
import os
from logging.handlers import RotatingFileHandler
from pathlib import Path
from textwrap import dedent
from traceback import format_tb
from buzz import DoExceptParams
from lm_agent.config import settings
DEFAULT_FORMAT = "[%(asctime)s;%(levelname)s] %(filename)s:%(lineno)s - %(func... | omnivector-solutions/license-manager | lm-agent/lm_agent/logs.py | .py | 33827096428d6242 | 7.42 | 6 |
import asyncio
import logging
import sentry_sdk
from sentry_sdk.integrations.logging import LoggingIntegration
from lm_agent.backend_utils.utils import check_backend_health, report_cluster_status
from lm_agent.config import settings
from lm_agent.logs import init_logging, logger
from lm_agent.scheduler import schedul... | omnivector-solutions/license-manager | lm-agent/lm_agent/main.py | .py | 3f94acee9b8dbd70 | 7.42 | 6 |
"""
Parser for DSLS.
"""
import csv
from typing import Optional
from lm_agent.models import LicenseUsesItem, ParsedFeatureItem
def parse_feature_dict(feature_dict: dict[str, str]) -> Optional[ParsedFeatureItem]:
"""
Parse the feature dcit in the DSLS output.
Data we need:
- ``feature``: license nam... | omnivector-solutions/license-manager | lm-agent/lm_agent/parsing/dsls.py | .py | 3d39cfb7c7f6cbca | 7.42 | 6 |
"""
Parser for LM-X.
"""
import re
from typing import Optional
from lm_agent.models import LicenseUsesItem
HOSTWORD = r"[a-zA-Z0-9-]+"
HOSTNAME = rf"{HOSTWORD}(\.{HOSTWORD})*"
INT = r"\d+"
VERSION = rf"{INT}\.{INT}"
FEATURE_LINE = rf"^Feature: (?P<feature>\w+) Version: (?P<version>{VERSION}) Vendor: (?P<vendor>\S+)... | omnivector-solutions/license-manager | lm-agent/lm_agent/parsing/lmx.py | .py | 72fb5c64d72e07aa | 7.42 | 6 |
"""
Parser for LS-Dyna.
"""
import re
from lm_agent.models import LicenseUsesItem
HOSTWORD = r"[a-zA-Z0-9-]+"
HOSTNAME = rf"{HOSTWORD}(\.{HOSTWORD})*"
NONWS = r"\S+"
INT = r"\d+"
PROGRAM = r"[A-Z0-9\-_]+"
EXPIRATION_DATE = r"((0[1-9]|1[012])[\/](0[1-9]|[12][0-9]|3[01])[\/](19|20)\d\d)"
INT_OR_DASH = r"[\d|-]"
PROGR... | omnivector-solutions/license-manager | lm-agent/lm_agent/parsing/lsdyna.py | .py | 71301099b8fdca95 | 7.42 | 6 |
"""
Parser for OLicense.
"""
import re
from typing import Optional
from lm_agent.models import LicenseUsesItem
HOSTWORD = r"[a-zA-Z0-9-]+"
HOSTNAME = rf"{HOSTWORD}(\.{HOSTWORD})*"
INT = r"\d+"
EXPIRATION_DATE = (
r"[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1]) (2[0-3]|[01][0-9]):[0-5][0-9]:[0-5][0-9]"
)
F... | omnivector-solutions/license-manager | lm-agent/lm_agent/parsing/olicense.py | .py | 417baaed493ceb8d | 7.42 | 6 |
"""
Parser for RLM.
"""
import re
from typing import Optional
from lm_agent.models import LicenseUsesItem
INT = r"\d+"
VERSION = rf"v{INT}\.{INT}"
HOSTWORD = r"[a-zA-Z0-9-]+"
HOSTWORD2 = r"[a-zA-Z0-9-.]+"
HOSTNAME = rf"{HOSTWORD}(\.{HOSTWORD2})*"
FEATURE_NAME = r"[\w-]+"
FEATURE_LINE = rf"^\s*(?P<license_feature>{F... | omnivector-solutions/license-manager | lm-agent/lm_agent/parsing/rlm.py | .py | a07d2e86e0ce7451 | 7.42 | 6 |
"""
DSLS license server interface.
"""
import typing
from lm_agent.config import settings
from lm_agent.exceptions import CommandFailedToExecute, LicenseManagerBadServerOutput
from lm_agent.logs import logger
from lm_agent.models import LicenseReportItem, LicenseServerSchema
from lm_agent.parsing import dsls
from lm_... | omnivector-solutions/license-manager | lm-agent/lm_agent/server_interfaces/dsls.py | .py | 7c86de39c2c77e63 | 7.42 | 6 |
"""
FlexLM license server interface.
"""
import typing
from buzz import check_expressions
from lm_agent.config import settings
from lm_agent.exceptions import CommandFailedToExecute, LicenseManagerBadServerOutput
from lm_agent.logs import logger
from lm_agent.models import LicenseReportItem, LicenseServerSchema
from... | omnivector-solutions/license-manager | lm-agent/lm_agent/server_interfaces/flexlm.py | .py | 585677b544537df1 | 7.42 | 6 |
"""Module for license server interface abstract base class."""
class LicenseServerInterface:
"""
Abstract base class for License Server interface.
The logic for obtaining the data output from the License Server should be encapsulated in
the ``get_output_from_server`` method.
After obtaining the ... | omnivector-solutions/license-manager | lm-agent/lm_agent/server_interfaces/license_server_interface.py | .py | db144df305ca6b3e | 7.42 | 6 |
"""
LM-X license server interface.
"""
import typing
from lm_agent.config import settings
from lm_agent.exceptions import CommandFailedToExecute, LicenseManagerBadServerOutput
from lm_agent.logs import logger
from lm_agent.models import LicenseReportItem, LicenseServerSchema
from lm_agent.parsing import lmx
from lm_a... | omnivector-solutions/license-manager | lm-agent/lm_agent/server_interfaces/lmx.py | .py | 91fe250e6b27d0ce | 7.42 | 6 |
"""
LS-Dyna license server interface.
"""
import typing
from lm_agent.config import settings
from lm_agent.exceptions import CommandFailedToExecute, LicenseManagerBadServerOutput
from lm_agent.logs import logger
from lm_agent.models import LicenseReportItem, LicenseServerSchema
from lm_agent.parsing import lsdyna
fro... | omnivector-solutions/license-manager | lm-agent/lm_agent/server_interfaces/lsdyna.py | .py | 459f7aa97d7b3777 | 7.42 | 6 |
"""
OLicense license server interface.
"""
import typing
from lm_agent.config import settings
from lm_agent.exceptions import CommandFailedToExecute, LicenseManagerBadServerOutput
from lm_agent.logs import logger
from lm_agent.models import LicenseReportItem, LicenseServerSchema
from lm_agent.parsing import olicense
... | omnivector-solutions/license-manager | lm-agent/lm_agent/server_interfaces/olicense.py | .py | cce74149dbda81b8 | 7.42 | 6 |
"""
RLM license server interface.
"""
import typing
from lm_agent.config import settings
from lm_agent.exceptions import CommandFailedToExecute, LicenseManagerBadServerOutput
from lm_agent.logs import logger
from lm_agent.models import LicenseReportItem, LicenseServerSchema
from lm_agent.parsing import rlm
from lm_ag... | omnivector-solutions/license-manager | lm-agent/lm_agent/server_interfaces/rlm.py | .py | 6e1ece7943ea7ab3 | 7.42 | 6 |
"""
Invoke license stat tools to build a view of license token counts.
"""
import asyncio
import typing
from lm_agent.backend_utils.utils import get_cluster_configs_from_backend, make_feature_update
from lm_agent.exceptions import LicenseManagerEmptyReportError, LicenseManagerNonSupportedServerTypeError
from lm_agent... | omnivector-solutions/license-manager | lm-agent/lm_agent/services/license_report.py | .py | 48607f8a18b5bd93 | 7.42 | 6 |
"""
Utilities that interact with Slurm.
"""
import re
from typing import Dict, List, Optional, Union
from lm_agent.config import settings
from lm_agent.exceptions import ScontrolRetrievalFailure, SqueueParserUnexpectedInputError
from lm_agent.logs import log_error, logger
from lm_agent.models import LicenseBooking
fr... | omnivector-solutions/license-manager | lm-agent/lm_agent/workload_managers/slurm/cmd_utils.py | .py | 7a64c1296f69d705 | 7.42 | 6 |
"""
Test the LM-X parser.
"""
from pytest import mark
from lm_agent.models import LicenseUsesItem
from lm_agent.parsing.lmx import parse, parse_feature_line, parse_in_use_line, parse_usage_line
def test_parse_feature_line():
"""
Does the regex for the feature line match the lines in the output?
The line... | omnivector-solutions/license-manager | lm-agent/tests/parsing/test_lmx.py | .py | be68b678885ade68 | 7.92 | 6 |
"""
Test the LS-Dyna parser.
"""
from lm_agent.models import LicenseUsesItem
from lm_agent.parsing.lsdyna import parse, parse_program_line, parse_total_line, parse_usage_line
def test_parse_program_line():
"""
Does the regex for the program line match the lines in the output?
The line contains:
- pro... | omnivector-solutions/license-manager | lm-agent/tests/parsing/test_lsdyna.py | .py | eccfadd08f7b824e | 7.92 | 6 |
"""
Test the OLicense parser.
"""
from lm_agent.models import LicenseUsesItem
from lm_agent.parsing.olicense import parse, parse_feature_line, parse_in_use_line, parse_usage_line
def test_parse_feature_line():
"""
Does the regex for the feature line match the lines in the output?
The line contains:
-... | omnivector-solutions/license-manager | lm-agent/tests/parsing/test_olicense.py | .py | e99db0aedb9be832 | 7.92 | 6 |
"""
Test the RLM parser.
"""
from pytest import mark
from lm_agent.models import LicenseUsesItem
from lm_agent.parsing.rlm import parse, parse_count_line, parse_feature_line, parse_usage_line
def test_parse_feature_line():
"""
Does the regex for the feature line match the lines in the output?
The line c... | omnivector-solutions/license-manager | lm-agent/tests/parsing/test_rlm.py | .py | 162d98efe61c823d | 7.92 | 6 |
__author__ = "Matteo Lulli"
__copyright__ = "Copyright (c) 2020-2022 Matteo Lulli (lullimat/idea.deploy), matteo.lulli@gmail.com"
__credits__ = ["Matteo Lulli"]
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Softwa... | lullimat/idea.deploy | idpy/CTypes/CTypes.py | .py | c78fdd06e20913f4 | 7.48 | 8 |
__author__ = "Matteo Lulli"
__copyright__ = "Copyright (c) 2020-2026 Matteo Lulli (lullimat/idea.deploy), matteo.lulli@gmail.com"
__credits__ = ["Matteo Lulli"]
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Softwa... | lullimat/idea.deploy | idpy/IdpyCode/test_residency.py | .py | f503a15a5f6ef6aa | 7.98 | 8 |
__author__ = "Matteo Lulli"
__copyright__ = "Copyright (c) 2020-2026 Matteo Lulli (lullimat/idea.deploy), matteo.lulli@gmail.com"
__credits__ = ["Matteo Lulli"]
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Softwa... | lullimat/idea.deploy | idpy/IdpyCode/test_residency_policy.py | .py | 45db653a555cc50b | 7.98 | 8 |
"""
Provides a minimal interface for the use of pymetallic.
Method names, if shared, match those of idpy.CUDA.CUDA class.
Requires Apple Silicon (or Metal-capable macOS), Xcode/Swift toolchain,
and: pip install pymetallic
"""
__author__ = "Matteo Lulli"
__copyright__ = "Copyright (c) 2020-2023 Matteo Lulli (lullimat/... | lullimat/idea.deploy | idpy/Metal/Metal.py | .py | 7efd4d8674ddc171 | 7.48 | 8 |
#!/usr/bin/env python3
"""Smoke tests for MetalMemoryPool buffer reuse."""
import gc
import unittest
import numpy as np
from idpy.IdpyCode import idpy_langs_sys, METAL_T, GetTenet, IdpyMemory
@unittest.skipUnless(idpy_langs_sys.get(METAL_T, False), "Metal not available")
class TestMetalMemoryPool(unittest.TestCase... | lullimat/idea.deploy | idpy/Metal/test_memory_pool.py | .py | 62ca3cd4e0ed9ea7 | 7.98 | 8 |
# -*- coding: utf-8 -*-
# (C) Copyright IBM Corp. 2026.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | IBM/platform-services-python-sdk | test/integration/test_account_management_v4.py | .py | 49767b99f01798c5 | 8.1 | 15 |
# coding: utf-8
# Copyright 2020, 2022 IBM 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | IBM/platform-services-python-sdk | test/integration/test_case_management_v1.py | .py | 7d86fb8d5eb76765 | 8.1 | 15 |
import os
import shutil
import numpy as np
import warnings
import pytest
@pytest.fixture(scope="session")
def sim_path():
return os.path.join("tests", "accuracy_tests", "sim_for_alphapeel_accu_test")
def prepare_path(output_path):
"""
Prepare an empty output folder
"""
if os.path.exists(output_p... | AlphaGenes/AlphaImpute2 | tests/accuracy_tests/run_accu_test.py | .py | 8c777ce6bab3f0b4 | 8.09 | 14 |
import os
import subprocess
import numpy as np
def read_file(file_path, test_alt_allele_prob=False, **kwargs):
"""
INPUT:
file_path: str, the path of the file to be read
decimal_place(optional): if provided, round the data with the given
decimal places
OUTPUT:
values: 2d list of str, store... | AlphaGenes/AlphaImpute2 | tests/functional_tests/run_func_test.py | .py | 092f7fc58c3562ef | 8.09 | 14 |
from .hand.LeftHand import LeftHand
from .hand.RightHand import RightHand
from src.midi.midiToNote import calculate_frame
from typing import List
import json
class HandPoseRecorder():
"""
a recorder for hand pose. 一个手势记录器,用于记录左手指法
"""
def __init__(self) -> None:
self.handPoseList = []
... | highmore9501/fretDance | src/HandPoseRecorder.py | .py | 205d85177693fa0b | 7.65 | 19 |
import bpy # type: ignore
def add_wave_constraints():
"""
添加波浪约束,主要为头发或者裙子添加一些波浪效果
"""
# 获取当前选中的骨骼
obj = bpy.context.active_object
if obj is None or obj.type != 'ARMATURE':
print("请选中一个骨架对象")
return
armature = obj
bones = armature.data.bones
pose_bones = armature... | highmore9501/fretDance | src/fret_dance_addon/add_wave.py | .py | 668467fa88f3ee17 | 7.65 | 19 |
import bpy # type: ignore
import bmesh # type: ignore
import mathutils
def move_string(offset: float):
# 确保处于编辑模式
if bpy.context.object.mode != 'EDIT':
bpy.ops.object.mode_set(mode='EDIT')
# 获取 bmesh 对象
bm = bmesh.from_edit_mesh(bpy.context.object.data)
# 获取原始向量
original_vector = m... | highmore9501/fretDance | src/fret_dance_addon/tools/moveString.py | .py | 589d64c1b5ec2614 | 7.65 | 19 |
from .GuitarString import GuitarString
from .MusicNote import MusicNote
class GuitarNote:
"""
params:
guitarString: GuitarString object. 吉他弦对象
fret: Fret number. 品位
"""
def __init__(self, guitarString: GuitarString, fret: int):
self._guitarString: GuitarString = guitarString
s... | highmore9501/fretDance | src/guitar/GuitarNote.py | .py | 81e6f82f853fe17c | 7.65 | 19 |
from .MusicNote import MusicNote, KEYNOTES
from typing import List, Any
class GuitarString():
"""
params:
baseNote: Base note of the string. 弦的基音
stringIndex: Index of the string, starting with the highest pitch as string 0. 弦的索引,以最高音为0弦开始计算
"""
def __init__(self, baseNote: MusicNote, stringI... | highmore9501/fretDance | src/guitar/GuitarString.py | .py | 0e459ac0cf9440ef | 7.65 | 19 |
KEYNOTES: dict[str, int] = {
"C": 48,
"C#": 49,
"D": 50,
"D#": 51,
"E": 52,
"F": 53,
"F#": 54,
"G": 55,
"G#": 56,
"A": 45,
"A#": 46,
"B": 47
}
class MusicNote:
"""
params:
num: Number of notes, Calculated with C note (3rd fret on the 5th string of standard g... | highmore9501/fretDance | src/guitar/MusicNote.py | .py | 86d956bf8571cc8f | 7.65 | 19 |
from ..guitar.GuitarString import GuitarString
from ..guitar.Guitar import Guitar
from ..utils.utils import lerp_by_fret
import math
PRESSSTATE: dict = {
"Open": 0,
"Pressed": 1,
"Barre": 2,
"Partial_barre_2_strings": 3,
"Partial_barre_3_strings": 4,
"Keep": 5
}
FINGERS: dict = {
"Empty": ... | highmore9501/fretDance | src/hand/LeftFinger.py | .py | d3b6205650e6ac9f | 7.65 | 19 |
from typing import List, Dict, Any
from ..guitar.Guitar import Guitar
import numpy as np
from numpy import linalg
import itertools
from mathutils import Vector, Quaternion
def convertNotesToChord(notes: List[int], guitar: Guitar) -> Any:
"""
convert notes to a list of possible positions on the guitar. 将音符转换为吉... | highmore9501/fretDance | src/utils/utils.py | .py | e96042c7dde2adb6 | 7.65 | 19 |
import unittest
from src.utils.utils import verifyValidCombination
class TestUtils(unittest.TestCase):
def test_verifyValidCombination(self):
# 重复手指在不同品位
result = [
{'index': 4, 'fret': 3, 'finger': 1},
{'index': 3, 'fret': 2, 'finger': 1},
{'index': 2, 'fret': ... | highmore9501/fretDance | tests/testUtils.py | .py | f6fc4bf1092d213a | 7.15 | 19 |
# Copyright 2018 BMW Car IT GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | bmwcarit/zubbi | tests/conftest.py | .py | 0630c311db98da8c | 7.15 | 19 |
# Copyright 2018 BMW Car IT GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | bmwcarit/zubbi | tests/scraper/connections/test_gerrit.py | .py | 57fc259b2f53be7a | 7.15 | 19 |
# Copyright 2018 BMW Car IT GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | bmwcarit/zubbi | tests/scraper/connections/test_github.py | .py | 4432c0291025287e | 7.15 | 19 |
# Copyright 2018 BMW Car IT GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | bmwcarit/zubbi | tests/scraper/connections/test_init.py | .py | ca259d6f99d13ac5 | 7.15 | 19 |
# Copyright 2018 BMW Car IT GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | bmwcarit/zubbi | tests/scraper/test_integration.py | .py | c9c1815fd8293008 | 7.15 | 19 |
# Copyright 2018 BMW Car IT GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | bmwcarit/zubbi | tests/test_doc.py | .py | 62d5f649869aef89 | 7.15 | 19 |
import contextlib
import importlib
import os
import ssl
from unittest import mock
import elasticsearch
import pytest
import zubbi.models
from zubbi.models import (
ZUBBI_INDEX_PREFIX_ENV,
init_elasticsearch_con,
init_elasticsearch_documents,
)
ES_HOST = "http://127.0.0.1:9200"
ES_HOST_SSL = "https://127.... | bmwcarit/zubbi | tests/test_elasticsearch.py | .py | 85caf984856d9723 | 7.15 | 19 |
# Copyright 2018 BMW Car IT GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | bmwcarit/zubbi | tests/test_utils.py | .py | a650d4589b84e93a | 7.15 | 19 |
# Copyright 2018 BMW Car IT GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | bmwcarit/zubbi | tests/test_views.py | .py | d833f2566aed91e3 | 8.15 | 19 |
# Copyright 2018 BMW Car IT GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | bmwcarit/zubbi | zubbi/extensions.py | .py | 42d44c83d35e81dc | 7.65 | 19 |
# Copyright 2018 BMW Car IT GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | bmwcarit/zubbi | zubbi/models.py | .py | 9f96012447cceed6 | 7.65 | 19 |
# Copyright 2018 BMW Car IT GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | bmwcarit/zubbi | zubbi/scraper/connections/github.py | .py | 9e94a9b3a4ab7987 | 7.65 | 19 |
# Copyright 2018 BMW Car IT GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | bmwcarit/zubbi | zubbi/scraper/repo_parser.py | .py | 16202dd552b05330 | 7.65 | 19 |
# Copyright 2018 BMW Car IT GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | bmwcarit/zubbi | zubbi/scraper/repos/__init__.py | .py | 2c8ca718489eb277 | 7.65 | 19 |
# Copyright 2018 BMW Car IT GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | bmwcarit/zubbi | zubbi/scraper/repos/git.py | .py | 98c9bab240844f2f | 7.65 | 19 |
# Copyright 2018 BMW Car IT GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | bmwcarit/zubbi | zubbi/utils.py | .py | 53a381973e1aa197 | 7.65 | 19 |
# Copyright 2018 BMW Car IT GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | bmwcarit/zubbi | zubbi/views.py | .py | 4f4e7a44e7c3fb36 | 7.65 | 19 |
"""Configure optional computational backends."""
from __future__ import annotations
import os
import sys
from dataclasses import dataclass
from importlib import import_module
from typing import TYPE_CHECKING, Literal, get_args
if TYPE_CHECKING:
from collections.abc import Callable
from types import ModuleTyp... | ComPWA/tensorwaves | src/tensorwaves/config.py | .py | 388f9f71b0509dda | 7.52 | 10 |
"""The `.data` module takes care of data generation."""
from __future__ import annotations
import logging
import numpy as np
from tqdm.auto import tqdm
from tensorwaves.interface import (
DataGenerator,
DataSample,
DataTransformer,
Function,
RealNumberGenerator,
)
from ._data_sample import (
... | ComPWA/tensorwaves | src/tensorwaves/data/__init__.py | .py | dbe5b06cf173fc8f | 7.52 | 10 |
"""Implementations of a `.DataGenerator` for four-momentum samples."""
from __future__ import annotations
import logging
from typing import TYPE_CHECKING
from tqdm.auto import tqdm
from tensorwaves.function._backend import raise_missing_module_error
from tensorwaves.interface import DataGenerator, DataSample, RealN... | ComPWA/tensorwaves | src/tensorwaves/data/phasespace.py | .py | eb7aa3c488f1f305 | 7.52 | 10 |
"""Implementations of `.RealNumberGenerator`."""
from __future__ import annotations
from typing import TYPE_CHECKING
import numpy as np
from tensorwaves.config import _tensorflow_precision
from tensorwaves.function._backend import raise_missing_module_error
from tensorwaves.interface import RealNumberGenerator
if ... | ComPWA/tensorwaves | src/tensorwaves/data/rng.py | .py | 70dc7d130c4bbba1 | 7.52 | 10 |
"""Implementations of `.DataTransformer`."""
from __future__ import annotations
from typing import TYPE_CHECKING
from attrs import field, frozen
from tensorwaves.function import PositionalArgumentFunction
from tensorwaves.function.sympy import _get_free_symbols, _lambdify_normal_or_fast
from tensorwaves.interface i... | ComPWA/tensorwaves | src/tensorwaves/data/transform.py | .py | f2ccb991cc362f1c | 7.52 | 10 |
"""Express mathematical expressions in terms of computational functions."""
from __future__ import annotations
import inspect
from typing import TYPE_CHECKING
import attrs
import numpy as np
from attrs import field, frozen
from tensorwaves.interface import (
DataSample,
Function,
ParameterValue,
Par... | ComPWA/tensorwaves | src/tensorwaves/function/__init__.py | .py | 94d50274b30699ea | 7.52 | 10 |
"""Utility to splice (flatten) and merge (unflatten) complex parameters for 'real-only' optimizers."""
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from collections.abc import Mapping
from tensorwaves.interface import ParameterValue
class ParameterFlattener:
""... | ComPWA/tensorwaves | src/tensorwaves/optimizer/parameter.py | .py | 6085269f2dc08d24 | 7.52 | 10 |
# Copyright 2019 Nicole Borrelli
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | hmsjayne/ffr-hmsj | doslib/rom.py | .py | d310c1fac7aefd2a | 7.5 | 9 |
# Copyright 2020 Nicole Borrelli
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | hmsjayne/ffr-hmsj | doslib/tripointertext.py | .py | da2ba4f59fe91786 | 7.5 | 9 |
# Copyright 2019 Nicole Borrelli
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | hmsjayne/ffr-hmsj | event/parseinputstring.py | .py | d92a8cd890c04eab | 7.5 | 9 |
# Copyright 2019 Nicole Borrelli
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | hmsjayne/ffr-hmsj | event/tests/test_codegen.py | .py | e6c796b963d1d5da | 8 | 9 |
# Copyright 2019 Nicole Borrelli
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | hmsjayne/ffr-hmsj | randomizer/ipsfile.py | .py | a55e7c288f2c462d | 7.5 | 9 |
# Copyright 2019 Nicole Borrelli
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | hmsjayne/ffr-hmsj | stream/outputstream.py | .py | 11a6d62761cd29bf | 7.5 | 9 |
"""
A simple Telegram bot that sends random dog pictures.
This code declares a Telegram bot that will reply every message with
a random dog picture.
Every picture is fetched through the Dog API (https://dog.ceo/dog-api/).
@author Andrés Ignacio Torres <dev@aitorres.com>
"""
import logging
import os
import random
fr... | aitorres/dogpicsbot | bot.py | .py | 8c1af44197fbcbe5 | 7.5 | 9 |
"""
Unit tests for the functions and classes implemented for the DogPicsBot.
@author Andrés Ignacio Torres <dev@aitorres.com>
"""
from dataclasses import dataclass, field
from random import randint
from typing import List, Optional, Tuple
import pytest
from bot import (
DOG_SOUNDS,
DOGS_API_BREED_LIST_URL,
... | aitorres/dogpicsbot | tests.py | .py | 90df181ab6a8f516 | 7 | 9 |
from datasette import hookimpl, Forbidden
from datasette.permissions import Action
from datasette.tokens import TokenHandler
import itsdangerous
import json
import secrets
import sqlite_utils
import time
from markupsafe import Markup
from .views import (
create_api_token,
check_permission,
tokens_index,
... | simonw/datasette-auth-tokens | datasette_auth_tokens/__init__.py | .py | e2145825499760fb | 7.6 | 15 |
from datasette_auth_tokens.migrations import migration
import sqlite_utils
OLD_CREATE_TABLES_SQL = """
CREATE TABLE _datasette_auth_tokens (
id INTEGER PRIMARY KEY,
token_status TEXT DEFAULT 'L', -- [L]ive, [R]evoked, [E]xpired
description TEXT,
actor_id TEXT,
permissions TEXT,
created_timestam... | simonw/datasette-auth-tokens | tests/test_migrations.py | .py | 01eb4fa1733ccae0 | 7.1 | 15 |
class AttrDisplay:
"""Provides a string representation for objects based on their attributes.
This class offers a `__repr__` method that generates a dictionary-like
string representation of an object's public attributes (those not starting
with '_') and whose values are not None.
"""
def __rep... | rvcristiand/pymas | src/pymas/classtools.py | .py | 016597bf4f923ed3 | 7.48 | 8 |
"""
Tests for the Frame class.
A Frame is a 2-node element with axial, shear, and bending stiffness
(rigid connections). It has 6 degrees of freedom per joint in 3D.
The Frame class extends Truss with bending stiffness:
- Axial deformation (local x)
- Shear deformation (local y, z)
- Bending (about local ... | rvcristiand/pymas | tests/test_frame.py | .py | 395dcb7c2c450534 | 7.98 | 8 |
"""
Tests for the Joint class.
A Joint represents a node in the structural model with spatial coordinates (x, y, z).
Joints define the endpoints of structural elements (trusses, frames) and can have
supports and loads applied to them.
Typical usage:
structure = Structure()
joint = structure.add_joint('N1', x=... | rvcristiand/pymas | tests/test_joint.py | .py | 453defe56858f5c1 | 7.98 | 8 |
"""
Tests for load-related classes.
This module tests:
- LoadPattern: Groups loads that act simultaneously
- JointPointLoad: Force/moment applied directly to a joint
- ElementPointLoad: Force/moment applied to an element at a specific distance
- DistributedLoad: Uniformly distributed load along an elem... | rvcristiand/pymas | tests/test_load_pattern.py | .py | 812daef4cc30daa7 | 7.98 | 8 |
"""
Tests for the Material class.
The Material class represents a linear elastic material with elastic modulus (E)
and shear modulus (G) properties. It is used to define the material properties
of structural elements like trusses and frames.
Typical usage:
structure = Structure()
material = structure.add_mate... | rvcristiand/pymas | tests/test_material.py | .py | c1c77d6388a2cf64 | 7.98 | 8 |
"""
Tests for the Structure class.
The Structure class is the main class in pymas for modeling and analyzing
structural systems using the Direct Stiffness Method.
Structure types:
- '3D': 6 DOF per joint (ux, uy, uz, rx, ry, rz)
- '3D truss': 3 DOF per joint (ux, uy, uz)
- 'beam': 2 DOF per joint (uy, rz)... | rvcristiand/pymas | tests/test_structure.py | .py | 1e7fb12cfb5d35d7 | 7.98 | 8 |
"""
Tests for the Support class.
A Support defines boundary conditions at a joint, specifying which degrees of freedom
are restrained. Supports prevent translation and/or rotation at a joint.
Degrees of freedom in 3D:
- Translational: ux, uy, uz (translation along x, y, z axes)
- Rotational: rx, ry, rz (rotat... | rvcristiand/pymas | tests/test_support.py | .py | 12885d02f37c6600 | 7.98 | 8 |
"""
Tests for the Truss class.
A Truss is a linear element that transmits axial force only (hinged connections at both ends).
It has 3 degrees of freedom per joint in 3D: ux, uy, uz.
Key methods:
- length(): Element length between joints
- direction_cosines_vector(): Unit vector along truss axis
- rotatio... | rvcristiand/pymas | tests/test_truss.py | .py | 71c80a0988baae9a | 7.98 | 8 |
#!/usr/bin/env python3
"""
Docstring Extractor
This script extracts docstrings from Python files in a specified directory
and generates a README.md file with the documentation.
chmod +x docstring_extractor.py
Usage:
python docstring_extractor.py [directory] [--output README.md]
# Basic usage (current directo... | rongmon/rbcodes | docs/docstring_extractor.py | .py | d2676ddf0d3c00d3 | 7.54 | 11 |
'''
Absorber
Inputs:
flux; wave; error; linelist; redshift; bin
1st. Asborber will bin the flux,wave and error to clean the data
2nd. will pull the actual lamd_rest from the atom.dat file for all lines
-->this (2nd) will return a dictionary of lamd_rest,ion_name,fval,gamma
3rd. Initialized entries for the Vstack... | rongmon/rbcodes | src/rbcodes/GUIs/abstools/Absorber.py | .py | 252dc5642a63de28 | 7.54 | 11 |
import os
import json
import glob
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
def load_abstools_json(json_file):
"""Load an AbsTools JSON file and return the ions dictionary"""
# Custom JSON decoder to handle special types
def json_object_hook(obj):
if "_type" in obj:
... | rongmon/rbcodes | src/rbcodes/GUIs/abstools/batch_process_abstools.py | .py | a28fb32e461fe713 | 7.54 | 11 |
"""
Equivalent Width module for the absorption line analysis toolbox.
This module handles the calculation of equivalent widths, column densities,
and other line measurements.
Enhanced with improved error handling and signal-slot communication.
"""
import numpy as np
from rbcodes.IGM import compute_EW
from rbcodes.GUIs... | rongmon/rbcodes | src/rbcodes/GUIs/abstools/equivalent_width.py | .py | 36df7068893f6d85 | 7.54 | 11 |
import json
import numpy as np
import matplotlib.pyplot as plt
import numpy.polynomial.legendre as L
def load_abstools_analysis(json_file):
"""
Load an AbsTools JSON analysis file and return the data as a dictionary
Parameters:
-----------
json_file : str
Path to the JSON file saved fr... | rongmon/rbcodes | src/rbcodes/GUIs/abstools/extract_abstools_data.py | .py | d6e086eb0dac5653 | 7.54 | 11 |
import json
import numpy as np
import pandas as pd
def extract_measurements_table(json_file):
"""
Extract measurements from an AbsTools JSON file into a pandas DataFrame
Parameters:
-----------
json_file : str
Path to the JSON file saved from AbsTools
Returns:
--------... | rongmon/rbcodes | src/rbcodes/GUIs/abstools/extract_abstools_measurements.py | .py | 7a0a0d4d86599ac6 | 7.54 | 11 |
"""
Utilities for handling intervening absorption lines.
This module provides functions for reading and plotting
intervening absorption line data.
"""
import numpy as np
import pandas as pd
from rbcodes.GUIs.abstools.config import SPEED_OF_LIGHT, COLORS
from rbcodes.GUIs.abstools.config import shift2vel
def grab_inte... | rongmon/rbcodes | src/rbcodes/GUIs/abstools/intervening_utils.py | .py | d6f1c4fe585e8785 | 7.54 | 11 |
"""
JSON saving and loading functionality for the absorption line analysis toolbox.
This module provides functions to save and load analysis data in JSON format.
"""
import json
import numpy as np
import os
from datetime import datetime
class NumPyJSONEncoder(json.JSONEncoder):
"""
Custom JSON encoder that ha... | rongmon/rbcodes | src/rbcodes/GUIs/abstools/json_utils.py | .py | 176b8969cfdec18b | 7.54 | 11 |
#!/usr/bin/env python
"""
Simplified AbsTools Launcher - Entry point for the Absorption Line Analysis Toolbox.
This script provides a convenient entry point for launching the AbsTools
wrapper GUI, with improved process isolation.
Usage:
python simplified_abstools_launcher.py
"""
import sys
import os
import trace... | rongmon/rbcodes | src/rbcodes/GUIs/abstools/simplified_abstools_launcher.py | .py | d6a6c43034f0967b | 7.54 | 11 |
"""
Cube collapse functions — whitelight, narrowband, continuum-subtracted.
Phase 3 implements build_whitelight.
Phases 8+ add build_narrowband and build_continuum_sub.
"""
import warnings
import numpy as np
def build_whitelight(flux, wave, wmin=None, wmax=None, method='mean'):
"""
Collapse a 3-D flux cube a... | rongmon/rbcodes | src/rbcodes/GUIs/ifuviewer/processing/cube_collapse.py | .py | fc1f18fcbaa85e07 | 7.54 | 11 |
"""Platform for switch integration."""
import logging
from typing import Any
from homeassistant.components.button import ButtonEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import STATE_ON
from homeassistant.core import HomeAssistant
from homeassistant.helpers.device_registry im... | toscano/hass-autonomic | custom_components/autonomic/button.py | .py | b3e766bc88cef726 | 7.45 | 7 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.