From c5bdeb6d2e537af0f8b69338c2a44fe6aa7f35a2 Mon Sep 17 00:00:00 2001 From: Marcos Marado Date: Wed, 29 Jul 2015 13:44:26 +0100 Subject: [PATCH 1/3] Fix paths to each tsv database on description --- pt_regions/bd_database.py | 2 +- pt_regions/caop_database.py | 14 ++++++++------ pt_regions/dgal_database.py | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/pt_regions/bd_database.py b/pt_regions/bd_database.py index 363dd47..743b2bc 100644 --- a/pt_regions/bd_database.py +++ b/pt_regions/bd_database.py @@ -8,7 +8,7 @@ which was: 1. exported to TSV via "save as..." "UTF-16 Unicode Text" in excel. 2. converted to utf-8 via a text program. - 3. saved in `contracts/DGAL_data/bp_list.tsv` + 3. saved in `raw_data/bp_list.tsv` """ import csv import datetime diff --git a/pt_regions/caop_database.py b/pt_regions/caop_database.py index b159602..5d464c7 100644 --- a/pt_regions/caop_database.py +++ b/pt_regions/caop_database.py @@ -1,6 +1,6 @@ """ - This module converts 3 TSV files of districts, municipalities and counties into - a dictionaries. Use `get_districts`, `get_municipalities`, `get_counties`. + This module converts 3 TSV files of districts, municipalities and counties + into dictionaries. Use `get_districts`, `get_municipalities`, `get_counties`. This module uses the database from http://www.dgterritorio.pt/cartografia_e_geodesia/cartografia/carta_administrativa_oficial_de_portugal__caop_/caop_em_vigor/ @@ -8,12 +8,14 @@ http://www.dgterritorio.pt/ficheiros/cadastro/caop/caop_download/caop_2014_0/areasfregmundistcaop2014_3 which: - 1. each sheet was exported to TSV via "save as..." "UTF-16 Unicode Text" in excel. + 1. each sheet was exported to TSV via "save as..." "UTF-16 Unicode Text" in + excel. 2. each sheet was converted to utf-8 via a text program. 3. each sheet was saved in - * `Areas_distritos_CAOP2014_utf8.txt` - * `Areas_municipios_CAOP2014_utf8.txt` - * `Areas_freguesias_CAOP2014_utf8.txt` + * `raw_data/Areas_distritos_CAOP2014_utf8.txt` + * `raw_data/Areas_municipios_CAOP2014_utf8.txt` + * `raw_data/Areas_freguesias_CAOP2014_utf8.txt` + """ import csv diff --git a/pt_regions/dgal_database.py b/pt_regions/dgal_database.py index 28ad192..81c8c40 100644 --- a/pt_regions/dgal_database.py +++ b/pt_regions/dgal_database.py @@ -8,7 +8,7 @@ which was: 1. exported to TSV via "save as..." "UTF-16 Unicode Text" in excel. 2. converted to utf-8 via a text program. - 3. saved in `contracts/DGAL_data/DGAL_Freguesias_2014_V7_utf8.txt` + 3. saved in `raw_data/DGAL_Freguesias_2014_V7_utf8.txt` """ import csv From c2e991243f8256aa40765c015961978f6ba28a39 Mon Sep 17 00:00:00 2001 From: Marcos Marado Date: Wed, 29 Jul 2015 13:47:40 +0100 Subject: [PATCH 2/3] Identify file encoding as UTF-8 (PEP 0263) More info: https://www.python.org/dev/peps/pep-0263/ --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index d9c59a8..eefb20e 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,6 @@ -from setuptools import setup, find_packages +# -*- coding: utf-8 -*- +from setuptools import setup, find_packages setup(name='pt-regions', version='1.0.0', From bf4bc17cf976592457c8befa9316861da6c2938a Mon Sep 17 00:00:00 2001 From: Marcos Marado Date: Wed, 29 Jul 2015 13:53:10 +0100 Subject: [PATCH 3/3] Declare this modules as UTF-8 (PEP 0263) More info: https://www.python.org/dev/peps/pep-0263/ --- pt_regions/bd_database.py | 2 ++ pt_regions/dgal_database.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/pt_regions/bd_database.py b/pt_regions/bd_database.py index 743b2bc..0cce6fb 100644 --- a/pt_regions/bd_database.py +++ b/pt_regions/bd_database.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + """ This module uses the database of Banco de Portugal to retrieve the NIFs of municipalities. diff --git a/pt_regions/dgal_database.py b/pt_regions/dgal_database.py index 81c8c40..2e279a1 100644 --- a/pt_regions/dgal_database.py +++ b/pt_regions/dgal_database.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + """ This module contains 1 function, `get_counties`, that returns all counties with respective NIFs.