Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump black from 21.10b0 to 24.4.2 #902

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion baseplate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def from_upstream(
raise ValueError("invalid sampled value")

if flags is not None:
if not 0 <= flags < 2 ** 64:
if not 0 <= flags < 2**64:
raise ValueError("invalid flags value")

return cls(trace_id, parent_id, span_id, sampled, flags)
Expand Down
1 change: 1 addition & 0 deletions baseplate/clients/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
trace information is passed on and metrics are collected automatically.

"""

from typing import Any
from typing import TYPE_CHECKING

Expand Down
14 changes: 8 additions & 6 deletions baseplate/clients/cassandra.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,14 +364,16 @@ def execute_async(
**kwargs: Any,
) -> ResponseFuture:
prom_labels = CassandraPrometheusLabels(
cassandra_client_name=self.prometheus_client_name
if self.prometheus_client_name is not None
else self.context_name,
cassandra_client_name=(
self.prometheus_client_name
if self.prometheus_client_name is not None
else self.context_name
),
cassandra_keyspace=self.session.keyspace,
cassandra_query_name=query_name if query_name is not None else "",
cassandra_cluster_name=self.prometheus_cluster_name
if self.prometheus_cluster_name is not None
else "",
cassandra_cluster_name=(
self.prometheus_cluster_name if self.prometheus_cluster_name is not None else ""
),
)

REQUEST_ACTIVE.labels(**prom_labels._asdict()).inc()
Expand Down
1 change: 1 addition & 0 deletions baseplate/clients/memcache/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
should use pickle_and_compress() and decompress_and_unpickle().

"""

import json
import logging
import pickle
Expand Down
1 change: 1 addition & 0 deletions baseplate/lib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Internal library helpers."""

import functools
import inspect
import warnings
Expand Down
1 change: 1 addition & 0 deletions baseplate/lib/_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
This stuff is not stable yet, so it's only for baseplate-internal use.

"""

import socket
import urllib.parse

Expand Down
3 changes: 1 addition & 2 deletions baseplate/lib/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,7 @@ def __init__(self) -> None:
super().__init__()
self.__dict__ = self

def __getattr__(self, name: str) -> Any:
...
def __getattr__(self, name: str) -> Any: ...


ConfigSpecItem = Union["Parser", Dict[str, Any], Callable[[str], T]]
Expand Down
1 change: 1 addition & 0 deletions baseplate/lib/crypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@


"""

import base64
import binascii
import datetime
Expand Down
1 change: 1 addition & 0 deletions baseplate/lib/datetime.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Extensions to the standard library `datetime` module."""

from datetime import datetime
from datetime import timezone

Expand Down
1 change: 1 addition & 0 deletions baseplate/lib/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
by a separate daemon.

"""

import logging

from typing import Any
Expand Down
1 change: 1 addition & 0 deletions baseplate/lib/file_watcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
would change whenever the underlying file changes.

"""

import logging
import os
import typing
Expand Down
1 change: 1 addition & 0 deletions baseplate/lib/live_data/writer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Write a file's contents to a node in ZooKeeper."""

import argparse
import configparser
import difflib
Expand Down
1 change: 1 addition & 0 deletions baseplate/lib/live_data/zookeeper.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Helpers for interacting with ZooKeeper."""

from typing import Optional

from kazoo.client import KazooClient
Expand Down
1 change: 1 addition & 0 deletions baseplate/lib/message_queue.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A Gevent-friendly POSIX message queue."""

import select

from typing import Optional
Expand Down
1 change: 1 addition & 0 deletions baseplate/lib/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
.. _StatsD: https://github.com/statsd/statsd

"""

import collections
import errno
import logging
Expand Down
2 changes: 1 addition & 1 deletion baseplate/lib/prometheus_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
default_size_factor = 2
default_size_count = 20
default_size_buckets = [
default_size_start * default_size_factor ** i for i in range(default_size_count)
default_size_start * default_size_factor**i for i in range(default_size_count)
]


Expand Down
1 change: 1 addition & 0 deletions baseplate/lib/random.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Extensions to the standard library `random` module."""

import bisect
import random
import typing
Expand Down
1 change: 1 addition & 0 deletions baseplate/lib/retry.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Policies for retrying an operation safely."""

import time

from typing import Iterator
Expand Down
4 changes: 2 additions & 2 deletions baseplate/lib/secrets.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Application integration with the secret fetcher daemon."""

import base64
import binascii
import json
Expand Down Expand Up @@ -121,8 +122,7 @@ def _decode_secret(path: str, encoding: str, value: str) -> bytes:


class SecretParser(Protocol):
def __call__(self, data: Dict[str, Any], secret_path: str = "") -> Dict[str, str]:
...
def __call__(self, data: Dict[str, Any], secret_path: str = "") -> Dict[str, str]: ...


def parse_secrets_fetcher(data: Dict[str, Any], secret_path: str = "") -> Dict[str, str]:
Expand Down
1 change: 1 addition & 0 deletions baseplate/lib/service_discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
print(backend.endpoint.address)

"""

import json

from typing import IO
Expand Down
1 change: 1 addition & 0 deletions baseplate/lib/thrift_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
client.do_example_thing()

"""

import contextlib
import logging
import queue
Expand Down
1 change: 1 addition & 0 deletions baseplate/observers/tracing.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Components for processing Baseplate spans for service request tracing."""

import collections
import json
import logging
Expand Down
1 change: 1 addition & 0 deletions baseplate/server/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

This command serves your application from the given configuration file.
"""

from __future__ import annotations

import argparse
Expand Down
1 change: 1 addition & 0 deletions baseplate/server/einhorn.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Client library for children of Einhorn."""

import contextlib
import json
import os
Expand Down
1 change: 1 addition & 0 deletions baseplate/server/healthcheck.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Check health of a baseplate service on localhost."""

import argparse
import socket
import sys
Expand Down
1 change: 1 addition & 0 deletions baseplate/server/prometheus.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
can aggregate and serve metrics for all workers.

"""

import atexit
import logging
import os
Expand Down
1 change: 1 addition & 0 deletions baseplate/server/reloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
settings.

"""

import logging
import os
import re
Expand Down
6 changes: 3 additions & 3 deletions baseplate/sidecars/event_publisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ def __init__(self, metrics_client: metrics.Client, cfg: Any):
self.key_name = cfg.key.name
self.key_secret = cfg.key.secret
self.session = requests.Session()
self.session.headers[
"User-Agent"
] = f"baseplate.py-{self.__class__.__name__}/{baseplate_version}"
self.session.headers["User-Agent"] = (
f"baseplate.py-{self.__class__.__name__}/{baseplate_version}"
)

def _sign_payload(self, payload: bytes) -> str:
digest = hmac.new(self.key_secret, payload, hashlib.sha256).hexdigest()
Expand Down
1 change: 1 addition & 0 deletions baseplate/sidecars/live_data_watcher.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Watch nodes in ZooKeeper and sync their contents to disk on change."""

import argparse
import configparser
import json
Expand Down
7 changes: 4 additions & 3 deletions baseplate/sidecars/secrets_fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
write to a new file in whatever format needed, and restart other services if necessary.

"""

import argparse
import configparser
import datetime
Expand Down Expand Up @@ -155,9 +156,9 @@ def __init__(self, base_url: str, role: str, auth_type: Authenticator, mount_poi
self.auth_type = auth_type
self.mount_point = mount_point
self.session = requests.Session()
self.session.headers[
"User-Agent"
] = f"baseplate.py-{self.__class__.__name__}/{baseplate_version}"
self.session.headers["User-Agent"] = (
f"baseplate.py-{self.__class__.__name__}/{baseplate_version}"
)
self.client: Optional["VaultClient"] = None

def _make_client(self) -> "VaultClient":
Expand Down
6 changes: 3 additions & 3 deletions baseplate/sidecars/trace_publisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ def __init__(
adapter = requests.adapters.HTTPAdapter(pool_connections=num_conns, pool_maxsize=num_conns)
parsed_url = urllib.parse.urlparse(zipkin_api_url)
self.session = requests.Session()
self.session.headers[
"User-Agent"
] = f"baseplate.py-{self.__class__.__name__}/{baseplate_version}"
self.session.headers["User-Agent"] = (
f"baseplate.py-{self.__class__.__name__}/{baseplate_version}"
)
self.session.mount(f"{parsed_url.scheme}://", adapter)
self.endpoint = f"{zipkin_api_url}/spans"
self.metrics = metrics_client
Expand Down
1 change: 1 addition & 0 deletions docs/tutorial/chapter3/helloworld.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from baseplate import Baseplate
from baseplate.frameworks.pyramid import BaseplateConfigurator

from pyramid.config import Configurator
from pyramid.view import view_config

Expand Down
1 change: 1 addition & 0 deletions docs/tutorial/chapter4/helloworld.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from baseplate import Baseplate
from baseplate.clients.sqlalchemy import SQLAlchemySession
from baseplate.frameworks.pyramid import BaseplateConfigurator

from pyramid.config import Configurator
from pyramid.view import view_config

Expand Down
Loading
Loading