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
"""Custom Guardrail using a Llama-Prompt-Guard-2 model. This guardrail: 1. Translates OpenAI Chat Completions format to our internal format 2. Uses Llama-Prompt-Guard-2 to detect jailbreaks and prompt injections 3. Translates the model's response back to Databricks Guardrails format """ from typing import Any, Dict, ...
andyweaves/databricks
notebooks/ai_guardrails/prompt_guard/llama-prompt-guard-2.py
.py
0f50b93ca8fac96d
7.56
12
from databricks.sdk import WorkspaceClient import os import json import pathlib import pandas as pd def check_or_set_env_var(var_name: str, var_value: str): """ Checks if the environment variable `var_name` is set to `var_value`. If it is not, it sets it to `var_value`. """ if var_name in os.enviro...
andyweaves/databricks
notebooks/ai_guardrails/red_team/utils/garak.py
.py
7a13cd0a1a2996a1
7.56
12
# Databricks notebook source # /// script # [tool.databricks.environment] # environment_version = "5" # /// # MAGIC %md # MAGIC # Generate Fake PII Data # MAGIC # MAGIC This notebook generates realistic fake PII (Personally Identifiable Information) data across multiple locales and writes it to a Unity Catalog Delta ta...
andyweaves/databricks
notebooks/fake_pii_data/generate_fake_pii.py
.py
d4892d6520031d98
7.56
12
# Databricks notebook source # MAGIC %pip install -q ff3-cryptography faker mimesis # COMMAND ---------- # MAGIC %run ../../common/privacy_functions # COMMAND ---------- # MAGIC %md # MAGIC ## Step 1: Generate some fake PII data using ```faker``` # COMMAND ---------- df = generate_fake_pii_data(num_rows=1000).dro...
andyweaves/databricks
notebooks/privacy/format_preserving_encryption/format_preserving_encryption.py
.py
cba5da3dd0a6b53d
7.56
12
# Databricks notebook source # MAGIC %pip install -q ff3-cryptography # COMMAND ---------- # MAGIC %md # MAGIC ## FPE Test Suite # MAGIC # MAGIC Tests for format-preserving encryption. Run this notebook to validate the FPE logic, # MAGIC including bug fixes for reassemble bounds checking, charset selection, and speci...
andyweaves/databricks
notebooks/privacy/format_preserving_encryption/format_preserving_encryption_tests.py
.py
76905d203a6c5b20
7.06
12
# Copyright (C) 2023 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # 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, includi...
ansys/pyansys-sound
src/ansys/sound/core/_pyansys_sound.py
.py
b2cd1e4f88ebfbab
7.45
7
# Copyright (C) 2023 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # 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, includi...
ansys/pyansys-sound
src/ansys/sound/core/order_analysis/isolate_orders.py
.py
26d900fca8494fa4
7.45
7
# Copyright (C) 2023 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # 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, includi...
ansys/pyansys-sound
src/ansys/sound/core/order_analysis/rpm_order_representation.py
.py
f119f104f1d94bf5
7.45
7
# Copyright (C) 2023 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # 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, includi...
ansys/pyansys-sound
src/ansys/sound/core/psychoacoustics/fluctuation_strength.py
.py
c62274f8d446f499
7.45
7
# Copyright (C) 2023 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # 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, includi...
ansys/pyansys-sound
src/ansys/sound/core/psychoacoustics/loudness_ansi_s3_4.py
.py
4f9912c441ce258b
7.45
7
# Copyright (C) 2023 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # 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, includi...
ansys/pyansys-sound
src/ansys/sound/core/psychoacoustics/loudness_iso_532_1_stationary.py
.py
b9e916e77e72b43a
7.45
7
# Copyright (C) 2023 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # 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, includi...
ansys/pyansys-sound
src/ansys/sound/core/psychoacoustics/loudness_iso_532_1_time_varying.py
.py
f15324255aeef35e
7.45
7
# Copyright (C) 2023 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # 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, includi...
ansys/pyansys-sound
src/ansys/sound/core/psychoacoustics/loudness_iso_532_2.py
.py
ab9684e00ceb879c
7.45
7
# Copyright (C) 2023 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # 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, includi...
ansys/pyansys-sound
src/ansys/sound/core/psychoacoustics/prominence_ratio.py
.py
ba2bb09293fe451e
7.45
7
# Copyright (C) 2023 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # 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, includi...
ansys/pyansys-sound
src/ansys/sound/core/psychoacoustics/prominence_ratio_for_orders_over_time.py
.py
e345387b8e28d478
7.45
7
# Copyright (C) 2023 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # 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, includi...
ansys/pyansys-sound
src/ansys/sound/core/psychoacoustics/roughness.py
.py
a7b13c1be1229f80
7.45
7
# Copyright (C) 2023 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # 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, includi...
ansys/pyansys-sound
src/ansys/sound/core/psychoacoustics/roughness_ecma_418_2.py
.py
e72df411d6f77f98
7.45
7
# Copyright (C) 2023 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # 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, includi...
ansys/pyansys-sound
src/ansys/sound/core/psychoacoustics/sharpness.py
.py
601781a1f43705cb
7.45
7
# Copyright (C) 2023 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # 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, includi...
ansys/pyansys-sound
src/ansys/sound/core/psychoacoustics/sharpness_din_45692.py
.py
d5c59c271be155a6
7.45
7
# Copyright (C) 2023 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # 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, includi...
ansys/pyansys-sound
src/ansys/sound/core/psychoacoustics/sharpness_din_45692_over_time.py
.py
9372d4dd0f89825b
7.45
7
# Copyright (C) 2023 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # 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, includi...
ansys/pyansys-sound
src/ansys/sound/core/psychoacoustics/sharpness_over_time.py
.py
5749cd1db21bd581
7.45
7
# Copyright (C) 2023 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # 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, includi...
ansys/pyansys-sound
src/ansys/sound/core/psychoacoustics/spectral_centroid.py
.py
eb77be8c1d0d7950
7.95
7
# Copyright (C) 2023 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # 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, includi...
ansys/pyansys-sound
src/ansys/sound/core/psychoacoustics/tonality_aures.py
.py
f6f470d9d62baa53
7.45
7
# Copyright (C) 2023 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # 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, includi...
ansys/pyansys-sound
src/ansys/sound/core/psychoacoustics/tonality_din_45681.py
.py
64397b36e4831ac5
7.45
7
# Copyright (C) 2023 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # 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, includi...
ansys/pyansys-sound
src/ansys/sound/core/psychoacoustics/tonality_ecma_418_2.py
.py
85ec191c9c2d4d52
7.45
7
# Copyright (C) 2023 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # 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, includi...
ansys/pyansys-sound
src/ansys/sound/core/psychoacoustics/tonality_iso_1996_2.py
.py
e7bbe7bc2b1188cd
7.45
7
# Copyright (C) 2023 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # 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, includi...
ansys/pyansys-sound
src/ansys/sound/core/psychoacoustics/tonality_iso_1996_2_over_time.py
.py
da34cb66b74ab68f
7.45
7
# Copyright (C) 2023 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # 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, includi...
ansys/pyansys-sound
src/ansys/sound/core/psychoacoustics/tonality_iso_ts_20065.py
.py
e4d88fde1f724cd5
7.45
7
# Copyright (C) 2023 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # 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, includi...
ansys/pyansys-sound
src/ansys/sound/core/psychoacoustics/tone_to_noise_ratio.py
.py
8c22129e8a170fae
7.45
7
# Copyright (C) 2023 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # 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, includi...
ansys/pyansys-sound
src/ansys/sound/core/psychoacoustics/tone_to_noise_ratio_for_orders_over_time.py
.py
f0823429a8671dbe
7.45
7
# Copyright (C) 2023 - 2026 Synopsys, Inc. and ANSYS, Inc. All rights reserved. # SPDX-License-Identifier: MIT # # # 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, includi...
ansys/pyansys-sound
src/ansys/sound/core/server_helpers/_check_version.py
.py
899906bff1af94c0
7.45
7
""" Defense methods. code from https://github.com/zhuohangli/GGL Including: - Additive noise - Gradient clipping - Gradient compression - Representation perturbation """ import numpy as np import torch params = {'dp': 'noise_std', 'clip': 'clip_bound', 'sparse': 'sparse_ratio', 'perturb': 'prune_rate'} def additive_...
mankasto/iLRG
ilrg/defense.py
.py
c1115f806718b19c
7.54
11
"""This is code for median pooling from https://gist.github.com/rwightman. https://gist.github.com/rwightman/f2d3849281624be7c0f11c85c87c1598 """ import torch.nn as nn import torch.nn.functional as F from torch.nn.modules.utils import _pair, _quadruple class MedianPool2d(nn.Module): """Median pool (usable as med...
mankasto/iLRG
ilrg/medianfilt.py
.py
72cc18c9b5800500
7.54
11
"""This file is part of https://github.com/ildoonet/pytorch-gradual-warmup-lr. MIT License Copyright (c) 2019 Ildoo Kim 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, inclu...
mankasto/iLRG
ilrg/scheduler.py
.py
5db0efbba6330305
7.54
11
"""Generates the Protocol0 Windows icon (installer/windows/assets/protocol0.ico). Faithful to the site's badge (src/website/favicon.svg): rounded dark-gradient square, thin border, bold blue "P" centered. We draw the badge with Pillow rather than rasterize the SVG, to avoid any system binary dependency (cairosvg/inksc...
lebrunthibault/protocol0
installer/windows/generate_icon.py
.py
576a185e585f53ad
7.42
6
"""Shared, dependency-free helpers for the cross-platform dev tooling. stdlib-only on purpose: these run *before* any poetry env exists (at bootstrap time) and in CI, so they cannot import third-party packages. """ import subprocess import sys from pathlib import Path # Repo root = parent of this scripts/ directory. ...
lebrunthibault/protocol0
scripts/_pyfind.py
.py
e3cfc660aa4094d7
7.42
6
"""One-command local dev setup, cross-platform (Windows + macOS). Sets up the remote script's poetry env (lint/test tooling — flake8, pytest; the script itself is stdlib-only) and deploys the remote script into Ableton. The agent is Rust (`make agent` builds it with cargo) and needs no poetry. After this, `make agent`...
lebrunthibault/protocol0
scripts/bootstrap.py
.py
78b5952fc8323f35
7.42
6
"""Arrete le stack dev lance par `make up` (target `make down`). Lit les PID memorises dans %APPDATA%\\Protocol0\\dev-up.json (ecrit par scripts/up.py) et tue chaque arbre de process avec `taskkill /T` (les services tournent via un shell qui spawn node/poetry en enfants -> il faut tuer l'arbre, pas juste le shell pare...
lebrunthibault/protocol0
scripts/down.py
.py
a352b265815a32d7
7.42
6
"""Deploy the DEV remote script into Ableton's MIDI Remote Scripts directory. Cross-platform port of the old `make install_script` (Windows PowerShell). Copies the Protocol_0 template into Ableton, then rewrites the DEV loader's __P0_SOURCE_DIR__ placeholder to this checkout's src/remote-script path, so Ableton loads ...
lebrunthibault/protocol0
scripts/install_remote_script.py
.py
e5e8da0ab99af00f
7.42
6
"""Liste les process agent en cours et les tue (target `make kill-agent`). Pourquoi : le bug "un raccourci charge plusieurs devices" venait de DEUX agents tournant en parallele (cf. docs/debug-double-shortcut.md). Le mutex single-instance couvre la tache planifiee, mais des lancements manuels en mode source (`poetry r...
lebrunthibault/protocol0
scripts/kill_agent.py
.py
4ae7bad133dabb5b
7.42
6
"""Tail combine les logs Ableton et ceux de l'agent dans un seul terminal (target `make logs`). Pourquoi : en dev on veut une seule fenetre qui montre ce que fait le remote script (cote Ableton, via Log.txt) ET ce que fait l'agent (raccourcis clavier, appels HTTP au script, serveur web). Avant, ca vivait dans le backe...
lebrunthibault/protocol0
scripts/logs.py
.py
1ee251d88b7403cb
7.42
6
import click from srecli.group import ContextObj, ViewCommand, cli_response from srecli.group.customer_rabbitmq import rabbitmq attributes_order = 'name', 'display_name', 'admins' @click.group(name='customer') def customer(): """Manages Syndicate Rule Engine Customer Entities""" @customer.command(cls=ViewComm...
epam/syndicate-rule-engine
cli/srecli/group/customer.py
.py
ed08e19952030901
7.45
7
import click from srecli.group import ( ConditionalGroup, ContextObj, ViewCommand, cli_response, require_maestro_integration, ) @click.group(name='rabbitmq', cls=ConditionalGroup) def rabbitmq(): """ Manages RabbitMQ configuration for a customer """ @rabbitmq.command(cls=ViewCommand,...
epam/syndicate-rule-engine
cli/srecli/group/customer_rabbitmq.py
.py
3ee3fb1e33adae04
7.45
7
import click from srecli.group import ( ContextObj, ViewCommand, build_tenant_option, cli_response, ) from srecli.service.constants import AWS, AZURE, GOOGLE, KUBERNETES @click.group(name='chronicle') def chronicle(): """ Manages chronicle integrations """ @chronicle.command(cls=ViewCom...
epam/syndicate-rule-engine
cli/srecli/group/integrations_chronicle.py
.py
948571f2be39529b
7.45
7
import click from srecli.group import ( ConditionalGroup, ContextObj, ViewCommand, build_tenant_option, cli_response, require_maestro_integration, ) from srecli.service.constants import AWS, AZURE, GOOGLE, KUBERNETES @click.group(name='re', cls=ConditionalGroup) def re(): """ Manages R...
epam/syndicate-rule-engine
cli/srecli/group/integrations_re.py
.py
182ab972094b0fab
7.45
7
import click from srecli.group import ContextObj, ViewCommand, cli_response from srecli.group.job_event_maestro import maestro from srecli.service.adapter_client import SREResponse from srecli.service.event_files import ( events_file_option, load_events_from_file, ) @click.group(name='event', hidden=True) de...
epam/syndicate-rule-engine
cli/srecli/group/job_event.py
.py
e596fca5655b101d
7.45
7
import click from srecli.group import ( ContextObj, ViewCommand, cli_response, ) from srecli.service.adapter_client import SREResponse from srecli.service.constants import ( ServiceOperationType, OPERATION_STATUS_HINT, ) @click.group(name='metadata') def metadata(): """Manages locally sto...
epam/syndicate-rule-engine
cli/srecli/group/metadata.py
.py
e9810af468383457
7.45
7
import click from srecli.group import ( ContextObj, ViewCommand, cli_response, ) from srecli.service.constants import ( ServiceOperationType, OPERATION_STATUS_HINT, ) from srecli.service.adapter_client import SREResponse @click.group(name='metrics') def metrics(): """Manages Scan and Tena...
epam/syndicate-rule-engine
cli/srecli/group/metrics.py
.py
a901a111425601b6
7.45
7
from typing import Optional import click from srecli.group import ( ContextObj, ViewCommand, build_tenant_option, cli_response, ) @click.group(name='k8s') def k8s(): """Manages kubernetes platforms""" @k8s.command(cls=ViewCommand, name='create') @build_tenant_option(required=True) @click.option...
epam/syndicate-rule-engine
cli/srecli/group/platform_k8s.py
.py
0076551165e42188
7.45
7
import json from pathlib import Path import click from srecli.group import ContextObj, ViewCommand, cli_response, validate_file_optional attributes_order = 'name', 'permissions', 'customer' @click.group(name='policy') def policy(): """Manages Entities""" @policy.command(cls=ViewCommand, name='describe') @cli...
epam/syndicate-rule-engine
cli/srecli/group/policy.py
.py
d915f2b0d14e1a68
7.45
7
from datetime import datetime from typing import Optional import click from srecli.group import ( build_job_id_option, from_date_report_option, optional_job_type_option, to_date_report_option, ) from srecli.group import ContextObj, ViewCommand, cli_response from srecli.group import tenant_option @cl...
epam/syndicate-rule-engine
cli/srecli/group/report_digests.py
.py
9d1769f23874373f
7.45
7
import click from srecli.group import ContextObj, ViewCommand, cli_response from srecli.group import build_tenant_option from srecli.group import SREResponse from srecli.service.presigned_hints_pack import presigned_url_hints_pack @click.group(name='raw') def raw(): """Fetches raw report""" @raw.command(cls=Vi...
epam/syndicate-rule-engine
cli/srecli/group/report_raw.py
.py
08444c6663b1fddc
7.45
7
from datetime import datetime from typing import Optional import click from srecli.group import ( build_job_id_option, build_job_type_option, optional_job_type_option, SREResponse, ) from srecli.group import ( ContextObj, ViewCommand, build_tenant_option, cli_response, from_date_re...
epam/syndicate-rule-engine
cli/srecli/group/report_rules.py
.py
f3542973c3030cbd
7.45
7
from datetime import datetime import click from srecli.group import ( ContextObj, ViewCommand, cli_response, next_option, build_tenant_option, build_limit_option, exception_expire_at_required_option, ) from srecli.service.adapter_client import SREResponse @click.group(name='exception') def exception(): ...
epam/syndicate-rule-engine
cli/srecli/group/resource_exception.py
.py
a1cc1159f79eeb5e
7.45
7
from datetime import datetime import click from srecli.group import ( ContextObj, ViewCommand, cli_response, DYNAMIC_DATE_ONLY_EXAMPLE, ) attributes_order = 'name', 'expiration', 'policies' @click.group(name='role') def role(): """Manages Role Entity""" @role.command(cls=ViewCommand, name='describe')...
epam/syndicate-rule-engine
cli/srecli/group/role.py
.py
94384797c46d6288
7.45
7
import click from srecli.group import ( ContextObj, ViewCommand, build_rule_source_id_option, cli_response, ) from srecli.group import limit_option, next_option from srecli.service.constants import RULE_CLOUDS from srecli.service.adapter_client import SREResponse from srecli.service.constants import IT...
epam/syndicate-rule-engine
cli/srecli/group/rule.py
.py
50482043b081f409
7.45
7
import click from srecli.group import ( ContextObj, ViewCommand, cli_response, DYNAMIC_DATE_ONLY_PAST_EXAMPLE, DYNAMIC_DATE_ONLY_NOW_EXAMPLE, ) from srecli.service.adapter_client import SREResponse from srecli.service.constants import ServiceOperationType _CLI_TO_API = {member.value[0]: member.value[1] for me...
epam/syndicate-rule-engine
cli/srecli/group/service_operations.py
.py
5b931332cf916f37
7.45
7
import click from srecli.group import ContextObj, ViewCommand, cli_response @click.group(name='mail') def mail(): """Manages Mail configuration""" @mail.command(cls=ViewCommand, name='describe') @click.option('--display_password', '-dp', is_flag=True, default=False, help='Specify to whether displ...
epam/syndicate-rule-engine
cli/srecli/group/setting_mail.py
.py
7cdc660ba9b82f89
7.45
7
import click from srecli.group import ViewCommand, cli_response, ContextObj, limit_option, \ next_option, build_tenant_option from srecli.service.constants import AWS, AZURE, GOOGLE from srecli.service.adapter_client import SREResponse @click.group(name='credentials') def credentials(): """ Allows to bin...
epam/syndicate-rule-engine
cli/srecli/group/tenant_credentials.py
.py
74ae18e3900a95a6
7.45
7
# (C) Copyright 2024 ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmenta...
ecmwf/earthkit-geo
src/earthkit/geo/cartography.py
.py
57196a079619cd79
7.42
6
# (C) Copyright 2024 ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmenta...
ecmwf/earthkit-geo
src/earthkit/geo/coord.py
.py
5772484ab16b82c0
7.42
6
# (C) Copyright 2024 ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmenta...
ecmwf/earthkit-geo
src/earthkit/geo/figure.py
.py
2fdf43c830c9aefa
7.42
6
# (C) Copyright 2024 ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmenta...
ecmwf/earthkit-geo
src/earthkit/geo/gisco.py
.py
bd9f985ac9776436
7.42
6
# (C) Copyright 2023 ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmenta...
ecmwf/earthkit-geo
src/earthkit/geo/grids/_regrid/regrid.py
.py
9f6fd9c424e5321a
7.42
6
# (C) Copyright 2023 ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmenta...
ecmwf/earthkit-geo
src/earthkit/geo/grids/utils/memcache.py
.py
fe3e60d21d8c0cc9
7.42
6
# (C) Copyright 2024 ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmenta...
ecmwf/earthkit-geo
src/earthkit/geo/rotate.py
.py
8989e16ac04a62de
7.42
6
# (C) Copyright 2023 ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmenta...
ecmwf/earthkit-geo
src/earthkit/geo/utils/__init__.py
.py
53d2718538ad3a2f
7.42
6
# (C) Copyright 2023 ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmenta...
ecmwf/earthkit-geo
src/earthkit/geo/utils/humanize.py
.py
df2babdf9e0b0afb
7.42
6
# (C) Copyright 2023 ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernmenta...
ecmwf/earthkit-geo
src/earthkit/geo/utils/temporary.py
.py
be59f79a69628610
7.42
6
"""Array processing utilities for Dask, Zarr, and NumPy arrays.""" import math from typing import Optional, Tuple, Union import numpy as np import zarr from dask import array as da try: import cupy as cp cupy_available = True except ImportError: cupy_available = False from ome_zarr_pyramid.utils.logging...
Euro-BioImaging/ome_zarr_pyramid
src/ome_zarr_pyramid/utils/array_utils.py
.py
7fca960c91fbb520
7.45
7
"""JSON serialization and conversion utilities for numpy types and nested structures.""" import json import warnings from typing import Any import numpy as np def convert_np_types(obj: Any) -> Any: """Convert NumPy types to native Python types for JSON serialization. Args: obj: Object to conver...
Euro-BioImaging/ome_zarr_pyramid
src/ome_zarr_pyramid/utils/json_utils.py
.py
661c8bf94e2a62d2
7.45
7
"""Shared fixtures for the ome_zarr_pyramid test suite. The public surface under test is the working core: `Pyramid` (construction, indexing, downscaling, metadata, operators) and `IO` (NGFF read/write). Legacy process/creation/CLI modules are intentionally out of scope. """ import numpy as np import pytest import za...
Euro-BioImaging/ome_zarr_pyramid
tests/conftest.py
.py
dca36199f905d962
7.95
7
"""Pyramid construction via `from_arrays`: axes, shape, dtype, layers, scales.""" import numpy as np def test_from_arrays_basic(pyr3d): pyr, data = pyr3d assert pyr.axes == "cyx" assert pyr.meta.ndim == 3 assert pyr.shape == data.shape assert str(pyr.dtype) == "float32" assert pyr.nlayers == ...
Euro-BioImaging/ome_zarr_pyramid
tests/test_construction.py
.py
9062876db88c3cc6
7.95
7
"""IO: write a Pyramid to an OME-Zarr store and read it back, checking that pixel data and NGFF metadata survive the round trip (both 0.4 and 0.5).""" import numpy as np import pytest from ome_zarr_pyramid.core.io import IO @pytest.mark.parametrize("version", ["0.4", "0.5"]) def test_roundtrip_data_and_axes(make_py...
Euro-BioImaging/ome_zarr_pyramid
tests/test_io_roundtrip.py
.py
af95ac77290878f0
7.95
7
from __future__ import annotations from typing import Any def build_args(*, non_null_defaults: set[str], **kwargs) -> dict[str, Any]: """Build a dictionary of arguments for the analysis. Parameters ---------- non_null_defaults : set[str], optional A set of argument names that are optional bu...
MREYE-LUMC/visisipy
tests/helpers.py
.py
c13348e96f5942f7
7.09
14
from __future__ import annotations import numpy as np import pytest import zospy as zp from visisipy.models.materials import NavarroMaterials pytestmark = [pytest.mark.needs_opticstudio] @pytest.fixture def opticstudio_model(oss): """Simple optical system with 3 parallel surfaces: a stop, refracting interface,...
MREYE-LUMC/visisipy
tests/opticstudio/test_material_models.py
.py
76faf1fe29801b04
8.09
14
#!/usr/bin/env python3 """ Generate the GitHub Actions test matrix for collector tests. Discovers all collectors with test directories (test/ or tests/) and includes them in the matrix. All collectors are always tested. """ import json import os from pathlib import Path # Directories that are NOT collectors (exclude...
OpenAEV-Platform/collectors
.github/scripts/build_test_matrix.py
.py
dd81452fd7d8c0a7
8.07
13
from pydantic import Field from pyoaev.configuration import ConfigLoaderOAEV, Configuration, SettingsLoader from crowdstrike.configuration.collector_config_override import CollectorConfigOverride from crowdstrike.configuration.crowdstrike_settings import CrowdstrikeSettings class ConfigLoader(SettingsLoader): op...
OpenAEV-Platform/collectors
crowdstrike/crowdstrike/configuration/config_loader.py
.py
2d7b16efdfa437c2
7.57
13
"""Core collector.""" import os from pyoaev.daemons import CollectorDaemon # type: ignore[import-untyped] from pyoaev.helpers import OpenAEVDetectionHelper # type: ignore[import-untyped] from src.services.expectation_service import ElasticExpectationService from src.services.trace_service import ElasticTrace...
OpenAEV-Platform/collectors
elastic/src/collector/collector.py
.py
32414d209882d3bd
7.57
13
#!/usr/bin/env python3 """ Generate the GitHub Actions test matrix for injector tests. Discovers all injectors with test directories (test/ or tests/) and includes them in the matrix. All injectors are always tested. """ import json import os from pathlib import Path # Directories that are NOT injectors (excluded fr...
OpenAEV-Platform/injectors
.github/scripts/build_test_matrix.py
.py
3b0fb044f0b2b1be
7.95
7
"""Catalog of AI red-team techniques exposed by the ai-redteam injector. Each native technique maps to MITRE ATLAS technique external ids (AML.Txxxx) and OWASP (LLM 2025 / Agentic 2026) references, so injects flow into the ATLAS coverage matrix exactly like endpoint techniques flow into the ATT&CK matrix. Contract...
OpenAEV-Platform/injectors
ai-redteam/ai_redteam/contracts/constants.py
.py
b3896e200f20b588
7.45
7
"""Success detection for AI red-team attacks. Determines, from a model response, whether an adversarial technique succeeded (the target is vulnerable). The default heuristic combines canary leakage, explicit success keywords, and refusal detection. This is intentionally conservative: a clear refusal counts as a su...
OpenAEV-Platform/injectors
ai-redteam/ai_redteam/detectors.py
.py
b9f655a74fed62d5
7.45
7
"""Engine registry. Each engine implements one execution backend for AI red-team techniques.""" from ai_redteam.contracts import constants as c from ai_redteam.engines.garak import GarakEngine from ai_redteam.engines.native import NativeEngine from ai_redteam.engines.promptfoo import PromptfooEngine from ai_redt...
OpenAEV-Platform/injectors
ai-redteam/ai_redteam/engines/__init__.py
.py
52535cb24f977947
7.45
7
"""Engine abstraction. An engine runs one AI red-team technique against a resolved target and returns an EngineResult that the injector turns into an execution callback (message + structured outputs). """ import base64 import codecs class EngineResult: def __init__( self, success: bool...
OpenAEV-Platform/injectors
ai-redteam/ai_redteam/engines/base.py
.py
93dd55ceef9cb79b
7.45
7
"""PyRIT engine: multi-turn adversarial orchestration. Prefers Microsoft PyRIT (https://github.com/Azure/PyRIT) when available. PyRIT is a library (not a CLI) with a fast-moving API, so it is imported lazily; if it is unavailable or its API differs, the engine gracefully degrades to a built-in iterative "escalatio...
OpenAEV-Platform/injectors
ai-redteam/ai_redteam/engines/pyrit.py
.py
a62ee1c571dd903d
7.45
7
"""Per-inject canary marker used to (a) detect attack success in the model response and (b) let AI defense collectors correlate a guardrail/firewall event back to a specific inject execution. The marker is deterministic per (inject_id, agent_id) so the platform-side expectation signatures and the collector-side lo...
OpenAEV-Platform/injectors
ai-redteam/ai_redteam/marker.py
.py
2a92092a27580d86
7.45
7
import json import time from typing import Dict from ai_redteam import marker as marker_mod from ai_redteam.configuration.config_loader import ConfigLoader from ai_redteam.engines import build_registry, contract_engine_map from ai_redteam.targets.target_resolver import resolve_targets from pyoaev.helpers impor...
OpenAEV-Platform/injectors
ai-redteam/ai_redteam/openaev_ai_redteam.py
.py
e4121d67bffe7821
7.45
7
"""Resolves the AI target connection(s) for an inject. The contract exposes a "Type of targets" selector (`target_selector`) with three modes: 1. ``ai_target`` (default) - reference a pre-configured `AiTarget` asset by id (contract field `ai_target`), fetched from the platform. 2. ``asset-groups`` - run ...
OpenAEV-Platform/injectors
ai-redteam/ai_redteam/targets/target_resolver.py
.py
19fba4929e23b50a
7.45
7
import json import time from typing import Dict from pyoaev.helpers import OpenAEVConfigHelper, OpenAEVInjectorHelper from aws.configuration.config_loader import ConfigLoader from aws.contracts_aws import ( CLOUDTRAIL_ENUM_CONTRACT, COGNITO_ENUM_CONTRACT, DYNAMODB_ENUM_CONTRACT, EBS_ENUM_SNAPSHOTS_CON...
OpenAEV-Platform/injectors
aws/aws/openaev_aws.py
.py
09e97f3b27c3b36a
7.45
7
"""Stats-utility functions for ArviZ.""" import logging from collections.abc import Sequence import numpy as np __all__ = ["make_ufunc", "calculate_khat_bin_edges"] _log = logging.getLogger(__name__) def make_ufunc(func, n_dims=2, n_output=1, n_input=1, index=Ellipsis, ravel=True, check_shape=None): """Make u...
arviz-devs/arviz-stats
src/arviz_stats/base/stats_utils.py
.py
baae36779644548e
7.64
18
"""Utility functions for computing the PIT ECDF and the simultaneous confidence bands.""" from functools import lru_cache import numpy as np import xarray as xr from arviz_base import dict_to_dataset from scipy.special import bdtr, bdtrik, gammaln # pylint: disable=no-name-in-module def difference_ecdf_pit(predict...
arviz-devs/arviz-stats
src/arviz_stats/ecdf_utils.py
.py
510fb3c897626597
7.64
18
"""Helper functions for PSIS-LOO-CV moment matching.""" import numpy as np from xarray import DataArray __all__ = ["mm_from_pymc"] def mm_from_pymc( idata, *, model=None, var_name=None, ): """Build the inputs needed by :func:`arviz_stats.loo_moment_match` from a PyMC model. :func:`arviz_sta...
arviz-devs/arviz-stats
src/arviz_stats/loo/loo_moment_match_helper.py
.py
b3e87b00189ddc3a
7.64
18
# pylint: disable=too-many-instance-attributes,too-many-arguments,too-many-public-methods """Base class for sampling wrappers.""" from arviz_base import convert_to_datatree from xarray import apply_ufunc class SamplingWrapper: """Class wrapping sampling routines for its usage via ArviZ. Using a common class...
arviz-devs/arviz-stats
src/arviz_stats/loo/wrapper.py
.py
33ffb21cc9d2e590
7.64
18
"""Array numba functions.""" import numpy as np from numba import guvectorize, jit from arviz_stats.base.array import BaseArray def process_ary_axes(ary, axes): """Process input array and axes to ensure input core dims are flattened into the last axis. Parameters ---------- ary : array_like axe...
arviz-devs/arviz-stats
src/arviz_stats/numba/array.py
.py
1c69bfd56a4d8f41
7.64
18
"""Diagnostics as gufuncs powered by xarray, numba and einops.""" import numba import numpy as np import scipy import xarray as xr from scipy.fftpack import next_fast_len from xarray_einstats import stats from xarray_einstats.einops import rearrange __all__ = ["rhat", "ess"] def _backtransform_ranks(da, c=3 / 8): ...
arviz-devs/arviz-stats
src/arviz_stats/numba/diagnostics.py
.py
96cddae300aa02db
7.64
18
"""Credible interval estimators.""" import warnings import numpy as np import xarray as xr from arviz_base import rcParams from numba import guvectorize from xarray_einstats import _remove_indexes_to_reduce __all__ = ["eti", "quantile"] @guvectorize( ["void(float64[:], float64[:], float64[:])", "void(int64[:],...
arviz-devs/arviz-stats
src/arviz_stats/numba/intervals.py
.py
e88d7cddd1e2b053
7.64
18
"""Survival analysis utilities.""" import warnings import numpy as np from arviz_base import dict_to_dataset, extract def kaplan_meier( dt, var_names, ): """Compute Kaplan-Meier survival curves for observed data. Parameters ---------- dt: DataTree DataTree with "posterior_predictive...
arviz-devs/arviz-stats
src/arviz_stats/survival.py
.py
b777ab9bd9b24004
7.64
18
"""ArviZ stats general utility functions.""" import warnings from collections.abc import Hashable from dataclasses import dataclass from importlib import import_module import numpy as np import xarray as xr from arviz_base import convert_to_dataset, rcParams from xarray import DataArray from arviz_stats.validate imp...
arviz-devs/arviz-stats
src/arviz_stats/utils.py
.py
28f04337039b408c
7.64
18
"""Validator functions for common arguments.""" from arviz_base import rcParams def validate_dims(dims): """Validate `dims` argument. Uses the default in rcParams and ensures the returned object is a list. Parameters ---------- dims : str, sequence of hashable, or None Returns ------- ...
arviz-devs/arviz-stats
src/arviz_stats/validate.py
.py
e9eff01d86c41fcd
7.64
18
"""Tests for circular_utils.""" import numpy as np from numpy.testing import assert_allclose from arviz_stats.base.circular_utils import ( circular_diff, circular_mean, circular_sd, circular_var, mean_resultant_length, ) def test_circular_diff_zero(): """Test that difference of identical ang...
arviz-devs/arviz-stats
tests/base/test_circular_utils.py
.py
10eafff67e0ba1f6
7.14
18