<commit_before>import mint.client
import mint.config
import mint.shimclient

from restlib.controller import RestController

from catalogService import userInfo
from catalogService import serviceInfo
from catalogService.rest.response import XmlResponse, XmlStringResponse
from catalogService.rest import users
from catalogService.rest import clouds

class CatalogServiceController(RestController):
    urls = {'clouds' : clouds.AllCloudController,
            'users' : users.UsersController,
            'userinfo' : 'userinfo',
            'serviceinfo' : 'serviceinfo'}

    def __init__(self, cfg):
        RestController.__init__(self, None, None, [cfg])
        self.loadCloudTypes()

    def loadCloudTypes(self):
        self._getController('clouds').loadCloudTypes()

    def _getController(self, url):
        return self.urls[url]

    def userinfo(self, request):
        responseId = "%s/userinfo" % request.baseUrl
        response = userInfo.UserInfo(id = responseId,
            username = request.mintAuth.username,
            isAdmin = bool(request.mintAuth.admin))
        return XmlResponse(response)
    
    def serviceinfo(self, request):
        responseId = "%s/serviceinfo" % request.baseUrl
        # TODO:  Get proper version/type in here.  See RBL-4191.
        response = serviceInfo.ServiceInfo(id = responseId,
            version = "1",
            type = "full")
        return XmlResponse(response)<commit_msg>Updated some comments in the code for RBL-4191<commit_after>import mint.client
import mint.config
import mint.shimclient

from restlib.controller import RestController

from catalogService import userInfo
from catalogService import serviceInfo
from catalogService.rest.response import XmlResponse, XmlStringResponse
from catalogService.rest import users
from catalogService.rest import clouds

class CatalogServiceController(RestController):
    urls = {'clouds' : clouds.AllCloudController,
            'users' : users.UsersController,
            'userinfo' : 'userinfo',
            'serviceinfo' : 'serviceinfo'}

    def __init__(self, cfg):
        RestController.__init__(self, None, None, [cfg])
        self.loadCloudTypes()

    def loadCloudTypes(self):
        self._getController('clouds').loadCloudTypes()

    def _getController(self, url):
        return self.urls[url]

    def userinfo(self, request):
        responseId = "%s/userinfo" % request.baseUrl
        response = userInfo.UserInfo(id = responseId,
            username = request.mintAuth.username,
            isAdmin = bool(request.mintAuth.admin))
        return XmlResponse(response)
    
    def serviceinfo(self, request):
        responseId = "%s/serviceinfo" % request.baseUrl
        # TODO:  Get proper version/type in here.  See RBL-4191.
        # For type, client needs "full", "limited", or "disabled"
        response = serviceInfo.ServiceInfo(id = responseId,
            version = "1",
            type = "full")
        return XmlResponse(response)
{'fraction_non_alphanumeric': 0.09200401472064236, 'fraction_numerical': 0.00468384074941452, 'mean_word_length': 3.095890410958904, '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': '2615379', 'n_tokens_mistral': 812, 'n_tokens_neox': 788, 'n_words': 206}