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 |
|---|---|---|---|---|---|---|
#!/usr/bin/env python3
from argparse import ArgumentParser
import logging
import os
import sys
import yaml
from typing import Dict, List
if __name__ == "__main__" and __package__ is None:
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from webapp.exceptions import DataError
from web... | opensciencegrid/topology | src/webapp/mappings.py | .py | 4297b2708138c3a2 | 7.69 | 23 |
#!/usr/bin/env python3
from webapp.common import safe_dict_get
from webapp.ldap_data import get_osg_ldap_id_map
from webapp.ldap_data import cilogon_id_map_to_ssh_keys
from webapp.ldap_data import get_contact_cilogon_id_map
def get_oasis_manager_endpoint_info(global_data, vo, ldappass):
""" return list of oasis... | opensciencegrid/topology | src/webapp/oasis_managers.py | .py | 43da99c7a4069d21 | 7.69 | 23 |
#!/usr/bin/env python3
# COManage REST API functions
# This module is not currently used, as it proved TOO SLOW to query for
# identifiers in serial, and we found a cool workaround to make a limited
# number of interesting identifiers available to ldap queries.
# Nonetheless, we are keeping this code around in case ... | opensciencegrid/topology | src/webapp/rest_data.py | .py | 5fba806af2d62bf9 | 7.69 | 23 |
import datetime
import json
import pathlib
import pandas as pd
def downsample(df, offset):
"""Reduce dataframe by resampling according to frequency offset/rule
Parameters
----------
df : pandas.core.frame.DataFrame
A pandas dataframe where the index is the date.
offset : str
offs... | jeremymoreau/covid19mtl | app/core.py | .py | 7f14c3231bc7511d | 7.74 | 29 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import os
# now import some fitburst-specific packages.
from fitburst.utilities import bases
class DataReader(bases.ReaderBaseClass):
"""
A child class of I/O and processing for generic data stored
in a .npz file, inheriting the basic stru... | CHIMEFRB/fitburst | fitburst/backend/generic.py | .py | 5524f41952e53b8c | 7.7 | 24 |
"""
Routines for Temporal Shapes of Profiles
This module contains functions that return profile values that are
derivable from analytic expressions. These funtions are used to
derive the temporal variation of the dynamic spectrum. In the case
of pulse broadening (e.g., due to thin-screen scattering), the profile
shape... | CHIMEFRB/fitburst | fitburst/routines/profile.py | .py | 03e59eb7d4469839 | 7.7 | 24 |
"""
Routines for Spectral Energy Distributions (SEDs)
This module contains functions that return SED values that are
derivable from analytic expression. These funtions are used to
derive the frequency variation of the dynamic spectrum.
"""
import numpy as np
def compute_spectrum_rpl(freqs: np.ndarray, freq_ref: floa... | CHIMEFRB/fitburst | fitburst/routines/spectrum.py | .py | 5b0ce46a54758c79 | 7.2 | 24 |
"""
Routines for Deriving Time-related Data
"""
from datetime import datetime, timedelta
import numpy as np
import pytz
def compute_arrival_times(parameters: dict, time0: float = 0.) -> list:
"""
Computes arrival times on a specified timescale.
Parameters
----------
parameters : dict
A di... | CHIMEFRB/fitburst | fitburst/routines/times.py | .py | ff1f54ff3d7719b3 | 7.7 | 24 |
#!/usr/bin/env python
"""Generic tests for frb-datatrails."""
import fitburst
def test_project_import():
"""Simple check to test for package importability."""
assert isinstance(fitburst.__file__, str)
def test_analysis_function():
"""Check if the seed function works."""
flavor = "str"
uuid = fit... | CHIMEFRB/fitburst | tests/test_import.py | .py | 52aab87e8171dc84 | 7.7 | 24 |
"""Application configuration classes.
This module defines configuration classes for different environments
(development, production, testing).
"""
from config import Config
from models.enums import NoHarmENV
class BaseConfig:
"""Base configuration with settings common to all environments."""
# SQLAlchemy
... | noharm-ai/backend | app/flask_config.py | .py | db62a0446d3848af | 7.76 | 32 |
"""Application handlers.
This module contains error handlers and utility endpoints.
"""
from flask import jsonify, request
from flask_jwt_extended import unset_refresh_cookies
from config import Config
from utils import logger, status
def register_handlers(app):
"""Register error handlers and utility endpoints... | noharm-ai/backend | app/handlers.py | .py | e6cf1fee29dd3fbf | 7.76 | 32 |
"""Security configuration.
This module configures security headers for HTTP responses.
"""
# Security headers to be added to all responses
SECURITY_HEADERS = {
"strict-transport-security": ["max-age=63072000", "includeSubDomains"],
"content-security-policy": ["default-src 'none'", "frame-ancestors 'none'"],
... | noharm-ai/backend | app/security.py | .py | 634177caa0a10c6f | 7.76 | 32 |
from enum import Enum
class MemoryEnum(Enum):
PRESMED_FORM = "presmed-form"
OAUTH_CONFIG = "oauth-config"
OAUTH_KEYS = "oauth-keys"
FEATURES = "features"
ADMISSION_REPORTS = "admission-reports"
ADMISSION_REPORTS_INTERNAL = "admission-reports-internal"
REPORTS = "reports"
REPORTS_INTERN... | noharm-ai/backend | models/enums.py | .py | a6fd5cf1ac1255ff | 7.76 | 32 |
"""Request models: admin global memory related"""
from pydantic import BaseModel
class GlobalMemoryItensRequest(BaseModel):
"""Request memory records"""
kinds: list[str]
class UpdateGlobalMemoryRequest(BaseModel):
"""update memory record Request"""
key: int
kind: str
value: dict
| noharm-ai/backend | models/requests/admin/admin_global_memory_request.py | .py | 91976bf229f8a320 | 7.26 | 32 |
"""Request models for admin report operations"""
from typing import Any, Optional
from pydantic import BaseModel, Field
class UpdateReportGraphsRequest(BaseModel):
"""Request model for updating report graphs"""
graphs: Optional[Any] = Field(None, description="Graph configurations as JSON")
class CopySour... | noharm-ai/backend | models/requests/admin/admin_report_request.py | .py | 0878ff809df6817f | 7.76 | 32 |
"""Request model: drug related requests"""
from pydantic import BaseModel
class DrugUnitConversionRequest(BaseModel):
"""Request model for drug conversion data"""
class DrugUnitConversionList(BaseModel):
id_measure_unit: str
factor: float
conversion_list: list[DrugUnitConversionList]
| noharm-ai/backend | models/requests/drug_request.py | .py | d64bfc3b74646321 | 7.26 | 32 |
"""Request model: protocol creation co-pilot (agent chat)"""
from typing import Literal, Optional
from pydantic import BaseModel, Field
class ProtocolAgentChatMessage(BaseModel):
"""One prior chat turn (transcript is held by the frontend)"""
role: Literal["user", "assistant"]
content: str = Field(min_l... | noharm-ai/backend | models/requests/protocol_agent_request.py | .py | 6bfd73aa15259725 | 7.76 | 32 |
"""Request model: protocol"""
from pydantic import BaseModel, Field
class ProtocolListRequest(BaseModel):
"""Protocol request parameters"""
active: bool | None = None
protocolType: str | None = None
protocolTypeList: list[int] = None
statusType: int | None = None
term: str | None = None
cl... | noharm-ai/backend | models/requests/protocol_request.py | .py | a00227d5e33dfa80 | 7.76 | 32 |
"""Request models for regulation reports"""
from typing import Optional
from pydantic import BaseModel
class Order(BaseModel):
field: str
direction: str
class RegIndicatorsPanelReportRequest(BaseModel):
"""Request model for regulation indicators panel report"""
indicator: str
name: Optional[s... | noharm-ai/backend | models/requests/regulation_reports_request.py | .py | b1b3241731367caf | 7.76 | 32 |
from typing import Literal, Optional
from pydantic import BaseModel, Field
class SuggestGraphsColumn(BaseModel):
key: str
label: str
type: Literal["string", "number", "date", "boolean", "object"]
options: Optional[list[str]] = None
distinctCount: Optional[int] = None
class SuggestGraphsRequest(... | noharm-ai/backend | models/requests/reports_custom_request.py | .py | 009caf2e88ca2b57 | 7.76 | 32 |
"""Response: response classes for n0_agent"""
from pydantic import BaseModel, Field
class ExtraFields(BaseModel):
"""Campos complementares."""
label: str = Field(description="Descrição do campo")
type: str = Field(description="Tipo de campo (text, boolean, archive)")
class TicketForm(BaseModel):
"... | noharm-ai/backend | models/response/agents/n0_response.py | .py | f419e084c86137a2 | 7.76 | 32 |
"""Response: structured output classes for the protocol creation co-pilot agent"""
from typing import Optional
from pydantic import BaseModel, Field
class ProtocolAgentProposalConfig(BaseModel):
"""Proposed protocol configuration (same shape persisted in Protocol.config)."""
variables: list[dict] = Field(
... | noharm-ai/backend | models/response/agents/protocol_agent_response.py | .py | 374766976803b066 | 7.76 | 32 |
from drf_spectacular.extensions import OpenApiAuthenticationExtension
from drf_spectacular.plumbing import build_bearer_security_scheme_object
from oauth2_provider.contrib.rest_framework import OAuth2Authentication
from ephios.api.models import AccessToken
from ephios.core.models import UserProfile
class TokenScheme... | ephios-dev/ephios | src/ephios/api/access/auth.py | .py | 12b8544358051da3 | 7.73 | 28 |
# Generated by Django 5.0.8 on 2024-09-12 20:15
import oauth2_provider.models
from django.db import migrations, models
from oauth2_provider.settings import oauth2_settings
def forwards_func(apps, schema_editor):
"""
Forward migration touches every "old" accesstoken.token which will cause the checksum to be c... | ephios-dev/ephios | src/ephios/api/migrations/0005_accesstoken_token_checksum_refreshtoken_token_family_and_more.py | .py | 8b96963172c617c3 | 7.73 | 28 |
from django.db import models
from django.urls import reverse
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from oauth2_provider.models import (
AbstractAccessToken,
AbstractApplication,
AbstractGrant,
AbstractIDToken,
AbstractRefreshToken,
ApplicationMa... | ephios-dev/ephios | src/ephios/api/models.py | .py | 3b6d61dc2d6a6221 | 7.73 | 28 |
from django.contrib.auth import get_user_model
from rest_framework.permissions import DjangoModelPermissions, DjangoObjectPermissions
class ViewPermissionsMixin:
# DjangoModelPermissions and DjangoObjectPermissions only check permissions for write/unsafe operations.
# This mixin adds permissions for read/safe... | ephios-dev/ephios | src/ephios/api/permissions.py | .py | deea162f9be30925 | 7.73 | 28 |
class DynamicSettingsProxy:
"""
Proxy access to django settings but first check if any receiver overwrites it with a dynamic value.
"""
NONE = object()
def __init__(self):
from django.conf import settings
self._django_settings = settings
def __getattr__(self, name):
f... | ephios-dev/ephios | src/ephios/core/dynamic.py | .py | c92ff24b9400cee7 | 7.73 | 28 |
#!/usr/bin/env python3
# encoding: utf-8
"""
ARC - Automatic Rate Calculator
"""
import argparse
import logging
import os
from arc.common import read_yaml_file
from arc.main import ARC
def parse_command_line_arguments(command_line_args=None):
"""
Parse command-line arguments.
Args:
command_lin... | ReactionMechanismGenerator/ARC | ARC.py | .py | d95803e5f1bbec61 | 7.86 | 51 |
#!/usr/bin/env python3
# encoding: utf-8
"""
This module contains unit tests for the kinetic families defined under arc.data.families.
"""
import unittest
import os
from arc.family.family import ReactionFamily, get_reaction_family_products, get_recipe_actions
from arc.imports import settings
from arc.reaction.reacti... | ReactionMechanismGenerator/ARC | arc/family/arc_families_test.py | .py | 3847b65362a477c1 | 7.36 | 51 |
"""
This module contains unit tests for the arc.imports module.
"""
import os
import tempfile
import unittest
from unittest.mock import patch
from arc.imports import resolve_overridden_dependents
from arc.settings import external_paths
# The finders consult these before ``repo_path``, and CI exports two of them
# (s... | ReactionMechanismGenerator/ARC | arc/imports_test.py | .py | 9c673c0b58c225fc | 8.36 | 51 |
#!/usr/bin/env python3
# encoding: utf-8
"""
A standalone script to retrieve xyz data from AutoTST,
should be run under the tst_env.
"""
# tst_env is Python 3.9; this script uses PEP 604 union syntax
# (``str | None``) for parity with the rest of ARC. The future-import
# defers annotation evaluation so 3.9 doesn't ch... | ReactionMechanismGenerator/ARC | arc/job/adapters/scripts/autotst_script.py | .py | 9e4015cf20dbda25 | 7.86 | 51 |
#!/usr/bin/env python3
# encoding: utf-8
from openbabel import openbabel
import argparse
import os
import yaml
def xyz_to_OBMol(xyz: str) -> openbabel.OBMol:
"""
Turns an xyz to OBMol object.
Args:
xyz (str): xyz in xyz file format
Returns:
mol (OBMol): OBMol object that corresponds ... | ReactionMechanismGenerator/ARC | arc/job/adapters/scripts/ob_script.py | .py | 44854f660a64d2b6 | 7.86 | 51 |
"""Module dedicated to the calculation of reaction rate constants."""
from __future__ import annotations
__all__ = ["eyring"]
import logging
import numpy as np
import overreact as rx
from overreact import _constants as constants
logger = logging.getLogger(__name__)
@np.vectorize
def liquid_viscosity(id, temper... | geem-lab/overreact | overreact/rates.py | .py | e415c17830dd923f | 7.91 | 64 |
"""Module dedicated to the calculation of thermodynamic properties in solvation."""
from __future__ import annotations
import logging
import numpy as np
import overreact as rx
from overreact import _constants as constants
from overreact import coords
from overreact._misc import _derivative as derivative
logger = l... | geem-lab/overreact | overreact/thermo/_solv.py | .py | aa3c3d953a3805e7 | 7.91 | 64 |
"""Module dedicated to quantum tunneling approximations."""
from __future__ import annotations
__all__ = ["eckart", "wigner"]
import logging
import numpy as np
from scipy.integrate import fixed_quad
from scipy.special import roots_laguerre
from overreact import _constants as constants
logger = logging.getLogger(... | geem-lab/overreact | overreact/tunnel.py | .py | f7eeae99127f71f6 | 7.91 | 64 |
"""Tests for the command-line interface."""
from __future__ import annotations
from overreact import _cli as cli
def test_cli_compiles_source_file(monkeypatch) -> None:
"""Ensure the command-line interface can compile a source file (`.k`)."""
params = ["overreact", "--compile", "data/ethane/B97-3c/model.k"]... | geem-lab/overreact | tests/test_cli.py | .py | b811866d90988f2f | 7.41 | 64 |
"""Tests for constants module."""
from __future__ import annotations
import pytest
import overreact as rx
from overreact import _constants as constants
def test_reference_raw_constants() -> None:
"""Ensure raw constants are close to values commonly used by the community.
Reference values were taken from t... | geem-lab/overreact | tests/test_constants.py | .py | b523b8941ee48030 | 8.41 | 64 |
"""Tests for misc module."""
from __future__ import annotations
import numpy as np
import pytest
import overreact as rx
def test_broaden_spectrum_works() -> None:
"""Ensure we can broad a simple spectrum."""
x = np.linspace(50, 200, num=15)
s = rx._misc.broaden_spectrum(x, [150, 100], [2, 1], scale=20.... | geem-lab/overreact | tests/test_misc.py | .py | a5b21b633f9741a3 | 8.41 | 64 |
"""Tests for simulate module."""
from __future__ import annotations
import numpy as np
import pytest
import overreact as rx
from overreact import simulate
def test_get_dydt_calculates_reaction_rate() -> None:
"""Ensure get_dydt gives correct reaction rates."""
scheme = rx.Scheme(
compounds=["A", "B... | geem-lab/overreact | tests/test_simulate.py | .py | bf8417dc65d88599 | 7.41 | 64 |
"""Tests for tunnel module."""
from __future__ import annotations
import pytest
import overreact as rx
def test_wigner_tunneling_corrections_are_correct() -> None:
"""Ensure Wigner tunneling values are correct."""
with pytest.raises(ValueError, match="vibfreq should not be zero for tunneling"):
rx.... | geem-lab/overreact | tests/test_tunnel.py | .py | cbffe777d31c2c01 | 7.41 | 64 |
# 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, software
# d... | openstack/placement | api-ref/ext/validator.py | .py | 32eed8dd88cd77ee | 7.72 | 27 |
# 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, software
# d... | openstack/placement | placement/attribute_cache.py | .py | b2ae5401a113bad1 | 7.72 | 27 |
# 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, software
# d... | openstack/placement | placement/auth.py | .py | 037bc455d3fd9150 | 7.72 | 27 |
# 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, software
# d... | openstack/placement | placement/cmd/status.py | .py | 7e5b076b742159dc | 7.72 | 27 |
# Copyright 2015 OpenStack Foundation
# All Rights Reserved.
#
# 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 requ... | openstack/placement | placement/conf/opts.py | .py | 9266482e1316f0c4 | 7.72 | 27 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright 2012 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the ... | openstack/placement | placement/conf/paths.py | .py | df2c6f5583561529 | 7.72 | 27 |
# 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, software
# d... | openstack/placement | placement/context.py | .py | 47347c9925253b8a | 7.72 | 27 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# 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 ... | openstack/placement | placement/db/sqlalchemy/migration.py | .py | 9a1ed10fb25908b9 | 7.72 | 27 |
# 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, software
# d... | openstack/placement | placement/db_api.py | .py | b2ca08325ae67451 | 7.72 | 27 |
# 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, software
# d... | openstack/placement | placement/deploy.py | .py | 24d922b90e6cdfa9 | 7.72 | 27 |
# 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, software
# d... | openstack/placement | placement/exception.py | .py | d905c32aad1ffa96 | 7.72 | 27 |
# 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, software
# distributed under the... | openstack/placement | placement/fault_wrap.py | .py | 0cd3f8f6232c6e27 | 7.72 | 27 |
# 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, software
# d... | openstack/placement | placement/handler.py | .py | 360766c4c2fa6a77 | 7.72 | 27 |
# 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, software
# d... | openstack/placement | placement/handlers/aggregate.py | .py | 860d3979cdfa4f9c | 7.72 | 27 |
# 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, software
# d... | openstack/placement | placement/handlers/allocation_candidate.py | .py | 28c97329ef38dcb7 | 7.72 | 27 |
# 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, software
# d... | openstack/placement | placement/handlers/reshaper.py | .py | 5ee4ccd671a6c66d | 7.72 | 27 |
# 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, software
# d... | openstack/placement | placement/handlers/resource_class.py | .py | 50d527376d4fd8c5 | 7.72 | 27 |
# 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, software
# d... | openstack/placement | placement/handlers/resource_provider.py | .py | d0484b667a90bc4f | 7.72 | 27 |
"""Logging Configurator for tails server."""
import io
import logging
import os
import sys
from importlib import resources
from logging.config import dictConfigClass
from typing import Optional
import yaml
sys.path.insert(1, os.path.realpath(os.path.dirname(__file__)) + "/config")
LOGGER = logging.getLogger(__name_... | bcgov/indy-tails-server | tails_server/loadlogger.py | .py | debf2691774f2368 | 7.74 | 29 |
from datetime import timedelta
from flask import current_app, request, session
REQUEST_TIMEOUT = 5
GC_ARTICLES_AUTH_API_ENDPOINT = "/wp-json/jwt-auth/v1/token"
GC_ARTICLES_AUTH_TOKEN_CACHE_KEY = "gc-articles-bearer-token"
GC_ARTICLES_AUTH_TOKEN_CACHE_TTL = int(timedelta(days=1).total_seconds())
GC_ARTICLES_FALLBACK_C... | cds-snc/notification-admin | app/articles/__init__.py | .py | 9b4941452f4c2661 | 7.67 | 21 |
import hashlib
class AssetFingerprinter(object):
"""
Get a unique hash for an asset file, so that it doesn't stay cached
when it changes
Usage:
in the application
template_data.asset_fingerprinter = AssetFingerprinter()
where template data is how you pass variables to every ... | cds-snc/notification-admin | app/asset_fingerprinter.py | .py | 149188f84c7c7a07 | 7.67 | 21 |
import React from "react";
import dayjs from "dayjs";
import { StateProvider, setIntialState } from "../store";
import { I18nProvider, getTranslate } from "../i18n";
import { Calendar } from "./Calendar";
import { render, fireEvent, wait } from "@testing-library/react";
import "@testing-library/jest-dom/extend-expect";... | cds-snc/notification-admin | app/assets/javascripts/scheduler/Calendar/Calendar.test.js | .js | 0043fad283ae92b0 | 7.17 | 21 |
import argparse
import csv
import logging
import sys
from lib import now_ts, print_rate_limiting_explanation, sc_get, validate_environment
parser = argparse.ArgumentParser(
description="Exports Epic comments as a CSV",
)
parser.add_argument(
"-e",
"--epic-id",
dest="epic_id",
help="Export comments... | useshortcut/api-cookbook | epic-comments/epic_comments.py | .py | 01ef6dcaa0bd2c05 | 7.9 | 63 |
"""Helper functions for communicating with the Shortcut API.
Expects the Shortcut token to be set in the SHORTCUT_API_TOKEN
environment variable.
"""
from datetime import datetime
import sys
import os
import logging
from pyrate_limiter import Duration, InMemoryBucket, Limiter, Rate # type: ignore
import requests
... | useshortcut/api-cookbook | epic-comments/lib.py | .py | 2d79f92dd5e60c94 | 7.9 | 63 |
#!/usr/bin/env python3
"""Generate a report of story rollover from iteration to iteration.
This script analyzes stories in an iteration and reports how many previous
iterations each story has been in, grouped by team (group_id).
Usage:
# Analyze the latest started iteration
python iteration_rollover.py
#... | useshortcut/api-cookbook | iteration-rollover/iteration_rollover.py | .py | 248368ea8b0518e9 | 7.9 | 63 |
"""Helper functions for communicating with the Shortcut API.
Expects the Shortcut token to be set in the SHORTCUT_API_TOKEN
environment variable.
"""
import sys
import os
import logging
from pyrate_limiter import Duration, InMemoryBucket, Limiter, Rate # type: ignore
import requests
# Logging
logger = logging.get... | useshortcut/api-cookbook | iteration-rollover/lib.py | .py | 26803568b8342928 | 7.9 | 63 |
"""Helper functions for communicating with the Shortcut API.
Expects the Shortcut token to be set in the SHORTCUT_API_TOKEN
environment variable.
"""
from collections.abc import Mapping
from copy import deepcopy
from datetime import datetime
import mimetypes
import re
import sys
import csv
import json
import os
impo... | useshortcut/api-cookbook | pivotal-import/lib.py | .py | bb34825633e10553 | 7.9 | 63 |
from dataclasses import asdict, dataclass
import os
import requests
from ShortcutMetadata import ShortcutMetadata
@dataclass( frozen = True, eq = True ) # These settings make objects of this class hashable. We'll need that for set operations used by the caller.
class ShortcutStoryLink:
s... | useshortcut/api-cookbook | pivotal-import/post-import-utils/ShortcutObject.py | .py | 7db289c7bffc6f2b | 7.9 | 63 |
from boltons.dictutils import OrderedMultiDict
from dataclasses import dataclass
from itertools import islice
import json
import os
import regex
from typing import Iterable
from PivotalExport import PivotalBlocker, PivotalExport, PivotalItemLabe... | useshortcut/api-cookbook | pivotal-import/post-import-utils/assign_favorite_epic_per_story.py | .py | 147853fc1bc70400 | 7.9 | 63 |
from itertools import islice
import json
import os
import regex
from ShortcutMetadata import ShortcutMetadata
from ShortcutObject import ShortcutObject
def make_edited_string( s: str, scid_from_ptid, url_slug ):
'''
Return an edited copy of `s`, or None if the output wo... | useshortcut/api-cookbook | pivotal-import/post-import-utils/transform_id_mappings.py | .py | d02010bd1fc4a496 | 7.9 | 63 |
"""Helper functions for communicating with the Shortcut API.
Expects the Shortcut token to be set in the SHORTCUT_API_TOKEN
environment variable.
"""
from datetime import datetime
import sys
import os
import logging
from pyrate_limiter import Duration, InMemoryBucket, Limiter, Rate # type: ignore
import requests
... | useshortcut/api-cookbook | unused-labels/lib.py | .py | ded8712a7e0e3d5c | 7.9 | 63 |
"""Helper functions for communicating with the Shortcut API v4.
Expects the Shortcut token to be set in the SHORTCUT_API_TOKEN environment
variable and the workspace slug in SHORTCUT_WORKSPACE_SLUG.
"""
from datetime import datetime
import sys
import os
import logging
from pyrate_limiter import Duration, InMemoryBuc... | useshortcut/api-cookbook | v4-admin-token-management/lib.py | .py | 78c8bd30ca0e3ee5 | 7.9 | 63 |
"""Helper functions for communicating with the Shortcut API v4.
Expects the Shortcut token to be set in the SHORTCUT_API_TOKEN environment
variable and the workspace slug in SHORTCUT_WORKSPACE_SLUG.
"""
from datetime import datetime
import sys
import os
import logging
from pyrate_limiter import Duration, InMemoryBu... | useshortcut/api-cookbook | v4-epic-with-stories/lib.py | .py | 683c8d630c62224b | 7.9 | 63 |
"""Helper functions for communicating with the Shortcut API v4.
Expects the Shortcut token to be set in the SHORTCUT_API_TOKEN environment
variable and the workspace slug in SHORTCUT_WORKSPACE_SLUG.
"""
from datetime import datetime
import sys
import os
import logging
from pyrate_limiter import Duration, InMemoryBu... | useshortcut/api-cookbook | v4-story-comments/lib.py | .py | 18dc7663df98eac5 | 7.9 | 63 |
"""Helpers for publishing versioned documentation to GitHub Pages."""
from __future__ import annotations
import argparse
import json
import re
import shutil
from pathlib import Path
from urllib.error import HTTPError, URLError
from urllib.request import urlopen
SEMVER_RE = re.compile(r"^\d+\.\d+\.\d+$")
PRERELEASE_R... | pegasystems/pega-datascientist-tools | python/docs/versioned_docs.py | .py | 1cbdeae57039d45d | 7.8 | 39 |
"""Datamart-level AGB discovery helper."""
from __future__ import annotations
import base64
import json
import logging
import zlib
from typing import TYPE_CHECKING
import polars as pl
from ...utils import cdh_utils
logger = logging.getLogger(__name__)
if TYPE_CHECKING:
from ...utils.types import QUERY
fro... | pegasystems/pega-datascientist-tools | python/pdstools/adm/trees/_agb.py | .py | 249ce714b473764e | 7.8 | 39 |
"""The :class:`MultiTrees` collection — multiple snapshots of one config."""
from __future__ import annotations
import logging
import multiprocessing
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any
import polars as pl
from ._model import ADMTreesModel
if TYPE_CHECKING:
from collections.... | pegasystems/pega-datascientist-tools | python/pdstools/adm/trees/_multi.py | .py | 4ff235c069a162fb | 7.8 | 39 |
"""Tree primitives: split parsing, node dataclass, traversal helpers."""
from __future__ import annotations
import re
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any, Literal, cast
if TYPE_CHECKING:
from collections.abc import Iterator
SplitOperator = Literal["<", ">", "==", "in", "is"]
... | pegasystems/pega-datascientist-tools | python/pdstools/adm/trees/_nodes.py | .py | fb73eda7032787e9 | 7.8 | 39 |
# python/pdstools/app/data_quality/_navigation.py
"""Programmatic navigation for the Topic Data Quality app.
Mirrors the pattern used by Impact Analyzer, Decision Analyzer, and
Health Check so all pdstools Streamlit apps share one navigation
mechanism.
"""
from __future__ import annotations
from dataclasses import d... | pegasystems/pega-datascientist-tools | python/pdstools/app/data_quality/_navigation.py | .py | 1adfd237683fc428 | 7.8 | 39 |
"""Topic Data Quality app – Streamlit helpers."""
from __future__ import annotations
import logging
import streamlit as st
logger = logging.getLogger(__name__)
def ensure_dq_data_loaded() -> bool:
"""Return ``True`` when ``st.session_state["topic_dq"]`` is populated."""
return "topic_dq" in st.session_sta... | pegasystems/pega-datascientist-tools | python/pdstools/app/data_quality/dq_streamlit_utils.py | .py | bcef48b152211bcd | 7.8 | 39 |
# python/pdstools/app/decision_analyzer/_home_page.py
"""Home page for the Decision Analysis app.
Exposes a single ``render()`` callable that ``_navigation.build_navigation()``
registers as the default page in ``st.navigation()``. Kept as a function
(not a script) so navigation routes to it without re-executing top-le... | pegasystems/pega-datascientist-tools | python/pdstools/app/decision_analyzer/_home_page.py | .py | 1a3ee9ad1e822e87 | 7.8 | 39 |
# python/pdstools/app/decision_analyzer/_navigation.py
"""Programmatic navigation for the Decision Analysis app.
Replaces Streamlit's auto-discovery of ``pages/`` with an explicit
``st.navigation()`` registry. Pages that need a loaded
``DecisionAnalyzer`` are hidden from the sidebar until
``st.session_state["decision_... | pegasystems/pega-datascientist-tools | python/pdstools/app/decision_analyzer/_navigation.py | .py | f2678a42c9b0bbeb | 7.8 | 39 |
from __future__ import annotations
import polars as pl
import streamlit as st
from pdstools.app.decision_analyzer.da_streamlit_utils import (
collect_page_filters,
contextual_filters,
ensure_data,
get_data_filters,
show_filtered_counts,
)
from pdstools.decision_analyzer.utils import (
apply_fi... | pegasystems/pega-datascientist-tools | python/pdstools/app/decision_analyzer/pages/6_Win_Loss_Analysis.py | .py | 346b9e9a17559afd | 7.8 | 39 |
# Copyright 2020 D-Wave Systems 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 wri... | dwavesystems/dwave-qiskit-plugin | tests/test_dwave_minimum_eigen_solver.py | .py | 60ff0fef299697d9 | 8.29 | 37 |
from homeassistant.helpers.entity import Entity
from .const import DOMAIN
class ComelitDevice(Entity):
def __init__(self, id, device_type, name):
"""Initialize the Comelit device."""
self._is_available = True
self._device_type = device_type
self._id = id
self._state = None... | gicamm/homeassistant-comelit | custom_components/comelit/comelit_device.py | .py | 3526d6bb8ce4f17d | 7.75 | 31 |
"""API management class and base class for the different end points."""
from __future__ import annotations
from abc import ABC
from collections.abc import Callable, ItemsView, Iterator, ValuesView
import enum
from typing import TYPE_CHECKING, Any, Generic, cast, final
from ..models.api import ApiItemT, ApiRequest
i... | Kane610/aiounifi | aiounifi/interfaces/api_handlers.py | .py | a09e8d7e6588ba1b | 7.98 | 89 |
"""Clients are devices on a UniFi network."""
from ..models.api import TypedApiResponse
from ..models.client import (
Client,
ClientBlockRequest,
ClientListRequest,
ClientReconnectRequest,
ClientRemoveRequest,
)
from ..models.message import MessageKey
from .api_handlers import APIHandler
class Cl... | Kane610/aiounifi | aiounifi/interfaces/clients.py | .py | 4973b9b56eac0e48 | 7.98 | 89 |
"""Python library to enable integration between Home Assistant and UniFi."""
from __future__ import annotations
from collections.abc import Callable, Mapping
import datetime
from http import HTTPStatus, cookies
import logging
from typing import TYPE_CHECKING, Any, cast
import aiohttp
from aiohttp import client_excep... | Kane610/aiounifi | aiounifi/interfaces/connectivity.py | .py | 70075689d78ba56b | 7.98 | 89 |
"""UniFi devices are network infrastructure.
Access points, gateways, power plugs, switches.
"""
from ..models.api import TypedApiResponse
from ..models.device import Device, DeviceListRequest, DeviceUpgradeRequest
from ..models.message import MessageKey
from .api_handlers import APIHandler
class Devices(APIHandler... | Kane610/aiounifi | aiounifi/interfaces/devices.py | .py | 7aa41bd14979d86b | 7.98 | 89 |
"""DPI Restrictions as part of a UniFi network."""
from ..models.api import TypedApiResponse
from ..models.dpi_restriction_app import (
DPIRestrictionApp,
DPIRestrictionAppEnableRequest,
DpiRestrictionAppListRequest,
)
from ..models.message import MessageKey
from .api_handlers import APIHandler
class DPI... | Kane610/aiounifi | aiounifi/interfaces/dpi_restriction_apps.py | .py | 4d190220063b4a11 | 7.98 | 89 |
"""Manage events from UniFi Network Controller."""
from __future__ import annotations
from collections.abc import Callable
import logging
from typing import TYPE_CHECKING
from ..models.event import Event, EventKey
from ..models.message import Message, MessageKey
if TYPE_CHECKING:
from ..controller import Contro... | Kane610/aiounifi | aiounifi/interfaces/events.py | .py | 2c14e26b39a51346 | 7.98 | 89 |
"""Manage events from UniFi Network Controller."""
from __future__ import annotations
from collections.abc import Callable
import logging
from typing import TYPE_CHECKING, Any
import orjson
from ..models.message import Message, MessageKey
if TYPE_CHECKING:
from ..controller import Controller
LOGGER = logging.... | Kane610/aiounifi | aiounifi/interfaces/messages.py | .py | 7c25437e265c3be3 | 7.98 | 89 |
"""Object-oriented network configurations as part of a UniFi network."""
from copy import deepcopy
from ..models.api import TypedApiResponse
from ..models.object_oriented_network_config import (
ObjectOrientedNetworkConfig,
ObjectOrientedNetworkConfigListRequest,
ObjectOrientedNetworkConfigUpdateRequest,
... | Kane610/aiounifi | aiounifi/interfaces/object_oriented_network_configs.py | .py | 69fb95b6916007cf | 7.98 | 89 |
"""Device outlet handler."""
from __future__ import annotations
from typing import TYPE_CHECKING
from ..models.outlet import Outlet
from .api_handlers import APIHandler, ItemEvent
if TYPE_CHECKING:
from ..controller import Controller
class Outlets(APIHandler[Outlet]):
"""Represents network device ports.""... | Kane610/aiounifi | aiounifi/interfaces/outlets.py | .py | f195de9c52787dee | 7.98 | 89 |
"""Device port handler."""
from __future__ import annotations
from typing import TYPE_CHECKING
from ..models.port import Port
from .api_handlers import APIHandler, ItemEvent
if TYPE_CHECKING:
from ..controller import Controller
class Ports(APIHandler[Port]):
"""Represents network device ports."""
ite... | Kane610/aiounifi | aiounifi/interfaces/ports.py | .py | 10b73f87183deff7 | 7.98 | 89 |
"""Speedtest interface."""
from __future__ import annotations
import logging
from aiounifi.models.speedtest import (
SpeedtestStatus,
SpeedtestStatusRequest,
SpeedtestTriggerRequest,
)
from .api_handlers import APIHandler
LOGGER = logging.getLogger(__name__)
class SpeedtestHandler(APIHandler[Speedtes... | Kane610/aiounifi | aiounifi/interfaces/speedtest.py | .py | dbb2853730135198 | 8.48 | 89 |
"""Traffic routes as part of a UniFi network."""
from copy import deepcopy
from ..models.api import TypedApiResponse
from ..models.traffic_route import (
TrafficRoute,
TrafficRouteListRequest,
TrafficRouteSaveRequest,
)
from .api_handlers import APIHandler
class TrafficRoutes(APIHandler[TrafficRoute]):
... | Kane610/aiounifi | aiounifi/interfaces/traffic_routes.py | .py | 5b1e97abbbc4ab35 | 7.98 | 89 |
"""Traffic rules as part of a UniFi network."""
from copy import deepcopy
from ..models.api import TypedApiResponse
from ..models.traffic_rule import (
TrafficRule,
TrafficRuleEnableRequest,
TrafficRuleListRequest,
)
from .api_handlers import APIHandler
class TrafficRules(APIHandler[TrafficRule]):
"... | Kane610/aiounifi | aiounifi/interfaces/traffic_rules.py | .py | 289c157640172ce4 | 7.98 | 89 |
"""Hotspot vouchers as part of a UniFi network."""
from ..models.api import TypedApiResponse
from ..models.voucher import (
Voucher,
VoucherCreateRequest,
VoucherDeleteRequest,
VoucherListRequest,
)
from .api_handlers import APIHandler
class Vouchers(APIHandler[Voucher]):
"""Represents Hotspot vo... | Kane610/aiounifi | aiounifi/interfaces/vouchers.py | .py | d2288dcf161ab368 | 7.98 | 89 |
"""WLANs as part of a UniFi network."""
from ..models.api import TypedApiResponse
from ..models.message import MessageKey
from ..models.wlan import Wlan, WlanEnableRequest, WlanListRequest, wlan_qr_code
from .api_handlers import APIHandler
class Wlans(APIHandler[Wlan]):
"""Represents WLAN configurations."""
... | Kane610/aiounifi | aiounifi/interfaces/wlans.py | .py | fe322e029ee40fc4 | 7.98 | 89 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.