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

import common
import WMSCollector
import VOFrontend
from Glidein       import Glidein
from Configuration import Configuration
from Configuration import ConfigurationError

import traceback
import sys,os,pwd,string,time
import xml.sax.saxutils

import optparse

#STARTUP_DIR=sys.path[0]
#sys.path.append(os.path.join(STARTUP_DIR,"../lib"))
os.environ["PYTHONPATH"] = ""

factory_options = [ "hostname", 
"username", 
"service_name", 
"install_location", 
"logs_dir",
"client_log_dir", 
"client_proxy_dir", 
"instance_name",
"use_vofrontend_proxy", 
"x509_proxy", 
"x509_gsi_dn", 
"use_glexec", 
"use_ccb", 
"ress_host",
"entry_vos",
"entry_filters",
"web_location",
"web_url",
"javascriptrrd_location",
"match_authentication",
"install_vdt_client",
"glideinwms_location",
"vdt_location",
"pacman_location",
]

wmscollector_options = [ "hostname", 
"username", 
"privilege_separation",
"condor_location",
"frontend_users",
"x509_cert_dir",
]

frontend_options = [ 
"glidein_proxy_files", 
"glidein_proxy_dns", 
]

valid_options = { "Factory"       : factory_options,
                  "WMSCollector"  : wmscollector_options,
                  "VOFrontend"    : frontend_options,
}


class Factory(Configuration):

  def __init__(self,inifile,options=None):
    global valid_options
    self.inifile = inifile
    self.ini_section = "Factory"
    if options == None:
      options = valid_options[self.ini_section]
    Configuration.__init__(self,inifile)
    self.validate_section(self.ini_section,options)
    self.glidein = Glidein(self.inifile,self.ini_section,options)
    self.config_entries_list = {} # Config file entries elements
    self.wms      = None
    self.frontend = None

  #-- get service instances --------
  def get_wms(self):
    if self.wms == None:
      self.wms = WMSCollector.WMSCollector(self.inifile,valid_options["WMSCollector"])

  def get_frontend(self):
    if self.frontend == None:
      self.frontend = VOFrontend.VOFrontend(self.inifile,valid_options["VOFrontend"])

  #---------------------
  def glideinwms_location(self):<commit_msg>Temporary fix to a problem recursion problem when instantiating objects that have a sortof incestuous relationship.<commit_after>#!/usr/bin/env python

import common
import WMSCollector
import VOFrontend
from Glidein       import Glidein
from Configuration import Configuration
from Configuration import ConfigurationError

import traceback
import sys,os,pwd,string,time
import xml.sax.saxutils

import optparse

#STARTUP_DIR=sys.path[0]
#sys.path.append(os.path.join(STARTUP_DIR,"../lib"))
os.environ["PYTHONPATH"] = ""

factory_options = [ "hostname", 
"username", 
"service_name", 
"install_location", 
"logs_dir",
"client_log_dir", 
"client_proxy_dir", 
"instance_name",
"use_vofrontend_proxy", 
"x509_proxy", 
"x509_gsi_dn", 
"use_glexec", 
"use_ccb", 
"ress_host",
"entry_vos",
"entry_filters",
"web_location",
"web_url",
"javascriptrrd_location",
"match_authentication",
"install_vdt_client",
"glideinwms_location",
"vdt_location",
"pacman_location",
]

wmscollector_options = [ "hostname", 
"username", 
"privilege_separation",
"condor_location",
"frontend_users",
"x509_cert_dir",
]

frontend_options = [ 
"glidein_proxy_files", 
"glidein_proxy_dns", 
]

valid_options = { "Factory"       : factory_options,
                  "WMSCollector"  : wmscollector_options,
                  "VOFrontend"    : frontend_options,
}


class Factory(Configuration):

  def __init__(self,inifile,options=None):
    global valid_options
    self.inifile = inifile
    self.ini_section = "Factory"
    if options == None:
      options = valid_options[self.ini_section]
    Configuration.__init__(self,inifile)
    self.validate_section(self.ini_section,options)
    self.glidein = Glidein(self.inifile,self.ini_section,options)
    self.config_entries_list = {} # Config file entries elements
    self.wms      = None
    self.frontend = None
    self.get_wms()

  #-- get service instances --------
  def get_wms(self):
    if self.wms == None:
      self.wms = WMSCollector.WMSCollector(self.inifile,valid_options["WMSCollector"])

  def get_frontend(self):
    if self.frontend == None:
      self.frontend = VOFrontend.VOFrontend(self.inifile,valid_options["VOFrontend"])

  #---------------------
  def glideinwms_location(self):
{'fraction_non_alphanumeric': 0.13096610560295135, 'fraction_numerical': 0.004611482591653216, 'mean_word_length': 4.498098859315589, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '4092378', 'n_tokens_mistral': 1556, 'n_tokens_neox': 1517, 'n_words': 255}