small fixes, lint

parent b7701475
Pipeline #19517973 passed with stage
in 11 minutes and 18 seconds
......@@ -6,6 +6,7 @@ import time
from datetime import datetime
from subprocess import CalledProcessError
from typing import Dict, List
from urllib.error import HTTPError
import pytz
import requests
......@@ -57,6 +58,22 @@ queries = {
'area[name="Deutschland"]->.gem; relation(area.gem)["type"="boundary"][admin_level=6]; out geom;',
"samtgemeinde_verwaltungsgemeinschaft":
'area[name="Deutschland"]->.gem; relation(area.gem)["type"="boundary"][admin_level=7]; out geom;',
# huge!
"""
A bit too huge?
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
1: node::Abort() [/usr/local/bin/node]
2: node::FatalException(v8::Isolate*, v8::Local<v8::Value>, v8::Local<v8::Message>) [/usr/local/bin/node]
3: v8::Utils::ReportOOMFailure(char const*, bool) [/usr/local/bin/node]
4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [/usr/local/bin/node]
5: v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [/usr/local/bin/node]
6: v8::internal::Runtime_AllocateInTargetSpace(int, v8::internal::Object**, v8::internal::Isolate*)
[/usr/local/bin/node]
7: 0x2fb7fb8ed46
8: 0x2fb7fcf4e76
9: 0x2fb7fcdd264
10: 0x2fb7fb85cd5
"""
"stadt_gemeinde":
'area[name="Deutschland"]->.gem; relation(area.gem)["type"="boundary"][admin_level=8]; out geom;',
"stadtbezirk_gemeindeteil_mit_selbstverwaltung":
......@@ -182,6 +199,8 @@ def import_from_scratch(countries: List[str]=None, organization_types: List[str]
resolution = resampling_resolutions.get(country, {}).get(organization_type, 0.001)
store_new(resample(feature, resolution), country, organization_type, when)
# can't do multiprocessing.pool, given non global functions.
log.info("Import finished.")
......@@ -309,11 +328,20 @@ def store_new(feature: Dict, country: str="NL", organization_type: str="municipa
# try to find official urls for this organization, as it's empty now. All those will then be onboarded and scanned.
if "wikidata" in properties:
client = Client() # Q9928
entity = client.get(properties["wikidata"], load=True)
website = str(entity.get(client.get("P856"), None)) # P856 == Official Website.
if not website:
website = ""
try:
client = Client() # Q9928
entity = client.get(properties["wikidata"], load=True)
website = str(entity.get(client.get("P856"), None)) # P856 == Official Website.
except HTTPError as e:
# No entity with ID Q15111448 was found... etc.
# perfectly possible. In that case, no website, and thus continue.
pass
except Exception as e:
# don't cause problems here... if the service is down, bad luck, try an import later etc...
pass
if not website or website == "None":
return
extract = tldextract.extract(website)
......@@ -459,6 +487,7 @@ def get_osm_data(country: str= "NL", organization_type: str= "municipality"):
four_hours_ago = time.time() - 14400
if os.path.isfile(filename + ".geojson") and four_hours_ago < os.path.getmtime(filename):
log.debug("Already downloaded a coordinate file in the past four hours. Using that one.")
log.debug(filename + ".geojson")
return json.load(open(filename + ".geojson"))
"""
......@@ -513,6 +542,7 @@ def get_osm_data(country: str= "NL", organization_type: str= "municipality"):
def osmtogeojson_available():
try:
# todo: node --max_old_space_size=4000, for larger imprts... we don't even call node... :(
subprocess.check_output(["osmtogeojson", "tesfile.osm"], stderr=subprocess.STDOUT, )
except CalledProcessError as e:
if "no such file or directory, open 'tesfile.osm'" in str(e.output):
......
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-03-26 12:03+0000\n"
"POT-Creation-Date: 2018-03-26 15:32+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <[email protected]>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
......
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-03-26 12:03+0000\n"
"POT-Creation-Date: 2018-03-26 15:32+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <[email protected]>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
......@@ -18,8 +18,8 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: failmap/map/static/js/failmap.js:71 failmap/map/static/js/views.js:476
#: failmap/map/static/js/views.js:481 failmap/map/static/js/views.js:484
#: failmap/map/static/js/failmap.js:71 failmap/map/static/js/views.js:485
#: failmap/map/static/js/views.js:490 failmap/map/static/js/views.js:493
msgid "View Full Screen"
msgstr ""
......@@ -364,31 +364,37 @@ msgid "category_menu_hacking"
msgstr "Hackers"
#: failmap/map/static/js/script.js:62
msgid "bundesland"
msgstr ""
#, fuzzy
#| msgid "category_menu_unknown"
msgid "category_menu_bundesland"
msgstr "Unknown"
#: failmap/map/static/js/script.js:63
msgid "regierungsbezirk"
msgstr ""
#, fuzzy
#| msgid "category_menu_cyber"
msgid "category_menu_regierungsbezirk"
msgstr "Cyber"
#: failmap/map/static/js/script.js:64
msgid "landkreis_kreis_kreisfreie_stadt"
msgid "category_menu_landkreis_kreis_kreisfreie_stadt"
msgstr ""
#: failmap/map/static/js/script.js:65
msgid "samtgemeinde_verwaltungsgemeinschaft"
msgid "category_menu_samtgemeinde_verwaltungsgemeinschaft"
msgstr ""
#: failmap/map/static/js/script.js:66
msgid "stadt_gemeinde"
msgstr ""
#, fuzzy
#| msgid "category_menu_hacking"
msgid "category_menu_stadt_gemeinde"
msgstr "Hackers"
#: failmap/map/static/js/script.js:67
msgid "stadtbezirk_gemeindeteil_mit_selbstverwaltung"
msgid "category_menu_stadtbezirk_gemeindeteil_mit_selbstverwaltung"
msgstr ""
#: failmap/map/static/js/script.js:68
msgid "stadtteil_gemeindeteil_ohne_selbstverwaltung"
msgid "category_menu_stadtteil_gemeindeteil_ohne_selbstverwaltung"
msgstr ""
#: failmap/map/static/js/script.js:71
......@@ -461,6 +467,6 @@ msgstr ""
msgid "top win on failmap"
msgstr ""
#: failmap/map/static/js/views.js:482
#: failmap/map/static/js/views.js:491
msgid "Exit Full Screen"
msgstr ""
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-03-26 12:03+0000\n"
"POT-Creation-Date: 2018-03-26 15:32+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Fail Map <[email protected]>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
......
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-03-26 12:03+0000\n"
"POT-Creation-Date: 2018-03-26 15:32+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <[email protected]>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
......@@ -18,8 +18,8 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: failmap/map/static/js/failmap.js:71 failmap/map/static/js/views.js:476
#: failmap/map/static/js/views.js:481 failmap/map/static/js/views.js:484
#: failmap/map/static/js/failmap.js:71 failmap/map/static/js/views.js:485
#: failmap/map/static/js/views.js:490 failmap/map/static/js/views.js:493
msgid "View Full Screen"
msgstr "Volledig scherm"
......@@ -373,31 +373,31 @@ msgid "category_menu_hacking"
msgstr "Hackers"
#: failmap/map/static/js/script.js:62
msgid "bundesland"
msgid "category_menu_bundesland"
msgstr "Bundesland"
#: failmap/map/static/js/script.js:63
msgid "regierungsbezirk"
msgid "category_menu_regierungsbezirk"
msgstr "Regierungsbezirk"
#: failmap/map/static/js/script.js:64
msgid "landkreis_kreis_kreisfreie_stadt"
msgid "category_menu_landkreis_kreis_kreisfreie_stadt"
msgstr "Landkreis / Kreis / kreisfreie Stadt"
#: failmap/map/static/js/script.js:65
msgid "samtgemeinde_verwaltungsgemeinschaft"
msgid "category_menu_samtgemeinde_verwaltungsgemeinschaft"
msgstr "Samtgemeinde, Verwaltungsgemeinschaft"
#: failmap/map/static/js/script.js:66
msgid "stadt_gemeinde"
msgid "category_menu_stadt_gemeinde"
msgstr "Stadt, Gemeinde"
#: failmap/map/static/js/script.js:67
msgid "stadtbezirk_gemeindeteil_mit_selbstverwaltung"
msgid "category_menu_stadtbezirk_gemeindeteil_mit_selbstverwaltung"
msgstr "Stadtbezirk / Gemeindeteil mit Selbstverwaltung"
#: failmap/map/static/js/script.js:68
msgid "stadtteil_gemeindeteil_ohne_selbstverwaltung"
msgid "category_menu_stadtteil_gemeindeteil_ohne_selbstverwaltung"
msgstr "Stadtteil / Gemeindeteil ohne Selbstverwaltung"
#: failmap/map/static/js/script.js:71
......@@ -470,9 +470,15 @@ msgstr "faalkaart"
msgid "top win on failmap"
msgstr "beste organisaties op faalkaart"
#: failmap/map/static/js/views.js:482
#: failmap/map/static/js/views.js:491
msgid "Exit Full Screen"
msgstr "Sluit volledig scherm"
#~ msgid "bundesland"
#~ msgstr "Bundesland"
#~ msgid "stadt_gemeinde"
#~ msgstr "Stadt, Gemeinde"
#~ msgid "slechtste organisaties on failmap"
#~ msgstr "op faalkaart"
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-03-26 12:03+0000\n"
"POT-Creation-Date: 2018-03-26 15:32+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Fail Map <[email protected]>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
......
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-03-26 12:03+0000\n"
"POT-Creation-Date: 2018-03-26 15:32+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <[email protected]>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
......@@ -18,8 +18,8 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: failmap/map/static/js/failmap.js:71 failmap/map/static/js/views.js:476
#: failmap/map/static/js/views.js:481 failmap/map/static/js/views.js:484
#: failmap/map/static/js/failmap.js:71 failmap/map/static/js/views.js:485
#: failmap/map/static/js/views.js:490 failmap/map/static/js/views.js:493
msgid "View Full Screen"
msgstr "🌈"
......@@ -41,7 +41,7 @@ msgstr "🌈"
#: failmap/map/static/js/failmap.js:173
msgid "Loading"
msgstr ""
msgstr "🌈"
#: failmap/map/static/js/failmap.js:191
msgid "Url"
......@@ -362,31 +362,45 @@ msgid "category_menu_hacking"
msgstr "🌈"
#: failmap/map/static/js/script.js:62
msgid "bundesland"
#, fuzzy
#| msgid "category_menu_unknown"
msgid "category_menu_bundesland"
msgstr "🌈"
#: failmap/map/static/js/script.js:63
msgid "regierungsbezirk"
#, fuzzy
#| msgid "regierungsbezirk"
msgid "category_menu_regierungsbezirk"
msgstr "🌈"
#: failmap/map/static/js/script.js:64
msgid "landkreis_kreis_kreisfreie_stadt"
#, fuzzy
#| msgid "landkreis_kreis_kreisfreie_stadt"
msgid "category_menu_landkreis_kreis_kreisfreie_stadt"
msgstr "🌈"
#: failmap/map/static/js/script.js:65
msgid "samtgemeinde_verwaltungsgemeinschaft"
#, fuzzy
#| msgid "samtgemeinde_verwaltungsgemeinschaft"
msgid "category_menu_samtgemeinde_verwaltungsgemeinschaft"
msgstr "🌈"
#: failmap/map/static/js/script.js:66
msgid "stadt_gemeinde"
#, fuzzy
#| msgid "category_menu_hacking"
msgid "category_menu_stadt_gemeinde"
msgstr "🌈"
#: failmap/map/static/js/script.js:67
msgid "stadtbezirk_gemeindeteil_mit_selbstverwaltung"
#, fuzzy
#| msgid "stadtbezirk_gemeindeteil_mit_selbstverwaltung"
msgid "category_menu_stadtbezirk_gemeindeteil_mit_selbstverwaltung"
msgstr "🌈"
#: failmap/map/static/js/script.js:68
msgid "stadtteil_gemeindeteil_ohne_selbstverwaltung"
#, fuzzy
#| msgid "stadtteil_gemeindeteil_ohne_selbstverwaltung"
msgid "category_menu_stadtteil_gemeindeteil_ohne_selbstverwaltung"
msgstr "🌈"
#: failmap/map/static/js/script.js:71
......@@ -459,10 +473,16 @@ msgstr "🌈"
msgid "top win on failmap"
msgstr "🌈"
#: failmap/map/static/js/views.js:482
#: failmap/map/static/js/views.js:491
msgid "Exit Full Screen"
msgstr "🌈"
#~ msgid "bundesland"
#~ msgstr "🌈"
#~ msgid "stadt_gemeinde"
#~ msgstr "🌈"
#~ msgid ""
#~ "Site does not redirect to secure url, and has nosecure alternative on a "
#~ "standard port."
......
......@@ -59,13 +59,13 @@ var dynamic_translations = function(){
gettext('category_menu_province');
gettext('category_menu_hacking');
// and germany
gettext('bundesland');
gettext('regierungsbezirk');
gettext('landkreis_kreis_kreisfreie_stadt');
gettext('samtgemeinde_verwaltungsgemeinschaft');
gettext('stadt_gemeinde');
gettext('stadtbezirk_gemeindeteil_mit_selbstverwaltung');
gettext('stadtteil_gemeindeteil_ohne_selbstverwaltung');
gettext('category_menu_bundesland');
gettext('category_menu_regierungsbezirk');
gettext('category_menu_landkreis_kreis_kreisfreie_stadt');
gettext('category_menu_samtgemeinde_verwaltungsgemeinschaft');
gettext('category_menu_stadt_gemeinde');
gettext('category_menu_stadtbezirk_gemeindeteil_mit_selbstverwaltung');
gettext('category_menu_stadtteil_gemeindeteil_ohne_selbstverwaltung');
// some countries:
gettext('country_NL');
......
......@@ -307,8 +307,10 @@ function extra() {
function germany() {
vueCountryNavbar.countries = ["NL", "DE"];
vueCategoryNavbar.categories = ["bundesland", "regierungsbezirk", "landkreis_kreis_kreisfreie_stadt",
"samtgemeinde_verwaltungsgemeinschaft", "stadt_gemeinde", "stadtbezirk_gemeindeteil_mit_selbstverwaltung",
"stadtbezirk_gemeindeteil_mit_selbstverwaltung", "stadtteil_gemeindeteil_ohne_selbstverwaltung"];
"samtgemeinde_verwaltungsgemeinschaft"];
// too big to import, too detailed?
// "stadt_gemeinde", "stadtbezirk_gemeindeteil_mit_selbstverwaltung",
// "stadtbezirk_gemeindeteil_mit_selbstverwaltung", "stadtteil_gemeindeteil_ohne_selbstverwaltung"
}
......
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-03-26 12:03+0000\n"
"POT-Creation-Date: 2018-03-26 15:32+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <[email protected]>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
......
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-03-26 12:03+0000\n"
"POT-Creation-Date: 2018-03-26 15:32+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <[email protected]>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
......
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-03-26 12:03+0000\n"
"POT-Creation-Date: 2018-03-26 15:32+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <[email protected]>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
......
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-03-26 12:03+0000\n"
"POT-Creation-Date: 2018-03-26 15:32+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <[email protected]>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
......
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-03-26 12:03+0000\n"
"POT-Creation-Date: 2018-03-26 15:32+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <[email protected]>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
......
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-03-26 12:03+0000\n"
"POT-Creation-Date: 2018-03-26 15:32+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <[email protected]>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
......
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-03-26 12:03+0000\n"
"POT-Creation-Date: 2018-03-26 15:32+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <[email protected]>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
......
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-03-26 12:03+0000\n"
"POT-Creation-Date: 2018-03-26 15:32+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <[email protected]>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
......
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-03-26 12:03+0000\n"
"POT-Creation-Date: 2018-03-26 15:32+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <[email protected]>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment