def BgBatchDoWork(self, sender, e):
     try:
         # We need a seperate instance of the DBHelper, because it's a different thread
         dbHelper = DatabaseHelper()
         dbHelper.addBatch( self._rtbBatch.Text, self )
     except Exception, e:
         print 'Batch Error: ', e
    def selectionchange(self, i):
        selectedDesignation = self.cb.currentText()
        databaseHelper = DatabaseHelper('steel_sections.sqlite')
        anglesData = databaseHelper.GetAnglesDataForADesignation(
            selectedDesignation)
        beamsData = databaseHelper.GetBeamsDataForADesignation(
            selectedDesignation)
        channelsData = databaseHelper.GetChannelsDataForADesignation(
            selectedDesignation)
        for row in anglesData:
            inx = anglesData.index(row)
            self.angletableWidget.insertRow(inx)
            for i in range(24):
                self.angletableWidget.setItem(inx, i,
                                              QTableWidgetItem(str(row[i])))

        for row in beamsData:
            inx = beamsData.index(row)
            self.beamstableWidget.insertRow(inx)
            for i in range(20):
                self.beamstableWidget.setItem(inx, i,
                                              QTableWidgetItem(str(row[i])))

        for row in channelsData:
            inx = channelsData.index(row)
            self.channelstableWidget.insertRow(inx)
            for i in range(21):
                self.channelstableWidget.setItem(inx, i,
                                                 QTableWidgetItem(str(row[i])))
Esempio n. 3
0
 def getConversaitonHistoryObject(self, userName):
     conversationHistory = DatabaseHelper().getValue(
         self.convoFile, userName)
     if (conversationHistory == False):
         #Create new conversation history object
         conversationHistory = UserConversation()
         conversationHistory.userName = userName
     return conversationHistory
Esempio n. 4
0
 def setUp(self):
     self.db = DatabaseHelper()
     self.db._tinydb.purge_tables()  #remove any pre-existing tables
     self.table = self.db.createTable(self.USERS_TABLE)
     self.sts = SimpleTestSuite()
     self.testRow = {
         'username': '******',
         'name': 'areeba',
         'age': 21,
         'country': 'CA'
     }
Esempio n. 5
0
    def find_home(self, response):
        """find homepage of identified target blog post,
        and stores it in the blogs database"""

        pageurl = str(response.request.url)

        homeurl = urlparse(pageurl)[0] + "://" + urlparse(pageurl)[1]
        title = self.get_title(homeurl)
        last_active = self.get_active(homeurl)
        # insert into database
        DatabaseHelper.make_new_url(pageurl, 'bloghome', title, last_active)
Esempio n. 6
0
 def createUser(self):
     # We create a dummy user for this client, in real world you'd either log in or sign up
     # but since we have already covered login and sign up in messaging app I won't do it here
     user = User()
     user.userName = '******'
     user.userId = 100
     # We need to populate friends list, by default I am just gonna add all users from users database
     # to our main user's friend list so they can see the news feed.
     # in this the main user cannot create a post item to post it to their news feed
     user.friendList = DatabaseHelper().getAllKeys(self.userDbFile)
     while not user.friendList:
         print "Please start the create feed script, imma check on you again in 2 seconds"
         user.friendList = DatabaseHelper().getAllKeys(self.userDbFile)
         time.sleep(2)
     return user
    def on_clickSaveAngle(self):
        print('Inside Save')
        rowCount = self.angletableWidget.rowCount()
        print(rowCount)
        if (rowCount == 0):
            return
        newAngle = []
        for i in range(24):
            item = self.angletableWidget.item(rowCount - 1, i)
            newAngle.append(item.text())

        print(newAngle)
        databaseHelper = DatabaseHelper('steel_sections.sqlite')
        databaseHelper.SaveNewAngle(newAngle)
        print('DOnE')
