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 |
|---|---|---|---|---|---|---|
from django.contrib import admin
from django.utils.safestring import mark_safe
from django.utils.translation import gettext_lazy as _
from inventory.models.attachment import Attachment
from inventory.models.remarks import Remark
from inventory.models.status_change import StatusChange
def is_an_image_path(path: str) ... | JobDoesburg/landolfio | landolfio/inventory/admin_inlines.py | .py | 64d4ed7d039db4d3 | 7.48 | 8 |
# Generated by Django 5.1.6 on 2025-07-20 21:43
from django.db import migrations
from django.utils.text import slugify
def update_property_slugs(apps, schema_editor):
"""Update existing property slugs to remove category prefixes."""
AssetProperty = apps.get_model("inventory", "AssetProperty")
for prop i... | JobDoesburg/landolfio | landolfio/inventory/migrations/0008_auto_20250720_2343.py | .py | 394299d61cc46274 | 7.48 | 8 |
# Generated by Django 5.1.6 on 2025-09-07 21:06
from django.db import migrations
from django.utils import timezone
def create_initial_status_changes(apps, schema_editor):
"""Create initial StatusChange records for all existing assets."""
Asset = apps.get_model("inventory", "Asset")
StatusChange = apps.ge... | JobDoesburg/landolfio | landolfio/inventory/migrations/0014_populate_initial_status_changes.py | .py | b042901a6b374078 | 7.48 | 8 |
# Copyright (C) 2020 Chase Finch
"""Test against the spec files from AMP Optimizer."""
import re
from html.parser import HTMLParser
from pathlib import Path
import pytest
from amp_renderer import AMPRenderer
from amp_renderer._compatibility import override
class OutputNormalizer(HTMLParser):
"""Alphabetize att... | chasefinch/amp-renderer | tests/test_against_spec.py | .py | f7c01c081575078b | 8.15 | 19 |
# Copyright (C) 2020 Chase Finch
"""Tests for AMPNode and related functionality."""
from amp_renderer import AMPNode, Layout
class TestLayout:
"""Test the layout classes."""
def test_get_class(self) -> None:
"""Test the get_class method."""
for layout in list(Layout):
assert layo... | chasefinch/amp-renderer | tests/test_amp_node.py | .py | 99db85cea31fc03e | 7.15 | 19 |
# Copyright (C) 2020 Chase Finch
"""Tests for AMPRenderer and related functionality."""
from amp_renderer import AMPRenderer
RUNTIME_VERSION = "01234"
RUNTIME_STYLES = "body{background-color:pink;}"
BASIC_HTML = """
<!doctype html>
<html ⚡️>
<head>
</head>
<body>
<div
id="tes... | chasefinch/amp-renderer | tests/test_amp_renderer.py | .py | 2f7188af7f7b1b0f | 8.15 | 19 |
# Copyright (C) 2020 Chase Finch
"""Define middleware for applying AMPRenderer to the output of Django views."""
import re
from typing import TYPE_CHECKING
from amp_renderer import AMPRenderer
from django.conf import settings
from django.utils.deprecation import MiddlewareMixin
from django.utils.encoding import Djang... | chasefinch/django-amp-renderer | django_amp_renderer/django_amp_renderer.py | .py | f1c4deaf4d1f3ba8 | 7.45 | 7 |
"""Tests for account_dependency.py ."""
from dataclasses import dataclass
from dataclasses import field
import pytest
from godslayer.god_slayer_factory import GodSlayerFactory
from zaimcsvconverter.accounts.context import AccountContext
from zaimcsvconverter.inputtooutput.converters.recordtozaim.waon import WaonZaim... | yukihiko-shinoda/zaim-csv-converter | tests/accounts/test_context.py | .py | 67a078ce09ca314d | 7.02 | 10 |
"""Tests for account.py."""
from enum import Enum
from pathlib import Path
from types import DynamicClassAttribute
import pytest
from zaimcsvconverter.accounts.enum import Account
class FilePathInput(Enum):
"""File path for test."""
WAON = Path("c:\\Users\\user\\workspace\\zaim-csv-converter\\csvinput\\wa... | yukihiko-shinoda/zaim-csv-converter | tests/accounts/test_enum.py | .py | e71cd8a4d7ff47c2 | 8.02 | 10 |
"""This module implements config for pytest."""
from collections.abc import Generator
from pathlib import Path
from typing import Any
import pytest
from fixturefilehandler import RelativeDeployFilePath
from fixturefilehandler import ResourceFileDeployer
from fixturefilehandler.factories import DeployerFactory
from fi... | yukihiko-shinoda/zaim-csv-converter | tests/conftest.py | .py | 6960d940bbb4833b | 7.02 | 10 |
"""Tests for input_csv_converter.py."""
from __future__ import annotations
import csv
from typing import TYPE_CHECKING
import pytest
from tests.testlibraries.assert_list import assert_each_properties
from tests.testlibraries.instance_resource import InstanceResource
from tests.testlibraries.row_data import ZaimRowD... | yukihiko-shinoda/zaim-csv-converter | tests/csvconverter/test_csv_to_csv_converter.py | .py | 7a54a383ba6c5f13 | 8.02 | 10 |
"""Tests for error_handler.py."""
from typing import ClassVar
import pytest
from tests.testlibraries.assert_list import assert_list
from tests.testlibraries.instance_resource import InstanceResource
from zaimcsvconverter.errorhandling.error_handler import UndefinedContentErrorHandler
from zaimcsvconverter.inputtoout... | yukihiko-shinoda/zaim-csv-converter | tests/errorhandling/test_error_handler.py | .py | 7434aa060da8ab86 | 8.02 | 10 |
"""Tests for input_csv_converter_iterator.py."""
import csv
from pathlib import Path
import pytest
from tests.testlibraries.assert_list import assert_each_properties
from tests.testlibraries.error_row_data_for_test import ErrorRowDataForTest
from zaimcsvconverter.errorreporters.error_totalizer import ErrorTotalizer
... | yukihiko-shinoda/zaim-csv-converter | tests/errorreporters/error_totalizer.py | .py | 5c58958de83e50a9 | 8.02 | 10 |
"""Tests for zaimcsvconverter.errorreporters.input_csv_error_reporter."""
from collections.abc import Generator
from typing import Generic
import pytest
from zaimcsvconverter.errorreporters.input_csv_error_reporter import DataSourceErrorReporterFactory
from zaimcsvconverter.exceptions import InvalidCellError
from za... | yukihiko-shinoda/zaim-csv-converter | tests/errorreporters/test_input_csv_error_reporter.py | .py | d14429a1146434ca | 8.02 | 10 |
"""Tests for __init__.py."""
import pytest
from tests.conftest import create_zaim_row_converter
from tests.testlibraries.instance_resource import InstanceResource
from zaimcsvconverter.accounts.enum import Account
from zaimcsvconverter.inputtooutput.converters.recordtozaim import ZaimPaymentRowConverter
from zaimcsvc... | yukihiko-shinoda/zaim-csv-converter | tests/inputtooutput/converters/recordtozaim/test___init__.py | .py | df42fb09446ca244 | 7.02 | 10 |
"""Tests for amazon.py."""
from pathlib import Path
import pytest
from tests.testlibraries.assert_list import assert_each_properties
from tests.testlibraries.instance_resource import InstanceResource
from tests.testlibraries.row_data import ZaimRowData
from zaimcsvconverter.accounts.enum import Account
from zaimcsvc... | yukihiko-shinoda/zaim-csv-converter | tests/inputtooutput/converters/recordtozaim/test_amazon.py | .py | 429ab9512f633384 | 8.02 | 10 |
"""Tests for amazon.py."""
import pytest
from tests.conftest import create_zaim_row
from tests.testlibraries.instance_resource import InstanceResource
from tests.testlibraries.row_data import ZaimRowData
from zaimcsvconverter.accounts.enum import Account
from zaimcsvconverter.inputtooutput.datasources.csvfile.data.am... | yukihiko-shinoda/zaim-csv-converter | tests/inputtooutput/converters/recordtozaim/test_amazon_201911.py | .py | ab59d11a4e82f2a3 | 7.02 | 10 |
"""Tests for gold_point_card_plus.py."""
from dataclasses import dataclass
import pytest
from tests.conftest import create_zaim_row
from tests.testlibraries.instance_resource import InstanceResource
from tests.testlibraries.row_data import ZaimRowData
from zaimcsvconverter.accounts.enum import Account
from zaimcsvco... | yukihiko-shinoda/zaim-csv-converter | tests/inputtooutput/converters/recordtozaim/test_gold_point_card_plus.py | .py | 46da703952020f1c | 7.02 | 10 |
"""Tests for gold_point_card_plus_201912.py."""
from dataclasses import dataclass
import pytest
from tests.conftest import create_zaim_row
from tests.testlibraries.instance_resource import InstanceResource
from tests.testlibraries.row_data import ZaimRowData
from zaimcsvconverter.accounts.enum import Account
from za... | yukihiko-shinoda/zaim-csv-converter | tests/inputtooutput/converters/recordtozaim/test_gold_point_card_plus_201912.py | .py | 8d263e5dd58dd048 | 7.02 | 10 |
"""Tests for mufg.py."""
from pathlib import Path
import pytest
from tests.testlibraries.assert_list import assert_each_properties
from tests.testlibraries.instance_resource import InstanceResource
from tests.testlibraries.row_data import ZaimRowData
from zaimcsvconverter.accounts.enum import Account
from zaimcsvcon... | yukihiko-shinoda/zaim-csv-converter | tests/inputtooutput/converters/recordtozaim/test_mufg.py | .py | 5bf2119f2ad06371 | 7.02 | 10 |
"""Tests for sf_card_viewer.py."""
from dataclasses import dataclass
import pytest
from tests.conftest import create_zaim_row
from tests.testlibraries.instance_resource import InstanceResource
from tests.testlibraries.row_data import ZaimRowData
from zaimcsvconverter.accounts.enum import Account
from zaimcsvconverte... | yukihiko-shinoda/zaim-csv-converter | tests/inputtooutput/converters/recordtozaim/test_sf_card_viewer.py | .py | 1e82f5f45a5dc170 | 7.02 | 10 |
"""Tests for view_card.py."""
import pytest
from tests.conftest import create_zaim_row
from tests.testlibraries.instance_resource import InstanceResource
from tests.testlibraries.row_data import ZaimRowData
from zaimcsvconverter.accounts.enum import Account
from zaimcsvconverter.inputtooutput.datasources.csvfile.data... | yukihiko-shinoda/zaim-csv-converter | tests/inputtooutput/converters/recordtozaim/test_view_card.py | .py | 47f010628d4c25e5 | 8.02 | 10 |
"""Tests for waon.py."""
from pathlib import Path
from typing import TYPE_CHECKING
from typing import cast
import pytest
from tests.testlibraries.assert_list import assert_each_properties
from tests.testlibraries.instance_resource import InstanceResource
from tests.testlibraries.row_data import ZaimRowData
from zaim... | yukihiko-shinoda/zaim-csv-converter | tests/inputtooutput/converters/recordtozaim/test_waon.py | .py | e82850a9b67c5876 | 7.02 | 10 |
"""Tests for AmazonRowFactory."""
import pytest
from tests.testlibraries.instance_resource import InstanceResource
from zaimcsvconverter.inputtooutput.datasources.csvfile.converters.amazon import AmazonRowFactory
from zaimcsvconverter.inputtooutput.datasources.csvfile.data.amazon import AmazonRowData
from zaimcsvconv... | yukihiko-shinoda/zaim-csv-converter | tests/inputtooutput/datasources/csvfile/converters/test_amazon.py | .py | 6c563ebc2e8ddc21 | 8.02 | 10 |
"""Test for Amazon201911RowFactory."""
import pytest
from tests.testlibraries.instance_resource import InstanceResource
from zaimcsvconverter.inputtooutput.datasources.csvfile.converters.amazon_201911 import Amazon201911RowFactory
from zaimcsvconverter.inputtooutput.datasources.csvfile.data.amazon_201911 import Amazo... | yukihiko-shinoda/zaim-csv-converter | tests/inputtooutput/datasources/csvfile/converters/test_amazon_201911.py | .py | 2bc083c03e2ed6dc | 8.02 | 10 |
"""Test for GoldPointCardPlusRowFactory."""
import pytest
from tests.testlibraries.instance_resource import InstanceResource
from zaimcsvconverter.inputtooutput.datasources.csvfile.converters.gold_point_card_plus import (
GoldPointCardPlusRowFactory, # noqa: H301
)
from zaimcsvconverter.inputtooutput.datasources... | yukihiko-shinoda/zaim-csv-converter | tests/inputtooutput/datasources/csvfile/converters/test_gold_point_card_plus.py | .py | f18a3623c04493d4 | 8.02 | 10 |
"""Test for GoldPointCardPlus201912RowFactory."""
import pytest
from tests.testlibraries.instance_resource import InstanceResource
from zaimcsvconverter.inputtooutput.datasources.csvfile.converters.gold_point_card_plus_201912 import (
GoldPointCardPlus201912RowFactory, # noqa: H301
)
from zaimcsvconverter.inputt... | yukihiko-shinoda/zaim-csv-converter | tests/inputtooutput/datasources/csvfile/converters/test_gold_point_card_plus_201912.py | .py | 82ed93b2128bd28d | 8.02 | 10 |
"""Tests for MufgRowFactory."""
from dataclasses import dataclass
import pytest
from tests.testlibraries.instance_resource import InstanceResource
from zaimcsvconverter.inputtooutput.datasources.csvfile.converters.mufg import MufgRowFactory
from zaimcsvconverter.inputtooutput.datasources.csvfile.data.mufg import Muf... | yukihiko-shinoda/zaim-csv-converter | tests/inputtooutput/datasources/csvfile/converters/test_mufg.py | .py | 5ebeee5225742c20 | 8.02 | 10 |
"""Test for SFCardViewerRowFactory."""
from dataclasses import dataclass
import pytest
from tests.testlibraries.instance_resource import InstanceResource
from zaimcsvconverter import CONFIG
from zaimcsvconverter.inputtooutput.datasources.csvfile.converters.sf_card_viewer import SFCardViewerRowFactory
from zaimcsvcon... | yukihiko-shinoda/zaim-csv-converter | tests/inputtooutput/datasources/csvfile/converters/test_sf_card_viewer.py | .py | 754e6bc01d7d2b87 | 7.02 | 10 |
"""Test for ViewCardRowFactory."""
import pytest
from tests.testlibraries.instance_resource import InstanceResource
from zaimcsvconverter.inputtooutput.datasources.csvfile.converters.view_card import ViewCardRowFactory
from zaimcsvconverter.inputtooutput.datasources.csvfile.data.view_card import ViewCardRowData
from ... | yukihiko-shinoda/zaim-csv-converter | tests/inputtooutput/datasources/csvfile/converters/test_view_card.py | .py | f289f26639fc6d84 | 8.02 | 10 |
"""Tests for WaonRowFactory."""
import pytest
from tests.testlibraries.instance_resource import InstanceResource
from zaimcsvconverter.inputtooutput.datasources.csvfile.converters.waon import WaonRowFactory
from zaimcsvconverter.inputtooutput.datasources.csvfile.data.waon import WaonRowData
from zaimcsvconverter.inpu... | yukihiko-shinoda/zaim-csv-converter | tests/inputtooutput/datasources/csvfile/converters/test_waon.py | .py | c83a5faa8bc2aa7b | 8.02 | 10 |
"""Tests for AmazonRow."""
from datetime import datetime
from tests.testlibraries.assert_list import assert_each_properties
from zaimcsvconverter.inputtooutput.datasources.csvfile.data import RowDataFactory
from zaimcsvconverter.inputtooutput.datasources.csvfile.data.amazon import AmazonRowData
# Reason: Unluckily ... | yukihiko-shinoda/zaim-csv-converter | tests/inputtooutput/datasources/csvfile/data/test_amazon.py | .py | 22c49c05e2547c0f | 8.02 | 10 |
"""Tests for AmazonRow."""
from datetime import datetime
from tests.testlibraries.assert_list import assert_each_properties
from zaimcsvconverter.inputtooutput.datasources.csvfile.data import RowDataFactory
from zaimcsvconverter.inputtooutput.datasources.csvfile.data.amazon_201911 import Amazon201911RowData
# Reaso... | yukihiko-shinoda/zaim-csv-converter | tests/inputtooutput/datasources/csvfile/data/test_amazon_201911.py | .py | 1e6281248f6f2bb4 | 8.02 | 10 |
"""Tests for GoldPointCartPlusRow."""
from datetime import datetime
from tests.testlibraries.assert_list import assert_each_properties
from zaimcsvconverter.inputtooutput.datasources.csvfile.data import RowDataFactory
from zaimcsvconverter.inputtooutput.datasources.csvfile.data.gold_point_card_plus import GoldPointCa... | yukihiko-shinoda/zaim-csv-converter | tests/inputtooutput/datasources/csvfile/data/test_gold_point_card_plus.py | .py | 1e42012cb3890229 | 8.02 | 10 |
"""Tests for GoldPointCartPlusRow."""
from datetime import datetime
from zaimcsvconverter.inputtooutput.datasources.csvfile.data import RowDataFactory
from zaimcsvconverter.inputtooutput.datasources.csvfile.data.gold_point_card_plus_201912 import (
GoldPointCardPlus201912RowData, # noqa: H301
)
class TestGoldP... | yukihiko-shinoda/zaim-csv-converter | tests/inputtooutput/datasources/csvfile/data/test_gold_point_card_plus_201912.py | .py | 6fb6594862f333ec | 8.02 | 10 |
"""Tests for mufg.py."""
from datetime import datetime
import pytest
from pydantic import ValidationError
from tests.testlibraries.assert_list import assert_each_properties
from tests.testlibraries.instance_resource import InstanceResource
from zaimcsvconverter.data.mufg import CashFlowKind
from zaimcsvconverter.inp... | yukihiko-shinoda/zaim-csv-converter | tests/inputtooutput/datasources/csvfile/data/test_mufg.py | .py | e18854a689ca0bd0 | 8.02 | 10 |
"""Tests for sf_card_viewer.py."""
from datetime import datetime
from tests.testlibraries.assert_list import assert_each_properties
from zaimcsvconverter.data.sf_card_viewer import Note
from zaimcsvconverter.inputtooutput.datasources.csvfile.data import RowDataFactory
from zaimcsvconverter.inputtooutput.datasources.c... | yukihiko-shinoda/zaim-csv-converter | tests/inputtooutput/datasources/csvfile/data/test_sf_card_viewer.py | .py | f62c5e06de1970ea | 8.02 | 10 |
"""Tests for ViewCardRow."""
from datetime import datetime
from zaimcsvconverter.inputtooutput.datasources.csvfile.data import RowDataFactory
from zaimcsvconverter.inputtooutput.datasources.csvfile.data.view_card import ViewCardRowData
class TestViewCardRowData:
"""Tests for ViewCardRowData."""
# Reason: a... | yukihiko-shinoda/zaim-csv-converter | tests/inputtooutput/datasources/csvfile/data/test_view_card.py | .py | 1cc1382bd60f27f7 | 8.02 | 10 |
"""Tests for waon.py."""
from datetime import datetime
import pytest
from pydantic import ValidationError
from tests.testlibraries.assert_list import assert_each_properties
from tests.testlibraries.instance_resource import InstanceResource
from zaimcsvconverter.data.waon import ChargeKind
from zaimcsvconverter.data.... | yukihiko-shinoda/zaim-csv-converter | tests/inputtooutput/datasources/csvfile/data/test_waon.py | .py | 76d8356a547ac85d | 8.02 | 10 |
"""Tests for AmazonRow."""
from datetime import datetime
import pytest
from tests.testlibraries.assert_list import assert_each_properties
from tests.testlibraries.instance_resource import InstanceResource
from zaimcsvconverter.inputtooutput.datasources.csvfile.records.amazon import AmazonRow
from zaimcsvconverter.mo... | yukihiko-shinoda/zaim-csv-converter | tests/inputtooutput/datasources/csvfile/records/test_amazon.py | .py | 3dabf80411bf8d6f | 8.02 | 10 |
"""Tests for AmazonRow."""
from datetime import datetime
import pytest
from tests.testlibraries.instance_resource import InstanceResource
from zaimcsvconverter.inputtooutput.datasources.csvfile.records.amazon_201911 import Amazon201911DiscountRow
from zaimcsvconverter.inputtooutput.datasources.csvfile.records.amazon... | yukihiko-shinoda/zaim-csv-converter | tests/inputtooutput/datasources/csvfile/records/test_amazon_201911.py | .py | 5d255596efc623d4 | 8.02 | 10 |
"""Tests for GoldPointCartPlusRow."""
from datetime import datetime
import pytest
from tests.testlibraries.instance_resource import InstanceResource
from zaimcsvconverter.inputtooutput.datasources.csvfile.data.gold_point_card_plus import GoldPointCardPlusRowData
from zaimcsvconverter.inputtooutput.datasources.csvfil... | yukihiko-shinoda/zaim-csv-converter | tests/inputtooutput/datasources/csvfile/records/test_gold_point_card_plus.py | .py | 2e7e410c62f8122e | 8.02 | 10 |
"""Tests for GoldPointCartPlusRow."""
from datetime import datetime
import pytest
from tests.testlibraries.instance_resource import InstanceResource
from zaimcsvconverter.inputtooutput.datasources.csvfile.data.gold_point_card_plus_201912 import (
GoldPointCardPlus201912RowData, # noqa: H301
)
from zaimcsvconver... | yukihiko-shinoda/zaim-csv-converter | tests/inputtooutput/datasources/csvfile/records/test_gold_point_card_plus_201912.py | .py | 6142c409d79ca30e | 8.02 | 10 |
"""Reusable widgets for AiiDAlab applications."""
_WARNING_TEMPLATE = """
<div style="background-color: #f7f7f7; border: 2px solid #e0e0e0; padding: 20px; border-radius: 5px;">
<p style="font-size: 16px; font-weight: bold; color: #ff5733;">Warning:</p>
<p style="font-size: 14px;">The default profile '<span sty... | aiidalab/aiidalab-widgets-base | aiidalab_widgets_base/__init__.py | .py | f8de9f050dac4223 | 7.52 | 10 |
"""Provide more user friendly error messages and automated reporting.
Authors:
* Carl Simon Adorf <simon.adorf@epfl.ch>
"""
from __future__ import annotations
import base64
import json
import platform
import re
import subprocess
import sys
import textwrap
import zlib
from urllib import parse
import ipywidgets ... | aiidalab/aiidalab-widgets-base | aiidalab_widgets_base/bug_report.py | .py | d9d60b224b3f752a | 7.52 | 10 |
"""Useful functions that provide access to some data."""
import ipywidgets as ipw
import numpy as np
from ase import Atom, Atoms
# The first atom is anchoring, so the new bond will be connecting it
# The direction of the new bond is (-1, -1, -1).
FUNCTIONAL_GROUPS = {
"Select functional group": 0,
"Methyl -CH... | aiidalab/aiidalab-widgets-base | aiidalab_widgets_base/data/__init__.py | .py | 39a3417a034e80b9 | 7.52 | 10 |
"""Widgets that allow to query online databases."""
import re
import ase
import ipywidgets as ipw
import requests
import traitlets as tl
TEMPLATE_PATTERN = re.compile(r"\{\{.*\}\}")
class CodQueryWidget(ipw.VBox):
"""Query structures in Crystallography Open Database (COD)
Useful class members:
:ivar st... | aiidalab/aiidalab-widgets-base | aiidalab_widgets_base/databases.py | .py | 0ebbc334e05cae8c | 7.52 | 10 |
"""Widgets to manage AiiDA export."""
import os
import ipywidgets as ipw
class ExportButtonWidget(ipw.Button):
"""Export Node button."""
def __init__(self, process, **kwargs):
self.process = process
if "description" not in kwargs:
kwargs["description"] = f"Export workflow ({self... | aiidalab/aiidalab-widgets-base | aiidalab_widgets_base/export.py | .py | 5abd591a40d66d0f | 7.52 | 10 |
import ipywidgets as ipw
class LoadingWidget(ipw.HBox):
"""Widget for displaying a loading spinner."""
def __init__(self, message: str = "Loading", **kwargs):
self.message = ipw.Label(message)
super().__init__(
children=[
self.message,
ipw.HTML(
... | aiidalab/aiidalab-widgets-base | aiidalab_widgets_base/loaders.py | .py | 63415d7402b5d119 | 7.52 | 10 |
"""Some useful classes used acrross the repository."""
import io
import tokenize
import ipywidgets as ipw
from traitlets import Unicode
class CopyToClipboardButton(ipw.Button):
"""Button to copy text to clipboard."""
value = Unicode(allow_none=True) # Traitlet that contains a string to copy.
def __in... | aiidalab/aiidalab-widgets-base | aiidalab_widgets_base/misc.py | .py | 07268205f13f7f3a | 7.52 | 10 |
"""Widgets to work with AiiDA nodes."""
import functools
import ipytree
import ipywidgets as ipw
import traitlets as tl
from aiida import common, engine, orm
from aiida.cmdline.utils.ascii_vis import calc_info
class AiidaNodeTreeNode(ipytree.Node):
def __init__(self, pk, name, **kwargs):
self.pk = pk
... | aiidalab/aiidalab-widgets-base | aiidalab_widgets_base/nodes.py | .py | 3f4cd70ea72d3744 | 7.52 | 10 |
"""Widgets to work with processes."""
# pylint: disable=no-self-use
# Built-in imports
from __future__ import annotations
import inspect
import threading
import traceback
import warnings
from html import escape
import ipywidgets as ipw
import traitlets as tl
from aiida import engine, orm
# Local imports.
from .node... | aiidalab/aiidalab-widgets-base | aiidalab_widgets_base/process.py | .py | 108f91ce9c45f56c | 7.52 | 10 |
"""Some utility functions used acrross the repository."""
from __future__ import annotations
import itertools
import operator
import threading
from enum import Enum
from typing import Any
import ase
import ase.io
import ipywidgets as ipw
import numpy as np
import traitlets as tl
from aiida.plugins import DataFactory... | aiidalab/aiidalab-widgets-base | aiidalab_widgets_base/utils/__init__.py | .py | cf9b7d865b005e9c | 7.52 | 10 |
"""The wizard application allows the implication of a Wizard-like GUI.
Authors:
* Carl Simon Adorf <simon.adorf@epfl.ch>
"""
from __future__ import annotations
import enum
from collections.abc import Sequence
import ipywidgets as ipw
import traitlets as tl
class AtLeastTwoStepsWizardError(ValueError):
""... | aiidalab/aiidalab-widgets-base | aiidalab_widgets_base/wizard.py | .py | b8058887ab80f5fe | 7.52 | 10 |
import io
import time
from collections.abc import Mapping
import pytest
from aiida import engine, orm, plugins
# Load aiida-core's sqlite-based pytest fixtures
pytest_plugins = ["aiida.tools.pytest_fixtures"]
@pytest.fixture(scope="session")
def aiida_profile(aiida_config, aiida_profile_factory, config_sqlite_dos):... | aiidalab/aiidalab-widgets-base | tests/conftest.py | .py | 0280a36329b177cc | 8.02 | 10 |
import base64
import json
import zlib
from aiidalab_widgets_base import bug_report
def test_fingerprint_parser():
"""Test get_environment_fingerprint function and parse it out."""
encoding = "utf-8"
fingerprint = bug_report.get_environment_fingerprint(encoding)
# Parse the fingerprint.
data = b... | aiidalab/aiidalab-widgets-base | tests/test_bug_report.py | .py | 769b38cc9d26613b | 7.02 | 10 |
import ase
import pytest
import aiidalab_widgets_base as awb
from aiidalab_widgets_base.databases import ComputationalResourcesDatabaseWidget
# timeout for the test
@pytest.mark.timeout(30)
@pytest.mark.xfail(strict=False)
def test_cod_query_widget():
"""Test the COD query widget."""
widget = awb.CodQueryWi... | aiidalab/aiidalab-widgets-base | tests/test_databases.py | .py | 3d347bcfc094334d | 8.02 | 10 |
import pytest
from aiidalab_widgets_base import export
@pytest.mark.usefixtures("aiida_profile_clean")
def test_export_button_widget(multiply_add_completed_workchain, monkeypatch, tmp_path):
"""Test the export button widget."""
process = multiply_add_completed_workchain
button = export.ExportButtonWidge... | aiidalab/aiidalab-widgets-base | tests/test_export.py | .py | 9ba5dc0b529ec76c | 7.02 | 10 |
from pathlib import Path
from aiidalab_widgets_base.loaders import LoadingWidget
from aiidalab_widgets_base.utils.loaders import load_css
def test_load_css():
"""Test `load_css` utility."""
css_dir = Path("aiidalab_widgets_base/static/styles")
load_css(css_path=css_dir)
load_css(css_path=css_dir / "g... | aiidalab/aiidalab-widgets-base | tests/test_loaders.py | .py | 8ee36a92fecb2580 | 8.02 | 10 |
import pytest
from aiidalab_widgets_base import nodes
@pytest.mark.usefixtures("aiida_profile_clean")
def test_nodes_tree_widget(multiply_add_completed_workchain):
"""Test ProcessNodesTreeWidget with a simple `WorkChainNode`"""
process = multiply_add_completed_workchain
tree = nodes.NodesTreeWidget()
... | aiidalab/aiidalab-widgets-base | tests/test_nodes.py | .py | e79015ce56e7796d | 7.02 | 10 |
import base64
import re
from pathlib import Path
import ase
import pytest
import traitlets as tl
from aiida import orm
from aiidalab_widgets_base import viewers
@pytest.mark.usefixtures("aiida_profile_clean")
def test_pbc_structure_data_viewer(structure_data_object):
"""Test the periodicity of the structure vie... | aiidalab/aiidalab-widgets-base | tests/test_viewers.py | .py | 12b69896cfc42d73 | 7.02 | 10 |
import os
from pathlib import Path
from urllib.parse import urljoin
import pytest
import requests
import selenium.webdriver.support.expected_conditions as ec
from requests.exceptions import ConnectionError
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
def is_re... | aiidalab/aiidalab-widgets-base | tests_notebooks/conftest.py | .py | fdfafb9101c677bc | 8.02 | 10 |
import time
import requests
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
def test_loaded_css(selenium_driver):
driver = selenium_driver("tests_notebooks/test_notebook.ipynb")
element = driver.find_element(By.CLASS_NAME, "red-text")
assert element.value_of_cs... | aiidalab/aiidalab-widgets-base | tests_notebooks/test_notebooks.py | .py | a20769a4e4f7058a | 8.02 | 10 |
#!/usr/bin/env python3
"""https-client charm."""
import logging
import subprocess
from pathlib import Path
import pylxd
from ops.charm import (
CharmBase,
ConfigChangedEvent,
InstallEvent,
RelationBrokenEvent,
RelationChangedEvent,
RelationCreatedEvent,
StartEvent,
)
from ops.main import ... | canonical/charm-lxd | examples/https-client/src/https-client.py | .py | 7559f96711362d42 | 7.5 | 9 |
#
# Copyright 2025 Splunk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | splunk/addonfactory-solutions-library-python | solnlib/alerts_rest_client.py | .py | 40b9aa02019ee6cf | 7.65 | 19 |
#
# Copyright 2025 Splunk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | splunk/addonfactory-solutions-library-python | solnlib/bulletin_rest_client.py | .py | 5b37e4872ae16ae3 | 7.65 | 19 |
#
# Copyright 2025 Splunk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | splunk/addonfactory-solutions-library-python | solnlib/concurrent/process_pool.py | .py | deb6c78cf0008e92 | 7.65 | 19 |
#
# Copyright 2025 Splunk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | splunk/addonfactory-solutions-library-python | solnlib/concurrent/thread_pool.py | .py | adf580e1fb8d62db | 7.65 | 19 |
#
# Copyright 2025 Splunk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | splunk/addonfactory-solutions-library-python | solnlib/file_monitor.py | .py | d7e4d5a23a22539d | 7.65 | 19 |
#
# Copyright 2025 Splunk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | splunk/addonfactory-solutions-library-python | solnlib/modular_input/checkpointer.py | .py | 9ac9d8370879364b | 7.65 | 19 |
#
# Copyright 2025 Splunk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | splunk/addonfactory-solutions-library-python | solnlib/modular_input/event.py | .py | 4957ab7eee61cc84 | 7.65 | 19 |
#
# Copyright 2025 Splunk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | splunk/addonfactory-solutions-library-python | solnlib/modular_input/modinput.py | .py | 0b872d302a8bca56 | 7.65 | 19 |
#
# Copyright 2025 Splunk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | splunk/addonfactory-solutions-library-python | solnlib/modular_input/modular_input.py | .py | ad0acea06aa4db72 | 7.65 | 19 |
#
# Copyright 2025 Splunk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | splunk/addonfactory-solutions-library-python | solnlib/orphan_process_monitor.py | .py | c5fb09a8a8782e45 | 7.65 | 19 |
#
# Copyright 2025 Splunk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | splunk/addonfactory-solutions-library-python | solnlib/schedule/job.py | .py | 83319ff84573b534 | 7.65 | 19 |
#
# Copyright 2025 Splunk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | splunk/addonfactory-solutions-library-python | solnlib/schedule/scheduler.py | .py | 2cd72e6ff1ef9bf1 | 7.65 | 19 |
#
# Copyright 2025 Splunk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | splunk/addonfactory-solutions-library-python | solnlib/server_info.py | .py | ba6fbf1422188bf9 | 7.65 | 19 |
#
# Copyright 2025 Splunk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | splunk/addonfactory-solutions-library-python | solnlib/splunk_rest_client.py | .py | 16fe9e5a5b76ea9f | 7.65 | 19 |
#
# Copyright 2025 Splunk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | splunk/addonfactory-solutions-library-python | solnlib/utils.py | .py | 98e4e0d502428da3 | 7.65 | 19 |
import time
import uuid
from solnlib import log
from solnlib.modular_input import ModularInput, Argument
# Set log context
log.Logs.set_context(namespace="solnlib_demo", root_logger_log_file="collector")
# Get named logger
logger = log.Logs().get_logger("collector")
# Define orphan process handler
def orphan_handle... | splunk/addonfactory-solutions-library-python | tests/integration/data/solnlib_demo/bin/solnlib_demo_collector.py | .py | b87f7cb90049194a | 7.15 | 19 |
#
# Copyright 2025 Splunk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | splunk/addonfactory-solutions-library-python | tests/integration/test_alerts_rest_client.py | .py | bf53b57ea478be3c | 7.15 | 19 |
#
# Copyright 2023 Splunk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | splunk/addonfactory-solutions-library-python | tests/integration/test_hec_event_writer.py | .py | 7636890c62b372fa | 7.15 | 19 |
#
# Copyright 2021 Splunk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | splunk/addonfactory-solutions-library-python | tests/integration/test_logger.py | .py | 528553aa94dbac0f | 7.15 | 19 |
#
# Copyright 2023 Splunk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | splunk/addonfactory-solutions-library-python | tests/integration/test_server_info.py | .py | 07dddc1e4a41fd80 | 7.15 | 19 |
'''
Module : Args
Description : Command line argument parsing for Gurita
Copyright : (c) Bernie Pope, 16 Oct 2019-2021
License : MIT
Maintainer : bjpope@unimelb.edu.au
Portability : POSIX
'''
import argparse
import sys
import logging
import os
from pathlib import Path
import itertools
import gurita.cons... | bjpop/gurita | gurita/args.py | .py | 26a0e71c794b0b3e | 7.42 | 6 |
'''
Module : command_base
Description : base class for command classes, allows plugin-style definition of new commands
Copyright : (c) Bernie Pope, 26 September 2021
License : MIT
Maintainer : bjpope@unimelb.edu.au
Portability : POSIX
'''
import gurita.constants as const
import argparse
class Command... | bjpop/gurita | gurita/command_base.py | .py | e6d31b776111f747 | 7.42 | 6 |
'''
Module : Main
Description : The main entry point for the program.
Copyright : (c) Bernie Pope, 16 Oct 2019
License : MIT
Maintainer : bjpope@unimelb.edu.au
Portability : POSIX
A plotting and data analytics program for the command line
'''
import sys
import logging
import pandas as pd
from gurita.co... | bjpop/gurita | gurita/gurita.py | .py | e8977fe2f4924265 | 7.42 | 6 |
'''
Module : describe
Description : Display summary information about the columns in the current data frame
Copyright : (c) Bernie Pope, 16 Oct 2019
License : MIT
Maintainer : bjpope@unimelb.edu.au
Portability : POSIX
'''
import argparse
import pandas as pd
from gurita.command_base import CommandBase
... | bjpop/gurita | gurita/info.py | .py | 62f007e68b11d287 | 7.42 | 6 |
'''
Module : io.py
Description : Read/write a CSV/TSV file in/out from stdin or a named file
Copyright : (c) Bernie Pope, 27 September 2021
License : MIT
Maintainer : bjpope@unimelb.edu.au
Portability : POSIX
'''
import argparse
import sys
import pandas as pd
from pathlib import Path
from gurita.comma... | bjpop/gurita | gurita/io.py | .py | c24def7076fe674d | 7.42 | 6 |
'''
Module : pca
Description : Principal Components Analysis (PCA)
Copyright : (c) Bernie Pope, 22 September 2021
License : MIT
Maintainer : bjpope@unimelb.edu.au
Portability : POSIX
'''
import sys
import logging
import pandas as pd
from sklearn.preprocessing import StandardScaler
import sklearn.decomp... | bjpop/gurita | gurita/pca.py | .py | 5e23efa4bbf8684c | 7.42 | 6 |
'''
Module : plot_arguments
Description : Common command line arguments used by plotting commands
Copyright : (c) Bernie Pope, 25 September 2021
License : MIT
Maintainer : bjpope@unimelb.edu.au
Portability : POSIX
'''
import argparse
import gurita.constants as const
def make_plot_arguments(default_widt... | bjpop/gurita | gurita/plot_arguments.py | .py | 26c308003fd122a1 | 7.42 | 6 |
'''
Module : Main
Description : Utilities for rendering plots
Copyright : (c) Bernie Pope, 25 September 2021
License : MIT
Maintainer : bjpope@unimelb.edu.au
Portability : POSIX
'''
import sys
import matplotlib.pyplot as plt
from pathlib import Path
import gurita.utils as utils
import seaborn as sns
d... | bjpop/gurita | gurita/render_plot.py | .py | a546d6ddb96e55aa | 7.42 | 6 |
'''
Module : Utils
Description : General utilities for the Gurita program
Copyright : (c) Bernie Pope, 16 Oct 2019
License : MIT
Maintainer : bjpope@unimelb.edu.au
Portability : POSIX
'''
import sys
import logging
from pathlib import Path
import gurita.constants as const
import re
import codecs
import ... | bjpop/gurita | gurita/utils.py | .py | ef592af261b2f82f | 7.42 | 6 |
"""Landing page for the pysepal demos: one Solara server, one route per app.
Every demo keeps its entrypoint at ``app.py`` so it stays runnable on its own,
which means a plain ``import app`` would resolve to whichever demo was imported
first. Loading by path under the demo's own name avoids that collision, and
putting... | openforis/pysepal | demo_apps/gallery.py | .py | a0bb110e93f5d080 | 7.57 | 13 |
"""SEPAL Solara map application demo.
One app exercising what a real SEPAL module needs: AOI selection, async
processing with progress notifications, layer management, a floating map legend
driven by the layers currently on the map, and Earth Engine / Drive / SEPAL
exports.
This module is only the shell: it opens the... | openforis/pysepal | demo_apps/solara_map_app/app.py | .py | c9499d16fa4c8dd9 | 7.57 | 13 |
"""Application model for the Solara map application template.
This module defines the AppModel class that stores application state and configuration.
"""
from traitlets import Unicode
from pysepal.model import Model
class AppModel(Model):
"""Model class for the map application.
Stores application-specific ... | openforis/pysepal | demo_apps/solara_map_app/component/model/model.py | .py | 44a16d6f11c227a7 | 7.57 | 13 |
"""Declare the datasets the export dialog is allowed to offer."""
from pysepal.solara.components.export import ExportSource, ResolvedExport
def export_sources(aoi_value, outputs) -> list[ExportSource]:
"""Declare what the export dialog is allowed to offer.
The dialog only lists datasets a page explicitly re... | openforis/pysepal | demo_apps/solara_map_app/component/scripts/exports.py | .py | e6924c5c4d176e5c | 7.57 | 13 |
"""Turn layer definitions and Earth Engine reductions into legend data."""
import ee
from component.model import LayerLegend, ProcessingOutputs
from component.parameter import ELEVATION_CLASSES
from pysepal.solara.components.legend import DiscreteEntry, GradientEntry, LegendData
def upsert_legends(current: tuple, *... | openforis/pysepal | demo_apps/solara_map_app/component/scripts/legends.py | .py | ea8e7a6199e0d223 | 7.57 | 13 |
"""Earth Engine computations behind the demo layers."""
import ee
from component.model import ProcessingOutputs
def ndvi_composite() -> ee.Image:
"""Sentinel-2 NDVI over a fixed demo area, independent of the AOI."""
polygons = ee.FeatureCollection(
[
ee.Feature(ee.Geometry.Rectangle([-74.... | openforis/pysepal | demo_apps/solara_map_app/component/scripts/processing.py | .py | f55a78f6d779f251 | 7.57 | 13 |
"""Right-panel section holding the standalone layer controls.
This section is a hook returning MapApp content rather than a
``@solara.component``: it mixes Solara elements with pre-built ipyvuetify
buttons, and ``solara.display`` re-creates a widget instead of embedding the
instance, which would drop the ``on_event`` ... | openforis/pysepal | demo_apps/solara_map_app/component/tile/layers.py | .py | 9e1cb4e103c90114 | 7.57 | 13 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.