uw package¶
Subpackages¶
- uw.local package
- Subpackages
- uw.local.deploy package
- uw.local.grad package
- Subpackages
- uw.local.grad.bin package
- uw.local.grad.db package
- uw.local.grad.webui package
- Submodules
- uw.local.grad.webui.ajax module
- uw.local.grad.webui.analysis module
- uw.local.grad.webui.authority module
- uw.local.grad.webui.coordinator module
- uw.local.grad.webui.delegate module
- uw.local.grad.webui.director module
- uw.local.grad.webui.faculty module
- uw.local.grad.webui.list module
- uw.local.grad.webui.list_render module
- uw.local.grad.webui.roles module
- uw.local.grad.webui.stats module
- uw.local.grad.webui.util module
- uw.local.grad.webui.view module
- uw.local.grad.webui.view_accept module
- uw.local.grad.webui.view_comments module
- uw.local.grad.webui.view_compilation module
- uw.local.grad.webui.view_contact module
- uw.local.grad.webui.view_edit module
- uw.local.grad.webui.view_history module
- uw.local.grad.webui.view_main module
- uw.local.grad.webui.view_offer module
- uw.local.grad.webui.view_render module
- uw.local.grad.webui.wsgifunc module
- Module contents
- Module contents
- Subpackages
- uw.local.identity package
- uw.local.ofcourse package
- uw.local.outgoing package
- uw.local.print_ package
- uw.local.quest package
- Subpackages
- uw.local.quest.bin package
- uw.local.quest.db package
- uw.local.quest.webui package
- Submodules
- uw.local.quest.webui.ajax module
- uw.local.quest.webui.building module
- uw.local.quest.webui.compare module
- uw.local.quest.webui.course module
- uw.local.quest.webui.delegate module
- uw.local.quest.webui.format module
- uw.local.quest.webui.instructor module
- uw.local.quest.webui.room module
- uw.local.quest.webui.schema module
- uw.local.quest.webui.subject module
- uw.local.quest.webui.term module
- uw.local.quest.webui.timetable module
- uw.local.quest.webui.timetable_test module
- uw.local.quest.webui.ui module
- uw.local.quest.webui.unit module
- uw.local.quest.webui.wsgifunc module
- Module contents
- Module contents
- Subpackages
- uw.local.teaching package
- Subpackages
- uw.local.teaching.bin package
- Submodules
- uw.local.teaching.bin.crowdmark_create_json module
- uw.local.teaching.bin.crowdmark_process_pdf module
- uw.local.teaching.bin.crowdmark_save_qr_codes module
- uw.local.teaching.bin.crowdmark_upload_pdf module
- uw.local.teaching.bin.daily_notify module
- uw.local.teaching.bin.generate_cyon module
- uw.local.teaching.bin.main_web module
- uw.local.teaching.bin.markbox_create_assessment module
- uw.local.teaching.bin.markbox_get_pdf module
- uw.local.teaching.bin.markbox_send_classlist module
- uw.local.teaching.bin.send_final_examination_reminder module
- uw.local.teaching.bin.send_instructor_setup_reminders module
- uw.local.teaching.bin.send_scheduling_coordinator_reminder module
- uw.local.teaching.bin.send_scheduling_rep_reminder module
- uw.local.teaching.bin.submit_cel_coversheets module
- uw.local.teaching.bin.submit_exam_print module
- uw.local.teaching.bin.submit_grade_revisions module
- uw.local.teaching.bin.submit_posting_pads module
- uw.local.teaching.bin.ta_eval_approve_reminder module
- Module contents
- uw.local.teaching.command package
- uw.local.teaching.db package
- Submodules
- uw.local.teaching.db.aids module
- uw.local.teaching.db.classlist module
- uw.local.teaching.db.crowdmark module
- uw.local.teaching.db.cursor module
- uw.local.teaching.db.cyon module
- uw.local.teaching.db.exam_import_rooms module
- uw.local.teaching.db.exam_import_times module
- uw.local.teaching.db.exam_print module
- uw.local.teaching.db.markbox module
- uw.local.teaching.db.pdf module
- Module contents
- uw.local.teaching.webui package
- Subpackages
- uw.local.teaching.webui.ta package
- Submodules
- uw.local.teaching.webui.ta.admin module
- uw.local.teaching.webui.ta.entitlement module
- uw.local.teaching.webui.ta.eval module
- uw.local.teaching.webui.ta.planner module
- uw.local.teaching.webui.ta.position module
- uw.local.teaching.webui.ta.setup module
- uw.local.teaching.webui.ta.student module
- uw.local.teaching.webui.ta.ta module
- uw.local.teaching.webui.ta.ui module
- Module contents
- uw.local.teaching.webui.ta package
- Submodules
- uw.local.teaching.webui.accommodation module
- uw.local.teaching.webui.accommodation_test module
- uw.local.teaching.webui.admin module
- uw.local.teaching.webui.admin_account_edit module
- uw.local.teaching.webui.admin_exams_edit module
- uw.local.teaching.webui.administer module
- uw.local.teaching.webui.administer_test module
- uw.local.teaching.webui.aids_edit module
- uw.local.teaching.webui.api module
- uw.local.teaching.webui.authority module
- uw.local.teaching.webui.candidate module
- uw.local.teaching.webui.candidate_test module
- uw.local.teaching.webui.coordinators module
- uw.local.teaching.webui.crowdmark module
- uw.local.teaching.webui.crowdmark_test module
- uw.local.teaching.webui.delegate module
- uw.local.teaching.webui.division module
- uw.local.teaching.webui.enrolment module
- uw.local.teaching.webui.enrolment_test module
- uw.local.teaching.webui.eval_view module
- uw.local.teaching.webui.exam module
- uw.local.teaching.webui.exam_edit module
- uw.local.teaching.webui.exam_edit_test module
- uw.local.teaching.webui.exam_render module
- uw.local.teaching.webui.exam_scan module
- uw.local.teaching.webui.exam_scan_test module
- uw.local.teaching.webui.exam_schedule module
- uw.local.teaching.webui.exam_schedule_test module
- uw.local.teaching.webui.exam_version module
- uw.local.teaching.webui.exam_version_test module
- uw.local.teaching.webui.grades module
- uw.local.teaching.webui.grades_test module
- uw.local.teaching.webui.integration module
- uw.local.teaching.webui.new_features module
- uw.local.teaching.webui.offering module
- uw.local.teaching.webui.offering_conflict module
- uw.local.teaching.webui.offering_edit module
- uw.local.teaching.webui.order_edit module
- uw.local.teaching.webui.override_uploader module
- uw.local.teaching.webui.personnel module
- uw.local.teaching.webui.print_ module
- uw.local.teaching.webui.room module
- uw.local.teaching.webui.room_create module
- uw.local.teaching.webui.room_edit module
- uw.local.teaching.webui.room_render module
- uw.local.teaching.webui.room_render_test module
- uw.local.teaching.webui.schedule module
- uw.local.teaching.webui.schedule_test module
- uw.local.teaching.webui.sitting module
- uw.local.teaching.webui.sitting_edit module
- uw.local.teaching.webui.special module
- uw.local.teaching.webui.term module
- uw.local.teaching.webui.ui module
- uw.local.teaching.webui.upload module
- uw.local.teaching.webui.wsgifunc module
- Module contents
- Subpackages
- uw.local.teaching.bin package
- Module contents
- Subpackages
- uw.local.userdb package
- uw.local.util package
- uw.local.uwdata package
- uw.local.watiam package
- uw.local.wcms package
- Submodules
- uw.local.config module
- uw.local.dbtools module
- uw.local.debug module
- uw.local.termtools module
- uw.local.termtools_test module
- uw.local.webtools module
- Module contents
- Subpackages
- uw.parse package
- uw.scientia package
- uw.sql package
- uw.web package
Submodules¶
uw.color module¶
Color-manipulating utility routines.
Convenient functions for converting between RGB and HSV color spaces, formatting colors for use in HTML/CSS, and generating a series of (relatively) contrasting hues.
-
uw.color.
hsv2rgb
(hsv)[source]¶ Convert HSV color to RGB.
- Parameters
hsv – a 3-tuple containing the H, S, and V values.
- Returns
the RGB representation of the color as a 3-tuple.
-
uw.color.
html_row
(i, hsv)[source]¶ Create a table row to demonstrate a hue.
- Parameters
i (int) – the number of the row within the table, for inclusion in the first column.
hsv – the color to demonstrate.
- Returns
an HTML <tr> element showing the color, as well as related colors with 70% and 40% of the saturation of the given color.
For use by
html_sample()
.
-
uw.color.
html_sample
(n)[source]¶ Create a sample HTML page showing hues generated by
hues()
.- Parameters
n (int) – the number of hues to generate.
- Returns
an HTML document containing a table with one row per hue.
-
uw.color.
hues
(start=0)[source]¶ Generate a sequence of hues intended to be contrasting.
- Parameters
start – the starting point in the sequence of colors.
- Returns
a generator which returns successive hue values.
The hues start out with red (assuming the default start value is used) and rotate around the spectrum spaced out so that the set of hues returned up to any point is evenly distributed according to hue values. No attempt is made to optimize the distribution for human color perception, i.e., filling in some parts of the spectrum more or less densely to improve the human-visible contrast.
uw.dbtools module¶
General-purpose utility routines related to the database.
This module is for general-purpose utility routines that relate to the Postgres database.
uw.emailutils module¶
Email-related utilities.
Contains a class that provides a simple extension of some Python standard
email.utils
routines.
-
class
uw.emailutils.
emailaddr
[source]¶ Bases:
tuple
Simple class to represent an email address.
- Parameters
realname – the realname to be displayed with the email address, or empty for no real name.
email – the email address itself.
Instances are always 2-tuples. The two elements are the realname and address. This mostly just wraps procedures in
email.utils
.-
property
email
¶ The email address itself.
-
static
parse
(fieldvalues)[source]¶ Parse email addresses using
email.utils.getaddresses()
.
-
static
parse1
(address)[source]¶ Parse a single email address using
email.utils.parseaddr()
.
-
property
realname
¶ The realname associated with the email address.
-
property
valid
¶ Perform a simple check for validity.
Runs this address through
email.utils.getaddresses()
and verifies that the result is a single address whose address component contains an ‘@’.
uw.stringtools module¶
String-handling utilities.
Contains a procedure to facilitate multiple string substitutions, and a
slight enhancement of the Python-standard str.strip()
.
-
uw.stringtools.
multiReplace
(changes)[source]¶ Create a procedure to perform multiple string substitutions.
- Parameters
changes (dict) – dictionary of substitutions; keys will be replaced by values.
The returned procedure expects a string and returns a string. The result string consists of the input string with the specified substitutions performed.
The changes are a dictionary of find/replace values. The “find” values (dictionary keys) are simultaneously found and each occurrence is replaced by the corresponding “replace” value (dictionary value).
Works by constructing a regular expression corresponding to the alternation of the keys of the dictionary. In the event that “find” strings overlap, behaviour is determined by the
re
library.A special case allows for correct handling of the “empty dictionary” case of no replacements.
-
uw.stringtools.
normalize_table_whitespace
(grid)[source]¶ Normalize whitespace for a 2 dimensional array of strings.
- Parameters
grid – An iterable of lists of strings.
- Returns
An iterator of lists of strings.
Apply
strip_string()
to each element of the provided 2D array of strings; also use None values to extend each element of the outer array to the length of the longest element.
-
uw.stringtools.
parse_tabular_file
(columns, request, header_skip=0, line_field=None)[source]¶ Parse a file of tabular data according to the specified columns.
- Parameters
columns (list) – A list of column specifications. Each one must be a 3-tuple consisting of the heading in the file which will identify the column, the fieldname in the result of the parse, and a parser to process values from the column.
request – A 2D array of values representing the input. Each value is either a string or None; None values will not be parsed but just passed through as None to the output.
header_skip (int) – The number of initial header lines to skip.
line_field (str) – The field name in the output to set to the line number, or None for no such field name.
- Returns
A 2-tuple of result rows and errors.
The first non-skipped line is interpreted as column headings. These are matched with the first elements of the provided columns to identify which columns of the file will be parsed. Additional columns not given in columns are permitted, but all columns given in columns must be present in the headings line.
The remaining rows are parsed. Each element that corresponds to one of the provided columns is parsed using the corresponding parser. Each row becomes a namedtuple.
-
uw.stringtools.
split_upload_text
(text)[source]¶ Split field content text into a rectangular array of field values.
- Parameters
text (str) – The field content text.
- Returns
A list of lists of field values.
The field content is split into lines. Then each line is divided either on tabs (if every line has a tab), or according to CSV rules (otherwise). Finally, the result is normalized using
normalize_table_whitespace()
.
-
uw.stringtools.
strip_string
(s)[source]¶ Trim whitespace off a string, and recognize empty strings.
- Parameters
s (str) – the string to strip.
This is intended for processing text form fields. It strips whitespace off the ends of the string; if an empty string is all that remains, None is returned. None is also returned if s is None.
Module contents¶
Top-level package for UW-written Python code.
This is the top-level package for locally-written Python code.
Code that is actually specific to UW applications belongs in uw.local
,
while code that could be useful outside of UW and is designed without local
assumptions goes outside of uw.local
.