diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9308e1b..f05b601 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,9 +1,11 @@ name: Build on: + pull_request: push: branches: - main + merge_group: jobs: build: @@ -27,6 +29,7 @@ jobs: run: python src/vbl_aquarium/build.py - name: 📤 PR changes + if: github.ref == 'refs/heads/main' uses: peter-evans/create-pull-request@v6 with: token: ${{ secrets.PR_TOKEN }} diff --git a/src/vbl_aquarium/__about__.py b/src/vbl_aquarium/__about__.py index a73339b..00ec2dc 100644 --- a/src/vbl_aquarium/__about__.py +++ b/src/vbl_aquarium/__about__.py @@ -1 +1 @@ -__version__ = "0.0.8" +__version__ = "0.0.9" diff --git a/src/vbl_aquarium/models/unity.py b/src/vbl_aquarium/models/unity.py index e8d5cb7..d0ed4e1 100644 --- a/src/vbl_aquarium/models/unity.py +++ b/src/vbl_aquarium/models/unity.py @@ -27,3 +27,27 @@ class Vector4(BaseModel): y: float = 0.0 z: float = 0.0 w: float = 0.0 + + def __add__(self, other): + if isinstance(other, Vector4): + return Vector4(x=self.x + other.x, y=self.y + other.y, z=self.z + other.z, w=self.w + other.w) + error = f"unsupported operand type(s) for +: 'Vector4' and '{type(other)}'" + raise TypeError(error) + + def __sub__(self, other): + if isinstance(other, Vector4): + return Vector4(x=self.x - other.x, y=self.y - other.y, z=self.z - other.z, w=self.w - other.w) + error = f"unsupported operand type(s) for -: 'Vector4' and '{type(other)}'" + raise TypeError(error) + + def __mul__(self, other): + if isinstance(other, (int, float)): + return Vector4(x=self.x * other, y=self.y * other, z=self.z * other, w=self.w * other) + error = f"unsupported operand type(s) for *: 'Vector4' and '{type(other)}'" + raise TypeError(error) + + def __truediv__(self, other): + if isinstance(other, (int, float)): + return Vector4(x=self.x / other, y=self.y / other, z=self.z / other, w=self.w / other) + error = f"unsupported operand type(s) for /: 'Vector4' and '{type(other)}'" + raise TypeError(error)