Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f2da2a2

Browse files
committed
unsafe ruff fixes
1 parent 389390c commit f2da2a2

4 files changed

Lines changed: 4 additions & 7 deletions

File tree

IPython/core/history.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -580,8 +580,7 @@ def get_range_by_str(
580580
Tuples as :meth:`get_range`
581581
"""
582582
for sess, s, e in extract_hist_ranges(rangestr):
583-
for line in self.get_range(sess, s, e, raw=raw, output=output):
584-
yield line
583+
yield from self.get_range(sess, s, e, raw=raw, output=output)
585584

586585

587586
class HistoryManager(HistoryAccessor):

IPython/lib/latextools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Copyright (c) IPython Development Team.
55
# Distributed under the terms of the Modified BSD License.
66

7-
from io import BytesIO, open
7+
from io import BytesIO
88
import os
99
import tempfile
1010
import shutil

IPython/utils/openpy.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ def strip_encoding_cookie(filelike):
5555
except StopIteration:
5656
return
5757

58-
for line in it:
59-
yield line
58+
yield from it
6059

6160
def read_py_file(filename, skip_encoding_cookie=True):
6261
"""Read a Python file, using the encoding declared inside the file.

IPython/utils/tokenutil.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ class Token(NamedTuple):
2323
def generate_tokens(readline) -> Generator[TokenInfo, None, None]:
2424
"""wrap generate_tkens to catch EOF errors"""
2525
try:
26-
for token in tokenize.generate_tokens(readline):
27-
yield token
26+
yield from tokenize.generate_tokens(readline)
2827
except tokenize.TokenError:
2928
# catch EOF error
3029
return

0 commit comments

Comments
 (0)