From 94ed370c2419767b5b9b4ce1bb191772337346ca Mon Sep 17 00:00:00 2001 From: Giuseppe L'Erario Date: Fri, 12 Jan 2024 13:01:48 +0100 Subject: [PATCH 1/6] Update black.yml --- .github/workflows/black.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index 8ba32be4..ca64506b 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -11,7 +11,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: black - uses: lgeiger/black-action@v1.0.1 + uses: psf/black@stable with: args: . - name: Check for modified files From 8c26f1e8fbbf3e91c2fa6b7cba17a9cbd05186e1 Mon Sep 17 00:00:00 2001 From: Giuseppe L'Erario Date: Fri, 12 Jan 2024 13:06:24 +0100 Subject: [PATCH 2/6] Add on pull_request --- .github/workflows/black.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index ca64506b..52d61d27 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -1,6 +1,7 @@ name: Black action on: + pull_request: push: branches: - main From 349fbc649b334d6050e347c1502ea0b42638fdac Mon Sep 17 00:00:00 2001 From: giulero Date: Fri, 12 Jan 2024 13:13:55 +0100 Subject: [PATCH 3/6] Align with black formatting --- src/adam/model/std_factories/std_model.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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]: From 7f1133d3194c4e572a8c72c3047e88104756a9ef Mon Sep 17 00:00:00 2001 From: giulero Date: Fri, 12 Jan 2024 13:15:40 +0100 Subject: [PATCH 4/6] Update actions/checkout version in black.yml workflow --- .github/workflows/black.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index 52d61d27..be355329 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -10,7 +10,7 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: black uses: psf/black@stable with: From 31e567da9322bb2f4981763004febc8ce8b858d2 Mon Sep 17 00:00:00 2001 From: giulero Date: Fri, 12 Jan 2024 13:18:41 +0100 Subject: [PATCH 5/6] Remove unnecessary 'args' parameter in black workflow --- .github/workflows/black.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index be355329..83b92fa3 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -13,8 +13,6 @@ jobs: - uses: actions/checkout@v3 - name: black uses: psf/black@stable - with: - args: . - 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) From 29c985c54530af543abf66615ef1776af286c53e Mon Sep 17 00:00:00 2001 From: Giuseppe L'Erario Date: Fri, 12 Jan 2024 15:03:15 +0100 Subject: [PATCH 6/6] Update .github/workflows/black.yml Co-authored-by: Filippo Luca Ferretti <102977828+flferretti@users.noreply.github.com> --- .github/workflows/black.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index 83b92fa3..41be665b 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -13,6 +13,8 @@ jobs: - uses: actions/checkout@v3 - name: black uses: psf/black@stable + with: + 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)