1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-03 04:22:09 +03:00

python/samba/gp_parse: PY3 file -> open

'file' no longer exists in PY3 replace with 'open'

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
This commit is contained in:
Noel Power
2018-09-05 12:46:44 +01:00
committed by Noel Power
parent 0934fc14ef
commit 388bddf4a6
6 changed files with 8 additions and 8 deletions

View File

@ -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('<?xml version="1.0" encoding="utf-8"?><UnknownFile/>')
def load_xml(self, filename):

View File

@ -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.
#

View File

@ -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:

View File

@ -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():

View File

@ -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)

View File

@ -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'])