diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bd342edf..98d2165d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -12,7 +12,7 @@ In short, this is how that works. 3. Install development dependencies: ```bash - pip install -r requirements-dev.txt + pip install -e .[dev] ``` 4. Make sure all tests pass: diff --git a/src/compas_xr/ghpython/app_settings.py b/src/compas_xr/ghpython/app_settings.py index 854a6f70..6112d23a 100644 --- a/src/compas_xr/ghpython/app_settings.py +++ b/src/compas_xr/ghpython/app_settings.py @@ -9,9 +9,7 @@ def ToString(self): return str(self) def __str__(self): - return "AppSettings, project_name={}, storage_folder={}, z_to_y_remap={}".format( - self.project_name, self.storage_folder, self.z_to_y_remap - ) + return "AppSettings, project_name={}, storage_folder={}, z_to_y_remap={}".format(self.project_name, self.storage_folder, self.z_to_y_remap) def __data__(self): return { diff --git a/src/compas_xr/ghpython/firebase_config.py b/src/compas_xr/ghpython/firebase_config.py index bd489468..015752d2 100644 --- a/src/compas_xr/ghpython/firebase_config.py +++ b/src/compas_xr/ghpython/firebase_config.py @@ -10,9 +10,7 @@ def ToString(self): return str(self) def __str__(self): - return "FirebaseConfig, api_key={}, auth_domain={}, database_url={}, storage_bucket={}".format( - self.api_key, self.auth_domain, self.database_url, self.storage_bucket - ) + return "FirebaseConfig, api_key={}, auth_domain={}, database_url={}, storage_bucket={}".format(self.api_key, self.auth_domain, self.database_url, self.storage_bucket) def __data__(self): return { diff --git a/src/compas_xr/ghpython/trajectory_manager.py b/src/compas_xr/ghpython/trajectory_manager.py index 0d9c0557..1f3e79b3 100644 --- a/src/compas_xr/ghpython/trajectory_manager.py +++ b/src/compas_xr/ghpython/trajectory_manager.py @@ -1,6 +1,3 @@ -from compas_robots import Configuration - - class TrajectoryResultManager(object): trajectory = None requested_element_id = None @@ -10,9 +7,7 @@ def ToString(self): return str(self) def __str__(self): - return "Planning result for element {} with {} points".format( - self.requested_element_id, len(self.trajectory.points) - ) + return "Planning result for element {} with {} points".format(self.requested_element_id, len(self.trajectory.points)) def format_trajectory(self, trajectory, robot_name): configs_dicts = [] diff --git a/src/compas_xr/mqtt/messages.py b/src/compas_xr/mqtt/messages.py index e9e35fa8..e8b4a2c8 100644 --- a/src/compas_xr/mqtt/messages.py +++ b/src/compas_xr/mqtt/messages.py @@ -103,9 +103,7 @@ class Header(Message): _shared_response_id_counter = None _device_id = None - def __init__( - self, increment_response_ID=False, sequence_id=None, response_id=None, device_id=None, time_stamp=None - ): + def __init__(self, increment_response_ID=False, sequence_id=None, response_id=None, device_id=None, time_stamp=None): super(Header, self).__init__() self["sequence_id"] = sequence_id or self._ensure_sequence_id() self["response_id"] = response_id or self._ensure_response_id(increment_response_ID) diff --git a/src/compas_xr/realtime_database/realtime_database_cli.py b/src/compas_xr/realtime_database/realtime_database_cli.py index d0fe43f3..599b6dc3 100644 --- a/src/compas_xr/realtime_database/realtime_database_cli.py +++ b/src/compas_xr/realtime_database/realtime_database_cli.py @@ -23,10 +23,8 @@ clr.AddReference("LiteDB.dll") clr.AddReference("System.Reactive.dll") -from Firebase.Auth import FirebaseAuthClient -from Firebase.Auth import FirebaseAuthConfig -from Firebase.Database import FirebaseClient -from Firebase.Database.Query import QueryExtensions +from Firebase.Database import FirebaseClient # noqa: E402 +from Firebase.Database.Query import QueryExtensions # noqa: E402 class RealtimeDatabase(RealtimeDatabaseInterface): @@ -96,11 +94,12 @@ def _get_file_from_remote(self, url): It also checks if the data is None or == null (firebase return if no data) """ try: - get = urlopen(url).read() - except: - raise Exception("unable to get file from url {}".format(url)) - if get is not None and get != "null": - return get + file_content = urlopen(url).read() + except Exception as e: + raise Exception("Unable to get file from url {}. Error={}".format(url, str(e))) + + if file_content is not None and file_content != "null": + return file_content else: raise Exception("unable to get file from url {}".format(url)) diff --git a/src/compas_xr/storage/storage_cli.py b/src/compas_xr/storage/storage_cli.py index 8845ff69..afa0c57e 100644 --- a/src/compas_xr/storage/storage_cli.py +++ b/src/compas_xr/storage/storage_cli.py @@ -25,9 +25,7 @@ clr.AddReference("Firebase.dll") clr.AddReference("Firebase.Storage.dll") -from Firebase.Auth import FirebaseAuthClient -from Firebase.Auth import FirebaseAuthConfig -from Firebase.Storage import FirebaseStorage +from Firebase.Storage import FirebaseStorage # noqa: E402 class Storage(StorageInterface): @@ -94,13 +92,12 @@ def _get_file_from_remote(self, url): It also checks if the data is None or == null (firebase return if no data) """ try: - get = urlopen(url).read() + file_content = urlopen(url).read() + except Exception as e: + raise Exception("Unable to get file from url {}. Error={}".format(url, str(e))) - except: - raise Exception("unable to get file from url {}".format(url)) - - if get is not None and get != "null": - return get + if file_content is not None and file_content != "null": + return file_content else: raise Exception("unable to get file from url {}".format(url)) diff --git a/src/compas_xr/storage/storage_pyrebase.py b/src/compas_xr/storage/storage_pyrebase.py index 0a776594..433d7f18 100644 --- a/src/compas_xr/storage/storage_pyrebase.py +++ b/src/compas_xr/storage/storage_pyrebase.py @@ -67,8 +67,8 @@ def _get_file_from_remote(self, url): """ try: file_content = urlopen(url).read().decode() - except: - raise Exception("unable to get file from url {}".format(url)) + except Exception as e: + raise Exception("Unable to get file from url {}. Error={}".format(url, str(e))) if file_content is not None and file_content != "null": return file_content