aboutsummaryrefslogtreecommitdiffstats
path: root/administrative-codes/csv2json
diff options
context:
space:
mode:
Diffstat (limited to 'administrative-codes/csv2json')
-rwxr-xr-xadministrative-codes/csv2json9
1 files changed, 6 insertions, 3 deletions
diff --git a/administrative-codes/csv2json b/administrative-codes/csv2json
index 7c22666..6dd6ad7 100755
--- a/administrative-codes/csv2json
+++ b/administrative-codes/csv2json
@@ -18,6 +18,8 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#----------------------------------------------------------------------
+# pylint: disable=missing-module-docstring
+
import sys
import csv
from pathlib import Path
@@ -25,13 +27,14 @@ import json
basedir = Path(sys.argv[0]).parent
data = {}
-def readCSV(path):
- with open(path, mode='r', newline='') as fp:
+def readCSV(pathname): # pylint: disable=invalid-name
+ """Read CSV"""
+ with open(pathname, mode='r', newline='', encoding='utf-8') as fp:
reader = csv.DictReader(fp, delimiter='\t', dialect='unix')
for row in reader:
code = row['Code']
if code in data:
- raise Exception(f'Duplicate code {code}')
+ raise RuntimeError(f'Duplicate code {code}')
data[code] = row['Name']
# The source (SCB) lists all codes in same file: they differ only in