<commit_before>'''
Created on Nov 7, 2011

@author: Dusan
'''
import time
from pysimplesoap_atomia.client import SoapClient
from datetime import datetime
import ConfigParser, os

class AtomiaActions(object):
    
    def __init__(self, username = None, password = None, api_url = None, token_created = None, token_expires = None, soap_header = None, body_xmlns = None):

        if token_created is None:
            self.created = datetime.fromtimestamp(time.mktime(time.gmtime())).strftime('%Y-%m-%dT%H:%M:%SZ')
        else:
            self.created = token_created
        
        if token_expires is None:
            self.expires = datetime.fromtimestamp(time.mktime(time.gmtime()) + 300).strftime('%Y-%m-%dT%H:%M:%SZ')
        else:
            self.expires = token_expires 
        
        self.username = username
        self.password = password
        self.api_url = api_url
		self.bootstrap = False
        
        if self.username is None or self.password is None or self.api_url is None:
            config = ConfigParser.ConfigParser()
            conf_file = config.read(['atomia.conf', os.path.dirname(os.path.realpath(__file__)) + '/atomia.conf', os.path.abspath('/etc/atomia.conf')])
            if conf_file is not None and len(conf_file) > 0:
                if self.username is None:
                    self.username = config.get("Automation Server API", "username")
                if self.password is None:
                    self.password = config.get("Automation Server API", "password")
                if self.api_url is None:
                    self.api_url = config.get("Automation Server API", "url")
                
                self.bootstrap = config.has_option("Automation Server API", "bootstrap") and config.getboolean("Automation Server API", "bootstrap")
            else:
                raise Exception("Could not find the config file!")
        
        if soap_header is None:
            
            if self.bootstrap:
                self.header = """<soap:Header xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" 
                            xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
            </soap:Header>"""
            
            else:<commit_msg>Fixed indentation.<commit_after>'''
Created on Nov 7, 2011

@author: Dusan
'''
import time
from pysimplesoap_atomia.client import SoapClient
from datetime import datetime
import ConfigParser, os

class AtomiaActions(object):
    
    def __init__(self, username = None, password = None, api_url = None, token_created = None, token_expires = None, soap_header = None, body_xmlns = None):

        if token_created is None:
            self.created = datetime.fromtimestamp(time.mktime(time.gmtime())).strftime('%Y-%m-%dT%H:%M:%SZ')
        else:
            self.created = token_created
        
        if token_expires is None:
            self.expires = datetime.fromtimestamp(time.mktime(time.gmtime()) + 300).strftime('%Y-%m-%dT%H:%M:%SZ')
        else:
            self.expires = token_expires 
        
        self.username = username
        self.password = password
        self.api_url = api_url
        self.bootstrap = False
        
        if self.username is None or self.password is None or self.api_url is None:
            config = ConfigParser.ConfigParser()
            conf_file = config.read(['atomia.conf', os.path.dirname(os.path.realpath(__file__)) + '/atomia.conf', os.path.abspath('/etc/atomia.conf')])
            if conf_file is not None and len(conf_file) > 0:
                if self.username is None:
                    self.username = config.get("Automation Server API", "username")
                if self.password is None:
                    self.password = config.get("Automation Server API", "password")
                if self.api_url is None:
                    self.api_url = config.get("Automation Server API", "url")
                
                self.bootstrap = config.has_option("Automation Server API", "bootstrap") and config.getboolean("Automation Server API", "bootstrap")
            else:
                raise Exception("Could not find the config file!")
        
        if soap_header is None:
            
            if self.bootstrap:
                self.header = """<soap:Header xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" 
                            xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
            </soap:Header>"""
            
            else:
{'fraction_non_alphanumeric': 0.11865121180189674, 'fraction_numerical': 0.017702845100105374, 'mean_word_length': 2.1409662475182, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 8}, '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': '6590668', 'n_tokens_mistral': 1476, 'n_tokens_neox': 1374, 'n_words': 302}