Restore unnecessarily changed indentation

CURA-7435
This commit is contained in:
Erwan MATHIEU 2025-02-21 08:05:27 +01:00
parent 7a5657ca98
commit fedf5a4794
8 changed files with 52 additions and 70 deletions

View File

@ -428,15 +428,13 @@ class CuraConan(ConanFile):
package_folder = self.dependencies[data['package']].package_folder package_folder = self.dependencies[data['package']].package_folder
if package_folder is None: if package_folder is None:
raise ConanException( raise ConanException(f"Unable to find package_folder for {data['package']}, check that it has not been skipped")
f"Unable to find package_folder for {data['package']}, check that it has not been skipped")
src_path = os.path.join(self.dependencies[data["package"]].package_folder, data["src"]) src_path = os.path.join(self.dependencies[data["package"]].package_folder, data["src"])
elif "root" in data: # get the paths relative from the install folder elif "root" in data: # get the paths relative from the install folder
src_path = os.path.join(self.install_folder, data["root"], data["src"]) src_path = os.path.join(self.install_folder, data["root"], data["src"])
else: else:
raise ConanException( raise ConanException("Misformatted conan data for pyinstaller datas, expected either package or root option")
"Misformatted conan data for pyinstaller datas, expected either package or root option")
if not Path(src_path).exists(): if not Path(src_path).exists():
raise ConanException(f"Missing folder {src_path} for pyinstaller data {data}") raise ConanException(f"Missing folder {src_path} for pyinstaller data {data}")
@ -452,8 +450,7 @@ class CuraConan(ConanFile):
if self.settings.os == "Windows": if self.settings.os == "Windows":
src_path = src_path.replace("\\", "\\\\") src_path = src_path.replace("\\", "\\\\")
else: else:
raise ConanException( raise ConanException("Misformatted conan data for pyinstaller binaries, expected either package or root option")
"Misformatted conan data for pyinstaller binaries, expected either package or root option")
if not Path(src_path).exists(): if not Path(src_path).exists():
raise ConanException(f"Missing folder {src_path} for pyinstaller binary {binary}") raise ConanException(f"Missing folder {src_path} for pyinstaller binary {binary}")
@ -486,8 +483,7 @@ class CuraConan(ConanFile):
# filter all binary files in binaries on the blacklist # filter all binary files in binaries on the blacklist
blacklist = pyinstaller_metadata["blacklist"] blacklist = pyinstaller_metadata["blacklist"]
filtered_binaries = [b for b in binaries if filtered_binaries = [b for b in binaries if not any([all([(part in b[0].lower()) for part in parts]) for parts in blacklist])]
not any([all([(part in b[0].lower()) for part in parts]) for parts in blacklist])]
# In case the installer isn't actually pyinstaller (Windows at the moment), outright remove the offending files: # In case the installer isn't actually pyinstaller (Windows at the moment), outright remove the offending files:
specifically_delete = set(binaries) - set(filtered_binaries) specifically_delete = set(binaries) - set(filtered_binaries)
@ -539,8 +535,7 @@ class CuraConan(ConanFile):
copy(self, "cura_app.py", self.recipe_folder, self.export_sources_folder) copy(self, "cura_app.py", self.recipe_folder, self.export_sources_folder)
def validate(self): def validate(self):
if self.options.i18n_extract and self.settings.os == "Windows" and not self.conf.get( if self.options.i18n_extract and self.settings.os == "Windows" and not self.conf.get("tools.microsoft.bash:path", check_type=str):
"tools.microsoft.bash:path", check_type=str):
raise ConanInvalidConfiguration("Unable to extract translations on Windows without Bash installed") raise ConanInvalidConfiguration("Unable to extract translations on Windows without Bash installed")
def requirements(self): def requirements(self):

View File

