This file contains hidden or 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
# -*- coding: utf-8 -*- | |
import sys | |
from pprint import PrettyPrinter | |
class UnicodePrettyPrinter(PrettyPrinter): | |
"""Unicode-friendly PrettyPrinter | |
Prints: | |
- u'привет' instead of u'\u043f\u0440\u0438\u0432\u0435\u0442' |
This file contains hidden or 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
#!/usr/bin/env python2 | |
# coding: utf-8 | |
from __future__ import unicode_literals | |
import sys | |
import string | |
import textwrap | |
import webbrowser | |
from urlparse import urlparse | |
from argparse import ArgumentParser, RawDescriptionHelpFormatter |
This file contains hidden or 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
''' | |
*** | |
Modified generic daemon class | |
*** | |
Author: http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/www.boxedice.com | |
License: http://creativecommons.org/licenses/by-sa/3.0/ | |
Changes: 23rd Jan 2009 (David Mytton <[email protected]>) | |
- Replaced hard coded '/dev/null in __init__ with os.devnull | |
- Added OS check to conditionally remove code that doesn't |
This file contains hidden or 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
#!/usr/bin/env python | |
# codeing: utf-8 | |
import readline | |
import shlex | |
if __name__ == '__main__': | |
print 'Enter a command to do something, e.g. `create name price`.' | |
print 'To get help, enter `help`.' |
This file contains hidden or 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
# source: https://groups.google.com/forum/#!topic/wtforms/ur84vD5S66Y | |
# Not exactly, but there are multiple ways to do this in WTForms that | |
# are different, each with its own advantages. | |
# Old Method: For two completely different forms which you want to | |
# validate entirely separately, you can create two form instances, each | |
# with their own prefix. This was the only way prior to WTForms 0.4 or | |
# thereabouts, to run multiple forms. | |