def readAll(inFolder):
    # Reads in the data from the input file and returns a
    # dictionary of PoliticalCard objects

    # Set file name
    path = inFolder + sys.argv[1].lower().capitalize() + "/"
    fileName = path + "politicalcards.txt"

    politicalCards = {}
    with open(fileName, "r") as politicalCardsFile:
        lineNumber = 1
        blocks = politicalCardsFile.read().split("\n\n")
        for block in blocks:
            # Each block is a political card
            lines = block.split("\n")
            for i in range(0, len(lines)):
                line = lines[i]
                if i == 0:
                    # Political name    (LAW)?
                    if line.strip()[-5:] == "(LAW)":
                        law = True
                        politicalName = line[:-6].strip()
                    else:
                        law = False
                        politicalName = line.strip()
                    assertNotEmpty(politicalName, fileName, lineNumber)
                    assertNotSeparator(politicalName, fileName, lineNumber)
                elif i == 1:
                    # Expansion
                    expansion = line.strip()
                    assertNotEmpty(expansion, fileName, lineNumber)
                    assertNotSeparator(expansion, fileName, lineNumber)
                elif i == 2:
                    # Flavor text
                    flavor = line.strip()
                    assertNotEmpty(flavor, fileName, lineNumber)
                    assertNotSeparator(flavor, fileName, lineNumber)
                    politicalCard = PoliticalCard(politicalName, law, expansion, flavor)
                else:
                    # Rule text line
                    ruleLine = line.strip()
                    assertNotEmpty(ruleLine, fileName, lineNumber)
                    assertNotSeparator(ruleLine, fileName, lineNumber)
                    politicalCard.addRuleText(ruleLine)
                lineNumber += 1
            lineNumber += 1
            politicalCards[politicalCard.getName() + politicalCard.getExpansion()] = politicalCard
    return politicalCards
def readAgenda(block, fileName, lineNumber):
	lines = block.split("\n")
	for i in range(0,len(lines)):
		line = lines[i]
		if line.strip()=="":
			continue
		elif i == 0:
			#Political name    (LAW) || (EVENT) ?
			if line.strip()[-5:] == "(LAW)":
				law = True
				event = False
				politicalName = line[:-6].strip()
			elif line.strip()[-7:] == "(EVENT)":
				law = False
				event = True
				politicalName = line[:-8].strip()
			else:
				law = False
				event = False
				politicalName = line.strip()
			assertNotEmpty(politicalName, fileName, lineNumber)
			assertNotSeparator(politicalName, fileName, lineNumber)
		elif i == 1:
			#Flavor text
			flavor = line.strip()
			assertNotEmpty(flavor, fileName, lineNumber)
			assertNotSeparator(flavor, fileName, lineNumber)
			agendaCard = PoliticalCard(politicalName, law, "Shards of the Throne", flavor, event)
		else:
			#Rule text line
			ruleLine = line.strip()
			assertNotEmpty(ruleLine, fileName, lineNumber)
			assertNotSeparator(ruleLine, fileName, lineNumber)	
			agendaCard.addRuleText(ruleLine)
		lineNumber += 1
	lineNumber += 1
	
	return agendaCard, lineNumber