Lists comments for datasets.

    Output: setid comment_id date time author message
760641
def marvcli_comment_list(datasets):
    
    app = create_app()
    ids = parse_setids(datasets, dbids=True)
    comments = db.session.query(Comment)\
                         .options(db.joinedload(Comment.dataset))\
                         .filter(Comment.dataset_id.in_(ids))
    for comment in sorted(comments, key=lambda x: (x.dataset._setid, x.id)):
        print(comment.dataset.setid, comment.id,
              datetime.datetime.fromtimestamp(int(comment.time_added / 1000)),
              comment.author, repr(comment.text))
1322099
def list_comments(self, page=0):
        
        from highton.models.comment import Comment
        params = {'page': int(page) * self.COMMENT_OFFSET}

        return fields.ListField(
            name=self.ENDPOINT,
            init_class=Comment
        ).decode(
            self.element_from_string(
                self._get_request(
                    endpoint=self.ENDPOINT + '/' + str(self.id) + '/' + Comment.ENDPOINT,
                    params=params
                ).text
            )
        )
173213
def get_comment_create_data(self):
        
        user_model = get_user_model()
        return dict(
            content_type=ContentType.objects.get_for_model(self.target_object),
            object_pk=force_text(self.target_object._get_pk_val()),
            text=self.cleaned_data["text"],
            user=user_model.objects.latest('id'),
            post_date=timezone.now(),
            site_id=settings.SITE_ID,
            is_public=True,
            is_removed=False,
        )
963096
def cli(ctx, feature_id, organism="", sequence=""):
    
    return ctx.gi.annotations.get_comments(feature_id, organism=organism, sequence=sequence)
368964
function getCommentsList(comments) {
  if (!comments.body || !comments.headers) return;

  let pageInfo = getPage(comments.headers.link);
  let pageList = [];

  comments.body.forEach((item) => {
    pageList.push(getComments(item));
  });

  return {
    page: pageInfo,
    list: pageList
  }
}
1091110
def comments(self, case_id=None, variant_id=None, username=None):
        
        logger.debug("Looking for comments")
        comment_objs = self.query(Comment)

        if case_id:
            comment_objs = comment_objs.filter_by(case_id=case_id)

        if variant_id:
            comment_objs = comment_objs.filter_by(variant_id=variant_id)
        elif case_id:
            comment_objs = comment_objs.filter_by(variant_id=None)

        return comment_objs
763051
def __parse_comments():
    ''''''
    filename = get_file('comments.tsv')

    with io.open(filename, 'r', encoding='cp1252') as textfile:
        next(textfile)

        for line in textfile:
            tokens = line.strip().split('\t')
            chebi_id = int(tokens[1])

            if chebi_id not in __COMMENTS:
                __COMMENTS[chebi_id] = []

            # Append Comment:
            com = Comment(tokens[3],
                          tokens[4],
                          tokens[5],
                          datetime.datetime.strptime(tokens[2], '%Y-%M-%d'))

            __COMMENTS[chebi_id].append(com)
655400
def get_comments_in_range(self, start, end):
        """"""
        comments = {}

        # Naive way, but maybe it's fast enough: loop over all comments
        # gathering those within the bounds
        for rawindex, comment in self.rawdata.extra.comments.items():
            try:
                index = self.get_index_from_base_index(rawindex)
            except IndexError:
                continue
            if index >= start and index < end:
                comments[index] = comment
        return comments
