Reformat with Black

No functional changes.
This commit is contained in:
2021-02-16 11:21:06 +01:00
parent 883f125722
commit 8b49c5505e
27 changed files with 3094 additions and 2288 deletions

View File

@@ -23,28 +23,31 @@ from pillarsdk import exceptions as sdk_exceptions
from .pillar import pillar_call
log = logging.getLogger(__name__)
HOME_PROJECT_ENDPOINT = '/bcloud/home-project'
HOME_PROJECT_ENDPOINT = "/bcloud/home-project"
async def get_home_project(params=None) -> pillarsdk.Project:
"""Returns the home project."""
log.debug('Getting home project')
log.debug("Getting home project")
try:
return await pillar_call(pillarsdk.Project.find_from_endpoint,
HOME_PROJECT_ENDPOINT, params=params)
return await pillar_call(
pillarsdk.Project.find_from_endpoint, HOME_PROJECT_ENDPOINT, params=params
)
except sdk_exceptions.ForbiddenAccess:
log.warning('Access to the home project was denied. '
'Double-check that you are logged in with valid BlenderID credentials.')
log.warning(
"Access to the home project was denied. "
"Double-check that you are logged in with valid BlenderID credentials."
)
raise
except sdk_exceptions.ResourceNotFound:
log.warning('No home project available.')
log.warning("No home project available.")
raise
async def get_home_project_id() -> str:
"""Returns just the ID of the home project."""
home_proj = await get_home_project({'projection': {'_id': 1}})
home_proj_id = home_proj['_id']
home_proj = await get_home_project({"projection": {"_id": 1}})
home_proj_id = home_proj["_id"]
return home_proj_id