Skip to content

build(deps): bump black from 19.10b0 to 20.8b1 #801

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

Merged
merged 5 commits into from
Aug 29, 2020
Merged
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
25 changes: 25 additions & 0 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: black

on: push

jobs:
format:
runs-on: ubuntu-16.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install Black
run: pip install -r linter-requirements.txt

- name: Run Black
run: black tests examples sentry_sdk

- name: Commit changes
run: |
git config --global user.name 'sentry-bot'
git config --global user.email '[email protected]'
git commit -am "fix: Formatting"
git push
2 changes: 1 addition & 1 deletion linter-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
black==19.10b0
black==20.8b1
flake8==3.8.3
flake8-import-order==0.18.1
mypy==0.782
Expand Down
26 changes: 13 additions & 13 deletions sentry_sdk/_functools.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ def update_wrapper(
# type: (Any, Any, Any, Any) -> Any
"""Update a wrapper function to look like the wrapped function

wrapper is the function to be updated
wrapped is the original function
assigned is a tuple naming the attributes assigned directly
from the wrapped function to the wrapper function (defaults to
functools.WRAPPER_ASSIGNMENTS)
updated is a tuple naming the attributes of the wrapper that
are updated with the corresponding attribute from the wrapped
function (defaults to functools.WRAPPER_UPDATES)
wrapper is the function to be updated
wrapped is the original function
assigned is a tuple naming the attributes assigned directly
from the wrapped function to the wrapper function (defaults to
functools.WRAPPER_ASSIGNMENTS)
updated is a tuple naming the attributes of the wrapper that
are updated with the corresponding attribute from the wrapped
function (defaults to functools.WRAPPER_UPDATES)
"""
for attr in assigned:
try:
Expand All @@ -57,10 +57,10 @@ def wraps(wrapped, assigned=WRAPPER_ASSIGNMENTS, updated=WRAPPER_UPDATES):
# type: (Callable[..., Any], Any, Any) -> Callable[[Callable[..., Any]], Callable[..., Any]]
"""Decorator factory to apply update_wrapper() to a wrapper function

Returns a decorator that invokes update_wrapper() with the decorated
function as the wrapper argument and the arguments to wraps() as the
remaining arguments. Default arguments are as for update_wrapper().
This is a convenience function to simplify applying partial() to
update_wrapper().
Returns a decorator that invokes update_wrapper() with the decorated
function as the wrapper argument and the arguments to wraps() as the
remaining arguments. Default arguments are as for update_wrapper().
This is a convenience function to simplify applying partial() to
update_wrapper().
"""
return partial(update_wrapper, wrapped=wrapped, assigned=assigned, updated=updated)
3 changes: 1 addition & 2 deletions sentry_sdk/hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,7 @@ def capture_event(
**scope_args # type: Dict[str, Any]
):
# type: (...) -> Optional[str]
"""Captures an event. Alias of :py:meth:`sentry_sdk.Client.capture_event`.
"""
"""Captures an event. Alias of :py:meth:`sentry_sdk.Client.capture_event`."""
client, top_scope = self._stack[-1]
scope = _update_scope(top_scope, scope, scope_args)
if client is not None:
Expand Down
3 changes: 1 addition & 2 deletions sentry_sdk/integrations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ def _generate_default_integrations_iterator(integrations, auto_enabling_integrat

def iter_default_integrations(with_auto_enabling_integrations):
# type: (bool) -> Iterator[Type[Integration]]
"""Returns an iterator of the default integration classes:
"""
"""Returns an iterator of the default integration classes:"""
from importlib import import_module

if with_auto_enabling_integrations:
Expand Down
3 changes: 2 additions & 1 deletion sentry_sdk/integrations/asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ async def _run_app(self, scope, callback):

if ty in ("http", "websocket"):
transaction = Transaction.continue_from_headers(
dict(scope["headers"]), op="{}.server".format(ty),
dict(scope["headers"]),
op="{}.server".format(ty),
)
else:
transaction = Transaction(op="asgi.server")
Expand Down
12 changes: 8 additions & 4 deletions sentry_sdk/integrations/aws_lambda.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,15 @@ def inner(*args, **kwargs):

return inner # type: ignore

lambda_bootstrap.LambdaRuntimeClient.post_invocation_result = _wrap_post_function(
lambda_bootstrap.LambdaRuntimeClient.post_invocation_result
lambda_bootstrap.LambdaRuntimeClient.post_invocation_result = (
_wrap_post_function(
lambda_bootstrap.LambdaRuntimeClient.post_invocation_result
)
)
lambda_bootstrap.LambdaRuntimeClient.post_invocation_error = _wrap_post_function(
lambda_bootstrap.LambdaRuntimeClient.post_invocation_error
lambda_bootstrap.LambdaRuntimeClient.post_invocation_error = (
_wrap_post_function(
lambda_bootstrap.LambdaRuntimeClient.post_invocation_error
)
)


Expand Down
3 changes: 2 additions & 1 deletion sentry_sdk/integrations/excepthook.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
from types import TracebackType

Excepthook = Callable[
[Type[BaseException], BaseException, TracebackType], Any,
[Type[BaseException], BaseException, TracebackType],
Any,
]


Expand Down
2 changes: 1 addition & 1 deletion sentry_sdk/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ class ServerlessTimeoutWarning(Exception):

class TimeoutThread(threading.Thread):
"""Creates a Thread which runs (sleeps) for a time duration equal to
waiting_time and raises a custom ServerlessTimeout exception.
waiting_time and raises a custom ServerlessTimeout exception.
"""

def __init__(self, waiting_time, configured_timeout):
Expand Down
4 changes: 3 additions & 1 deletion tests/integrations/flask/test_flask.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,9 @@ def test_flask_session_tracking(sentry_init, capture_envelopes, app):
sentry_init(
integrations=[flask_sentry.FlaskIntegration()],
release="demo-release",
_experiments=dict(auto_session_tracking=True,),
_experiments=dict(
auto_session_tracking=True,
),
)

@app.route("/")
Expand Down
6 changes: 4 additions & 2 deletions tests/integrations/gcp/test_gcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,10 @@ def inner(code, timeout="10s", subprocess_kwargs=()):
function_call_response = api_request.execute()

# STEP : Fetch logs of invoked function
log_name = "projects/{}/logs/cloudfunctions.googleapis.com%2Fcloud-functions".format(
project_id
log_name = (
"projects/{}/logs/cloudfunctions.googleapis.com%2Fcloud-functions".format(
project_id
)
)
project_name = "projects/{}".format(project_id)
body = {"resourceNames": [project_name], "filter": log_name}
Expand Down
5 changes: 4 additions & 1 deletion tests/integrations/logging/test_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ def test_logging_stack(sentry_init, capture_events):
logger.error("first", exc_info=True)
logger.error("second")

event_with, event_without, = events
(
event_with,
event_without,
) = events

assert event_with["level"] == "error"
assert event_with["threads"]["values"][0]["stacktrace"]["frames"]
Expand Down
5 changes: 4 additions & 1 deletion tests/integrations/stdlib/test_subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,10 @@ def test_subprocess_basic(

capture_message("hi")

transaction_event, message_event, = events
(
transaction_event,
message_event,
) = events

assert message_event["message"] == "hi"

Expand Down
4 changes: 3 additions & 1 deletion tests/test_transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,9 @@ def test_complex_limits_without_data_category(
dict(dsn="http://foobar@{}/123".format(httpserver.url[len("http://") :]))
)
httpserver.serve_content(
"hm", response_code, headers={"X-Sentry-Rate-Limits": "4711::organization"},
"hm",
response_code,
headers={"X-Sentry-Rate-Limits": "4711::organization"},
)

client.capture_event({"type": "transaction"})
Expand Down
62 changes: 37 additions & 25 deletions tests/utils/test_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,32 +128,44 @@ def test_parse_invalid_dsn(dsn):

@pytest.mark.parametrize("empty", [None, []])
def test_in_app(empty):
assert handle_in_app_impl(
[{"module": "foo"}, {"module": "bar"}],
in_app_include=["foo"],
in_app_exclude=empty,
) == [{"module": "foo", "in_app": True}, {"module": "bar"}]

assert handle_in_app_impl(
[{"module": "foo"}, {"module": "bar"}],
in_app_include=["foo"],
in_app_exclude=["foo"],
) == [{"module": "foo", "in_app": True}, {"module": "bar"}]

assert handle_in_app_impl(
[{"module": "foo"}, {"module": "bar"}],
in_app_include=empty,
in_app_exclude=["foo"],
) == [{"module": "foo", "in_app": False}, {"module": "bar", "in_app": True}]
assert (
handle_in_app_impl(
[{"module": "foo"}, {"module": "bar"}],
in_app_include=["foo"],
in_app_exclude=empty,
)
== [{"module": "foo", "in_app": True}, {"module": "bar"}]
)

assert (
handle_in_app_impl(
[{"module": "foo"}, {"module": "bar"}],
in_app_include=["foo"],
in_app_exclude=["foo"],
)
== [{"module": "foo", "in_app": True}, {"module": "bar"}]
)

assert (
handle_in_app_impl(
[{"module": "foo"}, {"module": "bar"}],
in_app_include=empty,
in_app_exclude=["foo"],
)
== [{"module": "foo", "in_app": False}, {"module": "bar", "in_app": True}]
)


def test_iter_stacktraces():
assert set(
iter_event_stacktraces(
{
"threads": {"values": [{"stacktrace": 1}]},
"stacktrace": 2,
"exception": {"values": [{"stacktrace": 3}]},
}
assert (
set(
iter_event_stacktraces(
{
"threads": {"values": [{"stacktrace": 1}]},
"stacktrace": 2,
"exception": {"values": [{"stacktrace": 3}]},
}
)
)
) == {1, 2, 3}
== {1, 2, 3}
)