Esempio n. 8
0
def main() -> None:
    try:
        with open(CACHE_FILENAME, 'r') as cache:
            jobBoard: JobBoardModel = JobBoardModel.deserialize(cache)
    except FileNotFoundError:
        # Can't find cache. Assume no requests have been done yet.
        jobBoard = JobBoardModel()

    if not jobBoard.isReadyForRefresh():
        print(f'Not ready. Next refresh at {jobBoard.getNextRefreshTime()}')
        return None

    httpResponse: Response = requests.get(JOB_BOARD_URL)
    httpResponse.raise_for_status()

    # TODO: Update interval from response
    # RSS supplies a refresh interval (in minutes) for clients.
    # I don't expect it'll change often, so it's hard-coded for now.
    jobBoard = JobBoardModel(responseText=httpResponse.text,
                             lastRequested=datetime.datetime.now())

    with open(CACHE_FILENAME, 'w') as cache:
        jobBoard.serialize(cache)

    rssResponse: Element = ElementTree.fromstring(jobBoard.responseText)
    jobModels: List[JobModel] = JobModel.fromRssResponse(rssResponse)

    with DatabaseHelper() as dbHelper:
        print(f'Inserted {dbHelper.insert(jobModels)} job(s)')

    print(f'Next refresh at {jobBoard.getNextRefreshTime()}')
 def getPost(self, userName):
     # if this was a real system, I wouln't be storing the post objects inside user object
     # realistically I'd be storing the posts in a saparate database table where the primary key is userId
     # and the value is the list of posts, since I am lazy I have just stored everything in one database.
     userObj = DatabaseHelper().getValue(self.userDbFile, userName)
     # return the 10 most recent posts, please check the news feed ranking image for more info on this.
     return userObj.posts[-10:]
Esempio n. 10
0
 def getConversaitonHistoryObject(self, userName):
     conversationHistory = DatabaseHelper().getValue(
         self.convoFile, userName)
     if (conversationHistory == False):
         print "There is no conversation history between these users"
         return
     return conversationHistory
Esempio n. 11
0
 def storeInSeenPostsFile(self, user, friendUserName, posts):
     # here is the structure of the seen posts file:
     # Key -> userName Value -> {friendUserName: [postId1... postIdN]}
     friendHashTable = DatabaseHelper().getValue(self.seenPostsFile,
                                                 user.userName)
     if not friendHashTable:
         DatabaseHelper().writeToHash(self.seenPostsFile, user.userName,
                                      {friendUserName: posts})
         return
     if not (friendUserName in friendHashTable):
         friendHashTable[friendUserName] = posts
     else:
         friendHashTable[
             friendUserName] = friendHashTable[friendUserName] + posts
     DatabaseHelper().writeToHash(self.seenPostsFile, user.userName,
                                  friendHashTable)
 def __init__(self):
     self.users = None
     createUsers = CreateUsers()
     # if user's file exist then get users from there
     if not (path.exists(createUsers.userDbFile)):
         self.users = createUsers.populateDB()
     else:
         self.users = DatabaseHelper().getAllValues(createUsers.userDbFile)
    def InitWindow(self):

        self.addAngle = QPushButton("Add New Angle", self)
        self.addAngle.clicked.connect(self.on_clickAngle)
        self.addBeam = QPushButton("Add New Beam", self)
        self.addBeam.clicked.connect(self.on_clickBeam)
        self.addChannel = QPushButton("Add New Channel", self)
        self.addChannel.clicked.connect(self.on_clickChannel)
        self.angles = QLabel("Angles", self)
        self.beams = QLabel("Beams", self)
        self.channels = QLabel("Channels", self)

        self.setWindowTitle(self.title)
        self.setGeometry(self.top, self.left, self.width, self.height)
        self.cb = QComboBox(self)
        databaseHelper = DatabaseHelper('steel_sections.sqlite')
        angles = databaseHelper.GetAllDimesions()
        self.cb.addItem('Please select')
        for angle in angles:
            self.cb.addItem(angle[0])

        self.cb.currentIndexChanged.connect(self.selectionchange)

        self.createAngleTable()
        self.createBeamsTable()
        self.createChannelsTable()

        self.layout = QVBoxLayout()
        self.layout.addWidget(self.cb)

        self.layout.addWidget(self.angles)
        self.layout.addWidget(self.angletableWidget)
        self.layout.addWidget(self.addAngle)

        self.layout.addWidget(self.beams)
        self.layout.addWidget(self.beamstableWidget)
        self.layout.addWidget(self.addBeam)

        self.layout.addWidget(self.channels)
        self.layout.addWidget(self.channelstableWidget)
        self.layout.addWidget(self.addChannel)

        self.setLayout(self.layout)

        self.show()
Esempio n. 14
0
 def LogIn(self):
     print '-'*26
     print "|Welcome to login page|"
     print '-'*26
     userName = raw_input("Enter your user name: ")
     #Search database to find the user with the user name, if not found then show error
     while not(self.ifUserExistsInDb(userName)):
         userName = raw_input("Invalid user name, please enter a valid user name: ")
     self.currentUser = DatabaseHelper().getValue(self.userDatabase, userName)