@ -266,11 +266,9 @@ class BuildVolume(SceneNode):
renderer.queueNode(self, mode = RenderBatch.RenderMode.Lines) renderer.queueNode(self, mode = RenderBatch.RenderMode.Lines)
renderer.queueNode(self, mesh = self._origin_mesh, backface_cull = True) renderer.queueNode(self, mesh = self._origin_mesh, backface_cull = True)
renderer.queueNode(self, mesh=self._grid_mesh, shader=self._grid_shader, backface_cull=True, transparent=True, renderer.queueNode(self, mesh=self._grid_mesh, shader=self._grid_shader, backface_cull=True, transparent=True, sort=-10)
sort=-10)
if self._disallowed_area_mesh: if self._disallowed_area_mesh:
renderer.queueNode(self, mesh=self._disallowed_area_mesh, shader=self._shader, transparent=True, renderer.queueNode(self, mesh=self._disallowed_area_mesh, shader=self._shader, transparent=True, backface_cull=True, sort=-5)
backface_cull=True, sort=-5)
if self._error_mesh: if self._error_mesh:
renderer.queueNode(self, mesh=self._error_mesh, shader=self._shader, transparent=True, renderer.queueNode(self, mesh=self._error_mesh, shader=self._shader, transparent=True,

View File

@ -78,8 +78,7 @@ if __name__ == "__main__":
parser = argparse.ArgumentParser(description = "Create Windows exe installer of Cura.") parser = argparse.ArgumentParser(description = "Create Windows exe installer of Cura.")
parser.add_argument("--source_path", type=str, help="Path to Conan install Cura folder.") parser.add_argument("--source_path", type=str, help="Path to Conan install Cura folder.")
parser.add_argument("--dist_path", type=str, help="Path to Pyinstaller dist folder") parser.add_argument("--dist_path", type=str, help="Path to Pyinstaller dist folder")
parser.add_argument("--filename", type=str, parser.add_argument("--filename", type=str, help="Filename of the exe (e.g. 'UltiMaker-Cura-5.1.0-beta-Windows-X64.exe')")
help="Filename of the exe (e.g. 'UltiMaker-Cura-5.1.0-beta-Windows-X64.exe')")
parser.add_argument("--version", type=str, help="The full cura version, e.g. 5.9.0-beta.1+24132") parser.add_argument("--version", type=str, help="The full cura version, e.g. 5.9.0-beta.1+24132")
args = parser.parse_args() args = parser.parse_args()
generate_nsi(args.source_path, args.dist_path, args.filename, args.version) generate_nsi(args.source_path, args.dist_path, args.filename, args.version)

View File

@ -196,8 +196,7 @@ class DigitalFactoryApiClient:
url = "{}/projects/{}/files".format(self.CURA_API_ROOT, library_project_id) url = "{}/projects/{}/files".format(self.CURA_API_ROOT, library_project_id)
self._http.get(url, self._http.get(url,
scope = self._scope, scope = self._scope,
callback=self._parseCallback(on_finished, DigitalFactoryFileResponse, failed, callback=self._parseCallback(on_finished, DigitalFactoryFileResponse, failed, default_values={'username': ''}),
default_values={'username': ''}),
error_callback = failed, error_callback = failed,
timeout = self.DEFAULT_REQUEST_TIMEOUT) timeout = self.DEFAULT_REQUEST_TIMEOUT)
@ -236,8 +235,7 @@ class DigitalFactoryApiClient:
if status_code >= 300 and on_error is not None: if status_code >= 300 and on_error is not None:
on_error() on_error()
else: else:
self._parseModels(response, on_finished, model, pagination_manager=pagination_manager, self._parseModels(response, on_finished, model, pagination_manager = pagination_manager, default_values = default_values)
default_values=default_values)
self._anti_gc_callbacks.append(parse) self._anti_gc_callbacks.append(parse)
return parse return parse

View File

@ -124,8 +124,7 @@ class SliceInfo(QObject, Extension):
return list(sorted(user_modified_setting_keys)) return list(sorted(user_modified_setting_keys))
def _flattenData(self, data: Any, result: dict, current_flat_key: Optional[str] = None, def _flattenData(self, data: Any, result: dict, current_flat_key: Optional[str] = None, lift_list: bool = False) -> None:
lift_list: bool = False) -> None:
if isinstance(data, dict): if isinstance(data, dict):
for key, value in data.items(): for key, value in data.items():
total_flat_key = key if current_flat_key is None else f"{current_flat_key}_{key}" total_flat_key = key if current_flat_key is None else f"{current_flat_key}_{key}"

View File

@ -84,7 +84,6 @@ def test_cleanAuthService() -> None:
assert authorization_service.getAccessToken() is None assert authorization_service.getAccessToken() is None
def test_refreshAccessTokenSuccess(http_request_manager): def test_refreshAccessTokenSuccess(http_request_manager):
authorization_service = AuthorizationService(OAUTH_SETTINGS, Preferences()) authorization_service = AuthorizationService(OAUTH_SETTINGS, Preferences())
authorization_service.initialize() authorization_service.initialize()
@ -92,15 +91,12 @@ def test_refreshAccessTokenSuccess(http_request_manager):
authorization_service._storeAuthData(SUCCESSFUL_AUTH_RESPONSE) authorization_service._storeAuthData(SUCCESSFUL_AUTH_RESPONSE)
authorization_service.onAuthStateChanged.emit = MagicMock() authorization_service.onAuthStateChanged.emit = MagicMock()
with patch("UM.TaskManagement.HttpRequestManager.HttpRequestManager.getInstance", with patch("UM.TaskManagement.HttpRequestManager.HttpRequestManager.getInstance", MagicMock(return_value=http_request_manager)):
MagicMock(return_value=http_request_manager)):
with patch.object(AuthorizationService, "getUserProfile", return_value=UserProfile()): with patch.object(AuthorizationService, "getUserProfile", return_value=UserProfile()):
with patch.object(AuthorizationHelpers, "getAccessTokenUsingRefreshToken", with patch.object(AuthorizationHelpers, "getAccessTokenUsingRefreshToken", side_effect=lambda refresh_token, callback: callback(SUCCESSFUL_AUTH_RESPONSE)):
side_effect=lambda refresh_token, callback: callback(SUCCESSFUL_AUTH_RESPONSE)):
authorization_service.refreshAccessToken() authorization_service.refreshAccessToken()
authorization_service.onAuthStateChanged.emit.assert_called_once_with(logged_in = True) authorization_service.onAuthStateChanged.emit.assert_called_once_with(logged_in = True)
def test__parseJWTNoRefreshToken(http_request_manager): def test__parseJWTNoRefreshToken(http_request_manager):
""" """
Tests parsing the user profile if there is no refresh token stored, but there is a normal authentication token. Tests parsing the user profile if there is no refresh token stored, but there is a normal authentication token.
@ -113,8 +109,7 @@ def test__parseJWTNoRefreshToken(http_request_manager):
mock_callback = Mock() # To log the final profile response. mock_callback = Mock() # To log the final profile response.
with patch("UM.TaskManagement.HttpRequestManager.HttpRequestManager.getInstance", with patch("UM.TaskManagement.HttpRequestManager.HttpRequestManager.getInstance", MagicMock(return_value=http_request_manager)):
MagicMock(return_value=http_request_manager)):
authorization_service._parseJWT(mock_callback) authorization_service._parseJWT(mock_callback)
mock_callback.assert_called_once() mock_callback.assert_called_once()
profile_reply = mock_callback.call_args_list[0][0][0] profile_reply = mock_callback.call_args_list[0][0][0]
@ -200,10 +195,8 @@ def test_refreshAccessTokenFailed():
http_mock.post = lambda url, data, headers_dict, callback, error_callback, urgent, timeout: callback(mock_reply) http_mock.post = lambda url, data, headers_dict, callback, error_callback, urgent, timeout: callback(mock_reply)
with patch("UM.TaskManagement.HttpRequestManager.HttpRequestManager.readJSON", Mock(return_value = {"error_description": "Mock a failed request!"})): with patch("UM.TaskManagement.HttpRequestManager.HttpRequestManager.readJSON", Mock(return_value = {"error_description": "Mock a failed request!"})):
with patch("UM.TaskManagement.HttpRequestManager.HttpRequestManager.getInstance", MagicMock(return_value = http_mock)): with patch("UM.TaskManagement.HttpRequestManager.HttpRequestManager.getInstance", MagicMock(return_value = http_mock)): authorization_service._storeAuthData(SUCCESSFUL_AUTH_RESPONSE)
authorization_service._storeAuthData(SUCCESSFUL_AUTH_RESPONSE) with patch("cura.OAuth2.AuthorizationHelpers.AuthorizationHelpers.getAccessTokenUsingRefreshToken", side_effect=lambda refresh_token, callback: callback(FAILED_AUTH_RESPONSE)):
with patch("cura.OAuth2.AuthorizationHelpers.AuthorizationHelpers.getAccessTokenUsingRefreshToken",
side_effect=lambda refresh_token, callback: callback(FAILED_AUTH_RESPONSE)):
authorization_service.refreshAccessToken() authorization_service.refreshAccessToken()
authorization_service.onAuthStateChanged.emit.assert_called_with(logged_in = False) authorization_service.onAuthStateChanged.emit.assert_called_with(logged_in = False)