uw package¶
Subpackages¶
- uw.local package
- Subpackages
- 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.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.outgoing package
- uw.local.print_ package
- uw.local.quest package
- uw.local.teaching package
- Subpackages
- uw.local.teaching.bin package
- Submodules
- uw.local.teaching.bin.crowdmark_create_json module
- uw.local.teaching.bin.crowdmark_save_qr_codes module
- uw.local.teaching.bin.daily_notify module
- uw.local.teaching.bin.import_final_exams module
- uw.local.teaching.bin.main_web module
- uw.local.teaching.bin.send_final_examination_reminder module
- uw.local.teaching.bin.send_instructor_setup_reminders 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
- Module contents
- uw.local.teaching.db package
- 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.admin module
- uw.local.teaching.webui.admin_exams_edit 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.coordinators module
- uw.local.teaching.webui.crowdmark module
- uw.local.teaching.webui.delegate module
- uw.local.teaching.webui.exam module
- uw.local.teaching.webui.exam_crowdmark module
- uw.local.teaching.webui.exam_edit module
- uw.local.teaching.webui.exam_render module
- uw.local.teaching.webui.exam_version module
- uw.local.teaching.webui.grades 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.print_ module
- uw.local.teaching.webui.room module
- uw.local.teaching.webui.room_edit module
- uw.local.teaching.webui.room_render module
- uw.local.teaching.webui.schedule 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.grad package
- Submodules
- uw.local.config module
- uw.local.dbtools module
- uw.local.termtools module
- uw.local.webtools module
- Module contents
- Subpackages
- uw.parse 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.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
.-
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()
.
-
realname
¶ The realname associated with the email address.
-
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.
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
.