Get a feature's comments

Output:

    A standard apollo feature dictionary ({"features": [{...}]})
963096
def cli(ctx, feature_id, organism="", sequence=""):
    
    return ctx.gi.annotations.get_comments(feature_id, organism=organism, sequence=sequence)
1201555
def get_comments(self):
        
        if self.retrieved:
            raise errors.IllegalState('List has already been retrieved.')
        self.retrieved = True
        return objects.CommentList(self._results, runtime=self._runtime)
965916
def disqus_show_comments(context, shortname=''):
    
    shortname = getattr(settings, 'DISQUS_WEBSITE_SHORTNAME', shortname)

    return {
        'shortname': shortname,
        'config': get_config(context),
    }
630577
def _parse_comments(element):
    

    comments = []
    items = element.findall("./{%s}comment" % WP_NAMESPACE)

    for item in items:
        comment_id = item.find("./{%s}comment_id" % WP_NAMESPACE).text
        author = item.find("./{%s}comment_author" % WP_NAMESPACE).text
        email = item.find("./{%s}comment_author_email" % WP_NAMESPACE).text
        author_url = item.find("./{%s}comment_author_url" % WP_NAMESPACE).text
        author_ip = item.find("./{%s}comment_author_IP" % WP_NAMESPACE).text
        date = item.find("./{%s}comment_date" % WP_NAMESPACE).text
        date_gmt = item.find("./{%s}comment_date_gmt" % WP_NAMESPACE).text
        content = item.find("./{%s}comment_content" % WP_NAMESPACE).text
        approved = item.find("./{%s}comment_approved" % WP_NAMESPACE).text
        comment_type = item.find("./{%s}comment_type" % WP_NAMESPACE).text
        parent = item.find("./{%s}comment_parent" % WP_NAMESPACE).text
        user_id = item.find("./{%s}comment_user_id" % WP_NAMESPACE).text

        comment = {
            "id": comment_id,
            "author": author,
            "author_email": email,
            "author_url": author_url,
            "author_ip": author_ip,
            "date": date,
            "date_gmt": date_gmt,
            "content": content,
            "approved": approved,
            "type": comment_type,
            "parent": parent,
            "user_id": user_id,
        }

        comments.append(comment)

    return comments
755279
def get_comment(self, item):
        
        key = item.upper()
        if key not in self._record_map:
            raise KeyError("unknown record: %s" % key)

        if 'comment' not in self._record_map[key]:
            return None
        else:
            return self._record_map[key]['comment']
751214
def commentrepr(self) -> List[str]:
        
        if hydpy.pub.options.reprcomments:
            return [f'# {line}' for line in
                    textwrap.wrap(objecttools.description(self), 72)]
        return []
49834
def to_dict(self, include_delta=True):
        
        if self.deleted:
            return {
                'timestamp': self.timestamp,
                'version': self.version
            }
        delta = self.parse_payload(self.desired, self.reported)
        payload = {}
        if self.desired is not None:
            payload['desired'] = self.desired
        if self.reported is not None:
            payload['reported'] = self.reported
        if include_delta and (delta is not None and len(delta.keys()) != 0):
            payload['delta'] = delta

        metadata = {}
        if self.metadata_desired is not None:
            metadata['desired'] = self.metadata_desired
        if self.metadata_reported is not None:
            metadata['reported'] = self.metadata_reported

        return {
            'state': payload,
            'metadata': metadata,
            'timestamp': self.timestamp,
            'version': self.version
        }
293735
def as_dict(self):
        """"""
        d = {"comment": self.comment, "nkpoints": self.num_kpts,
             "generation_style": self.style.name, "kpoints": self.kpts,
             "usershift": self.kpts_shift,
             "kpts_weights": self.kpts_weights, "coord_type": self.coord_type,
             "labels": self.labels, "tet_number": self.tet_number,
             "tet_weight": self.tet_weight,
             "tet_connections": self.tet_connections}

        optional_paras = ["genvec1", "genvec2", "genvec3", "shift"]
        for para in optional_paras:
            if para in self.__dict__:
                d[para] = self.__dict__[para]
        d["@module"] = self.__class__.__module__
        d["@class"] = self.__class__.__name__
        return d
1355578
def comment_line(comment)
      # Take care of annotation only if matched
      if comment.match(ProbeDockProbe::Annotation::ANNOTATION_REGEXP)
        # If the feature already started, the annotations are for scenarios
        if @current_feature_started
          @annotation = ProbeDockProbe::Annotation.new(comment)
        else
          @feature_annotation = ProbeDockProbe::Annotation.new(comment)
        end
      end
    end
1163491
def comments(self, issue):
        
        commit = self.as_id(issue)
        return self.get_list(url='%s/%s/comments' % (self, commit))
885154
def parse_comment(comment):
    
    names, vals = [], []
    pieces = comment.split('=')
    for i, piece in enumerate(pieces):
        if i == 0:  # first line
            names.append(piece.strip())
        elif i == len(pieces) - 1:  # last line
            vals.append(ast.literal_eval(piece))
        else:
            val, name = piece.rsplit(',', 1)
            vals.append(ast.literal_eval(val))
            names.append(name.strip())
    return list(zip(names, vals))
828217
def get_feature(self, feature_id):
        
        route_values = {}
        if feature_id is not None:
            route_values['featureId'] = self._serialize.url('feature_id', feature_id, 'str')
        response = self._send(http_method='GET',
                              location_id='c4209f25-7a27-41dd-9f04-06080c7b6afd',
                              version='5.0-preview.1',
                              route_values=route_values)
        return self._deserialize('ContributedFeature', response)
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
1262021
def to_dict(self, columns=None):
        
        if columns:
            assert len(columns) == len(self.feature_names)
        d = [
            dict([
                (columns[i] if columns else col_name, row[i])
                for i, col_name in enumerate(self.feature_names)
            ])
            for row in self.data
        ]
        return d
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)
330187
def dumpJSON(self):
        
        g = get_root(self).globals
        dtype = g.observe.rtype()
        if dtype == 'bias':
            target = 'BIAS'
        elif dtype == 'flat':
            target = 'FLAT'
        elif dtype == 'dark':
            target = 'DARK'
        else:
            target = self.target.value()

        return dict(
            target=target,
            ID=self.prog_ob.progid.value(),
            PI=self.pi.value(),
            OB='{:04d}'.format(self.prog_ob.obid.value()),
            Observers=self.observers.value(),
            comment=self.comment.value(),
            flags=dtype,
            filters=self.filter.value()
        )
1143547
def spec(self):
        """"""
        return dict(
            headers=self.header_lines,
            start=self.start_line,
            comments=self.comment_lines,
            end=self.end_line
        )