Esempio n. 15
0
class UserHelper(metaclass=Singleton):
    USERS_TABLE = "users"

    def __init__(self):
        self.db = DatabaseHelper()

    def validateUniqueUsername(self, username: str):
        if self.db.get(self.USERS_TABLE, 'username', username) is None:
            return True
        else:
            return False

    '''
	Creates new User if username is unique.
	Returns object User if successful, None if username already exists.
	'''

    def createNewUser(self, username: str, password: str):
        if (self.validateUniqueUsername(username)):
            # create new user
            self.db.insert(self.USERS_TABLE, {
                'username': username,
                'password': password
            })
            return User(username)
        else:
            return None

    '''
	Returns User object if login info is correct, 
	otherwise returns None. 
	'''

    def getUser(self, username: str, password: str):
        user_raw = self.db.get(self.USERS_TABLE, 'username', username)
        if user_raw is None or user_raw['password'] != password:
            return None
        else:
            # serialize it into User object
            user = User(user_raw['username'])
            return user
Esempio n. 16
0
 def getUsersToAddFriends(self):
     users = DatabaseHelper().getAllValues(self.userDatabase)
     print "Here are list of users "
     for i in range(len(users)):
         user = users[i]
         if(user.userName == self.currentUser.userName):
             continue
         print "-"*50
         print user.firstName, " ", user.lastName
         print "Index Value: ", i
     print "-"*50
     ch = 'y'
     while(ch.lower() == 'y'):
         #We want to add at least 1 friend
         friendIdexValue = int(input('Please type index value of the user you would like to add as a friend: '))
         while(friendIdexValue < 0 or friendIdexValue > len(users)):
             friendIdexValue = int(input('Invalid entry, please enter another index value: '))
         self.currentUser.friendList.append(users[friendIdexValue]) 
         ch = raw_input('Would you like to add another friend ? y/n ')
     #update current user in database
     DatabaseHelper().writeToHash(self.userDatabase, self.currentUser.userName, self.currentUser)
Esempio n. 17
0
 def appendUnreadConvoToReadConvo(self, conversationHistoryObj, receiver):
     if (receiver in conversationHistoryObj.unreadMessages):
         conversationHistoryObj.conversationHistory[
             receiver] = conversationHistoryObj.conversationHistory[
                 receiver] + conversationHistoryObj.unreadMessages[receiver]
         del conversationHistoryObj.unreadMessages[receiver]
         #store the modified ch object in database
         DatabaseHelper().writeToHash(self.convoFile,
                                      conversationHistoryObj.userName,
                                      conversationHistoryObj)
     #Return the most recent 10 convos from the q
     return conversationHistoryObj.conversationHistory[receiver][-10:]
 def userPost(self, user):
     post = self.createPostObject(user.userName, len(user.posts),
                                  str(user.firstName + " " + user.lastName))
     print user.firstName, user.lastName, " " * 5, 'at', post.timeStamp
     if (post.contentType == 'image'):
         print post.picture
     else:
         print post.text
     # append post object to user object's posts list
     user.posts.append(post)
     # store it in database
     DatabaseHelper().writeToHash(CreateUsers().userDbFile, user.userName,
                                  user)
Esempio n. 19
0
    def check_wp(self, response):
        """identifies whether the page as an unvisited wordpress page
        and adds to database or updates backlinks accordingly"""
        # To-do: Improve filter- other pages can also contain this keyword

        url = str(response.request.url)
        iswp = False
        unique = False
        wpfound = 0
        for href in response.css('link::attr(href)'):
            # for debugging: print type(href)
            wpmatch = re.search('wp', str(href))
            if wpmatch:
                wpfound += 1
            if wpfound >= 3:
                iswp = True
                unique = DatabaseHelper.check_new_url(url, "wppages")
                # checks if wp page has not been previously stored
                if unique:
                    DatabaseHelper.make_new_url(url, "wppages")
                    # adds page into database
                break
        return iswp
