Port codebase from Python 2 to Python 3

Replace Python 2-only constructs throughout libs/: print statements,
ConfigParser -> configparser, sets.Set -> builtin set, string.split ->
str.split, xrange -> range, dict.has_key()/.iteritems() -> in/.items(),
old-style raise Exception, "msg" syntax, and __cmp__ -> __eq__/__lt__
via functools.total_ordering (Python 3 dropped cmp()/__cmp__, which
max()/.sort() rely on). Also cleaned up mixed tab/space indentation
that Python 3's stricter tokenizer rejects.

Fixed two latent bugs that only surfaced once end-to-end runs were
possible under Python 3's stricter error handling:
- HandleBestellung() compared G.Anzahl (a bound method) to an int
  instead of calling G.Anzahl() - silently "worked" under Python 2's
  permissive cross-type ordering, raises TypeError under Python 3.
- LeuteAllein() raised KeyError for VIP-group members, who are never
  added to the regular Gruppen container; now skips people with no
  group entry instead of crashing.

Verified end-to-end: bin/platz.sh --indir work/test1 and --indir
work/test2 (VIP group included) both run to completion and produce
correctly formatted output.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Michael Stangl
2026-07-09 12:27:27 +02:00
parent 1e2eedc62b
commit 6e3649ed27
6 changed files with 289 additions and 278 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
# Python-Abhaengigkeiten fuer platz
#
# Aktuell werden nur Module aus der Standardbibliothek verwendet
# (ConfigParser, xml.dom.minidom, sets, UserList, random, ...).
# (configparser, xml.dom.minidom, random, ...).
# Keine externen Pakete erforderlich.
#
# Beispiel: