
from __future__ import division, absolute_import, print_function

import inspect

from . import six

OBSOLETE_BUILTINS = ['apply', 'cmp', 'coerce', 'execfile', 'file',
                     'raw_input', 'long', 'unicode', 'xrange',
                     'StandardError']


def disabled_function(name):
    '''
    Returns a function that cannot be called
    '''
    def disabled(*args, **kwargs):
        raise NameError('obsolete Python 2 builtin {} is disabled'.format(name))
    return disabled


if not six.PY3:
    caller = inspect.currentframe().f_back
    
    for fname in OBSOLETE_BUILTINS:
        caller.f_globals.__setitem__(fname, disabled_function(fname))



from __future__ import division, absolute_import, print_function

import inspect

from . import six

OBSOLETE_BUILTINS = ['apply', 'cmp', 'coerce', 'execfile', 'file', 'long',
                     'raw_input', 'reduce', 'reload', 'unicode', 'xrange',
                     'StandardError']


def disabled_function(name):
    '''
    Returns a function that cannot be called
    '''
    def disabled(*args, **kwargs):
        raise NameError('obsolete Python 2 builtin {} is disabled'.format(name))
    return disabled


if not six.PY3:
    caller = inspect.currentframe().f_back
    
    for fname in OBSOLETE_BUILTINS:
        caller.f_globals.__setitem__(fname, disabled_function(fname))


Add reduce() and reload() to disabled builtins
Add reduce() and reload() to disabled builtins

  
  from __future__ import division, absolute_import, print_function
  
  import inspect
  
  from . import six
  
- OBSOLETE_BUILTINS = ['apply', 'cmp', 'coerce', 'execfile', 'file',
+ OBSOLETE_BUILTINS = ['apply', 'cmp', 'coerce', 'execfile', 'file', 'long',
-                      'raw_input', 'long', 'unicode', 'xrange',
+                      'raw_input', 'reduce', 'reload', 'unicode', 'xrange',
                       'StandardError']
  
  
  def disabled_function(name):
      '''
      Returns a function that cannot be called
      '''
      def disabled(*args, **kwargs):
          raise NameError('obsolete Python 2 builtin {} is disabled'.format(name))
      return disabled
  
  
  if not six.PY3:
      caller = inspect.currentframe().f_back
      
      for fname in OBSOLETE_BUILTINS:
          caller.f_globals.__setitem__(fname, disabled_function(fname))
  
  
Add reduce() and reload() to disabled builtins
## Code Before:

from __future__ import division, absolute_import, print_function

import inspect

from . import six

OBSOLETE_BUILTINS = ['apply', 'cmp', 'coerce', 'execfile', 'file',
                     'raw_input', 'long', 'unicode', 'xrange',
                     'StandardError']


def disabled_function(name):
    '''
    Returns a function that cannot be called
    '''
    def disabled(*args, **kwargs):
        raise NameError('obsolete Python 2 builtin {} is disabled'.format(name))
    return disabled


if not six.PY3:
    caller = inspect.currentframe().f_back
    
    for fname in OBSOLETE_BUILTINS:
        caller.f_globals.__setitem__(fname, disabled_function(fname))


## Instruction:
Add reduce() and reload() to disabled builtins
## Code After:

from __future__ import division, absolute_import, print_function

import inspect

from . import six

OBSOLETE_BUILTINS = ['apply', 'cmp', 'coerce', 'execfile', 'file', 'long',
                     'raw_input', 'reduce', 'reload', 'unicode', 'xrange',
                     'StandardError']


def disabled_function(name):
    '''
    Returns a function that cannot be called
    '''
    def disabled(*args, **kwargs):
        raise NameError('obsolete Python 2 builtin {} is disabled'.format(name))
    return disabled


if not six.PY3:
    caller = inspect.currentframe().f_back
    
    for fname in OBSOLETE_BUILTINS:
        caller.f_globals.__setitem__(fname, disabled_function(fname))

