<commit_before># encoding: utf-8

from __future__ import unicode_literals
from .resource import AbstractResource

class Customer(AbstractResource):

    def __init__(self, api_key=None, name=None, document_number=None, email=None,
                 address_street=None, address_neighborhood=None,
                 address_zipcode=None, address_street_number=None,
                 address_complementary=None, phone_ddd=None, phone_number=None, **kwargs):

        address_zipcode = address_zipcode.replace('.', '').replace('-', '') if address_zipcode else None
        document_number = document_number.replace('.', '').replace('-', '') if document_number else None
        self.data = {
            'api_key': api_key,
            'name': name,
            'document_number': document_number,
            'email': email,
            'address_street': address_street,
            'address_neighborhood': address_neighborhood,
            'address_zipcode': address_zipcode,
            'address_street_number': address_street_number,
            'address_complementary': address_complementary,
            'phone_ddd': phone_ddd,
            'phone_number': phone_number,
        }

        self.data.update(kwargs)

    def get_anti_fraud_data(self):
        d = {}
        for key, value in self.data.items():
            if value is None:
                continue
            elif 'address' in key:
                new_key = 'customer[address][{key}]'.format(key=key.replace('address_', ''))
            elif 'phone' in key:
                new_key = 'customer[phone][{key}]'.format(key=key.replace('phone_', ''))
            else:
                new_key = 'customer[{key}]'.format(key=key)<commit_msg>Revert "Update Customer to inherit AbstractResource"<commit_after># encoding: utf-8

from __future__ import unicode_literals

class Customer(object):

    def __init__(self, name=None, document_number=None, email=None,
                 address_street=None, address_neighborhood=None,
                 address_zipcode=None, address_street_number=None,
                 address_complementary=None, phone_ddd=None, phone_number=None):

        address_zipcode = address_zipcode.replace('.', '').replace('-', '') if address_zipcode else None
        document_number = document_number.replace('.', '').replace('-', '') if document_number else None
        self.data = {
            'name': name,
            'document_number': document_number,
            'email': email,
            'address_street': address_street,
            'address_neighborhood': address_neighborhood,
            'address_zipcode': address_zipcode,
            'address_street_number': address_street_number,
            'address_complementary': address_complementary,
            'phone_ddd': phone_ddd,
            'phone_number': phone_number,
        }

    def get_anti_fraud_data(self):
        d = {}
        for key, value in self.data.items():
            if value is None:
                continue
            elif 'address' in key:
                new_key = 'customer[address][{key}]'.format(key=key.replace('address_', ''))
            elif 'phone' in key:
                new_key = 'customer[phone][{key}]'.format(key=key.replace('phone_', ''))
            else:
                new_key = 'customer[{key}]'.format(key=key)
{'fraction_non_alphanumeric': 0.11782477341389729, 'fraction_numerical': 0.0006042296072507553, 'mean_word_length': 2.467015706806283, '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': '7515377', 'n_tokens_mistral': 944, 'n_tokens_neox': 903, 'n_words': 181}