counts assignment points
Project description
sum_pts
Reads an assignment file (source code or latex source) and counts how many points each problem is worth.
Installation
pip3 install sum-pts
Quick-Start
Given an input text file, like ex_hw0.py or ex_hw0.ipynb:
# Part 1 (10 points)
# some text or code here
# Part 2 (14 + 2 auto pt)
# some text or code here
# part 3 (14 pt + 3 extra credit really long name pts)
Run this module from its command line interface:
python3 -m sum_pts ex_hw0.py
to generate a markdown table which sums all points in assignment:
| part | | auto | extra credit really long name | part total |
|:-------|---:|:-------|:--------------------------------|-------------:|
| Part 1 | 10 | | | 10 |
| Part 2 | 14 | 2.0 | | 16 |
| part 3 | 14 | | 3.0 | 17 |
| total | 38 | 2.0 | 3.0 | 43 |
you can write this to a markdown or csv file with the -m
or -c
flags if desired. This example shows more than one type of point in a problem (e.g. 'auto', 'extra credit really long name') though the final 3 columns above would be removed if no other point type existed.
Advanced Usage
You can customize the behavior to support more use cases, such as LaTeX files by modifying the default regular expression configurations, available via the command line interface.
There are a few regular expression strings which specify how points are identified.
# Part 2 (14 + 2 auto pt)
- prefix matches the beginning of a line which contains points to be counted. default
'#'
- left and right mark the beginning and end of the "point block" (e.g.
(14 + 2 auto pt)
above). default'\\('
and'\\)'
- points must match at least once inside the point block for the problem to be included. default
'([Pp]ts?|[Pp]oints?)'
- pt_split a point block is split between different types of points (e.g. 'auto' and '' in the example) whenever this is matched. default
'[+&,]'
- rm_list is a list of regex strings which are deleted from problem names (e.g. part 1) and point types. by default it is empty, users can pass strings here via the
-r
command line option. see case 2 for motivating use case
Parsing:
- Find lines matching
'{prefix}.*{left}.*{points}.*{right}.*'
- The name of the problem is the whole match above, after removing prefix, left, right and points and rm_list
- The
{left}.*{points}.*{right}
string is split according to pt_split - Point types have left, right, points and rm_list removed
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file sum_pts-0.0.4.tar.gz
.
File metadata
- Download URL: sum_pts-0.0.4.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3943f8b88c8a8d5c8ae06ef04477e914f090354ba3e897678734907f8c283f07 |
|
MD5 | 22f57c68b859ce7682da12f95f90185f |
|
BLAKE2b-256 | 490938e59d4516cc0aef78563cd1518acc3c0b57c0006483292732d491efd334 |
File details
Details for the file sum_pts-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: sum_pts-0.0.4-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93fba06f26555f65c77b749e540aa47ade1f7036d4e9970ef689767b7f1cea30 |
|
MD5 | b8b892405920e7d9037a73d5f971a40b |
|
BLAKE2b-256 | adc229df7f71a4bfc8316057b8bbb61633aadf9e60a7a783f647d054138f0765 |