We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 134ac92 commit d68de02Copy full SHA for d68de02
build/sage_bootstrap/package.py
@@ -380,14 +380,15 @@ def line_count_file(self, filename):
380
381
integer; 0 if the file cannot be read, 1 if it is a symlink
382
"""
383
- filename = os.path.join(self.path, filename)
384
- if os.path.islink(filename):
+ path = os.path.join(self.path, filename)
+ if os.path.islink(path):
385
return 1
386
- if os.path.isdir(filename):
+ if os.path.isdir(path):
387
return sum(self.line_count_file(os.path.join(filename, entry))
388
- for entry in os.listdir(filename))
+ for entry in os.listdir(path))
389
try:
390
- return len(list(open(filename, "rb")))
+ with open(path, "rb") as f:
391
+ return len(list(f))
392
except OSError:
393
return 0
394
0 commit comments