In general these frameworks provide functionality that covers one or more of the following:
- Routing: A mechanism for taking HTTP requests and routing them to some code that handles them and returns a response.
| """ | |
| BEGIN GPL LICENSE BLOCK | |
| (c) Dealga McArdle 2012 / blenderscripting.blogspot / digitalaphasia.com | |
| This program is free software; you may redistribute it, and/or | |
| modify it, under the terms of the GNU General Public License | |
| as published by the Free Software Foundation - either version 2 | |
| of the License, or (at your option) any later version. | 
| package fakeresponse | |
| import ( | |
| "testing" | |
| "net/http" | |
| ) | |
| type FakeResponse struct { | |
| t *testing.T | |
| headers http.Header | 
| # -*- coding: utf-8 -*- | |
| from uuid import uuid4 | |
| from datetime import timedelta | |
| from couchbase import Couchbase | |
| from couchbase import FMT_PICKLE | |
| from couchbase.exceptions import NotFoundError | 
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| """ | |
| A script to get the version of Python by which the file was compiled | |
| """ | |
| from __future__ import print_function | |
| import binascii | |
| import os | 
| val n = 9 | |
| val s = Math.sqrt(n).toInt | |
| type Board = IndexedSeq[IndexedSeq[Int]] | |
| def solve(board: Board, cell: Int = 0): Option[Board] = (cell%n, cell/n) match { | |
| case (r, `n`) => Some(board) | |
| case (r, c) if board(r)(c) > 0 => solve(board, cell + 1) | |
| case (r, c) => | |
| def guess(x: Int) = solve(board.updated(r, board(r).updated(c, x)), cell + 1) | |
| val used = board.indices.flatMap(i => Seq(board(r)(i), board(i)(c), board(s*(r/s) + i/s)(s*(c/s) + i%s))) | 
| import jwt | |
| from django.conf import settings | |
| from django.contrib.auth.models import User | |
| from rest_framework import exceptions | |
| from rest_framework.authentication import TokenAuthentication | |
| class JSONWebTokenAuthentication(TokenAuthentication): | 
| # Comparing serialization of complex GeoJSON geometries using: | |
| # | |
| # - standard lib json, marshal, pickle, cPickle | |
| # - umsgpack | |
| # - shapely.wkb | |
| # - geobuf (protobuf) | |
| # | |
| # The test case is a nearly circular polygon with 128 vertices. | |
| # | |
| # Python 2.7 because geobuf isn't possible on Python 3 (because | 
| from django.views.generic import FormView | |
| from django.utils.translation import ugettext_lazy as _ | |
| from django.contrib import messages | |
| from import_export.formats import base_formats | |
| from import_export.forms import ImportForm, ConfirmImportForm | |
| from import_export.resources import modelresource_factory | |
| from django.http import HttpResponseRedirect | |
| from import_export.tmp_storages import TempFolderStorage | |
| try: | 
| #include "thsq.h" | |
| #include "ti-lib.h" | |
| /*---------------------------------------------------------------------------*/ | |
| /* | |
| * Thingsquare lighting switch with slider. | |
| * | |
| * This client uses a linear potentiometer to set the dim level of the lights | |
| * in the network. To save power, we only power the potentiometer when we will | |
| * sample it, and we only send light control if it has moved enough. | |
| * |