Skip to content

Commit

Permalink
Clean code, noqa in generated code
Browse files Browse the repository at this point in the history
  • Loading branch information
frodrigo committed May 2, 2020
1 parent 66eb693 commit b791953
Show file tree
Hide file tree
Showing 29 changed files with 87 additions and 87 deletions.
6 changes: 3 additions & 3 deletions mapcss/mapcss2osmose.py
Original file line number Diff line number Diff line change
Expand Up @@ -788,9 +788,9 @@ def main(_, mapcss):

mapcss = ("""#-*- coding: utf-8 -*-
import modules.mapcss_lib as mapcss
import regex as re
import regex as re # noqa
from plugins.Plugin import with_options
from plugins.Plugin import with_options # noqa
from plugins.PluginMapCSS import PluginMapCSS
Expand All @@ -800,7 +800,7 @@ class """ + prefix + class_name + """(PluginMapCSS):
""" + ("\n not_for = ['" + "', '".join(not_for) + "']\n" if not_for != [] else "") + """
def init(self, logger):
super().init(logger)
tags = capture_tags = {}
tags = capture_tags = {} # noqa
""" + items.replace("\n", "\n ") + """
""" + "".join(map(lambda r: """
self.""" + r[1] + " = re.compile(r'" + r[0].replace('(?U)', '').replace("'", "\\'") + "'" + (', ' + {'i': "re.I", 'm': "re.M", 's': "re.I"}[r[2]] if r[2] else '') + ")", map(lambda a: [a[0][0], a[1], a[0][1]], sorted(regex_store.items(), key = lambda s: s[1])))) + """
Expand Down
6 changes: 3 additions & 3 deletions plugins/Bicycle.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#-*- coding: utf-8 -*-
import modules.mapcss_lib as mapcss
import regex as re
import regex as re # noqa

from plugins.Plugin import with_options
from plugins.Plugin import with_options # noqa
from plugins.PluginMapCSS import PluginMapCSS


Expand All @@ -12,7 +12,7 @@ class Bicycle(PluginMapCSS):

def init(self, logger):
super().init(logger)
tags = capture_tags = {}
tags = capture_tags = {} # noqa
self.errors[20301] = self.def_class(item = 2030, level = 1, tags = mapcss.list_(u'tag', u'highway') + mapcss.list_(u'cycleway', u'fix:survey'), title = mapcss.tr(u'Opposite cycleway without oneway'))
self.errors[20302] = self.def_class(item = 2030, level = 1, tags = mapcss.list_(u'tag', u'highway') + mapcss.list_(u'cycleway', u'fix:survey'), title = mapcss.tr(u'Opposite or opposite lane in the same way of the oneway'))
self.errors[20805] = self.def_class(item = 2080, level = 3, tags = mapcss.list_(u'tag', u'highway') + mapcss.list_(u'footway', u'fix:chair'), title = mapcss.tr(u'{0} without {1}', mapcss._tag_uncapture(capture_tags, u'{0.tag}'), u'highway=footway|construction'))
Expand Down
6 changes: 3 additions & 3 deletions plugins/Colour.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#-*- coding: utf-8 -*-
import modules.mapcss_lib as mapcss
import regex as re
import regex as re # noqa

from plugins.Plugin import with_options
from plugins.Plugin import with_options # noqa
from plugins.PluginMapCSS import PluginMapCSS


Expand All @@ -12,7 +12,7 @@ class Colour(PluginMapCSS):

def init(self, logger):
super().init(logger)
tags = capture_tags = {}
tags = capture_tags = {} # noqa
self.errors[30911] = self.def_class(item = 3091, level = 2, tags = mapcss.list_(u'tag'), title = mapcss.tr(u'Colour code should start with \'#\' followed by 3 or 6 digits'))

self.re_1b3f6ace = re.compile(r'^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$')
Expand Down
6 changes: 3 additions & 3 deletions plugins/Construction2.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#-*- coding: utf-8 -*-
import modules.mapcss_lib as mapcss
import regex as re
import regex as re # noqa

from plugins.Plugin import with_options
from plugins.Plugin import with_options # noqa
from plugins.PluginMapCSS import PluginMapCSS


Expand All @@ -12,7 +12,7 @@ class Construction2(PluginMapCSS):

def init(self, logger):
super().init(logger)
tags = capture_tags = {}
tags = capture_tags = {} # noqa
self.errors[40701] = self.def_class(item = 4070, level = 1, tags = mapcss.list_(u'tag', u'highway', u'fix:survey'), title = mapcss.tr(u'Inconsistent tagging of {0}', mapcss._tag_uncapture(capture_tags, u'{1.key}')))


Expand Down
6 changes: 3 additions & 3 deletions plugins/Josm_FranceSpecificRules.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#-*- coding: utf-8 -*-
import modules.mapcss_lib as mapcss
import regex as re
import regex as re # noqa

from plugins.Plugin import with_options
from plugins.Plugin import with_options # noqa
from plugins.PluginMapCSS import PluginMapCSS


Expand All @@ -13,7 +13,7 @@ class Josm_FranceSpecificRules(PluginMapCSS):

def init(self, logger):
super().init(logger)
tags = capture_tags = {}
tags = capture_tags = {} # noqa
self.errors[20806] = self.def_class(item = 2080, level = 3, tags = mapcss.list_(u'parking', u'amenity', u'fix:chair'), title = mapcss.tr(u'Missing tag carpool on area'))
self.errors[21600] = self.def_class(item = 2160, level = 3, tags = mapcss.list_(u'tag', u'railway'), title = mapcss.tr(u'Missing tag gauge on rail'))
self.errors[30401] = self.def_class(item = 3040, level = 3, tags = mapcss.list_(u'ref', u'infrastructure'), title = mapcss.tr(u'{0} is invalid', mapcss._tag_uncapture(capture_tags, u'{0.tag}')))
Expand Down
6 changes: 3 additions & 3 deletions plugins/Josm_ItalySpecific.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#-*- coding: utf-8 -*-
import modules.mapcss_lib as mapcss
import regex as re
import regex as re # noqa

from plugins.Plugin import with_options
from plugins.Plugin import with_options # noqa
from plugins.PluginMapCSS import PluginMapCSS


Expand All @@ -13,7 +13,7 @@ class Josm_ItalySpecific(PluginMapCSS):

def init(self, logger):
super().init(logger)
tags = capture_tags = {}
tags = capture_tags = {} # noqa
self.errors[21001] = self.def_class(item = 2100, level = 3, tags = mapcss.list_(u'fix:chair'), title = mapcss.tr(u'{0} without {1}', mapcss._tag_uncapture(capture_tags, u'{0.tag}'), mapcss._tag_uncapture(capture_tags, u'{1.key}')))


Expand Down
6 changes: 3 additions & 3 deletions plugins/Josm_Rules_Brazilian_Specific.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#-*- coding: utf-8 -*-
import modules.mapcss_lib as mapcss
import regex as re
import regex as re # noqa

from plugins.Plugin import with_options
from plugins.Plugin import with_options # noqa
from plugins.PluginMapCSS import PluginMapCSS


Expand All @@ -15,7 +15,7 @@ class Josm_Rules_Brazilian_Specific(PluginMapCSS):

def init(self, logger):
super().init(logger)
tags = capture_tags = {}
tags = capture_tags = {} # noqa
self.errors[9018002] = self.def_class(item = 9018, level = 3, tags = ["tag"], title = mapcss.tr(u'Brasil - Verificar'))
self.errors[9018003] = self.def_class(item = 9018, level = 3, tags = ["tag"], title = mapcss.tr(u'palavra abreviada em {0}', mapcss._tag_uncapture(capture_tags, u'{0.key}')))
self.errors[9018004] = self.def_class(item = 9018, level = 3, tags = ["tag"], title = mapcss.tr(u'nome supérfluo/incompleto de local de lazer'))
Expand Down
6 changes: 3 additions & 3 deletions plugins/Josm_Seamark.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#-*- coding: utf-8 -*-
import modules.mapcss_lib as mapcss
import regex as re
import regex as re # noqa

from plugins.Plugin import with_options
from plugins.Plugin import with_options # noqa
from plugins.PluginMapCSS import PluginMapCSS


Expand All @@ -13,7 +13,7 @@ class Josm_Seamark(PluginMapCSS):

def init(self, logger):
super().init(logger)
tags = capture_tags = {}
tags = capture_tags = {} # noqa
self.errors[9012001] = self.def_class(item = 9012, level = 3, tags = ["tag", "seamark"], title = mapcss.tr(u'Multi-colour {0} without {1}', mapcss._tag_uncapture(capture_tags, u'{0.value}'), mapcss._tag_uncapture(capture_tags, u'{2.key}')))
self.errors[9012002] = self.def_class(item = 9012, level = 3, tags = ["tag", "seamark"], title = mapcss.tr(u'Unrecognized {0}: {1}', mapcss._tag_uncapture(capture_tags, u'{0.key}'), mapcss._tag_uncapture(capture_tags, u'{0.value}')))
self.errors[9012003] = self.def_class(item = 9012, level = 3, tags = ["tag", "seamark"], title = mapcss.tr(u'{0} have no IALA or system defind ({1})', mapcss._tag_uncapture(capture_tags, u'{0.value}'), mapcss._tag_uncapture(capture_tags, u'{1.key}')))
Expand Down
6 changes: 3 additions & 3 deletions plugins/Josm_SuspiciousSwimming_Pool.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#-*- coding: utf-8 -*-
import modules.mapcss_lib as mapcss
import regex as re
import regex as re # noqa

from plugins.Plugin import with_options
from plugins.Plugin import with_options # noqa
from plugins.PluginMapCSS import PluginMapCSS


Expand All @@ -13,7 +13,7 @@ class Josm_SuspiciousSwimming_Pool(PluginMapCSS):

def init(self, logger):
super().init(logger)
tags = capture_tags = {}
tags = capture_tags = {} # noqa
self.errors[30801] = self.def_class(item = 3080, level = 3, tags = ["tag"] + mapcss.list_(u'tag', u'fix:chair', u'leisure', u'public equipment'), title = mapcss.tr(u'Suspicious tag association - possible confusion between swimming_pool and sports_centre'))


Expand Down
6 changes: 3 additions & 3 deletions plugins/Josm_addresses.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#-*- coding: utf-8 -*-
import modules.mapcss_lib as mapcss
import regex as re
import regex as re # noqa

from plugins.Plugin import with_options
from plugins.Plugin import with_options # noqa
from plugins.PluginMapCSS import PluginMapCSS


Expand All @@ -15,7 +15,7 @@ class Josm_addresses(PluginMapCSS):

def init(self, logger):
super().init(logger)
tags = capture_tags = {}
tags = capture_tags = {} # noqa
self.errors[9000003] = self.def_class(item = 9000, level = 3, tags = ["tag", "addr"], title = mapcss.tr(u'Same value of {0} and {1}', mapcss._tag_uncapture(capture_tags, u'{0.key}'), mapcss._tag_uncapture(capture_tags, u'{1.key}')))
self.errors[9000004] = self.def_class(item = 9000, level = 3, tags = ["tag", "addr"], title = mapcss.tr(u'{0} without number', mapcss._tag_uncapture(capture_tags, u'{0.key}')))

Expand Down
6 changes: 3 additions & 3 deletions plugins/Josm_combinations.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#-*- coding: utf-8 -*-
import modules.mapcss_lib as mapcss
import regex as re
import regex as re # noqa

from plugins.Plugin import with_options
from plugins.Plugin import with_options # noqa
from plugins.PluginMapCSS import PluginMapCSS


Expand All @@ -13,7 +13,7 @@ class Josm_combinations(PluginMapCSS):

def init(self, logger):
super().init(logger)
tags = capture_tags = {}
tags = capture_tags = {} # noqa
self.errors[9001001] = self.def_class(item = 9001, level = 3, tags = ["tag"], title = mapcss.tr(u'missing tag'))
self.errors[9001002] = self.def_class(item = 9001, level = 3, tags = ["tag"], title = mapcss.tr(u'suspicious tag combination'))
self.errors[9001003] = self.def_class(item = 9001, level = 3, tags = ["tag"], title = mapcss.tr(u'{0} on a relation without {1}', mapcss._tag_uncapture(capture_tags, u'{0.key}'), mapcss._tag_uncapture(capture_tags, u'{1.tag}')))
Expand Down
6 changes: 3 additions & 3 deletions plugins/Josm_de_openrailwaymap.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#-*- coding: utf-8 -*-
import modules.mapcss_lib as mapcss
import regex as re
import regex as re # noqa

from plugins.Plugin import with_options
from plugins.Plugin import with_options # noqa
from plugins.PluginMapCSS import PluginMapCSS


Expand All @@ -15,7 +15,7 @@ class Josm_de_openrailwaymap(PluginMapCSS):

def init(self, logger):
super().init(logger)
tags = capture_tags = {}
tags = capture_tags = {} # noqa
self.errors[9016001] = self.def_class(item = 9016, level = 2, tags = ["tag", "railway"], title = {'en': mapcss._tag_uncapture(capture_tags, u'{1.value} signals only exist as light signals')})
self.errors[9016002] = self.def_class(item = 9016, level = 2, tags = ["tag", "railway"], title = {'en': u'hp signals only exist as semaphore or light signals'})
self.errors[9016003] = self.def_class(item = 9016, level = 2, tags = ["tag", "railway"], title = {'en': u'KVB hp signals only exist as light signals'})
Expand Down
6 changes: 3 additions & 3 deletions plugins/Josm_deprecated.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#-*- coding: utf-8 -*-
import modules.mapcss_lib as mapcss
import regex as re
import regex as re # noqa

from plugins.Plugin import with_options
from plugins.Plugin import with_options # noqa
from plugins.PluginMapCSS import PluginMapCSS


Expand All @@ -13,7 +13,7 @@ class Josm_deprecated(PluginMapCSS):

def init(self, logger):
super().init(logger)
tags = capture_tags = {}
tags = capture_tags = {} # noqa
self.errors[9002001] = self.def_class(item = 9002, level = 3, tags = ["tag", "deprecated"], title = mapcss.tr(u'deprecated tagging'))
self.errors[9002002] = self.def_class(item = 9002, level = 3, tags = ["tag", "deprecated"], title = mapcss.tr(u'\'\'{0}\'\' is meaningless, use more specific tags, e.g. \'\'{1}\'\'', u'access=designated', u'bicycle=designated'))
self.errors[9002003] = self.def_class(item = 9002, level = 3, tags = ["tag", "deprecated"], title = mapcss.tr(u'\'\'{0}\'\' does not specify the official mode of transportation, use \'\'{1}\'\' for example', u'access=official', u'bicycle=official'))
Expand Down
6 changes: 3 additions & 3 deletions plugins/Josm_geometry.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#-*- coding: utf-8 -*-
import modules.mapcss_lib as mapcss
import regex as re
import regex as re # noqa

from plugins.Plugin import with_options
from plugins.Plugin import with_options # noqa
from plugins.PluginMapCSS import PluginMapCSS


Expand All @@ -13,7 +13,7 @@ class Josm_geometry(PluginMapCSS):

def init(self, logger):
super().init(logger)
tags = capture_tags = {}
tags = capture_tags = {} # noqa
self.errors[9003001] = self.def_class(item = 9003, level = 3, tags = ["geom"], title = mapcss.tr(u'{0} on a node. Should be used on a way.', mapcss._tag_uncapture(capture_tags, u'{0.tag}')))
self.errors[9003002] = self.def_class(item = 9003, level = 3, tags = ["geom"], title = mapcss.tr(u'{0} on a node. Should be used on a way or relation.', mapcss._tag_uncapture(capture_tags, u'{0.tag}')))
self.errors[9003003] = self.def_class(item = 9003, level = 3, tags = ["geom"], title = mapcss.tr(u'{0} on a node. Should be drawn as an area.', mapcss._tag_uncapture(capture_tags, u'{0.tag}')))
Expand Down
6 changes: 3 additions & 3 deletions plugins/Josm_highway.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#-*- coding: utf-8 -*-
import modules.mapcss_lib as mapcss
import regex as re
import regex as re # noqa

from plugins.Plugin import with_options
from plugins.Plugin import with_options # noqa
from plugins.PluginMapCSS import PluginMapCSS


Expand All @@ -13,7 +13,7 @@ class Josm_highway(PluginMapCSS):

def init(self, logger):
super().init(logger)
tags = capture_tags = {}
tags = capture_tags = {} # noqa
self.errors[9004001] = self.def_class(item = 9004, level = 3, tags = ["tag", "highway"], title = mapcss.tr(u'abbreviated street name'))
self.errors[9004002] = self.def_class(item = 9004, level = 3, tags = ["tag", "highway"], title = mapcss.tr(u'wrong crossing tag on a way'))
self.errors[9004004] = self.def_class(item = 9004, level = 3, tags = ["tag", "highway"], title = mapcss.tr(u'Unspecific highway type'))
Expand Down
6 changes: 3 additions & 3 deletions plugins/Josm_mtb.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#-*- coding: utf-8 -*-
import modules.mapcss_lib as mapcss
import regex as re
import regex as re # noqa

from plugins.Plugin import with_options
from plugins.Plugin import with_options # noqa
from plugins.PluginMapCSS import PluginMapCSS


Expand All @@ -12,7 +12,7 @@ class Josm_mtb(PluginMapCSS):

def init(self, logger):
super().init(logger)
tags = capture_tags = {}
tags = capture_tags = {} # noqa
self.errors[9013001] = self.def_class(item = 9013, level = 3, tags = ["tag", "sport"], title = mapcss.tr(u'Way contains \'\'{0}\'\' but not \'\'{1}\'\'.', mapcss._tag_uncapture(capture_tags, u'{0.key}'), mapcss._tag_uncapture(capture_tags, u'{1.key}')))
self.errors[9013002] = self.def_class(item = 9013, level = 3, tags = ["tag", "sport"], title = mapcss.tr(u'Way contains \'\'{0}\'\' but is neither a track nor a path.', mapcss._tag_uncapture(capture_tags, u'{0.key}')))
self.errors[9013003] = self.def_class(item = 9013, level = 3, tags = ["tag", "sport"], title = mapcss.tr(u'Invalid \'\'{0}\'\' value: \'\'{1}\'\'', mapcss._tag_uncapture(capture_tags, u'{0.key}'), mapcss._tag_uncapture(capture_tags, u'{0.value}')))
Expand Down
6 changes: 3 additions & 3 deletions plugins/Josm_multiple.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#-*- coding: utf-8 -*-
import modules.mapcss_lib as mapcss
import regex as re
import regex as re # noqa

from plugins.Plugin import with_options
from plugins.Plugin import with_options # noqa
from plugins.PluginMapCSS import PluginMapCSS


Expand All @@ -13,7 +13,7 @@ class Josm_multiple(PluginMapCSS):

def init(self, logger):
super().init(logger)
tags = capture_tags = {}
tags = capture_tags = {} # noqa
self.errors[9005001] = self.def_class(item = 9005, level = 3, tags = ["tag", "value"], title = mapcss.tr(u'{0} with multiple values', mapcss._tag_uncapture(capture_tags, u'{0.key}')))
self.errors[9005002] = self.def_class(item = 9005, level = 3, tags = ["tag", "value"], title = mapcss.tr(u'empty value in semicolon-separated \'\'{0}\'\'', mapcss._tag_uncapture(capture_tags, u'{0.key}')))

Expand Down
6 changes: 3 additions & 3 deletions plugins/Josm_numeric.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#-*- coding: utf-8 -*-
import modules.mapcss_lib as mapcss
import regex as re
import regex as re # noqa

from plugins.Plugin import with_options
from plugins.Plugin import with_options # noqa
from plugins.PluginMapCSS import PluginMapCSS


Expand All @@ -13,7 +13,7 @@ class Josm_numeric(PluginMapCSS):

def init(self, logger):
super().init(logger)
tags = capture_tags = {}
tags = capture_tags = {} # noqa
self.errors[9006001] = self.def_class(item = 9006, level = 3, tags = ["tag", "value"], title = mapcss.tr(u'numerical key'))
self.errors[9006002] = self.def_class(item = 9006, level = 3, tags = ["tag", "value"], title = mapcss.tr(u'{0} value with + sign', mapcss._tag_uncapture(capture_tags, u'{0.key}')))
self.errors[9006003] = self.def_class(item = 9006, level = 3, tags = ["tag", "value"], title = mapcss.tr(u'{0} should be an integer value between -5 and 5', mapcss._tag_uncapture(capture_tags, u'{0.key}')))
Expand Down
6 changes: 3 additions & 3 deletions plugins/Josm_openrailwaymap.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#-*- coding: utf-8 -*-
import modules.mapcss_lib as mapcss
import regex as re
import regex as re # noqa

from plugins.Plugin import with_options
from plugins.Plugin import with_options # noqa
from plugins.PluginMapCSS import PluginMapCSS


Expand All @@ -13,7 +13,7 @@ class Josm_openrailwaymap(PluginMapCSS):

def init(self, logger):
super().init(logger)
tags = capture_tags = {}
tags = capture_tags = {} # noqa
self.errors[9015001] = self.def_class(item = 9015, level = 2, tags = ["tag", "railway"], title = {'en': u'Track tagged with usage=* AND service=* - remove one of these tags'})
self.errors[9015002] = self.def_class(item = 9015, level = 2, tags = ["tag", "railway"], title = {'en': u'Station mapped as a way, but should be mapped as a node'})
self.errors[9015004] = self.def_class(item = 9015, level = 2, tags = ["tag", "railway"], title = {'en': u'Key traffic_mode is deprecated'})
Expand Down
Loading

0 comments on commit b791953

Please sign in to comment.