Cleanup: add-on, reformat with black

No functional changes.
This commit is contained in:
Sybren A. Stüvel 2022-10-20 13:14:51 +02:00
parent 32a3e48e24
commit 074c60df9d
6 changed files with 11 additions and 5 deletions

View File

@ -506,6 +506,7 @@ def _root_path() -> PurePath:
return PureWindowsPath("X:/")
return PurePosixPath("/")
def _root_path_strip(path: PurePath) -> PurePosixPath:
"""Strip off the leading / (POSIX) and drive letter (Windows).

View File

@ -3,5 +3,6 @@ from .. import wheels
# Load all the submodules we need from BAT in one go.
_bat_modules = wheels.load_wheel(
"blender_asset_tracer",
("blendfile", "pack", "pack.progress", "pack.transfer", "pack.shaman", "bpathlib"))
("blendfile", "pack", "pack.progress", "pack.transfer", "pack.shaman", "bpathlib"),
)
bat_toplevel, blendfile, pack, progress, transfer, shaman, bpathlib = _bat_modules

View File

@ -128,7 +128,8 @@ def ping_manager(
try:
version: FlamencoVersion = meta_api.get_version()
storage: SharedStorageLocation = meta_api.get_shared_storage(
"users", platform.system().lower())
"users", platform.system().lower()
)
except ApiException as ex:
error = "Manager cannot be reached: %s" % ex
except MaxRetryError as ex:

View File

@ -30,6 +30,7 @@ BLENDFILE_SETTING_KEY = "blendfile"
log = logging.getLogger(__name__)
def job_for_scene(scene: bpy.types.Scene) -> Optional[_SubmittedJob]:
from flamenco.manager.models import SubmittedJob, JobMetadata

View File

@ -596,5 +596,5 @@ def parse_api_error(api_client: _ApiClient, ex: _ApiException) -> _Error:
response = MockResponse()
response.data = ex.body
error: _Error = api_client.deserialize(response, (Error, ), True)
error: _Error = api_client.deserialize(response, (Error,), True)
return error

View File

@ -13,6 +13,7 @@ from typing import Iterator, Iterable
_my_dir = Path(__file__).parent
_log = logging.getLogger(__name__)
def load_wheel(module_name: str, submodules: Iterable[str]) -> list[ModuleType]:
"""Loads modules from a wheel file 'module_name*.whl'.
@ -46,8 +47,9 @@ def load_wheel(module_name: str, submodules: Iterable[str]) -> list[ModuleType]:
loaded_modules.append(module)
_log.info("Loaded %s from %s", modname, module.__file__)
assert len(loaded_modules) == len(to_load), \
f"expecting to load {len(to_load)} modules, but only have {len(loaded_modules)}: {loaded_modules}"
assert len(loaded_modules) == len(
to_load
), f"expecting to load {len(to_load)} modules, but only have {len(loaded_modules)}: {loaded_modules}"
return loaded_modules