environment/lib/python2.7/site-packages/IPython/core/inputsplitter.py
def has_comment(src):
    """Indicate whether an input line has (i.e. ends in, or is) a comment.
    
    This uses tokenize, so it can distinguish comments from # inside strings.
    
    Parameters
    ----------
    src : string
      A single line input string.
    
    Returns
    -------
    Boolean: True if source has a comment.
    """
    readline = StringIO(src).readline
    toktypes = set()
    try:
        for t in tokenize.generate_tokens(readline):
            toktypes.add(t[0])
    except tokenize.TokenError:
        pass
    return(tokenize.COMMENT in toktypes)
def has_comment(src):
    """Indicate whether an input line has (i.e. ends in, or is) a comment.
    
    This uses tokenize, so it can distinguish comments from # inside strings.
    
    Parameters
    ----------
    src : string
      A single line input string.
    
    Returns
    -------
    Boolean: True if source has a comment.
    """
    readline = StringIO(src).readline
    toktypes = set()
    try:
        for t in tokenize.generate_tokens(readline):
            toktypes.add(t[0])
    except tokenize.TokenError:
        pass
    return(tokenize.COMMENT in toktypes)
Indicate whether an input line has (i.e. ends in, or is) a comment.
    
    This uses tokenize, so it can distinguish comments from # inside strings.
    
    Parameters
    ----------
    src : string
      A single line input string.
    
    Returns
    -------
    Boolean: True if source has a comment.