<commit_before>from urllib2 import quote

from mongoengine import *
from mongoengine.queryset import QuerySet

from survivor import config

class UserQuerySet(QuerySet):
    """
    Custom user queries.
    """
    def competitors(self):
        return filter(lambda u: u.leaderboard_user(), self.all())

    def developers(self):
        return self.competitors()

class User(Document):
    """
    A JIRA user.
    """
    meta = {'queryset_class': UserQuerySet}

    login = StringField(required=True, unique=True)
    name = StringField()
    email = StringField()
    avatar_url = StringField()

    def __init__(self, **kwargs):
        self._closed_issues = None
        Document.__init__(self, **kwargs)

    def assigned_issues(self):
        return self.issues('open')

    def closed_issues(self):
        return self.issues('closed')

    def reported_issues(self):
        from survivor.models.issue import Issue
        return Issue.objects(reporter=self)

    def issues(self, state):
        from survivor.models.issue import Issue
        return Issue.objects(assignee=self, state=state)

    def leaderboard_user(self):
        "Returns true if user should be included in leaderboards."
        whitelist = config['leaderboard_users']
        return not whitelist or self.login in whitelist

    def assigned_issues_url(self):
        return quote('%s/issues/?jql=project = %s AND status = Open AND assignee = "%s"' % (config['jira.server'],
                                                                                            config['jira.project'],
                                                                                            self.login))
<commit_msg>fix assigned_issues_url function on user model<commit_after>from urllib2 import quote

from mongoengine import *
from mongoengine.queryset import QuerySet

from survivor import config

class UserQuerySet(QuerySet):
    """
    Custom user queries.
    """
    def competitors(self):
        return filter(lambda u: u.leaderboard_user(), self.all())

    def developers(self):
        return self.competitors()

class User(Document):
    """
    A JIRA user.
    """
    meta = {'queryset_class': UserQuerySet}

    login = StringField(required=True, unique=True)
    name = StringField()
    email = StringField()
    avatar_url = StringField()

    def __init__(self, **kwargs):
        self._closed_issues = None
        Document.__init__(self, **kwargs)

    def assigned_issues(self):
        return self.issues('open')

    def closed_issues(self):
        return self.issues('closed')

    def reported_issues(self):
        from survivor.models.issue import Issue
        return Issue.objects(reporter=self)

    def issues(self, state):
        from survivor.models.issue import Issue
        return Issue.objects(assignee=self, state=state)

    def leaderboard_user(self):
        "Returns true if user should be included in leaderboards."
        whitelist = config['leaderboard_users']
        return not whitelist or self.login in whitelist

    def assigned_issues_url(self):
        return '%s/issues/?jql=' % config['jira.server'] + \
            quote('project = %s AND status = Open AND assignee = "%s"' % (config['jira.project'],
                                                                          self.login))

{'fraction_non_alphanumeric': 0.09912886752778612, 'fraction_numerical': 0.0006007810153199159, 'mean_word_length': 2.3333333333333335, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 11, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '746547', 'n_tokens_mistral': 898, 'n_tokens_neox': 859, 'n_words': 236}