Esempio n. 20
0
 def checkForPostDuplicacy(self, user, friendUserName, posts):
     # after getting these posts, we'd wanna not get these same posts again coz the user's already
     # seen them, so it's better to store these posts in a database and compare these posts to that
     # to make sure we are not serving duplicate posts.
     friendHashTable = DatabaseHelper().getValue(self.seenPostsFile,
                                                 user.userName)
     # if friend hash table empty
     if not friendHashTable:
         return posts
     # if friend not present in hash table
     if not (friendUserName in friendHashTable):
         return posts
     # if friend present in hash table, compare posts with seen posts and remove seen posts
     seenFriendPosts = friendHashTable[friendUserName]
     return list(set(posts) - set(seenFriendPosts))
Esempio n. 21
0
 def SignUP(self):
     print '-'*29
     print "|Welcome to Sign up page|"
     print '-'*29
     user = User()       
     user.firstName = raw_input("Enter your first name: ")
     user.lastName = raw_input("Enter your last name: ")
     user.email = raw_input("Enter email address: ")
     user.userName = raw_input("Enter desired user name: ")
     #find if the user name exist in database if so then prompt user to enter other user name
     while(self.ifUserExistsInDb(user.userName)):
         user.userName = raw_input("User name already taken, please enter another user name: ")
     # insert user in users database with key as user name and value as user object
     DatabaseHelper().writeToHash(self.userDatabase, user.userName, user)
     self.currentUser = user
Esempio n. 22
0
class DatabaseHelperTest:
    USERS_TABLE = "users"

    def setUp(self):
        self.db = DatabaseHelper()
        self.db._tinydb.purge_tables()  #remove any pre-existing tables
        self.table = self.db.createTable(self.USERS_TABLE)
        self.sts = SimpleTestSuite()
        self.testRow = {
            'username': '******',
            'name': 'areeba',
            'age': 21,
            'country': 'CA'
        }

    def testInsertAndGet(self):
        # assert a table was successfully created at setup
        self.sts.assertIsNot(None, self.db.getTables())

        # assert insertion and getting value is successful
        self.db.insert(self.USERS_TABLE, self.testRow)
        valuesActual = self.db.get(self.USERS_TABLE, 'username',
                                   'AreebaAziz_123')
        self.sts.assertEqual(self.testRow, valuesActual)

    def testUpdate(self):
        self.testRow['country'] = 'US'
        self.db.update(self.USERS_TABLE, 'username', 'AreebaAziz_123',
                       'country', 'US')
        valuesActual = self.db.get(self.USERS_TABLE, 'username',
                                   'AreebaAziz_123')
        self.sts.assertEqual(self.testRow, valuesActual)

    def runTests(self):
        self.setUp()
        self.testInsertAndGet()
        self.testUpdate()
        self.sts.finishTest()
Esempio n. 23
0
 def writeConvoHistoryObjToDB(self, userName, chObj):
     print "Writing convos to db"
     DatabaseHelper().writeToHash(self.convoFile, userName, chObj)
Esempio n. 24
0
 def __init__(self):
     self.db = DatabaseHelper()
Esempio n. 25
0
def start_algorithm(scheduleInfoId):
    conn = _mssql.connect(server=Constants.SERVER_IP, user=Constants.USER, password=Constants.PASSWORD,
                               database=Constants.DATABASE)
    conn.execute_query('SELECT * FROM Edu_Semesters_ScheduleInfo WHERE ID = %d', scheduleInfoId)

    semesterId = 0
    isBachelor = True
    yearOfAdmission = ''
    for row in conn:
        j = json.loads(row['Settings'])
        semesterId = j['semesterId']
        isBachelor = j['isBachelor']
        yearOfAdmission = j['yearsOfAdmission']

    helper = DatabaseHelper(semesterId, yearOfAdmission, isBachelor, scheduleInfoId)
    times = helper.getTimes()
    days = helper.getDays()

    [c, ad_options] = helper.readSettings()
    # c.set_voenka_day(3)
    # c.set_bekturova_day(4)
    print c.toString()

    rooms = helper.getRooms()
    teachers = helper.getTeachers()
    students = helper.getStudents()
    courses = helper.getCourses()
    courseClasses = helper.getCourseClasses()
    # print 'Length1: ', len(courseClasses)

    courseClasses = helper.createCourseClasses()
    # print 'Length2: ', len(courseClasses)

    if len(courseClasses) > 0:
        roomReservations = helper.getRoomReservations()

        conf = Configuration(rooms, teachers, courses, courseClasses, roomReservations, ad_options, times, days)

        conn.execute_non_query(
            'UPDATE Edu_Semesters_ScheduleInfo SET StatusID = 2 WHERE ID = %d',
            scheduleInfoId)
        s = Schedule(10, 3, 70, 10, c, conf)
        a = Algorithm(100, 10, 5, s, scheduleInfoId)
        a.Start()
    else: conn.execute_non_query(
            'UPDATE Edu_Semesters_ScheduleInfo SET StatusID = 3 WHERE ID = %d',
        scheduleInfoId)
