Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion my_venv/Lib/site-packages/coala_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

def get_version():
with open(VERSION_FILE, 'r') as ver:
return ver.readline().strip()
return ver.readline(5_000_000).strip()


VERSION = get_version()
2 changes: 1 addition & 1 deletion my_venv/Lib/site-packages/jedi/inference/sys_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def _get_buildout_script_paths(search_path: Path):
try:
filepath = bin_path.joinpath(filename)
with open(filepath, 'r') as f:
firstline = f.readline()
firstline = f.readline(5_000_000)
if firstline.startswith('#!') and 'python' in firstline:
yield filepath
except (UnicodeDecodeError, IOError) as e:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def main(fd, verbose=0):
fd = msvcrt.open_osfhandle(fd, os.O_RDONLY)
with open(fd, 'rb') as f:
while True:
line = f.readline()
line = f.readline(5_000_000)
if line == b'': # EOF
break
try:
Expand Down
2 changes: 1 addition & 1 deletion my_venv/Lib/site-packages/nltk/corpus/reader/nkjp.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def build_preprocessed_file(self):
fw = self.write_file
line = " "
while len(line):
line = fr.readline()
line = fr.readline(5_000_000)
x = re.split(r"nkjp:[^ ]* ", line) # in all files
ret = " ".join(x)
x = re.split("<nkjp:paren>", ret) # in ann_segmentation.xml
Expand Down
2 changes: 1 addition & 1 deletion my_venv/Lib/site-packages/nltk/corpus/reader/xmldocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def _detect_encoding(self, fileid):
infile.close()
else:
with open(fileid, "rb") as infile:
s = infile.readline()
s = infile.readline(5_000_000)
if s.startswith(codecs.BOM_UTF16_BE):
return "utf-16-be"
if s.startswith(codecs.BOM_UTF16_LE):
Expand Down
2 changes: 1 addition & 1 deletion my_venv/Lib/site-packages/numpy/distutils/ccompiler_opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -2578,7 +2578,7 @@ def _generate_config(self, output_dir, dispatch_src, targets, has_baseline=False
cache_hash = self.cache_hash(targets, has_baseline)
try:
with open(config_path) as f:
last_hash = f.readline().split("cache_hash:")
last_hash = f.readline(5_000_000).split("cache_hash:")
if len(last_hash) == 2 and int(last_hash[1]) == cache_hash:
return True
except OSError:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ def swig_sources(self, sources, extension):
def get_swig_target(source):
with open(source, 'r') as f:
result = None
line = f.readline()
line = f.readline(5_000_000)
if _has_cpp_header(line):
result = 'c++'
if _has_c_header(line):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ def is_free_format(file):
# signs of free format are detected.
result = 0
with open(file, encoding='latin1') as f:
line = f.readline()
line = f.readline(5_000_000)
n = 10000 # the number of non-comment lines to scan for hints
if _has_f_header(line) or _has_fix_header(line):
n = 0
Expand All @@ -996,12 +996,12 @@ def is_free_format(file):
if (line[0]!='\t' and _free_f90_start(line[:5])) or line[-1:]=='&':
result = 1
break
line = f.readline()
line = f.readline(5_000_000)
return result

def has_f90_header(src):
with open(src, encoding='latin1') as f:
line = f.readline()
line = f.readline(5_000_000)
return _has_f90_header(line) or _has_fix_header(line)

_f77flags_re = re.compile(r'(c|)f77flags\s*\(\s*(?P<fcname>\w+)\s*\)\s*=\s*(?P<fflags>.*)', re.I)
Expand Down
4 changes: 2 additions & 2 deletions my_venv/Lib/site-packages/numpy/f2py/crackfortran.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ def is_free_format(file):
# signs of free format are detected.
result = 0
with open(file, 'r') as f:
line = f.readline()
line = f.readline(5_000_000)
n = 15 # the number of non-comment lines to scan for hints
if _has_f_header(line):
n = 0
Expand All @@ -320,7 +320,7 @@ def is_free_format(file):
if (line[0] != '\t' and _free_f90_start(line[:5])) or line[-2:-1] == '&':
result = 1
break
line = f.readline()
line = f.readline(5_000_000)
return result


Expand Down
2 changes: 1 addition & 1 deletion my_venv/Lib/site-packages/numpy/lib/tests/test_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ def test_version_2_0():

# check alignment of data portion
f.seek(0)
header = f.readline()
header = f.readline(5_000_000)
assert_(len(header) % format.ARRAY_ALIGN == 0)

f.seek(0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def setup_class(cls):
@classmethod
def _read_csv(cls, filename):
with open(filename) as csv:
seed = csv.readline()
seed = csv.readline(5_000_000)
seed = seed.split(',')
seed = [int(s.strip(), 0) for s in seed[1:]]
data = []
Expand Down
4 changes: 2 additions & 2 deletions my_venv/Lib/site-packages/numpy/testing/_private/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def memusage(_proc_pid_stat=f'/proc/{os.getpid()}/stat'):
"""
try:
with open(_proc_pid_stat, 'r') as f:
l = f.readline().split(' ')
l = f.readline(5_000_000).split(' ')
return int(l[22])
except Exception:
return
Expand All @@ -222,7 +222,7 @@ def jiffies(_proc_pid_stat=f'/proc/{os.getpid()}/stat', _load_time=[]):
_load_time.append(time.time())
try:
with open(_proc_pid_stat, 'r') as f:
l = f.readline().split(' ')
l = f.readline(5_000_000).split(' ')
return int(l[13])
except Exception:
return int(100*(time.time()-_load_time[0]))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ def test_read_seek(all_parsers):
with tm.ensure_clean() as path:
Path(path).write_text(prefix + content)
with open(path, encoding="utf-8") as file:
file.readline()
file.readline(5_000_000)
actual = parser.read_csv(file)
expected = parser.read_csv(StringIO(content))
tm.assert_frame_equal(actual, expected)
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def fix_script(path: str) -> bool:
assert os.path.isfile(path)

with open(path, "rb") as script:
firstline = script.readline()
firstline = script.readline(5_000_000)
if not firstline.startswith(b"#!python"):
return False
exename = sys.executable.encode(sys.getfilesystemencoding())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ def from_dist(cls, dist: BaseDistribution) -> "UninstallPathSet":
# PEP 660 modern editable is handled in the ``.dist-info`` case
# above, so this only covers the setuptools-style editable.
with open(develop_egg_link) as fh:
link_pointer = os.path.normcase(fh.readline().strip())
link_pointer = os.path.normcase(fh.readline(5_000_000).strip())
normalized_link_pointer = normalize_path(link_pointer)
assert os.path.samefile(
normalized_link_pointer, normalized_dist_location
Expand Down
2 changes: 1 addition & 1 deletion my_venv/Lib/site-packages/pip/_vendor/distlib/scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ def _copy_script(self, script, filenames):
raise
f = None
else:
first_line = f.readline()
first_line = f.readline(5_000_000)
if not first_line: # pragma: no cover
logger.warning('%s is an empty file (skipping)', script)
return
Expand Down
2 changes: 1 addition & 1 deletion my_venv/Lib/site-packages/pip/_vendor/distro/distro.py
Original file line number Diff line number Diff line change
Expand Up @@ -1294,7 +1294,7 @@ def _parse_distro_release_file(self, filepath: str) -> Dict[str, str]:
with open(filepath, encoding="utf-8") as fp:
# Only parse the first line. For instance, on SLES there
# are multiple lines. We don't want them...
return self._parse_distro_release_content(fp.readline())
return self._parse_distro_release_content(fp.readline(5_000_000))
except OSError:
# Ignore not being able to read a specific, seemingly version
# related file.
Expand Down
6 changes: 3 additions & 3 deletions my_venv/Lib/site-packages/pythonwin/pywin/Demos/dibdemo.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ def __init__(self, filename, *bPBM):
f = open(filename, "rb")
dib = win32ui.CreateDIBitmap()
if len(bPBM) > 0:
magic = f.readline()
magic = f.readline(5_000_000)
if magic != "P6\n":
print("The file is not a PBM format file")
raise ValueError("Failed - The file is not a PBM format file")
# check magic?
rowcollist = f.readline().split()
rowcollist = f.readline(5_000_000).split()
cols = int(rowcollist[0])
rows = int(rowcollist[1])
f.readline() # whats this one?
f.readline(5_000_000) # whats this one?
dib.LoadPBMData(f, (cols, rows))
else:
dib.LoadWindowsFormatFile(f)
Expand Down
6 changes: 3 additions & 3 deletions my_venv/Lib/site-packages/pythonwin/pywin/scintilla/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,12 @@ def __init__(self, f):
fp = open(f)
self.cache = {}
lineno = 1
line = fp.readline()
line = fp.readline(5_000_000)
while line:
# Skip to the next section (maybe already there!)
section, subsection = get_section_header(line)
while line and section is None:
line = fp.readline()
line = fp.readline(5_000_000)
if not line:
break
lineno = lineno + 1
Expand All @@ -148,7 +148,7 @@ def __init__(self, f):
self.report_error(
"Unrecognised section header '%s:%s'" % (section, subsection)
)
line = fp.readline()
line = fp.readline(5_000_000)
lineno = lineno + 1
# Check critical data.
if not self.cache.get("keys"):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def copy_scripts(self):
else:
encoding, lines = tokenize.detect_encoding(f.readline)
f.seek(0)
first_line = f.readline()
first_line = f.readline(5_000_000)
if not first_line:
self.warn("%s is an empty file (skipping)" % script)
continue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def search_cpp(self, pattern, body=None, headers=None, include_dirs=None,
with open(out) as file:
match = False
while True:
line = file.readline()
line = file.readline(5_000_000)
if line == '':
break
if pattern.search(line):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ def _manifest_is_not_generated(self):

fp = open(self.manifest)
try:
first_line = fp.readline()
first_line = fp.readline(5_000_000)
finally:
fp.close()
return first_line != '# file GENERATED by distutils, do NOT edit\n'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,12 +280,12 @@ def test_dump():
)
f.seek(0)

comment = f.readline()
comment = f.readline(5_000_000)
comment = str(comment, "utf-8")

assert "scikit-learn %s" % sklearn.__version__ in comment

comment = f.readline()
comment = f.readline(5_000_000)
comment = str(comment, "utf-8")

assert ["one", "zero"][zero_based] + "-based" in comment
Expand Down Expand Up @@ -323,9 +323,9 @@ def test_dump_multilabel():
dump_svmlight_file(X, y, f, multilabel=True)
f.seek(0)
# make sure it dumps multilabel correctly
assert f.readline() == b"1 0:1 2:3 4:5\n"
assert f.readline() == b"0,2 \n"
assert f.readline() == b"0,1 1:5 3:1\n"
assert f.readline(5_000_000) == b"1 0:1 2:3 4:5\n"
assert f.readline(5_000_000) == b"0,2 \n"
assert f.readline(5_000_000) == b"0,1 1:5 3:1\n"


def test_dump_concise():
Expand All @@ -347,11 +347,11 @@ def test_dump_concise():
dump_svmlight_file(X, y, f)
f.seek(0)
# make sure it's using the most concise format possible
assert f.readline() == b"1 0:1 1:2.1 2:3.01 3:1.000000000000001 4:1\n"
assert f.readline() == b"2.1 0:1000000000 1:2e+18 2:3e+27\n"
assert f.readline() == b"3.01 \n"
assert f.readline() == b"1.000000000000001 \n"
assert f.readline() == b"1 \n"
assert f.readline(5_000_000) == b"1 0:1 1:2.1 2:3.01 3:1.000000000000001 4:1\n"
assert f.readline(5_000_000) == b"2.1 0:1000000000 1:2e+18 2:3e+27\n"
assert f.readline(5_000_000) == b"3.01 \n"
assert f.readline(5_000_000) == b"1.000000000000001 \n"
assert f.readline(5_000_000) == b"1 \n"
f.seek(0)
# make sure it's correct too :)
X2, y2 = load_svmlight_file(f)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ def test_verbose_output():

# check output
verbose_output.seek(0)
header = verbose_output.readline().rstrip()
header = verbose_output.readline(5_000_000).rstrip()
# with OOB
true_header = " ".join(["%10s"] + ["%16s"] * 3) % (
"Iter",
Expand Down Expand Up @@ -818,7 +818,7 @@ def test_more_verbose_output():

# check output
verbose_output.seek(0)
header = verbose_output.readline().rstrip()
header = verbose_output.readline(5_000_000).rstrip()
# no OOB
true_header = " ".join(["%10s"] + ["%16s"] * 2) % (
"Iter",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ def test_rfecv_verbose_output():

verbose_output = sys.stdout
verbose_output.seek(0)
assert len(verbose_output.readline()) > 0
assert len(verbose_output.readline(5_000_000)) > 0


def test_rfecv_cv_results_size():
Expand Down
4 changes: 2 additions & 2 deletions my_venv/Lib/site-packages/werkzeug/debug/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def _generate() -> t.Optional[t.Union[str, bytes]]:
for filename in "/etc/machine-id", "/proc/sys/kernel/random/boot_id":
try:
with open(filename, "rb") as f:
value = f.readline().strip()
value = f.readline(5_000_000).strip()
except OSError:
continue

Expand All @@ -70,7 +70,7 @@ def _generate() -> t.Optional[t.Union[str, bytes]]:
# relatively stable across boots.
try:
with open("/proc/self/cgroup", "rb") as f:
linux += f.readline().strip().rpartition(b"/")[2]
linux += f.readline(5_000_000).strip().rpartition(b"/")[2]
except OSError:
pass

Expand Down