Skip to content

Commit 4443cb7

Browse files
committed
src - Fix import and source
1 parent 57d3e5b commit 4443cb7

File tree

1 file changed

+24
-17
lines changed

1 file changed

+24
-17
lines changed

overpy/__init__.py

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
import time
1010

1111
from overpy import exception
12-
from overpy.__about__ import (
12+
# Ignore flake8 F401 warning for unused vars
13+
from overpy.__about__ import ( # noqa: F401
1314
__author__, __copyright__, __email__, __license__, __summary__, __title__,
1415
__uri__, __version__
1516
)
@@ -52,7 +53,13 @@ class Overpass:
5253
default_retry_timeout = 1.0
5354
default_url = "http://overpass-api.de/api/interpreter"
5455

55-
def __init__(self, read_chunk_size=None, url=None, xml_parser=XML_PARSER_SAX, max_retry_count=None, retry_timeout=None):
56+
def __init__(
57+
self,
58+
read_chunk_size=None,
59+
url=None,
60+
xml_parser=XML_PARSER_SAX,
61+
max_retry_count=None,
62+
retry_timeout=None):
5663
"""
5764
:param read_chunk_size: Max size of each chunk read from the server response
5865
:type read_chunk_size: Integer
@@ -142,10 +149,10 @@ def query(self, query):
142149
if content_type == "application/osm3s+xml":
143150
return self.parse_xml(response)
144151

145-
e = exception.OverpassUnknownContentType(content_type)
152+
current_exception = exception.OverpassUnknownContentType(content_type)
146153
if not do_retry:
147-
raise e
148-
retry_exceptions.append(e)
154+
raise current_exception
155+
retry_exceptions.append(current_exception)
149156
continue
150157

151158
if f.code == 400:
@@ -158,33 +165,33 @@ def query(self, query):
158165
tmp = repr(tmp)
159166
msgs.append(tmp)
160167

161-
e = exception.OverpassBadRequest(
168+
current_exception = exception.OverpassBadRequest(
162169
query,
163170
msgs=msgs
164171
)
165172
if not do_retry:
166-
raise e
167-
retry_exceptions.append(e)
173+
raise current_exception
174+
retry_exceptions.append(current_exception)
168175
continue
169176

170177
if f.code == 429:
171-
e = exception.OverpassTooManyRequests
178+
current_exception = exception.OverpassTooManyRequests
172179
if not do_retry:
173-
raise e
174-
retry_exceptions.append(e)
180+
raise current_exception
181+
retry_exceptions.append(current_exception)
175182
continue
176183

177184
if f.code == 504:
178-
e = exception.OverpassGatewayTimeout
185+
current_exception = exception.OverpassGatewayTimeout
179186
if not do_retry:
180-
raise e
181-
retry_exceptions.append(e)
187+
raise current_exception
188+
retry_exceptions.append(current_exception)
182189
continue
183190

184-
e = exception.OverpassUnknownHTTPStatusCode(f.code)
191+
current_exception = exception.OverpassUnknownHTTPStatusCode(f.code)
185192
if not do_retry:
186-
raise e
187-
retry_exceptions.append(e)
193+
raise current_exception
194+
retry_exceptions.append(current_exception)
188195
continue
189196

190197
raise exception.MaxRetriesReached(retry_count=retry_num, exceptions=retry_exceptions)

0 commit comments

Comments
 (0)