<commit_before>import click
import json
import os
import sarge
import sys

# Exceptions
class AntTargetException(Exception):
    pass

class DeploymentException(Exception):
    pass

class ApexTestException(Exception):
    pass

class SalesforceCredentialsException(Exception):
    pass

def check_salesforce_credentials(env):
    missing = []
    if not env.get('SF_USERNAME'):
        missing.append('SF_USERNAME')
    if not env.get('SF_PASSWORD'):
        missing.append('SF_PASSWORD')
    if missing:
        raise SalesforceCredentialsException('You must set the environment variables: %s' % ', '.join(missing))

# Config object
class Config(object):
    def __init__(self):
        self.cumulusci_path = os.environ.get('CUMULUSCI_PATH', None)

        # Salesforce org credentials
        self.sf_username = os.environ.get('SF_USERNAME', None)
        self.sf_password = os.environ.get('SF_PASSWORD', None)
        self.sf_serverurl = os.environ.get('SF_SERVERURL', 'https://login.salesforce.com')

        # OAuth credentials for the packaging org
        self.oauth_client_id = os.environ.get('OAUTH_CLIENT_ID')
        self.oauth_client_secret = os.environ.get('OAUTH_CLIENT_SECRET')
        self.oauth_callback_url = os.environ.get('OAUTH_CALLBACK_URL')
        self.oauth_instance_url = os.environ.get('INSTANCE_URL')
        self.oauth_refresh_token = os.environ.get('REFRESH_TOKEN')

        # Github Credentials
        self.github_org_name = os.environ.get('GITHUB_ORG_NAME')
        self.github_repo_name = os.environ.get('GITHUB_REPO_NAME')
        self.github_username = os.environ.get('GITHUB_USERNAME')
        self.github_password = <PASSWORD>('<PASSWORD>')
    
        # Default test configuration and override via environment variable
        self.advanced_testing = True
        self.debug_tests = os.environ.get('DEBUG_TESTS') not in [None, 'true', 'True']
        self.apex_logdir = 'apex_debug_logs'
        self.junit_output = 'test_results_junit.xml'
        self.json_output = 'test_results.json'

        # Branch naming
        self.prefix_beta = os.environ.get('PREFIX_BETA', 'beta/')
        self.master_branch = os.environ.get('MASTER_BRANCH', 'master')

        # Build info
        self.branch = None
        self.commit = None
        self.build_type = None
        self.steps_feature = os.environ.get('CUMULUSCI_STEPS_FEATURE', 'deploy').split(',')
        self.steps_master = os.environ.get('CUMULUSCI_STEPS_MASTER', 'deploy,package_beta,beta_deploy').split(',')

        # Parse the cumulusci.properties file if it exists.  Make all variables into attrs by replacing . with __ in the variable name
        self.parse_cumulusci_properties()

    def parse_cumulusci_properties(self):
        if os.path.isfile('cumulusci.properties'):
            f = open('cumulusci.properties', 'r')
            for line in f:
                parts = line.split('=')
                attr = parts[0].strip().replace('.','__')
                value = parts[1].strip()
                setattr(self, attr, value)

    @property
    def test_mode(self):
        if self.advanced_testing:
            return 'parallel'
        return 'mdapi'

# Create a decorator to pass config around between commands
pass_config = click.make_pass_decorator(Config, ensure=True)
<commit_msg>Default to a one step (deploy) flow for master builds<commit_after>import click
import json
import os
import sarge
import sys

# Exceptions
class AntTargetException(Exception):
    pass

class DeploymentException(Exception):
    pass

class ApexTestException(Exception):
    pass

class SalesforceCredentialsException(Exception):
    pass

def check_salesforce_credentials(env):
    missing = []
    if not env.get('SF_USERNAME'):
        missing.append('SF_USERNAME')
    if not env.get('SF_PASSWORD'):
        missing.append('SF_PASSWORD')
    if missing:
        raise SalesforceCredentialsException('You must set the environment variables: %s' % ', '.join(missing))

# Config object
class Config(object):
    def __init__(self):
        self.cumulusci_path = os.environ.get('CUMULUSCI_PATH', None)

        # Salesforce org credentials
        self.sf_username = os.environ.get('SF_USERNAME', None)
        self.sf_password = os.environ.get('SF_PASSWORD', None)
        self.sf_serverurl = os.environ.get('SF_SERVERURL', 'https://login.salesforce.com')

        # OAuth credentials for the packaging org
        self.oauth_client_id = os.environ.get('OAUTH_CLIENT_ID')
        self.oauth_client_secret = os.environ.get('OAUTH_CLIENT_SECRET')
        self.oauth_callback_url = os.environ.get('OAUTH_CALLBACK_URL')
        self.oauth_instance_url = os.environ.get('INSTANCE_URL')
        self.oauth_refresh_token = os.environ.get('REFRESH_TOKEN')

        # Github Credentials
        self.github_org_name = os.environ.get('GITHUB_ORG_NAME')
        self.github_repo_name = os.environ.get('GITHUB_REPO_NAME')
        self.github_username = os.environ.get('GITHUB_USERNAME')
        self.github_password = <PASSWORD>('GITHUB_PASSWORD')
    
        # Default test configuration and override via environment variable
        self.advanced_testing = True
        self.debug_tests = os.environ.get('DEBUG_TESTS') not in [None, 'true', 'True']
        self.apex_logdir = 'apex_debug_logs'
        self.junit_output = 'test_results_junit.xml'
        self.json_output = 'test_results.json'

        # Branch naming
        self.prefix_beta = os.environ.get('PREFIX_BETA', 'beta/')
        self.master_branch = os.environ.get('MASTER_BRANCH', 'master')

        # Build info
        self.branch = None
        self.commit = None
        self.build_type = None
        self.steps_feature = os.environ.get('CUMULUSCI_STEPS_FEATURE', 'deploy').split(',')
        self.steps_master = os.environ.get('CUMULUSCI_STEPS_MASTER', 'deploy').split(',')

        # Parse the cumulusci.properties file if it exists.  Make all variables into attrs by replacing . with __ in the variable name
        self.parse_cumulusci_properties()

    def parse_cumulusci_properties(self):
        if os.path.isfile('cumulusci.properties'):
            f = open('cumulusci.properties', 'r')
            for line in f:
                parts = line.split('=')
                attr = parts[0].strip().replace('.','__')
                value = parts[1].strip()
                setattr(self, attr, value)

    @property
    def test_mode(self):
        if self.advanced_testing:
            return 'parallel'
        return 'mdapi'

# Create a decorator to pass config around between commands
pass_config = click.make_pass_decorator(Config, ensure=True)

{'fraction_non_alphanumeric': 0.10916238282431207, 'fraction_numerical': 0.0006047777441790142, 'mean_word_length': 3.043398533007335, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '1406475', 'n_tokens_mistral': 2035, 'n_tokens_neox': 2026, 'n_words': 405}