This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import random | |
import logging | |
import httpx | |
import tenacity | |
logging.basicConfig(level=logging.INFO, format="%(relativeCreated)dms %(message)s") | |
N_SEMAPHORE = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import os | |
import sys | |
from distutils.util import strtobool | |
from typing import Optional | |
def configure_logging_to_stderr_only(filename: Optional[str] = None): | |
"""Configures a basic config depending on 'DEBUG' env variable, | |
and also re-configures all existing handlers to output to stderr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class WildcardDict(dict): | |
def __init__(self, *args, enable_wildcards: bool = False, **kwargs) -> None: | |
self._enable_wildcards = enable_wildcards | |
return super().__init__(*args, **kwargs) | |
def __getitem__(self, key): | |
if not self._enable_wildcards: | |
return super().__getitem__(key) | |
for k, v in self.items(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Kudos to: https://stackoverflow.com/a/12867228 | |
def camel_to_snake(value: str) -> str: | |
""" | |
Converts value in camel case to snake case: | |
>>> camel_to_snake("camelCase") | |
'camel_case' | |
>>> camel_to_snake("PascalCase") | |
'pascal_case' | |
>>> camel_to_snake("one1Two2Three") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Setup private pypi - GCP Artifact Registry | |
inputs: | |
central_project: | |
type: string | |
required: true | |
description: GCP project where the Artifact Registry is located | |
central_repo: | |
type: string | |
required: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
repos: | |
- repo: https://github.com/pre-commit/pre-commit-hooks | |
rev: v4.2.0 | |
hooks: | |
- id: check-added-large-files | |
- id: end-of-file-fixer | |
- id: trailing-whitespace | |
- id: detect-private-key | |
- id: no-commit-to-branch | |
- id: check-toml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set -eu | |
# shortcut for getting payload values | |
function export_payload_var() { | |
name="$1" | |
pattern="$2" | |
value=$(jq -r "$pattern" "${PAYLOAD}") | |
if [[ "$value" == "null" ]]; then | |
echo "Could not find pattern '$pattern' in payload '${PAYLOAD}'" | |
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "tag=$tag" | |
echo "FILE_PATH=$FILE_PATH" | |
export LINE_MARK="tag:" | |
sed -i'' -e "0,/$LINE_MARK .*/s//$LINE_MARK $tag/" "$FILE_PATH" # replace first entry |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# TODO: use np.array and dtypes there | |
class _MyIndexer: | |
def __init__(self, obj) -> None: | |
self._obj = obj | |
def __getitem__(self, idx): | |
print('__getitem__', idx, type(idx), isinstance(idx, (list, tuple))) | |
if isinstance(idx, str): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
modified_dirs='["a", "a/b", "b/c/d", "c/d/e.txt"]' | |
modified_dirs=$(echo $modified_files | jq -r '[ .[] | split("/") | .[0] ] | unique') |
NewerOlder