Skip to content

Commit

Permalink
Updates to black settings, new dev install, etc
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzalocasas committed Jun 23, 2024
1 parent 2d8e451 commit 23ae97c
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 36 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 1 addition & 3 deletions src/compas_xr/ghpython/app_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 1 addition & 3 deletions src/compas_xr/ghpython/firebase_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
7 changes: 1 addition & 6 deletions src/compas_xr/ghpython/trajectory_manager.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
from compas_robots import Configuration


class TrajectoryResultManager(object):
trajectory = None
requested_element_id = None
Expand All @@ -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 = []
Expand Down
4 changes: 1 addition & 3 deletions src/compas_xr/mqtt/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
17 changes: 8 additions & 9 deletions src/compas_xr/realtime_database/realtime_database_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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))

Expand Down
15 changes: 6 additions & 9 deletions src/compas_xr/storage/storage_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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))
Expand Down
4 changes: 2 additions & 2 deletions src/compas_xr/storage/storage_pyrebase.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 23ae97c

Please sign in to comment.