@@ -245,6 +245,31 @@ define([
245245return label ;
246246}
247247
248+ /**
249+ * Pack the code with ignoring the warnings
250+ *@param {* } code
251+ */
252+ var ignoreWarning = function ( code ) {
253+ var convertedCode = new com_String ( ) ;
254+ convertedCode . appendLine ( 'import warnings' ) ;
255+ convertedCode . appendLine ( 'from IPython.display import display' ) ;
256+ convertedCode . appendLine ( 'with warnings.catch_warnings():' ) ;
257+ convertedCode . appendLine ( " warnings.simplefilter('ignore')" ) ;
258+ let codeLines = code . split ( '\n' ) ;
259+ codeLines . forEach ( ( line , idx ) => {
260+ if ( idx > 0 ) {
261+ convertedCode . appendLine ( ) ;
262+ }
263+ if ( codeLines . length == idx + 1 ) {
264+ // last line
265+ convertedCode . appendFormat ( " display({0})" , line ) ;
266+ } else {
267+ convertedCode . appendFormat ( " {0}" , line ) ;
268+ }
269+ } ) ;
270+ return convertedCode . toString ( ) ;
271+ }
272+
248273//============================================================================
249274// Cross-browser RegEx Split
250275//============================================================================
@@ -377,6 +402,7 @@ define([
377402setIsAPIListRunCode :setIsAPIListRunCode ,
378403getIsAPIListRunCode :getIsAPIListRunCode ,
379404safeString :safeString ,
405+ ignoreWarning :ignoreWarning ,
380406
381407regex_split :regex_split
382408}