<commit_before>#!/usr/bin/env python
#
# VM Backup extension
#
# Copyright 2015 Microsoft Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Requires Python 2.7+
#
import os
import datetime
import os.path
from Common import CommonVariables
from ConfigParser import ConfigParser
from ConfigUtil import ConfigUtil
from ConfigUtil import ConfigKeyValuePair
class EncryptionConfig(object):
    def __init__(self, encryption_environment,logger):
        self.encryptionEnvironment = encryption_environment
        self.passphrase_file_name = None
        self.bek_filesystem = None
        self.volume_type = None
        self.secret_id = None
        self.encryption_config = ConfigUtil(encryption_environment.encryption_config_file_path,'azure_crypt_config',logger)


    def config_file_exists(self):
        return self.encryption_config.config_file_exists()

    def get_bek_filename(self):
        return self.encryption_config.get_config(CommonVariables.PassphraseFileNameKey)

    def get_bek_filesystem(self):
        return self.encryption_config.get_config(CommonVariables.BekVolumeFileSystemKey)

    def get_secret_id(self):
        return self.encryption_config.get_config(CommonVariables.SecretUriKey)

    def commit(self):
        key_value_pairs = []
        command = ConfigKeyValuePair(CommonVariables.PassphraseFileNameKey,self.passphrase_file_name)
        key_value_pairs.append(command)
        bek_file_system = ConfigKeyValuePair(CommonVariables.BekVolumeFileSystemKey,CommonVariables.BekVolumeFileSystem)
        key_value_pairs.append(bek_file_system)
        parameters = ConfigKeyValuePair(CommonVariables.SecretUriKey,self.secret_id)
        key_value_pairs.append(parameters)
        self.encryption_config.save_configs(key_value_pairs)

    def clear_config(self):
        try:
            if(os.path.exists(self.encryptionEnvironment.encryption_config_file_path)):<commit_msg>Add logger member for EncryptionConfig<commit_after>#!/usr/bin/env python
#
# VM Backup extension
#
# Copyright 2015 Microsoft Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Requires Python 2.7+
#
import os
import datetime
import os.path
from Common import CommonVariables
from ConfigParser import ConfigParser
from ConfigUtil import ConfigUtil
from ConfigUtil import ConfigKeyValuePair
class EncryptionConfig(object):
    def __init__(self, encryption_environment,logger):
        self.encryptionEnvironment = encryption_environment
        self.passphrase_file_name = None
        self.bek_filesystem = None
        self.volume_type = None
        self.secret_id = None
        self.encryption_config = ConfigUtil(encryption_environment.encryption_config_file_path,'azure_crypt_config',logger)
        self.logger = logger


    def config_file_exists(self):
        return self.encryption_config.config_file_exists()

    def get_bek_filename(self):
        return self.encryption_config.get_config(CommonVariables.PassphraseFileNameKey)

    def get_bek_filesystem(self):
        return self.encryption_config.get_config(CommonVariables.BekVolumeFileSystemKey)

    def get_secret_id(self):
        return self.encryption_config.get_config(CommonVariables.SecretUriKey)

    def commit(self):
        key_value_pairs = []
        command = ConfigKeyValuePair(CommonVariables.PassphraseFileNameKey,self.passphrase_file_name)
        key_value_pairs.append(command)
        bek_file_system = ConfigKeyValuePair(CommonVariables.BekVolumeFileSystemKey,CommonVariables.BekVolumeFileSystem)
        key_value_pairs.append(bek_file_system)
        parameters = ConfigKeyValuePair(CommonVariables.SecretUriKey,self.secret_id)
        key_value_pairs.append(parameters)
        self.encryption_config.save_configs(key_value_pairs)

    def clear_config(self):
        try:
            if(os.path.exists(self.encryptionEnvironment.encryption_config_file_path)):
{'fraction_non_alphanumeric': 0.06672124437167418, 'fraction_numerical': 0.004093327875562832, 'mean_word_length': 4.4, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6523674', 'n_tokens_mistral': 1344, 'n_tokens_neox': 1313, 'n_words': 329}