hooks = {
    'newproject': [],        # (site)
    'generate': [],          # (site, dir, extra_context)
    'publish': [],           # (site, s3)
    'install': [],           # (site, project)
    'preview': [],           # (site)
    'server_start': [],      # (site)
    'server_stop': [],       # (site)
}


class register_hook(object):
    """
    Register hook with @register_hook("EVENT") where EVENT is "newproject" etc.
    """
    def __init__(self, event):
        self.event = event

    def __call__(self, f):
        # Avoid weird duplication
        names = ['{0}.{1}'.format(func.__module__, func.func_name) for func in hooks[self.event]]
        if '{0}.{1}'.format(f.__module__, f.func_name) not in names:
            hooks[self.event].append(f)
        return f

hooks = {
    'newproject': [],        # (site)
    'generate': [],          # (site, dir, extra_context)
    'publish': [],           # (site, s3)
    'install': [],           # (site, project)
    'preview': [],           # (site)
    'server_start': [],      # (site)
    'server_stop': [],       # (site)
}


class register_hook(object):
    """
    Register hook with @register_hook("EVENT") where EVENT is "newproject" etc.
    """
    def __init__(self, event):
        self.event = event

    def __call__(self, f):
        # Avoid weird duplication
        names = ['{0}.{1}'.format(func.__module__, func.__name__) for func in hooks[self.event]]
        if '{0}.{1}'.format(f.__module__, f.__name__) not in names:
            hooks[self.event].append(f)
        return f

Switch to Python 3-friendly `function.__name__`
Switch to Python 3-friendly `function.__name__`

  hooks = {
      'newproject': [],        # (site)
      'generate': [],          # (site, dir, extra_context)
      'publish': [],           # (site, s3)
      'install': [],           # (site, project)
      'preview': [],           # (site)
      'server_start': [],      # (site)
      'server_stop': [],       # (site)
  }
  
  
  class register_hook(object):
      """
      Register hook with @register_hook("EVENT") where EVENT is "newproject" etc.
      """
      def __init__(self, event):
          self.event = event
  
      def __call__(self, f):
          # Avoid weird duplication
-         names = ['{0}.{1}'.format(func.__module__, func.func_name) for func in hooks[self.event]]
+         names = ['{0}.{1}'.format(func.__module__, func.__name__) for func in hooks[self.event]]
-         if '{0}.{1}'.format(f.__module__, f.func_name) not in names:
+         if '{0}.{1}'.format(f.__module__, f.__name__) not in names:
              hooks[self.event].append(f)
          return f
  
Switch to Python 3-friendly `function.__name__`
## Code Before:
hooks = {
    'newproject': [],        # (site)
    'generate': [],          # (site, dir, extra_context)
    'publish': [],           # (site, s3)
    'install': [],           # (site, project)
    'preview': [],           # (site)
    'server_start': [],      # (site)
    'server_stop': [],       # (site)
}


class register_hook(object):
    """
    Register hook with @register_hook("EVENT") where EVENT is "newproject" etc.
    """
    def __init__(self, event):
        self.event = event

    def __call__(self, f):
        # Avoid weird duplication
        names = ['{0}.{1}'.format(func.__module__, func.func_name) for func in hooks[self.event]]
        if '{0}.{1}'.format(f.__module__, f.func_name) not in names:
            hooks[self.event].append(f)
        return f

## Instruction:
Switch to Python 3-friendly `function.__name__`
## Code After:
hooks = {
    'newproject': [],        # (site)
    'generate': [],          # (site, dir, extra_context)
    'publish': [],           # (site, s3)
    'install': [],           # (site, project)
    'preview': [],           # (site)
    'server_start': [],      # (site)
    'server_stop': [],       # (site)
}


class register_hook(object):
    """
    Register hook with @register_hook("EVENT") where EVENT is "newproject" etc.
    """
    def __init__(self, event):
        self.event = event

    def __call__(self, f):
        # Avoid weird duplication
        names = ['{0}.{1}'.format(func.__module__, func.__name__) for func in hooks[self.event]]
        if '{0}.{1}'.format(f.__module__, f.__name__) not in names:
            hooks[self.event].append(f)
        return f
