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 |
|---|---|---|---|---|---|---|
"""An interface for the testsuite to alter life-cycle of 3scale objects"""
# pylint: disable=no-self-use
import abc
from threescale_api.resources import Application, Backend, Service
class LifecycleHook(abc.ABC):
"""An interface to alter creation of 3scale objects
This defines certain methods that are cal... | 3scale-qe/3scale-tests | testsuite/lifecycle_hook.py | .py | 938189fc875e5ac5 | 7 | 9 |
"""
This module contains wrapper for the Mailhog API
"""
from typing import Optional, Set
import backoff
import pytest
import requests
from openshift_client import OpenShiftPythonException
from testsuite.openshift.client import OpenShiftClient
from testsuite.utils import warn_and_skip
class MailhogClient:
"""W... | 3scale-qe/3scale-tests | testsuite/mailhog.py | .py | efcdb16af788ab39 | 8 | 9 |
"""Represents mockserver calls used in tests"""
import json
from urllib.parse import urljoin
import backoff
import requests
from requests import HTTPError
from weakget import weakget
from testsuite.utils import generate_tail
class Mockserver:
"""mockserver interface
Also implements RequestBinClient interf... | 3scale-qe/3scale-tests | testsuite/mockserver.py | .py | 8923a62442ec9036 | 8 | 9 |
"""This module implements an openshift interface with openshift oc client wrapper."""
import enum
import json
import os
from contextlib import ExitStack
from functools import cached_property
from typing import Any, Callable, Dict, List, Optional, Sequence, Union
import openshift_client as oc
import yaml
from testsui... | 3scale-qe/3scale-tests | testsuite/openshift/client.py | .py | 5d51f37312b95a8d | 8 | 9 |
"""APIcast CRD object"""
from openshift_client import APIObject, Context
from testsuite.openshift.client import OpenShiftClient
class APIcast(APIObject):
"""APIcast CRD object supporting modifying all attributes"""
@classmethod
def create_instance(cls, openshift: OpenShiftClient, name, labels=None):
... | 3scale-qe/3scale-tests | testsuite/openshift/crd/apicast.py | .py | 3546e6792485ed88 | 8 | 9 |
"""Module containing APIManager object"""
from typing import Optional, Set
from openshift_client import APIObject, Missing
def _locator(path, apiobj):
"""
Translates string path like 'spec/backend/replicas' to an actual object
"""
split = path.split("/")
last_fragment = split[-1]
current_fra... | 3scale-qe/3scale-tests | testsuite/openshift/crd/apimanager.py | .py | 8fc353e300eda0d0 | 8 | 9 |
"""Module containing Operator object"""
import openshift_client as oc
from openshift_client import APIObject
class Operator(APIObject):
"""Operator CRD object with custom serializer and deserializer for pickle module"""
def __getstate__(self):
"""
Custom serializer for pickle module
... | 3scale-qe/3scale-tests | testsuite/openshift/crd/operator.py | .py | 6c2e23f216db0d63 | 8 | 9 |
"""Module containing Deployment related classes"""
import os
import typing
from abc import ABC, abstractmethod
from contextlib import ExitStack
from datetime import timezone
import openshift_client as oc
from testsuite.openshift.env import Environ
if typing.TYPE_CHECKING:
from testsuite.openshift.client import ... | 3scale-qe/3scale-tests | testsuite/openshift/deployments.py | .py | 713179d65f6085ba | 7 | 9 |
"""Module containing classes that manipulate deployment configs environment"""
import abc
import logging
import re
from typing import TYPE_CHECKING, Dict, Match
if TYPE_CHECKING:
# pylint: disable=cyclic-import
from testsuite.openshift.client import OpenShiftClient
from testsuite.openshift.deployments imp... | 3scale-qe/3scale-tests | testsuite/openshift/env.py | .py | 205c3bf3db30b17c | 7 | 9 |
"""This module contains basic objects for working with openshift resources"""
import base64
import enum
import math
import typing
from io import StringIO
from typing import List, Union
import yaml
from testsuite.certificates import Certificate
if typing.TYPE_CHECKING:
# pylint: disable=cyclic-import
from te... | 3scale-qe/3scale-tests | testsuite/openshift/objects.py | .py | 2f6174be2f25f210 | 8 | 9 |
"""Module for scaling deployments"""
import typing
from contextlib import contextmanager
from openshift_client import OpenShiftPythonException
from testsuite.openshift.deployments import DeploymentConfig, KubernetesDeployment
if typing.TYPE_CHECKING:
from testsuite.openshift.client import OpenShiftClient
fr... | 3scale-qe/3scale-tests | testsuite/openshift/scaler.py | .py | 39edfad1c2737d2b | 8 | 9 |
"""
This file contains methods that are used in performance testing
"""
import os
from urllib.parse import urlparse
import importlib_resources as resources
import yaml
from hyperfoil.factories import Benchmark, HyperfoilFactory
def _load_benchmark(filename):
"""Loads benchmark"""
with open(filename, encodin... | 3scale-qe/3scale-tests | testsuite/perf_utils.py | .py | 96c67056772bb8a2 | 8 | 9 |
"""Provide a small client for interacting with Prometheus REST API."""
import logging
import time
from datetime import datetime, timedelta, timezone
from math import ceil
from typing import Callable, Dict, Optional
from urllib.parse import urljoin
import backoff
import requests
from testsuite import settings
log = ... | 3scale-qe/3scale-tests | testsuite/prometheus.py | .py | 626d1cbcca6ed965 | 8 | 9 |
import os
from typing import List, Tuple
DEFAULT_MODEL = "gemini:gemini-3-flash-preview"
def map_ai_key(ai_key: str, model_name: str):
"""
Maps the universal CLEAN_WORKSPACE_AI_KEY to the provider-specific environment variable name.
"""
provider = model_name.split(":")[0]
mapping = {
"o... | iloveitaly/clean-browser | clean_workspace/ai.py | .py | 3531d1b24f26431b | 7.54 | 11 |
"""
I have this running on a orangepi in my home, and my eero has been disconnecting from the internet
overnight. This makes sure that an intermittent internet failure doesn't cause the job not to run.
"""
import backoff
# 8 hours, in case the internet goes down overnight
MAX_WAIT_TIME = 60 * 60 * 8
@backoff.on_exc... | iloveitaly/clean-browser | clean_workspace/internet.py | .py | 966403f82ba575d7 | 7.54 | 11 |
# Copyright 2026 SECTRA AB
#
# 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... | imi-bigpicture/opentile | opentile/cache.py | .py | 2ea0110572042954 | 7.66 | 20 |
# Copyright 2023 SECTRA AB
#
# 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... | imi-bigpicture/opentile | opentile/config.py | .py | 3db9454526ce204f | 7.66 | 20 |
# Copyright 2024 SECTRA AB
#
# 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... | imi-bigpicture/opentile | opentile/file.py | .py | 41dcf57d9fd7bd2e | 7.66 | 20 |
# Copyright 2026 SECTRA AB
#
# 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... | imi-bigpicture/opentile | opentile/formats/argos/argos_tiff_image.py | .py | cf3ac2b19d5e072c | 7.66 | 20 |
# Copyright 2026 SECTRA AB
#
# 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... | imi-bigpicture/opentile | opentile/formats/argos/argos_tiff_metadata.py | .py | 69856d3030b9cbf8 | 7.66 | 20 |
# Copyright 2026 SECTRA AB
#
# 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... | imi-bigpicture/opentile | opentile/formats/argos/argos_tiff_tiler.py | .py | 4675f6cbf9afcb1e | 7.66 | 20 |
# Copyright 2022-2023 SECTRA AB
#
# 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 a... | imi-bigpicture/opentile | opentile/formats/histech/histech_tiff_image.py | .py | 86410c7ec2df9aac | 7.66 | 20 |
# Copyright 2026 SECTRA AB
#
# 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... | imi-bigpicture/opentile | opentile/formats/histech/histech_tiff_metadata.py | .py | 4551b31eaa679ce2 | 7.66 | 20 |
# Copyright 2022-2024 SECTRA AB
#
# 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 a... | imi-bigpicture/opentile | opentile/formats/histech/histech_tiff_tiler.py | .py | 6cb9a12f2d46f220 | 7.66 | 20 |
# Copyright 2026 SECTRA AB
#
# 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... | imi-bigpicture/opentile | opentile/formats/huron/huron_tiff_metadata.py | .py | 2ee4676060fa9101 | 7.66 | 20 |
# Copyright 2026 SECTRA AB
#
# 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... | imi-bigpicture/opentile | opentile/formats/huron/huron_tiff_tiler.py | .py | b41521af03db907d | 7.66 | 20 |
# Copyright 2026 SECTRA AB
#
# 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... | imi-bigpicture/opentile | opentile/formats/leica/leica_scn_image.py | .py | 2b7412f9ab66386a | 7.66 | 20 |
# Copyright 2026 SECTRA AB
#
# 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... | imi-bigpicture/opentile | opentile/formats/leica/leica_scn_metadata.py | .py | 339305d8ac008876 | 7.66 | 20 |
# Copyright 2026 SECTRA AB
#
# 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... | imi-bigpicture/opentile | opentile/formats/leica/leica_scn_tiler.py | .py | ee5e97a5544fdaa8 | 7.66 | 20 |
# Copyright 2026 SECTRA AB
#
# 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... | imi-bigpicture/opentile | opentile/formats/mikroscan/mikroscan_tiff_metadata.py | .py | 74af3cf07f80ba35 | 7.66 | 20 |
# Copyright 2026 SECTRA AB
#
# 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... | imi-bigpicture/opentile | opentile/formats/mikroscan/mikroscan_tiff_tiler.py | .py | 33f5938c482da349 | 7.66 | 20 |
# Copyright 2026 SECTRA AB
#
# 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... | imi-bigpicture/opentile | opentile/formats/motic/motic_tiff_metadata.py | .py | 19c0545a995989ac | 7.66 | 20 |
# Copyright 2026 SECTRA AB
#
# 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... | imi-bigpicture/opentile | opentile/formats/motic/motic_tiff_tiler.py | .py | f84670e78272614b | 7.66 | 20 |
# Copyright 2021-2023 SECTRA AB
#
# 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 a... | imi-bigpicture/opentile | opentile/formats/ndpi/ndpi_metadata.py | .py | c0243103bd4c163d | 7.66 | 20 |
# Copyright 2021-2023 SECTRA AB
#
# 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 a... | imi-bigpicture/opentile | opentile/formats/ndpi/ndpi_tile.py | .py | dec179e4bbc2bce5 | 7.66 | 20 |
# Copyright 2021-2024 SECTRA AB
#
# 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 a... | imi-bigpicture/opentile | opentile/formats/ndpi/ndpi_tiler.py | .py | 917be2a518e7075f | 7.66 | 20 |
# Copyright 2022-2024 SECTRA AB
#
# 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 a... | imi-bigpicture/opentile | opentile/formats/ome/ome_tiff_tiler.py | .py | 5a5fe0d4f1cf0481 | 7.66 | 20 |
# Copyright 2021-2023 SECTRA AB
#
# 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 a... | imi-bigpicture/opentile | opentile/formats/philips/philips_tiff_metadata.py | .py | 7986d96c7d001da4 | 7.66 | 20 |
# Copyright 2021-2024 SECTRA AB
#
# 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 a... | imi-bigpicture/opentile | opentile/formats/philips/philips_tiff_tiler.py | .py | 3ec237c5dfe3d175 | 7.66 | 20 |
# Copyright 2026 SECTRA AB
#
# 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... | imi-bigpicture/opentile | opentile/formats/qptiff/qptiff_metadata.py | .py | 150d7e45c2567659 | 7.66 | 20 |
# Copyright 2026 SECTRA AB
#
# 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... | imi-bigpicture/opentile | opentile/formats/qptiff/qptiff_tiler.py | .py | eab6560abeeecb94 | 7.66 | 20 |
# Copyright 2021-2023 SECTRA AB
#
# 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 a... | imi-bigpicture/opentile | opentile/formats/svs/svs_image.py | .py | 39c9f520173197b0 | 7.66 | 20 |
# Copyright 2021-2023 SECTRA AB
#
# 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 a... | imi-bigpicture/opentile | opentile/formats/svs/svs_metadata.py | .py | 457e40eedbb9a9b5 | 7.66 | 20 |
# Copyright 2021-2024 SECTRA AB
#
# 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 a... | imi-bigpicture/opentile | opentile/formats/svs/svs_tiler.py | .py | f664b8b2c72e14a5 | 7.66 | 20 |
# Copyright 2026 SECTRA AB
#
# 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... | imi-bigpicture/opentile | opentile/formats/trestle/trestle_tiff_metadata.py | .py | 157aed7f839ab315 | 7.66 | 20 |
# Copyright 2026 SECTRA AB
#
# 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... | imi-bigpicture/opentile | opentile/formats/trestle/trestle_tiff_tiler.py | .py | 8248282d7039e21f | 7.66 | 20 |
import boto3
from .common import get_user_identity, check_contain_mandatory_tag_list
dynamodb = boto3.client("dynamodb")
def _get_instance_resource_ids(event: dict) -> list:
"""Get resource id from CloudTrail event."""
result = []
for instance in event["responseElements"]["instancesSet"]["items"]:
... | rubysoho07/cloudtrail-watcher | layer/python/cloudtrail_watcher/services/dynamodb.py | .py | e8e5886ecf54efda | 7.42 | 6 |
import boto3
from .common import get_user_identity, check_contain_mandatory_tag_list
ecr = boto3.client("ecr")
def _process_create_repository(event: dict, set_tag: bool = False) -> list:
"""Process ECR event for creating a repository. returns name of the repository."""
repository_arn = event["responseEleme... | rubysoho07/cloudtrail-watcher | layer/python/cloudtrail_watcher/services/ecr.py | .py | c7d1b0332481ba72 | 7.42 | 6 |
import boto3
from .common import get_user_identity, check_contain_mandatory_tag_list
ecs = boto3.client("ecs")
def _process_create_cluster(event: dict, set_tag: bool = False) -> list:
"""Process ECS CreateCluster API."""
if set_tag:
if not check_contain_mandatory_tag_list(
event["respon... | rubysoho07/cloudtrail-watcher | layer/python/cloudtrail_watcher/services/ecs.py | .py | b5f2be6ce25581d7 | 7.42 | 6 |
import boto3
from .common import get_user_identity, check_contain_mandatory_tag_dict
eks = boto3.client("eks")
def _process_create_cluster(event: dict, set_tag: bool = False) -> list:
"""Process ECS CreateCluster API."""
if set_tag:
if not check_contain_mandatory_tag_dict(
event["respon... | rubysoho07/cloudtrail-watcher | layer/python/cloudtrail_watcher/services/eks.py | .py | a933e5091760707a | 7.42 | 6 |
import boto3
from .common import get_user_identity, check_contain_mandatory_tag_list
emr = boto3.client("emr")
def _process_run_job_flow(event: dict, set_tag: bool = False) -> list:
"""Process RunJobFlow event to create EMR cluster."""
job_flow_id = event["responseElements"]["jobFlowId"]
if set_tag:
... | rubysoho07/cloudtrail-watcher | layer/python/cloudtrail_watcher/services/elasticmapreduce.py | .py | 3b99561c0cd41c89 | 7.42 | 6 |
import boto3
from .common import get_user_identity, check_contain_mandatory_tag_list
es = boto3.client("opensearch")
def _set_mandatory_tag(event: dict):
"""Set mandatory tag for OpenSearch Domain resources."""
if "tagList" in event["requestParameters"].keys():
if check_contain_mandatory_tag_list(e... | rubysoho07/cloudtrail-watcher | layer/python/cloudtrail_watcher/services/es.py | .py | 4b366d7d2e39f5eb | 7.42 | 6 |
import boto3
from .common import get_user_identity
lambda_ = boto3.client("lambda")
def _process_create_function_20150331(event: dict, set_tags: bool = False) -> list:
# Set mandatory tags
if set_tags:
function_arn = event["responseElements"]["functionArn"]
function_tags = lambda_.list_tags... | rubysoho07/cloudtrail-watcher | layer/python/cloudtrail_watcher/services/lambda_.py | .py | 00fff78aee072512 | 7.42 | 6 |
import boto3
from .common import (
get_user_identity,
check_contain_mandatory_tag_list,
get_service_name,
)
rds = boto3.client("rds")
def _set_mandatory_tag(event: dict, set_tags: bool = False):
"""Set mandatory tag for RDS cluster and instance."""
if not set_tags:
return
if check_c... | rubysoho07/cloudtrail-watcher | layer/python/cloudtrail_watcher/services/rds.py | .py | 62cc06365ef109c6 | 7.42 | 6 |
import boto3
from .common import get_user_identity, check_contain_mandatory_tag_list
redshift = boto3.client("redshift")
sts = boto3.client("sts")
def _get_redshift_cluster_arn(event: dict) -> str:
"""Get ARN of Redshift cluster"""
account_id = event["userIdentity"]["accountId"]
region = event["awsRegi... | rubysoho07/cloudtrail-watcher | layer/python/cloudtrail_watcher/services/redshift.py | .py | 88f44f3da8e63769 | 7.42 | 6 |
import boto3
from botocore.exceptions import ClientError
from .common import get_user_identity
s3 = boto3.resource("s3")
def _check_user_tag(tag_set: list) -> bool:
"""
Check 'User' tag exists in S3 Bucket Tagging.
Returns True when 'User' tag exists.
"""
for tag in tag_set:
if tag["Key... | rubysoho07/cloudtrail-watcher | layer/python/cloudtrail_watcher/services/s3.py | .py | 20b9f34246fbed34 | 7.42 | 6 |
import boto3
from .common import get_user_identity, check_contain_mandatory_tag_list
sns = boto3.client("sns")
def process_event(event: dict, set_tag: bool = False) -> dict:
"""Process CloudTrail event for sns"""
result = dict()
if event["eventName"] == "CreateTopic":
result["resource_id"] = _... | rubysoho07/cloudtrail-watcher | layer/python/cloudtrail_watcher/services/sns.py | .py | bf802d030c488067 | 7.42 | 6 |
import boto3
from .common import get_user_identity, check_contain_mandatory_tag_dict
sqs = boto3.client("sqs")
def process_event(event: dict, set_tag: bool = False) -> dict:
"""Process CloudTrail event for SQS"""
result = dict()
if event["eventName"] == "CreateQueue":
result["resource_id"] = _... | rubysoho07/cloudtrail-watcher | layer/python/cloudtrail_watcher/services/sqs.py | .py | e07396304f26b8aa | 7.42 | 6 |
import os
import json
import boto3
import importlib
from typing import Union
from urllib import request
from cloudtrail_watcher.services import common
sns = boto3.resource("sns")
def get_account_alias() -> Union[tuple[str, bool], tuple[None, bool]]:
"""
Get alias of AWS account.
Return alias name in st... | rubysoho07/cloudtrail-watcher | layer/python/cloudtrail_watcher/utils.py | .py | 8fe17f099a939805 | 7.42 | 6 |
import torch
import torch.nn as nn
from inplace_abn import ABN
def calc_activation(ABN_layer):
activation = None
if isinstance(ABN_layer, ABN):
if ABN_layer.activation == "relu":
activation = nn.ReLU(inplace=True)
elif ABN_layer.activation == "leaky_relu":
ac... | cifkam/FocalPosePP | ML_Decoder/helper_functions/bn_fusion.py | .py | c4af25a519264f91 | 7.48 | 8 |
import torch
import numpy as np
import transforms3d
def compute_rotation_matrix_from_ortho6d(poses):
"""
Code from https://github.com/papagina/RotationContinuity
On the Continuity of Rotation Representations in Neural Networks
Zhou et al. CVPR19
https://zhouyisjtu.github.io/project_rotation/rotati... | cifkam/FocalPosePP | focalpose/lib3d/rotations.py | .py | 68a0a02434fd4047 | 7.48 | 8 |
import numpy as np
import pandas as pd
from typing import Optional
from pyvo.dal import sia
from astropy.io import fits
from astropy import units as u
from hostphot.utils import open_fits_from_url, open_fits_from_urls
from hostphot.surveys_utils import get_survey_filters, check_filters_validity
def get_DES_urls(ra:... | temuller/hostphot | src/hostphot/cutouts/des.py | .py | 072f4d14acf04fec | 7.5 | 9 |
import numpy as np
from pathlib import Path
import astropy.units as u
from astropy.io import fits
from astropy.wcs import WCS
from astropy.nddata import Cutout2D
from astropy.coordinates import SkyCoord
from astroquery.esa.hubble import ESAHubble # HST
from hostphot._constants import workdir
from hostphot.utils imp... | temuller/hostphot | src/hostphot/cutouts/hst.py | .py | 9d2f9dfa90e3eee1 | 7.5 | 9 |
import numpy as np
from pathlib import Path
import astropy.units as u
from astropy.io import fits
from astropy.wcs import WCS
from astropy.nddata import Cutout2D
from astropy.coordinates import SkyCoord
from astroquery.esa.jwst import Jwst
from hostphot._constants import workdir
from hostphot.utils import check_work... | temuller/hostphot | src/hostphot/cutouts/jwst.py | .py | f0609fe97af2aacf | 7.5 | 9 |
import numpy as np
import pandas as pd
import astropy.units as u
from astropy.io import fits
from pyvo.dal import sia
from hostphot.utils import open_fits_from_url, open_fits_from_urls
from hostphot.surveys_utils import get_survey_filters, check_filters_validity
def get_SkyMapper_urls(ra: float, dec: float, fov: flo... | temuller/hostphot | src/hostphot/cutouts/skymapper.py | .py | 46fe42b1e24d4519 | 7.5 | 9 |
import numpy as np
import pandas as pd
from pathlib import Path
from typing import Optional
from pyvo.dal import sia
import astropy.units as u
from astropy.io import fits
import hostphot
hostphot_path = Path(hostphot.__path__[0])
from hostphot.utils import open_fits_from_url, open_fits_from_urls
from hostphot.surveys... | temuller/hostphot | src/hostphot/cutouts/splus.py | .py | 55b8e442649d6d72 | 7.5 | 9 |
import tarfile
import requests
import pandas as pd
from pathlib import Path
from typing import Optional
import astropy.units as u
from astropy.io import fits
from astropy.wcs import WCS
from astropy.nddata import Cutout2D
from astroquery.skyview import SkyView
from astropy.coordinates import SkyCoord
from hostphot.ut... | temuller/hostphot | src/hostphot/cutouts/wise.py | .py | 9e684d93f540dd93 | 7.5 | 9 |
import tarfile
import requests
import numpy as np
from pathlib import Path
import extinction
from sfdmap2 import sfdmap
from astropy.coordinates import SkyCoord
from astropy import units as u
import hostphot
from hostphot.photometry.photometry_utils import integrate_filter, extract_filter
import warnings
def _down... | temuller/hostphot | src/hostphot/photometry/dust.py | .py | dcc2fb20113388fa | 7.5 | 9 |
import numpy as np
import pandas as pd
from pathlib import Path
import matplotlib.pyplot as plt
from astropy import wcs
from astropy.io import fits
from photutils.aperture import EllipticalAperture
import hostphot
from hostphot.surveys_utils import check_survey_validity
hostphot_path = Path(hostphot.__path__[0])
co... | temuller/hostphot | src/hostphot/photometry/image_utils.py | .py | 6dbe6399473b8cdb | 7.5 | 9 |
import numpy as np
import pandas as pd
from pathlib import Path
from matplotlib import ticker
import matplotlib.pyplot as plt
from typing import Optional
import hostphot
from hostphot._constants import workdir, font_family
from hostphot.surveys_utils import get_survey_filters, filters_file, load_yml, extract_filter
p... | temuller/hostphot | src/hostphot/photometry/sed_plotting.py | .py | e67594cb6f545fa0 | 7.5 | 9 |
import numpy as np
from astropy import wcs
from astropy.io import fits
from astropy.coordinates import SkyCoord
from astropy.nddata.utils import Cutout2D
import warnings
from astropy.utils.exceptions import AstropyWarning
def trim_images(
fits_files: list[fits.ImageHDU], pos: SkyCoord, size: float
) -> list[fits... | temuller/hostphot | src/hostphot/processing/cleaning.py | .py | 6e6341edf28f2927 | 7.5 | 9 |
import numpy as np
import pandas as pd
from pathlib import Path
from typing import Optional
from copy import deepcopy
import matplotlib.pyplot as plt
import aplpy
import sep
from astropy.io import fits
from astropy import wcs
from astropy.coordinates import concatenate
from astropy.convolution import (
Gaussian2DK... | temuller/hostphot | src/hostphot/processing/masking.py | .py | 85d870ffba1187f9 | 7.5 | 9 |
import yaml
import numpy as np
from pathlib import Path
from typing import Optional
import warnings
import hostphot
hostphot_path = Path(hostphot.__path__[0])
filters_file = hostphot_path.joinpath("filters", "filters.yml")
# surveys that need background subtraction
bkg_surveys = [
"2MASS",
"WISE",
"VISTA... | temuller/hostphot | src/hostphot/surveys_utils.py | .py | c14bb6cc79b3e048 | 7.5 | 9 |
import os
import sys
import requests
import numpy as np
import pandas as pd
from io import BytesIO
from pathlib import Path
import matplotlib.image as img
import matplotlib.pyplot as plt
from contextlib import contextmanager
from datetime import datetime, timezone
from numpy.lib import recfunctions as rfn
import aplpy... | temuller/hostphot | src/hostphot/utils.py | .py | 4f6376c19a7a3e1a | 7.5 | 9 |
import unittest
import numpy as np
import os
from astropy.io import fits
from hostphot.photometry import global_photometry as gp
class TestHerschel(unittest.TestCase):
@classmethod
def setUpClass(cls):
"""Create a mock Herschel image for testing."""
cls.test_name = "Herschel_test"
cls... | temuller/hostphot | tests/test_herschel.py | .py | 467d547a3d006f37 | 8 | 9 |
import unittest
from hostphot.cutouts import download_images
from hostphot.processing import coadd_images
from hostphot.processing import create_mask
class TestHostPhot(unittest.TestCase):
def test_processing(self):
coadd_filters = "riz"
survey = "PanSTARRS"
sn_name = "2002fk"
host... | temuller/hostphot | tests/test_processing.py | .py | 568a4fd279e423e7 | 7 | 9 |
import os
import sys
sys.stderr = open(snakemake.log[0], "w")
import pandas as pd
from scipy.cluster.hierarchy import ward, leaves_list
from scipy.spatial.distance import pdist
from sklearn.feature_selection import chi2
from statsmodels.stats.multitest import fdrcorrection
import numpy as np
def collect_chromosomes... | snakemake-workflows/dna-seq-benchmark | workflow/scripts/collect-fp-fn.py | .py | fd9e1d7d2fe99811 | 7.57 | 13 |
import sys
import pandas as pd
sys.stderr = open(snakemake.log[0], "w")
def load_variant_table(file_path: str, cls) -> tuple[pd.DataFrame, dict, int]:
"""Load TSV file into a pandas DataFrame."""
variant_cols = ["chromosome", "position", "ref_allele", "alt_allele"]
df = pd.read_csv(file_path, sep="\t"... | snakemake-workflows/dna-seq-benchmark | workflow/scripts/filter-shared-variants.py | .py | 8b745a95ef7fb698 | 7.57 | 13 |
import sys
import pandas as pd
sys.stderr = open(snakemake.log[0], "w")
def load_variant_table(file_path: str, cls) -> tuple[pd.DataFrame, dict, int]:
"""Load TSV file into a pandas DataFrame."""
variant_cols = ["chromosome", "position", "ref_allele", "alt_allele"]
df = pd.read_csv(file_path, sep="\t"... | snakemake-workflows/dna-seq-benchmark | workflow/scripts/filter-unique-variants.py | .py | ac4cedf6a267c950 | 7.57 | 13 |
import sys
sys.stderr = open(snakemake.log[0], "w")
import pandas as pd
from pysam import VariantFile, VariantRecord
def load_fp_fn_table(file_path: str) -> pd.DataFrame:
"""Load TSV file into a pandas DataFrame."""
return pd.read_csv(file_path, sep="\t")
def load_vcf(file_path: str) -> VariantFile:
"""... | snakemake-workflows/dna-seq-benchmark | workflow/scripts/write-fp-fn-vcf.py | .py | 69fc645aecce17b0 | 7.57 | 13 |
import os
from logging.config import fileConfig
from alembic import context
from sqlalchemy import create_engine
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
# Interpret the config file for Python logging.
# This line sets up loggers ... | GispoCoding/tarmo | backend/databasemodel/alembic/env.py | .py | bfc4e13397a23ca9 | 7.62 | 16 |
"""add soft delete fields
Revision ID: 031ffec68d66
Revises: 68c9b9ed3e26
Create Date: 2022-04-07 12:07:06.827829
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "031ffec68d66"
down_revision = "68c9b9ed3e26"
branch_labels =... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/031ffec68d66_add_soft_delete_fields.py | .py | fd9b60b4f17142c1 | 7.62 | 16 |
"""add point view index for filtered tiling
Revision ID: 04aeb1302604
Revises: 0e85feca844d
Create Date: 2022-05-16 14:09:36.058301
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "04aeb1302604"
down_revision = "0e85feca844... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/04aeb1302604_add_point_view_index_for_filtered_tiling.py | .py | 40d8181799684a25 | 7.62 | 16 |
"""rename osm tables too
Revision ID: 0755db61ec77
Revises: 7bd932e00b99
Create Date: 2022-02-24 11:23:10.216924
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "0755db61ec77"
down_revision = "7bd932e00b99"
branch_labels = ... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/0755db61ec77_rename_osm_tables_too.py | .py | a6e1a885cdea8511 | 7.62 | 16 |
"""improve clustering and add cluster functions
Revision ID: 0e85feca844d
Revises: f10f72c08c61
Create Date: 2022-05-13 18:00:16.428923
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "0e85feca844d"
down_revision = "f10f72c... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/0e85feca844d_improve_clustering_and_add_cluster_.py | .py | c2e261a98323c469 | 7.62 | 16 |
"""move osm id generation to loader code
Revision ID: 106942da4dcc
Revises: ae776f283429
Create Date: 2022-03-29 17:52:28.916521
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "106942da4dcc"
down_revision = "8832d7a1b5fb"
... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/106942da4dcc_move_osm_id_generation_to_loader_code.py | .py | 9591df11db49f175 | 7.62 | 16 |
"""fix all_points index and permissions
Revision ID: 15d60e34986a
Revises: 6b21865a7058
Create Date: 2022-07-06 11:37:01.316638
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "15d60e34986a"
down_revision = "6b21865a7058"
b... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/15d60e34986a_fix_all_points_index_and_permissions.py | .py | 4a8bcff2d465cb4f | 7.62 | 16 |
"""remove benches and waste baskets
Revision ID: 1db9f62f20fd
Revises: 73a4b14c26ab
Create Date: 2026-03-20 17:58:56.648333
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "1db9f62f20fd"
down_revision = "73a4b14c26ab"
branc... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/1db9f62f20fd_remove_benches_and_waste_baskets.py | .py | f22eeb58f8b6b275 | 7.62 | 16 |
"""adjust tamperewfs names to match layer names, add metadata
Revision ID: 1dc4ac9953cb
Revises: ca6838d8e8a5
Create Date: 2022-03-09 14:16:23.725596
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "1dc4ac9953cb"
down_revis... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/1dc4ac9953cb_adjust_tamperewfs_names_to_match_layer_.py | .py | bdf8f81242279c2d | 7.62 | 16 |
"""add muinaisjäännös category
Revision ID: 23de797a5de0
Revises: 031ffec68d66
Create Date: 2022-05-02 16:34:56.751183
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "23de797a5de0"
down_revision = "031ffec68d66"
branch_lab... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/23de797a5de0_add_muinaisjaannos_category.py | .py | f842b403832f86ee | 7.62 | 16 |
"""remove parking areas that need permit
Revision ID: 2580e0ce4aae
Revises: ca6838d8e8a5
Create Date: 2022-03-11 11:32:41.619195
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "2580e0ce4aae"
down_revision = "ca6838d8e8a5"
... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/2580e0ce4aae_remove_parking_areas_that_need_permit.py | .py | 1bde1b29648caa86 | 7.62 | 16 |
"""revise luontorastit primary key
Revision ID: 25c1d1309c6d
Revises: 4224ed9e9473
Create Date: 2022-02-28 14:35:00.878451
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "25c1d1309c6d"
down_revision = "4224ed9e9473"
branch... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/25c1d1309c6d_revise_luontorastit_primary_key.py | .py | d071d3b268d015bd | 7.62 | 16 |
"""fix random wrong id types in all view layers
Revision ID: 37a74b19144f
Revises: 4924eaa49f96
Create Date: 2022-10-05 19:30:13.280364
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "37a74b19144f"
down_revision = "4924eaa... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/37a74b19144f_fix_random_wrong_id_types_in_all_view_.py | .py | 7870da0854f39f11 | 7.62 | 16 |
"""remove public transport shelters
Revision ID: 3d38553ecec1
Revises: 9f3e55c9d75f
Create Date: 2025-03-11 18:22:40.100843
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "3d38553ecec1"
down_revision = "9f3e55c9d75f"
branc... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/3d38553ecec1_remove_public_transport_shelters.py | .py | 4383bc1b61b7b984 | 7.62 | 16 |
"""add table_name to cluster layers
Revision ID: 3df1bb2d0c9b
Revises: 15d60e34986a
Create Date: 2022-07-07 13:37:43.346476
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "3df1bb2d0c9b"
down_revision = "15d60e34986a"
branc... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/3df1bb2d0c9b_add_table_name_to_cluster_layers.py | .py | d1f4ecc74d1192e1 | 7.62 | 16 |
"""revise osm primary keys
Revision ID: 4224ed9e9473
Revises: 5163f5a4135e
Create Date: 2022-02-24 18:43:33.749064
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "4224ed9e9473"
down_revision = "5163f5a4135e"
branch_labels ... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/4224ed9e9473_revise_osm_primary_keys.py | .py | 2e53640155938c8e | 7.62 | 16 |
"""improve all_points view for search
Revision ID: 472d0f3f0d65
Revises: fc36bf6bd3ff
Create Date: 2022-05-20 14:25:16.194078
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "472d0f3f0d65"
down_revision = "fc36bf6bd3ff"
bra... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/472d0f3f0d65_improve_all_points_view_for_search.py | .py | a1dbc887ecdce4b0 | 7.62 | 16 |
"""update wfs layers
Revision ID: 4924eaa49f96
Revises: 7d8ba4b179f5
Create Date: 2022-08-19 17:49:35.540477
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "4924eaa49f96"
down_revision = "7d8ba4b179f5"
branch_labels = None... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/4924eaa49f96_update_wfs_layers.py | .py | 1bacc9ea646141e8 | 7.62 | 16 |
"""add bike parking
Revision ID: 4d9aaf970735
Revises: 472d0f3f0d65
Create Date: 2022-06-13 17:20:45.982457
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "4d9aaf970735"
down_revision = "893d0d773706"
branch_labels = None
... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/4d9aaf970735_add_bike_parking.py | .py | 9bca510751e428ea | 7.62 | 16 |
"""separate type codes by season
Revision ID: 5163f5a4135e
Revises: 0755db61ec77
Create Date: 2022-02-24 17:06:42.688623
"""
import os
from alembic import op
here = os.path.dirname(os.path.realpath(__file__))
# revision identifiers, used by Alembic.
revision = "5163f5a4135e"
down_revision = "0755db61ec77"
branch_l... | GispoCoding/tarmo | backend/databasemodel/alembic/versions/5163f5a4135e_separate_type_codes_by_season.py | .py | 4683bdc2d3a54e88 | 7.62 | 16 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.