From 7cf228d5c88b1adf381b8fc057457560f77c9145 Mon Sep 17 00:00:00 2001 From: Daniele Nicolodi <daniele.nicolodi@ptb.de> Date: Mon, 16 Jan 2023 13:31:59 +0100 Subject: [PATCH] timetracking: Apply naming convention for class private variables --- timetracking.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/timetracking.py b/timetracking.py index f0a40f2..34fc41a 100644 --- a/timetracking.py +++ b/timetracking.py @@ -262,11 +262,11 @@ class Day: class Timesheet: def __init__(self, month, data): - self.month = month - self.start = self.header - self.end = object() - self.days = defaultdict(Day) + self._month = month + self._start = self.header + self._end = object() self._home_office_start = None + self.days = defaultdict(Day) self.parse(data) def __iter__(self): @@ -280,7 +280,7 @@ class Timesheet: def footer(self): line = next(self.tokens) if line == '*** Ende Monatsjournal ***': - return self.end + return self._end raise ValueError(line) def tableheader(self): @@ -291,7 +291,7 @@ class Timesheet: if re.match(r'\s+(anteilige\s+)?Wochensumme', line): continue if re.match(r'\s+Periodensumme', line): - return self.end + return self._end if re.match(r'-+$', line): continue self.tokens.rewind() @@ -335,7 +335,7 @@ class Timesheet: r'(?P<notes>[^|]+)\|' r'(?:\s+(?P<expected>\d+\.\d+)\s+(?P<worked>\d+\.\d+)\s+(?P<difference>[-+]\d+\.\d+)\s+(?P<balance>[-+]\d+\.\d+))?$', line): # entry - date = self.month.replace(day=int(m.group('day'))) + date = self._month.replace(day=int(m.group('day'))) tin = datetime.strptime(m.group('tin'), '%H:%M') if m.group('tin') else None tout = datetime.strptime(m.group('tout'), '%H:%M') if m.group('tout') else None code = Code(m.group('code') or '') @@ -371,8 +371,8 @@ class Timesheet: def parse(self, s): self.tokens = Tokenizer(s) - f = self.start - while f is not self.end: + f = self._start + while f is not self._end: f = f() -- GitLab