diff --git a/.circleci/config.yml b/.circleci/config.yml index 37eb049b03..82f5fdeded 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -327,7 +327,7 @@ jobs: machine: # Available images: # https://circleci.com/docs/2.0/configuration-reference/#available-linux-gpu-images - image: ubuntu-1604:202104-01 + image: ubuntu-2004:202201-02 resource_class: xlarge steps: - checkout: @@ -340,7 +340,7 @@ jobs: name: Install clang-tidy command: | # Bellow is only needed for Ubuntu 20 - # sudo apt-key adv --fetch-keys "https://apt.llvm.org/llvm-snapshot.gpg.key" + sudo apt-key adv --fetch-keys "https://apt.llvm.org/llvm-snapshot.gpg.key" sudo add-apt-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-12 main" sudo apt-get update -y || true sudo apt-get install -y clang-tidy-12 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b06c5ff48e..fd3a07462d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -75,7 +75,7 @@ repos: additional_dependencies: &flake8_dependencies - flake8-bugbear==22.1.11 - flake8-builtins==1.5.3 - - flake8-comprehensions==3.8.0 + - flake8-comprehensions==3.10.0 - flake8-return==1.1.3 - flake8-simplify==0.17.0 diff --git a/conda-build/common/delete_old_night_packages.py b/conda-build/common/delete_old_night_packages.py index 67069b2359..9e90743739 100644 --- a/conda-build/common/delete_old_night_packages.py +++ b/conda-build/common/delete_old_night_packages.py @@ -40,15 +40,14 @@ ) # Using len(versions) - MAX_NUMBER_OF_VERSIONS to support MAX_NUMBER_OF_VERSIONS == 0 remove_versions = versions[: len(versions) - MAX_NUMBER_OF_VERSIONS] -print( - f"anaconda remove {' '.join(list(map(lambda x: f'aihabitat-nightly/habitat-sim/{x}', remove_versions)))}" -) +remove_versions_list = [f"aihabitat-nightly/habitat-sim/{x}" for x in remove_versions] +print(f"anaconda remove {' '.join(remove_versions_list)}") result_remove = subprocess.run( [ "anaconda", "remove", "-f", - *list(map(lambda x: f"aihabitat-nightly/habitat-sim/{x}", remove_versions)), + *remove_versions_list, ], stderr=subprocess.PIPE, stdout=subprocess.PIPE, diff --git a/src_python/habitat_sim/nav/greedy_geodesic_follower.py b/src_python/habitat_sim/nav/greedy_geodesic_follower.py index 815ad0a5aa..2d4b2d4e54 100644 --- a/src_python/habitat_sim/nav/greedy_geodesic_follower.py +++ b/src_python/habitat_sim/nav/greedy_geodesic_follower.py @@ -188,7 +188,7 @@ def find_path(self, goal_pos: np.ndarray) -> List[Any]: if len(path) == 0: raise errors.GreedyFollowerError() - path = list(map(lambda v: self.action_mapping[v], path)) + path = [self.action_mapping[v] for v in path] return path diff --git a/src_python/habitat_sim/robots/mobile_manipulator.py b/src_python/habitat_sim/robots/mobile_manipulator.py index d9670c493a..84b282ae8b 100644 --- a/src_python/habitat_sim/robots/mobile_manipulator.py +++ b/src_python/habitat_sim/robots/mobile_manipulator.py @@ -274,15 +274,17 @@ def reset(self) -> None: @property def arm_joint_limits(self) -> Tuple[np.ndarray, np.ndarray]: """Get the arm joint limits in radians""" - arm_pos_indices = list( - map(lambda x: self.joint_pos_indices[x], self.params.arm_joints) - ) + # deref self vars to cut access in half + joint_pos_indices = self.joint_pos_indices + lower_joints_limits, upper_joint_limits = self.joint_limits + arm_joints = self.params.arm_joints + arm_pos_indices = [joint_pos_indices[x] for x in arm_joints] lower_lims = np.array( - [self.joint_limits[0][i] for i in arm_pos_indices], dtype=np.float32 + [lower_joints_limits[i] for i in arm_pos_indices], dtype=np.float32 ) upper_lims = np.array( - [self.joint_limits[1][i] for i in arm_pos_indices], dtype=np.float32 + [upper_joint_limits[i] for i in arm_pos_indices], dtype=np.float32 ) return lower_lims, upper_lims @@ -327,11 +329,15 @@ def ee_transform(self) -> mn.Matrix4: @property def gripper_joint_pos(self) -> np.ndarray: """Get the current gripper joint positions.""" - gripper_pos_indices = map( - lambda x: self.joint_pos_indices[x], self.params.gripper_joints - ) + + # deref self vars to cut access in half + joint_pos_indices = self.joint_pos_indices + gripper_joints = self.params.gripper_joints + sim_obj_joint_pos = self.sim_obj.joint_positions + + gripper_pos_indices = (joint_pos_indices[x] for x in gripper_joints) return np.array( - [self.sim_obj.joint_positions[i] for i in gripper_pos_indices], + [sim_obj_joint_pos[i] for i in gripper_pos_indices], dtype=np.float32, ) @@ -388,11 +394,15 @@ def is_gripper_closed(self) -> bool: @property def arm_joint_pos(self) -> np.ndarray: """Get the current arm joint positions.""" - arm_pos_indices = map( - lambda x: self.joint_pos_indices[x], self.params.arm_joints - ) + + # deref self vars to cut access in half + joint_pos_indices = self.joint_pos_indices + arm_joints = self.params.arm_joints + sim_obj_joint_pos = self.sim_obj.joint_positions + + arm_pos_indices = (joint_pos_indices[x] for x in arm_joints) return np.array( - [self.sim_obj.joint_positions[i] for i in arm_pos_indices], dtype=np.float32 + [sim_obj_joint_pos[i] for i in arm_pos_indices], dtype=np.float32 ) @arm_joint_pos.setter @@ -429,11 +439,15 @@ def set_fixed_arm_joint_pos(self, fix_arm_joint_pos): @property def arm_velocity(self) -> np.ndarray: """Get the velocity of the arm joints.""" - arm_dof_indices = map( - lambda x: self.joint_dof_indices[x], self.params.arm_joints - ) + + # deref self vars to cut access in half + joint_dof_indices = self.joint_dof_indices + arm_joints = self.params.arm_joints + sim_obj_joint_vel = self.sim_obj.joint_velocities + + arm_dof_indices = (joint_dof_indices[x] for x in arm_joints) return np.array( - [self.sim_obj.joint_velocities[i] for i in arm_dof_indices], + [sim_obj_joint_vel[i] for i in arm_dof_indices], dtype=np.float32, ) diff --git a/src_python/habitat_sim/simulator.py b/src_python/habitat_sim/simulator.py index cd0dd8bd81..400635fd72 100644 --- a/src_python/habitat_sim/simulator.py +++ b/src_python/habitat_sim/simulator.py @@ -90,29 +90,25 @@ def _sanitize_config(config: Configuration) -> None: ) config.sim_cfg.create_renderer = any( - map(lambda cfg: len(cfg.sensor_specifications) > 0, config.agents) + (len(cfg.sensor_specifications) > 0 for cfg in config.agents) ) config.sim_cfg.load_semantic_mesh = any( - map( - lambda cfg: any( - map( - lambda sens_spec: sens_spec.sensor_type == SensorType.SEMANTIC, - cfg.sensor_specifications, - ) - ), - config.agents, + ( + any( + sens_spec.sensor_type == SensorType.SEMANTIC + for sens_spec in cfg.sensor_specifications + ) + for cfg in config.agents ) ) config.sim_cfg.requires_textures = any( - map( - lambda cfg: any( - map( - lambda sens_spec: sens_spec.sensor_type == SensorType.COLOR, - cfg.sensor_specifications, - ) - ), - config.agents, + ( + any( + sens_spec.sensor_type == SensorType.COLOR + for sens_spec in cfg.sensor_specifications + ) + for cfg in config.agents ) )