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
#!/usr/bin/env python3 """Parse Apple Health export.zip / export.xml sleep data. Stats mode (default) reports what's in the export without touching anything. --out writes VictoriaMetrics /api/v1/import JSON-lines; --url POSTs them. Stdlib only. Usage: ./apple_health_sleep.py ~/Downloads/export.zip ./apple_hea...
nklmilojevic/home
scripts/apple-health-sleep-import.py
.py
dc95e95aefa21c03
7.54
11
#!/usr/bin/env -S uv run --script # /// script # requires-python = ">=3.11" # dependencies = ["websockets"] # /// """Backfill Oura-only sleep metrics from Home Assistant long-term statistics. Sleep score and breathing disturbance index have no Apple Health equivalent, so the export-based importer cannot produce them —...
nklmilojevic/home
scripts/ha-stats-sleep-backfill.py
.py
4f9805de0d112e5d
7.54
11
"""TencentBlueKing is pleased to support the open source community. 蓝鲸智云 - crypto-python-sdk (BlueKing - crypto-python-sdk) is made available by TencentBlueKing. Copyright (C) 2017-2023 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file e...
TencentBlueKing/crypto-python-sdk
bkcrypto/asymmetric/ciphers/base.py
.py
4f80d8deae041aa5
7.48
8
"""TencentBlueKing is pleased to support the open source community. 蓝鲸智云 - crypto-python-sdk (BlueKing - crypto-python-sdk) is made available by TencentBlueKing. Copyright (C) 2017-2023 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file e...
TencentBlueKing/crypto-python-sdk
bkcrypto/asymmetric/configs.py
.py
3964d1a08222bec4
7.48
8
"""TencentBlueKing is pleased to support the open source community. 蓝鲸智云 - crypto-python-sdk (BlueKing - crypto-python-sdk) is made available by TencentBlueKing. Copyright (C) 2017-2023 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file e...
TencentBlueKing/crypto-python-sdk
bkcrypto/asymmetric/interceptors.py
.py
a6fb3aa52487f321
7.48
8
"""TencentBlueKing is pleased to support the open source community. 蓝鲸智云 - crypto-python-sdk (BlueKing - crypto-python-sdk) is made available by TencentBlueKing. Copyright (C) 2017-2023 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file e...
TencentBlueKing/crypto-python-sdk
bkcrypto/asymmetric/options.py
.py
70fbee02cd46445d
7.48
8
"""TencentBlueKing is pleased to support the open source community. 蓝鲸智云 - crypto-python-sdk (BlueKing - crypto-python-sdk) is made available by TencentBlueKing. Copyright (C) 2017-2023 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file e...
TencentBlueKing/crypto-python-sdk
bkcrypto/constants.py
.py
59972297bd2ac8be
7.48
8
"""TencentBlueKing is pleased to support the open source community. 蓝鲸智云 - crypto-python-sdk (BlueKing - crypto-python-sdk) is made available by TencentBlueKing. Copyright (C) 2017-2023 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file e...
TencentBlueKing/crypto-python-sdk
bkcrypto/contrib/django/fields.py
.py
eec48e6b0141c39b
7.48
8
"""TencentBlueKing is pleased to support the open source community. 蓝鲸智云 - crypto-python-sdk (BlueKing - crypto-python-sdk) is made available by TencentBlueKing. Copyright (C) 2017-2023 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file e...
TencentBlueKing/crypto-python-sdk
bkcrypto/contrib/django/init_configs.py
.py
d7c15b52c3944107
7.48
8
"""TencentBlueKing is pleased to support the open source community. 蓝鲸智云 - crypto-python-sdk (BlueKing - crypto-python-sdk) is made available by TencentBlueKing. Copyright (C) 2017-2023 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file e...
TencentBlueKing/crypto-python-sdk
bkcrypto/contrib/django/selectors.py
.py
5f131c713f4b759d
7.48
8
"""TencentBlueKing is pleased to support the open source community. 蓝鲸智云 - crypto-python-sdk (BlueKing - crypto-python-sdk) is made available by TencentBlueKing. Copyright (C) 2017-2023 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file e...
TencentBlueKing/crypto-python-sdk
bkcrypto/contrib/django/settings.py
.py
61421f12cd43dfbb
7.48
8
"""TencentBlueKing is pleased to support the open source community. 蓝鲸智云 - crypto-python-sdk (BlueKing - crypto-python-sdk) is made available by TencentBlueKing. Copyright (C) 2017-2023 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file e...
TencentBlueKing/crypto-python-sdk
bkcrypto/symmetric/ciphers/base.py
.py
79cdc622485a6879
7.48
8
"""TencentBlueKing is pleased to support the open source community. 蓝鲸智云 - crypto-python-sdk (BlueKing - crypto-python-sdk) is made available by TencentBlueKing. Copyright (C) 2017-2023 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file e...
TencentBlueKing/crypto-python-sdk
bkcrypto/symmetric/configs.py
.py
602b1a6465fff4d8
7.48
8
"""TencentBlueKing is pleased to support the open source community. 蓝鲸智云 - crypto-python-sdk (BlueKing - crypto-python-sdk) is made available by TencentBlueKing. Copyright (C) 2017-2023 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file e...
TencentBlueKing/crypto-python-sdk
bkcrypto/symmetric/options.py
.py
d63286469fc5acb5
7.48
8
"""TencentBlueKing is pleased to support the open source community. 蓝鲸智云 - crypto-python-sdk (BlueKing - crypto-python-sdk) is made available by TencentBlueKing. Copyright (C) 2017-2023 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file e...
TencentBlueKing/crypto-python-sdk
bkcrypto/utils/base_interceptors.py
.py
82cc541aa44c0f37
7.48
8
"""TencentBlueKing is pleased to support the open source community. 蓝鲸智云 - crypto-python-sdk (BlueKing - crypto-python-sdk) is made available by TencentBlueKing. Copyright (C) 2017-2023 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file e...
TencentBlueKing/crypto-python-sdk
bkcrypto/utils/module_loding.py
.py
beb0776ac7838f13
7.48
8
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from bs4 import BeautifulSoup import os """ 将HTML文件转换为Markdown文件 使用BeautifulSoup解析HTML内容,并提取纯文本。 输出文件名与输入文件相同,但后缀改为 .md。 """ def html_to_text(html_content: str) -> str: """ 将 HTML 内容转换为纯文本 """ soup = BeautifulSoup(html_content, "html.parser") text = s...
atomeocean/job-compass
scripts/convert_html_to_markdown.py
.py
195f940388b4afb8
7.62
16
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ 根据目标目录下的全部Markdown 文件自动生成overview.md文件。 本地使用,自动生成指定目录的overview文件 """ from __future__ import annotations import argparse import json import re import sys from datetime import date from pathlib import Path from typing import Any REPO_IMPORT_ROOT = Path(__file__).reso...
atomeocean/job-compass
scripts/generate_folder_overview.py
.py
32f8a8c4ebcb1adc
7.62
16
import subprocess import re def get_modified_md_files(): """ 获取本次 PR 修改的 Markdown 文件(新增或修改) """ print("➡️ 调用 get_modified_md_files() ...") result = subprocess.run( ["git", "diff", "--diff-filter=AM", "--name-only", "origin/main...HEAD"], capture_output=True, text=True ) prin...
atomeocean/job-compass
scripts/git-actions/add_last_updated_to_md.py
.py
fde48c1b722d860f
7.62
16
""" 用于处理传递进来的pr数据,将其封装为需要记录的json对象 """ import json import argparse from scripts.utils.json_utils import read_json_file from scripts.utils.path_utils import get_project_root # 获取项目根目录 PROJECT_ROOT = get_project_root() # 设置pr_record模版路径 PR_RECORD_TEMPLATE_PATH = PROJECT_ROOT / "templates/pr_record.json" def parse_pr_...
atomeocean/job-compass
scripts/parse_pr_payload.py
.py
75d0c61610ca66ca
7.62
16
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ 下载visa_solution_company_json信息到本地Json目录下 """ from scripts.utils.rsync_downloader import sync_remote_folder from scripts.utils.path_utils import get_project_root # 配置信息需要本地创建config.py文件 from scripts.utils.config import ( REMOTE_1030_VISA_SOLUTION_COMPANY_JSON_DIR ...
atomeocean/job-compass
scripts/pull_visa_solution_company_json.py
.py
6f322dc1f1adb956
7.62
16
""" 同步文档创建日期的脚本 为/docs目录下所有Markdown文档的frontmatter添加创建日期 创建日期为该文档第一条git提交记录的日期(支持追踪文件重命名) """ import os import subprocess import logging from pathlib import Path import re from scripts.utils.logging_utils import setup_logging setup_logging() # 项目根目录的深度(从当前脚本目录向上追溯的层级数) PROJECT_ROOT_DEPTH = 1 PROJECT_ROOT = Path(__fil...
atomeocean/job-compass
scripts/sync_git_created_date.py
.py
82a67a0bc6a904c4
7.62
16
""" 同步文档最后更新时间的脚本 为/docs目录下所有Markdown文档的frontmatter添加 lastUpdated lastUpdated 为该文档最后一次 git 提交的日期 """ import os import subprocess import logging from pathlib import Path import re from scripts.utils.logging_utils import setup_logging setup_logging() # 项目根目录的深度(从当前脚本目录向上追溯的层级数) PROJECT_ROOT_DEPTH = 1 PROJECT_ROOT = Pa...
atomeocean/job-compass
scripts/sync_git_last_updated.py
.py
4a5037797736067d
7.62
16
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ rsync文件夹同步公共模块 """ import os import subprocess from pathlib import Path from typing import Union, Optional, List from scripts.utils.config import ( REMOTE_SERVER_1030_HOST, REMOTE_SERVER_1030_PORT, REMOTE_SERVER_1030_USER, SSH_PRIVATE_KEY_PATH_1030 ) ...
atomeocean/job-compass
scripts/utils/rsync_downloader.py
.py
12c020a7064798a0
7.62
16
# Copyright 2023 ACCESS-NRI and contributors. See the top-level COPYRIGHT file for details. # SPDX-License-Identifier: Apache-2.0 """ Aliasing support for intake catalogs to provide user-friendly field names and value mappings. RATIONALE --------- This module provides aliasing functionality to make ACCESS-NRI data mo...
ACCESS-NRI/access-nri-intake-catalog
src/access_nri_intake/aliases.py
.py
16b90e85b255e0d6
7.59
14
# Copyright 2023 ACCESS-NRI and contributors. See the top-level COPYRIGHT file for details. # SPDX-License-Identifier: Apache-2.0 """Manager for adding/updating intake sources in an intake-dataframe-catalog like the ACCESS-NRI catalog""" from pathlib import Path from typing import Any import intake from intake_dataf...
ACCESS-NRI/access-nri-intake-catalog
src/access_nri_intake/catalog/manager.py
.py
8d5b41a823d0b76d
7.59
14
from collections.abc import Callable from functools import wraps import pandas as pd def _to_tuple(series: pd.Series) -> pd.Series: """ Make each entry in the provided series a tuple Parameters ---------- series: :py:class:`~pandas.Series` A pandas Series or another object with an `apply...
ACCESS-NRI/access-nri-intake-catalog
src/access_nri_intake/catalog/utils.py
.py
0016969ad378b006
7.59
14
# Copyright 2024 ACCESS-NRI and contributors. See the top-level COPYRIGHT file for details. # SPDX-License-Identifier: Apache-2.0 import re import warnings from pathlib import Path import yaml from ..utils import get_catalog_fp from . import CATALOG_NAME_FORMAT CATALOG_PATH_REGEX = r"^(?P<rootpath>.*?)\{\{version\}...
ACCESS-NRI/access-nri-intake-catalog
src/access_nri_intake/data/utils.py
.py
64f1de944055dc3f
7.59
14
import ast from dataclasses import dataclass, field from inspect import signature from pathlib import Path from typing import Any import pandas as pd from intake_esm.core import esm_datastore from pandas.testing import assert_frame_equal from ..source.builders import Builder from .colours import f_reset, f_success, f...
ACCESS-NRI/access-nri-intake-catalog
src/access_nri_intake/experiment/utils.py
.py
becb47c2a45c1576
7.59
14
# Copyright 2023 ACCESS-NRI and contributors. See the top-level COPYRIGHT file for details. # SPDX-License-Identifier: Apache-2.0 """Shared utilities for writing Intake-ESM builders and their parsers""" import re import warnings from typing import Any import libcst as cst from intake_esm import esm_datastore from IP...
ACCESS-NRI/access-nri-intake-catalog
src/access_nri_intake/ipython_magic/ast.py
.py
13ad17153d682c7d
7.59
14
# Copyright 2023 ACCESS-NRI and contributors. See the top-level COPYRIGHT file for details. # SPDX-License-Identifier: Apache-2.0 """Shared utilities for writing Intake-ESM builders and their parsers""" import pickle import re import warnings from collections.abc import Iterable from dataclasses import asdict, datacl...
ACCESS-NRI/access-nri-intake-catalog
src/access_nri_intake/source/utils.py
.py
ae6c0d21ab4065ee
7.59
14
# Copyright 2023 ACCESS-NRI and contributors. See the top-level COPYRIGHT file for details. # SPDX-License-Identifier: Apache-2.0 """General utility functions for access-nri-intake""" import json from importlib import resources as rsr from pathlib import Path from warnings import warn import jsonschema import yaml ...
ACCESS-NRI/access-nri-intake-catalog
src/access_nri_intake/utils.py
.py
5623aa89b4a6c37b
7.59
14
# Copyright 2023 ACCESS-NRI and contributors. See the top-level COPYRIGHT file for details. # SPDX-License-Identifier: Apache-2.0 from datetime import datetime from pathlib import Path import pytest from IPython.testing.globalipapp import get_ipython here = Path(__file__).parent @pytest.fixture(scope="session") de...
ACCESS-NRI/access-nri-intake-catalog
tests/conftest.py
.py
2ac168c8bf7f89b2
7.09
14
"""Tests for the AST module""" from unittest import mock import intake import pytest from access_nri_intake.ipython_magic import ( MissingStorageError, MissingStorageWarning, check_storage_enabled, ) @pytest.mark.parametrize( "func", [ "to_dataset_dict", "to_dask", "to_d...
ACCESS-NRI/access-nri-intake-catalog
tests/test_ast_magic.py
.py
21abd14f4a3a6ac4
7.09
14
# Copyright 2023 ACCESS-NRI and contributors. See the top-level COPYRIGHT file for details. # SPDX-License-Identifier: Apache-2.0 import json import logging import os from pathlib import Path from unittest import mock import polars as pl import pytest from access_nri_intake.cloud import CatalogMirror, mirror_catalog...
ACCESS-NRI/access-nri-intake-catalog
tests/test_cloud.py
.py
dd686f8e97e536ca
8.09
14
import packaging.version def test_intake_esm_fork(): """ Make sure intake_esm version > 2025.7.9, ~= we are on our bleeding edge fork """ import intake_esm assert packaging.version.Version( intake_esm.__version__ ) > packaging.version.Version("2025.9.10") def test_ecgtools_fork(): ...
ACCESS-NRI/access-nri-intake-catalog
tests/test_environ.py
.py
6fff7db0053b504c
8.09
14
# Copyright 2023 ACCESS-NRI and contributors. See the top-level COPYRIGHT file for details. # SPDX-License-Identifier: Apache-2.0 import shutil from pathlib import Path import pandas as pd import pytest from intake_esm import esm_datastore from access_nri_intake.experiment.core import find_esm_datastore, use_datast...
ACCESS-NRI/access-nri-intake-catalog
tests/test_experiment.py
.py
a28b2bba974a1564
7.09
14
# Copyright 2023 ACCESS-NRI and contributors. See the top-level COPYRIGHT file for details. # SPDX-License-Identifier: Apache-2.0 from unittest import mock from warnings import warn import yaml import pytest from intake_dataframe_catalog.core import DfFileCatalogError from pandas.errors import EmptyDataError from pa...
ACCESS-NRI/access-nri-intake-catalog
tests/test_manager.py
.py
ded221bd6db5fd99
7.09
14
# Copyright 2024 ACCESS-NRI and contributors. See the top-level COPYRIGHT file for details. # SPDX-License-Identifier: Apache-2.0 import glob from pathlib import Path from conftest import metadata_sources from access_nri_intake.cli import metadata_validate def pytest_generate_tests(metafunc): if "yamlfile" in ...
ACCESS-NRI/access-nri-intake-catalog
tests/test_metadata_sources.py
.py
cd5866b13a5a85b3
7.09
14
#!/usr/bin/env python3 """Discover ticker symbols represented by repo markdown files.""" from __future__ import annotations from pathlib import Path EXCLUDED_STEMS = {"README", "TEMPLATE"} def repo_root() -> Path: return Path(__file__).resolve().parents[2] def discover_tickers(root: Path | None = None) -> l...
refcell/capital
functions/common/tickers.py
.py
7c09cf8a899ae9bd
7.56
12
#!/usr/bin/env python3 """Build KNF (Knife River Corporation) 6-sheet valuation model.""" from openpyxl import Workbook from openpyxl.styles import Font, Alignment, Border, Side, PatternFill from openpyxl.utils import get_column_letter wb = Workbook() # Styles bold_font = Font(bold=True) header_font = Font(bold=True,...
refcell/capital
models/_build_KNF.py
.py
70c267f048c5de10
7.56
12
#!/usr/bin/env python3 """Build 6-sheet PEGA valuation model. Data as of June 18, 2026.""" import openpyxl from openpyxl.styles import Font, Alignment, Border, Side, PatternFill wb = openpyxl.Workbook() hdr_font = Font(bold=True, size=12) sub_font = Font(bold=True, size=10) title_font = Font(bold=True, size=14) tb = ...
refcell/capital
models/_build_PEGA.py
.py
f0f2e063daf87076
7.56
12
import os import json import datetime def setup_output_dir(video_hash): """ Sets up the output directory using the video hash and current timestamp. """ timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S") output_dir = os.path.join("outputs", f"{video_hash}_{timestamp}") os.makedirs(ou...
Nepomuceno/video-meme
video_meme/file_manipulation.py
.py
e798c41a0a0b6912
7.54
11
import os from tqdm import tqdm from faster_whisper import WhisperModel from moviepy import AudioFileClip def transcribe_audio(audio_path, model_size="base", device="auto"): """ Transcribes audio using the faster-whisper model. """ if not os.path.exists(audio_path): raise FileNotFoundError(f"...
Nepomuceno/video-meme
video_meme/transcription.py
.py
d446c678e4a955d5
7.54
11
import os import subprocess import random from tqdm import tqdm from moviepy import VideoFileClip from moviepy.video.io.VideoFileClip import VideoFileClip from moviepy.video.io.ffmpeg_tools import ffmpeg_extract_subclip from moviepy.video.compositing.CompositeVideoClip import concatenate_videoclips from moviepy.video.V...
Nepomuceno/video-meme
video_meme/video_manipulation.py
.py
d9ddaa9ebb154f95
7.54
11
"""ARPAbet to IPA, so ghost's own G2P can drive a neural backend. WHY THIS EXISTS --------------- Most small neural TTS models are trained on IPA phonemes produced by eSpeak-NG, which is GPLv3 and therefore viral for a shipped game. That is the single most common reason projects in this class cannot be used commercial...
0-5788719150923125/praxis
axis/ghost/voice_host/arpabet.py
.py
1751da86fa9fb3b1
7.63
17
#!/usr/bin/env python3 """Expose a Piper voice's duration predictor, so we get exact phoneme timings. A VITS model already decides how long every phoneme lasts - that is what the stochastic duration predictor does - but the exported ONNX graph keeps that tensor internal and returns only audio. Promoting it to a graph ...
0-5788719150923125/praxis
axis/ghost/voice_host/patch_alignment.py
.py
2b51ea07e3be0998
7.63
17
import logging import os os.environ["LIGHTEVAL_DISABLE_TQDM"] = "1" from pprint import pprint import datasets from transformers import AutoConfig, AutoModel, AutoModelForCausalLM, AutoTokenizer from transformers.models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from praxis import PraxisConfig, Prax...
0-5788719150923125/praxis
evaluation/run.py
.py
dcb8cd8b8f087dda
7.63
17
# MIT License # Copyright (c) 2024 The HuggingFace Team # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, ...
0-5788719150923125/praxis
evaluation/tasks/_template.py
.py
9612ac1b175271f2
7.63
17
"""Cut Cross-Entropy loss integration implementation for Praxis.""" from typing import Any, Dict, Optional import torch import torch.nn as nn from cut_cross_entropy import linear_cross_entropy from torch import Tensor from praxis.integrations.base import BaseIntegration class CutCrossEntropyLoss(nn.Module): de...
0-5788719150923125/praxis
integrations/cut_cross_entropy/main.py
.py
bbcf4d11aed3b9c0
7.63
17
"""Discord bot integration for Praxis.""" import asyncio import os import threading from typing import Any, Optional from praxis.integrations.base import BaseIntegration, IntegrationSpec # What one Discord turn is allowed to cost the TRAINING LOOP, which is where # queued generations are actually served (GenerationQ...
0-5788719150923125/praxis
integrations/discord/main.py
.py
db7fdb4fdbf0544a
7.63
17
"""Gun.js integration implementation for Praxis.""" import atexit import multiprocessing import random import subprocess import sys import time from collections import deque from pathlib import Path from queue import Empty, Full from typing import Any, Dict, Optional from praxis.integrations.base import BaseIntegrati...
0-5788719150923125/praxis
integrations/gun/main.py
.py
410b408a9ce5b461
7.63
17
"""NeuralLambda integration for Praxis.""" import argparse # Auto-register the neural controller when module is imported def _register_controller(): """Register neural controller in the global registry.""" try: from praxis.controllers import CONTROLLER_REGISTRY from .neural import NeuralCont...
0-5788719150923125/praxis
integrations/neurallambda/main.py
.py
8d6e57e584f0c994
7.63
17
"""NeuralController implementation for the neurallambda integration.""" import random from typing import Any, Dict, List, Optional, Tuple, TypeVar import torch import torch.nn as nn import torch.nn.functional as F from neurallambda.stack import StackState, initialize, push_pop_nop, read from torch import Tensor from...
0-5788719150923125/praxis
integrations/neurallambda/neural.py
.py
16413378aafa7f56
7.63
17
"""Ngrok integration class for Praxis.""" import asyncio import os import threading from typing import Any, Dict, Optional from praxis.integrations.base import BaseIntegration, IntegrationSpec # Host suffixes that identify a request arriving through the ngrok tunnel. NGROK_HOST_SUFFIXES = (".ngrok-free.app", ".ngrok...
0-5788719150923125/praxis
integrations/ngrok/main.py
.py
28714a717e78cd21
7.63
17
from typing import List, Union import torch from torch import Tensor, nn class JaggedSine(nn.Module): """Sum of sines at fixed frequencies and amplitudes. Returns ``sum(a_i * sin(f_i * x))`` for buffer-registered ``(f_i, a_i)`` pairs. A cheap fixed-spectrum periodic activation - no learnable params. ...
0-5788719150923125/praxis
praxis/activations/jagged_sine.py
.py
b8eaec9d2c048951
7.63
17
import math import torch import torch.nn.functional as F from torch import Tensor, nn class NMDA(nn.Module): """ Implements NMDA - an activation function which mimics N-methyl-D-aspartic acid receptors (NMDAR) in the brain. NMDAR-like nonlinearity shifts short-term working memory into long-term reference...
0-5788719150923125/praxis
praxis/activations/nmda.py
.py
c3b9bc433258af39
7.63
17
import torch from torch import Tensor, nn torch.pi = 3.1415926535897932 torch.pdiv2 = 1.570796326 # π/2 torch.pdiv4 = 0.785398163 # π/4 class PeriodicReLU(nn.Module): """ Stolen from here: https://github.com/AaltoML/PeriodicBNN/blob/main/python_codes/model.py """ def __init__(self): su...
0-5788719150923125/praxis
praxis/activations/periodic_relu.py
.py
eeb7c3ac7d6d0b48
7.63
17
# -*- coding:utf-8 -*- from collections import OrderedDict, defaultdict from itertools import chain import numpy as np import torch import torch.nn as nn from farlog import getLogger from funrec.layers.sequence import SequencePoolingLayer from funrec.layers.utils import concat_fun logger = getLogger("funrec") DEFA...
farfarfun/funrec
src/funrec/inputs/core.py
.py
94e331d93a5e1cfd
7.57
13
# -*- coding:utf-8 -*- import torch import torch.nn as nn from torch.nn import Module class Dice(Module): """The Data Adaptive Activation Function in DIN,which can be viewed as a generalization of PReLu and can adaptively adjust the rectified point according to distribution of input data. Input shape: ...
farfarfun/funrec
src/funrec/layers/activation.py
.py
c4f6dbdf4a08e5ef
7.57
13
import torch import torch.nn as nn import torch.nn.functional as F from funrec.layers.core import LocalActivationUnit class AttentionSequencePoolingLayer(nn.Module): """The Attentional sequence pooling operation used in DIN & DIEN. Arguments - **att_hidden_units**:list of positive integer, the attenti...
farfarfun/funrec
src/funrec/layers/sequence/attention.py
.py
260d9421e4d10d0e
7.57
13
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.utils.rnn import PackedSequence __all__ = [ "AGRUCell", "AUGRUCell", "DynamicGRU", ] class AGRUCell(nn.Module): """Attention based GRU (AGRU) Reference: - Deep Interest Evolution Network for Click-Through Rate...
farfarfun/funrec
src/funrec/layers/sequence/gru.py
.py
8b76e686edfe3537
7.57
13
# -*- coding:utf-8 -*- import numpy as np import torch def concat_fun(inputs, axis=-1): if len(inputs) == 1: return inputs[0] else: return torch.cat(inputs, dim=axis) def slice_arrays(arrays, start=None, stop=None): """Slice an array or list of arrays. This takes an array-like, or ...
farfarfun/funrec
src/funrec/layers/utils.py
.py
738b51120b73455f
7.57
13
# -*- coding:utf-8 -*- """ Reference: [1] Xiao J, Ye H, He X, et al. Attentional factorization machines: Learning the weight of feature interactions via attention networks[J]. arXiv preprint arXiv:1708.04617, 2017. (https://arxiv.org/abs/1708.04617) """ import torch from funrec.layers import FM, AFMLayer from...
farfarfun/funrec
src/funrec/models/p2017/afm/code.py
.py
5e5137afb1e39a72
7.57
13
# -*- coding:utf-8 -*- """ Reference: [1] Guo H, Tang R, Ye Y, et al. Deepfm: a factorization-machine based neural network for ctr prediction[J]. arXiv preprint arXiv:1703.04247, 2017.(https://arxiv.org/abs/1703.04247) """ import torch import torch.nn as nn from funrec.inputs import combined_dnn_input from funrec...
farfarfun/funrec
src/funrec/models/p2017/deepfm/code.py
.py
8e42b34653d1111e
7.57
13
from enum import Enum import panel as pn from pydantic import ConfigDict, Field from oold.model import LinkedBaseModel from oold.ui.panel.demo import OoldDemoEditor class Entity(LinkedBaseModel): model_config = ConfigDict( json_schema_extra={ "@context": { # aliases ...
OO-LD/oold-python
examples/linked_data_editor.py
.py
248ace49b89d9b7e
7.45
7
#!/usr/bin/env python """ Guard zensical.toml against Zensical's default Markdown extensions drifting. Why this exists: a project that declares ANY markdown_extensions REPLACES Zensical's default set instead of extending it. zensical/config.py reads them via config.get("markdown_extensions", DEFAULT_MARKDOWN_EXTE...
OO-LD/oold-python
scripts/check_markdown_extensions.py
.py
eb97b9d172a55979
7.45
7
#!/usr/bin/env python """ Compare pytest-benchmark results between baseline and current run. Use in CI/CD to detect performance regressions. Usage: python scripts/compare_benchmarks.py baseline.json current.json --threshold 1.5 """ import json import sys def load_benchmark_data(filepath: str) -> dict: """Lo...
OO-LD/oold-python
scripts/compare_benchmarks.py
.py
6cb5c72ab1025a9c
7.45
7
import contextlib import contextvars import getpass import logging from enum import Enum from pathlib import Path from typing import ClassVar from pydantic import BaseModel, SecretStr _logger = logging.getLogger(__name__) # Credential types class BaseCredential(BaseModel): """Abstract base class for credentia...
OO-LD/oold-python
src/oold/backend/auth.py
.py
99cb8f183608348a
7.45
7
import json import sqlite3 from pathlib import Path from typing import Any from oold.backend.interface import ( Backend, Condition, LinkedDataFormat, Query, QueryParam, ResolveParam, ResolveResult, StoreResult, apply_operator, ) class SimpleDictDocumentStore(Backend): """In-me...
OO-LD/oold-python
src/oold/backend/document_store.py
.py
c0cb4fc79c36ec21
7.45
7
"""The ``oold`` command line entry point. A thin group that currently hosts the validation commands and leaves room for future non-validation subcommands. The implementation lives in :mod:`oold.validation.cli`, reached through :func:`main` for ``oold`` and :func:`validate_main` for ``oold-validate``. The second name m...
OO-LD/oold-python
src/oold/cli.py
.py
32e1e3ea5dc3fc78
7.45
7
from nicegui.element import Element from nicegui.events import GenericEventArguments, Handler, handle_event from typing_extensions import Self from oold.model import LinkedBaseModel from oold.model.v1 import LinkedBaseModel as LinkedBaseModel_v1 # class JsonEditor(ui.element, class JsonEditor( Element, compo...
OO-LD/oold-python
src/oold/ui/nicegui/jsoneditor.py
.py
9eb9d8b30e8d4d29
7.45
7
#! pip install nicegui pyscss from pathlib import Path from nicegui import app, ui from oold.model import LinkedBaseModel from oold.ui.nicegui.jsoneditor import OswEditor class Item(LinkedBaseModel): """A sample item model.""" name: str = "Sample Item" description: str = "This is a sample item descript...
OO-LD/oold-python
src/oold/ui/nicegui/main.py
.py
2f461b6dcb31df6f
7.45
7
import json from pathlib import Path import panel as pn import param from panel.custom import AnyWidgetComponent from oold.model import LinkedBaseModel from oold.model.v1 import LinkedBaseModel as LinkedBaseModel_v1 pn.extension() bundled_assets_dir = Path(__file__).parent.parent.parent / "vue" / "dist" / "default"...
OO-LD/oold-python
src/oold/ui/panel/anywidget_vite/jsoneditor.py
.py
2cbc00eff20f98f2
7.45
7
import panel as pn from rdflib import Graph from oold.model import LinkedBaseModel from oold.model.v1 import LinkedBaseModel as LinkedBaseModel_v1 from oold.ui.panel import JsonEditor pn.extension("codeeditor") class OoldDemoEditor(pn.viewable.Viewer): def __init__( self, oold_model: type[Linked...
OO-LD/oold-python
src/oold/ui/panel/demo.py
.py
180568a1e50f8a50
7.45
7
import logging from pathlib import Path from typing import Any from datamodel_code_generator import load_yaml from datamodel_code_generator.model import pydantic as pydantic_v1_model from datamodel_code_generator.model import pydantic_v2 as pydantic_v2_model from datamodel_code_generator.parser.jsonschema import ( ...
OO-LD/oold-python
src/oold/utils/codegen.py
.py
b1198ddbf93cadc8
7.45
7
"""Utilities for working different enviroments like IPython/Jupyter notebooks.""" import ast import inspect import sys from collections.abc import Callable def is_running_in_ipython() -> bool: """Check if the code is running in an interactive environment like Jupyter or IPython.""" return "IPython" in sy...
OO-LD/oold-python
src/oold/utils/environment.py
.py
5567b2c745ce581b
7.45
7
import json from pyld import jsonld def jsonld_to_jsonld(graph: dict, transformation_context: dict) -> dict: """Applies OO-LD alias notation to transform JSON(-LD) documents Parameters ---------- graph input JSON(-LD) document to transform context transformation context, which co...
OO-LD/oold-python
src/oold/utils/transform.py
.py
1d61e2c1f7651de2
7.45
7
"""The deterministic per-feature compliance suite. Where the general workflow runs generic checks over any schema, this runs *fixtures with exact expected outcomes*, so it catches behaviour a generic check cannot express. A suite is a directory of JSON files, each holding a list of groups. A group is one of three sha...
OO-LD/oold-python
src/oold/validation/compliance.py
.py
0feea74cf9dca48b
7.45
7
"""Detection of cyclic scoped ``@context`` references. This module *detects*; it does not resolve. Context resolution lives in :mod:`~oold.validation.context_resolution` and the pyld document loader. A schema's ``@context`` can reference other schema files, both as a parent context and as a term's scoped context. Whe...
OO-LD/oold-python
src/oold/validation/context_graph.py
.py
c59d531814eb4432
7.45
7
"""Flattening an OO-LD ``@context`` chain into a plain JSON-LD context. Most checks reference a context *by URL* and let the document loader fetch it, which keeps relative IRIs resolving against the right base. An OO-LD schema is itself a valid JSON-LD remote context - per JSON-LD 1.1, a remote context document only n...
OO-LD/oold-python
src/oold/validation/context_resolution.py
.py
3bb66ec0d2c30ea7
7.45
7
"""Deriving a minimal JSON-LD frame from an OO-LD schema. Port of ``scripts/schema_to_frame.mjs`` from oold-schema. Compaction alone reconstructs literals and references from RDF, but an embedded object is flattened into a separate (blank) node, and compaction never re-nests a flat graph. Framing does. So a schema th...
OO-LD/oold-python
src/oold/validation/frame.py
.py
e2e316f13571a998
7.45
7
"""Checks on a committed instance document. Two checks: the instance validates against its schema, with ``format`` asserted rather than annotated; and the instance survives ``instance -> RDF -> instance`` unchanged. An instance names its schema with ``$schema``, resolved relative to the instance's own location, so a ...
OO-LD/oold-python
src/oold/validation/instance_checks.py
.py
873fe5e767b9d32a
7.45
7
"""A JSON-LD document loader backed by the schema resolver. This loader maps ``https://oo-ld.test/examples/<file>`` onto the directory under test, which is what makes relative ``@context`` entries resolve on disk. It additionally serves ``http(s)`` and ``file:`` references through :class:`~oold.validation.resolve.Reso...
OO-LD/oold-python
src/oold/validation/loader.py
.py
a811985761855408
7.45
7
"""Round-trip-safe ``@context`` pattern lint. Ports ``meta/oold-pattern-lint.schema.json`` plus ``scripts/pattern_lint.mjs`` from oold-schema. The lint has three parts, in two categories: **MUST (a failure).** * No term may coerce a literal to a datatype JSON encodes natively (``xsd:string``, ``xsd:boolean``, ``xs...
OO-LD/oold-python
src/oold/validation/pattern_lint.py
.py
2272b6fc5d623646
7.45
7
"""Top-level package for iranleague exporter.""" from __future__ import annotations import importlib.metadata from pathlib import Path from typing import Any import toml __package_version: str = "unknown" def get_package_version() -> str: """Find the version of this package. Returns: str: The ver...
hatamiarash7/iranleague-exporter
iranleague_exporter/__init__.py
.py
d1e724d90f6880b2
7.42
6
"""Configuration module for iranleague_exporter.""" from __future__ import annotations import os from dataclasses import dataclass, field from enum import Enum class LogLevel(str, Enum): """Log level enumeration.""" DEBUG = "DEBUG" INFO = "INFO" WARNING = "WARNING" ERROR = "ERROR" CRITICAL ...
hatamiarash7/iranleague-exporter
iranleague_exporter/config.py
.py
abb88b5394e3d3c2
7.42
6
"""Crawler module for fetching Iran football league match schedules.""" from __future__ import annotations import logging from datetime import datetime from typing import TYPE_CHECKING, Any import jdatetime import requests from bs4 import BeautifulSoup from requests.adapters import HTTPAdapter from slugify import sl...
hatamiarash7/iranleague-exporter
iranleague_exporter/crawler.py
.py
622c7faecd30f545
7.42
6
"""Main module for the Iran League exporter.""" from __future__ import annotations import asyncio import logging import secrets import sys import threading from contextlib import asynccontextmanager from datetime import UTC, datetime from typing import TYPE_CHECKING import uvicorn from fastapi import Depends, FastAP...
hatamiarash7/iranleague-exporter
iranleague_exporter/main.py
.py
204fdd2fb15ce3eb
7.42
6
"""Utils module for iranleague_exporter.""" from __future__ import annotations import logging import os from typing import overload @overload def get_env(key: str) -> str: ... @overload def get_env(key: str, default: str) -> str: ... @overload def get_env(key: str, default: None) -> str | None: ... def get_en...
hatamiarash7/iranleague-exporter
iranleague_exporter/utils.py
.py
30761eede4d3388f
7.42
6
"""Tests for the config module.""" import os import unittest from unittest.mock import patch from iranleague_exporter.config import ( AppConfig, AuthConfig, CrawlerConfig, HTTPConfig, Language, LogLevel, _get_float_env, _get_int_env, _get_language_env, _get_log_level_env, g...
hatamiarash7/iranleague-exporter
tests/test_config.py
.py
6df799c1a158347e
7.92
6
"""Tests for the main module.""" import os import unittest from unittest.mock import MagicMock, patch from fastapi import HTTPException from fastapi.testclient import TestClient from iranleague_exporter.config import reset_config from iranleague_exporter.main import ( app, matches_gauge, update_metrics, ...
hatamiarash7/iranleague-exporter
tests/test_main.py
.py
89c6cc75b56d790e
7.92
6
"""Tests for the utils module.""" import unittest from unittest.mock import patch from iranleague_exporter.utils import get_env class TestGetEnvFunction(unittest.TestCase): @patch.dict("os.environ", {"TEST_KEY": "test_value"}, clear=True) def test_env_variable_set(self): """Test when the environment...
hatamiarash7/iranleague-exporter
tests/test_utils.py
.py
4467737aec9aaf75
7.92
6
import json import math import os import time from abc import abstractmethod from PythonClient import airsim from PythonClient.multirotor.storage.storage_config import get_storage_service class AirSimApplication: # Parent class for all airsim client side mission and monitors def __init__(self): # Set ...
UAVLab-SLU/DRV_public
backend/PythonClient/multirotor/airsim_application.py
.py
a56327a3e51d977a
7.42
6
from PythonClient.multirotor.mission.fly_to_points import FlyToPoints from PythonClient.multirotor.wind_control.airsim_wind_controller import AirSimWindController import threading class BlockSShape(FlyToPoints): """ !!! Only designed for one drone and only for the block environment. !!! This mission is to...
UAVLab-SLU/DRV_public
backend/PythonClient/multirotor/mission/block_s_shape.py
.py
580501fe21a9bb3d
7.42
6
from PythonClient.multirotor.mission.fly_to_points import FlyToPoints from PythonClient.multirotor.util.geo.geo_util import GeoUtil class FlyToPointsGeo(FlyToPoints): """ Fly to points in geographic coordinates """ def __init__(self, target_drone="Default", speed=2, geo_points=None): super()....
UAVLab-SLU/DRV_public
backend/PythonClient/multirotor/mission/fly_to_points_geo.py
.py
6e1efc4e0649bada
7.42
6
import PythonClient.airsim as airsim from PythonClient.multirotor.socket.mission_streamer import MissionStreamer class StreamManager: """ StreamManager is a class that manages the streaming of data from each MissionStreamer. """ def __init__(self): self.client = airsim.MultirotorClient() ...
UAVLab-SLU/DRV_public
backend/PythonClient/multirotor/socket/stream_manager.py
.py
1209ceafa5a7a7de
7.42
6
""" This script is used to test the streaming of frames from AirSim to a web browser. It streams the default drone and first person view camera. """ from flask import Flask, render_template_string, Response import PythonClient.airsim as airsim import cv2 import numpy as np client = airsim.MultirotorClient() client.c...
UAVLab-SLU/DRV_public
backend/PythonClient/multirotor/socket/test.py
.py
5740e410ef908458
7.92
6
from PythonClient.multirotor.storage.abstract.storage_service import StorageServiceInterface from google.cloud import storage import base64 import os import json class GCSStorageService(StorageServiceInterface): """Concrete class for uploading to GCS.""" def __init__(self, bucket_name='your_bucket_name'): ...
UAVLab-SLU/DRV_public
backend/PythonClient/multirotor/storage/gcs_storage_service.py
.py
f437920f48265f1b
7.42
6
import requests import json from datetime import datetime from pathlib import Path import time import concurrent.futures class ThreatIntelCollector: def __init__(self): self.data_dir = Path(".") # Updated C2 Intel Feeds URLs self.c2_feeds = { "c2_trackers": "https://raw...
EnisAksu/Argonis
ArgonisIntel/argonisintel_v2.1.py
.py
1e092bd3f328de97
7.48
8