Hi There!

I'm Dan Schlegel, an Associate Professor in the Computer Science Department at SUNY Oswego

CSC344 – Assignment 5

Microproject

Write a Python program which takes a single argument — a directory name. Your program will, for every file in the directory, count the number of lines in that file using the Unix command wc. Then, write to the console each file name and its number of lines.

Main Project

You will write a Python program to summarize the programming assignments in this course, collect all of the files together in a zip file, and email them. Assuming the programs are in subdirectories a1, a2, …, a5 of directory csc344, your program should:

  • create a summary_ai.xml file for each ai, which contains:
    • the name of each source file (linked to the file itself), along with the number of lines long the source file is, and
    • all identifiers used in the program (class, function, rule, variable etc names), omitting duplicates. You do NOT need to specially filter keywords or builtin functions, but do be sure to omit comments;
  • create a valid HTML web page in the csc344 directory called index.html with links to each of the summary files;
  • create a zip file containing all assignment sources, but excluding non-sources (executables, .class files, etc), while maintaining the directory structure. Also included should be the xml files created above. Be sure the links in the webpages work after extracted;
  • prompt the user for an email address and send the zip file.

For each item in your XML file, use a separate element. You will develop the schema used in your XML files. You will also write a XSLT file to allow display of your XML files. See this tutorial from w3schools for guidance on creating an XSLT file.

Extra Credit (your score * 1.1)

Instead of writing an XML file and using XSLT to display your output, write a JSON file from your Python program and an HTML file with embedded JavaScript to read and display its contents. Be sure the output is nicely formatted (not just the raw JSON file).

Dev Environment / Useful Resources

PyDev + Eclipse + Python 3.6.3
Regular Expressions in Python 3.6
Regular Expression Debugger / Tester