This file contains hidden or 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
| #!/usr/bin/env python3 | |
| """ | |
| I attempt to showcase and fix a problem in `urllib.parse.urlunsplit` by fixing it and comparing it to the original. | |
| See `DEMO`, below for results. | |
| TL;DR: It's currently impossible to obtain relative URIs (like `file:selfie.png`) from urlunsplit, but we could fix it. | |
| """ | |
| from urllib.parse import urlsplit, urlunsplit |
This file contains hidden or 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
| diff --git a/gcloud/lib/gcloud_logging_json_to_messages.py b/gcloud/lib/gcloud_logging_json_to_messages.py | |
| index f873758..43d0faf 100755 | |
| --- a/gcloud/lib/gcloud_logging_json_to_messages.py | |
| +++ b/gcloud/lib/gcloud_logging_json_to_messages.py | |
| @@ -173,10 +173,14 @@ def get_rpc_method_names(proto: json.Object) -> str: | |
| except KeyError: | |
| pass | |
| - return ".".join(( | |
| - gcp_json_get(proto, str, "serviceName").replace(".googleapis.com", ""), |
This file contains hidden or 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
| #!/usr/bin/env python3 | |
| from __future__ import annotations | |
| import re | |
| from typing import TYPE_CHECKING | |
| from typing import TypeVar | |
| from lib.json import JSONArray | |
| from lib.json import JSONObject | |
| from lib.json import deepget as json_deepget |
This file contains hidden or 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
| related docs | |
| https://cloud.google.com/functions/docs/bestpractices/retries#configure_the_retry_policy | |
| --- | |
| resource "google_cloudfunctions2_function" "collect_metrics" { | |
| name = "collect_metrics" | |
| location = var.region |
This file contains hidden or 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": "metadata", | |
| "description": "test metadata, from test_metadata.py", | |
| "fields": [ | |
| { | |
| "name": "cwd", | |
| "description": "current working directory", | |
| "type": "STRING", | |
| "mode": "REQUIRED" |
This file contains hidden or 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
| #!/bin/env python3 | |
| # -*- coding: utf-8 -*- | |
| import json | |
| import os | |
| import subprocess | |
| import time | |
| DD_API_BASE = "https://api.datadoghq.com" | |
| DEFAULT_DATADOG_API_KEY = "f964b6d704a81c65acad65ba5c554c9d" | |
| DATADOG_API_KEY = os.getenv("DATADOG_API_KEY") or os.getenv("DD_API_KEY") or DEFAULT_DATADOG_API_KEY |
This file contains hidden or 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
| #!/bin/bash | |
| # | |
| # This file echoes a bunch of color codes to the | |
| # terminal to demonstrate what's available. Each | |
| # line is the color code of one forground color, | |
| # out of 17 (default + 16 escapes), followed by a | |
| # test use of that color on all nine background | |
| # colors (default + 8 escapes). | |
| # |
This file contains hidden or 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
| """Define a 'cap1fd' pytest fixture which captures stdout/stderr combined.""" | |
| from __future__ import annotations | |
| import contextlib | |
| from io import FileIO | |
| # from typing import ContextManager | |
| from typing import Generator | |
| from typing import NamedTuple | |
| from typing import Self |
This file contains hidden or 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
| $ # stealing the command used for is_closed | |
| $ gh pr view https://github.com/getsentry/tacos-gha/pull/77 --json state | |
| { | |
| "state": "OPEN" | |
| } | |
| $ gh pr view https://github.com/getsentry/tacos-gha/pull/77 --json | |
| Specify one or more comma-separated fields for `--json`: | |
| additions | |
| assignees |
This file contains hidden or 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
| """this test passes if you let it run, but fails assert_pwd if you ctrl-c""" | |
| from __future__ import annotations | |
| import contextlib | |
| import typing | |
| from os import chdir, environ, getcwd | |
| from pathlib import Path | |
| from time import sleep | |
| from pytest import fixture |