
from .py27compat import builtins


def max(*args, **kwargs):
    """
    Add support for 'default' kwarg.

    >>> max([], default='res')
    'res'

    >>> max(default='res')
    Traceback (most recent call last):
    ...
    TypeError: ...

    >>> max('a', 'b', default='other')
    'b'
    """
    missing = object()
    if not 'default' in kwargs:
        return builtins.max(*args, **kwargs)
    default = kwargs.pop('default', missing)
    try:
        return builtins.max(*args, **kwargs)
    except ValueError as exc:
        if 'empty sequence' in str(exc) and default is not missing:
            return default
        raise


from .py27compat import builtins


def max(*args, **kwargs):
    """
    Add support for 'default' kwarg.

    >>> max([], default='res')
    'res'

    >>> max(default='res')
    Traceback (most recent call last):
    ...
    TypeError: ...

    >>> max('a', 'b', default='other')
    'b'
    """
    missing = object()
    default = kwargs.pop('default', missing)
    try:
        return builtins.max(*args, **kwargs)
    except ValueError as exc:
        if 'empty sequence' in str(exc) and default is not missing:
            return default
        raise

Remove superfluous check for default
Remove superfluous check for default

  
  from .py27compat import builtins
  
  
  def max(*args, **kwargs):
      """
      Add support for 'default' kwarg.
  
      >>> max([], default='res')
      'res'
  
      >>> max(default='res')
      Traceback (most recent call last):
      ...
      TypeError: ...
  
      >>> max('a', 'b', default='other')
      'b'
      """
      missing = object()
-     if not 'default' in kwargs:
-         return builtins.max(*args, **kwargs)
      default = kwargs.pop('default', missing)
      try:
          return builtins.max(*args, **kwargs)
      except ValueError as exc:
          if 'empty sequence' in str(exc) and default is not missing:
              return default
          raise
  
Remove superfluous check for default
## Code Before:

from .py27compat import builtins


def max(*args, **kwargs):
    """
    Add support for 'default' kwarg.

    >>> max([], default='res')
    'res'

    >>> max(default='res')
    Traceback (most recent call last):
    ...
    TypeError: ...

    >>> max('a', 'b', default='other')
    'b'
    """
    missing = object()
    if not 'default' in kwargs:
        return builtins.max(*args, **kwargs)
    default = kwargs.pop('default', missing)
    try:
        return builtins.max(*args, **kwargs)
    except ValueError as exc:
        if 'empty sequence' in str(exc) and default is not missing:
            return default
        raise

## Instruction:
Remove superfluous check for default
## Code After:

from .py27compat import builtins


def max(*args, **kwargs):
    """
    Add support for 'default' kwarg.

    >>> max([], default='res')
    'res'

    >>> max(default='res')
    Traceback (most recent call last):
    ...
    TypeError: ...

    >>> max('a', 'b', default='other')
    'b'
    """
    missing = object()
    default = kwargs.pop('default', missing)
    try:
        return builtins.max(*args, **kwargs)
    except ValueError as exc:
        if 'empty sequence' in str(exc) and default is not missing:
            return default
        raise
