From ea14cde42710c85aae1fcaf77ab084dd07385997 Mon Sep 17 00:00:00 2001 From: Olli Graf Date: Sat, 9 Nov 2024 10:21:36 +0100 Subject: [PATCH] Zwischen Commit --- docker/docker-compose.yml | 9 +++++++++ gettattr/.gitignore | 1 + gettattr/Kreis_getattr.py | 19 +++++++++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 docker/docker-compose.yml create mode 100644 gettattr/.gitignore create mode 100644 gettattr/Kreis_getattr.py diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 0000000..1a8c13e --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,9 @@ +--- +version: "2.1" +services: + fibserver: + image: hans:5000/fibserver:1 + container_name: fibserver + ports: + - 8085:8085 + restart: unless-stopped diff --git a/gettattr/.gitignore b/gettattr/.gitignore new file mode 100644 index 0000000..bee8a64 --- /dev/null +++ b/gettattr/.gitignore @@ -0,0 +1 @@ +__pycache__ diff --git a/gettattr/Kreis_getattr.py b/gettattr/Kreis_getattr.py new file mode 100644 index 0000000..f805f82 --- /dev/null +++ b/gettattr/Kreis_getattr.py @@ -0,0 +1,19 @@ +from math import pi as pi + + +class Kreis_getattr: + def __init__(self, radius): + self.radius = radius + self.operators ={ + 'durchmesser': lambda x: self.radius * 2, + 'umfang': lambda x: self.durchmesser * pi, + 'flaeche': lambda x: self.radius**2 *pi + } + + def __getattr__(self, name): + if name not in self.operators: + raise TypeError(f'unbekannte Operation {name}') + + return self.operators[name](0) + +