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
""" Departments domain service. Handles department and personnel directory data. """ from typing import Optional from thefuzz import fuzz from data_api.data.manager import nthudata JSON_PATH = "directory.json" FUZZY_SEARCH_THRESHOLD_DEPT = 80 FUZZY_SEARCH_THRESHOLD_PERSON = 80 FUZZY_SEARCH_THRESHOLD_PERSON_TITLE =...
NTHU-SA/NTHU-Data-API
src/data_api/domain/departments/services.py
.py
a10cb21a203e9433
7.57
13
"""Dining domain enums.""" from enum import Enum class DiningBuildingName(str, Enum): """Dining building names.""" 小吃部 = "小吃部" 水木生活中心 = "水木生活中心" 風雲樓 = "風雲樓" 綜合教學大樓_南大校區 = "綜合教學大樓(南大校區)" 其他餐廳 = "其他餐廳" class DiningScheduleName(str, Enum): """Schedule names for dining queries.""" tod...
NTHU-SA/NTHU-Data-API
src/data_api/domain/dining/enums.py
.py
0156a836a15019b6
7.57
13
""" Dining domain service. Handles business logic for dining data fetching and filtering. """ from datetime import datetime from typing import Optional from thefuzz import fuzz from data_api.data.manager import nthudata from data_api.domain.dining import enums JSON_PATH = "dining.json" FUZZY_SEARCH_THRESHOLD = 60 ...
NTHU-SA/NTHU-Data-API
src/data_api/domain/dining/services.py
.py
a45363255fde358b
7.57
13
# SPDX-License-Identifier: Apache-2.0 """ LangChain support for a create_stuff_documents_chain method for building a RAG chain which uses passes a 'documents' argument to the prompt and the model. This is important for chat models where you need to pass the `documents` argument in the request. It is also useful for c...
ibm-granite-community/utils
src/ibm_granite_community/langchain/chains/combine_documents/documents_chain.py
.py
ff9ca677e2a4548b
7.45
7
# SPDX-License-Identifier: Apache-2.0 """ LangChain support for creating prompt strings using the Transformers tokenizer's apply_chat_template method. This is useful for completion models where you need client-side prompt formatting so the fully-formatter prompt can be sent to the model. """ import json from collect...
ibm-granite-community/utils
src/ibm_granite_community/langchain/prompts/tokenizer_chat.py
.py
44425c3d5d3b77e8
7.45
7
# SPDX-License-Identifier: Apache-2.0 """ LangChain support utils methods. """ import uuid from collections import deque from collections.abc import Mapping, Sequence from typing import Any, cast from langchain_core.documents import Document from langchain_core.language_models import BaseLanguageModel, LanguageModel...
ibm-granite-community/utils
src/ibm_granite_community/langchain/utils.py
.py
88ad6443a2a8fbc2
7.45
7
# SPDX-License-Identifier: Apache-2.0 import importlib.util import os import textwrap from string import Formatter from dotenv import find_dotenv, load_dotenv # Function to check if the notebook is running in Google Colab def is_colab() -> bool: try: return importlib.util.find_spec("google.colab") is no...
ibm-granite-community/utils
src/ibm_granite_community/notebook_utils.py
.py
51e08be9bf45b0ef
7.45
7
import pandas as pd import os, sys, re, torch, json, glob, argparse, gc, ast, pickle import numpy as np from tqdm import tqdm from torch.utils.data import Dataset, DataLoader from scripts.vllm_engine import VllmClient from scripts.formatting_results import valid_json from scripts.negation import negation_detection_ba...
WGLab/PhenoGPT2
scripts/helpers.py
.py
58f6e57576370321
7.48
8
#!/usr/bin/env python3 """ Example usage: python scripts/evaluate_best_checkpoint.py \ /path/to/checkpoint_dir \ --output-file /path/to/output_file """ # Standard from pathlib import Path from typing import Optional import json # Third Party from rich import print from typing_extensions import Annotated impo...
instructlab/eval
scripts/evaluate_best_checkpoint.py
.py
a5d8d87497e61252
7.62
16
# Standard from typing import Dict, List, Tuple, TypedDict # First Party from instructlab.eval.mmlu import MMLUEvaluator SYSTEM_PROMPT = """I am, Red Hat® Instruct Model based on Granite 7B, an AI language model developed by Red Hat and IBM Research, based on the Granite-7b-base language model. My primary function is...
instructlab/eval
scripts/test_mmlu.py
.py
4e935e8bca51c2d8
8.12
16
# Standard from collections import defaultdict import json import os import typing as t # Third Party from lm_eval.evaluator import simple_evaluate from torch import cuda # Local from .evaluator import Evaluator class LongBenchResult(t.TypedDict, total=False): """Dict containing averages for each task type and ...
instructlab/eval
src/instructlab/eval/longbench.py
.py
223960edfc674f40
7.62
16
# SPDX-License-Identifier: Apache-2.0 """ MMLU - Massive Multitask Language Understanding https://en.wikipedia.org/wiki/MMLU https://arxiv.org/abs/2009.03300 """ # Standard from typing import Any, Dict, Optional, Union import os # Third Party from lm_eval.evaluator import simple_evaluate from lm_eval.tasks import Ta...
instructlab/eval
src/instructlab/eval/mmlu.py
.py
8b6c63ab7f07b325
7.62
16
# SPDX-License-Identifier: Apache-2.0 # Standard import concurrent.futures import json import os import time # Third Party import shortuuid import tqdm # Local from .logger_config import setup_logger from .mt_bench_common import ( bench_dir, chat_completion_openai, get_openai_client, load_questions, ...
instructlab/eval
src/instructlab/eval/mt_bench_answers.py
.py
3bf4f75adf33f1f3
7.62
16
# SPDX-License-Identifier: Apache-2.0 """ Common data structures and utilities. """ # Standard from typing import Optional, TypedDict import ast import dataclasses import json import os import re import time # Third Party import httpx import openai # First Party from instructlab.eval import exceptions # Local from ...
instructlab/eval
src/instructlab/eval/mt_bench_common.py
.py
171c22bcc23c753a
7.62
16
# SPDX-License-Identifier: Apache-2.0 """ Conversation prompt templates. """ # Standard from enum import IntEnum, auto from typing import Dict, List, Tuple, Union import dataclasses class SeparatorStyle(IntEnum): """Separator styles.""" ADD_COLON_SINGLE = auto() ADD_COLON_TWO = auto() ADD_COLON_SPAC...
instructlab/eval
src/instructlab/eval/mt_bench_conversation.py
.py
f782615c86bae3cf
7.62
16
# SPDX-License-Identifier: Apache-2.0 # Standard from concurrent.futures import ThreadPoolExecutor import os # Third Party from tqdm import tqdm import numpy as np import pandas as pd # First Party from instructlab.eval import exceptions # Local from .logger_config import setup_logger from .mt_bench_common import ( ...
instructlab/eval
src/instructlab/eval/mt_bench_judgment.py
.py
ec05b1b11f4a04db
7.62
16
# # SPDX-License-Identifier: Apache-2.0 # Standard from pathlib import Path from typing import TYPE_CHECKING, List, Optional, TypedDict # Third Party from langchain_community.chat_models import ChatOpenAI from openai import Client as OpenAIClient from openai.types.chat import ChatCompletionMessageParam from pandas imp...
instructlab/eval
src/instructlab/eval/ragas.py
.py
c42f0705a077e140
7.62
16
# Standard from typing import Any, Dict, List, Optional import json import os import pathlib # Third Party from lm_eval.evaluator import simple_evaluate # First Party from instructlab.eval.evaluator import Evaluator RULER_TASKS = [ "niah_single_1", "niah_single_2", "niah_single_3", "niah_multikey_1",...
instructlab/eval
src/instructlab/eval/ruler.py
.py
260c3b645e573d5f
7.62
16
# SPDX-License-Identifier: Apache-2.0 # Third Party import pytest # First Party from instructlab.eval.mt_bench_model_adapter import ( GraniteAdapter, MistralAdapter, get_conversation_template, get_model_adapter, ) MISTRAL_DEFAULT_MODEL_NAME = "mistral" EXAMPLE_MISTRAL_MODEL_PATHS = [ "mistral", ...
instructlab/eval
tests/test_mt_bench_model_adapter.py
.py
8d837f2b1708f35b
7.12
16
# SPDX-License-Identifier: Apache-2.0 # Standard from pathlib import Path from unittest.mock import MagicMock, patch import unittest # Third Party from pandas import DataFrame from ragas.callbacks import ChainRun from ragas.dataset_schema import EvaluationDataset, EvaluationResult # First Party from instructlab.eval....
instructlab/eval
tests/test_ragas.py
.py
ca934743d124fcda
7.12
16
from typing import Literal, Tuple, Optional, Union import numpy as np from numpy.typing import NDArray from .backend import ArrayBackend, backend_like @backend_like def _get_dpss_windows(n_winlen, NW, n_tapers, weight_type="unity", backend=None): tapers, eigns = backend.signal.windows.dpss( n_winlen, NW...
fncokg/pymultitaper
src/pymultitaper/spectral.py
.py
6565a37c29108194
7.95
7
# Copyright © 2025-2026, Empa. """Functions for getting the configuration settings.""" import json import logging import os from pathlib import Path from zoneinfo import ZoneInfo import platformdirs from tzlocal import get_localzone_name from aurora_cycler_manager.stdlib_utils import check_illegal_text logger = log...
EmpaEconversion/aurora-cycler-manager
aurora_cycler_manager/config.py
.py
03f636cb4b71e099
7.48
8
# Copyright © 2025-2026, Empa. """Daemon to update database, snapshot jobs and plots graphs. Updates database regularly and snapshots all jobs then analyses and plots graphs at specified times each day. Change the update time and snapshot times in the main block to suit your needs. """ import logging import sys impor...
EmpaEconversion/aurora-cycler-manager
aurora_cycler_manager/daemon.py
.py
06d96441bab9c18d
7.48
8
# Copyright © 2025-2026, Empa. """Functions for reading data from the aurora file structure. Functions like `get_cycling(sample_id)`, `get_eis(sample_id)` take a sample ID and return a polars dataframe with data. To get all of the data for a sample, `my_data = SampleDataBundle(sample_id)`, this bundles all of the tim...
EmpaEconversion/aurora-cycler-manager
aurora_cycler_manager/data_parse.py
.py
5ba3e2a5b4c52380
7.48
8
# Copyright © 2025-2026, Empa. """Harvest EC-lab .mpr files and convert to aurora-compatible parquet files. Define the machines to grab files from in the config.json file. Run the script to harvest and convert all mpr files. """ import json import logging import os from datetime import datetime, timezone from pathli...
EmpaEconversion/aurora-cycler-manager
aurora_cycler_manager/eclab_harvester.py
.py
461f76549dc0b23d
7.48
8
# Copyright © 2025, Empa. """Set up logging.""" import logging import sys class _NoMillisecondsFormatter(logging.Formatter): """Formatter that removes milliseconds from the timestamp.""" def formatTime(self, record: logging.LogRecord, datefmt: str | None = None) -> str: # noqa: N802 """Return the c...
EmpaEconversion/aurora-cycler-manager
aurora_cycler_manager/setup_logging.py
.py
a0af1d91abd2d4cc
7.48
8
# Copyright © 2026, Empa. """Functions for connecting to instrument servers with SSH.""" import atexit import base64 import logging import posixpath import threading from collections.abc import Callable from datetime import datetime from functools import partial from pathlib import Path, PureWindowsPath from time impo...
EmpaEconversion/aurora-cycler-manager
aurora_cycler_manager/ssh.py
.py
6c4175fedefb7ae6
7.48
8
# Copyright © 2026, Empa. """Utility functions which only depend on standard library.""" import json import re import uuid from fractions import Fraction from io import TextIOWrapper _ILLEGAL_RE = re.compile(r'[\/\\:*?"\'<>|]|\.\.|\x00') def check_illegal_text(test_string: str) -> None: r"""Raise error if illeg...
EmpaEconversion/aurora-cycler-manager
aurora_cycler_manager/stdlib_utils.py
.py
ffe4493c3c6aa813
7.48
8
# Copyright © 2025-2026, Empa. """Utility functions which depend on config and/or 3rd party imports.""" from contextlib import suppress from datetime import datetime, timezone import numpy as np import polars as pl from aurora_cycler_manager.config import get_config CONFIG = get_config() def weighted_median( ...
EmpaEconversion/aurora-cycler-manager
aurora_cycler_manager/utils.py
.py
24220f45edc1266b
7.48
8
# Copyright © 2026, Empa. """Server-side cache of sample data. Entries are keyed on file identity (sample, kind, mtime, size), and are shared between users. """ from __future__ import annotations import logging import threading import time from collections import OrderedDict from concurrent.futures import ThreadPool...
EmpaEconversion/aurora-cycler-manager
aurora_cycler_manager/visualiser/data_cache.py
.py
c02e9b9cda90d4af
7.48
8
# Copyright © 2025-2026, Empa. """Batch editing sub-layout for the database tab.""" import logging import dash_mantine_components as dmc from dash import Dash, Input, NoUpdate, Output, State, dcc, html, no_update from dash.exceptions import PreventUpdate from aurora_cycler_manager.database_funcs import ( remove_...
EmpaEconversion/aurora-cycler-manager
aurora_cycler_manager/visualiser/db_batch_edit.py
.py
db45e46cc90bc748
7.48
8
# Copyright © 2025-2026, Empa. """Useful functions for the visualiser app.""" import numpy as np import pandas as pd from aurora_cycler_manager.config import get_config ArrayLike = list | np.ndarray | pd.Series CONFIG = get_config() def make_pipelines_comparable(pipelines: list[str | None]) -> list[str | None]: ...
EmpaEconversion/aurora-cycler-manager
aurora_cycler_manager/visualiser/funcs.py
.py
779a7068e81e7710
7.48
8
# Copyright © 2025, Empa. """Notification system and loading messages for the Aurora cycler manager app. To send notification in a callback, Output to notifications-container. To send asynchronous notifications during a long callback is more complicated. There is no built-in or third-party asynchronous notification s...
EmpaEconversion/aurora-cycler-manager
aurora_cycler_manager/visualiser/notifications.py
.py
36ab95d8b64b5774
7.48
8
# Copyright © 2025-2026, Empa. """File upload element for large files with a progress bar.""" import shutil import tempfile from pathlib import Path from dash import Dash, Input, Output, clientside_callback, dcc, html from flask import Response, jsonify, request from werkzeug.utils import secure_filename UPLOAD_DIR ...
EmpaEconversion/aurora-cycler-manager
aurora_cycler_manager/visualiser/uploader.py
.py
a0778a461ac8d469
7.48
8
# Copyright © 2025-2026, Empa. """Before any tests are run, set envionment variable PYTEST_RUNNING.""" import json import logging import os import shutil import warnings from collections.abc import Generator from pathlib import Path from unittest.mock import patch import pytest from aurora_cycler_manager import conf...
EmpaEconversion/aurora-cycler-manager
tests/conftest.py
.py
b1e2a6bcace2f727
7.98
8
# Copyright © 2025-2026, Empa. """Testing ssh module.""" from pathlib import Path from unittest.mock import Mock class MockSSHClient: """Mock ssh.SSHClient with configurable command responses.""" def __init__(self) -> None: """Initialize.""" self.responses: dict[str, dict] = {} self....
EmpaEconversion/aurora-cycler-manager
tests/mocks.py
.py
247701c909f9e9e7
7.98
8
# Copyright © 2025-2026, Empa. """Test analysis.py.""" import json from pathlib import Path import numpy as np import polars as pl from polars.testing import assert_frame_equal import aurora_cycler_manager.database_funcs as dbf from aurora_cycler_manager.analysis import ( _sort_times, analyse_cycles, ana...
EmpaEconversion/aurora-cycler-manager
tests/test_analysis.py
.py
012ec3ec098bff95
7.98
8
# Copyright © 2025-2026, Empa. """Unit tests for database_funcs.py.""" import json import shutil from pathlib import Path from unittest.mock import patch import pandas as pd import pytest from sqlalchemy import text from aurora_cycler_manager.config import get_config from aurora_cycler_manager.database_engine import...
EmpaEconversion/aurora-cycler-manager
tests/test_database_funcs.py
.py
6e5ca6acc7c40c7c
7.98
8
# Copyright © 2025-2026, Empa. """Test database_setup.py aurora-setup command line tool.""" import json import os from pathlib import Path from unittest.mock import patch import pytest from sqlalchemy import inspect, text, types from sqlalchemy.exc import ProgrammingError from aurora_cycler_manager.config import get...
EmpaEconversion/aurora-cycler-manager
tests/test_database_setup.py
.py
c897ba4d8db3ab6e
7.98
8
# Copyright © 2025-2026, Empa. """Testing functions in the eclab_harvester.py.""" from datetime import datetime from pathlib import Path import pytest from polars.testing import assert_frame_equal from sqlalchemy import MetaData, Table, create_engine, select import aurora_cycler_manager.database_funcs as dbf from au...
EmpaEconversion/aurora-cycler-manager
tests/test_eclab_harvester.py
.py
a9dde63bbb9aacb2
7.98
8
# Copyright © 2025-2026, Empa. """Import everything to check coverage and dependencies.""" import importlib import pkgutil import aurora_cycler_manager class TestImportAllModules: """Import all modules.""" def test_import_all_modules(self) -> None: """Dynamically import all modules in the aurora_cy...
EmpaEconversion/aurora-cycler-manager
tests/test_imports.py
.py
904b4e900ed32f21
7.98
8
# Copyright © 2025-2026, Empa. """Test chaining together many high level functions.""" import base64 import json from pathlib import Path from unittest.mock import patch from zipfile import ZipFile import polars as pl import pytest from aurora_unicycler import CyclingProtocol from polars.testing import assert_frame_e...
EmpaEconversion/aurora-cycler-manager
tests/test_integration.py
.py
d3768296687d8ffa
7.98
8
# Copyright © 2025-2026, Empa. """Tests for Neware harvester.""" import logging from pathlib import Path import aurora_cycler_manager.database_funcs as dbf from aurora_cycler_manager.data_parse import get_cycling from aurora_cycler_manager.neware_harvester import convert_all_neware_data, main from aurora_cycler_manag...
EmpaEconversion/aurora-cycler-manager
tests/test_neware_harvester.py
.py
450168418367df27
7.98
8
# Copyright © 2025-2026, Empa. """Test for utilities module.""" import pytest from aurora_cycler_manager.stdlib_utils import ( c_to_float, check_illegal_text, max_with_none, min_with_none, round_c_rate, run_from_sample, ) from aurora_cycler_manager.utils import weighted_median class TestRunF...
EmpaEconversion/aurora-cycler-manager
tests/test_utils.py
.py
8d94b96c65ec913f
7.98
8
"""Module to parse config file.""" import configparser from collections import deque from logging import warning from data.models import str_to_showtype # Variable used to aid in ratelimiting api calls api_call_times = deque() min_ns = 60 * 1000000000 class WhitespaceFriendlyConfigParser(configparser.ConfigParser)...
wjs018/rikka
src/config.py
.py
9fa674f45de26a05
7.48
8
"""Module used to edit the rikka database.""" import yaml from logging import debug, info, exception, error from helper_functions import add_update_shows_by_id def main(config, db, *args, **kwargs): """Main function for the edit module""" if len(args) == 1: if _edit_with_file(config, db, args[0]): ...
wjs018/rikka
src/module_edit.py
.py
121ae7c56e4eec55
7.48
8
"""Module to get list of series releasing in a given year and season.""" import requests import time from logging import debug, info, error from helper_functions import URL, add_update_shows_by_id, meet_discovery_criteria from config import min_ns, api_call_times SEASON_LIST = ["WINTER", "SPRING", "SUMMER", "FALL"] ...
wjs018/rikka
src/module_edit_season.py
.py
dea0305aefd6ee2d
7.48
8
"""Module to create and update summary posts.""" import time import operator from logging import debug, info, error import lemmy from helper_functions import safe_format from data.models import ShowType, SummaryPost def main(config, db, *args, **kwargs): """Main function for summary module""" if len(args)...
wjs018/rikka
src/module_summary.py
.py
2083d00df5ebf58f
7.48
8
"""Module used to add a user-created thread to the database.""" import re import time from logging import info, error, debug import lemmy from data.models import UpcomingEpisode from helper_functions import add_update_shows_by_id from module_episode import _format_post_text, _edit_post def main(config, db, *args, ...
wjs018/rikka
src/module_user_thread.py
.py
d22deeeb8f774222
7.48
8
"""Module to create a series of formatted pages to list episodes in a wiki format""" import os import pathlib from jinja2 import Template from logging import debug, info from module_episode import _format_post_text def main(config, db, *args, **kwargs): """Main function for the module""" seasons = ["winte...
wjs018/rikka
src/module_wiki.py
.py
df441160bdb3ba1b
7.48
8
# we used to have rather big delays between the moment when MF provided the files through its API and the moment they were pushed on datagouv # with the drop of the integrity check (open with pygrib etc.) and the new S3 infra, things are much better # also this updates the JSON file that gives a look of the "filetree" ...
datagouv/datagouvfr_data_pipelines
data_processing/meteo/pnt_monitor/task_functions.py
.py
fc18201b655943a0
7.64
18
#!/usr/bin/env python3 """ Script that calls buildscript and runs fiber-c benchmarks. Usage: `./bench.py --help` `./bench.py` # runs all benchmarks on all engines by default `./bench.py --benchmarks sieve1 itersum --engines d8 wasmtime -o results_dir` # runs selected benchmarks and engines,...
wasmfx/fiber-c
bench.py
.py
d522883b9563b25d
7.45
7
#!/usr/bin/env python3 """ Buildscript that generates scripts to run them on the three wasm engines of interest (d8, wasmtime, and wizard). The generated scripts are in /run-scripts and can be executed with `./run-scripts/benchmark_engine_mode.sh`, e.g. `./run-scripts/sieve1_d8_wasmfx.sh`. Configurations are in config....
wasmfx/fiber-c
build.py
.py
01e3de1674b00ba6
7.45
7
#!/usr/bin/env python3 # /// script # requires-python = ">=3.10" # dependencies = [ # "matplotlib", # "pyqt6", # "numpy", # ] # /// """ Script that generates: 1. A bar chart displaying the relative performance of asyncify and wasmfx benchmarks, grouped by engine 2. $number_of_engines$ bar charts dis...
wasmfx/fiber-c
plot_benchmarks.py
.py
e8dd91b7541ab6a1
7.45
7
#!/usr/bin/env python3 # /// script # requires-python = ">=3.10" # /// """This script finds out the version and flags of compiler tools used for a particular benchmarking run.""" import subprocess import json import os # Run makefile which dumps the compiler info data = subprocess.check_output(["make", "-f", "r...
wasmfx/fiber-c
run_info/compiler_info.py
.py
a742249d36398b59
7.45
7
# Copyright 2023-2026 Airbus, CS Group # # 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...
RS-PYTHON/rs-server
services/adgs/rs_server_adgs/adgs_utils.py
.py
67ea716eef446e9f
7.54
11
# Copyright 2023-2026 Airbus, CS Group # # 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...
RS-PYTHON/rs-server
services/cadip/rs_server_cadip/cadip_utils.py
.py
8f809320edc8cfcd
7.54
11
# Copyright 2023-2026 Airbus, CS Group # # 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...
RS-PYTHON/rs-server
services/catalog/rs_server_catalog/app.py
.py
98f591a8e001f443
7.54
11
# Copyright 2023-2026 Airbus, CS Group # # 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...
RS-PYTHON/rs-server
services/catalog/rs_server_catalog/authentication_catalog.py
.py
3f5becd1893e5ca7
7.54
11
# Copyright 2023-2026 Airbus, CS Group # # 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...
RS-PYTHON/rs-server
services/catalog/rs_server_catalog/data_management/data_lifecycle.py
.py
91695712fab4d433
7.54
11
# Copyright 2023-2026 Airbus, CS Group # # 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...
RS-PYTHON/rs-server
services/catalog/rs_server_catalog/data_management/geometry_manager.py
.py
970e10af4bb89a46
7.54
11
# Copyright 2023-2026 Airbus, CS Group # # 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...
RS-PYTHON/rs-server
services/catalog/rs_server_catalog/data_management/stac_manager.py
.py
0fc29b36046ac5e0
7.54
11
# Copyright 2023-2026 Airbus, CS Group # # 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...
RS-PYTHON/rs-server
services/catalog/rs_server_catalog/data_management/timestamps_extension.py
.py
945fcdb61f740247
7.54
11
# Copyright 2023-2026 Airbus, CS Group # # 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...
RS-PYTHON/rs-server
services/catalog/rs_server_catalog/data_management/user_handler.py
.py
9be9941be888ecff
7.54
11
# Copyright 2023-2026 Airbus, CS Group # # 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...
RS-PYTHON/rs-server
services/catalog/rs_server_catalog/middleware/catalog_middleware.py
.py
4c252fe0ba96e0e4
7.54
11
# Copyright 2023-2026 Airbus, CS Group # # 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...
RS-PYTHON/rs-server
services/catalog/rs_server_catalog/utils.py
.py
9f71a2977545a26a
7.54
11
# Copyright 2023-2026 Airbus, CS Group # # 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...
RS-PYTHON/rs-server
services/catalog/tests/conftest.py
.py
cb8fdd9e088e24e6
8.04
11
# Copyright 2023-2026 Airbus, CS Group # # 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...
RS-PYTHON/rs-server
services/catalog/tests/helpers.py
.py
1421ce02d29e47e1
8.04
11
# Copyright 2023-2026 Airbus, CS Group # # 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...
RS-PYTHON/rs-server
services/catalog/tests/test_data_lifecycle.py
.py
8c63ffda700a734f
8.04
11
# Copyright 2023-2026 Airbus, CS Group # # 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...
RS-PYTHON/rs-server
services/catalog/tests/test_endpoints/test_catalog_delete_endpoints.py
.py
61e85f18e85f7450
8.04
11
# Copyright 2023-2026 Airbus, CS Group # # 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...
RS-PYTHON/rs-server
services/catalog/tests/test_endpoints/test_catalog_publish_collection_endpoint.py
.py
3e663bdfde284bbc
7.04
11
# Copyright 2023-2026 Airbus, CS Group # # 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...
RS-PYTHON/rs-server
services/catalog/tests/test_endpoints/test_catalog_publish_feature_endpoint.py
.py
4323c9e4e8409671
7.04
11
# Copyright 2023-2026 Airbus, CS Group # # 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...
RS-PYTHON/rs-server
services/catalog/tests/test_endpoints/test_generic_endpoints.py
.py
c58ded2aad5c5a0f
7.04
11
# Copyright 2023-2026 Airbus, CS Group # # 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...
RS-PYTHON/rs-server
services/catalog/tests/test_endpoints/test_patch_endpoint.py
.py
4a6ce8c8550cfdda
8.04
11
# Copyright 2023-2026 Airbus, CS Group # # 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...
RS-PYTHON/rs-server
services/catalog/tests/test_geometry_manager.py
.py
6a3559a85ed319fd
7.04
11
# Copyright 2023-2026 Airbus, CS Group # # 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...
RS-PYTHON/rs-server
services/catalog/tests/test_items_expiration.py
.py
262dc3632eeb6930
7.04
11
# Copyright 2023-2026 Airbus, CS Group # # 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...
RS-PYTHON/rs-server
services/catalog/tests/test_request_manager_utils.py
.py
efb55d0cdd9e224d
8.04
11
"""Dagster resource wrapping the published ``cityjson-index`` package. The pipeline keeps this module path for compatibility while exposing the package-oriented CityJSON index API used by downstream assets. """ from __future__ import annotations import json import os from collections.abc import Iterator from pathlib...
3DBAG/3dbag-pipeline
packages/common/src/bag3d/common/resources/cjindex.py
.py
d63a6db2cccf04c1
7.56
12
from typing import Any from dagster import ConfigurableResource from pgutils import PostgresConnection DatabaseConnection = PostgresConnection class DatabaseResource(ConfigurableResource): """ Database connection resource for PostgreSQL. Args: host: Database host address user: Database ...
3DBAG/3dbag-pipeline
packages/common/src/bag3d/common/resources/database.py
.py
6053b6bc1ff591f4
7.56
12
from pathlib import Path from shutil import rmtree from dagster import ConfigurableResource, get_dagster_logger logger = get_dagster_logger("resources.file_store") class FileStoreResource(ConfigurableResource): """Location of the data files that are generated in the pipeline.""" root_dir: str @propert...
3DBAG/3dbag-pipeline
packages/common/src/bag3d/common/resources/files.py
.py
6aa1a73e99b432f8
7.56
12
from dagster import ConfigurableResource from fabric import Connection class ServerTransferResource(ConfigurableResource): """ A resource for transferring files to other servers. Attributes: host: Optional[str] The hostname or IP address of the remote server. port: Optional[in...
3DBAG/3dbag-pipeline
packages/common/src/bag3d/common/resources/server_transfer.py
.py
2a037b3e9b21708c
7.56
12
from collections.abc import Generator from bag3d.specs.core import ( Attribute, CityJSONLocation, GpkgLocation, Ogc3dTilesLocation, load_attributes_spec, ) from dagster import ConfigurableResource from pydantic import PrivateAttr class Specs3DBAGResource(ConfigurableResource): """ The 3DB...
3DBAG/3dbag-pipeline
packages/common/src/bag3d/common/resources/specs.py
.py
91a2105bdac88353
8.06
12
import random import string from subprocess import CalledProcessError, TimeoutExpired, run from typing import Annotated from dagster import ConfigurableResource, get_dagster_logger from pydantic import BeforeValidator, PrivateAttr logger = get_dagster_logger() def _make_release_version(v: str | None) -> str: re...
3DBAG/3dbag-pipeline
packages/common/src/bag3d/common/resources/version.py
.py
c883c9fb3d91daee
7.56
12
"""Test context builder that validates against the asset definition. Prevents tests from silently injecting partition_key for non-partitioned assets (or omitting it for partitioned ones), which would mask wiring bugs that only surface at runtime. """ from contextlib import contextmanager from typing import Any from ...
3DBAG/3dbag-pipeline
packages/common/src/bag3d/common/testing/context.py
.py
5f2183486193a123
7.06
12
"""Custom types, custom Dagster types""" from collections.abc import Sequence from dataclasses import dataclass from pathlib import Path from dagster import PythonObjectDagsterType, make_python_type_usable_as_dagster_type from pgutils import PostgresTableIdentifier LocalPath = PythonObjectDagsterType( python_typ...
3DBAG/3dbag-pipeline
packages/common/src/bag3d/common/types.py
.py
21c0943c11c16f8c
7.56
12
"""Utilities for working with the dagster instance""" from datetime import date from dagster import ( AssetExecutionContext, StaticPartitionsDefinition, TableColumn, TableSchema, get_dagster_logger, ) from bag3d.common.utils.files import get_export_tile_ids def get_run_id(context: AssetExecutio...
3DBAG/3dbag-pipeline
packages/common/src/bag3d/common/utils/dagster.py
.py
7f510c2a65863cd7
7.56
12
import inspect from importlib import resources from logging import Logger from dagster import MarkdownMetadataValue, get_dagster_logger from pgutils import PostgresTableIdentifier, inject_parameters from psycopg.sql import SQL, Composed, Identifier, Literal from bag3d.common.resources.database import DatabaseResource...
3DBAG/3dbag-pipeline
packages/common/src/bag3d/common/utils/database.py
.py
25c1d39688230c81
7.56
12
"""Working with file inputs and outputs""" import csv import os from collections.abc import Iterator, Sequence from pathlib import Path from zipfile import ZipFile from dagster import get_dagster_logger from bag3d.common.resources import DagsterDeployment, FileStoreResource from bag3d.common.types import ExportResul...
3DBAG/3dbag-pipeline
packages/common/src/bag3d/common/utils/files.py
.py
e4dcb907f244a875
7.56
12
import json import re from json.decoder import JSONDecodeError from logging import Logger from pathlib import Path from dagster import ( Failure, TableColumn, TableColumnConstraints, TableSchema, TableSchemaMetadataValue, get_dagster_logger, ) from pgutils import PostgresTableIdentifier from b...
3DBAG/3dbag-pipeline
packages/common/src/bag3d/common/utils/geodata.py
.py
ac03948c557d46df
7.56
12
"""Read tool metadata from 3dbag-manifest.json.""" import json import os from pathlib import Path _manifest_cache: dict | None = None _MANIFEST_FILENAME = "3dbag-manifest.json" _DOCKER_MANIFEST_PATH = Path("/opt/3dbag-pipeline") / _MANIFEST_FILENAME def _walk_manifest_parents(start: Path) -> Path | None: """Ret...
3DBAG/3dbag-pipeline
packages/common/src/bag3d/common/utils/manifest.py
.py
5aa9275f6f173605
7.56
12
from pathlib import Path from bag3d.common.types import ExportResult def test_export_result(tmp_path): """Test ExportResult class""" export_result = ExportResult( tile_id="z/x/y", cityjson_path=tmp_path, gpkg_path=tmp_path, obj_paths=[ Path(tmp_path), ], ...
3DBAG/3dbag-pipeline
packages/common/tests/test_types.py
.py
ad495660983d4c58
7.06
12
import json from datetime import datetime from functools import partial import pytz from bag3d.common.resources.database import DatabaseResource from bag3d.common.resources.executables import PDALResource from bag3d.common.types import PostgresTableIdentifier from bag3d.common.utils.database import create_schema, load...
3DBAG/3dbag-pipeline
packages/core/src/bag3d/core/assets/ahn/metadata.py
.py
2c857518d792de64
7.56
12
from bag3d.common.resources.database import DatabaseResource from bag3d.common.resources.executables import GDALResource from bag3d.common.types import PostgresTableIdentifier from bag3d.common.utils.database import ( create_schema, drop_table, load_sql, postgrestable_from_query, ) from bag3d.common.uti...
3DBAG/3dbag-pipeline
packages/core/src/bag3d/core/assets/bgt/load.py
.py
3128483edb9ee822
7.56
12
"""Strict template reading and safe, atomic CSV output writing.""" from __future__ import annotations import csv import hashlib import io import os import tempfile from dataclasses import dataclass from pathlib import Path from typing import Iterable from .models import CSV_COLUMNS, DictionaryRow class CsvTemplate...
leabs/misc-python-apps
DD-bulk-export/dd_bulk_export/csv_io.py
.py
b536df2600e2ab77
7.5
9
import requests import pandas as pd import numpy as np from typing import Optional MAX_BASE = 1500.0 MID_BASE = 750.0 def calculate_investment(power_law_level: float, annual_budget: float, frequency: str) -> int: """ Returns an integer recommended investment per period based on the power law level. freque...
leabs/misc-python-apps
btc-power-law-investment/main.py
.py
57bb9f078331b37d
7.5
9
"""キャンペーン管理 view(一覧 / 作成 / 編集 / 削除)。 権限境界: - 全ての view は LoginRequiredMixin + accessible_community_ids でフィルタする - 他集会の Campaign は一覧に出ず、直接 URL アクセスは 404 を返す - フォームの community 選択肢もサーバー側で絞る(HTML 改ざん耐性) """ import logging from django.contrib.auth.mixins import LoginRequiredMixin from django.urls import reverse_lazy from dj...
noricha-vr/vrc-ta-hub
app/analytics/campaign_views.py
.py
033d1f26bc1ba5ef
7.63
17
"""集会主催者向けアクセス解析ダッシュボード。 機能(MVP + Phase 2): - 集会切替(my_list と同じ active_community セッションを共有) - 期間切替(7 / 30 / 90 日。デフォルト 30) - 集会全体サマリー(PV/UU/セッション + 前期間比較) - 記事別アクセス一覧テーブル(PV 順、Phase 2: ソート / CSV エクスポート) - 流入元別 PV ランキング - 公開後N日積み上げチャート(上位記事の伸びを比較) - CSV エクスポート(?format=csv) 権限境界: - LoginRequiredMixin に加えて accessible_comm...
noricha-vr/vrc-ta-hub
app/analytics/dashboard_views.py
.py
4fdce728352c4cbd
7.63
17
"""キャンペーン管理フォーム。""" import re from django import forms from community.models import Community from .models import Campaign from .services import accessible_community_ids # 着地パスとして許可するパターン。 # - '/' で始まる # - 直後の文字は '/' でも '\\' でもない(オープンリダイレクト変則パターン防止) # - '/' 単体も許可 _LANDING_PATH_RE = re.compile(r'^/([^/\\].*)?$') c...
noricha-vr/vrc-ta-hub
app/analytics/forms.py
.py
3d3f7cf0b9c50b46
7.63
17
"""GA4 Data API クライアント。 GA4 プロパティからページ別アクセスデータ(PV・ユーザー数・セッション数)を 日次で取得する。資格情報やトークンはログ・例外に絶対出さない。 """ import logging import os from datetime import date from django.conf import settings from google.api_core import retry as api_retry from google.api_core import exceptions as google_exceptions from google.analytics.data...
noricha-vr/vrc-ta-hub
app/analytics/ga4_client.py
.py
b93bdcf8285dec11
7.63
17
import os import uuid from urllib.parse import urlencode from django.core.validators import RegexValidator from django.db import models from website.constants import build_site_url # utm_source / utm_medium に許す文字種。GA4 / UA 標準の慣習(英数 + - _ .)に揃え、 # 改行や絵文字での QR 量産・改ざんを防ぐ。 # `\A...\Z` を使うのは `^...$` だと re.MULTILINE 不要でも ...
noricha-vr/vrc-ta-hub
app/analytics/models.py
.py
b93e29b310b4fe7b
7.63
17