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 sqlite3 | |
import sys | |
db_con = sqlite3.connect(":memory:") | |
db_con.text_factory = str | |
def safe_column_name(name): | |
""" | |
Modifies the column name so that it only contains alphanumeric |
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 gi.repository import Gtk | |
class LedControl(Gtk.Window): | |
""" | |
A simple app that changes images according to the button status. | |
""" | |
def __init__(self): | |
Gtk.Window.__init__(self, title="LED Control") | |
self.set_border_width(6) |
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 gi.repository import Gtk, GLib | |
class LedControl(Gtk.Window): | |
""" | |
A simple app that changes images according to the button status. | |
""" | |
def __init__(self): | |
Gtk.Window.__init__(self, title="LED Control") | |
self.set_border_width(6) |
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 make_text_table(row_count, column_width): | |
""" | |
Makes a textual table with the numbered rows and 2 columns. The first | |
column is 5 characters wide, the 2nd and 3rd columns are column_width | |
characters wide. | |
Params: | |
row_count The number of rows. The rows are then numbered | |
1 to row_count | |
column_width The width of the second and third column. | |
""" |
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 make_text_table(row_count, column_width): | |
print "+", | |
for width in range(5): | |
print "-", | |
for width in range(2): | |
print "+", | |
for width in range(column_width): | |
print "-", | |
print "+" | |
''' |
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 make_text_table(row_count, column_width): | |
""" | |
Makes a textual table with the numbered rows and 2 columns. The first | |
column is 5 characters wide, the 2nd and 3rd columns are column_width | |
characters wide. | |
Params: | |
row_count The number of rows. The rows are then numbered | |
1 to row_count | |
column_width The width of the second and third column. | |
""" |
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 make_text_table(row_count, column_width): | |
""" | |
Makes a textual table with the numbered rows and 2 columns. The first | |
column is 5 characters wide, the 2nd and 3rd columns are column_width | |
characters wide. | |
Params: | |
row_count The number of rows. The rows are then numbered | |
1 to row_count | |
column_width The width of the second and third column. | |
""" |
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 Expression(object): | |
def __add__(self, rt): | |
return Plus(self, rt) | |
def __sub__(self, rt): | |
return Minus(self, rt) | |
def __mul__(self, rt): | |
return Multiply(self, rt) | |
def __div__(self, rt): | |
return Divide(self, rt) |
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 copy | |
import sqlalchemy.engine.base | |
import sqlalchemy.dialects.mssql.base | |
import sqlalchemy.dialects.mssql.pyodbc | |
class SQLABaanRowProxy(sqlalchemy.engine.base.RowProxy): | |
def __init__(self, parent, row, processors, keymap): | |
""" | |
For all keys starting with "t_" adds also a "t$..." key. |
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 webob import Response | |
class TinyApp(object): | |
def __call__(self, environ, start_response): | |
resp = Response("""<html><body>AHOJ</body></html>""") | |
return resp(environ, start_response) | |
if __name__ == '__main__': | |
from wsgiref.simple_server import make_server |
OlderNewer