Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Pelloin
svd2vec
Commits
d7c1d394
Commit
d7c1d394
authored
Apr 23, 2020
by
Valentin Pelloin
Browse files
check notebook function updated
parent
e6fdd66d
Changes
1
Hide whitespace changes
Inline
Side-by-side
svd2vec/utils.py
View file @
d7c1d394
...
...
@@ -48,11 +48,23 @@ class Utils:
def
running_notebook
():
# Returns True if the current code is running in a Jupyter Notebook,
# False otherwise
if
'IPython'
in
sys
.
modules
:
from
IPython
import
get_ipython
return
'IPKernelApp'
in
get_ipython
().
config
else
:
return
False
# if 'IPython' in sys.modules:
# from IPython import get_ipython
# return 'IPKernelApp' in get_ipython().config
# else:
# return False
# from https://stackoverflow.com/a/39662359
try
:
shell
=
get_ipython
().
__class__
.
__name__
if
shell
==
'ZMQInteractiveShell'
:
return
True
# Jupyter notebook or qtconsole
elif
shell
==
'TerminalInteractiveShell'
:
return
False
# Terminal running IPython
else
:
return
False
# Other type (?)
except
NameError
:
return
False
# Probably standard Python interpreter
def
parse_csv
(
file_path
,
delimiter
,
comment
=
"#"
):
# Returns a list of lines, each line being a list of cells
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment