library_for_python

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub Kazun1998/library_for_python

:warning: Tuple/Triple.py

Code

from typing import TypeVar, Generic

S = TypeVar('S')
T = TypeVar('T')
U = TypeVar('U')
class Triple(tuple, Generic[S, T, U]):
    def __new__(cls, first: S, second: T, third: U):
        return super().__new__(cls, (first, second, third))

    def __repr__(self) -> str:
        return f"{self.__class__.__name__}({self.first}, {self.second}, {self.third})"

    @property
    def first(self) -> S:
        return self[0]

    @property
    def second(self) -> T:
        return self[1]

    @property
    def third(self) -> U:
        return self[2]

    def __add__(self, other: "Triple[S, T, U]") -> "Triple[S, T, U]":
        return Triple(self.first + other.first, self.second + other.second, self.third + other.third)

    def __sub__(self, other: "Triple[S, T, U]") -> "Triple[S, T, U]":
        return Triple(self.first - other.first, self.second - other.second, self.third - other.third)

    def __mul__(self, other: "Triple[S, T, U]") -> "Triple[S, T, U]":
        return Triple(self.first * other.first, self.second * other.second, self.third * other.third)

    def __xor__(self, other: "Triple[S, T, U]") -> "Triple[S, T, U]":
        return Triple(self.first ^ other.first, self.second ^ other.second, self.third ^ other.third)
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.13.3/x64/lib/python3.13/site-packages/onlinejudge_verify/documentation/build.py", line 71, in _render_source_code_stat
    bundled_code = language.bundle(stat.path, basedir=basedir, options={'include_paths': [basedir]}).decode()
                   ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.13.3/x64/lib/python3.13/site-packages/onlinejudge_verify/languages/python.py", line 96, in bundle
    raise NotImplementedError
NotImplementedError
Back to top page