Example #1
0
 def gen():
     for event in get_raw_issue_events(repo_slug):
         yield stscraper.json_map(
             {
                 'id': 'id',
                 'issue_no': 'issue__number',
                 'event': 'event',
                 'user': '******',
                 'created_at': 'created_at',
             }, event)
def json_imap(mapping, iterable):
    """Extract json mappings from an iterable.

    Typically it is applied to an iterator returned by an API

    Args:
        mapping (dict): mapping, same as used by `json_map`
        iterable (Iterable): any kind of a directly iterable object.
    Returns:
        Generator: a generator of mapped items
    """
    for item in iterable:
        yield scraper.json_map(mapping, item)
Example #3
0
 def gen():
     for comment in get_raw_review_comments(repo_slug):
         yield stscraper.json_map(
             {
                 'pr_no': 'pr_no',
                 'id': 'id',
                 'user': '******',
                 'created_at': 'created_at',
                 'updated_at': 'updated_at',
                 'body': 'body',
                 'path': 'path',
                 'position': 'original_position',
                 'role': 'author_association'
             }, comment)
Example #4
0
 def gen():
     for commit in get_raw_commits(repo_slug):
         yield stscraper.json_map(
             {
                 'sha': 'sha',
                 'author': 'author__login',
                 'author_email': 'commit__author__email',
                 'authored_at': 'commit__author__date',
                 'committer': 'committer__login',
                 'committer_email': 'commit__committer__email',
                 'committed_at': 'commit__committer__date',
                 'comment_count': 'commit__comment_count',
                 'message': 'commit__message'
             }, commit)
Example #5
0
 def gen():
     for issue in get_raw_issues(repo_slug):
         i = stscraper.json_map(
             {
                 'number': 'number',
                 'id': 'id',
                 'state': 'state',
                 'created_at': 'created_at',
                 'updated_at': 'updated_at',
                 'closed_at': 'closed_at',
                 'user': '******',
                 'role': 'author_association',
                 'reactions': 'reactions__total_count',
             }, issue)
         i['labels'] = ",".join(l['name'] for l in issue['labels'])
         yield i