Beispiel #1
0
def getLineObjs():
    filePath = os.path.expanduser(PICKLE_FILE)
    lineObjs = pickle.load(open(filePath))
    matches = [lineObj for lineObj in lineObjs.values()
               if isinstance(lineObj, LineMatch)]
    logger.addEvent('total_num_files', len(lineObjs))

    selectionPath = os.path.expanduser(SELECTION_PICKLE)
    if os.path.isfile(selectionPath):
        selectedIndices = pickle.load(open(selectionPath))
        for index in selectedIndices:
            if index < len(matches):
                matches[index].is_selected = True

    if not matches:
        output.writeToFile('echo "No lines matched!!"')
        sys.exit(0)
    return lineObjs
Beispiel #2
0
def getLineObjs():
    filePath = os.path.expanduser(PICKLE_FILE)
    lineObjs = pickle.load(open(filePath))
    matches = [lineObj for i, lineObj in lineObjs.items()
               if not lineObj.isSimple()]
    logger.addEvent('total_num_files', len(lineObjs.items()))

    selectionPath = os.path.expanduser(SELECTION_PICKLE)
    if os.path.isfile(selectionPath):
        selectedIndices = pickle.load(open(selectionPath))
        for index in selectedIndices:
            if index < len(matches):
                matches[index].setSelect(True)

    if not len(matches):
        output.writeToFile('echo "No lines matched!!"')
        sys.exit(0)
    return lineObjs
Beispiel #3
0
def getLineObjs():
    filePath = stateFiles.getPickleFilePath()
    try:
        lineObjs = pickle.load(open(filePath, 'rb'))
    except:
        output.appendError(LOAD_SELECTION_WARNING)
        sys.exit(1)
    logger.addEvent('total_num_files', len(lineObjs.items()))

    selectionPath = stateFiles.getSelectionFilePath()
    if os.path.isfile(selectionPath):
        setSelectionsFromPickle(selectionPath, lineObjs)

    matches = [lineObj for i, lineObj in lineObjs.items()
               if not lineObj.isSimple()]
    if not len(matches):
        output.writeToFile('echo "No lines matched!!"')
        sys.exit(0)
    return lineObjs
Beispiel #4
0
def getLineObjs():
    filePath = stateFiles.getPickleFilePath()
    try:
        lineObjs = pickle.load(open(filePath, 'rb'))
    except:
        output.appendError(LOAD_SELECTION_WARNING)
        sys.exit(1)
    logger.addEvent('total_num_files', len(lineObjs.items()))

    selectionPath = stateFiles.getSelectionFilePath()
    if os.path.isfile(selectionPath):
        setSelectionsFromPickle(selectionPath, lineObjs)

    matches = [lineObj for i, lineObj in lineObjs.items()
               if not lineObj.isSimple()]
    if not len(matches):
        output.writeToFile('echo "No lines matched!!"')
        sys.exit(0)
    return lineObjs
Beispiel #5
0
def getLineObjs():
    filePath = os.path.expanduser(PICKLE_FILE)
    lineObjs = pickle.load(open(filePath))
    matches = [
        lineObj for lineObj in lineObjs.values()
        if isinstance(lineObj, LineMatch)
    ]
    logger.addEvent('total_num_files', len(lineObjs))

    selectionPath = os.path.expanduser(SELECTION_PICKLE)
    if os.path.isfile(selectionPath):
        selectedIndices = pickle.load(open(selectionPath))
        for index in selectedIndices:
            if index < len(matches):
                matches[index].is_selected = True

    if not matches:
        output.writeToFile('echo "No lines matched!!"')
        sys.exit(0)
    return lineObjs
Beispiel #6
0
def getLineObjs():
    filePath = os.path.expanduser(PICKLE_FILE)
    lineObjs = pickle.load(open(filePath))
    matches = [
        lineObj for lineObj in lineObjs.values()
        if isinstance(lineObj, LineMatch)
    ]
    logger.addEvent('total_num_files', len(lineObjs))

    selectionPath = os.path.expanduser(SELECTION_PICKLE)
    if os.path.isfile(selectionPath):
        selectedIndices = pickle.load(open(selectionPath))
        for index in selectedIndices:
            if index < len(matches):
                matches[index].is_selected = True

    if not matches:
        output.writeToFile('echo "No lines matched!!"')
        sys.exit(0)
    return lineObjs


if __name__ == '__main__':
    if not os.path.exists(os.path.expanduser(PICKLE_FILE)):
        print('Nothing to do!')
        output.writeToFile('echo ":D"')
        sys.exit(0)
    output.clearFile()
    curses.wrapper(doProgram)
Beispiel #7
0
    screen.control()


def getLineObjs():
    filePath = os.path.expanduser(PICKLE_FILE)
    lineObjs = pickle.load(open(filePath))
    matches = [lineObj for i, lineObj in lineObjs.items()
               if not lineObj.isSimple()]
    logger.addEvent('total_num_files', len(lineObjs.items()))

    selectionPath = os.path.expanduser(SELECTION_PICKLE)
    if os.path.isfile(selectionPath):
        selectedIndices = pickle.load(open(selectionPath))
        for index in selectedIndices:
            if index < len(matches):
                matches[index].setSelect(True)

    if not len(matches):
        output.writeToFile('echo "No lines matched!!"')
        sys.exit(0)
    return lineObjs


if __name__ == '__main__':
    if not os.path.exists(os.path.expanduser(PICKLE_FILE)):
        print 'Nothing to do!'
        output.writeToFile('echo ":D"')
        sys.exit(0)
    output.clearFile()
    curses.wrapper(doProgram)
Beispiel #8
0
from csvData import CsvData
from assignmentPath import AssignmentPath
import output

csvData = CsvData()
columnNames = csvData.getColumnNames()
studentGrades = csvData.getStudentGrades()

assignmentPath = AssignmentPath()
print("Mark file generated for the following students:")
count = 0
for studentID, dataPair in studentGrades.items():
    writePath = assignmentPath.findLatestAssignmentPathOfStudent(studentID)
    if writePath is None:
        print("Could not find the assignment path for student " + str(studentID))
    else:
        content = output.determineFileContent(columnNames, dataPair)
        output.writeToFile(writePath, "mark.txt", content)
        print(studentID)
        count += 1
print("Total of " + str(count) + " 'mark.txt' generated")
Beispiel #9
0
from bs4 import BeautifulSoup
import urllib2

import states
import webPage
import parseStateHomePhp
import output

for state in states.name:
    url = 'http://www.workerscompensation.com/regulations/statehome.php?state=' + state
    #print url
    html = webPage.open(url)
    stateHomeLinks = parseStateHomePhp.getLinks(html)
    #print stateHomeLinks
    i = 0
    for stateDepartmentLink in stateHomeLinks:
        # if i == :
        #     i = i+1
        output.writeToFile(state, stateDepartmentLink['title'],
                           stateDepartmentLink['url'])
    print '---------------------------------'