locale_database: Use super() to call base class methods

This is the standard way to call base class methods in Python 3 and
it is shorter than the custom one used now.

Task-number: QTBUG-83488
Pick-to: 6.2
Change-Id: Ifaff591a46e92148fbf514856109ff794a50c9f7
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Ievgenii Meshcheriakov 2021-07-06 09:20:56 +02:00
parent 53382b7b07
commit 2f4868548b
2 changed files with 5 additions and 10 deletions

View File

@ -41,9 +41,8 @@ import os
import tempfile
class Error (Exception):
__upinit = Exception.__init__
def __init__(self, msg, *args):
self.__upinit(msg, *args)
super().__init__(msg, *args)
self.message = msg
def __str__(self):
return self.message
@ -126,7 +125,6 @@ class SourceFileEditor (Transcriber):
Callers should call close() on success or cleanup() on failure (to
clear away the temporary file); see Transcriber.
"""
__upinit = Transcriber.__init__
def __init__(self, path, temp):
"""Set up the source file editor.
@ -134,13 +132,12 @@ class SourceFileEditor (Transcriber):
and, on success, replaced with a new version; and the
directory in which to store the temporary file during the
rewrite."""
self.__upinit(path, temp)
super().__init__(path, temp)
self.__copyPrelude()
__upclose = Transcriber.close
def close(self):
self.__copyTail()
self.__upclose()
super().close()
# Implementation details:
GENERATED_BLOCK_START = '// GENERATED PART STARTS HERE'

View File

@ -133,9 +133,8 @@ def currencyIsoCodeData(s):
return "{0,0,0}"
class LocaleSourceEditor (SourceFileEditor):
__upinit = SourceFileEditor.__init__
def __init__(self, path, temp, version):
self.__upinit(path, temp)
super().__init__(path, temp)
self.writer.write("""
/*
This part of the file was generated on {} from the
@ -447,9 +446,8 @@ class CalendarDataWriter (LocaleSourceEditor):
months_data.write(self.writer)
class LocaleHeaderWriter (SourceFileEditor):
__upinit = SourceFileEditor.__init__
def __init__(self, path, temp, dupes):
self.__upinit(path, temp)
super().__init__(path, temp)
self.__dupes = dupes
def languages(self, languages):