code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
import urllib
from django.db import models
from django.contrib.auth.models import User
from django.contrib import admin
from django.conf import settings
from django.core.mail import send_mail, mail_admins
from django.template import loader
from managers import TokenManager, ConsumerManager, ResourceManager, KEY_SIZE, ... | Python |
import cgi
import urllib
import time
import random
import urlparse
import hmac
import base64
VERSION = '1.0' # Hi Blaine!
HTTP_METHOD = 'GET'
SIGNATURE_METHOD = 'PLAINTEXT'
# Generic exception class
class OAuthError(RuntimeError):
def get_message(self):
return self._message
def set_message(self, mes... | Python |
from django.db import models
from django.contrib.auth.models import User
KEY_SIZE = 18
SECRET_SIZE = 32
class KeyManager(models.Manager):
'''Add support for random key/secret generation
'''
def generate_random_codes(self):
key = User.objects.make_random_password(length=KEY_SIZE)
secret = U... | Python |
import binascii
import oauth
from django.http import HttpResponse, HttpResponseRedirect
from django.contrib.auth.models import User, AnonymousUser
from django.contrib.auth.decorators import login_required
from django.template import loader
from django.contrib.auth import authenticate
from django.conf import settings
f... | Python |
from django.middleware.http import ConditionalGetMiddleware
from django.middleware.common import CommonMiddleware
def compat_middleware_factory(klass):
"""
Class wrapper that only executes `process_response`
if `streaming` is not set on the `HttpResponse` object.
Django has a bad habbit of looking at t... | Python |
from django.http import HttpResponseNotAllowed, HttpResponseForbidden, HttpResponse, HttpResponseBadRequest
from django.core.urlresolvers import reverse
from django.core.cache import cache
from django import get_version as django_version
from decorator import decorator
from datetime import datetime, timedelta
__versi... | Python |
import inspect, handler
from piston.handler import typemapper
from piston.handler import handler_tracker
from django.core.urlresolvers import get_resolver, get_callable, get_script_prefix
from django.shortcuts import render_to_response
from django.template import RequestContext
def generate_doc(handler_cls):
"""... | Python |
import oauth
from models import Nonce, Token, Consumer
class DataStore(oauth.OAuthDataStore):
"""Layer between Python OAuth and Django database."""
def __init__(self, oauth_request):
self.signature = oauth_request.parameters.get('oauth_signature', None)
self.timestamp = oauth_request.parameter... | Python |
from M2Crypto import RSA
def getPublicKey(keys):
pubKey = RSA.new_pub_key(keys.pub())
return pubKey.as_pem(cipher=None)
def encrypt(plaintext,keys):
encText = keys.private_encrypt(plaintext, 1)
return encText
def decrypt(encText,pubKey):
dec = pubKey.public_decrypt(encText, 1)
return decl
de... | Python |
from jplot2d.python import *
from org.jplot2d.swing import JPlot2DFrame
# Create plot
p = plot(preferredContentSize=(400, 230), sizeMode=AutoPackSizeMode())
p.legend.visible = 0
pf = JPlot2DFrame(p)
pf.size = (480, 360)
pf.visible = 1
# Axes
xaxes = axes(2, range=(0, 4), tickInterval=1, minorTicks=9)
xaxes[0].title.t... | Python |
from jplot2d.python import *
from org.jplot2d.swing import JPlot2DFrame
# Create plot
p = plot()
p.sizeMode = AutoPackSizeMode()
pf = JPlot2DFrame(p)
pf.size = (480, 480)
pf.visible = 1
# create subplots
lsp = subplot(preferredContentSize=(400, 100))
msp = subplot(preferredContentSize=(400, 100))
hsp = subplot(prefer... | Python |
from jplot2d.python import *
# the sizeMode must be set
p=plot(sizeMode=AutoPackSizeMode())
from org.jplot2d.swing import JPlot2DFrame
pf = JPlot2DFrame(p)
pf.size = (480, 480)
pf.visible = 1
x = 0,1,2,3
y = 0,2,1,4
graph = xygraph(x, y)
layer = layer()
layer.addGraph(graph)
yaxis=axis()
xaxis=axis()
# the axes must ... | Python |
from jplot2d.python import *
from org.jplot2d.swing import JPlot2DFrame
# Create plot
p = plot(sizeMode=AutoPackSizeMode(), layoutDirector=GridLayoutDirector())
pf = JPlot2DFrame(p)
pf.size = (480, 480)
pf.visible = 1
# create subplots
usp = subplot(preferredContentSize=(380, 260))
lsp = subplot(preferredContentSize=... | Python |
from jplot2d.python import *
# the sizeMode must be set
p=plot(sizeMode=AutoPackSizeMode())
from org.jplot2d.swing import JPlot2DFrame
pf = JPlot2DFrame(p)
pf.size = (480, 480)
pf.visible = 1
z = [[0,1],[2,3.1]]
graph = imagegraph(z)
layer = layer()
layer.addGraph(graph)
yaxis=axis()
xaxis=axis()
# the axes must be ... | Python |
from jplot2d.python import *
from org.jplot2d.swing import JPlot2DFrame
# Create plot
p = plot(preferredContentSize=(300, 200), sizeMode=AutoPackSizeMode(), fontSize = 16)
p.legend.visible = 0
pf = JPlot2DFrame(p)
pf.size = (480, 360)
pf.visible = 1
# Axes
xaxis = axis(transform=LOGARITHMIC, range=(5e13, 2.5e17))
xax... | Python |
from jplot2d.python import *
from org.jplot2d.swing import JPlot2DFrame
# Create plot
p = plot(preferredContentSize=(300, 300), sizeMode=AutoPackSizeMode())
pf = JPlot2DFrame(p)
pf.size = (480, 480)
pf.visible = 1
# Axes
xaxes = axes(2, tickSide=AxisTickSide.OUTWARD, range=(0.8, 2.2))
xaxes[0].title.text = "S$_100$/S... | Python |
from jplot2d.python import *
# the sizeMode must be set
p=plot(sizeMode=AutoPackSizeMode())
from org.jplot2d.swing import JPlot2DFrame
pf = JPlot2DFrame(p)
pf.size = (480, 480)
pf.visible = 1
r = [[0,1],[2,3]]
g = [[3,0],[1,2]]
b = [[2,3],[0,1]]
graph = rgbimagegraph(r,g,b)
layer = layer()
layer.addGraph(graph)
yaxi... | Python |
#
from org.jplot2d.env import InterfaceInfo
from org.jplot2d.axtype import *
from org.jplot2d.data import *
from org.jplot2d.element import *
from org.jplot2d.element.AxisPosition import *
from org.jplot2d.element.XYGraph.ChartType import *
from org.jplot2d.layout import *
from org.jplot2d.sizing import *
from org.jplo... | Python |
#!/usr/bin/python2.6
#
# Simple http server to emulate api.playfoursquare.com
import logging
import shutil
import sys
import urlparse
import SimpleHTTPServer
import BaseHTTPServer
class RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
"""Handle playfoursquare.com requests, for testing."""
def do_GET(self... | Python |
#!/usr/bin/python
import datetime
import sys
import textwrap
import common
from xml.dom import pulldom
PARSER = """\
/**
* Copyright 2009 Joe LaPenna
*/
package com.joelapenna.foursquare.parsers;
import com.joelapenna.foursquare.Foursquare;
import com.joelapenna.foursquare.error.FoursquareError;
import com.joel... | Python |
#!/usr/bin/python
"""
Pull a oAuth protected page from foursquare.
Expects ~/.oget to contain (one on each line):
CONSUMER_KEY
CONSUMER_KEY_SECRET
USERNAME
PASSWORD
Don't forget to chmod 600 the file!
"""
import httplib
import os
import re
import sys
import urllib
import urllib2
import urlparse
import user
from xml.... | Python |
#!/usr/bin/python
import os
import subprocess
import sys
BASEDIR = '../main/src/com/joelapenna/foursquare'
TYPESDIR = '../captures/types/v1'
captures = sys.argv[1:]
if not captures:
captures = os.listdir(TYPESDIR)
for f in captures:
basename = f.split('.')[0]
javaname = ''.join([c.capitalize() for c in basena... | Python |
#!/usr/bin/python
import logging
from xml.dom import minidom
from xml.dom import pulldom
BOOLEAN = "boolean"
STRING = "String"
GROUP = "Group"
# Interfaces that all FoursquareTypes implement.
DEFAULT_INTERFACES = ['FoursquareType']
# Interfaces that specific FoursqureTypes implement.
INTERFACES = {
}
DEFAULT_CLA... | Python |
import platform
import sys
#Display user's OS platform using two options
print "OS:",platform.platform()
print "Platform:",sys.platform
| Python |
#!/usr/bin/python2.4
#
# Copyright 2007 The Python-Twitter Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | Python |
#!/usr/bin/python2.4
# -*- coding: utf-8 -*-#
#
# Copyright 2007 The Python-Twitter Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... | Python |
#!/usr/bin/python2.4
'''Load the latest update for a Twitter user and leave it in an XHTML fragment'''
__author__ = 'dewitt@google.com'
import codecs
import getopt
import sys
import twitter
TEMPLATE = """
<div class="twitter">
<span class="twitter-user"><a href="http://twitter.com/%s">Twitter</a>: </span>
<span... | Python |
#!/usr/bin/python2.4
'''Post a message to twitter'''
__author__ = 'dewitt@google.com'
import ConfigParser
import getopt
import os
import sys
import twitter
USAGE = '''Usage: tweet [options] message
This script posts a message to Twitter.
Options:
-h --help : print this help
--consumer-key : the twit... | Python |
#!/usr/bin/python2.4
#
# Copyright 2007 The Python-Twitter Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | Python |
#!/usr/bin/python2.4
#
# Copyright 2007 The Python-Twitter Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | Python |
"""Implementation of JSONDecoder
"""
import re
import sys
import struct
from simplejson.scanner import make_scanner
try:
from simplejson._speedups import scanstring as c_scanstring
except ImportError:
c_scanstring = None
__all__ = ['JSONDecoder']
FLAGS = re.VERBOSE | re.MULTILINE | re.DOTALL
def _floatconst... | Python |
"""JSON token scanner
"""
import re
try:
from simplejson._speedups import make_scanner as c_make_scanner
except ImportError:
c_make_scanner = None
__all__ = ['make_scanner']
NUMBER_RE = re.compile(
r'(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?',
(re.VERBOSE | re.MULTILINE | re.DOTALL))
def py_make_scan... | Python |
"""Implementation of JSONEncoder
"""
import re
try:
from simplejson._speedups import encode_basestring_ascii as c_encode_basestring_ascii
except ImportError:
c_encode_basestring_ascii = None
try:
from simplejson._speedups import make_encoder as c_make_encoder
except ImportError:
c_make_encoder = None
... | Python |
r"""JSON (JavaScript Object Notation) <http://json.org> is a subset of
JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data
interchange format.
:mod:`simplejson` exposes an API familiar to users of the standard library
:mod:`marshal` and :mod:`pickle` modules. It is the externally maintained
version of ... | Python |
r"""Using simplejson from the shell to validate and
pretty-print::
$ echo '{"json":"obj"}' | python -msimplejson.tool
{
"json": "obj"
}
$ echo '{ 1.2:3.4}' | python -msimplejson.tool
Expecting property name: line 1 column 2 (char 2)
"""
import simplejson
def main():
import sys
if l... | Python |
#!/usr/bin/python2.4
#
# Copyright 2007 The Python-Twitter Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | Python |
import socket
import struct
import time
import select
import os
MULTICAST_GROUP_ADDR="239.255.42.42"
UDP_PORT=10042
MAX_PACKET=2048
MAGIC_BYTES="FCst"
TICK_TIME=3.0 # seconds
MAX_NODE_AGE=12.0 # seconds
class NodeInfo:
def __init__(self):
self.nodeid="not set yet"
self.lastseen=0 # epoch
self.addr='0.0.0.0'
... | Python |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
#
# Copyright (C) 2010 - Jens Knutson <jens.knutson at gmail dot com>
# This software is licensed under the GNU General Public License
# version 3 or later (see the file COPYING).
import os
import fluidity
from distutils.core import setup
from textwrap import dedent
DATA... | Python |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
#
# Copyright (C) 2009 - Jens Knutson <jens.knutson at gmail dot com>
# This software is licensed under the GNU General Public License
# version 3 or later (see the file COPYING).
__author__ = 'Jens Knutson'
import os
if os.path.exists('.pathhack.py'):
import imp
... | Python |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
#
# Copyright (C) 2010 - Jens Knutson <jens.knutson at gmail dot com>
# This software is licensed under the GNU General Public License
# version 3 or later (see the file COPYING).
"""Misc. functions for use throughout Fluidity."""
from __future__ import absolute_import, divis... | Python |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
#
# Copyright (C) 2009 - Jens Knutson <jens.knutson at gmail dot com>
# This software is licensed under the GNU General Public License
# version 3 or later (see the file COPYING).
from __future__ import absolute_import, division, print_function
__author__ = 'Jens Knutson'
... | Python |
#!/usr/bin/python -O
#-*- coding:utf-8 -*-
# ZOMG, a time when -O might not be total rice!
from __future__ import absolute_import, division, print_function, unicode_literals
__author__ = "Jens Knutson"
try:
import cPickle as pickle
except ImportError:
import pickle
import os
import sys
QUERY_STRINGS = ['.'... | Python |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
#
# Copyright (C) 2010 - Jens Knutson <jens.knutson at gmail dot com>
# This software is licensed under the GNU General Public License
# version 3 or later (see the file COPYING).
"""Resets the age attribute on each Next Action for all active Projects."""
from __future__ impo... | Python |
#!/usr/bin/env python
from __future__ import absolute_import, division, print_function
# include in this a total of the time estimates!
try:
import cPickle as pickle
except ImportError:
import pickle
import datetime
import operator
import os
import sys
import gtk
from fluidity import defs
from fluidity impo... | Python |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
#
# Copyright (C) 2010 - Jens Knutson <jens.knutson at gmail dot com>
# This software is licensed under the GNU General Public License
# version 3 or later (see the file COPYING).
from __future__ import absolute_import, division, print_function, unicode_literals
__author__ ... | Python |
#-*- coding:utf-8 -*-
#
# Copyright (C) 2009 - Jens Knutson <jens.knutson at gmail dot com>
# This software is licensed under the GNU General Public License
# version 3 or later (see the file COPYING).
#pylint: disable-msg=W0201
"""Collection of "manager" classes, which handle disparate aspects of Fluidity."""
from __f... | Python |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
#
# Copyright (C) 2010 - Jens Knutson <jens.knutson at gmail dot com>
# This software is licensed under the GNU General Public License
# version 3 or later (see the file COPYING).
"""GeeTeeDee-related data objects"""
from __future__ import absolute_import, division, print_fun... | Python |
#-*- coding:utf-8 -*-
#
# Copyright (C) 2009 - Jens Knutson <jens.knutson at gmail dot com>
# This software is licensed under the GNU General Public License
# version 3 or later (see the file COPYING).
"""OH NOES."""
from __future__ import absolute_import, division, print_function
__author__ = 'Jens Knutson'
import... | Python |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
#
# Copyright (C) 2009 - Jens Knutson <jens.knutson at gmail dot com>
# This software is licensed under the GNU General Public License
# version 3 or later (see the file COPYING).
"""The main Fluidity app module."""
from __future__ import absolute_import, division, print_func... | Python |
#-*- coding:utf-8 -*-
#
# Copyright (C) 2009 - Jens Knutson <jens.knutson at gmail dot com>
# This software is licensed under the GNU General Public License
# version 3 or later (see the file COPYING).
"""Total hack to export Fity tasks to a Tomboy note."""
from __future__ import absolute_import, division, print_functi... | Python |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
#
# Copyright (C) 2010 - Jens Knutson <jens.knutson at gmail dot com>
# This software is licensed under the GNU General Public License
# version 3 or later (see the file COPYING).
"""Misc. D-Bus-related functions & an app-wide note proxy"""
from __future__ import absolute_imp... | Python |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
#
# Copyright (C) 2009 - Jens Knutson <jens.knutson at gmail dot com>
# This software is licensed under the GNU General Public License
# version 3 or later (see the file COPYING).
from __future__ import absolute_import, division, print_function
__author__ = 'Jens Knutson'
... | Python |
#-*- coding:utf-8 -*-
# 'relevance' code:
#
# Copyright (C) 2009 Ulrik Sverdrup <ulrik.sverdrup@gmail.com>
# 2008 Christian Hergert <chris@dronelabs.com>
# 2007 Chris Halse Rogers, DR Colkitt
# David Siegel, James Walker
# Jason Smith, Miguel de Ica... | Python |
# pylint: disable-msg=C0103
from collections import namedtuple
_MAJOR = 0
_MINOR = 3
_MICRO = 0
_vers_ntuple = namedtuple('version_info', 'description major minor micro')
_vers_nums = _MAJOR, _MINOR, _MICRO
__version_info__ = _vers_ntuple(".".join([str(i) for i in _vers_nums]), *_vers_nums)
__version__ = __versio... | Python |
#-*- coding:utf-8 -*-
#
# Copyright (C) 2009 - Jens Knutson <jens.knutson at gmail dot com>
# This software is licensed under the GNU General Public License
# version 3 or later (see the file COPYING).
"""Miscellaneous classes for Fluidity's needs
...and OMG, look: it's code I'm not totally ashamed of, huzzah!
"""
fro... | Python |
#!/usr/bin/python -O
#-*- coding:utf-8 -*-
#
# Copyright (C) 2009 - Jens Knutson <jens.knutson at gmail dot com>
# This software is licensed under the GNU General Public License
# version 3 or later (see the file COPYING).
"""Contains the Slider app class"""
from __future__ import absolute_import, division, print_funct... | Python |
#-*- coding:utf-8 -*-
#
# Copyright (C) 2009 - Jens Knutson <jens.knutson at gmail dot com>
# This software is licensed under the GNU General Public License
# version 3 or later (see the file COPYING).
"""All the Inbox item classes."""
from __future__ import absolute_import, division, print_function
__author__ = 'Jen... | Python |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
#
# Copyright (C) 2010 - Jens Knutson <jens.knutson at gmail dot com>
# This software is licensed under the GNU General Public License
# version 3 or later (see the file COPYING).
"""GIO: makes I/O less painful. Except when it doesn't."""
from __future__ import absolute_impo... | Python |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
#
# Copyright (C) 2010 - Jens Knutson <jens.knutson at gmail dot com>
# This software is licensed under the GNU General Public License
# version 3 or later (see the file COPYING).
"""Misc. app-wide constants."""
from __future__ import absolute_import, division, print_function... | Python |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
#
# Copyright (C) 2010 - Jens Knutson <jens.knutson at gmail dot com>
# This software is licensed under the GNU General Public License
# version 3 or later (see the file COPYING).
"""View/Display objects for use with Kiwi ObjectList/ObjectTrees, etc."""
from __future__ import... | Python |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
#
# Copyright (C) 2009 - Jens Knutson <jens.knutson at gmail dot com>
# This software is licensed under the GNU General Public License
# version 3 or later (see the file COPYING).
"""Dialog controller classes for Fluidity."""
from __future__ import absolute_import, division, ... | Python |
#!/usr/bin/env python
# vim: noexpandtab:ts=4:sts=4
"""Menu Generator for PekWM
Generates a dynamic menu for PekWM using the freedesktop.org standards
Usage:
Options:
-l ..., --lang=... create the menu using a language. Default = $LANG
-h, --help show this help
"""
__author__ = "Michael Ri... | Python |
#!/usr/bin/env python
# vim: noexpandtab:ts=4:sts=4
"""Menu Generator for Fluxbox
Generates a menu for Fluxbox using the freedesktop.org standards
Usage: fluxbox-fdo-menugen.py [options]
Options:
-l ..., --lang=... create the menu using a language. Default = $LANG
-h, --help show this help
-... | Python |
#!/usr/bin/env python
# vim: noexpandtab:ts=4:sts=4
"""Menu Generator for PekWM
Generates a dynamic menu for PekWM using the freedesktop.org standards
Usage:
Options:
-l ..., --lang=... create the menu using a language. Default = $LANG
-h, --help show this help
"""
__author__ = "Michael Ri... | Python |
#!/usr/bin/env python
# vim: noexpandtab:ts=4:sts=4
"""Menu Generator for Fluxbox
Generates a menu for Fluxbox using the freedesktop.org standards
Usage: fluxbox-fdo-menugen.py [options]
Options:
-l ..., --lang=... create the menu using a language. Default = $LANG
-h, --help show this help
-... | Python |
#!/usr/bin/env python
# vim: noexpandtab:ts=4:sts=4
"""Menu Generator for PekWM
Generates a dynamic menu for PekWM using the freedesktop.org standards
Usage:
Options:
-l ..., --lang=... create the menu using a language. Default = $LANG
-h, --help show this help
"""
__author__ = "Michael Ri... | Python |
#!/usr/bin/env python
# vim: noexpandtab:ts=4:sts=4
"""Menu Generator for Fluxbox
Generates a menu for Fluxbox using the freedesktop.org standards
Usage: fluxbox-fdo-menugen.py [options]
Options:
-l ..., --lang=... create the menu using a language. Default = $LANG
-h, --help show this help
-... | Python |
#!/usr/bin/env python
# vim: noexpandtab:ts=4:sts=4
"""Menu Generator for PekWM
Generates a dynamic menu for PekWM using the freedesktop.org standards
Usage:
Options:
-l ..., --lang=... create the menu using a language. Default = $LANG
-h, --help show this help
"""
__author__ = "Michael Ri... | Python |
#!/usr/bin/env python
# vim: noexpandtab:ts=4:sts=4
"""Menu Generator for Fluxbox
Generates a menu for Fluxbox using the freedesktop.org standards
Usage: fluxbox-fdo-menugen.py [options]
Options:
-l ..., --lang=... create the menu using a language. Default = $LANG
-h, --help show this help
-... | Python |
#
# main.py
# Fluke
#
# Created by Dmitry Kichenko on 24/08/09.
# Copyright University of Toronto 2009. All rights reserved.
#
#import modules required by application
import objc
import AppKit
import Foundation
from PyObjCTools import AppHelper
# import modules containing classes required to start application a... | Python |
#!/opt/local/bin/python
#
# FlukeAppDelegate.py
# Fluke
#
# Created by Dmitry Kichenko on 24/08/09.
# Copyright University of Toronto 2009. All rights reserved.
#
from Foundation import *
from AppKit import *
import sys
from FlukeController import *
class FlukeAppDelegate(NSObject):
def applicationDidFinishLa... | Python |
#!/opt/local/bin/python
#
# FlukeAppDelegate.py
# Fluke
#
# Created by Dmitry Kichenko on 24/08/09.
# Copyright University of Toronto 2009. All rights reserved.
#
from Foundation import *
from AppKit import *
import sys
from FlukeController import *
class FlukeAppDelegate(NSObject):
def applicationDidFinishLa... | Python |
"""
Fluke lets you play FLACs in iTunes. This the command line version of it.
USAGE
python flukeapp.py file1[ file2 file3...] [--convert]
file1,file2.. can be directories
--convert automaticaly convert imported FLACs to Apple Lossless
"""
import sys,os
# py2app fix - make sure we're going to find those third par... | Python |
# -*- coding: utf-8 -*-
"""
Module for dealing with iTunes stuff.
"""
import sys, os
# Fluke specific modules
from appscript import *
from mutagen.flac import FLAC, FLACNoHeaderError
from fluke.exceptions import *
itunesApp = app(u'iTunes')
def add(files):
filesASPaths = [getASPath(f) for f in files]
try:
... | Python |
"""
All exceptions pooled together for easy importing later
"""
class FlukeException(Exception): pass
class ItunesReferenceError(FlukeException): pass
class ItunesFormatError(FlukeException): pass
class ItunesNotInitialized(FlukeException): pass
class GUIFormatError(FlukeException): pass
class GUIItunesRestart(FlukeE... | Python |
"""
Main Fluke class. Accepts a string or a list of files upon initiation.
"""
__all__ = ['itunes', 'exceptions']
import sys,os,types
import itunes
from fluke.exceptions import *
from appscript.reference import CommandError
class FLAC(object):
def __init__(self,files=None):
self.files = [] # list of lists... | Python |
"""
Fluke controller
"""
# PyObjC modules
from objc import YES, NO, IBAction, IBOutlet
from Foundation import *
from AppKit import *
from PyObjCTools import AppHelper
import sys,os
import fluke, flukeapp
from fluke.exceptions import *
class FlukeController(NSObject):
mainWindow = IBOutlet()
myAlertView = I... | Python |
#
# main.py
# Fluke
#
# Created by Dmitry Kichenko on 24/08/09.
# Copyright University of Toronto 2009. All rights reserved.
#
#import modules required by application
import objc
import AppKit
import Foundation
from PyObjCTools import AppHelper
# import modules containing classes required to start application a... | Python |
#
# FlukeAppDelegate.py
# Fluke
#
# Created by Dmitry Kichenko on 24/08/09.
# Copyright University of Toronto 2009. All rights reserved.
#
from Foundation import *
from AppKit import *
import sys
from FlukeController import *
class FlukeAppDelegate(NSObject):
def applicationDidFinishLaunching_(self, sender):
... | Python |
"""
Fluke lets you play FLACs in iTunes. This the command line version of it.
USAGE
python flukeapp.py file1[ file2 file3...] [--convert]
file1,file2.. can be directories
--convert automaticaly convert imported FLACs to Apple Lossless
"""
import sys,os
# py2app fix - make sure we're going to find those third par... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Module for dealing with iTunes stuff.
"""
import sys, os
# Fluke specific modules
from appscript import *
from mutagen.flac import FLAC, FLACNoHeaderError
itunesApp = app(u'iTunes')
class ItunesReferenceError(Exception): pass
class ItunesFormatError(Exception): pass
de... | Python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Module for dealing with iTunes stuff.
"""
import sys, os
# Fluke specific modules
from appscript import *
from mutagen.flac import FLAC, FLACNoHeaderError
itunesApp = app(u'iTunes')
class ItunesReferenceError(Exception): pass
class ItunesFormatError(Exception): pass
de... | Python |
"""
Main Fluke class. Accepts a string or a list of files upon initiation.
"""
__all__ = ['itunes']
import sys,os
import itunes
class FLAC(object):
def __init__(self,files=None):
self.files = [] # list of lists with paths and references
if files:
self.files = [[f] for f in self.proces... | Python |
"""
Fluke controller for Xcode and py2app
"""
# PyObjC modules
import objc
from Foundation import *
from AppKit import *
from PyObjCTools import AppHelper
import sys,os
# py2app fix - make sure we're going to find those third part libs
#resPath = sys.argv[0].split("/")
#resPath.pop()
#sys.path.insert( 0, os.path.joi... | Python |
import os
import sys
CURRENT_DIR = os.getcwd()
SRC_DIR = os.path.join(CURRENT_DIR, 'src')
sys.path.append(SRC_DIR)
from util import device
print '### Setup script for FluidVoice V4'
un = raw_input('Username:')
id = raw_input('ID (int, should be unique):')
id = int(id)
print '### Creating profile file'
f = open('src/... | Python |
# Copyright 2001-2005 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this permissio... | Python |
# Copyright 2001-2005 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this permissio... | Python |
# Copyright 2001-2005 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this permissio... | Python |
import threading
import sqlite3
import time
import os
import sys
import cPickle as pickle
from Queue import Queue
DB_DIR = './'
DB_FILENAME = 'data.db'
DB_DEBUG = True
dbs = {}
def get_database(dir, filename):
global dbs
name = dir + filename
if name in dbs:
db = dbs[name]
else:
db... | Python |
import os
from presence import ps
from fvutil.managers import text, audio, objectmanager
# For live audio
from audio import mixerinterface
# For interfacing with flash
from ui import flashinterface
import ui.uiconstants as uicon
import gobject
from data import db, broker, textmanager, loginman... | Python |
from util import config
import logging.config
logging.config.fileConfig('logging.config')
from async import asyncmanager
from db import db
from net import network, queues
from presence import ps
from fvutil import broker, accounts, fvcon
from fvutil.managers import audio, text, group, poll, shopping, timeli... | Python |
import cPickle as pickle
import gobject
import time
import socket
import asyncore
import thread
import copy
import re
import sys
import os
from net import network, queues
from util import config, device
from db import db
# TODO:
# - Resilience to network failure
# - Stubbing framework?
# - Move UserPresence (etc) ... | Python |
import os
import re
import device
def scan(ifname):
# Some debugging stuff
live = True
if live:
a = os.popen("iwlist " + ifname + " scanning")
lines = a.read().strip().split('\n')
a.close()
else:
a = open('n800-aps.txt')
lines = a.read().strip().split('\n')
... | Python |
def synchronized(lock):
def wrap(f):
def new(*args, **kw):
lock.acquire()
try:
return f(*args, **kw)
finally:
lock.release()
return new
return wrap
| Python |
import cPickle as pickle
def persist(obj, path):
f = open(path, mode='wb')
dump(obj, f, pickle.HIGHEST_PROTOCOL)
f.close()
def depersist(path):
f = open(path, mode='rb')
obj = load(f)
f.close()
return obj | Python |
import gobject
import socket
import apscan
import device
# For Nokia stuff
import dbus
import logging
logger = logging.getLogger('util.connectivity')
class Connectivity(gobject.GObject):
__gsignals__ = {
'disconnected' : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE,
(gobject.TYPE_PYO... | Python |
# Device-specific module
import os
import platform
NOKIA_TABLET = 'NOKIA_TABLET'
LINUX = 'LINUX'
WINDOWS = 'WINDOWS'
UMPC = 'UMPC'
devices = {
'armv6l' : NOKIA_TABLET,
'i686' : LINUX,
'i386' : LINUX,
'x86_64' : LINUX,
}
_current = None
def override(current):
_current = current
... | Python |
import ConfigParser
import device
parser = None
def __instance():
global parser
if parser is None:
parser = ConfigParser.ConfigParser()
return parser
def as_dict(section):
parser = __instance()
d = {}
for (name, value) in parser.items(section):
d[name] = value
... | Python |
import gobject
import threading
import time
from util.decorators import *
import chunk, message
from util import config
import logging
logger = logging.getLogger('async.receiver')
class Receiver(gobject.GObject):
__gsignals__ = {
'message-complete' : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE,
... | Python |
# cache.py
# Caches for incoming and outgoing data.
import threading
import os
import shutil
import time
import chunk
from util import config
incoming = None
outgoing = None
import logging
logger = logging.getLogger('async')
def get_incoming():
global incoming
if incoming is None:
incoming = Incomin... | 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.