diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index 8ba32be4..41be665b 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -1,6 +1,7 @@ name: Black action on: + pull_request: push: branches: - main @@ -9,11 +10,11 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: black - uses: lgeiger/black-action@v1.0.1 + uses: psf/black@stable with: - args: . + options: "--check --verbose" - name: Check for modified files id: git-check run: echo ::set-output name=modified::$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi) diff --git a/src/adam/model/std_factories/std_model.py b/src/adam/model/std_factories/std_model.py index 41d8af69..ffeff713 100644 --- a/src/adam/model/std_factories/std_model.py +++ b/src/adam/model/std_factories/std_model.py @@ -7,11 +7,12 @@ from adam.core.spatial_math import SpatialMath from adam.model import ModelFactory, StdJoint, StdLink + def urdf_remove_sensors_tags(xml_string): # Parse the XML string root = ET.fromstring(xml_string) - # Find and remove all tags named "sensor" that are child of + # Find and remove all tags named "sensor" that are child of # root node (i.e. robot) for sensors_tag in root.findall("sensor"): root.remove(sensors_tag) @@ -21,6 +22,7 @@ def urdf_remove_sensors_tags(xml_string): return modified_xml_string + class URDFModelFactory(ModelFactory): """This factory generates robot elements from urdf_parser_py @@ -36,17 +38,19 @@ def __init__(self, path: str, math: SpatialMath): raise FileExistsError(path) # Read URDF, but before passing it to urdf_parser_py get rid of all sensor tags - # sensor tags are valid elements of URDF (see ), + # sensor tags are valid elements of URDF (see ), # but they are ignored by urdf_parser_py, that complains every time it sees one. # As there is nothing to be fixed in the used models, and it is not useful # to have a useless and noisy warning, let's remove before hands all the sensor elements, # that anyhow are not parser by urdf_parser_py or adam # See https://github.com/ami-iit/ADAM/issues/59 - xml_file = open(path, 'r') + xml_file = open(path, "r") xml_string = xml_file.read() xml_file.close() xml_string_without_sensors_tags = urdf_remove_sensors_tags(xml_string) - self.urdf_desc = urdf_parser_py.urdf.URDF.from_xml_string(xml_string_without_sensors_tags) + self.urdf_desc = urdf_parser_py.urdf.URDF.from_xml_string( + xml_string_without_sensors_tags + ) self.name = self.urdf_desc.name def get_joints(self) -> List[StdJoint]: