From a7d1fca14abdfad3b96f0e7c6007b8a2a5c1b308 Mon Sep 17 00:00:00 2001 From: Joel Date: Thu, 4 Mar 2021 21:48:54 +0100 Subject: [PATCH] api position objects now implements __str__ and __repr__ --- build_deb.sh | 2 +- compLib/Api.py | 6 ++++++ compLib/__init__.py | 4 ++-- setup.py | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/build_deb.sh b/build_deb.sh index 6197626..567adfe 100644 --- a/build_deb.sh +++ b/build_deb.sh @@ -34,7 +34,7 @@ fpm -s python --python-bin python3 --python-pip pip3 --python-package-name-prefi -d "python3-pigpio" \ -d "python3-numpy" \ -d "ffmpeg" \ - -v 0.1.0-0 -t deb setup.py + -v 0.1.0-3 -t deb setup.py # --deb-changelog changelog \ # --deb-upstream-changelog changelog \ diff --git a/compLib/Api.py b/compLib/Api.py index 9c6e0a6..4b4ffdc 100644 --- a/compLib/Api.py +++ b/compLib/Api.py @@ -65,6 +65,12 @@ class Position: self.y = y self.degrees = degrees + def __repr__(self): + return f"Position(x={self.x}, y={self.y}, degrees={self.degrees})" + + def __str__(self): + return f"Position(x={round(self.x, 5)}, y={round(self.y, 5)}, degrees={round(self.degrees, 5)})" + class DoubleElim: """Class used for communicating with double elimination api diff --git a/compLib/__init__.py b/compLib/__init__.py index 28d1de1..bcbe0d7 100644 --- a/compLib/__init__.py +++ b/compLib/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.1.0-0" +__version__ = "0.1.0-3" import compLib.LogstashLogging import logging @@ -8,7 +8,7 @@ try: __versions = apt.Cache()["python3-complib"].versions if len(__versions) != 1: print(f"Starting compLib! \033[91mVersion: {__version__} is outdated\033[0m\n" - f"\033[92m[!] run the command 'apt update && apt install python3-complib' to install the newest version\033[0m") + f"\033[92m[!] run the command 'sudo apt update && sudo apt install python3-complib' to install the newest version\033[0m") else: print(f"Starting compLib! \033[92mVersion: {__version__} is up to date\033[0m") except Exception as e: diff --git a/setup.py b/setup.py index 10aef70..0588203 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ else: setuptools.setup( name="complib", - version="0.1.0-0", + version="0.1.0-3", author="F-WuTs", author_email="--", description="",