Conditions | 5 |
Total Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | class Logger: |
||
14 | def validate(logFile: str) -> str: |
||
15 | if '.' in logFile: |
||
16 | name, ext = logFile.split('.', 2) |
||
17 | ext = '.' + ext |
||
18 | else: |
||
19 | name = logFile |
||
20 | ext = '' |
||
21 | num = 0 |
||
22 | exists = True |
||
23 | while(exists): |
||
24 | logFile = name + '-' + str(num) + ext |
||
25 | try: |
||
26 | with open(logFile): |
||
27 | pass |
||
28 | except IOError: |
||
29 | return logFile |
||
30 | num += 1 |
||
31 | |||
57 | return data |