Esempio n. 1
0
if (__name__ == '__main__'):
    print('py3_markov version ' + VERSION)

    config_file = config.dflt_cfg
    if (len(sys.argv) > 1):
        config_file = sys.argv[1]
    print('using JSON config file ' + config_file)

    #the state transition array structure,
    #which contains prefixes, suffixes, and probabilities associated with each suffix
    state_change = []

    prefix_len = None
    try:
        prefix_len = int(
            config.get_json_param(config.read_json_file(config_file),
                                  'prefix_len'))
    except ValueError:
        prefix_len = None

    if (prefix_len == None):
        prefix_len = 2
    prefix = []
    for i in range(0, prefix_len):
        prefix.append('')

    use_pg = config.get_json_param(config.read_json_file(config_file),
                                   'use_pg')
    if (use_pg == None):
        use_pg = False
Esempio n. 2
0
if(__name__=='__main__'):
	print('py3_markov version '+VERSION)
	
	config_file=config.dflt_cfg
	if(len(sys.argv)>1):
		config_file=sys.argv[1]
	print('using JSON config file '+config_file)
	
	#the state transition array structure,
	#which contains prefixes, suffixes, and probabilities associated with each suffix
	state_change=[]
	
	prefix_len=None
	try:
		prefix_len=int(config.get_json_param(config.read_json_file(config_file),'prefix_len'))
	except ValueError:
		prefix_len=None
	
	if(prefix_len==None):
		prefix_len=2
	prefix=[]
	for i in range(0,prefix_len):
		prefix.append('')
	
	use_pg=config.get_json_param(config.read_json_file(config_file),'use_pg')
	if(use_pg==None):
		use_pg=False
	
	state_file=None
	db_login=None
Esempio n. 3
0
    print('Err: Connection Closed')

    #if we got here then we're totally finished
    #so close the socket
    sock.close()


#runtime
if (__name__ == '__main__'):
    config_file = config.dflt_cfg
    if (len(sys.argv) > 1):
        config_file = sys.argv[1]
    print('using JSON config file ' + config_file)

    #read the configuration from the json configuration file
    json_cfg_tree = config.read_json_file(config_file)

    #set configuration from the config file
    #if configuration for anything is omitted a default value from the code is used

    #nick
    json_bot_nick = config.get_json_param(json_cfg_tree, 'bot_nick')
    if (json_bot_nick != None):
        bot_nick = json_bot_nick

    #channels to join on startup
    json_autojoin_channels = config.get_json_param(json_cfg_tree,
                                                   'autojoin_channels')
    if (json_autojoin_channels != None):
        autojoin_channels = json_autojoin_channels
Esempio n. 4
0
	
	print('Err: Connection Closed')
	
	#if we got here then we're totally finished
	#so close the socket
	sock.close()

#runtime
if(__name__=='__main__'):
	config_file=config.dflt_cfg
	if(len(sys.argv)>1):
		config_file=sys.argv[1]
	print('using JSON config file '+config_file)
	
	#read the configuration from the json configuration file
	json_cfg_tree=config.read_json_file(config_file)
	
	#set configuration from the config file
	#if configuration for anything is omitted a default value from the code is used
	
	#nick
	json_bot_nick=config.get_json_param(json_cfg_tree,'bot_nick')
	if(json_bot_nick!=None):
		bot_nick=json_bot_nick
	
	#channels to join on startup
	json_autojoin_channels=config.get_json_param(json_cfg_tree,'autojoin_channels')
	if(json_autojoin_channels!=None):
		autojoin_channels=json_autojoin_channels
	
	#debug channels to join and spam