Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
import tornado.ioloop | |
import tornado.web | |
import tornado.gen | |
import tornado.httpclient | |
class GenAsyncHandler(tornado.web.RequestHandler): | |
@tornado.web.asynchronous | |
@tornado.gen.engine | |
def get(self): |
# Copyright (c) 2010, Philip Plante of EndlessPaths.com | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: | |
# | |
# The above copyright notice and this permission notice shall be included in |
BaseApp = function(){ | |
this.params = { | |
'fdfdf' : 'dsad' | |
}; | |
this.init = function (params) { | |
var params = $.extend({}, this.params, params); | |
var a = this; | |
a.$content = $('#content'); |
<div class="hidden-xs hidden-sm panel panel-default"> | |
<div class="panel-heading"> | |
<h5 align="center">Сейчас на сайте</h5> | |
</div> | |
<div class="list-group"> | |
<li class="list-group-item">пользователей: {{ users_count|add:u_count }} ({{ users_count }})</li> | |
<li class="list-group-item">гостей: {{ anons_count|add:a_count }} ({{ anons_count }})</li> | |
</div> | |
</div> |
import asyncio | |
import tornado.ioloop | |
import tornado.web | |
import tornado.gen | |
from tornado.httpclient import AsyncHTTPClient | |
class AsyncRequestHandler(tornado.web.RequestHandler): | |
""" | |
https://github.com/rudyryk/python-samples/blob/master/hello_tornado/hello_asyncio.py |
# -*- coding: utf-8 -*- | |
import os, sys, locale | |
import site, os | |
locale.setlocale(locale.LC_TIME,'ru_RU.utf8') | |
#projects_root = '/home/codeboy/xxx/svn2/' | |
# | |
#if projects_root not in sys.path: |
// КОНТРОЛЛЕР | |
Ext.define('C300.controller.Base', { | |
extend: 'Ext.app.Controller', | |
stores:[ | |
'C300.store.streetStore' | |
], | |
views: [ |
### | |
# Sending sms via smsaero.ru gate | |
### | |
import requests | |
import time | |
import hashlib | |
def sms_sender( | |
number='79825552211', |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!