Commit 23b9cc45 authored by Ivan Tyagov's avatar Ivan Tyagov

Clean up unused variables.

parent 1174b7f2
...@@ -180,7 +180,6 @@ def Base_runJupyterCode(self, jupyter_code, old_notebook_context): ...@@ -180,7 +180,6 @@ def Base_runJupyterCode(self, jupyter_code, old_notebook_context):
# Saving the initial globals dict so as to compare it after code execution # Saving the initial globals dict so as to compare it after code execution
globals_dict = globals() globals_dict = globals()
result_string = ''
notebook_context = old_notebook_context notebook_context = old_notebook_context
# Execute only if jupyter_code is not empty # Execute only if jupyter_code is not empty
...@@ -432,8 +431,7 @@ class EnvironmentDefinitionError(TypeError): ...@@ -432,8 +431,7 @@ class EnvironmentDefinitionError(TypeError):
def canSerialize(obj): def canSerialize(obj):
result = False
container_type_tuple = (list, tuple, dict, set, frozenset) container_type_tuple = (list, tuple, dict, set, frozenset)
# if object is a container, we need to check its elements for presence of # if object is a container, we need to check its elements for presence of
...@@ -479,7 +477,7 @@ def canSerialize(obj): ...@@ -479,7 +477,7 @@ def canSerialize(obj):
# #
# Even though the issue seems complicated, this quickfix should be # Even though the issue seems complicated, this quickfix should be
# properly rewritten in a better way as soon as possible. # properly rewritten in a better way as soon as possible.
except (cPickle.PicklingError, TypeError, NameError, AttributeError) as e: except (cPickle.PicklingError, TypeError, NameError, AttributeError):
return False return False
else: else:
return True return True
...@@ -735,7 +733,7 @@ class ImportFixer(ast.NodeTransformer): ...@@ -735,7 +733,7 @@ class ImportFixer(ast.NodeTransformer):
"WARNING: Your imported the module %s without using " "WARNING: Your imported the module %s without using "
"the environment object, which is not recomended. " "the environment object, which is not recomended. "
"Your import was automatically converted to use such method." "Your import was automatically converted to use such method."
"The setup function registered was named %s_setup.\\n" "The setup function was named as: %s_setup.\\n"
"'") % (module_name, module_name) "'") % (module_name, module_name)
tree = ast.parse(warning) tree = ast.parse(warning)
return tree.body[0] return tree.body[0]
...@@ -763,7 +761,7 @@ def renderAsHtml(self, renderable_object): ...@@ -763,7 +761,7 @@ def renderAsHtml(self, renderable_object):
compile_jupyter_frame = sys._getframe(3) compile_jupyter_frame = sys._getframe(3)
compile_jupyter_locals = compile_jupyter_frame.f_locals compile_jupyter_locals = compile_jupyter_frame.f_locals
processor = compile_jupyter_locals['processor_list'].getProcessorFor(renderable_object) processor = compile_jupyter_locals['processor_list'].getProcessorFor(renderable_object)
result, mime_type = processor(renderable_object).process() result, _ = processor(renderable_object).process()
compile_jupyter_locals['inject_variable_dict']['_print'].write(result) compile_jupyter_locals['inject_variable_dict']['_print'].write(result)
compile_jupyter_locals['display_data']['mime_type'] = 'text/html' compile_jupyter_locals['display_data']['mime_type'] = 'text/html'
...@@ -773,7 +771,7 @@ def getErrorMessageForException(self, exception, notebook_context): ...@@ -773,7 +771,7 @@ def getErrorMessageForException(self, exception, notebook_context):
code execution (notebook_context) and will return a dict as Jupyter code execution (notebook_context) and will return a dict as Jupyter
requires for error rendering. requires for error rendering.
''' '''
etype, value, tb = sys.exc_info() _, value, _ = sys.exc_info()
traceback_text = traceback.format_exc().split('\n')[:-1] traceback_text = traceback.format_exc().split('\n')[:-1]
return { return {
'status': 'error', 'status': 'error',
......
...@@ -46,14 +46,11 @@ ...@@ -46,14 +46,11 @@
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple>
<string>W: 85, 2: Redefining name \'traceback\' from outer scope (line 9) (redefined-outer-name)</string> <string>W:308, 10: Use of exec (exec-used)</string>
<string>W:197, 8: Use of exec (exec-used)</string> <string>W:357, 10: Use of exec (exec-used)</string>
<string>W:252, 8: Use of exec (exec-used)</string> <string>W:372, 10: Use of exec (exec-used)</string>
<string>W:264, 8: Use of exec (exec-used)</string> <string>W:460, 6: No exception type(s) specified (bare-except)</string>
<string>W:327, 10: Unused variable \'mime_type\' (unused-variable)</string> <string>W:916, 2: Redefining name \'IFrame\' from outer scope (line 22) (redefined-outer-name)</string>
<string>W:462, 2: Redefining name \'IFrame\' from outer scope (line 17) (redefined-outer-name)</string>
<string>W: 9, 0: Unused import traceback (unused-import)</string>
<string>W: 13, 0: Unused import transaction (unused-import)</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment