Esempio n. 1
0
    def parseToDancerSet(self):
        # name|email|lead/follow|code
        set = dancerSet.dancerSet()
        count = 0

        for line in self.file:
            arr = line.split("|")
            if (len(arr) != 4):
                print("Error: file contains incorrectly formatted line.")
                print(line)
            else:
                name = arr[0]
                email = arr[1]
                isLead = arr[2].lower() == "lead"
                code = arr[3]

                d = dancer(name, email, isLead, code)
                print(d.toStringNumName())
                set.addDancer(d)
                count += 1
                print(d.toStringNumName())

        print("Finished parsing {0} lines.".format(str(count)))
        self.file.close()
        return set
Esempio n. 2
0
def main():
    print("""Welcome to Partner Search
    
    This program allows you to run a ballroom dance partner search (or speed-dating, as they are the same thing)
    """)

    danceClub = dancerSet.dancerSet()

    while True:
        while True:
            try:
                printMainOptions()
                userInput = int(raw_input("Select function (0,1,2,3): "))
                validOptions = [0, 1, 2, 3]

                if userInput in validOptions:
                    print("")
                    break
                else:
                    print("Error: invalid function selection.")

            except ValueError:
                print("Error: you must enter a valid integer.")

        if userInput == 0:
            danceClub = setupDancers()
        elif userInput == 1:
            setupChoices(danceClub)
        elif userInput == 2:
            doPairings(danceClub)
        elif userInput == 3:
            doMatching(danceClub)
Esempio n. 3
0
    def parseToDancerSet(self):
        # name|email|lead/follow|code
        set = dancerSet.dancerSet()
        count = 0
        
        for line in self.file:
            arr = line.split("|")
            if (len(arr) != 4):
                print("Error: file contains incorrectly formatted line.")
                print(line)
            else:
                name = arr[0]
                email = arr[1]
                isLead = arr[2].lower() == "lead"
                code = arr[3]

                d = dancer(name, email, isLead, code)
                print(d.toStringNumName())
                set.addDancer(d)
                count += 1
                print(d.toStringNumName())
        
        print("Finished parsing {0} lines.".format(str(count)))
        self.file.close()        
        return set
        
Esempio n. 4
0
def main():
    print("""Welcome to Partner Search
    
    This program allows you to run a ballroom dance partner search (or speed-dating, as they are the same thing)
    """)
    
    danceClub = dancerSet.dancerSet()
    
    while True:
        while True:
            try:
                printMainOptions()
                userInput = int(raw_input("Select function (0,1,2,3): "))
                validOptions = [0,1,2,3]
                
                if userInput in validOptions:
                    print("")
                    break
                else:
                    print("Error: invalid function selection.")
        
            except ValueError:
                print("Error: you must enter a valid integer.")
            
        if userInput == 0:
            danceClub = setupDancers()
        elif userInput == 1:
            setupChoices(danceClub)
        elif userInput == 2:
            doPairings(danceClub)
        elif userInput == 3:
            doMatching(danceClub)