<commit_before>from decimal import Decimal
from BaseController import BaseController
import tornado.ioloop
import tornado.web
import re
import redis


class InfoController(BaseController):
    def get(self):
        """Serves a GET request.
        """
        server = self.get_argument("server").split(':')
        
        redis_info = self.getStatsPerServer(server)
        databases=[]

        for key in sorted(redis_info.keys()):
            if key.startswith("db"):
                database = redis_info[key]
                database['name']=key
                databases.append(database)

        total_keys=0
        for database in databases:
            total_keys+=database.get("keys")

        if(total_keys==0):
            databases=[{"name" : "db0", "keys" : "0", "expires" : "0"}]

        redis_info['databases'] = databases
        redis_info['total_keys']= self.shorten_number(total_keys)

        uptime_seconds = redis_info['uptime_in_seconds']
        redis_info['uptime'] = self.shorten_time(uptime_seconds)

        commands_processed = redis_info['total_commands_processed']
        commands_processed = self.shorten_number(commands_processed)<commit_msg>Need to search for password from list of servers for INFO<commit_after>from decimal import Decimal
from BaseController import BaseController
import tornado.ioloop
import tornado.web
import re
import redis
from api.util import settings

class InfoController(BaseController):
    def get(self):
        """Serves a GET request.
        """

        server = self.get_argument("server").split(':')

	password = None
	
	for redis_server in settings.get_redis_servers():
	  if (redis_server["server"] == server[0]) and (int(redis_server["port"]) == int(server[1])):
            password = redis_server["password"]
	    break
 
        redis_info = self.getStatsPerServer(server, password)
        databases=[]

        for key in sorted(redis_info.keys()):
            if key.startswith("db"):
                database = redis_info[key]
                database['name']=key
                databases.append(database)

        total_keys=0
        for database in databases:
            total_keys+=database.get("keys")

        if(total_keys==0):
            databases=[{"name" : "db0", "keys" : "0", "expires" : "0"}]

        redis_info['databases'] = databases
        redis_info['total_keys']= self.shorten_number(total_keys)

        uptime_seconds = redis_info['uptime_in_seconds']
        redis_info['uptime'] = self.shorten_time(uptime_seconds)

        commands_processed = redis_info['total_commands_processed']
        commands_processed = self.shorten_number(commands_processed)
{'fraction_non_alphanumeric': 0.11206896551724138, 'fraction_numerical': 0.004497751124437781, 'mean_word_length': 2.919236417033774, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '3294920', 'n_tokens_mistral': 808, 'n_tokens_neox': 762, 'n_words': 157}