Return the short permalink to the comment.
183844
def _fast_permalink(self):
        """"""
        if hasattr(self, 'link_id'):  # from /r or /u comments page
            sid = self.link_id.split('_')[1]
        else:  # from user's /message page
            sid = self.context.split('/')[4]
        return urljoin(self.reddit_session.config['comments'], '{0}/_/{1}'
                       .format(sid, self.id))
415483
def lookup_comments(self, reverse=False):
        ""

        comments = []
        if self.thread_id is None:
            self.thread_id = self.lookup_thread_id()
        path = self.thread_id
        with open(self.thread_id, 'r', newline='') as fdesc:
            reader = csv.reader(fdesc)
            header = reader.__next__()
            assert header == self.header
            for num, line in enumerate(reader):
                if not line:
                    continue
                assert len(line) == len(header), (
                    'Line %i in path %s misformatted' % (num+1, path))
                line_kw = dict(zip(header, line))
                comments.append(SingleComment(**line_kw))
        if reverse:
            comments = list(reversed(comments))

        return CommentSection(comments)
973791
def verbose_comment(self, t, i):
        """"""

        current = []
        escaped = False

        try:
            while t != "\n":
                if not escaped and t == "\\":
                    escaped = True
                    current.append(t)
                elif escaped:
                    escaped = False
                    if t in self._new_refs:
                        current.append("\\")
                    current.append(t)
                else:
                    current.append(t)
                t = next(i)
        except StopIteration:
            pass

        if t == "\n":
            current.append(t)
        return current
843554
def itemComments(self):
        
        url = "%s/comments/" % self.root
        params = {
            "f": "json"
        }
        return self._get(url,
                            params,
                            securityHandler=self._securityHandler,
                            proxy_port=self._proxy_port,
                            proxy_url=self._proxy_url)
472622
def allow(self, comment, content_object, request):
        """"""
        
        POST = urlencode({
                "blog": settings.AKISMET_BLOG.encode("utf-8"),
                "user_ip": comment.ip_address,
                "user_agent": request.META.get('HTTP_USER_AGENT', "").
                                                encode("utf-8"),
                "referrer": request.META.get('HTTP_REFERRER', "").
                                                encode("utf-8"),
                "comment_author": comment.user_name.encode("utf-8"),
                "comment_author_email": comment.user_email.encode("utf-8"),
                "comment_author_url": comment.user_url.encode("utf-8"),
                "comment_content": comment.comment.encode("utf-8")})
        connection = HTTPConnection(AKISMET_URL, AKISMET_PORT)
        connection.request("POST", AKISMET_PATH, POST,
                           {"User-Agent": AKISMET_USERAGENT,
                            "Content-type":"application/x-www-form-urlencoded"
                            })
        response = connection.getresponse()
        status, result = response.status, response.read()
        if result == "false":
            return True
        elif result == "true" and settings.DISCARD_SPAM:
            return False
        elif result == "true":
            comment.is_removed = True
            comment.is_public = False
            return True
        else:
            raise AkismetError(status, result)
898533
def translate_comment(self, comment, link_resolver):
        
        out = u''

        self.translate_tags(comment, link_resolver)
        ast = self.comment_to_ast(comment, link_resolver)
        out += self.ast_to_html(ast, link_resolver)
        return out
216225
def comments(self, limit=None):
        
        return self._reddit.comments(self.display_name, limit=limit)
68660
def source(self):
        """"""
        full_src = self._source[self._slice]

        def is_empty_or_comment(line):
            return line.strip() == '' or line.strip().startswith('#')

        filtered_src = dropwhile(is_empty_or_comment, reversed(full_src))
        return ''.join(reversed(list(filtered_src)))
377698
public function getCommentAuthorLink(Comment $comment)
    {
        if (!$user = $comment->getUser()) {
            if ((!$authorUrl = $comment->getAuthorUrl()) || !preg_match('/^http(s)?:\/\/.+$/', $authorUrl)) {
                return $comment->getAuthor();
            }

            return sprintf('<a href="%s" rel="nofollow" target="_new">%s</a>', $authorUrl, $comment->getAuthor());
        }

        if ((!$userUrl = $user->getUrl()) || !preg_match('/^http(s)?:\/\/.+$/', $userUrl)) {
            return $user->getDisplayName();
        }

        return sprintf('<a href="%s" rel="nofollow" target="_new">%s</a>', $userUrl, $user->getDisplayName());
    }
1103204
def _handle_comment(self, token):
        """"""
        self._push()
        while self._tokens:
            token = self._tokens.pop()
            if isinstance(token, tokens.CommentEnd):
                contents = self._pop()
                return Comment(contents)
            else:
                self._write(self._handle_token(token))
        raise ParserError("_handle_comment() missed a close token")
1338099
def obtain_the_permalink(check = nil, render_inline = true)
      site_url = Setting.get('site_url')
      post = obtain_record(check)

      return '' if post.blank?

      article_url = Setting.get('articles_slug')

      url =
        if post.post_type == 'post'
           site_url("#{article_url}#{post.structured_url}")
        else
          site_url("#{post.structured_url}")
        end

      if render_inline
        render :inline => url
      else
        url
      end

    end
571125
def full_url(self):
        
        if self.link == '':
            return None
        else:
            return Note._expand_url(self.link, self.subreddit)
1159822
def raw_comment(self):
        """"""
        r = conf.lib.clang_Cursor_getRawCommentText(self)
        if not r:
            return None
        return str(r)
324663
def short_doc(self):
        
        if self.brief is not None:
            return self.brief
        if self.help is not None:
            return self.help.split('\n', 1)[0]
        return ''
1175353
def obtain_comments(check = nil)

      if check.blank? && !@content.blank? && @content[0].blank?
        Comment.where(:post_id => @content.id, :comment_approved => 'Y')
      else
        Comment.where(:post_id => check, :comment_approved => 'Y')
      end

    end
1302345
def text(short):
    """"""
    return indent(short, branch_method=html_block_tag, leaf_method=convert_line, pass_syntax=PASS_SYNTAX,
                  flush_left_syntax=FLUSH_LEFT_SYNTAX, flush_left_empty_line=FLUSH_LEFT_EMPTY_LINE,
                  indentation_method=find_indentation)
1047161
def shorten_comment(line, max_line_length, last_comment=False):
    
    assert len(line) > max_line_length
    line = line.rstrip()

    # PEP 8 recommends 72 characters for comment text.
    indentation = _get_indentation(line) + '# '
    max_line_length = min(max_line_length,
                          len(indentation) + 72)

    MIN_CHARACTER_REPEAT = 5
    if (
        len(line) - len(line.rstrip(line[-1])) >= MIN_CHARACTER_REPEAT and
        not line[-1].isalnum()
    ):
        # Trim comments that end with things like ---------
        return line[:max_line_length] + '\n'
    elif last_comment and re.match(r'\s*#+\s*\w+', line):
        split_lines = textwrap.wrap(line.lstrip(' \t#'),
                                    initial_indent=indentation,
                                    subsequent_indent=indentation,
                                    width=max_line_length,
                                    break_long_words=False,
                                    break_on_hyphens=False)
        return '\n'.join(split_lines) + '\n'

    return line + '\n'