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) + +