Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changed all python variables named file to file_name to not override built_in file #2830

Merged
merged 1 commit into from
Sep 6, 2017
Merged
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
6 changes: 3 additions & 3 deletions notebook/nbextensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,9 @@ def install_nbextension(path, overwrite=False, symlink=False,
if logger:
logger.info("Making directory: %s" % dest_dir)
os.makedirs(dest_dir)
for file in files:
src = pjoin(parent, file)
dest_file = pjoin(dest_dir, file)
for file_name in files:
src = pjoin(parent, file_name)
dest_file = pjoin(dest_dir, file_name)
_maybe_copy(src, dest_file, logger=logger)
else:
src = path
Expand Down
8 changes: 4 additions & 4 deletions notebook/notebookapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -1515,9 +1515,9 @@ def list_running_servers(runtime_dir=None):
if not os.path.isdir(runtime_dir):
return

for file in os.listdir(runtime_dir):
if file.startswith('nbserver-'):
with io.open(os.path.join(runtime_dir, file), encoding='utf-8') as f:
for file_name in os.listdir(runtime_dir):
if file_name.startswith('nbserver-'):
with io.open(os.path.join(runtime_dir, file_name), encoding='utf-8') as f:
info = json.load(f)

# Simple check whether that process is really still running
Expand All @@ -1527,7 +1527,7 @@ def list_running_servers(runtime_dir=None):
else:
# If the process has died, try to delete its info file
try:
os.unlink(os.path.join(runtime_dir, file))
os.unlink(os.path.join(runtime_dir, file_name))
except OSError:
pass # TODO: This should warn or log or something
#-----------------------------------------------------------------------------
Expand Down
28 changes: 14 additions & 14 deletions notebook/tests/test_nbextensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@
from traitlets.config.manager import BaseJSONConfigManager


def touch(file, mtime=None):
def touch(file_name, mtime=None):
"""ensure a file exists, and set its modification time

returns the modification time of the file
"""
open(file, 'a').close()
open(file_name, 'a').close()
# set explicit mtime
if mtime:
atime = os.stat(file).st_atime
os.utime(file, (atime, mtime))
return os.stat(file).st_mtime
atime = os.stat(file_name).st_atime
os.utime(file_name, (atime, mtime))
return os.stat(file_name).st_mtime


def test_help_output():
Expand Down Expand Up @@ -77,8 +77,8 @@ def cleanup_tempdirs():
pjoin(u'∂ir', u'ƒile1'),
pjoin(u'∂ir', u'∂ir2', u'ƒile2'),
]
for file in files:
fullpath = os.path.join(self.src, file)
for file_name in files:
fullpath = os.path.join(self.src, file_name)
parent = os.path.dirname(fullpath)
if not os.path.exists(parent):
os.makedirs(parent)
Expand Down Expand Up @@ -144,9 +144,9 @@ def test_create_data_dir(self):
}):
install_nbextension(self.src, user=True)
self.assert_dir_exists(data_dir)
for file in self.files:
for file_name in self.files:
self.assert_installed(
pjoin(basename(self.src), file),
pjoin(basename(self.src), file_name),
user=True,
)

Expand All @@ -169,9 +169,9 @@ def test_create_nbextensions_system(self):
)

def test_single_file(self):
file = self.files[0]
install_nbextension(pjoin(self.src, file))
self.assert_installed(file)
file_name = self.files[0]
install_nbextension(pjoin(self.src, file_name))
self.assert_installed(file_name)

def test_single_dir(self):
d = u'∂ir'
Expand All @@ -188,8 +188,8 @@ def test_single_dir_trailing_slash(self):
self.assert_installed(self.files[-1])

def test_destination_file(self):
file = self.files[0]
install_nbextension(pjoin(self.src, file), destination = u'ƒiledest')
file_name = self.files[0]
install_nbextension(pjoin(self.src, file_name), destination = u'ƒiledest')
self.assert_installed(u'ƒiledest')

def test_destination_dir(self):
Expand Down