<commit_before>from .utils import _build_new_bid_type, _build_new_bidding_strategy_configuration


def new_keyword_operation(adgroup_id: 'Long' = None,
                          criteria_id: 'Long' = None,
                          text: 'String' = None,
                          keyword_match_type: 'String' = None,
                          status: 'String' = None,
                          cpc_bid: 'Bid' = None,
                          operator: 'String' = 'ADD',
                          **kwargs):
    status = status.upper()
    if not status and operator == 'ADD':
        status = 'PAUSED'
    operator = operator.upper()

    operation = {
        'xsi_type': 'AdGroupCriterionOperation',
        'operand': {
            'xsi_type': 'BiddableAdGroupCriterion',
            'criterion': {'xsi_type': 'Keyword'},
            'adGroupId': adgroup_id,
        },
        'operator': operator
    }

    if criteria_id:
        operation['operand']['criterion']['id'] = criteria_id

    if status:
        operation['operand']['userStatus'] = status

    if status != 'REMOVED' and keyword_match_type and text:
        operation['operand']['criterion']['text'] = text
        operation['operand']['criterion']['matchType'] = keyword_match_type.upper()

    if status != 'REMOVED' and cpc_bid:
        bidding_strategy = _build_new_bidding_strategy_configuration()<commit_msg>fixing bid adjustment when creating operations<commit_after>from .utils import _build_new_bid_type, _build_new_bidding_strategy_configuration


def new_keyword_operation(adgroup_id: 'Long' = None,
                          criteria_id: 'Long' = None,
                          text: 'String' = None,
                          keyword_match_type: 'String' = None,
                          status: 'String' = None,
                          cpc_bid: 'Bid' = None,
                          operator: 'String' = 'ADD',
                          **kwargs):
    operator = operator.upper()
    if not status and operator == 'ADD':
        status = 'PAUSED'

    operation = {
        'xsi_type': 'AdGroupCriterionOperation',
        'operand': {
            'xsi_type': 'BiddableAdGroupCriterion',
            'criterion': {'xsi_type': 'Keyword'},
            'adGroupId': adgroup_id,
        },
        'operator': operator
    }

    if criteria_id:
        operation['operand']['criterion']['id'] = criteria_id

    if status:
        operation['operand']['userStatus'] = status.upper()

    if status != 'REMOVED' and keyword_match_type and text:
        operation['operand']['criterion']['text'] = text
        operation['operand']['criterion']['matchType'] = keyword_match_type.upper()

    if status != 'REMOVED' and cpc_bid:
        bidding_strategy = _build_new_bidding_strategy_configuration()
{'fraction_non_alphanumeric': 0.12028725314183124, 'fraction_numerical': 0.0, 'mean_word_length': 2.1268237934904604, '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': '5893120', 'n_tokens_mistral': 783, 'n_tokens_neox': 777, 'n_words': 160}