This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib, urllib2, json | |
class CanLIIException(Exception): | |
def __str__(self): | |
return repr(self.args) | |
class CanLII(object): | |
def __init__(self, api_key, language = 'en'): | |
self.address = "http://api.canlii.org/v1/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
D = """ | |
xxxxxx | |
xx xxxx | |
xxxxxxxx | |
xxxx | |
xxxxxxxxxxxx xxx | |
xxxxxxxxxxxxx xxxx | |
xxxxxxxxxxxxx xxxx | |
xxxx xxxx | |
xxxx xxxxxxxxxxxxx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urwid | |
from urwid.util import calc_width | |
class RTLTextLayout(urwid.TextLayout): | |
""" | |
A toy text layout that arranges all characters from | |
right to left. | |
Only works with unicode strings and narrow characters | |
Currently fails if text is too long for the line |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def split_bars(v): | |
i = iter(v.split('|')) | |
while True: | |
part = next(i) | |
while part.endswith('\\'): | |
part = part[:-1] + '|' + next(i) | |
yield part.replace('\\\\', '\\') |
NewerOlder