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
"""Light recommender model, without the heavy Turi Create dependency.""" import logging from collections import defaultdict from dataclasses import asdict, dataclass from pathlib import Path from typing import TYPE_CHECKING, FrozenSet, Iterable, List, Optional, Type, Union import numpy as np import pandas as pd from...
recommend-games/board-game-recommender
v3/board_game_recommender/light.py
.py
4ca3466767b8fdbf
7.6
15
"""Calculate the trust into users.""" import json import math from itertools import groupby from typing import Any, Dict, Generator, Iterable, Optional, Tuple, Union import turicreate as tc from scipy.stats import shapiro def _user_trust( *, ratings: Iterable[Optional[float]], dates: Iterable[Optional[s...
recommend-games/board-game-recommender
v3/board_game_recommender/trust.py
.py
8e04aa37617d8493
7.6
15
"""Shared boilerplate for ``scripts/`` research screens and utilities. Extracted by task ``ref-scripts-common`` (wave 1) from the verbatim-identical function clusters quantified in ``reports/wave1/hyg-scripts-audit.md`` (§4a: 29 duplicate clusters / ~2k recoverable lines). Behavior-preserving only: every helper here i...
ryanpmcintire/nfl_py3
scripts/_common.py
.py
d90d16ab1d3c4d13
7.6
15
"""Re-read stored per-game artifacts and recompute paired statistics for three TERMINAL verdicts flagged by the 2026-08-18 measurement-instrument audit (``docs/revisit_list.md``, Tier 1). This script performs NO new model fits, NO new windows, and NO calls into ``nfl_ats.rotation``. It only re-reads existing per-game ...
ryanpmcintire/nfl_py3
scripts/audit_terminal_verdicts.py
.py
810146d14b3e0a7e
7.6
15
"""Does the MOD-07 availability advantage sit where the mechanism says it must? The +1.75-point availability/value half (``scripts/availability_ablation.py``) is 456 games wide and its interval crosses zero, so it cannot be confirmed by size. It CAN be checked for mechanism, and that check is free: it re-reads a windo...
ryanpmcintire/nfl_py3
scripts/availability_mechanism_screen.py
.py
0fb0c1f659bd6f39
7.6
15
"""Overlap audit for the player-availability / player-value evidence family. ROADMAP RWB-16 records: "The one family where it accumulates is player availability and value -- five measurements, all positive, p = 0.0625 within the family." That p-value is a two-sided sign test, and a sign test assumes the measurements a...
ryanpmcintire/nfl_py3
scripts/availability_overlap_audit.py
.py
4b31e50149fa681b
7.6
15
"""One-time mechanical backfill of the RWB-09 experiment-provenance registry. ``registry/experiments/`` (git-tracked) is new; ``artifacts/`` (gitignored, local-disk-only) already holds ~100 run directories from before it existed. This script lifts a registry row for every run directory whose ``metadata.json``/``run.js...
ryanpmcintire/nfl_py3
scripts/backfill_experiment_registry.py
.py
1c5d10074c747e3f
7.6
15
"""Incremental off-device mirror of the local data trees. Why this exists --------------- On 2026-08-27 an audit of the backup state found that ~70% of `data/` by bytes was copied anywhere, the copy was 11 days stale, and the entire `data/raw/` tree -- 741 MB across 31 scraped sources -- had never been backed up at al...
ryanpmcintire/nfl_py3
scripts/backup_data.py
.py
6499119537f8ba3e
7.6
15
"""Tier-2 re-read of ``best_pick_ranker_opener`` (Docs revisit list, 2026-08-18). This is a RE-READ, not a re-run: it recomputes statistics from the already -stored per-pick parquet artifacts under ``artifacts/best_pick_ranker/`` (``opener_2020_2021.picks.parquet`` and ``screen_2013_2015.picks.parquet``). No model is ...
ryanpmcintire/nfl_py3
scripts/best_pick_ranker_tiebreak_audit.py
.py
93e2f4585de80a96
7.6
15
"""Join EPA AQS air-quality + US Drought Monitor drought data to the NFL schedule, at the HOME stadium's county, as-of the Tuesday of each game week. INGESTION + COVERAGE REPORT ONLY -- this script performs no experiments and writes nothing to the weak-signals/rotation registries (registry/weak_signals.json, registry/...
ryanpmcintire/nfl_py3
scripts/build_environmental_exposure_join.py
.py
0633191c25e211fe
7.6
15
"""Per-season league-level meta-game trend series. Read-only, descriptive. Built from two local, gitignored inputs -- nothing here touches the network and nothing here is committed: - ``data/pbp/raw/<latest snapshot>/season=<season>/plays.parquet`` (nflverse play-by-play, seasons 2009-2025 as of this run; the r...
ryanpmcintire/nfl_py3
scripts/build_metagame_series.py
.py
05b61d609da42a88
7.6
15
""" bus.py ------ ``bus.py`` contains the functionality to show upcoming departures of buses. """ import json import time from dataclasses import dataclass import requests API_URL = "https://dfi.swtue.de/departure_board" class SSEDecodeError(Exception): """Raised when parsing the SSE response fails.""" @data...
fsi-tue/fachschaftsempfaenger
fachschaftsempfaenger/bus.py
.py
12bad99c208ad04c
7.48
8
""" calendar.py ----------- ``calendar.py`` contains the functionality to show upcoming events of the student union of Computer Science in Tuebingen. """ import requests from icalendar import Calendar def events(urls): """ Yields a generator of the events in the ical file provided by the url - **parame...
fsi-tue/fachschaftsempfaenger
fachschaftsempfaenger/calendar.py
.py
3527e3da9b9cbf44
7.48
8
import json from datetime import datetime from django.core.exceptions import ObjectDoesNotExist from django.shortcuts import render from django.utils import timezone from fachschaftsempfaenger.models import Advertisement, Food, Mastodon, Member, Menu from . import __author__ as author from . import __repository_url__...
fsi-tue/fachschaftsempfaenger
fachschaftsempfaenger/views.py
.py
d52d94cc458ae854
7.48
8
""" 初回動かす必要のあるスクリプト """ from library.database import execute_sql def create_table() -> None: """テーブルを作成する""" with open( "postgres/docker-entrypoint-initdb.d/02_init.sql", encoding="UTF-8" ) as init_sql: sql = "" for line in init_sql.readlines(): sql += line ...
dev-hato/hato-bot
create_env.py
.py
152d30024909c751
7.09
14
# coding: utf-8 """ 地震情報 """ import json from typing import Any, List, Optional import requests from PIL import Image from library.hatomap import ( GeoCoord, HatoMap, Layer, LineTrace, MapBox, MarkerTrace, get_circle, ) def get_quake_list(limit: int = 10) -> Optional[Any]: """ ...
dev-hato/hato-bot
library/earthquake.py
.py
85efddb2fa058f80
7.59
14
# coding: utf-8 """ amesh """ import re import unicodedata from random import choice from typing import Dict, Optional import requests import slackbot_settings as conf def get_geo_data(place: str) -> Optional[Dict[str, str]]: """ 地名や住所から座標を取得する(ラッパー) :param place: 地名・住所・郵便番号 :return: place: 地名, la...
dev-hato/hato-bot
library/geo.py
.py
33228155777c933a
7.59
14
# coding: utf-8 """ jma_amesh """ import datetime import json from dataclasses import dataclass from typing import List, Optional, Tuple import requests from PIL import Image from library.hatomap import ( GeoCoord, HatoMap, Layer, LineTrace, MapBox, MarkerTrace, RasterLayer, get_circ...
dev-hato/hato-bot
library/jma_amesh.py
.py
feca08d3e2a4d051
7.59
14
# coding: utf-8 """ おみくじを返す """ from dataclasses import dataclass from random import choices from typing import Tuple, TypeVar @dataclass class OmikujiResult: """ おみくじの引いた結果を示すデータクラス 出やすさの調整もここで行う """ appearance: int message: str def __post_init__(self): """ 初期化後のアサーション...
dev-hato/hato-bot
library/omikuji.py
.py
aef2482c1baaf239
7.59
14
""" メッセージを解析する """ from functools import partial from typing import Callable, List from library.clientclass import BaseClient, SlackClient from plugins import hato def analyze_slack_message(messages: List[dict]) -> Callable[[SlackClient], None]: """Slackコマンド解析""" message = "".join([m["text"] for m in messa...
dev-hato/hato-bot
plugins/analyze.py
.py
52dde1bb0c54a549
7.59
14
""" hato-bot用のおみくじラッパー """ from enum import Enum, auto from library.omikuji import OmikujiResult, OmikujiResults, draw class HatoMikuji: """ HatoMikuji Omikujiをhato-bot用に設定を導入しラップするAdapter """ class OmikujiEnum(Enum): """ HatoMikuji用のおみくじ結果一覧 """ DAI_KICHI = au...
dev-hato/hato-bot
plugins/hato_mikuji.py
.py
e5182b7e79b9fbd2
7.59
14
""" pyproject.tomlに対して以下の修正を行う。 * pyproject.tomlでのバージョン指定がないパッケージについて、バージョン指定を実際にインストールされるものに修正する * プロジェクト内のPythonファイルでimportされているがpyproject.toml内には存在しないパッケージをpyproject.tomlの「project.dependencies」セクションに追加する """ import importlib.util import re import sys from pathlib import Path from typing import NoReturn, TypeGuard ...
dev-hato/hato-bot
scripts/pr_format/pr_format/fix_pyproject.py
.py
af14c0b41cd53602
7.59
14
""" amesh.pyのテスト """ import json import unittest import requests_mock import slackbot_settings as conf from library.geo import get_gsi_geo_data, get_yahoo_geo_data def set_yahoo_mock( place: str, mocker: requests_mock.Mocker, is_zip_code: bool, content=None ): """ Mockを設定する :param place: 地名・住所・郵便番号...
dev-hato/hato-bot
tests/library/test_geo.py
.py
5f2654c91fb4feb9
7.09
14
""" hukidashiライブラリのテスト """ import textwrap import unittest from library.hukidasi import generator class TestHukidashiGenerator(unittest.TestCase): """ 突然の死を生成するテスト """ def test_normal_one_line_ascii(self): """ 英数字のみの1行のテキストに対して突然の死が生成される """ self.assertEqual( ...
dev-hato/hato-bot
tests/library/test_hukidasi.py
.py
e56a9ecd3102f2e2
7.09
14
""" omikujiライブラリのテスト """ import unittest from enum import Enum, auto from library.omikuji import OmikujiResult, OmikujiResults, draw class TestOmikuji(unittest.TestCase): """ おみくじのテスト """ def test_omikuji_minimum(self): """ おみくじの実装が正常か """ class DummyOmikujiEnum(Enu...
dev-hato/hato-bot
tests/library/test_omikuji.py
.py
81cc09c5331132e3
8.09
14
""" plugin関連のテスト """ from library.clientclass import BaseClient class TestClient(BaseClient): """ モッククライアント """ post_message: str filename: str def __init__(self) -> None: self.post_message = "" self.filename = "" def post(self, message: str) -> None: self.post_...
dev-hato/hato-bot
tests/plugins/__init__.py
.py
7ed056fe0831775f
8.09
14
""" analyze.pyのテスト """ import unittest from plugins import hato from plugins.analyze import analyze_message, analyze_slack_message from tests.plugins import TestClient class TestAnalyzeSlackMessage(unittest.TestCase): """ Slackコマンドを正しく解析できるかテストする """ def test_telephone_link(self): """電話番号のリ...
dev-hato/hato-bot
tests/plugins/test_analyze.py
.py
7a47c392afa14baf
7.09
14
""" hato.pyのテスト """ import json import os import re import unittest from typing import List import requests_mock import slackbot_settings as conf from plugins.hato import ( altitude, amedas, amesh, earth_quake, omikuji, split_command, yoshiyoshi, ) from plugins.hato_mikuji import HatoMiku...
dev-hato/hato-bot
tests/plugins/test_hato.py
.py
8403c3e7682b013b
7.09
14
""" hato_mikuji.pyのテスト """ import unittest from plugins.hato_mikuji import HatoMikuji class TestHatoMikuji(unittest.TestCase): """ HatoMikujiの設定テスト """ def test_config_normalized_per_mill(self): sum_of_appearance = sum( map(lambda e: e.appearance, HatoMikuji.OMIKUJI_CONFIG.value...
dev-hato/hato-bot
tests/plugins/test_hatomikuji.py
.py
7d62a8a07b53075b
7.59
14
""" DBが起動するまで待機する """ from time import sleep import psycopg from library.database import execute_sql def wait_db() -> None: """DBが起動するまで待機する""" max_attempt = 30 for i in range(max_attempt): try: execute_sql("SELECT 1") break except psycopg.OperationalError as _...
dev-hato/hato-bot
wait_db.py
.py
5466350fd501a588
7.59
14
import json import random from jsonschema import RefResolver # from dss.util.s3urlcache import S3UrlCache from azul.json_gen.generator import JsonGenerator class HCAJsonGenerator(object): """ Used to generate random JSON from a from a list of URLs containing JSON schemas. """ def __init__(self, sche...
DataBiosphere/azul
attic/hca_generator.py
.py
e1241fc8602e1ecc
7.54
11
from math import ceil, floor import random from typing import List, Union from faker import Faker from faker.providers.python import Provider as PythonProvider from jsonschema import Draft4Validator, RefResolver import rstr class JsonProvider(PythonProvider): _SUPPORTED_JSON_TYPES = {'str', 'float', 'int', 'iso...
DataBiosphere/azul
attic/json_gen/generator.py
.py
e87a23d3393802a8
7.54
11
"""empty message Revision ID: 975a9e3e0e78 Revises: c659370cdf42 Create Date: 2017-02-02 13:36:32.942494 """ # revision identifiers, used by Alembic. revision = '975a9e3e0e78' down_revision = 'c659370cdf42' from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto generated by Alembic - ...
DataBiosphere/azul
attic/migrations/versions/975a9e3e0e78_.py
.py
906a3fd93b68d4f3
7.54
11
"""empty message Revision ID: c659370cdf42 Revises: None Create Date: 2016-11-10 16:54:26.039687 """ # revision identifiers, used by Alembic. revision = 'c659370cdf42' down_revision = None from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto generated by Alembic - please adjust! ###...
DataBiosphere/azul
attic/migrations/versions/c659370cdf42_.py
.py
03bb74361f9bd58e
7.54
11
"""empty message Revision ID: d7cdac75242a Revises: be7c97191ac2 Create Date: 2017-03-16 15:03:56.535956 """ # revision identifiers, used by Alembic. revision = 'd7cdac75242a' down_revision = 'be7c97191ac2' from alembic import op import sqlalchemy as sa import sqlalchemy_utils def upgrade(): ### commands auto...
DataBiosphere/azul
attic/migrations/versions/d7cdac75242a_.py
.py
64cd7687d40ea460
7.54
11
# # Copyright (c) 2025 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # # All Rights Reserved. # """This module contains common classes for Netlink library""" import os from importlib.resources import files from ..base import NlError from ..base import YnlFamily class NetlinkException(Exception): ...
starlingx/integ
python/pynetlink/src/pynetlink/common/netlink.py
.py
56a607bf57d6191d
7.42
6
# # Copyright (c) 2025 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # # All Rights Reserved. # """This module has the constants and enumerators used by other dpll modules.""" from enum import Enum from enum import unique class DeviceFields: """List of possible field names returned in device ...
starlingx/integ
python/pynetlink/src/pynetlink/dpll/constants.py
.py
51d0eb98f6c761b5
7.42
6
import pandas as pd import numpy as np import shlex import subprocess import re class GetFasta: """ This function execute the bedtools getfasta. Keyword arguments: input_file: input_file, parsed with -in argument. bed_file: bed file, genereated along the pipeline out_file: output file """...
WallauBioinfo/EEfinder
eefinder/bed.py
.py
6cd6bbe53166d136
7.52
10
from Bio import SeqIO class RemoveShortSequences: """ Remove sequences bellow the cutoff threshold. Keyword arguments: input_file: input fasta file cutoff: cutoff length, parsed by -ln """ def __init__(self, input_file: str, cutoff: int) -> object: self.input_file = input_file ...
WallauBioinfo/EEfinder
eefinder/clean_data.py
.py
072bab14dbdaa426
7.52
10
import pandas as pd class CompareResults: """ This function compares 2 blast results, for queries with same ID, only the one with the major bitscore is keept. In a final step only queries with tag EE are maintained Keyword arguments: vir_result: filtred blast against ee database host_result: ...
WallauBioinfo/EEfinder
eefinder/compare_results.py
.py
10caee84606e7812
7.52
10
from Bio import SeqIO class GetLength: """ Creates a length file with the module SeqIO. Keywords arguments: input_file: formated genome, generated by cut_seq function """ def __init__(self, input_file: str) -> object: self.input_file = input_file self.get_length() def g...
WallauBioinfo/EEfinder
eefinder/get_length.py
.py
a541654f639c23ba
7.52
10
import re class InsertPrefix: """ Insert prefix on input file fasta sequence headers Keyword arguments: input_file: input fasta file prefix: prefix string name outdir: output directory """ def __init__(self, input_file: str, prefix: str, outdir: str) -> None: self.input_file ...
WallauBioinfo/EEfinder
eefinder/prepare_data.py
.py
d31fe91fe442471d
7.52
10
""" Script to collect rna-seq qc metrics from different summary and report files from the rnaseq pipeline Usage : python rnaseq_qc.py --multiqc_prealign multiQC_prealign_report --multiqc_postalign multiQC_postalign_report 8019468197_summary.txt 8019468197_mapped_report.txt 8019468197_rRNA_report.txt 8019468197_globin_...
MoTrPAC/motrpac-rna-seq-pipeline
wdl/collect_qc_metrics/rnaseq_qc.py
.py
462938383f6a046d
7.48
8
# Copyright © 2019 Province of British Columbia. # # 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 agr...
bcgov/business-schemas
setup.py
.py
0fe8aac83691545e
7.42
6
# Copyright © 2019 Province of British Columbia # # 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 agr...
bcgov/business-schemas
src/registry_schemas/flask/schema_services.py
.py
224e9ffd2a559151
7.42
6
# Copyright © 2019 Province of British Columbia # # 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 agr...
bcgov/business-schemas
src/registry_schemas/utils.py
.py
e838080ac480d8c9
7.42
6
# Copyright © 2022 Province of British Columbia # # 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 agr...
bcgov/business-schemas
tests/unit/business_documents/test_lseal.py
.py
97551a8c76eeff39
7.92
6
# Copyright © 2022 Province of British Columbia # # 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 agr...
bcgov/business-schemas
tests/unit/business_documents/test_summary.py
.py
b483c3a385db1ac7
7.92
6
# Copyright © 2019 Province of British Columbia # # 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 agr...
bcgov/business-schemas
tests/unit/schemas/test_business.py
.py
714d8bd232fe08a1
7.92
6
# Copyright © 2023 Province of British Columbia # # 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 agr...
bcgov/business-schemas
tests/unit/test_affiliated_businesses.py
.py
e4b6f70960359452
7.92
6
# Copyright © 2025 Province of British Columbia # # 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 agr...
bcgov/business-schemas
tests/unit/test_change_of_liquidators.py
.py
ddefcf4912aefecb
7.92
6
# Copyright © 2025 Province of British Columbia # # 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 agr...
bcgov/business-schemas
tests/unit/test_change_of_receivers.py
.py
a35f9417ad6c170a
7.92
6
# Copyright © 2022 Province of British Columbia # # 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 agr...
bcgov/business-schemas
tests/unit/test_cp_special_resolution.py
.py
37055db0be81ebe9
7.92
6
# Copyright (c) 2026, Province of British Columbia # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # 1. Redistributions of source code must retain the above copyright notice, this # list of conditions and the followi...
bcgov/business-schemas
tests/unit/test_multi_filings.py
.py
7c917d68d2d88a7c
7.92
6
import matplotlib.pyplot as plt import numpy as np from functools import partial from src import charged_particle import util ''' This script produces a plot comparing the absolute error of the x coordinate of a test charge in a simple larmor gyration. The error is determined by comparing the results with the analy...
lcpp-org/PlasmaEDU
particle/python/Gh2/examples/introduction_example.py
.py
fc06b14b7b026493
7.52
10
import numpy as np from pylab import plot, axis, show, xlim, ylim, savefig from scipy.integrate import odeint # Physical Constants (SI units, 2019 redefinition) qe = 1.602176634e-19 # fundamental charge [C] me = 9.109383701528e-31 # electron rest mass [kg] mp = 1.6726219236951e-27 # proton rest mass [...
lcpp-org/PlasmaEDU
particle/python/ex09_nbody_20body.py
.py
7cb1dcc3b526a1f2
7.52
10
import numpy as np from pylab import plot, axis, show, savefig from scipy.integrate import odeint # Physical Constants (SI units, 2019 redefinition) qe = 1.602176634e-19 # fundamental charge [C] me = 9.109383701528e-31 # electron rest mass [kg] mp = 1.6726219236951e-27 # proton rest mass [kg] lux = 2...
lcpp-org/PlasmaEDU
particle/python/ex11_nbody_3body.py
.py
456efa467ac7e339
7.52
10
# # Copyright (c) 2020-present Cumulocity GmbH, Duesseldorf, Germany and/or its affiliates and/or their licensors. # Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Cumulocity GmbH # from pysys.constants import * from apamax.anal...
Cumulocity-IoT/apama-analytics-builder-block-sdk
samples/tests/CreateEvent/run.py
.py
552cc903cfa1cfc5
8.04
11
# # Copyright (c) 2019-present Cumulocity GmbH, Duesseldorf, Germany and/or its affiliates and/or their licensors. # Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Cumulocity GmbH # from pysys.constants import * from apamax.anal...
Cumulocity-IoT/apama-analytics-builder-block-sdk
samples/tests/DeviceLocationBlock/run.py
.py
710a1e12e0e7bb14
8.04
11
# # Copyright (c) 2019-present Cumulocity GmbH, Duesseldorf, Germany and/or its affiliates and/or their licensors. # This file is licensed under the Apache 2.0 license - see https://www.apache.org/licenses/LICENSE-2.0 # from pysys.constants import * from apamax.analyticsbuilder.basetest import AnalyticsBuilderBaseT...
Cumulocity-IoT/apama-analytics-builder-block-sdk
samples/tests/DifferenceBlock/run.py
.py
33ce34597ee1303d
7.04
11
# # Copyright (c) 2019-present Cumulocity GmbH, Duesseldorf, Germany and/or its affiliates and/or their licensors. # This file is licensed under the Apache 2.0 license - see https://www.apache.org/licenses/LICENSE-2.0 # from pysys.constants import * from apamax.analyticsbuilder.basetest import AnalyticsBuilderBaseT...
Cumulocity-IoT/apama-analytics-builder-block-sdk
samples/tests/DifferenceRestrictedOutput/run.py
.py
bc8fcbd4d71a8056
7.04
11
# # Copyright (c) 2019-present Cumulocity GmbH, Duesseldorf, Germany and/or its affiliates and/or their licensors. # Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Cumulocity GmbH # from pysys.constants import * from apamax.anal...
Cumulocity-IoT/apama-analytics-builder-block-sdk
samples/tests/DualMeasurementIO/run.py
.py
45f9b7cff5abcb83
8.04
11
# # Copyright (c) 2020-present Cumulocity GmbH, Duesseldorf, Germany and/or its affiliates and/or their licensors. # This file is licensed under the Apache 2.0 license - see https://www.apache.org/licenses/LICENSE-2.0 # from pysys.constants import * from apamax.analyticsbuilder.basetest import AnalyticsBuilderBaseTes...
Cumulocity-IoT/apama-analytics-builder-block-sdk
samples/tests/GroupStatistics_Bounded/run.py
.py
c820089205261c19
7.04
11
# # Copyright (c) 2020-present Cumulocity GmbH, Duesseldorf, Germany and/or its affiliates and/or their licensors. # This file is licensed under the Apache 2.0 license - see https://www.apache.org/licenses/LICENSE-2.0 # from pysys.constants import * from apamax.analyticsbuilder.basetest import AnalyticsBuilderBaseTes...
Cumulocity-IoT/apama-analytics-builder-block-sdk
samples/tests/GroupStatistics_UnBounded/run.py
.py
34eedf12932ddede
7.04
11
# #!/usr/bin/env python # A python script for mocking HTTP server. It just print all the request received from the client. It does not support HTTPS. # import http.server import socketserver import sys, json, time print("Starting") PORT = int(sys.argv[1]) class RequestHandler(http.server.BaseHTTPRequestHandler): d...
Cumulocity-IoT/apama-analytics-builder-block-sdk
samples/tests/HttpOutputBlock/Input/server.py
.py
b6ea2e59f1f76640
8.04
11
# # Copyright (c) 2019-present Cumulocity GmbH, Duesseldorf, Germany and/or its affiliates and/or their licensors. # This file is licensed under the Apache 2.0 license - see https://www.apache.org/licenses/LICENSE-2.0 # from pysys.constants import * from apamax.analyticsbuilder.basetest import AnalyticsBuilderBaseT...
Cumulocity-IoT/apama-analytics-builder-block-sdk
samples/tests/HttpOutputBlock/run.py
.py
d76187ad027e8cdd
8.04
11
# # Copyright (c) 2019-present Cumulocity GmbH, Duesseldorf, Germany and/or its affiliates and/or their licensors. # This file is licensed under the Apache 2.0 license - see https://www.apache.org/licenses/LICENSE-2.0 # from pysys.constants import * from apamax.analyticsbuilder.basetest import AnalyticsBuilderBaseT...
Cumulocity-IoT/apama-analytics-builder-block-sdk
samples/tests/Offset/run.py
.py
4001b632bdaddf25
7.04
11
# Copyright (c) 2019-present Cumulocity GmbH, Duesseldorf, Germany and/or its affiliates and/or their licensors. # This file is licensed under the Apache 2.0 license - see https://www.apache.org/licenses/LICENSE-2.0 __pysys_title__ = r""" ONNX block: To check the basic working of the block""" __pysys_purpose__ = ...
Cumulocity-IoT/apama-analytics-builder-block-sdk
samples/tests/OnnxBlock/run.py
.py
17c6e76a7f867fe7
7.04
11
# # Copyright (c) 2019-present Cumulocity GmbH, Duesseldorf, Germany and/or its affiliates and/or their licensors. # This file is licensed under the Apache 2.0 license - see https://www.apache.org/licenses/LICENSE-2.0 # from pysys.constants import * from apamax.analyticsbuilder.basetest import AnalyticsBuilderBaseT...
Cumulocity-IoT/apama-analytics-builder-block-sdk
samples/tests/Percentile/run.py
.py
0bb1bdc5dea2eef5
7.04
11
# # Copyright (c) 2019-present Cumulocity GmbH, Duesseldorf, Germany and/or its affiliates and/or their licensors. # This file is licensed under the Apache 2.0 license - see https://www.apache.org/licenses/LICENSE-2.0 # from pysys.constants import * from apamax.analyticsbuilder.basetest import AnalyticsBuilderBaseT...
Cumulocity-IoT/apama-analytics-builder-block-sdk
samples/tests/TimeDelayBlock/run.py
.py
541ceab5ec04a189
7.04
11
# # Copyright (c) 2020-present Cumulocity GmbH, Duesseldorf, Germany and/or its affiliates and/or their licensors. # Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Cumulocity GmbH # from pysys.constants import * from apamax.anal...
Cumulocity-IoT/apama-analytics-builder-block-sdk
samples/tests/TimeTickerBlock/run.py
.py
a4566065e433e136
7.04
11
# # Copyright (c) 2019-present Cumulocity GmbH, Duesseldorf, Germany and/or its affiliates and/or their licensors. # This file is licensed under the Apache 2.0 license - see https://www.apache.org/licenses/LICENSE-2.0 # from pysys.constants import * from apamax.analyticsbuilder.basetest import AnalyticsBuilderBaseT...
Cumulocity-IoT/apama-analytics-builder-block-sdk
samples/tests/TimeWindow/run.py
.py
130c500472e109dc
7.04
11
# # Copyright (c) 2019-present Cumulocity GmbH, Duesseldorf, Germany and/or its affiliates and/or their licensors. # This file is licensed under the Apache 2.0 license - see https://www.apache.org/licenses/LICENSE-2.0 # from pysys.constants import * from apamax.analyticsbuilder.basetest import AnalyticsBuilderBaseT...
Cumulocity-IoT/apama-analytics-builder-block-sdk
samples/tests/TimeWindowPercentile/run.py
.py
6539f8af888cd82b
7.04
11
# # Copyright (c) 2019-present Cumulocity GmbH, Duesseldorf, Germany and/or its affiliates and/or their licensors. # This file is licensed under the Apache 2.0 license - see https://www.apache.org/licenses/LICENSE-2.0 # from pysys.constants import * from apamax.analyticsbuilder.basetest import AnalyticsBuilderBaseT...
Cumulocity-IoT/apama-analytics-builder-block-sdk
samples/tests/TimeWindowPercentile_String/run.py
.py
0cc924270a4539b1
7.04
11
#!/usr/bin/env python3 # Copyright (c) 2021-present Cumulocity GmbH, Duesseldorf, Germany and/or its affiliates and/or their licensors. # Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Cumulocity GmbH import os, urllib, buildExten...
Cumulocity-IoT/apama-analytics-builder-block-sdk
scripts/listExtensions.py
.py
9b315189ef53e5da
7.54
11
#!/usr/bin/env python ## License # Copyright (c) 2019-present Cumulocity GmbH, Duesseldorf, Germany and/or its affiliates and/or their licensors. # 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 ...
Cumulocity-IoT/apama-analytics-builder-block-sdk
testframework/apamax/analyticsbuilder/basetest.py
.py
7ae87aec600271de
8.04
11
# original code from: # https://github.com/dashea/requests-file # http://www.apache.org/licenses/LICENSE-2.0 # forked to experiment with relative file URLs and providing more headers from requests.adapters import BaseAdapter from requests.compat import urlparse, unquote from requests import Response, codes import errn...
digital-land/digital-land-python
digital_land/adapter/file.py
.py
d004b2a5d0521f52
7.52
10
import csv from enum import Enum import os import requests import logging import tempfile import typing from digital_land.pipeline.main import Pipeline from digital_land.specification import Specification DEFAULT_URL = "https://files.planning.data.gov.uk" class API: def __init__( self, specifica...
digital-land/digital-land-python
digital_land/api.py
.py
8e9b44f1fc2178fa
7.52
10
""" Module to contain the primary Classes and functions for the configuration package The config class is primarily how to access all the different configuration classes. """ import sqlite3 import urllib from pathlib import Path from digital_land.package.sqlite import SqlitePackage from digital_land.package.package ...
digital-land/digital-land-python
digital_land/configuration/main.py
.py
c90b8fade4ceb4cf
7.52
10
from abc import ABC, abstractmethod class BaseCheckpoint(ABC): @abstractmethod def load(): """filled in by child classes, ensures a config is loaded correctly should raise error if not""" pass @abstractmethod def run(self): pass @abstractmethod def save(self, output_d...
digital-land/digital-land-python
digital_land/expectations/checkpoints/base.py
.py
d7201f0e3c0dbd49
7.52
10
import inspect import json import logging import pyarrow.parquet as pq import spatialite from datetime import datetime from pathlib import Path from jinja2 import Template from digital_land.organisation import Organisation from .base import BaseCheckpoint from ..log import ExpectationLog from ..operations.dataset imp...
digital-land/digital-land-python
digital_land/expectations/checkpoints/dataset.py
.py
5c33873589774dc4
7.52
10
from .checkpoints.dataset import DatasetCheckpoint from .checkpoints.csv import CsvCheckpoint from digital_land.configuration.main import Config from digital_land.organisation import Organisation # in principle the command needs a few things: # an output directory to store expectation logs in this maybe should be in...
digital-land/digital-land-python
digital_land/expectations/commands.py
.py
7ddcb68f923614fd
7.52
10
import csv import json import pyarrow as pa import pyarrow.parquet as pq from pathlib import Path # TODO Review and connect to centralised Log classes do we need our own class for this class ExpectationLog: """ a class to create and store the log output from running expectations """ def __init__(se...
digital-land/digital-land-python
digital_land/expectations/log.py
.py
7e0b6257181730d4
7.52
10
""" Contains data classes representing the result of an expectation being ran from expectation functions """ from datetime import datetime import os # TODO I think we can remove copy, often promotes bad behaviour import copy # TODO is warnings the right module for this? or should we use logging import warnings from...
digital-land/digital-land-python
digital_land/expectations/result.py
.py
537a3097c735a9f3
7.52
10
""" Utility functions to support functions in the expectation module notes: - might want to remove QueryRunner at a future date as it loads spatialite which may not be useful for everything """ import spatialite import yaml import pandas as pd def transform_df_first_column_into_set(dataframe: pd.DataFrame) -> set: ...
digital-land/digital-land-python
digital_land/expectations/utils.py
.py
d9cc43239e488bf6
7.52
10
import itertools import keyword BUILTIN_TYPES = frozenset(("list", "dict", "str", "int", "float", "bool", "set", "frozenset", "tuple", "bytes")) def camelcase(s: str) -> str: return "".join(word[0].upper() + word[1:] for word in s.split("_")) def snake_case(s: str) -> str: """Converts string into snake cas...
vkbottle/types
generator/utility.py
.py
2feb7c1a51b57096
7.57
13
from ..fixes import fix_remove_variable_attr, fix_rename_dimension, fix_rename_variable, fix_rename_variable_attr # Attributes allowed by the protocol (kept as a set for fast membership tests) _ALLOWED_VARIABLE_ATTRS = { 'axis', 'bounds', 'calendar', 'classes', 'comment', 'description', 'en...
ISI-MIP/isimip-qc
isimip_qc/checks/dataset.py
.py
7124f8e193e55ca7
7.52
10
import pytest from ..utils.contact import match_addrs, match_contact @pytest.mark.parametrize('contact,result', [ (r"John Doe <john@example.com>", True), (r"John Doe <john@example.com>, Jane Smith <jane@company.org>", True), (r"John Doe (john@example.com)", True), (r"John Doe (john@example.com), Jane...
ISI-MIP/isimip-qc
isimip_qc/tests/test_contact.py
.py
819d7afcfaf5aa36
7.02
10
import shutil import subprocess from collections.abc import Iterable def _run_tool(tool: str, args: Iterable[str], input_file, output_file) -> None: """Run an external tool with the given arguments and files. Raises FileNotFoundError if the tool is not available in PATH and subprocess.CalledProcessError ...
ISI-MIP/isimip-qc
isimip_qc/utils/datamodel.py
.py
964b8dd006439a99
7.52
10
"""FOLIO Migration Tools package for migrating library data to FOLIO LSP.""" import importlib.metadata from typing import Protocol __version__ = importlib.metadata.version("folio_migration_tools") class StrCoercible(Protocol): """Protocol for objects that can be coerced to string.""" def __repr__(self) -> ...
FOLIO-FSE/folio_migration_tools
src/folio_migration_tools/__init__.py
.py
145bd8dc88ef2673
7.09
14
"""Configuration file loading and merging utilities. Provides functions for loading JSON configuration files with support for inheriting from parent configurations. Handles deep merging of nested dictionaries and lists while preserving unique entries. """ import json from pathlib import Path def deep_merge(target_d...
FOLIO-FSE/folio_migration_tools
src/folio_migration_tools/config_file_load.py
.py
2ad8d6b0f897247b
7.59
14
"""Custom CSV DictReader with case-insensitive field names. Provides the InsensitiveDictReader class that normalizes CSV field names to lowercase and strips whitespace, making CSV parsing more forgiving of inconsistent header formatting. """ import csv class InsensitiveDictReader(csv.DictReader): """CSV DictRea...
FOLIO-FSE/folio_migration_tools
src/folio_migration_tools/custom_dict.py
.py
745f7f55f529bf26
7.59
14
"""Writer for extradata objects generated during transformation. Provides the ExtradataWriter class for buffering and writing extradata objects (e.g., organization interfaces, bound-with parts) to separate files during migration. Handles buffering, flushing, and file management. """ import json import logging import ...
FOLIO-FSE/folio_migration_tools
src/folio_migration_tools/extradata_writer.py
.py
e684e9ab04673194
7.59
14
"""Folder structure management for migration tasks. Defines the FolderStructure class that manages the standardized directory layout for migration tasks. Creates and manages folders for source data, results, reports, logs, and mapping files. Handles path generation and validation. """ import logging import sys import...
FOLIO-FSE/folio_migration_tools
src/folio_migration_tools/folder_structure.py
.py
a2d80e9c35c6e3cf
7.59
14
"""General helper utilities for migration tasks. Provides the Helper class with static utility methods for data validation, mapping report generation, and common transformation operations used across multiple migration tasks. """ import json import logging from folio_migration_tools.i18n_cache import i18n_t class ...
FOLIO-FSE/folio_migration_tools
src/folio_migration_tools/helper.py
.py
5480c584e260d7f0
7.59
14
"""Cached i18n translation wrapper to improve performance. This module provides a drop-in replacement for i18n.t() that caches translation results on first call. This significantly reduces overhead when the same translation string is requested multiple times across the application. The cache uses functools.lru_cache ...
FOLIO-FSE/folio_migration_tools
src/folio_migration_tools/i18n_cache.py
.py
c0e25cdce907c08b
7.59
14
"""Logging configuration for folio_migration_tools. This module provides centralized logging configuration for the package. It sets up a package-level logger with RichHandler for console output that properly coordinates with Rich progress bars. Usage: from folio_migration_tools.logging_config import setup_logging...
FOLIO-FSE/folio_migration_tools
src/folio_migration_tools/logging_config.py
.py
91e29e7909dde698
7.59
14
"""Mapper for transforming organization data to FOLIO Organizations format. Provides the OrganizationMapper class for mapping legacy vendor/organization data to FOLIO Organization records. Handles embedded interfaces, contacts, categories, and extradata object creation. """ import json import logging import os import...
FOLIO-FSE/folio_migration_tools
src/folio_migration_tools/mapping_file_transformation/organization_mapper.py
.py
3534684c4ba791f5
7.59
14
"""Migration reporting and statistics tracking. Provides the MigrationReport class for tracking migration statistics, errors, and warnings during transformation and loading tasks. Generates markdown and JSON formatted reports with categorized statistics. """ import json import logging from datetime import datetime, t...
FOLIO-FSE/folio_migration_tools
src/folio_migration_tools/migration_report.py
.py
7ed9b10892fdd6e8
7.59
14
"""InventoryBatchPoster module for FOLIO inventory batch operations. This module provides an adapter that wraps folio_data_import.BatchPoster to conform to the folio_migration_tools MigrationTaskBase interface. It supports posting Instances, Holdings, Items, and ShadowInstances to FOLIO's inventory storage endpoints w...
FOLIO-FSE/folio_migration_tools
src/folio_migration_tools/migration_tasks/inventory_batch_poster.py
.py
0100ab80eedf8678
7.59
14