code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
# Populate the database for the SQL injection demo,
# it creates a DBS directory in the current working dir.
# Requires Gadfly on the python path, and a --allworkingmodules --oldstyle
# pypy-c.
# Passwords for the demo are just the reverse of user names.
import md5
import sys, os
import random
os.mkdir("DBS")
import... | Python |
"""
This example transparently intercepts and shows operations on
builtin objects. Requires the "--objspace-std-withtproxy" option.
"""
from tputil import make_proxy
def make_show_proxy(instance):
def controller(operation):
print "proxy sees:", operation
res = operation.delegate()
re... | Python |
"""
This small example implements a basic orthogonal persistence
mechanism on top of PyPy's transparent proxies.
"""
from tputil import make_proxy
list_changeops = set('__iadd__ __imul__ __delitem__ __setitem__ __setattr__'
'__delslice__ __setslice__ '
'append extend inser... | Python |
#!/usr/bin/env python
"""
Translator Demo
Run this file -- over regular Python! -- to analyse and type-annotate
the functions and class defined in this module, starting from the
entry point function demo().
Requires Pygame.
"""
# Back-Propagation Neural Networks
#
# Written in Python. See http:/... | Python |
#!/usr/bin/env python
"""
Translator Demo
Run this file -- over regular Python! -- to analyse and type-annotate
the functions and class defined in this module, starting from the
entry point function demo().
Requires Pygame.
"""
# Back-Propagation Neural Networks
#
# Written in Python. See http:/... | Python |
import time
def f(n):
if n > 1:
return n * f(n-1)
else:
return 1
import pypyjit
pypyjit.enable(f.func_code)
print f(7)
| Python |
import time
ZERO = 0
def f1(n):
"Arbitrary test function."
i = 0
x = 1
while i<n:
j = 0 #ZERO
while j<=i:
j = j + 1
x = x + (i&j)
i = i + 1
return x
try:
import pypyjit
except ImportError:
print "No jit"
else:
pypyjit.enable(f1.func_... | Python |
import time
def f(n):
r = 1
while n > 1:
r *= n
n -= 1
return r
import pypyjit
pypyjit.enable(f.func_code)
print f(7)
| Python |
from dbc import ContractAspect, ContractError
ContractAspect()
from contract_stack import Stack
def run():
"""This is an example of how contracts work
"""
print "*"*30
print "Creating an empty stack (max_size = 3)"
stack = Stack(3)
try:
print "Empty stack, pop() should fail"
s... | Python |
import sys, os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
| Python |
"""
This is an example usage of the 'thunk' object space of PyPy.
It implements transparent distributed object manipulation.
Start a server on a local port, say port 8888, with:
$ py.py -o thunk sharedref.py 8888
Waiting for connection on port 8888
Then start and connect a client from the s... | Python |
class Stack:
"""A very simple stack interface
(not very useful in Python)
"""
def __init__(self, max_size = 10):
self.max_size = max_size
self.elements = []
def _pre_pop(self):
return not self.is_empty()
def _post_pop(self, old, ret):
return ret == old.top() an... | Python |
"""This is an example that uses the (prototype) Logic Object Space. To run,
you have to set USE_GREENLETS in pypy.objspace.logic to True and do:
$ py.py -o logic producerconsumer.py
newvar creates a new unbound logical variable. If you try to access an unbound
variable, the current uthread is blocked, until the... | Python |
"""
Stackless demo.
This example only works on top of a pypy-c compiled with stackless features
and the signal module:
translate.py --stackless targetpypystandalone --withmod-signal
Usage:
pypy-c pickle_coroutine.py --start demo.pickle
Start the computation. You can interrupt it at any time by
... | Python |
#!/usr/bin/python2.4
#
# Copyright 2008 The RE2 Authors. All Rights Reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
"""Unittest for the util/regexp/re2/unicode.py module."""
import os
import StringIO
from google3.pyglib import flags
from google3.testing... | Python |
# Copyright 2008 The RE2 Authors. All Rights Reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
"""Parser for Unicode data files (as distributed by unicode.org)."""
import os
import re
import urllib2
# Directory or URL where Unicode tables reside.
_UNICOD... | Python |
# coding=utf-8
# (The line above is necessary so that I can use 世界 in the
# *comment* below without Python getting all bent out of shape.)
# Copyright 2007-2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may o... | Python |
#!/usr/bin/python
# Imports
import os, pygame
import opencv.adaptors as adaptors
# Basepaths
BASEDIR = 'capture'
TMPDIR = '/tmp/capture'
DATADIR = 'data'
def load_image(filename):
"""Loads and returns an image with pygame.
Parameters: string filename - location of the image to be loaded."""
try:
... | Python |
#!/usr/bin/python
# Imports
import sys, os
import pygame
import opencv
from opencv.cv import *
from opencv.highgui import *
from data import *
import scene
from inputbox import Inputbox
from conf import countdown_seconds, pictures_taken, max_amount_of_pics, amount_of_matches
class FaceDetect(object):
"""Used to ... | Python |
#!/usr/bin/python
# Imports
import os
import pygame
import scene
# Centers the window
os.environ['SDL_VIDEO_CENTERED'] = '1'
# Initialization of pygame
pygame.init()
# Setting a display with title.
size = 800, 600
screen = pygame.display.set_mode(size)
pygame.display.set_caption("Face Recognition")
print 'Starting... | Python |
#!/usr/bin/python
# Imports
import pygame, os, sys
from pygame import string
import MySQLdb, _mysql_exceptions
from conf import db_host, db_user, db_passwd
class SQL(object):
"""Contains functions to create, update, select or check things through the database."""
def __init__(self):
"""Initialization... | Python |
#!/usr/bin/python
# Imports
import os, sys
import pygame
from data import *
from faceDetect import FaceDetect
from inputbox import Inputbox
from sql import SQL
from dialog import Dialog
# main window parameters
main_buttons = ["Login", "Take Pictures", "Create User", "Quit"]
main_window = 'Main'
main_title = 'Choose ... | Python |
#!/usr/bin/python
# Imports
import sys
import pygame
import scene
class Inputbox(object):
"""Used when you want to know certain information which should be entered through key events."""
def __init__(self, screen, sql, scene):
"""Initialization of Inputbox.
Creates the necessary global parame... | Python |
#!/usr/bin/python
# Imports
import os
import opencv
from opencv.cv import *
from opencv.highgui import *
########## Variables ##########
# Database configuration
db_host = "localhost"
db_user = "root"
db_passwd = ""
# Amount of seconds untill the login sequence
countdown_seconds = 5
# Amount of pictures taken whe... | Python |
#!/usr/bin/python
import pygame
from data import *
class Dialog(object):
"""A Dialog has an 'Ok'-button as a standard and can have one extra.
Depending on the name of the extra button the function behind it should be written in de eventloop in main()."""
def __init__(self, screen, title, message, ext... | Python |
# -*- coding: utf-8 -*-
"""
@author: Bruno Cezar Rocha
@titter: @rochacbruno
@company: blouweb.com
@depends: http://www.wbotelhos.com/gridy/ - Jquery Gridy Plugin
@include: http://nyromodal.nyrodev.com/ - nyroModal
@include: http://css3buttons.michaelhenriksen.dk/ - CSS3 Buttons
@depends: http://www.web2py.com - web2p... | Python |
# -*- coding: utf-8 -*-
"""
PowerGrid
@Version Beta 0.1 - 22/07/2011
@author: Bruno Cezar Rocha
@titter: @rochacbruno
@company: blouweb.com
@depends: http://www.wbotelhos.com/gridy/ - Jquery Gridy Plugin
@include: http://nyromodal.nyrodev.com/ - nyroModal
@include: http://css3buttons.michaelhenriksen.dk/ - CSS3 Button... | Python |
## Test script for testing remote RPC CALLS WHICH NEED
## admin authentication
##
## Usage: python testAdminXMLRPC.py [local]
import os,sys
import xmlrpclib
import pprint
#VMWARE TEST NODE
user="000c29764c2e"
pw="00505630601a"
if len(sys.argv)==2:
print 'Assuming local mode'
server_url = 'http://%s:%s@localho... | Python |
## Test script for testing remote RPC CALLS WHICH NEED
## admin authentication
##
## Usage: python removePackage.py [local]
import os,sys
import xmlrpclib
#VMWARE TEST NODE
user="000c29764c2e"
pw="00505630601a"
if len(sys.argv)==2:
print 'Assuming local mode'
server_url = 'http://%s:%s@localhost:8000/provisio... | Python |
## Test script for testing remote RPC CALLS WHICH NEED
## admin authentication
##
## Usage: python testAdminXMLRPC.py [local]
import os,sys
import xmlrpclib
#VMWARE TEST NODE
user="000c29764c2e"
pw="00505630601a"
if len(sys.argv)==2:
print 'Assuming local mode'
server_url = 'http://%s:%s@localhost:8000/provis... | Python |
## Test script for testing remote RPC CALLS WHICH NEED
## admin authentication
##
## Usage: python testAdminXMLRPC.py [local]
import os,sys
import xmlrpclib
#NODE Q3100083
user="000c29764c2e"
pw="00505630601a"
if len(sys.argv)==2:
#assume local mode
server_url = 'http://%s:%s@localhost:8000/provisioner/xmlrpc... | Python |
## Test script for testing remote RPC CALLS WHICH NEED
## admin authentication
##
## Usage: python registerNode.py adminuser adminpass [local]
import os,sys
import xmlrpclib
user=sys.argv[1]
pw=sys.argv[2]
if len(sys.argv)==4:
#assume local mode
server_url = 'http://%s:%s@localhost:8000/provisioner/xmlrpc/call... | Python |
## Test script for testing remote RPC CALLS WHICH NEED
## admin authentication
##
## Usage: python testAdminXMLRPC.py user pass [local]
import os,sys
import xmlrpclib
user=sys.argv[1]
pw=sys.argv[2]
if len(sys.argv)==4:
#assume local mode
server_url = 'http://%s:%s@localhost:8000/provisioner/xmlrpc/call/xmlrpc... | Python |
## Test script for testing remote RPC CALLS WHICH NEED
## admin authentication
##
## Usage: python testAdminXMLRPC.py [local]
import os,sys
import xmlrpclib
#NODE Q3100083
user="6c626d102fe8"
pw="6c626d4ffcce"
if len(sys.argv)==2:
#assume local mode
server_url = 'http://%s:%s@localhost:8000/provisioner/xmlrpc... | Python |
db.define_table('tag',
Field('name',requires=IS_NOT_IN_DB(db,'tag.name')),
Field('links','integer',default=0,writable=False),
format='%(name)s')
db.define_table('tag_link',
Field('tag',db.tag),
Field('table_name', 'string'),
Field('record_id','integer')) | Python |
# -*- coding: utf-8 -*-
# this file is released under public domain and you can use without limitations
#########################################################################
## This scaffolding model makes your app work on Google App Engine too
######################################################################... | Python |
import os
#The parent reference could also be done with:
# Field('parent', 'reference page'),
db.define_table('page',
Field('language',
requires=IS_IN_SET(('nl','en')),writable=False,readable=False),
Field('parent', type='integer', writable=False,readable=False,
label=T('Parent page'))... | Python |
# This file was developed by Massimo Di Pierro
# It is released under BSD, MIT and GPL2 licenses
###################################################
# required parameters set by default if not set
###################################################
DEFAULT = {
'editor' : auth.user and auth.has_membership(role='ed... | Python |
# -*- coding: utf-8 -*-
"""
@author: Bruno Cezar Rocha
@titter: @rochacbruno
@company: blouweb.com
@depends: http://www.wbotelhos.com/gridy/ - Jquery Gridy Plugin
@include: http://nyromodal.nyrodev.com/ - nyroModal
@include: http://css3buttons.michaelhenriksen.dk/ - CSS3 Buttons
@depends: http://www.web2py.com - web2p... | Python |
import logging
import uuid
import datetime
module_logger = logging.getLogger('SP.models.server')
## Game info ##
db.define_table('game_info',
Field('game_name', type='string', requires=(IS_NOT_EMPTY())),
Field('maxlevels', type='integer', requires=(IS_NOT_EMPTY())),
Field('levelupcount', type='integer', r... | Python |
# -*- coding: utf-8 -*-
# this file is released under public domain and you can use without limitations
#########################################################################
## Customize your APP title, subtitle and menus here
#########################################################################
response.title... | Python |
import os
import re
import time
import datetime
import hashlib
import mac2cred
def button(text,action,args=[]):
return A(text,_href=URL(r=request,f=action,args=args), _class='button')
def buttonDownload(text,action,args=[]):
return SPAN('[',A(text,_href=URL(c='static',f=action,args=args)),']')
def buttonIc... | Python |
try:
import loggersetup
except Exception,info:
print info | Python |
#set the language
if auth.has_membership('admins'):
#if 'siteLanguage' in request.cookies and not (request.cookies['siteLanguage'] is None):
#T.force(request.cookies['siteLanguage'].value)
T.force('nl')
else:
#FORCE LANG TO NL for non admin stuff
#WHEN EN trans is done; remove the admin stuff
... | Python |
# -*- coding: utf-8 -*-
# this file is released under public domain and you can use without limitations
#########################################################################
## This is a samples controller
## - index is the default action of any application
## - user is required for authentication and authorizatio... | Python |
# -*- coding: utf-8 -*-
# ##########################################################
# ## make sure administrator is on localhost
# ###########################################################
import os
import socket
import datetime
import copy
import gluon.contenttype
import gluon.fileutils
# ## critical --- make a ... | Python |
# This file was developed by Massimo Di Pierro
# It is released under BSD, MIT and GPL2 licenses
##########################################################
# code to handle wiki pages
##########################################################
@auth.requires(plugin_wiki_editor)
def index():
w = db.plugin_wiki_page... | Python |
# -*- coding: utf-8 -*-
"""
@author: Bruno Cezar Rocha
@titter: @rochacbruno
@company: blouweb.com
@depends: http://www.wbotelhos.com/gridy/ - Jquery Gridy Plugin
@include: http://nyromodal.nyrodev.com/ - nyroModal
@include: http://css3buttons.michaelhenriksen.dk/ - CSS3 Buttons
@depends: http://www.web2py.com - web2p... | Python |
import random
import os.path
def show():
quiz=request.args(0)
quiz_id=request.args(1)
if quiz=='personal':
content=db(db.quizpersonal.id==quiz_id).select().first()
elif quiz=='regional':
content=db(db.quizregional.id==quiz_id).select().first()
else:
content=False
if con... | Python |
import logging
module_logger = logging.getLogger('SP.controllers.server')
def index():
return ""
@auth.requires_login()
@service.xmlrpc
def get_version():
"""Returns the version of the braintrainer XMLRPC protocol used.
This is here to make sure that a next version protocol can be easily implemented witho... | Python |
#error handler
error=URL(r=request,f='error')
def index():
"""
Start page of games module
"""
try:
arguments=request.args(0)
except:
arguments = None
title="Formatics games"
messages=[]
messages.append("Kies een spel")
return dict(title=title, messages=messages)... | Python |
# -*- coding: utf-8 -*-
# this file is released under public domain and you can use without limitations
#########################################################################
## This is a samples controller
## - index is the default action of any application
## - user is required for authentication and authorizatio... | Python |
@auth.requires_login()
def index():
redirect(URL('quiz', 'index'))
return
@auth.requires_login()
def download():
import os
import shutil
import uuid
import time
import zipfile
import contenttype as c
from PIL import Image
memberships = db(db.auth_membership.user_id==auth.us... | Python |
# -*- coding: utf-8 -*-
# this file is released under public domain and you can use without limitations
#########################################################################
## This is a samples controller
## - index is the default action of any application
## - user is required for authentication and authorizatio... | Python |
# -*- coding: utf-8 -*-
# this file is released under public domain and you can use without limitations
#########################################################################
## This is a samples controller
## - index is the default action of any application
## - user is required for authentication and authorizatio... | Python |
import time
#requires settings.email*
while True:
rows = db(db.queue.status=='pending').select(db.queue.ALL, limitby=(0, settings.email_queue_max))
for row in rows:
if mail.send(to=row.email,
subject=row.subject,
message=row.message,
bcc=settings.email_bcc):
... | Python |
#!/usr/bin/python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run ... | Python |
# *-* encoding: utf8 *-*
from django.db import models
class Estatico(models.Model):
link = models.CharField(max_length=20)
label = models.CharField(max_length=50, verbose_name='Titulo')
conteudo = models.TextField()
def __unicode__(self):
return self.label
class Post(models.Model):
... | Python |
"""
This file demonstrates two different styles of tests (one doctest and one
unittest). These will both pass when you run "manage.py test".
Replace these with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
... | Python |
# -*- coding: utf-8 -*-
from django.contrib import admin
from flisol_system.conteudo.models import Estatico, Post, Publicidade
class PostAdmin(admin.ModelAdmin):
class Media:
js = ('/js/tiny_mce/tiny_mce.js', '/js/textareas.js')
admin.site.register(Estatico)
admin.site.register(Post, PostAdmin)
admin.sit... | Python |
#! -*- coding: utf-8 -*-
from django.shortcuts import render_to_response
from django.template import RequestContext, Template, Context
from models import Estatico
from configuration.models import PageData
from conteudo.models import Post
def estatico(request, pagina):
page = "conteudo_estatico.html"
obj = eva... | Python |
#!/usr/bin/python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run ... | Python |
from django.conf.urls.defaults import *
from django.conf import settings
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
(r'^admin/inscricoes/palestra/(?P<palestraId>\d+?)/presenca/$', 'flisol_system.inscricoes.views.listaPresenca'),
(r'^admin/contato/notificacao/$', 'flisol_s... | Python |
import os
PROJECT_ROOT_PATH = os.path.dirname(os.path.abspath(__file__))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'xxxxxx@gmail.com'
EMAIL_HOST_PASSWORD = 'xxxxxxxx'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS =... | Python |
# -*- encoding: utf-8 -*-
from django.db import models
from conteudo.models import Publicidade
# XXX fazer com que essa instancia seja criada na instalacao
class FlisolManager(models.Model):
ESTADO_CHOICES = (
(u'A', u'Aberto'),
(u'F', u'Fechado'),
)
# msg exibida qndo proposta está fec... | Python |
"""
This file demonstrates two different styles of tests (one doctest and one
unittest). These will both pass when you run "manage.py test".
Replace these with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
... | Python |
from django.contrib import admin
from models import FlisolManager, MenuSite
admin.site.register(FlisolManager)
admin.site.register(MenuSite)
| Python |
# Create your views here.
| Python |
#! -*- coding: utf-8 -*-
from django.db import models
from django import forms
from django.contrib.admin import widgets
class NotificacaoForm(forms.Form):
DEST_CHOICES = (
(u'T', u'Todos'),
(u'A', u'Apenas usuarios inscritos este ano'),
(u'I', u'Apenas usuarios que levarão a máquina para ... | Python |
"""
This file demonstrates two different styles of tests (one doctest and one
unittest). These will both pass when you run "manage.py test".
Replace these with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
... | Python |
# -*- coding: utf-8 -*-
#from django.contrib import admin
#from models import Contato
#
#class ContatoAdmin(admin.ModelAdmin):
# list_display = ('nome','email','telefone')
#
#admin.site.register(Contato, ContatoAdmin)
| Python |
import smtplib
#from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email import Encoders
import os
import getopt
import sys
from email.Header import Header
class EmailMsg:
def __init__(self, title, msg):
self.title = title
self... | Python |
from django import forms
from django.shortcuts import render_to_response, get_object_or_404
from django.http import HttpResponseRedirect, HttpResponse
from django.core.urlresolvers import reverse
from django.forms import ModelForm
from django.template import RequestContext
from django.core.mail import EmailMessage
fro... | Python |
from django.shortcuts import render_to_response
from django.template import RequestContext
from inscricoes.models import Palestra, Proposta
from conteudo.models import Post, Publicidade
from configuration.models import MenuSite
from django.http import HttpResponse
from configuration.models import PageData
def index(re... | Python |
#! -*- coding: utf-8 -*-
from django.db import models
class Proposta(models.Model):
NIVEL_CHOICES = (
(u'B', u'Básico'),
(u'M', u'Médio'),
(u'A', u'Avançado'),
)
CATEGORIA_CHOICES = (
(u'P', u'Palestra'),
(u'O', u'Oficina/Palestra'),
(u'L', u'Lightning Tal... | Python |
"""
This file demonstrates two different styles of tests (one doctest and one
unittest). These will both pass when you run "manage.py test".
Replace these with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
... | Python |
# -*- coding: utf-8 -*-
from django.contrib import admin
from models import Palestra, Proposta, Participante
class ParticipanteAdmin(admin.ModelAdmin):
list_display = ('nome','email','instalar')
class PalestraAdmin(admin.ModelAdmin):
list_display = ('id','horario','titulo','palestrante', 'vagas')
class Prop... | Python |
#! -*- coding: utf-8 -*-
from django import forms
from django.shortcuts import render_to_response, get_object_or_404
from django.http import HttpResponseRedirect, HttpResponse
from django.core.urlresolvers import reverse
from django.forms import ModelForm
from django.template import RequestContext
from flisol_system.c... | Python |
#!/usr/bin/env python
##########################################################
##########################################################
## ##
## Flexible Registry Parser ##
## Author: Paul-Henri Huckel ##
## Contact: @FrOzPolow ##
## ##
###################... | Python |
#!/usr/bin/env python
##########################################################
##########################################################
## ##
## Flexible Registry Parser ##
## Author: Paul-Henri Huckel ##
## Contact: @FrOzPolow ##
## ##
###################... | Python |
import kf_lib_v2_2 as lib
import math
headings = "N,NNE,NE,ENE,E,ESE,SE,SSE,S,SSW,SW,WSW,W,WNW,NW,NNW".split(",")
def deg_to_bearing(deg):
divisions= 360.0 / len(headings)
return headings[int(((deg + divisions/2) % 360)/divisions)]
if __name__ == "__main__":
for deg in range(365... | Python |
import kf_lib_v2_2 as lib
import sqlite3
import weather
class Flightplanner:
def __init__(self, route):
#help(sqlite3.connect)
self.aopa = sqlite3.connect("Source Data\\aopa.sqlite")
self.c=self.aopa.cursor()
#help(self.aopa.cursor)
... | Python |
# The lines up to and including sys.stderr should always come first
# Then any errors that occur later get reported to the console
# If you'd prefer to report errors to a file, you can do that instead here.
import sys
from Npp import *
# Set the stderr to the normal console as early as possible, in case of early... | Python |
import datetime
# Just in case, we'll clear all the existing callbacks for FILEBEFORESAVE
notepad.clearCallbacks([NOTIFICATION.FILEBEFORESAVE])
# Define the function to call just before the file is saved
def addSaveStamp(args):
if notepad.getBufferFilename(args["bufferID"])[-4:] == '.log':
if MESSAGEBOXFLA... | Python |
# Disable the virtual space options for both Scintilla views, apart from for rectangular selection (the default in Notepad++)
# For more information, see the Scintilla documentation on virtual space and the SCI_SETVIRTUALSPACEOPTIONS message.
editor1.setVirtualSpaceOptions(1)
editor2.setVirtualSpaceOptions(1)
| Python |
# Enable the virtual space options for both Scintilla views
# For more information, see the Scintilla documentation on virtual space and the SCI_SETVIRTUALSPACEOPTIONS message.
editor1.setVirtualSpaceOptions(3)
editor2.setVirtualSpaceOptions(3)
| Python |
# First we'll start an undo action, then Ctrl-Z will undo the actions of the whole script
editor.beginUndoAction()
# Do a Python regular expression replace, full support of Python regular expressions
# This replaces any three uppercase letters that are repeated,
# so ABDABD, DEFDEF or DGBDGB etc. the fir... | Python |
def testContents(contents, lineNumber, totalLines):
if contents.strip() == "rubbish":
editor.deleteLine(lineNumber)
# As we've deleted the line, the "next" line to process
# is actually the current line, so we return 0 to advance zero lines
... | Python |
"""Python part of the warnings subsystem."""
# Note: function level imports should *not* be used
# in this module as it may cause import lock deadlock.
# See bug 683658.
import linecache
import sys
import types
__all__ = ["warn", "showwarning", "formatwarning", "filterwarnings",
"resetwarnings", "catch_war... | Python |
"""General floating point formatting functions.
Functions:
fix(x, digits_behind)
sci(x, digits_behind)
Each takes a number or a string and a number of digits as arguments.
Parameters:
x: number to be formatted; or a string resembling a number
digits_behind: number of digits behind the decimal point
"""
f... | Python |
r"""Utilities to compile possibly incomplete Python source code.
This module provides two interfaces, broadly similar to the builtin
function compile(), which take program text, a filename and a 'mode'
and:
- Return code object if the command is complete and valid
- Return None if the command is incomplete
- Raise Sy... | Python |
"""Provide a (g)dbm-compatible interface to bsddb.hashopen."""
import sys
import warnings
warnings.warnpy3k("in 3.x, the dbhash module has been removed", stacklevel=2)
try:
import bsddb
except ImportError:
# prevent a second import of this module from spuriously succeeding
del sys.modules[__name__]
rai... | Python |
"""Create portable serialized representations of Python objects.
See module cPickle for a (much) faster implementation.
See module copy_reg for a mechanism for registering custom picklers.
See module pickletools source for extensive comments.
Classes:
Pickler
Unpickler
Functions:
dump(object, file)
... | Python |
"""Manage shelves of pickled objects.
A "shelf" is a persistent, dictionary-like object. The difference
with dbm databases is that the values (not the keys!) in a shelf can
be essentially arbitrary Python objects -- anything that the "pickle"
module can handle. This includes most class instances, recursive data
type... | Python |
# $Id$
#
# Copyright (C) 2005 Gregory P. Smith (greg@krypto.org)
# Licensed to PSF under a Contributor Agreement.
import warnings
warnings.warn("the sha module is deprecated; use the hashlib module instead",
DeprecationWarning, 2)
from hashlib import sha1 as sha
new = sha
blocksize = 1 # l... | Python |
# $Id$
#
# Copyright (C) 2005 Gregory P. Smith (greg@krypto.org)
# Licensed to PSF under a Contributor Agreement.
#
__doc__ = """hashlib module - A common interface to many hash functions.
new(name, string='') - returns a new hash object implementing the
given hash function; initializing th... | Python |
"""Find modules used by a script, using introspection."""
# This module should be kept compatible with Python 2.2, see PEP 291.
from __future__ import generators
import dis
import imp
import marshal
import os
import sys
import types
import struct
if hasattr(sys.__stdout__, "newlines"):
READ_MODE = "U" # universa... | Python |
"""Parser for command line options.
This module helps scripts to parse the command line arguments in
sys.argv. It supports the same conventions as the Unix getopt()
function (including the special meanings of arguments of the form `-'
and `--'). Long options similar to those supported by GNU software
may be used as ... | Python |
#! /usr/bin/env python
# Copyright 1994 by Lance Ellinghouse
# Cathedral City, California Republic, United States of America.
# All Rights Reserved
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provide... | Python |
"""Load / save to libwww-perl (LWP) format files.
Actually, the format is slightly extended from that used by LWP's
(libwww-perl's) HTTP::Cookies, to avoid losing some RFC 2965 information
not recorded by LWP.
It uses the version string "2.0", though really there isn't an LWP Cookies
2.0 format. This indicates that ... | Python |
Subsets and Splits
SQL Console for ajibawa-2023/Python-Code-Large
Provides a useful breakdown of language distribution in the training data, showing which languages have the most samples and helping identify potential imbalances across different language groups.