<commit_before>#!/usr/bin/env python

#python libs
import os
import csv
from datetime import datetime

#swift libs
from swiftclient import client as swift

class SwiftServiceTest(object):

    def __init__(self, username=None, password=None, tenant=None, auth_url=None,
               auth_ver='2.0', swift_url=None, debug=False):

        self.auth_ver = auth_ver
        self.debug = debug
        self.token = None
        self.http_conn = None

        def _default(var, env):
            if var:
                return var
            if env in os.environ:
                return os.environ[env]
            return None

        self.username = _default(username, 'OS_USERNAME')
        self.password = _default(password, '<PASSWORD>')
        self.tenant = _default(tenant, 'OS_TENANT_NAME')
        self.auth_url = _default(auth_url, 'OS_AUTH_URL')
        self.swift_url = _default(swift_url, 'OS_OBJECT_URL')


    def connect(self, force=False):
        if self.http_conn is not None and not force:
            return

        swift_url, self.token = swift.get_auth(auth_url=self.auth_url,
                                              user=self.username,
                                              key=self.password,
                                              auth_version=self.auth_ver,
                                              tenant_name=self.tenant)
        if not swift_url == self.swift_url:
            print("Different swift_url returned from swift")
        if self.debug:
            print(self.auth_url)
            print(self.token)
            print(self.swift_url)
            print(swift_url)
            print

        self.http_conn = swift.http_connection(self.swift_url)

        if self.debug:
            print(self.http_conn)
            print


    def get_account(self, deep=True):<commit_msg>If the swift urls are different, use the one given to us from the server.<commit_after>#!/usr/bin/env python

#python libs
import os
import csv
from datetime import datetime

#swift libs
from swiftclient import client as swift

class SwiftServiceTest(object):

    def __init__(self, username=None, password=<PASSWORD>, tenant=None, auth_url=None,
               auth_ver='2.0', swift_url=None, debug=False):

        self.auth_ver = auth_ver
        self.debug = debug
        self.token = None
        self.http_conn = None

        def _default(var, env):
            if var:
                return var
            if env in os.environ:
                return os.environ[env]
            return None

        self.username = _default(username, 'OS_USERNAME')
        self.password = _default(password, '<PASSWORD>')
        self.tenant = _default(tenant, 'OS_TENANT_NAME')
        self.auth_url = _default(auth_url, 'OS_AUTH_URL')
        self.swift_url = _default(swift_url, 'OS_OBJECT_URL')


    def connect(self, force=False):
        if self.http_conn is not None and not force:
            return

        swift_url, self.token = swift.get_auth(auth_url=self.auth_url,
                                               user=self.username,
                                               key=self.password,
                                               auth_version=self.auth_ver,
                                               tenant_name=self.tenant)
        if self.debug:
            print(self.auth_url)
            print(self.token)
            print(self.swift_url)
            print(swift_url)
            print
        if not swift_url == self.swift_url:
            print("Different swift_url returned from swift")
            self.swift_url = swift_url

        self.http_conn = swift.http_connection(self.swift_url)

        if self.debug:
            print(self.http_conn)
            print


    def get_account(self, deep=True):
{'fraction_non_alphanumeric': 0.08185899128597834, 'fraction_numerical': 0.0010562450488513335, 'mean_word_length': 1.6903409090909092, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3250348', 'n_tokens_mistral': 1055, 'n_tokens_neox': 1015, 'n_words': 241}