From: Noel Power Date: Wed, 5 Sep 2018 11:46:44 +0000 (+0100) Subject: python/samba/gp_parse: PY3 file -> open X-Git-Tag: tdb-1.3.17~929 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=388bddf4a6471f17f32af209bec36713f0b75d20;p=thirdparty%2Fsamba.git python/samba/gp_parse: PY3 file -> open 'file' no longer exists in PY3 replace with 'open' Signed-off-by: Noel Power Reviewed-by: Douglas Bagnall --- diff --git a/python/samba/gp_parse/__init__.py b/python/samba/gp_parse/__init__.py index 911f7df3e7d..8ddd52d3657 100644 --- a/python/samba/gp_parse/__init__.py +++ b/python/samba/gp_parse/__init__.py @@ -61,7 +61,7 @@ class GPParser(object): pass def write_xml(self, filename): - with file(filename, 'w') as f: + with open(filename, 'w') as f: f.write('') def load_xml(self, filename): diff --git a/python/samba/gp_parse/gp_csv.py b/python/samba/gp_parse/gp_csv.py index b19f84c56f7..cd30ef2bc00 100644 --- a/python/samba/gp_parse/gp_csv.py +++ b/python/samba/gp_parse/gp_csv.py @@ -47,7 +47,7 @@ class GPAuditCsvParser(GPParser): # print line def write_xml(self, filename): - with file(filename, 'wb') as f: + with open(filename, 'wb') as f: root = Element('CsvFile') child = SubElement(root, 'Row') for e in self.header: @@ -93,7 +93,7 @@ class GPAuditCsvParser(GPParser): self.lines.append(line) def write_binary(self, filename): - with file(filename, 'wb') as f: + with open(filename, 'wb') as f: # This should be using a unicode writer, but it seems to be in the # right encoding at least by default. # diff --git a/python/samba/gp_parse/gp_inf.py b/python/samba/gp_parse/gp_inf.py index e4bed26b2d9..8fcd9d59d74 100644 --- a/python/samba/gp_parse/gp_inf.py +++ b/python/samba/gp_parse/gp_inf.py @@ -337,7 +337,7 @@ class GptTmplInfParser(GPParser): self.sections[s].write_section(s, f) def write_xml(self, filename): - with file(filename, 'w') as f: + with open(filename, 'wb') as f: root = Element('GptTmplInfFile') for sec_inf in self.sections: diff --git a/python/samba/gp_parse/gp_ini.py b/python/samba/gp_parse/gp_ini.py index 58aee88a1e1..575dee78727 100644 --- a/python/samba/gp_parse/gp_ini.py +++ b/python/samba/gp_parse/gp_ini.py @@ -70,7 +70,7 @@ class GPIniParser(GPParser): return section_name def write_xml(self, filename): - with open(filename, 'wb') as f: + with open(filename, 'w') as f: root = Element('IniFile') for sec_ini in self.ini_conf.sections(): diff --git a/python/samba/gp_parse/gp_pol.py b/python/samba/gp_parse/gp_pol.py index 563574713b3..67ecd584dc0 100644 --- a/python/samba/gp_parse/gp_pol.py +++ b/python/samba/gp_parse/gp_pol.py @@ -99,7 +99,7 @@ class GPPolParser(GPParser): # print self.pol_file.__ndr_print__() def write_xml(self, filename): - with file(filename, 'w') as f: + with open(filename, 'wb') as f: root = Element('PolFile') root.attrib['signature'] = self.pol_file.header.signature root.attrib['version'] = str(self.pol_file.header.version) @@ -142,6 +142,6 @@ class GPPolParser(GPParser): # self.load_xml(fromstring(contents)) def write_binary(self, filename): - with file(filename, 'wb') as f: + with open(filename, 'wb') as f: binary_data = ndr_pack(self.pol_file) f.write(binary_data) diff --git a/python/samba/netcmd/gpo.py b/python/samba/netcmd/gpo.py index 6a7efe8add8..07c31f3a043 100644 --- a/python/samba/netcmd/gpo.py +++ b/python/samba/netcmd/gpo.py @@ -295,7 +295,7 @@ def backup_directory_remote_to_local(conn, remotedir, localdir): os.mkdir(l_name) else: data = conn.loadfile(r_name) - with file(l_name + SUFFIX, 'w') as f: + with open(l_name + SUFFIX, 'w') as f: f.write(data) parser = find_parser(e['name'])