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
""" add a 'graded' boolean to course_block_names_dict and course_block_names """ from alembic import op revision = "0017" down_revision = "0016" branch_labels = None depends_on = None on_cluster = " ON CLUSTER '{{CLICKHOUSE_CLUSTER_NAME}}' " if "{{CLICKHOUSE_CLUSTER_NAME}}" else "" def drop_objects(): # We incl...
openedx/tutor-contrib-aspects
tutoraspects/templates/aspects/apps/aspects/migrations/alembic/versions/0017_add_graded_course_block_names.py
.py
096819d9aedec133
7.09
14
"""Update the get org function to include other characters""" from alembic import op import sqlalchemy as sa revision = "0020" down_revision = "0017" branch_labels = None depends_on = None def upgrade(): op.execute( f""" CREATE OR REPLACE FUNCTION get_org_from_course_url AS ( cou...
openedx/tutor-contrib-aspects
tutoraspects/templates/aspects/apps/aspects/migrations/alembic/versions/0020_get_org_from_course_url.py
.py
d0d517ea21505af7
8.09
14
""" create external_id sink table This table is always created, but it will only be populated if ASPECTS_ENABLE_PII. .. pii: Stores a mapping between an Open edX user and their external_id values stored in Open edX. .. pii_types: user_id, username .. pii_retirement: local_api, consumer_api """ from alembic import op ...
openedx/tutor-contrib-aspects
tutoraspects/templates/aspects/apps/aspects/migrations/alembic/versions/0026_event_sink_external_id.py
.py
cac4a1acfc1095b1
8.09
14
""" Partition the event_sink.user_profile table .. pii: Stores Open edX user profile data. .. pii_types: user_id, name, username, location, phone_number, email_address, birth_date, biography, gender .. pii_retirement: local_api, consumer_api """ from alembic import op revision = "0027" down_revision = "0026" branch_...
openedx/tutor-contrib-aspects
tutoraspects/templates/aspects/apps/aspects/migrations/alembic/versions/0027_partition_event_sink_user_profile.py
.py
7fde569fd21cbec1
7.09
14
""" create user_pii table sourced from an in-memory dictionary joining the PII tables. This table is always created, but it will only be populated if ASPECTS_ENABLE_PII. Once accessed, data from this dictionary is cached in-memory for ASPECTS_PII_CACHE_LIFETIME seconds. .. pii: Stores Open edX user and profile data i...
openedx/tutor-contrib-aspects
tutoraspects/templates/aspects/apps/aspects/migrations/alembic/versions/0028_user_pii.py
.py
6e93734bd19311e5
8.09
14
""" As part of the Ralph 4.0 upgrade, we drop the unused JSON column "event" and rename "event_json" to "event". """ from alembic import op revision = "0029" down_revision = "0028" branch_labels = None depends_on = None on_cluster = ( " ON CLUSTER '{{CLICKHOUSE_CLUSTER_NAME}}' " if "{{CLICKHOUSE_CLUSTER_NAME}...
openedx/tutor-contrib-aspects
tutoraspects/templates/aspects/apps/aspects/migrations/alembic/versions/0029_drop_json_column.py
.py
44a099773c4b567d
7.09
14
""" As part of the Ralph 4.0 upgrade, we need to rename "event_json" to "event". Later we've removed all references to the JSON columns and allow_experimental_object_type since they have been removed from ClickHouse and cause various errors. """ from alembic import op revision = "0030" down_revision = "0029" branch_...
openedx/tutor-contrib-aspects
tutoraspects/templates/aspects/apps/aspects/migrations/alembic/versions/0030_rename_vector_json_column.py
.py
4d25ee981c3343e5
8.09
14
""" Add email column to user profile table """ from alembic import op revision = "0031" down_revision = "0030" branch_labels = None depends_on = None on_cluster = " ON CLUSTER '{{CLICKHOUSE_CLUSTER_NAME}}' " if "{{CLICKHOUSE_CLUSTER_NAME}}" else "" def upgrade(): op.execute( f""" ALTER TABLE {{ ...
openedx/tutor-contrib-aspects
tutoraspects/templates/aspects/apps/aspects/migrations/alembic/versions/0031_add_email_user_profile.py
.py
ea05e44340890f4f
8.09
14
""" Partition the xapi table by year and month """ from alembic import op revision = "0032" down_revision = "0031" branch_labels = None depends_on = None on_cluster = ( " ON CLUSTER '{{CLICKHOUSE_CLUSTER_NAME}}' " if "{{CLICKHOUSE_CLUSTER_NAME}}" else "" ) engine = ( "ReplicatedReplacingMergeTree" ...
openedx/tutor-contrib-aspects
tutoraspects/templates/aspects/apps/aspects/migrations/alembic/versions/0032_partition_tables_by_year_and_month.py
.py
19e0a67934b630ad
7.09
14
""" Create the get_org_from_ccx_course_url function to support CCX courses """ from alembic import op revision = "0033" down_revision = "0032" branch_labels = None depends_on = None def upgrade(): op.execute( f""" CREATE OR REPLACE FUNCTION get_org_from_ccx_course_url AS ( course...
openedx/tutor-contrib-aspects
tutoraspects/templates/aspects/apps/aspects/migrations/alembic/versions/0033_ccx_function.py
.py
38e374743236df8b
8.09
14
""" Create the load_test_stats table This table is always created, but it will only be populated if the load test management commands are run from the platform_plugin_aspects app. """ from alembic import op revision = "0034" down_revision = "0033" branch_labels = None depends_on = None on_cluster = " ON CLUSTER '{{C...
openedx/tutor-contrib-aspects
tutoraspects/templates/aspects/apps/aspects/migrations/alembic/versions/0034_load_test_table.py
.py
d8beb8c368931578
7.09
14
""" Migrate dictionaries to DBT. """ from alembic import op revision = "0035" down_revision = "0034" branch_labels = None depends_on = None on_cluster = " ON CLUSTER '{{CLICKHOUSE_CLUSTER_NAME}}' " if "{{CLICKHOUSE_CLUSTER_NAME}}" else "" engine = ( "ReplicatedReplacingMergeTree" if "{{CLICKHOUSE_CLUSTER_NAME...
openedx/tutor-contrib-aspects
tutoraspects/templates/aspects/apps/aspects/migrations/alembic/versions/0035_migrate_dictionaries.py
.py
c9344767110ed3d5
7.09
14
""" This MV should have been moved to dbt, but was missed in the migration and existed in a weird, unused state from 0035 until this migration. """ from alembic import op revision = "0037" down_revision = "0036" branch_labels = None depends_on = None on_cluster = " ON CLUSTER '{{CLICKHOUSE_CLUSTER_NAME}}' " if "{{CL...
openedx/tutor-contrib-aspects
tutoraspects/templates/aspects/apps/aspects/migrations/alembic/versions/0037_remove_most_recent_course_blocks.py
.py
05d6a87e35810a6f
7.09
14
from alembic import op import sqlalchemy as sa revision = "0040" down_revision = "0039" branch_labels = None depends_on = None on_cluster = " ON CLUSTER '{{CLICKHOUSE_CLUSTER_NAME}}' " if "{{CLICKHOUSE_CLUSTER_NAME}}" else "" engine = ( "ReplicatedReplacingMergeTree" if "{{CLICKHOUSE_CLUSTER_NAME}}" else "...
openedx/tutor-contrib-aspects
tutoraspects/templates/aspects/apps/aspects/migrations/alembic/versions/0040_user_profile_username.py
.py
6a9a007bf2b2a697
7.09
14
from alembic import op import clickhouse_sqlalchemy import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '0041' down_revision = '0040' branch_labels = None depends_on = None on_cluster = " ON CLUSTER '{{CLICKHOUSE_CLUSTER_NAME}}' " if "{{CLICKHOUSE_CLUSTER_NAME}}" else "" engine = "ReplicatedMe...
openedx/tutor-contrib-aspects
tutoraspects/templates/aspects/apps/aspects/migrations/alembic/versions/0041_drop_course_dictionaries.py
.py
cfb56a2d69db47bf
7.09
14
""" Parse all Superset datasets for SQL, find links back to dbt assets. This is used in aspects-dbt to update the exposures. Significant parts of this are from the dbt_superset_lineage package at: https://github.com/slidoapp/dbt-superset-lineage/ """ # Necessary to access Superset from create_assets import app impor...
openedx/tutor-contrib-aspects
tutoraspects/templates/aspects/apps/superset/pythonpath/collect_dbt_lineage.py
.py
c654d01360ddd846
8.09
14
"""Import a list of assets from a yaml file and create them in the superset assets folder.""" import os from superset.app import create_app app = create_app() app.app_context().push() import logging import uuid from collections import defaultdict from copy import deepcopy from pathlib import Path import yaml from ...
openedx/tutor-contrib-aspects
tutoraspects/templates/aspects/apps/superset/pythonpath/create_assets.py
.py
67f1a196ed9f7cfb
8.09
14
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
openedx/tutor-contrib-aspects
tutoraspects/templates/aspects/apps/superset/pythonpath/openedx/create_assets_utils.py
.py
13fff591c089f806
7.09
14
"""Delete all unused Aspects assets from Superset tables""" import logging from flask import g from superset import security_manager from superset.extensions import db from superset.models.slice import Slice from superset.connectors.sqla.models import SqlaTable from superset.tags.models import TaggedObject, ObjectType...
openedx/tutor-contrib-aspects
tutoraspects/templates/aspects/apps/superset/pythonpath/openedx/delete_assets.py
.py
f0f5734cba0e3b85
7.09
14
""" This file is used to load translations from the locale.yaml file and provide a function to get translations """ import yaml TRANSLATIONS_FILE_PATH = "/app/localization/locale.yaml" DATASET_STRINGS_FILE_PATH = "/app/localization/datasets_strings.yaml" ASSETS_TRANSLATIONS = {} with open(TRANSLATIONS_FILE_PATH, "r"...
openedx/tutor-contrib-aspects
tutoraspects/templates/aspects/apps/superset/pythonpath/openedx/localization.py
.py
fd0fe23e9d19077e
7.09
14
""" Custom Jinja template filters that can be used in Superset queries. cf https://superset.apache.org/docs/installation/sql-templating/ """ import logging from flask import g from openedx.localization import DATASET_STRINGS, get_translation from superset import security_manager from superset.extensions import secur...
openedx/tutor-contrib-aspects
tutoraspects/templates/aspects/apps/superset/pythonpath/openedx_jinja_filters.py
.py
0fb3b4fcaf611822
8.09
14
import logging import time import jwt import requests from authlib.common.urls import add_params_to_qs, add_params_to_uri from authlib.integrations.flask_client import OAuthError from flask import current_app, session from superset.extensions import cache_manager from superset.security import SupersetSecurityManager ...
openedx/tutor-contrib-aspects
tutoraspects/templates/aspects/apps/superset/pythonpath/openedx_sso_security_manager.py
.py
d1a2450c8cfdbad4
8.09
14
""" Gather performance metrics on Superset chart queries. Reads the queries from the superset database, and enriches them with the query_context from the asset files. The query_context cannot be stored in the database on import due to is using database primary keys which do not match across Superset installations. """...
openedx/tutor-contrib-aspects
tutoraspects/templates/aspects/apps/superset/pythonpath/performance_metrics.py
.py
a3c8165c52452a29
8.09
14
import os import glob import shutil import ruamel.yaml import ruamel.yaml.comments yaml = ruamel.yaml.YAML() def recursive_sort_mappings(s): """Given a ruamel yaml object, recursively sort all mappings in order.""" if isinstance(s, list): for elem in s: recursive_sort_mappings(elem) ...
openedx/tutor-contrib-aspects
tutoraspects/templates/aspects/build/aspects-superset/localization/compile_translations.py
.py
946fd3497fc64b09
8.09
14
# SPDX-FileCopyrightText: 2025 InOrbit, Inc. # # SPDX-License-Identifier: MIT import argparse import logging import signal import sys from dotenv import find_dotenv from dotenv import load_dotenv # Attempts to load environment variables from config/.env file relative to the current working # directory. If the file i...
inorbit-ai/inorbit-robot-connectors
gausium_legacy_connector/inorbit_gausium_connector/inorbit_gausium_connector.py
.py
adf3ee9c284da9a1
7.48
8
# SPDX-FileCopyrightText: 2025 InOrbit, Inc. # # SPDX-License-Identifier: MIT from inorbit_connector.models import InorbitConnectorConfig from inorbit_connector.utils import read_yaml from inorbit_gausium_connector.src.robot.robot_factory import ROBOT_API_CLASSES from pydantic import field_validator from pydantic impo...
inorbit-ai/inorbit-robot-connectors
gausium_legacy_connector/inorbit_gausium_connector/src/config/connector_model.py
.py
6f27f5d99e56e9ec
7.48
8
# SPDX-FileCopyrightText: 2025 InOrbit, Inc. # # SPDX-License-Identifier: MIT import asyncio from enum import Enum import io import math import os import tempfile from typing import override from inorbit_connector.connector import Connector, CommandResultCode from inorbit_connector.models import MapConfig from inorbi...
inorbit-ai/inorbit-robot-connectors
gausium_legacy_connector/inorbit_gausium_connector/src/connector.py
.py
9ad30b78cb94134f
7.48
8
# SPDX-FileCopyrightText: 2025 InOrbit, Inc. # # SPDX-License-Identifier: MIT from enum import Enum class MissionStatus(Enum): """ Values for InOrbit for mission Status. """ ok = "OK" warn = "warn" error = "error" class MissionState(Enum): """ Values for InOrbit for mission States....
inorbit-ai/inorbit-robot-connectors
gausium_legacy_connector/inorbit_gausium_connector/src/constants.py
.py
261d7e6e9f9b1f8b
7.48
8
# SPDX-FileCopyrightText: 2025 InOrbit, Inc. # # SPDX-License-Identifier: MIT import time from typing import Callable from inorbit_gausium_connector.src.constants import ( CLEANING_MODE_TRANSLATION, MissionState, MissionStatus, ) from inorbit_gausium_connector.src.robot.constants import TaskState, WorkTyp...
inorbit-ai/inorbit-robot-connectors
gausium_legacy_connector/inorbit_gausium_connector/src/mission.py
.py
0355289a62e1732a
7.48
8
# SPDX-FileCopyrightText: 2025 InOrbit, Inc. # # SPDX-License-Identifier: MIT from typing import List, Tuple from pydantic import BaseModel class ModelTypeMismatchError(Exception): """Exception raised when the model type of the robot and the API wrapper in use do not match.""" def __init__(self, robot_mode...
inorbit-ai/inorbit-robot-connectors
gausium_legacy_connector/inorbit_gausium_connector/src/robot/datatypes.py
.py
28b19d729be45ecf
7.48
8
# SPDX-FileCopyrightText: 2025 InOrbit, Inc. # # SPDX-License-Identifier: MIT import asyncio import logging from math import radians from typing import Coroutine, List from inorbit_gausium_connector.src.robot.constants import WorkType from inorbit_gausium_connector.src.robot.datatypes import MapData, ModelTypeMismatc...
inorbit-ai/inorbit-robot-connectors
gausium_legacy_connector/inorbit_gausium_connector/src/robot/robot.py
.py
e75af89836720adf
7.48
8
# SPDX-FileCopyrightText: 2025 InOrbit, Inc. # # SPDX-License-Identifier: MIT from inorbit_gausium_connector.src.robot.datatypes import MapData def coordinate_to_grid_units(x: float, y: float, map: MapData) -> tuple[int, int]: """Convert coordinates to grid units of a map Args: x (float): X coordina...
inorbit-ai/inorbit-robot-connectors
gausium_legacy_connector/inorbit_gausium_connector/src/robot/utils.py
.py
a58b4cf1a2b1b19a
7.48
8
# SPDX-FileCopyrightText: 2025 InOrbit, Inc. # # SPDX-License-Identifier: MIT from copy import deepcopy from pathlib import Path import pytest import yaml from inorbit_gausium_connector.src.config.connector_model import ConnectorConfig from inorbit_gausium_connector.src.config.connector_model import default_config fr...
inorbit-ai/inorbit-robot-connectors
gausium_legacy_connector/inorbit_gausium_connector/tests/test_config_validation.py
.py
ab1ff03b3641761c
7.98
8
# SPDX-FileCopyrightText: 2025 InOrbit, Inc. # # SPDX-License-Identifier: MIT import time import pytest from unittest.mock import MagicMock, patch from inorbit_gausium_connector.src.mission import MissionTracking, MissionState, MissionStatus class TestMissionTracking: @pytest.fixture def mission_tracking(se...
inorbit-ai/inorbit-robot-connectors
gausium_legacy_connector/inorbit_gausium_connector/tests/test_mission_tracking.py
.py
29eeb0649c27f486
7.98
8
# SPDX-FileCopyrightText: 2025 InOrbit, Inc. # # SPDX-License-Identifier: MIT import pytest from inorbit_gausium_connector.src.robot.robot import MapData from inorbit_gausium_connector.src.robot.utils import ( coordinate_to_grid_units, grid_units_to_coordinate, ) @pytest.fixture def map_data(): """Creat...
inorbit-ai/inorbit-robot-connectors
gausium_legacy_connector/inorbit_gausium_connector/tests/test_utils.py
.py
6d2daf06f1d4db94
7.98
8
# SPDX-FileCopyrightText: 2026 InOrbit, Inc. # # SPDX-License-Identifier: MIT """Entry point for the InOrbit Gausium Open Platform Connector.""" # Standard import argparse import logging import signal import sys from typing import NoReturn # InOrbit from inorbit_connector.utils import read_yaml # Local from gausium...
inorbit-ai/inorbit-robot-connectors
gausium_open_platform_connector/gausium_open_platform_connector/gausium_open_platform_connector.py
.py
5c17fd8dfb1f2fca
7.48
8
# SPDX-FileCopyrightText: 2026 InOrbit, Inc. # # SPDX-License-Identifier: MIT """Bearer token authentication for httpx clients.""" # Standard import asyncio import logging import time from collections.abc import AsyncGenerator, Awaitable, Callable # Third-party import httpx # Minimum spacing between token fetches, ...
inorbit-ai/inorbit-robot-connectors
gausium_open_platform_connector/gausium_open_platform_connector/src/api/auth.py
.py
f4a5c2865203fc9c
7.48
8
# SPDX-FileCopyrightText: 2026 InOrbit, Inc. # # SPDX-License-Identifier: MIT """Fleet data poller: caches per-robot state fetched from the Gausium API.""" # Standard import asyncio import logging import math import time from collections.abc import Awaitable, Callable from dataclasses import dataclass, field # InOrb...
inorbit-ai/inorbit-robot-connectors
gausium_open_platform_connector/gausium_open_platform_connector/src/api/data_poller.py
.py
a0a2fce8d7f4db68
7.48
8
# SPDX-FileCopyrightText: 2026 InOrbit, Inc. # # SPDX-License-Identifier: MIT """Vendor to cleaning contract normalization, shared by the live key-values and the reports.""" # Standard import re from datetime import datetime from enum import StrEnum class TaskState(StrEnum): """Task states reported by the Gausi...
inorbit-ai/inorbit-robot-connectors
gausium_open_platform_connector/gausium_open_platform_connector/src/canonical.py
.py
9fd7d1d4302b648c
7.48
8
# SPDX-FileCopyrightText: 2026 InOrbit, Inc. # # SPDX-License-Identifier: MIT """Custom command definitions for the Gausium Open Platform connector.""" # Standard from enum import StrEnum class CustomScripts(StrEnum): """InOrbit-facing custom command names (kept identical to v1.x for compatibility).""" SUB...
inorbit-ai/inorbit-robot-connectors
gausium_open_platform_connector/gausium_open_platform_connector/src/commands.py
.py
d7f27093785a0003
7.48
8
# SPDX-FileCopyrightText: 2026 InOrbit, Inc. # # SPDX-License-Identifier: MIT """Configuration models for the Gausium Open Platform connector.""" from inorbit_connector.models import ConnectorRootConfig, ConnectorSpecificConfig, RobotConfig from pydantic import Field, HttpUrl, model_validator CONNECTOR_TYPE = "gausi...
inorbit-ai/inorbit-robot-connectors
gausium_open_platform_connector/gausium_open_platform_connector/src/config/models.py
.py
d52db5b06d2b69ee
7.48
8
# SPDX-FileCopyrightText: 2026 InOrbit, Inc. # # SPDX-License-Identifier: MIT """Gausium Open Platform multi-robot connector for InOrbit.""" # Standard import asyncio import math from functools import partial from typing import override # InOrbit from inorbit_connector.commands import CommandFailure, CommandResultCo...
inorbit-ai/inorbit-robot-connectors
gausium_open_platform_connector/gausium_open_platform_connector/src/connector.py
.py
c311ed1df9a1088c
7.48
8
# SPDX-FileCopyrightText: 2026 InOrbit, Inc. # # SPDX-License-Identifier: MIT """Canonical mission data extracted from a Gausium task report. Transport agnostic: the polled v2 API sends ISO 8601 timestamps and the report push callback sends epoch milliseconds, and both are accepted. """ # Standard from typing import...
inorbit-ai/inorbit-robot-connectors
gausium_open_platform_connector/gausium_open_platform_connector/src/report.py
.py
804eda7168aa0dc2
7.48
8
# SPDX-FileCopyrightText: 2026 InOrbit, Inc. # # SPDX-License-Identifier: MIT """ Test-wide fixtures. """ from __future__ import annotations import asyncio import os import pytest @pytest.fixture(autouse=True) def _clean_inorbit_env(monkeypatch): """Remove all ``INORBIT_*`` environment variables before each t...
inorbit-ai/inorbit-robot-connectors
gausium_open_platform_connector/tests/conftest.py
.py
fd8874aaf56f77e2
7.98
8
# SPDX-FileCopyrightText: 2026 InOrbit, Inc. # # SPDX-License-Identifier: MIT """Consistency checks between the cac examples and the keys the connector publishes.""" from __future__ import annotations import json from pathlib import Path import yaml from gausium_open_platform_connector.src.key_values import ( ...
inorbit-ai/inorbit-robot-connectors
gausium_open_platform_connector/tests/test_cac.py
.py
230b15dba8c73357
7.98
8
# SPDX-FileCopyrightText: 2026 InOrbit, Inc. # # SPDX-License-Identifier: MIT """Tests for `gausium_open_platform_connector.src.canonical`.""" from __future__ import annotations from datetime import datetime from gausium_open_platform_connector.src.canonical import ( camel_to_snake, cleaning_mode_keys, ...
inorbit-ai/inorbit-robot-connectors
gausium_open_platform_connector/tests/test_canonical.py
.py
c76ff222ee474ae9
7.98
8
# SPDX-FileCopyrightText: 2026 InOrbit, Inc. # # SPDX-License-Identifier: MIT """Tests for `gausium_open_platform_connector.src.config.models`.""" from __future__ import annotations import copy import pytest from gausium_open_platform_connector.src.config.models import ( CONNECTOR_TYPE, DEFAULT_BASE_URL, ...
inorbit-ai/inorbit-robot-connectors
gausium_open_platform_connector/tests/test_config_models.py
.py
fdfed0b3d7703b94
7.98
8
from allauth.account.adapter import DefaultAccountAdapter from allauth.account.models import EmailAddress from allauth.core.exceptions import SignupClosedException from allauth.socialaccount.adapter import DefaultSocialAccountAdapter from django.utils.translation import gettext_lazy as _ from core.services.jhe_setting...
jupyterhealth/jupyterhealth-exchange
core/adapters.py
.py
97cd23ba320cd76a
7.59
14
"""Loads the HL7 ``hl7.fhir.uv.xver`` StructureMaps and ConceptMaps (R4 -> R5 only) into lookup registries used by the engine. Only ``*4to5`` StructureMaps are loaded (the R4B ``*4Bto5`` variants are deliberately skipped). After the official pack, local **patches** from ``fhir-cross-version-patches`` are merged in ru...
jupyterhealth/jupyterhealth-exchange
core/fhir/cross_version_maps.py
.py
dffa003fffd5ebb3
7.59
14
"""Element -> type resolution for the R4 -> R5 engine, sourced from the installed ``fhir.resources`` models. The cross-version StructureMaps dispatch datatype ``dependent`` calls by the *runtime type* of the element being mapped (e.g. ``Observation.code`` -> the ``CodeableConcept`` group). The maps do not carry that t...
jupyterhealth/jupyterhealth-exchange
core/fhir/cross_version_type_index.py
.py
525c58db4cc5a95d
7.59
14
"""Validate an incoming FHIR resource dict against its ``fhir.resources`` model. Used on the write path for auxiliary resources (and anywhere a verbatim FHIR body must be checked before it is stored). The resource is parsed with the ``fhir.resources`` model that matches its ``resourceType``; a parse/validation failure...
jupyterhealth/jupyterhealth-exchange
core/fhir/fhir_validation.py
.py
1575e79b0175160a
7.59
14
from django.db.models.query import RawQuerySet from rest_framework.pagination import PageNumberPagination from rest_framework.response import Response from core.pagination import PaginatedRawQuerySet class FHIRBundlePagination(PageNumberPagination): """ FHIR Bundle pagination using database-level pagination ...
jupyterhealth/jupyterhealth-exchange
core/fhir/pagination.py
.py
4acfdc1228b1437d
7.59
14
"""Index-refs pass for auxiliary FHIR resources (issue #584). When a FHIR aux resource is uploaded its references still point at the upstream system's ids (e.g. ``Encounter.subject.reference = "Patient/123"``), while JHE stores each resource under a new UUID. This pass rewrites the references declared in ``__refPaths`...
jupyterhealth/jupyterhealth-exchange
core/fhir/ref_indexing.py
.py
04f130250c1168ec
7.59
14
"""Shared scoping/authorization helpers for the normalized ``Model.fhir_search`` methods. Every FHIR-mapped Django model exposes a uniform:: fhir_search(jhe_user_id, resource_id=None, organization_id=None, study_id=None, patient_id=None, **params) The user is resolved from ``jhe_user_id`` (so cal...
jupyterhealth/jupyterhealth-exchange
core/fhir/scope.py
.py
dc301e403b3b04ea
7.59
14
""" Import a SMART App Launch 2.2 "user-access Brands Bundle" (FHIR Bundle of Organization brands + Organization care facilities + Endpoints) into the EhrBrand / EhrBrandLocation tables that power the Patient Access hospital picker. Epic publishes its bundle at https://open.epic.com/MyApps/Endpoints (User-access Brand...
jupyterhealth/jupyterhealth-exchange
core/management/commands/import_ehr_brands.py
.py
3eee78029c764c53
7.59
14
from django.conf import settings from django.http import HttpResponse class OAuthCorsMiddleware: """Permissive CORS for the OAuth endpoints under /o/. Browser-based OAuth clients (SPA / PKCE) served from a different origin need to read the JSON token response from a cross-origin fetch, which the browser ...
jupyterhealth/jupyterhealth-exchange
core/middleware.py
.py
14e21e9a650613ca
7.59
14
""" Logging setup for the epub conversion tool. Importing this module has no side effects beyond registering a custom TRACE level and creating a package logger with a null handler. Handlers are only attached when :func:`configure` is called, which keeps the library importable from tests without spraying an ``app.log``...
raeq/ibook2epub
epubconvert/app_logger.py
.py
0fef9e2ae541cf0f
7.52
10
""" The command line surface. Kept apart from the conversion logic so that the argument definitions, which are long and change often, do not crowd the module that does the work. """ from __future__ import annotations import argparse from collections.abc import Sequence from pathlib import Path from . import __versi...
raeq/ibook2epub
epubconvert/cli.py
.py
0fed413a31a79428
7.52
10
""" The one rule for turning a name from a book into a path on disk. A ``*.epub/`` package is input. Its ``container.xml`` names the package document, the package document names every manifest item, and the directory itself names its own entries. All of those are chosen by whoever produced or sideloaded the book, and ...
raeq/ibook2epub
epubconvert/contained.py
.py
caac23d764889f19
7.52
10
""" Rendering names that came out of a book. A package name is input, not fact: it is whatever the publisher or the person who sideloaded the book put on the directory. Anything shown to a user goes through here first. Kept in its own module because both the exporter and the planner display names, and neither should ...
raeq/ibook2epub
epubconvert/display.py
.py
a641dfd712bc3186
7.52
10
""" Reading the output directory, and writing beside it. Writing the output directory is not the same as trusting it. Two of these operations read it back: checking that exported archives are still sound, and measuring the space left to write into. The third, :func:`extract_cover`, writes *into* it, and deliberately ...
raeq/ibook2epub
epubconvert/inspect_output.py
.py
929acd820163a485
8.02
10
""" Driving one run from the command line. Everything between parsing arguments and returning an exit code: what a run announces before it starts, the read-only ``--list`` and ``--verify`` branches, and the export itself under the output directory lock. Held apart from :mod:`epubconvert.convert` so the exporter can b...
raeq/ibook2epub
epubconvert/run.py
.py
7100f436dfa13f31
7.52
10
""" Inspection of source packages before conversion. Two conditions make a package impossible to convert into a readable book, and both are silent: a DRM-protected purchase produces a valid-looking archive nobody can open, and a book that iCloud has not downloaded produces one with empty files inside. Detecting them t...
raeq/ibook2epub
epubconvert/source.py
.py
ca2eb27d2c53a27a
7.52
10
"""Tests for argument parsing, logging setup and the top-level entry point.""" # Test names describe the behaviour under test; separate docstrings would only # restate them. Explicit empty-list comparisons read better than truthiness here. # pylint: disable=missing-function-docstring,missing-class-docstring # pylint: ...
raeq/ibook2epub
tests/test_cli.py
.py
3c8c06a7a57e8308
8.02
10
""" Tests for the one rule about turning a name from a book into a path on disk. A ``*.epub/`` package is input. Its container document, its package document, its manifest hrefs and its own directory entries are all names somebody else chose, and every one of them ends up joined onto a real directory. This module exis...
raeq/ibook2epub
tests/test_containment.py
.py
182a99a73c886f8d
8.02
10
"""Tests for the package discovery, archiving and export logic.""" # Test names describe the behaviour under test; separate docstrings would only # restate them. Explicit empty-list comparisons read better than truthiness here. # pylint: disable=missing-function-docstring,missing-class-docstring # pylint: disable=use-...
raeq/ibook2epub
tests/test_convert.py
.py
3e4e0769cf4b61a6
8.02
10
""" Tests for files that need no conversion and are taken along anyway. A real library holds both forms: Apple's ``*.epub/`` package directories, and books that arrived already zipped or as PDFs. Converting only the first and saying nothing about the rest meant "export my library" produced a partial shelf whose summar...
raeq/ibook2epub
tests/test_copy_through.py
.py
1158da8327579f59
7.02
10
""" Tests for the work the tool does per book, and the work it declines to do. These pin behaviour a measurement established, so a later change cannot quietly undo it: which compression level is actually applied, how many threads the pool takes by default, and which expensive checks run only for books that will really...
raeq/ibook2epub
tests/test_efficiency.py
.py
4ecef6cc0a069557
8.02
10
""" Tests for the optional external ``epubcheck`` validator. It is a much stricter check than the structural one, it needs a JVM, and almost nobody has it installed -- so every branch past "is it on PATH" ran unexercised. The subprocess is mocked rather than the tool installed, which keeps the suite dependency-free wh...
raeq/ibook2epub
tests/test_epubcheck.py
.py
c7ac3cf3c4b0d961
8.02
10
""" Tests for what the tool tells the person running it. The conversion machinery is covered elsewhere. These are about the seams where it talks: whether advice it gives actually works, whether a message teaches the way out of the state it describes, and whether anything the user put in the source directory can go unm...
raeq/ibook2epub
tests/test_experience.py
.py
96a4c6dbacd887e4
7.02
10
"""Tests for archive writing: reproducibility, interrupts, disk space, covers.""" # Test names describe the behaviour under test; separate docstrings would only # restate them. Explicit empty-list comparisons read better than truthiness here. # pylint: disable=missing-function-docstring,missing-class-docstring # pylin...
raeq/ibook2epub
tests/test_export.py
.py
e37e1d3ac439308f
7.02
10
""" Tests for the guards that keep untrusted input and hostile filesystems honest. A ``*.epub/`` package comes from a publisher or a sideload, so its XML and its filenames are input, not fact. These cases cover the places where believing them cost something. """ # Test names describe the behaviour under test; separat...
raeq/ibook2epub
tests/test_hardening.py
.py
47c6b01d7c2800ef
8.02
10
""" Tests for the guarantees that keep the output directory trustworthy. The output directory is this tool's only record of completed work, so a book that is written wrong is not merely wrong: it is recorded as finished and no rerun retries it. Every test here covers a way that record was found to lie. """ # Test nam...
raeq/ibook2epub
tests/test_integrity.py
.py
c1642bf184b30683
8.02
10
"""Tests for naming policies and identity-based deduplication.""" # Test names describe the behaviour under test; separate docstrings would only # restate them. Explicit empty-list comparisons read better than truthiness here. # pylint: disable=missing-function-docstring,missing-class-docstring # pylint: disable=use-i...
raeq/ibook2epub
tests/test_naming.py
.py
555741d8054e0b68
7.02
10
"""Tests for --version, --force, --match, --workers, the run lock and totals.""" # Test names describe the behaviour under test; separate docstrings would only # restate them. Explicit empty-list comparisons read better than truthiness here. # pylint: disable=missing-function-docstring,missing-class-docstring # pylint...
raeq/ibook2epub
tests/test_options.py
.py
2b9f94b80076fae2
7.02
10
""" Tests for what ships, and for the version the shipped thing reports. A release is the one artefact nobody can patch after the fact: PyPI does not allow re-uploading a file. These check the two claims a release makes about itself before it is cut. """ # Test names describe the behaviour under test; separate docstr...
raeq/ibook2epub
tests/test_packaging.py
.py
ac4918cdd9d19451
8.02
10
"""Tests for planning: collision handling, refresh, and the listing modes.""" # Test names describe the behaviour under test; separate docstrings would only # restate them. Explicit empty-list comparisons read better than truthiness here. # pylint: disable=missing-function-docstring,missing-class-docstring # pylint: d...
raeq/ibook2epub
tests/test_planning.py
.py
e4c1dd6df2eae0a2
7.02
10
""" Tests for what the tool can say about the output directory itself. The library is seen richly: five statuses, reasons, tallies. The shelf was seen not at all. After adopting ``-p`` a shelf can hold both ``Sapiens: A Brief History.epub`` and ``Sapiens A Brief History.epub`` and no command would ever surface that --...
raeq/ibook2epub
tests/test_shelf.py
.py
4be318e2e946a636
7.02
10
"""Tests for source-package inspection: DRM and undownloaded iCloud stubs.""" # Test names describe the behaviour under test; separate docstrings would only # restate them. Explicit empty-list comparisons read better than truthiness here. # pylint: disable=missing-function-docstring,missing-class-docstring # pylint: d...
raeq/ibook2epub
tests/test_source.py
.py
28c8660a95a41b56
8.02
10
""" Tests for collision names that do not move when the library changes. ``--on-collision suffix`` numbered the members of a colliding group by their position in it, so adding a book that sorted earlier renamed every later member. ``_assign_names`` documented that against itself and pointed at ``dc:identifier`` as the...
raeq/ibook2epub
tests/test_stable_names.py
.py
d852dd1349af0c57
7.02
10
#!/usr/bin/env python3 # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. """Install Nuke on an ephemeral macOS integration-test runner.""" import argparse import hashlib import os import platform import re import shutil import subprocess import sys import tempfile from dataclasses import dataclass f...
aws-deadline/deadline-cloud-for-nuke
pipeline/setup-runner.py
.py
c9bf387fdf60c21c
7.6
15
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. """Script to create platform-specific Deadline Client installers using InstallBuilder.""" import os import sys import shutil import tempfile from datetime import datetime from typing import Optional from pathlib import Path from common import Evalua...
aws-deadline/deadline-cloud-for-nuke
scripts/build_installer.py
.py
86d3c3187134a471
7.6
15
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. from __future__ import annotations import logging import os import re import sys import threading import time import jsonschema # type: ignore from typing import Callable, cast from deadline.client.api import get_deadline_cloud_library_telemetry_c...
aws-deadline/deadline-cloud-for-nuke
src/deadline/nuke_adaptor/NukeAdaptor/adaptor.py
.py
5f2fb69a69ed64bd
7.6
15
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. from __future__ import annotations import os from functools import lru_cache from pathlib import Path, PurePath from types import FrameType as FrameType from typing import ( List, Optional, ) # The Nuke Adaptor adds the `openjd` namespace d...
aws-deadline/deadline-cloud-for-nuke
src/deadline/nuke_adaptor/NukeClient/nuke_client.py
.py
c2a5490be2b3972b
7.6
15
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. from __future__ import annotations import re import os import sys from typing import TYPE_CHECKING, Any, Callable, Dict, List try: import nuke except ImportError: # pragma: no cover raise OSError("Could not find the Nuke module. Are you ru...
aws-deadline/deadline-cloud-for-nuke
src/deadline/nuke_adaptor/NukeClient/nuke_handler.py
.py
b862fdf046befb86
7.6
15
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. """ Functionality for creating a global logger for the Nuke submitter. """ import logging import logging.handlers import os import tempfile # TODO: Output logging to the Script Editor Console as well. class NukeLogger(logging.Logger): log_path...
aws-deadline/deadline-cloud-for-nuke
src/deadline/nuke_submitter/_logging.py
.py
a73d7e8d2c5dea10
7.6
15
import argparse import json import logging import re import subprocess import sys import threading import time import pathlib from typing import Dict, List, Optional, TextIO, Tuple error_regex = re.compile(r".*(ERROR: |Error ?:|Eddy\[ERROR\])(.+)") step_complete_regex = re.compile(r"\[Step:(\d+)/(\d+)\].*") def _rep...
aws-deadline/deadline-cloud-for-nuke
src/deadline/nuke_submitter/copycat_adaptor.py
.py
e7873cb48b3c4daa
7.6
15
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. from __future__ import annotations import dataclasses from dataclasses import dataclass, field, is_dataclass import json from pathlib import Path from typing import Union, Dict, Any from enum import Enum RENDER_SUBMITTER_SETTINGS_FILE_EXT = ".deadl...
aws-deadline/deadline-cloud-for-nuke
src/deadline/nuke_submitter/data_classes.py
.py
6aafda84d8dc92e6
7.6
15
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. from __future__ import annotations from typing import NamedTuple from deadline.nuke_submitter.assets import AssetReferencesParsingOutcome # Handle different Qt imports for different Nuke versions try: # For Nuke 16+ from PySide6.QtCore imp...
aws-deadline/deadline-cloud-for-nuke
src/deadline/nuke_submitter/ui/components/asset_scan_warning_dialog.py
.py
acff79cc05534260
7.6
15
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. """Utilities for checking and displaying update notifications.""" import logging from dataclasses import dataclass from deadline.client.api import safe_check_for_updates, UpdateCheckResult, UpdateCheckStatus from deadline.client.ui.dialogs.update_a...
aws-deadline/deadline-cloud-for-nuke
src/deadline/nuke_submitter/update_utils.py
.py
19ee2709f83ae764
7.6
15
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. from __future__ import annotations import os from pathlib import PurePath from typing import Optional import nuke import PyOpenColorIO as OCIO def is_env_config_enabled() -> bool: """True if the OCIO environment variable is specified""" r...
aws-deadline/deadline-cloud-for-nuke
src/deadline/nuke_util/ocio.py
.py
1c96413ddeda4fb4
7.6
15
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. """Launch GUI Nuke with the Deadline Cloud submitter for xa11y-driven tests. Modeled on ``deadline-cloud`` ``test/blender_submitter_ui``. Launches Nuke in the foreground with the repo's ``src`` and this suite's ``_opener`` dir on ``NUKE_PATH``; the ...
aws-deadline/deadline-cloud-for-nuke
test/nuke_submitter_ui/_launcher.py
.py
b7514d47615b017b
8.1
15
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. """Nuke-side opener hook for the xa11y submitter UI tests. DO NOT CHANGE THIS FILE's NAME — Nuke executes ``menu.py`` from every directory on ``NUKE_PATH`` at GUI startup. The test launcher puts this suite's ``_opener`` directory on ``NUKE_PATH`` al...
aws-deadline/deadline-cloud-for-nuke
test/nuke_submitter_ui/_opener/menu.py
.py
6f435002c65d595c
8.1
15
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. """Stops the launched DCC and the helper processes it spawns. Stdlib only, so these rules are unit tested on every build instead of only where a licensed Nuke exists (``test/unit/test_nuke_submitter_ui_process.py``). Nuke's crash handler, frame ser...
aws-deadline/deadline-cloud-for-nuke
test/nuke_submitter_ui/_process.py
.py
5ddf454bfbf990fa
8.1
15
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. """Helpers and the local golden-bundle normalization policy.""" from __future__ import annotations import re import time from datetime import datetime from pathlib import Path from shutil import copy2 from deadline_test_fixtures.job_bundle import ...
aws-deadline/deadline-cloud-for-nuke
test/nuke_submitter_ui/_utils.py
.py
76b2b4a6b7c91f71
8.1
15
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. """Fixtures for the xa11y-driven Nuke submitter UI tests. Requirements, setup, case layout, and platform notes: see ``README.md`` in this directory. Canonical invocation (the suite is not part of the default unit-test run):: hatch run integ-xa1...
aws-deadline/deadline-cloud-for-nuke
test/nuke_submitter_ui/conftest.py
.py
6ca0094bfbad29e0
8.1
15
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. """Dialog configurator for the basic_workflow case. Runs after the submitter dialog has settled and before Save bundle as is pressed. Receives the suite's NukeSubmitterDialog page object (see test/nuke_submitter_ui/pages.py), which encodes the platf...
aws-deadline/deadline-cloud-for-nuke
test/nuke_submitter_ui/test_cases/basic_workflow/input/configure.py
.py
9a14425c178ec60f
7.1
15
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. """Dialog configurator for the custom_frame_range case. Port of the Squish custom_frame_range_gui case: enable the frame-range override and submit a range (1-10) narrower than the scene's own 1-100, so the golden's Frames parameter proves the overri...
aws-deadline/deadline-cloud-for-nuke
test/nuke_submitter_ui/test_cases/custom_frame_range/input/configure.py
.py
5a475e5f042eeff7
7.1
15
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. """Dialog configurator for the custom_settings case. Port of the Squish custom_settings_gui case: override the job properties (priority, max failed tasks, max retries per task) and enable continue-on -error, then let the golden bundle prove each val...
aws-deadline/deadline-cloud-for-nuke
test/nuke_submitter_ui/test_cases/custom_settings/input/configure.py
.py
ed0741abc61bb128
7.1
15
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. """Dialog configurator for the default_frame_range case. Port of the Squish default_frame_range_gui case: submit WITHOUT touching the frame-range controls, so the golden's Frames parameter proves the scene's own root range (25-75, set by scene.py) i...
aws-deadline/deadline-cloud-for-nuke
test/nuke_submitter_ui/test_cases/default_frame_range/input/configure.py
.py
3945bec3e2cb3f46
7.1
15