<commit_before>#!/usr/bin/python
import json
import os
import re
import shutil
import sys
import time

__author__ = '<NAME>'

ALFRESCO_PATH = '/var/lib/ghost'

class ServiceRun():

  def set_database_connection(self, db_type, db_host, db_port, db_name, db_user, db_password):
      global ALFRESCO_PATH

      if db_type not in ["postgresql", "mysql"]:
          raise KeyError("DB type must be Postgresql or Mysql")

      if db_type == "mysql" and (db_host == "localhost" or db_host == "127.0.0.1"):
          raise KeyError("For local database, you must use Postgresql")

      if db_host != "localhost" and db_host != "127.0.0.1":
          self.replace_all('/etc/supervisor/conf.d/supervisord-postgresql.conf', 'autostart\s*=.*', 'autostart=false')
          self.replace_all('/etc/supervisor/conf.d/supervisord-postgresql.conf', 'autorestart\s*=.*', 'autorestart=false')
      else:
          self.replace_all('/etc/supervisor/conf.d/supervisord-postgresql.conf', 'autostart\s*=.*', 'autostart=true')
          self.replace_all('/etc/supervisor/conf.d/supervisord-postgresql.conf', 'autorestart\s*=.*', 'autorestart=true')

      if db_host is None or db_host == "":<commit_msg>fix syntax error<commit_after>#!/usr/bin/python
import json
import os
import re
import shutil
import sys
import time

__author__ = '<NAME>'

ALFRESCO_PATH = '/opt/alfresco'

class ServiceRun():

  def set_database_connection(self, db_type, db_host, db_port, db_name, db_user, db_password):
      global ALFRESCO_PATH

      if db_type not in ["postgresql", "mysql"]:
          raise KeyError("DB type must be Postgresql or Mysql")

      if db_type == "mysql" and (db_host == "localhost" or db_host == "127.0.0.1"):
          raise KeyError("For local database, you must use Postgresql")

      if db_host != "localhost" and db_host != "127.0.0.1":
          self.replace_all('/etc/supervisor/conf.d/supervisord-postgresql.conf', 'autostart\s*=.*', 'autostart=false')
          self.replace_all('/etc/supervisor/conf.d/supervisord-postgresql.conf', 'autorestart\s*=.*', 'autorestart=false')
      else:
          self.replace_all('/etc/supervisor/conf.d/supervisord-postgresql.conf', 'autostart\s*=.*', 'autostart=true')
          self.replace_all('/etc/supervisor/conf.d/supervisord-postgresql.conf', 'autorestart\s*=.*', 'autorestart=true')

      if db_host is None or db_host == "":
{'fraction_non_alphanumeric': 0.15147679324894514, 'fraction_numerical': 0.010126582278481013, 'mean_word_length': 3.7043650793650795, 'pattern_counts': {'":': 4, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, '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': '2794496', 'n_tokens_mistral': 850, 'n_tokens_neox': 821, 'n_words': 172}