Skip to content

Commit

Permalink
Code clean
Browse files Browse the repository at this point in the history
  • Loading branch information
frodrigo committed May 2, 2020
1 parent c927e8b commit 66eb693
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 17 deletions.
2 changes: 1 addition & 1 deletion analysers/Analyser_Merge_Geocode_Addok_CSV.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def fetch(self, url, tmp_file, date_string=None):
slices = int((len(content)-1) / step) + 1
for i in range(0, slices):
self.logger.log("Geocode slice {0}/{1}".format(i, slices))
slice = ''.join(header + content[1 + step*i : 1 + step*(i+1)])
slice = ''.join(header + content[1 + step*i : 1 + step*(i+1)]) # noqa
r = downloader.requests_retry_session().post(url=service, data={
'delimiter': self.delimiter,
'encoding': self.encoding,
Expand Down
1 change: 0 additions & 1 deletion conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Used by pytest to ignore some tests
import sys

collect_ignore = [
"plugins/Josm_de_openrailwaymap.py",
Expand Down
2 changes: 1 addition & 1 deletion modules/oh_sanitizer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
__author__ = "rezemika <reze.mika@gmail.com>"
__licence__ = "AGPLv3"

from .main import sanitize_field, SanitizeError, InconsistentField
from .main import sanitize_field, SanitizeError, InconsistentField # noqa
10 changes: 5 additions & 5 deletions osmose_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ class gen(default_country):
default_country("asia", "bahrain", 378734, {"country": "BH", "language": "ar","proj": 32639}, download_repo=OSMFR)
default_country("asia", "bhutan", 184629, {"country": "BT", "language": ["dz", "en"], "proj": 32646}, download_repo=OSMFR)
default_country("asia", "brunei", 2103120, {"country": "BN", "driving_side": "left", "language": "ms", "proj": 32650}, download_repo=OSMFR)
default_country("asia", "cambodia", 49898 , {"country": "KHM", "language": "km", "proj": 32648}, download_repo=OSMFR)
default_country("asia", "cambodia", 49898, {"country": "KHM", "language": "km", "proj": 32648}, download_repo=OSMFR)
default_country("asia", "east_timor", 305142, {"country": "TL", "language": "pt", "proj": 32651}, download_repo=OSMFR)
default_country("asia", "georgia", 28699, {"country": "GE", "language": "ka", "proj": 32637}, download_repo=OSMFR)
default_country("asia", "israel", 1473946, {"country": "IL", "language": ["he", "ar"], "proj": 32636}, download_repo=OSMFR)
Expand All @@ -979,7 +979,7 @@ class gen(default_country):
default_country("asia", "kyrgyzstan", 178009, {"country": "KG", "language": ["ky", "ru"], "proj": 32643})
default_country("asia", "laos", 49903, {"country": "LA", "language": ["lo", "en"], "proj": 32648}, download_repo=OSMFR)
default_country("asia", "lebanon", 184843, {"country": "LB", "language": "ar", "proj": 32636})
default_country("asia", "malaysia", 2108121 , {"country": "MY", "language": "ms", "driving_side": "left", "proj": 32649}, download_repo=OSMFR)
default_country("asia", "malaysia", 2108121, {"country": "MY", "language": "ms", "driving_side": "left", "proj": 32649}, download_repo=OSMFR)
default_country("asia", "maldives", 536773, {"country": "MV", "language": "dv", "proj": 32643}, download_repo=OSMFR)
default_country("asia", "mongolia", 161033, {"country": "MN", "language": "mn", "proj": 32648})
default_country("asia", "myanmar", 50371, {"country": "MM", "language": "my", "proj": 32646}, download_repo=OSMFR)
Expand All @@ -991,7 +991,7 @@ class gen(default_country):
default_country("asia", "philippines", 2850940, {"country": "PH", "language": "en", "proj": 32651, 'phone_code': '63', 'phone_len': [7, 8], 'phone_international': '00'}, download_repo=GEOFABRIK)
default_country("asia", "qatar", 305095, {"country": "QA", "language": "ar","proj": 32639}, download_repo=OSMFR)
default_country("asia", "saudi_arabia", 307584, {"country": "SA", "language": "ar","proj": 32637}, download_repo=OSMFR)
default_country("asia", "singapore", 536780 , {"country": "SG", "language": "en", "driving_side": "left", "proj": 32648}, download_repo=OSMFR)
default_country("asia", "singapore", 536780, {"country": "SG", "language": "en", "driving_side": "left", "proj": 32648}, download_repo=OSMFR)
default_country("asia", "sri-lanka", 536807, {"country": "LK", "language": ["en", "si", "ta"], "driving_side": "left", "proj": 32644})
default_country("asia", "south_korea", 307756, {"country": "KR", "language": "ko", "proj": 32652}, download_country="south-korea")
default_country("asia", "syria", 184840, {"country": "SY", "language": "ar", "proj": 32637})
Expand Down Expand Up @@ -1101,7 +1101,7 @@ class gen(default_country):
#########################################################################

default_country("merge", "fiji", 571747, {"country": "FJ", "language": "en", "driving_side": "left", "proj": 32660}, download_repo=OSMFR)
default_country("merge", "kiribati", 571178 , {"country": "KL", "language": "en", "driving_side": "left", "proj": 32660}, download_repo=OSMFR)
default_country("merge", "kiribati", 571178, {"country": "KL", "language": "en", "driving_side": "left", "proj": 32660}, download_repo=OSMFR)

#########################################################################

Expand Down Expand Up @@ -1135,7 +1135,7 @@ class gen(default_country):
default_country("south-america", "paraguay", 287077, {"country": "PY", "language": "es", "proj": 32721}, download_repo=OSMFR)
default_country("south-america", "peru", 288247, {"country": "PE", "language": "es", "proj": 32718})
default_country("south-america", "samoa", 1872673, {"country": "WS", "language": "en", "driving_side": "left", "speed_limit_unit": "mph", "proj": 32602}, download_repo=OSMFR)
default_country("south-america", "tonga", 2186665 , {"country": "TO", "language": "en", "driving_side": "left", "proj": 32601}, download_repo=OSMFR)
default_country("south-america", "tonga", 2186665, {"country": "TO", "language": "en", "driving_side": "left", "proj": 32601}, download_repo=OSMFR)
default_country("south-america", "trinidad_and_tobago", 555717, {"country": "TT", "language": "en", "driving_side": "left","proj": 32620}, download_repo=OSMFR)
default_country("south-america", "suriname", 287082, {"country": "SR", "language": "nl", "driving_side": "left", "proj": 32621}, download_repo=OSMFR)
default_country("south-america", "united_kingdom_falkland", 2185374, {"country": "FK", "language": "en", "driving_side": "left", "proj": 32721}, download_repo=OSMFR, download_country="falkland")
Expand Down
2 changes: 1 addition & 1 deletion osmose_config_password-example.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#-*- coding: utf-8 -*-

def set_password(config):
for country in config.keys():
for country in config.keys():
for k in config[country].analyser.keys():
config[country].analyser[k] = 'foo'
10 changes: 5 additions & 5 deletions osmose_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def execc(conf, logger, options, osmosis_manager):
logger.sub().sub().sub().err('got an HTTP timeout status')
else:
dt = r.text.strip()
logger.sub().sub().sub().err(u"UPDATE ERROR %s/%s : %s\n"%(country, analyser_name, dt))
logger.sub().sub().sub().err(u"UPDATE ERROR %s/%s : %s\n" % (country, analyser_name, dt))
if dt == "FAIL: Already up to date":
update_finished = True
if not was_on_timeout:
Expand Down Expand Up @@ -329,8 +329,8 @@ def clean(conf, logger, options, osmosis_manager):
f = ".osm".join(conf.download["dst"].split(".osm")[:-1])
for ext in ["osm", "osm.bz2", "osm.pbf"]:
try:
os.remove("%s.%s"%(f, ext))
logger.sub().log("DROP FILE %s.%s"%(f, ext))
os.remove("%s.%s" % (f, ext))
logger.sub().log("DROP FILE %s.%s" % (f, ext))
except:
pass

Expand Down Expand Up @@ -493,9 +493,9 @@ def run(conf, logger, options):
lfil = "/tmp/analyse-{0}-{1}".format(country, base)
lock = lockfile(lfil)
except:
logger.err("can't lock %s"%country)
logger.err("can't lock %s" % country)
if options.cron:
sys.stderr.write("can't lock %s\n"%country)
sys.stderr.write("can't lock %s\n" % country)
for l in open(lfil).read().rstrip().split("\n"):
logger.log(" "+l)
if options.cron:
Expand Down
4 changes: 2 additions & 2 deletions tools/logs-buildbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def analyse_log(filename):
if cur_task and not "iteration=" in cur_task:
tasks[cur_task] = cur_timestamp - first_task_timestamp
cur_task = new_task
first_task_timestamp = cur_timestamp
first_task_timestamp = cur_timestamp # noqa

if first_timestamp is None:
return None
Expand Down Expand Up @@ -247,7 +247,7 @@ def str_timedelta_empty(print_day=False):
color = None
attrs = None
try:
val = str_timedelta(stats[i]["tasks"][taskname], print_day=tasks_longest[taskname][0].days)
val = str_timedelta(stats[i]["tasks"][taskname], print_day=tasks_longest[taskname][0].days)
except:
val = str_timedelta_empty()
print(colored(val, color, attrs=attrs), end=' ')
Expand Down
2 changes: 1 addition & 1 deletion tools/logs-jenkins.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def analyse_log(filename):
if cur_task and not "iteration=" in cur_task:
tasks[cur_task] = cur_timestamp - first_task_timestamp
cur_task = new_task
first_task_timestamp = cur_timestamp
first_task_timestamp = cur_timestamp # noqa

if first_timestamp is None:
return None
Expand Down

0 comments on commit 66eb693

Please sign in to comment.