From 23b9cc4597c8ac2bd3dc113fa977627390beacc9 Mon Sep 17 00:00:00 2001 From: Ivan Tyagov <ivan@nexedi.com> Date: Wed, 16 Nov 2016 13:33:55 +0000 Subject: [PATCH] Clean up unused variables. --- .../extension.erp5.JupyterCompile.py | 12 +++++------- .../extension.erp5.JupyterCompile.xml | 13 +++++-------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/bt5/erp5_data_notebook/ExtensionTemplateItem/portal_components/extension.erp5.JupyterCompile.py b/bt5/erp5_data_notebook/ExtensionTemplateItem/portal_components/extension.erp5.JupyterCompile.py index 4890bbe8e0..e5403bc34a 100644 --- a/bt5/erp5_data_notebook/ExtensionTemplateItem/portal_components/extension.erp5.JupyterCompile.py +++ b/bt5/erp5_data_notebook/ExtensionTemplateItem/portal_components/extension.erp5.JupyterCompile.py @@ -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 globals_dict = globals() - result_string = '' notebook_context = old_notebook_context # Execute only if jupyter_code is not empty @@ -432,8 +431,7 @@ class EnvironmentDefinitionError(TypeError): def canSerialize(obj): - result = False - + container_type_tuple = (list, tuple, dict, set, frozenset) # if object is a container, we need to check its elements for presence of @@ -479,7 +477,7 @@ def canSerialize(obj): # # Even though the issue seems complicated, this quickfix should be # 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 else: return True @@ -735,7 +733,7 @@ class ImportFixer(ast.NodeTransformer): "WARNING: Your imported the module %s without using " "the environment object, which is not recomended. " "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) tree = ast.parse(warning) return tree.body[0] @@ -763,7 +761,7 @@ def renderAsHtml(self, renderable_object): compile_jupyter_frame = sys._getframe(3) compile_jupyter_locals = compile_jupyter_frame.f_locals 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['display_data']['mime_type'] = 'text/html' @@ -773,7 +771,7 @@ def getErrorMessageForException(self, exception, notebook_context): code execution (notebook_context) and will return a dict as Jupyter requires for error rendering. ''' - etype, value, tb = sys.exc_info() + _, value, _ = sys.exc_info() traceback_text = traceback.format_exc().split('\n')[:-1] return { 'status': 'error', diff --git a/bt5/erp5_data_notebook/ExtensionTemplateItem/portal_components/extension.erp5.JupyterCompile.xml b/bt5/erp5_data_notebook/ExtensionTemplateItem/portal_components/extension.erp5.JupyterCompile.xml index fedbf60c07..f428d3eeae 100644 --- a/bt5/erp5_data_notebook/ExtensionTemplateItem/portal_components/extension.erp5.JupyterCompile.xml +++ b/bt5/erp5_data_notebook/ExtensionTemplateItem/portal_components/extension.erp5.JupyterCompile.xml @@ -46,14 +46,11 @@ <key> <string>text_content_warning_message</string> </key> <value> <tuple> - <string>W: 85, 2: Redefining name \'traceback\' from outer scope (line 9) (redefined-outer-name)</string> - <string>W:197, 8: Use of exec (exec-used)</string> - <string>W:252, 8: Use of exec (exec-used)</string> - <string>W:264, 8: Use of exec (exec-used)</string> - <string>W:327, 10: Unused variable \'mime_type\' (unused-variable)</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> + <string>W:308, 10: Use of exec (exec-used)</string> + <string>W:357, 10: Use of exec (exec-used)</string> + <string>W:372, 10: Use of exec (exec-used)</string> + <string>W:460, 6: No exception type(s) specified (bare-except)</string> + <string>W:916, 2: Redefining name \'IFrame\' from outer scope (line 22) (redefined-outer-name)</string> </tuple> </value> </item> -- 2.30.9