Skip to content

Commit 20d7879

Browse files
authored
chore: update black (#58)
* Update Black dev dependency There is a bug in 19.3b0 which may cause problems locally. psf/black#875 * Update CHANGELOG * Update PR number in CHANGELOG * Reformat after updating black.
1 parent 4afd64d commit 20d7879

File tree

6 files changed

+19
-21
lines changed

6 files changed

+19
-21
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Versioning](https://semver.org/spec/v2.0.0.html).
1717
- [PR 53](https://github.com/salesforce/django-declarative-apis/pull/53) Update dev dependencies: flake8, bandit, ipython
1818
- [PR 54](https://github.com/salesforce/django-declarative-apis/pull/54) Remove unneeded `mock` dependency
1919
- [PR 56](https://github.com/salesforce/django-declarative-apis/pull/56) Add Python 3.8 and 3.9 to Travis CI testing
20+
- [PR 58](https://github.com/salesforce/django-declarative-apis/pull/58) Update black dev dependency
2021

2122
# [0.22.2] - 2020-08-11
2223
### Fixed

django_declarative_apis/authentication/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
class AuthenticatorHint(typing.NamedTuple):
13-
""" Tuple to provide hints for authentication implementations
13+
"""Tuple to provide hints for authentication implementations
1414
1515
header_hint: A string used to match the `Authentication: ` header.
1616
"""
@@ -25,7 +25,7 @@ def is_authenticated(self, request):
2525

2626
@abc.abstractmethod
2727
def challenge(self, error):
28-
""" Results in the challenge response sent to the user
28+
"""Results in the challenge response sent to the user
2929
3030
This should result in a django.http.HttpResponse that should include information through the
3131
WWW-Authenticate header around expectations.
@@ -61,7 +61,7 @@ def __bool__(self):
6161

6262

6363
def validate_authentication_config(config):
64-
""" Validate the computed configuration of authentication handlers
64+
"""Validate the computed configuration of authentication handlers
6565
6666
The schema for the config is:
6767

django_declarative_apis/authentication/oauthlib/endpoint.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,10 @@ def validate_request(self, uri, http_method="GET", body=None, headers=None):
8989
base_signing_string = signature.construct_base_string(
9090
request.http_method, uri, norm_params
9191
) # TOOPHER
92-
self.validation_error_message = "Invalid signature. Expected signature base string: {0}".format(
93-
base_signing_string
92+
self.validation_error_message = (
93+
"Invalid signature. Expected signature base string: {0}".format(
94+
base_signing_string
95+
)
9496
) # TOOPHER
9597
return v, request
9698

django_declarative_apis/machinery/__init__.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ class EndpointDefinitionMixin(metaclass=EndpointDefinitionMeta):
373373
class BaseEndpointDefinition(metaclass=EndpointDefinitionMeta):
374374
@abc.abstractmethod
375375
def is_authorized(self):
376-
""" Authorization check. Should be overridden by endpoint definition implementations.
376+
"""Authorization check. Should be overridden by endpoint definition implementations.
377377
378378
Returns:
379379
``bool``: Whether or not the user should be able to access the resource. Defaults to ``False``.
@@ -417,7 +417,7 @@ def http_status(self):
417417
@property
418418
@abc.abstractmethod
419419
def resource(self):
420-
""" The instance of a resource. Should either be a ``dict`` or instance of a Django Model or QuerySet.
420+
"""The instance of a resource. Should either be a ``dict`` or instance of a Django Model or QuerySet.
421421
422422
This property *must* be implemented by all endpoint definitions.
423423
"""
@@ -514,7 +514,7 @@ def get_adhoc_queries(cls):
514514

515515

516516
class EndpointDefinition(BaseEndpointDefinition):
517-
""" A base class to be used when defining endpoints.
517+
"""A base class to be used when defining endpoints.
518518
519519
Base class to be used implementing endpoints that aren't necessarily tied to a model. Also implements
520520
basic consumer-based authentication.
@@ -527,7 +527,7 @@ class EndpointDefinition(BaseEndpointDefinition):
527527
"""
528528

529529
def is_permitted(self):
530-
""" Checks authorization for the current consumer.
530+
"""Checks authorization for the current consumer.
531531
532532
Returns:
533533
``bool``: Whether or not the user has permission to the resource.
@@ -581,8 +581,7 @@ def http_status(self):
581581

582582

583583
class ResourceEndpointDefinition(EndpointDefinition):
584-
""" A base class to be used when defining endpoints bound to models.
585-
"""
584+
"""A base class to be used when defining endpoints bound to models."""
586585

587586
consumer = RequestAttribute()
588587

@@ -603,7 +602,7 @@ def __init__(self, *args, **kwargs):
603602

604603
@property
605604
def resource(self):
606-
""" Resource implementation
605+
"""Resource implementation
607606
608607
Queries the object manager of `self.resource_model` for the given id (`self.resource_id`).
609608
"""

example/myapp/resources.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414

1515

1616
class MeResourceMixin:
17-
"""Resource mixin for create and get endpoints
18-
"""
17+
"""Resource mixin for create and get endpoints"""
1918

2019
@machinery.endpoint_resource(
2120
type=models.OauthConsumer,
@@ -66,20 +65,17 @@ def save(self):
6665

6766

6867
class PingDefinition(machinery.BaseEndpointDefinition):
69-
"""A basic "ping" endpoint
70-
"""
68+
"""A basic "ping" endpoint"""
7169

7270
# filter definition for the resource. values will be masked by default (i.e. without this, the user would get
7371
# '{"ping": null}' in the response body.
7472
response_filter = {str: filtering.ALWAYS}
7573

7674
def is_authorized(self):
77-
"""User should always be authorized
78-
"""
75+
"""User should always be authorized"""
7976
return True
8077

8178
@property
8279
def resource(self):
83-
"""The endpoint resource
84-
"""
80+
"""The endpoint resource"""
8581
return {"ping": "pong"}

requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
bandit~=1.7
2-
black==19.3b0
2+
black==21.5b1
33
bumpversion~=0.5
44
coverage~=5.0
55
flake8~=3.9.0

0 commit comments

Comments
 (0)