Esempio n. 26
0
def LoadData():
    helper = DatabaseHelper()
    data = helper.loadDataset()
    rankings = helper.getPopularityRanks()
    return (data, rankings)
Esempio n. 27
0
def processRequest(req):
    dbHelper = None
    sourceIsTelegram = False
    telegramId = ""
    try:
        dbHelper = DatabaseHelper(DATABASE_PATH)
        response = None
        # Get name of current intent
        intentName = req.get("queryResult").get("intent").get("displayName")

        if intentName != "Termin aendern 4":
            dbHelper.clearTodoChangeTable(TEST_TELEGRAM_ID)

        # check if source is telegram
        source = req.get("originalDetectIntentRequest").get("source")
        username = ""
        if source:
            if source == "telegram":
                sourceIsTelegram = True
                # Get Telegram Id
                telegramId = req.get("originalDetectIntentRequest").get(
                    "payload").get("data").get("message").get("chat").get("id")

        #telegramId = TEST_TELEGRAM_ID

        if intentName == "Begruessung Intent":
            #Get Username
            if sourceIsTelegram:
                username = req.get("originalDetectIntentRequest").get(
                    "payload").get("data").get("message").get("chat").get(
                        "first_name")
                response = __processBegruessungIntent(dbHelper, telegramId,
                                                      username)
            else:
                response = __processBegruessungIntent(dbHelper, telegramId,
                                                      username)
        elif intentName == "Termin abfragen Datum":
            # Get date from request
            date = req.get("queryResult").get("parameters").get("Datum")
            if date:
                response = __processTerminAbfragenIntent(
                    dbHelper, telegramId, date)
            else:
                response = __proccessTerminHeuteIntent(dbHelper)
        elif intentName == "Termin abfragen Heute":
            response = __proccessTerminHeuteIntent(dbHelper, telegramId)
        elif intentName == "Termin abfragen Woche":
            response = __proccessTerminWocheIntent(dbHelper, telegramId)
        elif intentName == "Termin erstellen 2":
            #Get parameters from request
            datum = req.get("queryResult").get("parameters").get("Datum")
            uhrzeit = req.get("queryResult").get("parameters").get("Uhrzeit")
            dauer = req.get("queryResult").get("parameters").get("Dauer")
            ort = req.get("queryResult").get("parameters").get("Ort")
            titel = req.get("queryResult").get("parameters").get("Titel")
            response = __processTerminErstellenIntent(dbHelper, telegramId,
                                                      datum, uhrzeit, dauer,
                                                      ort, titel)
        elif intentName == "Termin löschen 2":
            datum = req.get("queryResult").get("parameters").get("Datum")
            uhrzeit = req.get("queryResult").get("parameters").get("Uhrzeit")
            titel = req.get("queryResult").get("parameters").get("Titel")
            response = __processTerminLoeschenIntent(dbHelper, telegramId,
                                                     datum, uhrzeit, titel)
        elif intentName == "Termin aendern 2":
            datum = req.get("queryResult").get("parameters").get("Datum")
            uhrzeit = req.get("queryResult").get("parameters").get("Uhrzeit")
            response = __processTerminChangeIntent(dbHelper, telegramId, datum,
                                                   uhrzeit)
        elif intentName == "Termin aendern 4":
            datum = req.get("queryResult").get("parameters").get("Datum")
            uhrzeit = req.get("queryResult").get("parameters").get("Uhrzeit")
            titel = req.get("queryResult").get("parameters").get("Titel")
            response = __processTermin4ChangeIntent(dbHelper, telegramId,
                                                    datum, uhrzeit, titel)
    except:
        print("Unexpected error:", sys.exc_info()[0])
    finally:
        dbHelper.closeConnection()

    print("Intent: {0} / Response: {1}".format(intentName, response))
    return response
