5 files modified
13 files added
1 files deleted
| | |
| | | sandbox* |
| | | queens* |
| | | *.venv* |
| | | |
| | | |
| | | |test| |
| | | __pycache__/ |
| | | .idea/ |
New file |
| | |
| | | import sys |
| | | |
| | | filename = sys.argv[1] |
| | | |
| | | with open(filename, 'r') as f: |
| | | for line in f.readlines(): |
| | | print(line.strip()) |
| | | pass |
New file |
| | |
| | | [build-system] |
| | | requires = ["setuptools"] |
| | | build-backend = "setuptools.build_meta" |
| | | |
| | | [project] |
| | | name = "wettercdc" |
| | | version = "0.0.1" |
| | | |
| | | [tool.setuptools.packages.find] |
| | | # All the following settings are optional: |
| | | where = ["src"] |
| | | |
| | | # [project.scripts] |
| | | # mystudy = "mystudy.main:start" |
| | | |
New file |
| | |
| | | import re |
| | | |
| | | class WetterStation: |
| | | """ |
| | | represents a Weather station |
| | | """ |
| | | def __init__(self, station_line: str): |
| | | fields = re.split(r"\s+", station_line.strip()) |
| | | self._id = fields[0] |
| | | self._bundesland = fields[-1] |
| | | self._name = fields[-2] |
| | | |
| | | def id(self): |
| | | return self._id |
| | | |
| | | def name(self): |
| | | return self._name |
| | | |
| | | def bundesland(self): |
| | | return self._bundesland |
| | | |
| | | pass |
| | | |
New file |
| | |
| | | # suche aus Beschreibung die Station aus gewünsche Bundesland |
| | | import sys |
| | | |
| | | from wettercdc.WetterStation import WetterStation |
| | | |
| | | filename = sys.argv[1] |
| | | stations = [] |
| | | |
| | | with open(filename, 'r') as f: |
| | | ignore_lines = 2 |
| | | for i in range(ignore_lines): |
| | | f.readline() |
| | | |
| | | for line in f.readlines(): |
| | | #TODO: mach was mit line |
| | | stations.append( WetterStation(line) ) |
| | | pass |
| | | |
| | | print('DONE', len(stations)) |
New file |
| | |
| | | import unittest |
| | | from typing import Final |
| | | |
| | | from wettercdc.WetterStation import WetterStation |
| | | |
| | | |
| | | class WetterStationCase(unittest.TestCase): |
| | | def test_constructor(self): |
| | | line:Final[str] = """00020 20040812 20240701 432 48.9219 9.9129 Abtsgmünd-Untergröningen Baden-Württemberg |
| | | """ |
| | | station = WetterStation(line) |
| | | self.assertEqual(station.id(), '00020') |
| | | self.assertEqual(station.name(), "Abtsgmünd-Untergröningen") |
| | | self.assertEqual(station.bundesland(), "Baden-Württemberg") |
| | | |
| | | |
| | | |
| | | if __name__ == '__main__': |
| | | unittest.main() |
New file |
| | |
| | | class Money: |
| | | def __init__(self, euro: int, cent: int = 0 ): |
| | | if euro < 0: |
| | | raise ValueError("Betrag ungültig") |
| | | if euro == 0 and cent == 0: |
| | | raise ValueError("Betrag ungültig") |
| | | if cent < 0: |
| | | raise ValueError("Betrag ungültig") |
| | | |
| | | self._betrag = euro * 100 + cent # in cent |
| | | self._euro, self._cent = divmod(self._betrag, 100) |
| | | pass |
| | | |
| | | |
| | | def normalize(self) -> str: |
| | | return f"{self._euro}€{self._cent}c" |
| | | |
| | | def __repr__(self): |
| | | return self.normalize() |
| | | |
| | | def getEuro(self): |
| | | return self._euro |
| | | |
| | | def add(self, euro): |
| | | return Money(self._euro + euro, self._cent) |
New file |
| | |
| | | import unittest |
| | | |
| | | |
| | | class MyTestCase(unittest.TestCase): |
| | | def test_something(self): |
| | | benzin_preis = Money(12, 5) |
| | | |
| | | milch_preis = Money(3) |
| | | katoffel_p = Money(0, 501) |
| | | pass |
| | | |
| | | |
| | | |
| | | if __name__ == '__main__': |
| | | unittest.main() |
New file |
| | |
| | | __pycache__ |
| | | *.egg-info/ |
| | | .idea/ |
New file |
| | |
| | | from mystudy.lecture import Lecture |
| | | |
| | | |
| | | class LecturesConvert: |
| | | def covert(self, lectures: list[Lecture]) -> str: |
| | | pass |
| | | |
| | |
| | | from typing import Final |
| | | |
| | | from mystudy.DataFormatError import DataFormatError |
| | | from mystudy.LecruresConverter import LecturesConvert |
| | | |
| | | lecture_time: Final[int] = 15 |
| | | ects_effort: Final[int] = 30 |
| | |
| | | pass |
| | | |
| | | |
| | | class Lecture2HTMLConverter: |
| | | class Lecture2HTMLConverter(LecturesConvert): |
| | | def __init__(self): |
| | | self.__head = """<!DOCTYPE html> |
| | | <html lang="en"> |
| | |
| | | </html> |
| | | """ |
| | | |
| | | def to_html(self, lectures: list[Lecture]) -> str: |
| | | def convert(self, lectures: list[Lecture]) -> str: |
| | | html = "" |
| | | for l in lectures: |
| | | html += f"""<tr> |
| | |
| | | lectures = read_file_to_lecture(filename) |
| | | if lectures is not None: |
| | | converter = Lecture2HTMLConverter() |
| | | html_code = converter.to_html(lectures) |
| | | html_code = converter.convert(lectures) |
| | | print(html_code) |
| | | except FileNotFoundError: |
| | | print(f"Datei '{filename}' nicht gefunden") |
New file |
| | |
| | | __pycache__ |
| | | *.egg-info/ |
| | | .idea/ |
| | |
| | | self.setheading(head) |
| | | pass |
| | | |
| | | pass |
| | | def pentagon(self, length, x, y): |
| | | alpha = 72 |
| | | self.teleport(x, y) |
| | | head = self.heading() |
| | | for i in range(0, 5): |
| | | self.forward(length) |
| | | self.left(alpha) |
| | | self.setheading(head) |
| | | pass |
| | | |
| | |
| | | def main(): |
| | | t = TtGeo() |
| | | t.triangle(50, 20, 25) |
| | | t.circle(50) |
| | | t.dot(25) |
| | | t.pentagon(60, 20, 25) |
| | | |
| | | |
| | | t.screen.mainloop() |