[Pkg-isocodes-devel] [SCM] ISO language, territory, currency, script codes and their translations branch, master, updated. 03570ff21c5b274fa394e207b5343689711250ca

Tobias Quathamer toddy at debian.org
Sun Jun 24 11:51:06 UTC 2012


The following commit has been merged in the master branch:
commit 140f974760cd3099483dfdbe6893697dc9528b4b
Author: Tobias Quathamer <toddy at debian.org>
Date:   Sat Jun 23 19:47:37 2012 +0200

    Refactoring: Rename input and output file variables

diff --git a/iso_639_3/iso-dis-639-tab-parse.py b/iso_639_3/iso-dis-639-tab-parse.py
index 2a27d50..d65b85d 100755
--- a/iso_639_3/iso-dis-639-tab-parse.py
+++ b/iso_639_3/iso-dis-639-tab-parse.py
@@ -33,11 +33,10 @@ for li in names.readlines():
 names.close()
 
 
-f=open("iso_639_3.tab")
+tabular_file = open("iso_639_3.tab")
+xml_file = open("iso_639_3.xml","w")
 
-ot=open("iso_639_3.xml","w")
-
-ot.write("""<?xml version="1.0" encoding="UTF-8" ?>
+xml_file.write("""<?xml version="1.0" encoding="UTF-8" ?>
 
 <!--
 This file gives a list of all languages in the ISO 639-3
@@ -80,12 +79,12 @@ Source: <http://www.sil.org/iso639-3/>
 """)
 
 # The first line only contains a header, so discard it
-f.readline()
+tabular_file.readline()
 
 # Set up a container for XML element 'iso_639_3_entry'
 iso_639_3_entry = ''
 
-for li in f.readlines():
+for li in tabular_file.readlines():
 	# Split the line into parts and look for quotes
 	parts = li.split('\t')
 	# Reverse the parts, because Python's pop() function is much
@@ -113,7 +112,7 @@ for li in f.readlines():
 	documentation = parts.pop()
 	# Write the last entry, before starting a new one
 	if iso_639_3_entry != '':
-		ot.write(iso_639_3_entry)
+		xml_file.write(iso_639_3_entry)
 		iso_639_3_entry = ''
 	# Assemble the iso_639_3_entry
 	iso_639_3_entry = '\t<iso_639_3_entry\n'
@@ -129,8 +128,8 @@ for li in f.readlines():
 	iso_639_3_entry += '\t\tname="%s" />\n' % reference_name
 
 # Finally, write the last entry and close the XML file
-ot.write(iso_639_3_entry)
-ot.write('</iso_639_3_entries>\n')
-ot.close()
+xml_file.write(iso_639_3_entry)
+xml_file.write('</iso_639_3_entries>\n')
+xml_file.close()
 
-f.close()
+tabular_file.close()

-- 
ISO language, territory, currency, script codes and their translations



More information about the Pkg-isocodes-devel mailing list