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
from pymongo import MongoClient | |
from bson import SON | |
from time import mktime | |
from datetime import datetime, timedelta | |
from time import mktime | |
from pprint import pprint | |
from random import randrange, randint, choice | |
def seed_position_times(db): |
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
;; 0. Given that `app` is a RING handler | |
;; 1. We have 6 functions: 3 to modify requests, 3 to modify responses | |
;; 1.1. Request modifiers | |
(defn modify-request-first [handler] | |
(fn [request] | |
(println "modify-request-first") ; "println" is a placeholder for real code | |
(handler request))) |
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
class PPrintMixin: | |
def __str__(self): | |
return '<{}: id={!r}>'.format(type(self).__name__, self.id) | |
def __repr__(self): | |
attrs = [] | |
for name in self._fields.keys(): | |
value = getattr(self, name) | |
if isinstance(value, (Document, EmbeddedDocument)): | |
attrs.append('\n {} = {!s},'.format(name, value)) |
NewerOlder