code
stringlengths
1
1.72M
language
stringclasses
1 value
import struct # Chunk types UNDEFINED = -1 DATA_CHUNK = 0 END_CHUNK = 1 # Data structure: (type, length of id, seq#) + id class Chunk: def __init__(self, mid, seq): self.mid = mid self.seq = seq self.type = -1 def raw(self): return struct.pack('iii', self.type, self.mid,...
Python
import threading import gobject import os import time from net import network, bt, queues from presence import ps from util.decorators import * from util import config from db import db import message import control import receiver import strategy import timesync from util import config import logging logger = lo...
Python
import cPickle as pickle import gobject import random from net import network, queues import bits, message from util import config SEPERATOR = ':::' import logging logger = logging.getLogger('async.control') class Control: def __init__(self, manager, iface, control_port): self.__manager = manager ...
Python
import gobject import asyncmanager from net import network from presence import ps from util import config class Engine: def __init__(self, iface, my_id, my_name, sender): p = ps.PresenceService(iface, config.PORTS['presence-out'], config.PORTS['presence-in'], my_id, my_name, standalone=False) ...
Python
import struct import logging logger = logging.getLogger('async') def pack_seqs(seqs, lsn): logger.debug('bits.py -- pack_seqs with args seqs=%s, lsn=%s', seqs, lsn) # Input: list of sequence numbers string = '' for i in xrange(lsn + 1): if i in seqs: string = string + '0' el...
Python
import time import cPickle as pickle import os import math import gobject from util import device, config import logging logger = logging.getLogger('async.timesync') last_reliable = None class TimeSync: TIME = 460 LAST_RELIABLE = 461 def __init__(self, presence): if not config...
Python
from util import config import random import logging logger = logging.getLogger('async.strategy') # Can implement other translations here def to_bluetooth_target(presence): send_addr = presence.meta[config.get_int('async.metas', 'bluetooth-mac-key')] send_port = presence.meta[config.get_int('async.metas',...
Python
import os import time import datetime import cPickle as pickle import struct import cache, chunk from util import config # Constsants used LSN_NOT_CALCULATED = -1 NO_GOOD = -1 import threading from util.decorators import * def add_days(time, days): return time + days * 24 * 60 * 60 class Header: def _...
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
"""Drop-in replacement for collections.OrderedDict by Raymond Hettinger http://code.activestate.com/recipes/576693/ """ from UserDict import DictMixin # Modified from original to support Python 2.4, see # http://code.google.com/p/simplejson/issues/detail?id=53 try: all except NameError: def all(seq): ...
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
import unittest import doctest class OptionalExtensionTestSuite(unittest.TestSuite): def run(self, result): import simplejson run = unittest.TestSuite.run run(self, result) simplejson._toggle_speedups(False) run(self, result) simplejson._toggle_speedups(True) ...
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_encode...
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"""Command-line tool to validate and pretty-print JSON Usage:: $ echo '{"json":"obj"}' | python -m simplejson.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -m simplejson.tool Expecting property name: line 1 column 2 (char 2) """ import sys import simplejson as json def main(): ...
Python
macs = {} f = open('wireless-kwan.csv', mode='ra') for line in f: # name,ip address,cname,mac - wired,wireless - a,wireless - b,notes name, ip, cname, wired_mac, wireless_a, wireless_b, notes = line.split(',') wireless_a = wireless_a.strip() wireless_b = wireless_b.strip() cname = cname.strip() ...
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
import sqlite3 DB_URL = 'apps.db' def where_am_i(self, macs): locations = [] for mac in macs: c = sqlite3.connect(DB_URL).cursor() c.execute(''' select room from aps where mac=? ''', (mac,)) location = None for row in c: if location: rais...
Python
class TheMixerException(Exception): pass
Python
# For audio recording and messaging import time import random import gobject import os from messaging2 import ahconstants as ahcon import ui.uiconstants as uicon from setup import common import os, datetime from util.persist import * SENT_FILE = "_sent_tvm.data" RECV_FILE = "_recv_tvm.data" """ TivoManager manag...
Python
import pygst pygst.require("0.10") import gst import gobject from util import device class MicController( gobject.GObject ): __gsignals__ = { 'my_ssrc' : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_UINT,)) } def __init__(...
Python
from util import device if device.current() == device.NOKIA_TABLET: AUDIO_SINK = "dsppcmsink" else: AUDIO_SINK = "alsasink" depays = {8:"rtppcmadepay", 0:"rtppcmudepay", 96:"rtppcmudepay"} decoders = {8:"alawdec", 0:"mulawdec", 96:"mulawdec"}
Python
import gobject import gstcomponents import recordsrc import gst import os from util import config from fvutil import fvcon class MixerInterface(gobject.GObject): __gsignals__ = { # create signals that will be emitted from mixer # emitted when the message ...
Python
import pygst pygst.require("0.10") import gst #import pygtk #pygtk.require("2.0") #import gtk import gobject import constants import themixerexceptions import random import struct #gtk.gdk.threads_init() #TODO - should it be here? shouldn't be gobject threads? class UnexpectedInput(themixerexceptions.TheMixerExcepti...
Python
import gobject from ui import uiconstants as uicon from messaging2 import ahconstants as ahcon from setup.fvconstants import LIVE_AUDIO_PORT import gstcomponents import recordsrc import gst import os class MixerInterface(gobject.GObject): __gsignals__ = { # create signals that will...
Python
# For audio recording and messaging import time import random import os, datetime from util.persist import * SENT_FILE = "_sent_am.data" RECV_FILE = "_recv_am.data" import gobject class AudioManager(gobject.GObject): """ Manages audio messages """ __gsignals__ = { 'sent_audio'...
Python
import thread import socket import struct import asyncore import gobject import time from util import device MAX_BUF_SIZE = 4096 import logging logger = logging.getLogger('network') def get_broadcast_addr(iface): if device.current() == device.WINDOWS: # TODO: Implement this properly for windows. ...
Python
import threading from util.decorators import * import gobject # TODO: Note the Queue interface. try: from async import chunk except: print 'Couldnt load chunk' pass import logging logger = logging.getLogger('network.queues') class Queue: lock = threading.Lock() def __init__(self): self._...
Python
import bluetooth import threading import time from util.decorators import * # TODO: Work out what this has to be MAX_BUF_SIZE = 1024 import logging logger = logging.getLogger('async.bt') class _L2CAPReceiveChannel(threading.Thread): def __init__(self, conn, addr, receive_cb, close_cb): threading.Thread....
Python
from db import db from fvutil import fvcon from util import config from presence import ps # NOTE: Same API class PresenceWrapper: def __init__(self, presence): self.__presence = presence #OFFLINE = config.get_int('presence.status', 'offline') #ONLINE = config.get_int('presence.st...
Python
import gobject from fvutil.managers import objectmanager from fvutil import fvcon class Timeline(objectmanager.ObjectManager): def __init__(self, my_id): objectmanager.ObjectManager.__init__(self, fvcon.ALL, my_id) def __get_messages(self, begin, end): c = self._table....
Python
import gobject from util import config from db import db from fvutil import fvcon import time import cPickle as pickle class ObjectManager(gobject.GObject): def __init__(self, o_type, my_id, table=None): gobject.GObject.__init__(self) if table: self._table = table ...
Python
from db import db from fvutil.managers import objectmanager from fvutil import fvcon from util import config from presence import ps import gobject import random import os def get_audio_duration(path): return os.path.getsize(path) / 16000 * 1000 # 1 channel, 16 bts, 8000 times a second in MS class AudioPresence(...
Python
import gobject from db import db from fvutil.managers import objectmanager from fvutil import fvcon from util import config import random from presence import ps class TextPresence(ps.ObjectPresence): def __init__(self, oid, name): ps.ObjectPresence.__init__(self, oid, name) clas...
Python
import gobject import random import os import shutil import cPickle as pickle from fvutil.managers import objectmanager from fvutil import fvcon from util import config from presence import ps # For RubyVote import simplejson import sys import logging logger = logging.getLogger('fluidvoice.poll') class PollQPresen...
Python
from db import db from fvutil.managers import objectmanager from fvutil import fvcon from util import config from presence import ps import gobject import random import os import logging.config logging.config.fileConfig('logging.config') logger = logging.getLogger('fluidvoice.tivo') from controlmsgs import StartTivo...
Python
import gobject import time import random import os from fvutil.managers import objectmanager from fvutil import fvcon from util import config from presence import ps class ShoppingPresence(ps.ObjectPresence): def __init__(self, oid, name): ps.ObjectPresence.__init__(self, oid, name) class Shopp...
Python
import gobject from db import db from fvutil import fvcon from util import config import random import time class GroupManager(gobject.GObject): __gsignals__ = { 'return_groups' : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT,)), 'group_appeared' : (gobj...
Python
from datetime import datetime from guid import * import cPickle import time import gobject import os from ui.uiconstants import GROUP, AVAILABLE, ADD, DELETE, PRIORITY_MEDIUM from messaging2.ahconstants import MESSAGING_PATH from data import db from util.persist import * class GroupService(gobject.GObject)...
Python
from util import config class Constants(): def __init__(self): config.add_file('fv.config') for (name, value) in config.items('fv.types'): exec('self.' + name.upper() + ' = ' + value) for (name, value) in config.items('fv.ui'): exec('self....
Python
from db import db from util import config import sha import random class Accounts(db.Table): def _init(self): self._conn.execute(''' create table accounts (uid INTEGER PRIMARY KEY, username STRING NOT NULL, password STRING NOT NULL) ''') ...
Python
from fvutil import fvcon class ObjectBroker: def __init__(self, presence_wrapper, group, audio, text, poll, shopping, tivo): self.__on_open_handlers = { fvcon.AUDIO : audio.get, fvcon.TEXT : text.get, fvcon.POLL_Q : poll.get_poll, ...
Python
class StartTivo(): def __init__(self, tivo_id, user_ids): self.tivo_id = tivo_id self.user_ids = user_ids class ExcludeFromTivo(): """ Sent by a user requesting to be excluded from Tivo """ def __init__(self, tivo_id, user_id): self.tivo_id = tivo_id ...
Python
import sys, time import socket, asyncore import Queue import simplejson import gobject from util import config from net import network from fvutil import fvcon FLASH_DEBUG = True POLICY = """ <cross-domain-policy> <allow-access-from domain="*" to-ports="*" /> </cross-domain-policy> """ class FlashInterfac...
Python
import string,cgi,time from os import curdir, sep from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer import gobject import thread import datetime class WebHandler(BaseHTTPRequestHandler): def do_GET(self): if self.path == "/": self.show_index() return ...
Python
#!/usr/bin/env python from OpenGL.GL import * from OpenGL.GLUT import * from OpenGL.GLU import * import serial import os import threading ESCAPE = '\033' KEY_a = '\141' KEY_b = '\142' KEY_c = '\143' KEY_d = '\144' KEY_e = '\145' KEY_f = '\146' #Initiate the glut window window = 0 # Rotation a...
Python
#!/usr/bin/env python from OpenGL.GL import * from OpenGL.GLUT import * from OpenGL.GLU import * import serial import os import threading ESCAPE = '\033' KEY_a = '\141' KEY_b = '\142' KEY_c = '\143' KEY_d = '\144' KEY_e = '\145' KEY_f = '\146' #Initiate the glut window window = 0 # Rotation a...
Python
import urllib import urllib2 import re import json from urlparse import urlparse, parse_qs import StorageServer from BeautifulSoup import BeautifulSoup import xbmcplugin import xbmcgui import xbmcaddon cache = StorageServer.StorageServer("flwoutdoors", 6) addon = xbmcaddon.Addon() addon_version = addon.getAddonInfo(...
Python
# Copyright 2009 Daniel Schubert # Copyright 2008 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 obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
Python
# Copyright 2008 Google Inc. # Copyright 2009 Daniel Schubert # # 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 appl...
Python
# Copyright 2008 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 obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
Python
# Copyright 2009 Daniel Schubert # # 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 applicable law or agreed to in wr...
Python
# Copyright 2008 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 obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
Python
# Copyright 2008 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 obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
Python
# Copyright 2008 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 obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
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
"""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
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"""Command-line tool to validate and pretty-print JSON Usage:: $ echo '{"json":"obj"}' | python -m simplejson.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -m simplejson.tool Expecting property name: line 1 column 2 (char 2) """ import sys import simplejson def main(): if len(...
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
# Copyright 2009 Daniel Schubert # # 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 applicable law or agreed to in wr...
Python
# Copyright 2009 Daniel Schubert # Copyright 2008 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 obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
Python
# Copyright 2008 Google Inc. # Copyright 2009 Daniel Schubert # # 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 appl...
Python
# Copyright 2008 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 obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
Python
import unittest import doctest class OptionalExtensionTestSuite(unittest.TestSuite): def run(self, result): import simplejson run = unittest.TestSuite.run run(self, result) simplejson._toggle_speedups(False) run(self, result) simplejson._toggle_speedups(True) ...
Python
"""Implementation of JSONEncoder """ import re from decimal import Decimal def _import_speedups(): try: from simplejson import _speedups return _speedups.encode_basestring_ascii, _speedups.make_encoder except ImportError: return None, None c_encode_basestring_ascii, c_make_encoder = _im...
Python
"""Implementation of JSONDecoder """ import re import sys import struct from simplejson.scanner import make_scanner def _import_c_scanstring(): try: from simplejson._speedups import scanstring return scanstring except ImportError: return None c_scanstring = _import_c_scanstring() __all...
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"""Command-line tool to validate and pretty-print JSON Usage:: $ echo '{"json":"obj"}' | python -m simplejson.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -m simplejson.tool Expecting property name: line 1 column 2 (char 2) """ import sys import simplejson as json def main(): ...
Python
"""JSON token scanner """ import re def _import_c_make_scanner(): try: from simplejson._speedups import make_scanner return make_scanner except ImportError: return None c_make_scanner = _import_c_make_scanner() __all__ = ['make_scanner'] NUMBER_RE = re.compile( r'(-?(?:0|[1-9]\d*))...
Python
"""Drop-in replacement for collections.OrderedDict by Raymond Hettinger http://code.activestate.com/recipes/576693/ """ from UserDict import DictMixin # Modified from original to support Python 2.4, see # http://code.google.com/p/simplejson/issues/detail?id=53 try: all except NameError: def all(seq): ...
Python
# Copyright 2009 Daniel Schubert # # 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 applicable law or agreed to in wr...
Python
# Copyright 2009 Daniel Schubert # Copyright 2008 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 obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
Python
# Copyright 2008 Google Inc. # Copyright 2009 Daniel Schubert # # 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 appl...
Python
# Copyright 2008 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 obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
Python
# Copyright 2009 Daniel Schubert # # 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 applicable law or agreed to in wr...
Python
# Copyright 2009 Daniel Schubert # Copyright 2008 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 obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
Python
# Copyright 2008 Google Inc. # Copyright 2009 Daniel Schubert # # 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 appl...
Python
# Copyright 2008 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 obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
Python
# Copyright 2009 Daniel Schubert # # 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 applicable law or agreed to in wr...
Python
# Copyright 2009 Daniel Schubert # Copyright 2008 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 obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
Python
# Copyright 2008 Google Inc. # Copyright 2009 Daniel Schubert # # 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 appl...
Python
# Copyright 2008 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 obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
Python
# Copyright 2009 Daniel Schubert # # 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 applicable law or agreed to in wr...
Python
# Copyright 2009 Daniel Schubert # Copyright 2008 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 obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
Python
# Copyright 2008 Google Inc. # Copyright 2009 Daniel Schubert # # 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 appl...
Python
# Copyright 2008 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 obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
Python
#!/usr/bin/python2.4 # # Copyright 2007 Google Inc. All Rights Reserved. # # 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...
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
"""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
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"""Command-line tool to validate and pretty-print JSON Usage:: $ echo '{"json":"obj"}' | python -m simplejson.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -m simplejson.tool Expecting property name: line 1 column 2 (char 2) """ import sys import simplejson def main(): if len(...
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
#!/usr/bin/python2.4 # # Copyright 2007 Google Inc. All Rights Reserved. # # 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...
Python
# Copyright 2009 Daniel Schubert # # 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 applicable law or agreed to in wr...
Python
#!/usr/bin/env python # -*- coding:Utf-8 -*- # # Modules # import ConfigParser import os import sys import threading from base.decorators import synchronized from base.Patterns import Singleton import core.Constantes as Constantes import logging logger = logging.getLogger( "TVDownloader.Configuration" ) # # Cla...
Python
#!/usr/bin/env python # -*- coding:Utf-8 -*- import ftplib,socket,re,sys,urlparse,os import subprocess,shlex,re,ctypes import fcntl,select libmms = ctypes.cdll.LoadLibrary("libmms.so.0") librtmp = ctypes.cdll.LoadLibrary("librtmp.so") import urllib,httplib ## Interface des classes effectuant le téléchargement de fi...
Python
#!/usr/bin/env python # -*- coding:Utf-8 -*- ########### # Modules # ########### import cPickle as pickle import os import Constantes from Fichier import Fichier import logging logger = logging.getLogger( "TVDownloader" ) import threading from tvdcore.util import SynchronizedMethod from TVDContex...
Python
#!/usr/bin/env python # -*- coding:Utf-8 -*- # # Modules # import os import sys # # Variables # # du programme TVD_NOM = "TVDownloader" TVD_VERSION = "1.0 alpha" # du systeme OS_UNIX = False OS_WINDOWS = False if( sys.platform.lower()[ : 3 ] == "win" ): OS_WINDOWS = True else: OS_UNIX = True # des che...
Python
#!/usr/bin/env python # -*- coding:Utf-8 -*- ########### # Modules # ########### import datetime import os.path import time from DownloaderFactory import DownloaderFactory import util as lib import util.html import util.fichierDossier import logging logger = logging.getLogger( "TVDownloader" ) ########## # Classe...
Python