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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>org.mongo.mongod</string> | |
<key>RunAtLoad</key> | |
<true/> | |
<key>ProgramArguments</key> | |
<array> |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
</head> | |
<body> | |
{% for category, message in get_flashed_messages(with_categories=true) %} | |
<div>{{ message }}</div> | |
{% endfor %} | |
<form action="{{ url_for("post") }}" method="post"> |
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
from flask import session | |
from flask.ext.babel import lazy_gettext | |
from traceback import format_exc | |
import os | |
import pickle | |
text = lazy_gettext('foo') | |
repr(text) # "lu'foo'" | |
text.value # u'foo' | |
text.__getattribute__('value') # u'foo' |
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
from flask.ext.babel import lazy_gettext | |
import os | |
import pickle | |
text = lazy_gettext('foo') | |
pickle.dump(text, open('lazy.string', 'wb')) | |
broken = pickle.load(open('lazy.string', 'rb')) | |
os.remove('lazy.string') | |
broken._kwargs # Traceback ... RuntimeError: maximum recursion depth exceeded while calling a Python object |
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
# -*- coding: utf-8 -*- | |
""" | |
LRU Cache. | |
:author: Jonathan Zempel | |
""" | |
from threading import Lock | |
from unittest import main, TestCase | |
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 survivor(count): | |
if count >= 2: | |
survivors = range(1, count + 1) | |
start = 1 | |
last = survivors[-1] | |
while len(survivors) > 1: | |
survivors = survivors[start::2] | |
start = 1 if last == survivors[-1] else 0 | |
last = survivors[-1] |
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
from blueprint import example | |
from extensions import mail | |
from flask import Flask | |
import settings | |
def create_app(settings=settings): | |
ret_val = Flask(__name__) | |
ret_val.config.from_object(settings) | |
# initialize extensions... |
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
from blueprint import example | |
from extensions import celery, mail | |
from flask import Flask | |
import settings | |
def create_app(settings=settings): | |
ret_val = Flask(__name__) | |
ret_val.config.from_object(settings) | |
# initialize extensions... |
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 diff(module1, module2): | |
"""Determine the difference in constant definitions between two modules. | |
:param module1: First module with constants. | |
:param module2: Second module with constants. | |
""" | |
_and = {} | |
_or = {} | |
_xor = {module1: {}, module2: {}} |
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 re | |
def duplicates(module): | |
"""Determine if the given module contains multiple definitions for the | |
same constant. | |
:param module: The module to check. | |
""" | |
ret_val = set() |
OlderNewer