806330
def import_comments(self, entry, comment_nodes):
        
        for comment_node in comment_nodes:
            is_pingback = comment_node.find(
                '{%s}comment_type' % WP_NS).text == PINGBACK
            is_trackback = comment_node.find(
                '{%s}comment_type' % WP_NS).text == TRACKBACK

            title = 'Comment #%s' % (comment_node.find(
                '{%s}comment_id' % WP_NS).text)
            self.write_out(' > %s... ' % title)

            content = comment_node.find(
                '{%s}comment_content' % WP_NS).text
            if not content:
                self.write_out(self.style.NOTICE('SKIPPED (unfilled)\n'))
                return

            submit_date = datetime.strptime(
                comment_node.find('{%s}comment_date_gmt' % WP_NS).text,
                '%Y-%m-%d %H:%M:%S')
            if settings.USE_TZ:
                submit_date = timezone.make_aware(submit_date,
                                                  pytz.timezone('GMT'))

            approvation = comment_node.find(
                '{%s}comment_approved' % WP_NS).text
            is_public = True
            is_removed = False
            if approvation != '1':
                is_removed = True
            if approvation == 'spam':
                is_public = False

            comment_dict = {
                'content_object': entry,
                'site': self.SITE,
                'user_name': comment_node.find(
                    '{%s}comment_author' % WP_NS).text[:50],
                'user_email': comment_node.find(
                    '{%s}comment_author_email' % WP_NS).text or '',
                'user_url': comment_node.find(
                    '{%s}comment_author_url' % WP_NS).text or '',
                'comment': content,
                'submit_date': submit_date,
                'ip_address': comment_node.find(
                    '{%s}comment_author_IP' % WP_NS).text or None,
                'is_public': is_public,
                'is_removed': is_removed, }
            comment = comments.get_model()(**comment_dict)
            comment.save()
            if is_pingback:
                comment.flags.create(
                    user=get_user_flagger(), flag=PINGBACK)
            if is_trackback:
                comment.flags.create(
                    user=get_user_flagger(), flag=TRACKBACK)

            self.write_out(self.style.ITEM('OK\n'))
        entry.comment_count = entry.comments.count()
        entry.pingback_count = entry.pingbacks.count()
        entry.trackback_count = entry.trackbacks.count()
        entry.save(force_update=True)
1117298
function get_comments($page) {
        global $DB;

        if ($page == 0) {
            $start = 0;
        } else {
            $start = $page * $this->perpage;
        }
        $comments = array();

        $usernamefields = get_all_user_name_fields(true, 'u');
        $sql = "SELECT c.id, c.contextid, c.itemid, c.component, c.commentarea, c.userid, c.content, $usernamefields, c.timecreated
                  FROM {comments} c
                  JOIN {user} u
                       ON u.id=c.userid
              ORDER BY c.timecreated ASC";
        $rs = $DB->get_recordset_sql($sql, null, $start, $this->perpage);
        $formatoptions = array('overflowdiv' => true, 'blanktarget' => true);
        foreach ($rs as $item) {
            // Set calculated fields
            $item->fullname = fullname($item);
            $item->time = userdate($item->timecreated);
            $item->content = format_text($item->content, FORMAT_MOODLE, $formatoptions);
            // Unset fields not related to the comment
            foreach (get_all_user_name_fields() as $namefield) {
                unset($item->$namefield);
            }
            unset($item->timecreated);
            // Record the comment
            $comments[] = $item;
        }
        $rs->close();

        return $comments;
    }
1022115
def set_comment(self, cellid, comment):
        
        info = {'cellid': cellid, 'comment': comment}
        self.datafile.set_metadata(self.current_dataset_name, info)
606274
def comment_set(self):
        
        ct = ContentType.objects.get_for_model(self.__class__)
        qs = Comment.objects.filter(
            content_type=ct,
            object_pk=self.pk)
        qs = qs.exclude(is_removed=True)
        qs = qs.order_by('-submit_date')
        return qs
1367783
def comment(data, what):
    
    data = data.splitlines()

    data = map(
        lambda x: "#" + x if x.strip().split() == what.split() else x,
        data
    )

    return "\n".join(data)
1268349
def list_pr_comments(repo: GithubRepository, pull_id: int
                     ) -> List[Dict[str, Any]]:
    
    url = ("https://api.github.com/repos/{}/{}/issues/{}/comments"
           "?access_token={}".format(repo.organization,
                                     repo.name,
                                     pull_id,
                                     repo.access_token))
    response = requests.get(url)
    if response.status_code != 200:
        raise RuntimeError(
            'Comments get failed. Code: {}. Content: {}.'.format(
                response.status_code, response.content))
    payload = json.JSONDecoder().decode(response.content.decode())
    return payload
36301
function collectComments(content, comments) {

    const table = []

    let from = 0
    let end

    while (true) {

        let start = content.indexOf('/*', from)

        if (start > -1) {

            end = content.indexOf('*/', start + 2)

            if (end > -1) {
                comments.push(content.slice(start + 2, end))
                table.push(content.slice(from, start))
                table.push('/*___PRESERVE_CANDIDATE_COMMENT_' + (comments.length - 1) + '___*/')
                from = end + 2

            } else {
                // unterminated comment
                end = -2
                break
            }

        } else {
            break
        }
    }

    table.push(content.slice(end + 2))

    return table.join('')
}
1256171
def get_comment_collection(cmt_id):
    
    query = """SELECT id_bibrec FROM "cmtRECORDCOMMENT" WHERE id=%s"""
    recid = run_sql(query, (cmt_id,))
    record_primary_collection = guess_primary_collection_of_a_record(
        recid[0][0])
    return record_primary_collection
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)