Esempio n. 28
0
 def ifUserExistsInDb(self, userName):
     #Ideally we would have a different database server do this but this is just easy on client side to code for now.
     #Realistically this should take place on server side.
     return DatabaseHelper().isKeyInHash(self.userDatabase, userName)
                            choices=["file", "stdout", "database"],
                            help="Choose how to output the scraped data")
    arg_parser.add_argument("-dbinfo",
                            "--database_info",
                            metavar="FILE",
                            dest="dbinfo",
                            help=dbinfo_help_text)

    args = arg_parser.parse_args()
    if args.output == "database" and args.dbinfo is None:
        arg_parser.error("Missing database information file")
    print(
        "############### Roskilde band scraper - log {} ##############".format(
            datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')))
    rfbs = RfBandScraping(year)
    d = DatabaseHelper(rfbs.current_year)
    # d.insert_update_categories(rfbs.categories)

    #rfbs.get_music_as_list()
    rfbs.extract_bands2()
    # rfbs.spilletime_leg()
    # sys.exit()

    # rfbs.spilletime_leg()
    #rfbs.get_category()
    print("-------------------- Result: ---------------------------")
    pprint.pprint(rfbs.bands)
    d.insert_update_bands(rfbs.bands)
    d.cancel_bands(rfbs.bands)
    print("--------------------------------------------------------\n\n")
    #res = d.fetch_current_bands()
Esempio n. 30
0
def LoadDataForLocation(lat, lon, user):
    helper = DatabaseHelper()
    data = helper.loadDatasetForLocation(lat, lon, user)
    rankings = helper.getPopularityRanks()
    return (data, rankings)
Esempio n. 31
0
    def fit(self, trainset):
        AlgoBase.fit(self, trainset)

        # Compute item similarity matrix based on content attributes
        # Load up vectors for every hotel
        helper = DatabaseHelper()
        guestRatings = helper.getHotelGuestRatings()
        hotelRatings = helper.getHotelRatings()
        foodAndDrinks = helper.getFoodAndDrink()
        thingsToDo = helper.getThingsToDo()
        homeComforts = helper.getHomeComforts()
        sleepWell = helper.getSleepWell()
        thingsToEnjoy = helper.getThingsToEnjoy()
        freshenUp = helper.getFreshenUp()
        beEntertained = helper.getBeEntertained()
        stayConnected = helper.getStayConnected()

        #Computing content-based similarity matrix
        self.similarities = np.zeros(
            (self.trainset.n_items, self.trainset.n_items))
        for thisRating in range(self.trainset.n_items):
            if (thisRating % 100 == 0):
                self.log.debug(thisRating, ' of ', self.trainset.n_items)
            for otherRating in range(thisRating + 1, self.trainset.n_items):
                thisHotelID = int(self.trainset.to_raw_iid(thisRating))
                otherHotelID = int(self.trainset.to_raw_iid(otherRating))
                foodAndDrinkSimilarity = self.computeMultiDataSimularity(
                    thisHotelID, otherHotelID, foodAndDrinks)
                thingsToDoSimilarity = self.computeMultiDataSimularity(
                    thisHotelID, otherHotelID, thingsToDo)
                homeComfortsSimilarity = self.computeMultiDataSimularity(
                    thisHotelID, otherHotelID, homeComforts)
                sleepWellSimilarity = self.computeMultiDataSimularity(
                    thisHotelID, otherHotelID, sleepWell)
                thingsToEnjoySimilarity = self.computeMultiDataSimularity(
                    thisHotelID, otherHotelID, thingsToEnjoy)
                freshenUpSimilarity = self.computeMultiDataSimularity(
                    thisHotelID, otherHotelID, freshenUp)
                beEntertainedSimilarity = self.computeMultiDataSimularity(
                    thisHotelID, otherHotelID, beEntertained)
                stayConnectedSimilarity = self.computeMultiDataSimularity(
                    thisHotelID, otherHotelID, stayConnected)
                guestRatingSimilarity = self.computeRatingSimilarity(
                    thisHotelID, otherHotelID, guestRatings)
                hotelRatingsSimilarity = self.computeRatingSimilarity(
                    thisHotelID, otherHotelID, hotelRatings)

                self.similarities[thisRating, otherRating] = foodAndDrinkSimilarity * (
                    thingsToDoSimilarity * 1.5
                ) * homeComfortsSimilarity * sleepWellSimilarity * thingsToEnjoySimilarity * freshenUpSimilarity * beEntertainedSimilarity * stayConnectedSimilarity * guestRatingSimilarity * hotelRatingsSimilarity
                self.similarities[otherRating,
                                  thisRating] = self.similarities[thisRating,
                                                                  otherRating]

        return self