notify-api-412 use black to enforce python style standards

This commit is contained in:
Kenneth Kehl
2023-08-23 10:35:43 -07:00
parent a7898118d7
commit 026dc14021
586 changed files with 33990 additions and 23461 deletions

View File

@@ -17,34 +17,34 @@ def create_service_authorization_header(service_id, key_type=KEY_TYPE_NORMAL):
else:
service = dao_fetch_service_by_id(service_id)
data = {
'service': service,
'name': uuid.uuid4(),
'created_by': service.created_by,
'key_type': key_type
"service": service,
"name": uuid.uuid4(),
"created_by": service.created_by,
"key_type": key_type,
}
api_key = ApiKey(**data)
save_model_api_key(api_key)
secret = api_key.secret
token = create_jwt_token(secret=secret, client_id=client_id)
return 'Authorization', 'Bearer {}'.format(token)
return "Authorization", "Bearer {}".format(token)
def create_admin_authorization_header():
client_id = current_app.config['ADMIN_CLIENT_ID']
client_id = current_app.config["ADMIN_CLIENT_ID"]
return create_internal_authorization_header(client_id)
def create_internal_authorization_header(client_id):
secret = current_app.config['INTERNAL_CLIENT_API_KEYS'][client_id][0]
secret = current_app.config["INTERNAL_CLIENT_API_KEYS"][client_id][0]
token = create_jwt_token(secret=secret, client_id=client_id)
return 'Authorization', 'Bearer {}'.format(token)
return "Authorization", "Bearer {}".format(token)
def unwrap_function(fn):
"""
Given a function, returns its undecorated original.
"""
while hasattr(fn, '__wrapped__'):
while hasattr(fn, "__wrapped__"):
fn = fn.__wrapped__
return fn