Skip to content

Commit 3ce81cb

Browse files
committed
Linting fix: raise from
1 parent dadc03a commit 3ce81cb

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

delphin/tdl.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,8 @@ def _bounded(p1, p2, line, pos, line_no, lines):
989989
pattern = 'docstring' if p1 == '"""' else 'block comment'
990990
raise TDLSyntaxError(
991991
f'unterminated {pattern}',
992-
lineno=start_line_no)
992+
lineno=start_line_no
993+
) from None
993994
pos = end = 0
994995
substrings.append(line[pos:end])
995996
end += len(p2)
@@ -1094,7 +1095,7 @@ def _parse_tdl(tokens, path):
10941095
if environment is not None and obj is not None:
10951096
environment.entries.append(obj)
10961097
except StopIteration:
1097-
raise TDLSyntaxError('unexpected end of input.')
1098+
raise TDLSyntaxError('unexpected end of input.') from None
10981099

10991100

11001101
def _parse_tdl_definition(identifier, tokens):

delphin/util.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -447,12 +447,12 @@ def next(self, skip=None):
447447
popleft()
448448
except IndexError:
449449
if not self._buffer_fill():
450-
raise StopIteration
450+
raise StopIteration from None
451451
try:
452452
datum = popleft()
453453
except IndexError:
454454
if not self._buffer_fill():
455-
raise StopIteration
455+
raise StopIteration from None
456456
datum = popleft()
457457
return datum
458458

@@ -471,7 +471,7 @@ def peek(self, n=0, skip=None, drop=False):
471471
datum = popleft()
472472
except IndexError:
473473
if not self._buffer_fill():
474-
raise StopIteration
474+
raise StopIteration from None
475475
datum = popleft()
476476
if not skip(datum):
477477
n -= 1

delphin/web/server.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@ def on_get(self, req, resp):
226226
def on_get_name(self, req, resp, name):
227227
try:
228228
entry = self.index[name]
229-
except KeyError:
230-
raise falcon.HTTPNotFound()
229+
except KeyError as e:
230+
raise falcon.HTTPNotFound() from e
231231
ts = itsdb.TestSuite(entry['path'])
232232
quote = urllib.parse.quote
233233
base = req.uri
@@ -238,8 +238,8 @@ def on_get_name(self, req, resp, name):
238238
def on_get_table(self, req, resp, name, table):
239239
try:
240240
entry = self.index[name]
241-
except KeyError:
242-
raise falcon.HTTPNotFound()
241+
except KeyError as e:
242+
raise falcon.HTTPNotFound() from e
243243
ts = itsdb.TestSuite(entry['path'])
244244
table_ = ts[table]
245245

0 commit comments

Comments
 (0)