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
DCPU-16 Specification | |
Copyright 1985 Mojang | |
Version 1.7 | |
=== SUMMARY ==================================================================== | |
* 16 bit words | |
* 0x10000 words of ram |
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
class Todo(TinyModel): | |
schema = { | |
'title' : { 'type' : 'string', 'maxlength' : 35 }, | |
'text' : { 'type' : 'string' }, | |
'tags' : { 'type' : 'list', "default" : [] }, | |
"votes" : { "type" : "integer", "default" : 0 } | |
} |
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
@app.make_method_routes() | |
class HelloHandler(BaseHandler): | |
@route(r'/hello/<int:identifier>', dispatch=["get"]) | |
def hello(self, identifier=None): | |
self.write("Hello world! " + str(identifier)) | |
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
@app.add_rest_routes("task") | |
class Task(BaseHandler): | |
# | |
# every pow handler automatically gets these RESTful routes | |
# when you add the : app.add_rest_routes() decorator. | |
# | |
# 1 GET /todo #=> list | |
# 2 GET /todo/<uuid:identifier> #=> show | |
# 3 GET /todo/new #=> new | |
# 4 GET /todo/<uuid:identifier>/edit #=> edit |
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
@relation.has_many("subtasks") | |
@relation.setup_sql_schema() | |
class Task(Base): | |
schema = { | |
'title' : { 'type' : 'string', 'maxlength' : 35 }, | |
'text' : { 'type' : 'string' }, | |
"votes" : { "type" : "integer", "default" : 0 } | |
} |
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
schema = { | |
'title' : { 'type' : 'string', 'maxlength' : 35 }, | |
'text' : { 'type' : 'string' }, | |
'tags' : { 'type' : 'list', "default" : [] }, | |
"votes" : { "type" : "integer", "default" : 0 } | |
} |
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
# | |
# convert json data to a cerberus schema. | |
# Cerberus types see here: http://docs.python-cerberus.org/en/stable/validation-rules.html#type | |
# | |
# sampledata: https://www.json-generator.com/ | |
# | |
# this uses the first data element in a given json file to create | |
# a model(cerberus) schema from it. Trying to guess the right types (without too much effort) | |
# |
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 -*- | |
""" | |
This module is a proposal to add python's dataclass support to cerberus. | |
See Issue: #397 | |
https://github.com/pyeve/cerberus/issues/397 | |
And road-map: | |
1.3 | |
Checklist: | |
The module dataclasses is implemented. This may get postponed 'til a following minor release. (#397) |
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
# | |
# Test string comparison of string tuples | |
# python 3.4 | |
# using difflib. | |
# | |
# see also: http://stackoverflow.com/questions/36643618/scoring-consistency-within-dataset | |
# khz 04/2016 | |
# | |
import difflib | |
import random |
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 csv | |
import json | |
import sys | |
# | |
# | |
# converts csv to json | |
# fieldnames are taken from the first line of the csv input file | |
# | |
# khz / 2014 |
NewerOlder