<commit_before>#!/usr/bin/python
"""
Stuff to import into bugzilla with
"""

import logging


def create_bug(BZ, ticket):
    """
    Currently just a mock implementation...


    Import a bug from sf.net to bugzilla
    @param BZ: Bugzilla object that has already been logged in
    @type BZ: bugzilla.Bugzilla
    @param ticket: the sf.net ticket to import
    @type ticket: sf.Ticket
    """
    params = {
        'product': 'Pywikibot',
        'component': find_valid_component(ticket.labels()),  # Need to map this
        'summary': ticket.summary(),
        'version': '',  # ???
        'description': ticket.export(),
        'status': find_status(ticket),  # Need to map this
    }
    if ticket.group == 'feature-requests':
        params['severity'] = 'Enhancement'
    logging.info('Uploading {0} to Bugzilla'.format(ticket.human_url()))
    bug = BZ.createbug(**params)

    # Now add all the comments.
    for cmt in ticket.comments():
        upd = BZ.build_update(comment=cmt)
        BZ.update_bugs(bug.id, upd)

    return bug  # Bug object


def add_to_see_also(bug, ticket):
    """
    @type bug: bugzilla.Bug
    @type ticket: sf.Ticket<commit_msg>Set version to 'unspecified'<commit_after>#!/usr/bin/python
"""
Stuff to import into bugzilla with
"""

import logging


def create_bug(BZ, ticket):
    """
    Currently just a mock implementation...


    Import a bug from sf.net to bugzilla
    @param BZ: Bugzilla object that has already been logged in
    @type BZ: bugzilla.Bugzilla
    @param ticket: the sf.net ticket to import
    @type ticket: sf.Ticket
    """
    params = {
        'product': 'Pywikibot',
        'component': find_valid_component(ticket.labels()),  # Need to map this
        'summary': ticket.summary(),
        'version': 'unspecified',
        'description': ticket.export(),
        'status': find_status(ticket),  # Need to map this
    }
    if ticket.group == 'feature-requests':
        params['severity'] = 'Enhancement'
    logging.info('Uploading {0} to Bugzilla'.format(ticket.human_url()))
    bug = BZ.createbug(**params)

    # Now add all the comments.
    for cmt in ticket.comments():
        upd = BZ.build_update(comment=cmt)
        BZ.update_bugs(bug.id, upd)

    return bug  # Bug object


def add_to_see_also(bug, ticket):
    """
    @type bug: bugzilla.Bug
    @type ticket: sf.Ticket
{'fraction_non_alphanumeric': 0.1276955602536998, 'fraction_numerical': 0.0008456659619450317, 'mean_word_length': 2.8222940226171245, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2899746', 'n_tokens_mistral': 782, 'n_tokens_neox': 739, 'n_words': 211}