Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 18, 2023
1 parent d8c2211 commit 0a26451
Show file tree
Hide file tree
Showing 19 changed files with 9 additions and 24 deletions.
9 changes: 6 additions & 3 deletions neodroid/entry_points/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ def run(self, env_name: str) -> None:
@staticmethod
def fetch(env_name: str) -> Path:
"""
Fetches a remotely stored environment with the specified name to local storage"""
Fetches a remotely stored environment with the specified name to local storage
"""
exe_path = download_environment(
env_name, path_to_executables_directory=DEFAULT_ENVIRONMENTS_PATH
)
Expand All @@ -71,7 +72,8 @@ def fetch(env_name: str) -> Path:

def install(self, env_name: str) -> Path:
"""
Fetches a remotely stored environment with the specified name to local storage"""
Fetches a remotely stored environment with the specified name to local storage
"""
return self.fetch(env_name)

@staticmethod
Expand All @@ -85,7 +87,8 @@ def remove(env_name: str) -> None:

def update(self, env_name: str) -> None:
"""
Updates, fetches environment with the specified name again and replaces the previous version if present"""
Updates, fetches environment with the specified name again and replaces the previous version if present
"""
if os.path.exists(DEFAULT_ENVIRONMENTS_PATH):
self.remove(env_name)
exe_path = self.fetch(env_name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ def _reset(self, resets=None, **kwargs):
return self._resets

def _react(self, reactions=None, **kwargs):

if self._resets and len(self._resets) > 0:
i = 0
for reset in self._resets:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ def __init__(
if self._simulation_instance:
logging.debug(f"successfully started environment {environment_name}")
else:

logging.debug(f"could not start environment {environment_name}")

self._setup_connection()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ def __init__(
num_env: int = cpu_count(),
auto_reset_on_terminal_state=False,
):

self._env = SubProcessEnvironments(
[make_gym_env(environment_name) for _ in range(num_env)],
auto_reset_on_terminal_state=auto_reset_on_terminal_state,
Expand Down Expand Up @@ -84,7 +83,6 @@ def observation_space(self) -> VectorObservationSpace:
:return:"""
ospc = self._env.observation_space
if len(ospc.shape) >= 1:

space = ObservationSpace(
[
Dimension(decimal_granularity=6, min_value=mn, max_value=mx)
Expand All @@ -111,7 +109,6 @@ def action_space(self) -> VectorActionSpace:
:return:"""
aspc = self._env.action_space
if len(self.aspc.shape) >= 1:

space = ActionSpace(
[
Dimension(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ class ContextualBanditEnvironment(object):
""""""

def __init__(self, seed=0):

self.np_random = numpy.random.RandomState()
self.np_random.seed(seed)

Expand Down
1 change: 0 additions & 1 deletion neodroid/messaging/message_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ def __init__(
single_threaded: bool = False,
writer: callable = logging.info,
):

self._tcp_address = tcp_address
self._tcp_port = tcp_port

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ def extract_camera_observation(state, key):


if __name__ == "__main__":

environments = neodroid.connect()
environments.reset()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ def __init__(self, actor_name: str, actuator_name: str, strength: float):
:param actor_name:
:param actuator_name:
:param strength: Strength has a possible direction given by the sign of the float"""
:param strength: Strength has a possible direction given by the sign of the float
"""
self._actor_name = actor_name
self._actuator_name = actuator_name
self._strength = strength
Expand Down
1 change: 0 additions & 1 deletion neodroid/utilities/transformations/quaternion.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ def _axis_angle_to_q(self, theta, v):
self.components = numpy.array([w, x, y, z])

def __mul__(self, b):

if isinstance(b, Quaternion):
return self._multiply_with_quaternion(b)
elif isinstance(b, (list, tuple, numpy.ndarray)):
Expand Down
2 changes: 1 addition & 1 deletion samples/experimental/observation_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def main():
connect_to_running=True
) as env:
with tqdm(env, leave=False) as observation_session:
for (observation, reward, terminated, info) in observation_session:
for observation, reward, terminated, info in observation_session:
frame_i += 1

if not diverged and frame_i != info.frame_number:
Expand Down
1 change: 0 additions & 1 deletion samples/external_agents/mario_rl_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ def asidjas(
num_skips=4,
device=global_torch_device(),
):

######################################################################
# Preprocess Environment
# ------------------------
Expand Down
1 change: 0 additions & 1 deletion samples/generation/dataset/collect_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
if __name__ == "__main__":

def main(generate_num=10):

if generate_num > 0:
with connect_dict() as env:
for i, state in enumerate(env):
Expand Down
1 change: 0 additions & 1 deletion samples/generation/dataset/tf_record_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ def write_tf_record_file(data_tuples, file_name="neodroid_bb_images.tfr"):


if __name__ == "__main__":

generate_num = 10
output_file_name = PROJECT_APP_PATH.user_data / "neodroid_bb_images.tfr"

Expand Down
1 change: 0 additions & 1 deletion samples/generation/web_app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ def assess_input():
@app.route("/assessment", methods=["GET", "POST"])
def upload_and_classify():
if request.method == "POST":

# check if the post request has the file part
if "file" not in request.files:
flash("No file part")
Expand Down
2 changes: 0 additions & 2 deletions samples/gui_client/gui_components/environment_state_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ def __init__(self, **kwargs):
self.assemble_components()

def assemble_components(self):

self.image_row_layout.add_widget(self.rgb_image)
self.image_row_layout.add_widget(self.segmentation_image)
self.image_row_layout.add_widget(self.instance_segmentation_image)
Expand Down Expand Up @@ -89,7 +88,6 @@ def update_segmentation_image(self, segmentation_image_data):

def update_instance_segmentation_image(self, instance_segmentation_image_data):
try:

instance_segmentation_image = CoreImage(
instance_segmentation_image_data, ext="png"
)
Expand Down
1 change: 0 additions & 1 deletion samples/gui_client/gui_components/status_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ def __init__(self, on_connect_callback, **kwargs):
self.assemble_components()

def assemble_components(self):

self.connect_button.bind(on_release=self.on_connect_button)
self.launch_check_box.bind(active=self.on_launch_button)

Expand Down
1 change: 0 additions & 1 deletion samples/gui_client/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ def update_environment_widgets(state):
print("Failed at updating rest of GUI")

try:

GUI.update_normal_image(state.sensor("NormalCamera").value)
GUI.update_motion_image(state.sensor("FlowCamera").value)
GUI.update_depth_image(state.sensor("DepthCamera").value)
Expand Down
1 change: 0 additions & 1 deletion samples/visualisation/histogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
if __name__ == "__main__":

def main(generate_num=10):

if generate_num > 0:
with connect() as env:
for i, state in enumerate(env):
Expand Down
1 change: 0 additions & 1 deletion samples/visualisation/timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
if __name__ == "__main__":

def main(generate_num=10):

if generate_num > 0:
with connect() as env:
for i, state in enumerate(env):
Expand Down

0 comments on commit 0a26451

Please sign in to comment.