code stringlengths 1 1.49M | vector listlengths 0 7.38k | snippet listlengths 0 7.38k |
|---|---|---|
#==============================================================================
# PyTyle - An on-demand tiling manager
# Copyright (C) 2009-2010 Andrew Gallant <andrew@pytyle.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publishe... | [
[
1,
0,
0.3636,
0.0182,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.4,
0.0182,
0,
0.66,
0.25,
901,
0,
1,
0,
0,
901,
0,
0
],
[
1,
0,
0.4182,
0.0182,
0,
0.66,... | [
"import sys",
"from distutils import sysconfig",
"from distutils.core import setup",
"try:\n import xcb.xproto, xcb.xcb, xcb.xinerama, xcb.randr\nexcept:\n print('')\n print('PyTyle 2 requires the X Python Binding')\n print('See: http://cgit.freedesktop.org/xcb/xpyb/')\n print('Or xpyb-ng can b... |
import ptxcb
from tile import Tile
from container import Container
class ManualTile(Tile):
def __init__(self, monitor):
Tile.__init__(self, monitor)
self.root = None
self.catchall = None
#
# Helper methods
#
def add(self, win):
if (
win.tilable() and s... | [
[
1,
0,
0.001,
0.001,
0,
0.66,
0,
805,
0,
1,
0,
0,
805,
0,
0
],
[
1,
0,
0.0029,
0.001,
0,
0.66,
0.125,
319,
0,
1,
0,
0,
319,
0,
0
],
[
1,
0,
0.0039,
0.001,
0,
0.66,... | [
"import ptxcb",
"from tile import Tile",
"from container import Container",
"class ManualTile(Tile):\n def __init__(self, monitor):\n Tile.__init__(self, monitor)\n self.root = None\n self.catchall = None\n\n #\n # Helper methods",
" def __init__(self, monitor):\n Til... |
import ptxcb
class Workspace(object):
WORKSPACES = {}
@staticmethod
def add(wsid):
Desktop.add(wsid)
@staticmethod
def iter_all_monitors():
for wsid in Workspace.WORKSPACES:
for mon in Workspace.WORKSPACES[wsid].iter_monitors():
yield mon
@staticme... | [
[
1,
0,
0.0127,
0.0127,
0,
0.66,
0,
805,
0,
1,
0,
0,
805,
0,
0
],
[
3,
0,
0.3671,
0.6709,
0,
0.66,
0.3333,
92,
0,
10,
0,
0,
186,
0,
6
],
[
14,
1,
0.0506,
0.0127,
1,
... | [
"import ptxcb",
"class Workspace(object):\n WORKSPACES = {}\n\n @staticmethod\n def add(wsid):\n Desktop.add(wsid)\n\n @staticmethod",
" WORKSPACES = {}",
" def add(wsid):\n Desktop.add(wsid)",
" Desktop.add(wsid)",
" def iter_all_monitors():\n for wsid in ... |
class Grid(object):
def __init__(self):
pass
| [
[
3,
0,
0.6667,
1,
0,
0.66,
0,
690,
0,
1,
0,
0,
186,
0,
0
],
[
2,
1,
0.8333,
0.6667,
1,
0.94,
0,
555,
0,
1,
0,
0,
0,
0,
0
]
] | [
"class Grid(object):\n def __init__(self):\n pass",
" def __init__(self):\n pass"
] |
import re
import config
from command import Command
from container import Container
class Tile(object):
queue_tile = set()
@staticmethod
def dispatch(monitor, command):
assert isinstance(command, Command)
tiler = monitor.get_tiler()
if tiler:
if tiler.get_name() == '... | [
[
1,
0,
0.0048,
0.0048,
0,
0.66,
0,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0145,
0.0048,
0,
0.66,
0.25,
308,
0,
1,
0,
0,
308,
0,
0
],
[
1,
0,
0.0193,
0.0048,
0,
0.... | [
"import re",
"import config",
"from command import Command",
"from container import Container",
"class Tile(object):\n queue_tile = set()\n\n @staticmethod\n def dispatch(monitor, command):\n assert isinstance(command, Command)\n\n tiler = monitor.get_tiler()",
" queue_tile = set... |
from pt.tile_auto import AutoTile
class Maximal(AutoTile):
def __init__(self, monitor):
AutoTile.__init__(self, monitor)
#
# Commands
#
def cmd_tile(self):
AutoTile.cmd_tile(self)
if not self.store.all():
return
# Do master last, in case decorations a... | [
[
1,
0,
0.0286,
0.0286,
0,
0.66,
0,
988,
0,
1,
0,
0,
988,
0,
0
],
[
3,
0,
0.5429,
0.9429,
0,
0.66,
1,
447,
0,
4,
0,
0,
407,
0,
7
],
[
2,
1,
0.1286,
0.0571,
1,
0.22,... | [
"from pt.tile_auto import AutoTile",
"class Maximal(AutoTile):\n def __init__(self, monitor):\n AutoTile.__init__(self, monitor)\n\n #\n # Commands\n #",
" def __init__(self, monitor):\n AutoTile.__init__(self, monitor)",
" AutoTile.__init__(self, monitor)",
" def cmd_... |
import math
from pt.tile_auto import AutoTile
class Vertical(AutoTile):
def __init__(self, monitor):
AutoTile.__init__(self, monitor)
self.hsplit = self.get_option('width_factor')
#
# Helper methods
#
def decrement_hsplit(self):
self.hsplit -= self.get_option('step_size'... | [
[
1,
0,
0.006,
0.006,
0,
0.66,
0,
526,
0,
1,
0,
0,
526,
0,
0
],
[
1,
0,
0.018,
0.006,
0,
0.66,
0.3333,
988,
0,
1,
0,
0,
988,
0,
0
],
[
3,
0,
0.2814,
0.509,
0,
0.66,... | [
"import math",
"from pt.tile_auto import AutoTile",
"class Vertical(AutoTile):\n def __init__(self, monitor):\n AutoTile.__init__(self, monitor)\n\n self.hsplit = self.get_option('width_factor')\n\n #\n # Helper methods",
" def __init__(self, monitor):\n AutoTile.__init__(self... |
import math
from pt.tile_auto import AutoTile
class Cascade(AutoTile):
def __init__(self, monitor):
AutoTile.__init__(self, monitor)
self.hsplit = self.get_option('width_factor')
self.vsplit = self.get_option('height_factor')
#
# Helper methods
#
def raise_active(self):
... | [
[
1,
0,
0.0061,
0.0061,
0,
0.66,
0,
526,
0,
1,
0,
0,
526,
0,
0
],
[
1,
0,
0.0183,
0.0061,
0,
0.66,
0.5,
988,
0,
1,
0,
0,
988,
0,
0
],
[
3,
0,
0.5152,
0.9756,
0,
0.6... | [
"import math",
"from pt.tile_auto import AutoTile",
"class Cascade(AutoTile):\n def __init__(self, monitor):\n AutoTile.__init__(self, monitor)\n\n self.hsplit = self.get_option('width_factor')\n self.vsplit = self.get_option('height_factor')\n\n #",
" def __init__(self, monitor)... |
import pt.tile_manual
import cascade
import center
import horizontal
import maximal
import vertical
ManualTile = pt.tile_manual.ManualTile
Cascade = cascade.Cascade
Center = center.Center
Horizontal = horizontal.Horizontal
HorizontalRows = horizontal.HorizontalRows
Maximal = maximal.Maximal
Vertical = vertical.Verti... | [
[
1,
0,
0.0588,
0.0588,
0,
0.66,
0,
744,
0,
1,
0,
0,
744,
0,
0
],
[
1,
0,
0.1765,
0.0588,
0,
0.66,
0.0769,
248,
0,
1,
0,
0,
248,
0,
0
],
[
1,
0,
0.2353,
0.0588,
0,
... | [
"import pt.tile_manual",
"import cascade",
"import center",
"import horizontal",
"import maximal",
"import vertical",
"ManualTile = pt.tile_manual.ManualTile",
"Cascade = cascade.Cascade",
"Center = center.Center",
"Horizontal = horizontal.Horizontal",
"HorizontalRows = horizontal.HorizontalRows... |
import math
from pt.tile_auto import AutoTile
class Horizontal(AutoTile):
def __init__(self, monitor):
AutoTile.__init__(self, monitor)
self.vsplit = self.get_option('height_factor')
#
# Helper methods
#
def decrement_vsplit(self):
self.vsplit -= self.get_option('step_si... | [
[
1,
0,
0.0061,
0.0061,
0,
0.66,
0,
526,
0,
1,
0,
0,
526,
0,
0
],
[
1,
0,
0.0184,
0.0061,
0,
0.66,
0.3333,
988,
0,
1,
0,
0,
988,
0,
0
],
[
3,
0,
0.2883,
0.5215,
0,
... | [
"import math",
"from pt.tile_auto import AutoTile",
"class Horizontal(AutoTile):\n def __init__(self, monitor):\n AutoTile.__init__(self, monitor)\n\n self.vsplit = self.get_option('height_factor')\n\n #\n # Helper methods",
" def __init__(self, monitor):\n AutoTile.__init__(s... |
import math
from pt.tile_auto import AutoTile
class Center(AutoTile):
def __init__(self, monitor):
AutoTile.__init__(self, monitor)
self.hsplit = self.get_option('width_factor')
self.vsplit = self.get_option('height_factor')
self.columns = self.get_option('columns')
#
# H... | [
[
1,
0,
0.0083,
0.0083,
0,
0.66,
0,
526,
0,
1,
0,
0,
526,
0,
0
],
[
1,
0,
0.0248,
0.0083,
0,
0.66,
0.5,
988,
0,
1,
0,
0,
988,
0,
0
],
[
3,
0,
0.5207,
0.9669,
0,
0.6... | [
"import math",
"from pt.tile_auto import AutoTile",
"class Center(AutoTile):\n def __init__(self, monitor):\n AutoTile.__init__(self, monitor)\n\n self.hsplit = self.get_option('width_factor')\n self.vsplit = self.get_option('height_factor')\n self.columns = self.get_option('colum... |
import time
import ptxcb
import config
from command import Command
from window import Window
from monitor import Monitor
from workspace import Workspace
from container import Container
_ACTIVE = None
pointer_grab = False
moving = False
properties = {}
xinerama = ptxcb.connection.xinerama_get_screens()
def init():
... | [
[
1,
0,
0.0037,
0.0037,
0,
0.66,
0,
654,
0,
1,
0,
0,
654,
0,
0
],
[
1,
0,
0.011,
0.0037,
0,
0.66,
0.0303,
805,
0,
1,
0,
0,
805,
0,
0
],
[
1,
0,
0.0184,
0.0037,
0,
0... | [
"import time",
"import ptxcb",
"import config",
"from command import Command",
"from window import Window",
"from monitor import Monitor",
"from workspace import Workspace",
"from container import Container",
"_ACTIVE = None",
"pointer_grab = False",
"moving = False",
"properties = {}",
"xin... |
# Library imports
import config
import ptxcb
import tilers
# Class imports
from workspace import Workspace
class Monitor(object):
@staticmethod
def add(wsid, xinerama):
for mid, screen in enumerate(xinerama):
new_mon = Monitor(
Workspace.WORKSPACES[wsid],
mi... | [
[
1,
0,
0.0084,
0.0042,
0,
0.66,
0,
308,
0,
1,
0,
0,
308,
0,
0
],
[
1,
0,
0.0127,
0.0042,
0,
0.66,
0.25,
805,
0,
1,
0,
0,
805,
0,
0
],
[
1,
0,
0.0169,
0.0042,
0,
0.... | [
"import config",
"import ptxcb",
"import tilers",
"from workspace import Workspace",
"class Monitor(object):\n @staticmethod\n def add(wsid, xinerama):\n for mid, screen in enumerate(xinerama):\n new_mon = Monitor(\n Workspace.WORKSPACES[wsid],\n mid,\n ... |
events = {
'KeyPressEvent': 2,
'KeyReleaseEvent': 3,
'ButtonPressEvent': 4,
'ButtonReleaseEvent': 5,
'MotionNotifyEvent': 6,
'EnterNotifyEvent': 7,
'LeaveNotifyEvent': 8,
'FocusInEvent': 9,
'FocusOutEvent': 10,
'KeymapNotifyEvent': 11,
'ExposeEvent': 12,
'GraphicsExposure... | [
[
14,
0,
0.5143,
1,
0,
0.66,
0,
830,
0,
0,
0,
0,
0,
6,
0
]
] | [
"events = {\n 'KeyPressEvent': 2,\n 'KeyReleaseEvent': 3,\n 'ButtonPressEvent': 4,\n 'ButtonReleaseEvent': 5,\n 'MotionNotifyEvent': 6,\n 'EnterNotifyEvent': 7,\n 'LeaveNotifyEvent': 8,"
] |
import xcb.xproto
from window import Window
from window import XROOT
from atom import Atom
def dispatch(e):
NotifyModes = {
0: 'Normal', 1: 'Grab', 2: 'Ungrab', 3: 'WhileGrabbed'
}
NotifyDetails = {
0: 'Ancestor', 1: 'Virtual', 2: 'Inferior', 3: 'Nonlinear',
4: 'NonlinearVirtual',... | [
[
1,
0,
0.0127,
0.0127,
0,
0.66,
0,
490,
0,
1,
0,
0,
490,
0,
0
],
[
1,
0,
0.038,
0.0127,
0,
0.66,
0.25,
114,
0,
1,
0,
0,
114,
0,
0
],
[
1,
0,
0.0506,
0.0127,
0,
0.6... | [
"import xcb.xproto",
"from window import Window",
"from window import XROOT",
"from atom import Atom",
"def dispatch(e):\n NotifyModes = {\n 0: 'Normal', 1: 'Grab', 2: 'Ungrab', 3: 'WhileGrabbed'\n }\n\n NotifyDetails = {\n 0: 'Ancestor', 1: 'Virtual', 2: 'Inferior', 3: 'Nonlinear',\n... |
import struct
import xcb.xproto, xcb.xcb, xcb.xinerama, xcb.randr
conn = None
setup = None
syms_to_codes = {}
codes_to_syms = {}
def init():
global conn, setup
conn = xcb.xcb.connect()
setup = conn.get_setup()
init_keymap()
def init_keymap():
global setup, syms_to_codes, codes_to_syms
q ... | [
[
1,
0,
0.0093,
0.0093,
0,
0.66,
0,
399,
0,
1,
0,
0,
399,
0,
0
],
[
1,
0,
0.0278,
0.0093,
0,
0.66,
0.0588,
490,
0,
4,
0,
0,
490,
0,
0
],
[
14,
0,
0.0463,
0.0093,
0,
... | [
"import struct",
"import xcb.xproto, xcb.xcb, xcb.xinerama, xcb.randr",
"conn = None",
"setup = None",
"syms_to_codes = {}",
"codes_to_syms = {}",
"def init():\n global conn, setup\n\n conn = xcb.xcb.connect()\n setup = conn.get_setup()\n\n init_keymap()",
" conn = xcb.xcb.connect()",
... |
atoms = {
'_PYTYLE_TYPE': ('ATOM', 32),
'_PYTYLE_TYPE_PLACE_HOLDER': ('ATOM', 32),
'_PYTYLE_TYPE_BORDER': ('ATOM', 32),
'WM_CLASS': ('STRING', 8),
'WM_HINTS': ('WM_HINTS', 32),
'WM_NAME': ('STRING', 8),
'WM_NORMAL_HINTS': ('WM_SIZE_HINTS', 32),
'WM_PROTOCOLS': ('ATOM', 32),
'WM_STAT... | [
[
14,
0,
0.2723,
0.5347,
0,
0.66,
0,
715,
0,
0,
0,
0,
0,
6,
0
],
[
14,
0,
0.6287,
0.1584,
0,
0.66,
0.3333,
354,
0,
0,
0,
0,
0,
6,
0
],
[
14,
0,
0.7871,
0.1386,
0,
0... | [
"atoms = {\n '_PYTYLE_TYPE': ('ATOM', 32),\n '_PYTYLE_TYPE_PLACE_HOLDER': ('ATOM', 32),\n '_PYTYLE_TYPE_BORDER': ('ATOM', 32),\n\n 'WM_CLASS': ('STRING', 8),\n 'WM_HINTS': ('WM_HINTS', 32),\n 'WM_NAME': ('STRING', 8),",
"window_types = {\n '_NET_WM_WINDOW_TYPE_DESKTOP': ('ATOM', 32),\n '_N... |
import struct
import xcb.xproto
import connection
from atoms import atoms
class Atom:
_cache = {}
@staticmethod
def build_cache():
if Atom._cache:
return
for atom in atoms:
Atom._cache[atom] = connection.get_core().InternAtom(
False,
... | [
[
1,
0,
0.0119,
0.0119,
0,
0.66,
0,
399,
0,
1,
0,
0,
399,
0,
0
],
[
1,
0,
0.0357,
0.0119,
0,
0.66,
0.25,
490,
0,
1,
0,
0,
490,
0,
0
],
[
1,
0,
0.0595,
0.0119,
0,
0.... | [
"import struct",
"import xcb.xproto",
"import connection",
"from atoms import atoms",
"class Atom:\n _cache = {}\n\n @staticmethod\n def build_cache():\n if Atom._cache:\n return",
" _cache = {}",
" def build_cache():\n if Atom._cache:\n return\n\n ... |
import atom
import connection
import event
import keysyms
import window
Atom = atom.Atom
BlankWindow = window.BlankWindow
LineWindow = window.LineWindow
RootWindow = window.RootWindow
Window = window.Window
keysyms = keysyms.keysyms
atoms = atoms.atoms
XROOT = window.XROOT
| [
[
1,
0,
0.0625,
0.0625,
0,
0.66,
0,
833,
0,
1,
0,
0,
833,
0,
0
],
[
1,
0,
0.125,
0.0625,
0,
0.66,
0.0833,
351,
0,
1,
0,
0,
351,
0,
0
],
[
1,
0,
0.1875,
0.0625,
0,
0... | [
"import atom",
"import connection",
"import event",
"import keysyms",
"import window",
"Atom = atom.Atom",
"BlankWindow = window.BlankWindow",
"LineWindow = window.LineWindow",
"RootWindow = window.RootWindow",
"Window = window.Window",
"keysyms = keysyms.keysyms",
"atoms = atoms.atoms",
"XR... |
import struct, traceback, time
import xcb.xproto, xcb.xcb
import connection
from atom import Atom
from events import events
class Window(object):
queue = []
@staticmethod
def exec_queue():
for tup in Window.queue:
tup[0](*tup[1:])
Window.queue = []
def __init__(self, wid... | [
[
1,
0,
0.0015,
0.0015,
0,
0.66,
0,
399,
0,
3,
0,
0,
399,
0,
0
],
[
1,
0,
0.0046,
0.0015,
0,
0.66,
0.1111,
490,
0,
2,
0,
0,
490,
0,
0
],
[
1,
0,
0.0077,
0.0015,
0,
... | [
"import struct, traceback, time",
"import xcb.xproto, xcb.xcb",
"import connection",
"from atom import Atom",
"from events import events",
"class Window(object):\n queue = []\n\n @staticmethod\n def exec_queue():\n for tup in Window.queue:\n tup[0](*tup[1:])\n Window.queu... |
keysyms = {
'VoidSymbol': 0xffffff,
'BackSpace': 0xff08,
'Tab': 0xff09,
'Linefeed': 0xff0a,
'Clear': 0xff0b,
'Return': 0xff0d,
'Pause': 0xff13,
'Scroll_Lock': 0xff14,
'Sys_Req': 0xff15,
'Escape': 0xff1b,
'Delete': 0xffff,
'Multi_key': 0xff20,
'Codeinput': 0xff37,
... | [
[
14,
0,
0.5002,
1,
0,
0.66,
0,
226,
0,
0,
0,
0,
0,
6,
0
]
] | [
"keysyms = {\n 'VoidSymbol': 0xffffff,\n 'BackSpace': 0xff08,\n 'Tab': 0xff09,\n 'Linefeed': 0xff0a,\n 'Clear': 0xff0b,\n 'Return': 0xff0d,\n 'Pause': 0xff13,"
] |
import ptxcb
import config
from window import BogusWindow
class Container(object):
idinc = 1
active = None
@staticmethod
def manage_focus(win):
if win and win.container:
win.container.borders_activate(win.container.tiler.decor)
elif Container.active:
Container.... | [
[
1,
0,
0.005,
0.005,
0,
0.66,
0,
805,
0,
1,
0,
0,
805,
0,
0
],
[
1,
0,
0.01,
0.005,
0,
0.66,
0.3333,
308,
0,
1,
0,
0,
308,
0,
0
],
[
1,
0,
0.0199,
0.005,
0,
0.66,
... | [
"import ptxcb",
"import config",
"from window import BogusWindow",
"class Container(object):\n idinc = 1\n active = None\n\n @staticmethod\n def manage_focus(win):\n if win and win.container:\n win.container.borders_activate(win.container.tiler.decor)",
" idinc = 1",
" ... |
import time
import ptxcb
import config
from workspace import Workspace
class Window(object):
WINDOWS = {}
@staticmethod
def add(wid):
if wid not in Window.WINDOWS:
if Window.manageable(wid):
win = Window(wid)
Window.WINDOWS[wid] = win
... | [
[
1,
0,
0.0028,
0.0028,
0,
0.66,
0,
654,
0,
1,
0,
0,
654,
0,
0
],
[
1,
0,
0.0083,
0.0028,
0,
0.66,
0.2,
805,
0,
1,
0,
0,
805,
0,
0
],
[
1,
0,
0.011,
0.0028,
0,
0.66... | [
"import time",
"import ptxcb",
"import config",
"from workspace import Workspace",
"class Window(object):\n WINDOWS = {}\n\n @staticmethod\n def add(wid):\n if wid not in Window.WINDOWS:\n if Window.manageable(wid):\n win = Window(wid)",
" WINDOWS = {}",
" ... |
import time
import config
import ptxcb
import state
import tilers
from command import Command
from window import Window
from tile import Tile
class Dispatcher(object):
def __init__(self, event_data):
self._event_data = event_data
self._stop = False
assert 'event' in self._event_data
... | [
[
1,
0,
0.0083,
0.0083,
0,
0.66,
0,
654,
0,
1,
0,
0,
654,
0,
0
],
[
1,
0,
0.025,
0.0083,
0,
0.66,
0.125,
308,
0,
1,
0,
0,
308,
0,
0
],
[
1,
0,
0.0333,
0.0083,
0,
0.... | [
"import time",
"import config",
"import ptxcb",
"import state",
"import tilers",
"from command import Command",
"from window import Window",
"from tile import Tile",
"class Dispatcher(object):\n def __init__(self, event_data):\n self._event_data = event_data\n self._stop = False\n\n... |
import xcb.xproto
import ptxcb
import config
class Command:
_cmds = {}
_mods = {
'alt': xcb.xproto.ModMask._1,
'ctrl': xcb.xproto.ModMask.Control,
'shift': xcb.xproto.ModMask.Shift,
'super': xcb.xproto.ModMask._4,
'menu': xcb.xproto.ModMask._3
}
def __init__(se... | [
[
1,
0,
0.0103,
0.0103,
0,
0.66,
0,
490,
0,
1,
0,
0,
490,
0,
0
],
[
1,
0,
0.0309,
0.0103,
0,
0.66,
0.3333,
805,
0,
1,
0,
0,
805,
0,
0
],
[
1,
0,
0.0412,
0.0103,
0,
... | [
"import xcb.xproto",
"import ptxcb",
"import config",
"class Command:\n _cmds = {}\n _mods = {\n 'alt': xcb.xproto.ModMask._1,\n 'ctrl': xcb.xproto.ModMask.Control,\n 'shift': xcb.xproto.ModMask.Shift,\n 'super': xcb.xproto.ModMask._4,\n 'menu': xcb.xproto.ModMask._3",... |
from tile import Tile
from container import Container
class AutoTile(Tile):
def __init__(self, monitor):
Tile.__init__(self, monitor)
self.store = None
self.cycle_index = 0
#
# Helper methods
#
def add(self, win):
if (
win.tilable() and self.tiling and
... | [
[
1,
0,
0.0031,
0.0031,
0,
0.66,
0,
319,
0,
1,
0,
0,
319,
0,
0
],
[
1,
0,
0.0062,
0.0031,
0,
0.66,
0.3333,
516,
0,
1,
0,
0,
516,
0,
0
],
[
3,
0,
0.3665,
0.7112,
0,
... | [
"from tile import Tile",
"from container import Container",
"class AutoTile(Tile):\n def __init__(self, monitor):\n Tile.__init__(self, monitor)\n self.store = None\n self.cycle_index = 0\n\n #\n # Helper methods",
" def __init__(self, monitor):\n Tile.__init__(self, mo... |
#!/usr/bin/env python
#==============================================================================
# PyTyle - An on-demand tiling manager
# Copyright (C) 2009-2010 Andrew Gallant <andrew@pytyle.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Publ... | [
[
1,
0,
0.0833,
0.0833,
0,
0.66,
0,
423,
0,
3,
0,
0,
423,
0,
0
],
[
1,
0,
0.25,
0.0833,
0,
0.66,
0.1429,
490,
0,
1,
0,
0,
490,
0,
0
],
[
1,
0,
0.4167,
0.0833,
0,
0.... | [
"import traceback, sys, time",
"import xcb.xproto",
"import pt.config as config",
"import pt.ptxcb as ptxcb",
"import pt.state as state",
"from pt.dispatcher import Dispatcher",
"from pt.window import Window",
"from pt.tile import Tile"
] |
#!/usr/bin/env python
## Copyright (c) 2012 The WebM project authors. All Rights Reserved.
##
## Use of this source code is governed by a BSD-style license
## that can be found in the LICENSE file in the root of the source
## tree. An additional intellectual property rights grant can be found
## in the file PATENT... | [
[
8,
0,
0.0787,
0.0079,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0945,
0.0079,
0,
0.66,
0.2,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.1102,
0.0079,
0,
0.66,
... | [
"\"\"\"Classes for representing diff pieces.\"\"\"",
"__author__ = \"jkoleszar@google.com\"",
"import re",
"class DiffLines(object):\n \"\"\"A container for one half of a diff.\"\"\"\n\n def __init__(self, filename, offset, length):\n self.filename = filename\n self.offset = offset\n ... |
#!/usr/bin/env python
## Copyright (c) 2012 The WebM project authors. All Rights Reserved.
##
## Use of this source code is governed by a BSD-style license
## that can be found in the LICENSE file in the root of the source
## tree. An additional intellectual property rights grant can be found
## in the file PATENT... | [
[
8,
0,
0.1645,
0.0789,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.2237,
0.0132,
0,
0.66,
0.1429,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.25,
0.0132,
0,
0.66,
... | [
"\"\"\"Calculates the \"intersection\" of two unified diffs.\n\nGiven two diffs, A and B, it finds all hunks in B that had non-context lines\nin A and prints them to stdout. This is useful to determine the hunks in B that\nare relevant to A. The resulting file can be applied with patch(1) on top of A.\n\"\"\"",
"... |
#!/usr/bin/env python
## Copyright (c) 2012 The WebM project authors. All Rights Reserved.
##
## Use of this source code is governed by a BSD-style license
## that can be found in the LICENSE file in the root of the source
## tree. An additional intellectual property rights grant can be found
## in the file PATENT... | [
[
8,
0,
0.2857,
0.3,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.4571,
0.0143,
0,
0.66,
0.1667,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.4714,
0.0143,
0,
0.66,
... | [
"\"\"\"Wraps paragraphs of text, preserving manual formatting\n\nThis is like fold(1), but has the special convention of not modifying lines\nthat start with whitespace. This allows you to intersperse blocks with\nspecial formatting, like code blocks, with written prose. The prose will\nbe wordwrapped, and the manu... |
"""
* Copyright (c) 2012 The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributi... | [
[
8,
0,
0.0472,
0.0849,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1038,
0.0094,
0,
0.66,
0.125,
509,
0,
6,
0,
0,
509,
0,
0
],
[
14,
0,
0.1132,
0.0094,
0,
0.66... | [
"\"\"\"\n * Copyright (c) 2012 The WebM project authors. All Rights Reserved.\n *\n * Use of this source code is governed by a BSD-style license\n * that can be found in the LICENSE file in the root of the source\n * tree. An additional intellectual property rights grant can be found\n * in the file PATENTS. ... |
#====================================================================
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you ... | [
[
1,
0,
0.3514,
0.0135,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.3649,
0.0135,
0,
0.66,
0.1111,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.3784,
0.0135,
0,
... | [
"import os",
"import re",
"import tempfile",
"import shutil",
"ignore_pattern = re.compile('^(.svn|target|bin|classes)')",
"java_pattern = re.compile('^.*\\.java')",
"annot_pattern = re.compile('import org\\.apache\\.http\\.annotation\\.')",
"def process_dir(dir):\n files = os.listdir(dir)\n for... |
'''
Module which prompts the user for translations and saves them.
TODO: implement
@author: Rodrigo Damazio
'''
class Translator(object):
'''
classdocs
'''
def __init__(self, language):
'''
Constructor
'''
self._language = language
def Translate(self, string_names):
print string_names | [
[
8,
0,
0.1905,
0.3333,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
3,
0,
0.7143,
0.619,
0,
0.66,
1,
229,
0,
2,
0,
0,
186,
0,
1
],
[
8,
1,
0.5238,
0.1429,
1,
0.2,
0... | [
"'''\nModule which prompts the user for translations and saves them.\n\nTODO: implement\n\n@author: Rodrigo Damazio\n'''",
"class Translator(object):\n '''\n classdocs\n '''\n\n def __init__(self, language):\n '''\n Constructor",
" '''\n classdocs\n '''",
" def __init__(self, language):\n '''... |
'''
Module which brings history information about files from Mercurial.
@author: Rodrigo Damazio
'''
import re
import subprocess
REVISION_REGEX = re.compile(r'(?P<hash>[0-9a-f]{12}):.*')
def _GetOutputLines(args):
'''
Runs an external process and returns its output as a list of lines.
@param args: the argume... | [
[
8,
0,
0.0319,
0.0532,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0745,
0.0106,
0,
0.66,
0.1429,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0851,
0.0106,
0,
0.66... | [
"'''\nModule which brings history information about files from Mercurial.\n\n@author: Rodrigo Damazio\n'''",
"import re",
"import subprocess",
"REVISION_REGEX = re.compile(r'(?P<hash>[0-9a-f]{12}):.*')",
"def _GetOutputLines(args):\n '''\n Runs an external process and returns its output as a list of lines... |
'''
Module which parses a string XML file.
@author: Rodrigo Damazio
'''
from xml.parsers.expat import ParserCreate
import re
#import xml.etree.ElementTree as ET
class StringsParser(object):
'''
Parser for string XML files.
This object is not thread-safe and should be used for parsing a single file at
a time... | [
[
8,
0,
0.0261,
0.0435,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0609,
0.0087,
0,
0.66,
0.3333,
573,
0,
1,
0,
0,
573,
0,
0
],
[
1,
0,
0.0696,
0.0087,
0,
0.66... | [
"'''\nModule which parses a string XML file.\n\n@author: Rodrigo Damazio\n'''",
"from xml.parsers.expat import ParserCreate",
"import re",
"class StringsParser(object):\n '''\n Parser for string XML files.\n\n This object is not thread-safe and should be used for parsing a single file at\n a time, only.\n... |
#!/usr/bin/python
'''
Entry point for My Tracks i18n tool.
@author: Rodrigo Damazio
'''
import mytracks.files
import mytracks.translate
import mytracks.validate
import sys
def Usage():
print 'Usage: %s <command> [<language> ...]\n' % sys.argv[0]
print 'Commands are:'
print ' cleanup'
print ' translate'
p... | [
[
8,
0,
0.0417,
0.0521,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0833,
0.0104,
0,
0.66,
0.125,
640,
0,
1,
0,
0,
640,
0,
0
],
[
1,
0,
0.0938,
0.0104,
0,
0.66,... | [
"'''\nEntry point for My Tracks i18n tool.\n\n@author: Rodrigo Damazio\n'''",
"import mytracks.files",
"import mytracks.translate",
"import mytracks.validate",
"import sys",
"def Usage():\n print('Usage: %s <command> [<language> ...]\\n' % sys.argv[0])\n print('Commands are:')\n print(' cleanup')\n p... |
'''
Module which compares languague files to the master file and detects
issues.
@author: Rodrigo Damazio
'''
import os
from mytracks.parser import StringsParser
import mytracks.history
class Validator(object):
def __init__(self, languages):
'''
Builds a strings file validator.
Params:
@para... | [
[
8,
0,
0.0304,
0.0522,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0696,
0.0087,
0,
0.66,
0.25,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0783,
0.0087,
0,
0.66,
... | [
"'''\nModule which compares languague files to the master file and detects\nissues.\n\n@author: Rodrigo Damazio\n'''",
"import os",
"from mytracks.parser import StringsParser",
"import mytracks.history",
"class Validator(object):\n\n def __init__(self, languages):\n '''\n Builds a strings file valida... |
'''
Module for dealing with resource files (but not their contents).
@author: Rodrigo Damazio
'''
import os.path
from glob import glob
import re
MYTRACKS_RES_DIR = 'MyTracks/res'
ANDROID_MASTER_VALUES = 'values'
ANDROID_VALUES_MASK = 'values-*'
def GetMyTracksDir():
'''
Returns the directory in which the MyTrac... | [
[
8,
0,
0.0667,
0.1111,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1333,
0.0222,
0,
0.66,
0.125,
79,
0,
1,
0,
0,
79,
0,
0
],
[
1,
0,
0.1556,
0.0222,
0,
0.66,
... | [
"'''\nModule for dealing with resource files (but not their contents).\n\n@author: Rodrigo Damazio\n'''",
"import os.path",
"from glob import glob",
"import re",
"MYTRACKS_RES_DIR = 'MyTracks/res'",
"ANDROID_MASTER_VALUES = 'values'",
"ANDROID_VALUES_MASK = 'values-*'",
"def GetMyTracksDir():\n '''\n... |
# Django settings for minutes project.
import os
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' o... | [
[
1,
0,
0.006,
0.003,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
14,
0,
0.0121,
0.003,
0,
0.66,
0.0086,
309,
1,
0,
0,
0,
0,
4,
0
],
[
14,
0,
0.0151,
0.003,
0,
0.66... | [
"import os",
"DEBUG = True",
"TEMPLATE_DEBUG = DEBUG",
"ADMINS = (\n # ('Your Name', 'your_email@domain.com'),\n)",
"MANAGERS = ADMINS",
"DATABASES = {\n 'default': {\n 'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle... |
"""Update items"""
import os, sys, site
python_version = 'python%s.%s' % sys.version_info[:2]
site_path = os.path.abspath(
os.path.normpath(
os.path.join(os.path.dirname(__file__),
'../lib', python_version, 'site-packages')))
site.addsitedir(site_path)
sys.path.append(os.path.abspath... | [
[
8,
0,
0.0476,
0.0476,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1429,
0.0476,
0,
0.66,
0.1111,
688,
0,
3,
0,
0,
688,
0,
0
],
[
14,
0,
0.2381,
0.0476,
0,
0.6... | [
"\"\"\"Update items\"\"\"",
"import os, sys, site",
"python_version = 'python%s.%s' % sys.version_info[:2]",
"site_path = os.path.abspath(\n os.path.normpath(\n os.path.join(os.path.dirname(__file__),\n '../lib', python_version, 'site-packages')))",
"site.addsitedir(site_path)"... |
import persistent_messages
from persistent_messages.constants import PERSISTENT_MESSAGE_LEVELS
from django.db import models
from django.contrib.auth.models import User
from django.contrib import messages
from django.contrib.messages import utils
from django.utils.translation import ugettext_lazy as _
from django.utils... | [
[
1,
0,
0.0116,
0.0116,
0,
0.66,
0,
494,
0,
1,
0,
0,
494,
0,
0
],
[
1,
0,
0.0233,
0.0116,
0,
0.66,
0.1111,
689,
0,
1,
0,
0,
689,
0,
0
],
[
1,
0,
0.0349,
0.0116,
0,
... | [
"import persistent_messages",
"from persistent_messages.constants import PERSISTENT_MESSAGE_LEVELS",
"from django.db import models",
"from django.contrib.auth.models import User",
"from django.contrib import messages",
"from django.contrib.messages import utils",
"from django.utils.translation import ug... |
from persistent_messages.models import Message
from persistent_messages.constants import PERSISTENT_MESSAGE_LEVELS
from django.contrib import messages
from django.contrib.messages.storage.base import BaseStorage
from django.contrib.auth.models import AnonymousUser
from django.contrib.messages.storage.fallback import F... | [
[
1,
0,
0.007,
0.007,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.014,
0.007,
0,
0.66,
0.0909,
689,
0,
1,
0,
0,
689,
0,
0
],
[
1,
0,
0.021,
0.007,
0,
0.66,
... | [
"from persistent_messages.models import Message",
"from persistent_messages.constants import PERSISTENT_MESSAGE_LEVELS",
"from django.contrib import messages",
"from django.contrib.messages.storage.base import BaseStorage",
"from django.contrib.auth.models import AnonymousUser",
"from django.contrib.messa... |
"""
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):
"""
... | [
[
8,
0,
0.1522,
0.2609,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.3478,
0.0435,
0,
0.66,
0.3333,
944,
0,
1,
0,
0,
944,
0,
0
],
[
3,
0,
0.5435,
0.2609,
0,
0.66... | [
"\"\"\"\nThis file demonstrates two different styles of tests (one doctest and one\nunittest). These will both pass when you run \"manage.py test\".\n\nReplace these with more appropriate tests for your application.\n\"\"\"",
"from django.test import TestCase",
"class SimpleTest(TestCase):\n def test_basic_a... |
from django.conf.urls.defaults import *
urlpatterns = patterns('',
url(r'^detail/(?P<message_id>\d+)/$', 'persistent_messages.views.message_detail', name='message_detail'),
url(r'^mark_read/(?P<message_id>\d+)/$', 'persistent_messages.views.message_mark_read', name='message_mark_read'),
url(r'^mark_closed/... | [
[
1,
0,
0.125,
0.125,
0,
0.66,
0,
341,
0,
1,
0,
0,
341,
0,
0
],
[
14,
0,
0.6875,
0.75,
0,
0.66,
1,
990,
3,
5,
0,
0,
75,
10,
5
]
] | [
"from django.conf.urls.defaults import *",
"urlpatterns = patterns('',\n url(r'^detail/(?P<message_id>\\d+)/$', 'persistent_messages.views.message_detail', name='message_detail'),\n url(r'^mark_read/(?P<message_id>\\d+)/$', 'persistent_messages.views.message_mark_read', name='message_mark_read'),\n url(r... |
from django.core.mail import send_mail
def email(level, message, extra_tags, subject, user, from_user):
if not user or not user.email:
raise Exception('Function needs to be passed a `User` object with valid email address.')
send_mail(subject, message, from_user.email if from_user else None, [user.email... | [
[
1,
0,
0.1667,
0.1667,
0,
0.66,
0,
537,
0,
1,
0,
0,
537,
0,
0
],
[
2,
0,
0.75,
0.6667,
0,
0.66,
1,
413,
0,
6,
0,
0,
0,
0,
2
],
[
4,
1,
0.75,
0.3333,
1,
0.36,
0... | [
"from django.core.mail import send_mail",
"def email(level, message, extra_tags, subject, user, from_user):\n if not user or not user.email:\n raise Exception('Function needs to be passed a `User` object with valid email address.')\n send_mail(subject, message, from_user.email if from_user else None,... |
DEBUG = 110
INFO = 120
SUCCESS = 125
WARNING = 130
ERROR = 140
DEFAULT_TAGS = {
INFO: 'info',
SUCCESS: 'success',
WARNING: 'warning',
ERROR: 'error',
}
PERSISTENT_MESSAGE_LEVELS = (INFO, SUCCESS, WARNING, ERROR)
| [
[
14,
0,
0.0714,
0.0714,
0,
0.66,
0,
309,
1,
0,
0,
0,
0,
1,
0
],
[
14,
0,
0.1429,
0.0714,
0,
0.66,
0.1667,
948,
1,
0,
0,
0,
0,
1,
0
],
[
14,
0,
0.2143,
0.0714,
0,
0... | [
"DEBUG = 110",
"INFO = 120",
"SUCCESS = 125",
"WARNING = 130",
"ERROR = 140",
"DEFAULT_TAGS = {\n INFO: 'info',\n SUCCESS: 'success',\n WARNING: 'warning',\n ERROR: 'error',\n}",
"PERSISTENT_MESSAGE_LEVELS = (INFO, SUCCESS, WARNING, ERROR)"
] |
from persistent_messages.api import *
from persistent_messages.constants import *
from django.contrib import messages
messages.DEFAULT_TAGS.update(DEFAULT_TAGS)
| [
[
1,
0,
0.2,
0.2,
0,
0.66,
0,
857,
0,
1,
0,
0,
857,
0,
0
],
[
1,
0,
0.4,
0.2,
0,
0.66,
0.3333,
689,
0,
1,
0,
0,
689,
0,
0
],
[
1,
0,
0.6,
0.2,
0,
0.66,
0.6667,
... | [
"from persistent_messages.api import *",
"from persistent_messages.constants import *",
"from django.contrib import messages",
"messages.DEFAULT_TAGS.update(DEFAULT_TAGS)"
] |
from persistent_messages.models import Message
from persistent_messages.storage import get_user
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404, render_to_response
from django.template import RequestContext
from django.core.exceptions import PermissionDenied
from mitems.ajax ... | [
[
1,
0,
0.0192,
0.0192,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.0385,
0.0192,
0,
0.66,
0.1,
209,
0,
1,
0,
0,
209,
0,
0
],
[
1,
0,
0.0577,
0.0192,
0,
0.6... | [
"from persistent_messages.models import Message",
"from persistent_messages.storage import get_user",
"from django.http import HttpResponseRedirect",
"from django.shortcuts import get_object_or_404, render_to_response",
"from django.template import RequestContext",
"from django.core.exceptions import Perm... |
from persistent_messages import notify
from persistent_messages import constants
def add_message(request, level, message, extra_tags='', fail_silently=False, subject='', user=None, email=False, from_user=None, expires=None, close_timeout=None):
"""
"""
if email:
notify.email(level, message, extra_... | [
[
1,
0,
0.037,
0.037,
0,
0.66,
0,
494,
0,
1,
0,
0,
494,
0,
0
],
[
1,
0,
0.0741,
0.037,
0,
0.66,
0.2,
494,
0,
1,
0,
0,
494,
0,
0
],
[
2,
0,
0.2407,
0.2222,
0,
0.66,
... | [
"from persistent_messages import notify",
"from persistent_messages import constants",
"def add_message(request, level, message, extra_tags='', fail_silently=False, subject='', user=None, email=False, from_user=None, expires=None, close_timeout=None):\n \"\"\"\n \"\"\"\n if email:\n notify.email... |
from persistent_messages.models import Message
from django.contrib import admin
class MessageAdmin(admin.ModelAdmin):
list_display = ('level', 'user', 'from_user', 'subject', 'message', 'created', 'read',
'closed', 'is_persistent')
admin.site.register(Message, MessageAdmin)
| [
[
1,
0,
0.125,
0.125,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.25,
0.125,
0,
0.66,
0.3333,
302,
0,
1,
0,
0,
302,
0,
0
],
[
3,
0,
0.625,
0.375,
0,
0.66,
... | [
"from persistent_messages.models import Message",
"from django.contrib import admin",
"class MessageAdmin(admin.ModelAdmin):\n list_display = ('level', 'user', 'from_user', 'subject', 'message', 'created', 'read',\n 'closed', 'is_persistent')",
" list_display = ('level', 'user', 'from... |
"""Social auth models"""
import warnings
from datetime import timedelta
from django.db import models
from django.conf import settings
from social_auth.fields import JSONField
# If User class is overridden, it *must* provide the following fields,
# or it won't be playing nicely with django.contrib.auth module:
#
# ... | [
[
8,
0,
0.0114,
0.0114,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0227,
0.0114,
0,
0.66,
0.0909,
358,
0,
1,
0,
0,
358,
0,
0
],
[
1,
0,
0.0341,
0.0114,
0,
0.66... | [
"\"\"\"Social auth models\"\"\"",
"import warnings",
"from datetime import timedelta",
"from django.db import models",
"from django.conf import settings",
"from social_auth.fields import JSONField",
"RECOMMENDED_FIELDS = ('username', 'last_login', 'is_active')",
"RECOMMENDED_METHODS = ('is_authenticat... |
import urlparse
def sanitize_redirect(host, redirect_to):
"""
Given the hostname and an untrusted URL to redirect to,
this method tests it to make sure it isn't garbage/harmful
and returns it, else returns None.
See http://code.djangoproject.com/browser/django/trunk/django/contrib/auth/views.py#L... | [
[
1,
0,
0.0233,
0.0233,
0,
0.66,
0,
857,
0,
1,
0,
0,
857,
0,
0
],
[
2,
0,
0.4884,
0.814,
0,
0.66,
0.5,
66,
0,
2,
1,
0,
0,
0,
1
],
[
8,
1,
0.3372,
0.4651,
1,
0.59,
... | [
"import urlparse",
"def sanitize_redirect(host, redirect_to):\n \"\"\"\n Given the hostname and an untrusted URL to redirect to,\n this method tests it to make sure it isn't garbage/harmful\n and returns it, else returns None.\n\n See http://code.djangoproject.com/browser/django/trunk/django/contri... |
"""URLs module"""
from django.conf.urls.defaults import patterns, url
from social_auth.views import auth, complete, associate, associate_complete, \
disconnect
urlpatterns = patterns('',
url(r'^login/(?P<backend>[^/]+)/$', auth, name='begin'),
url(r'^complete/(?P<backend>[^/]+)/... | [
[
8,
0,
0.0667,
0.0667,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1333,
0.0667,
0,
0.66,
0.3333,
341,
0,
2,
0,
0,
341,
0,
0
],
[
1,
0,
0.3,
0.1333,
0,
0.66,
... | [
"\"\"\"URLs module\"\"\"",
"from django.conf.urls.defaults import patterns, url",
"from social_auth.views import auth, complete, associate, associate_complete, \\\n disconnect",
"urlpatterns = patterns('',\n url(r'^login/(?P<backend>[^/]+)/$', auth, name='begin'),\n url(r'^c... |
"""
Django-social-auth application, allows OpenId or OAuth user
registration/authentication just adding a few configurations.
"""
version = (0, 3, 9)
__version__ = '.'.join(map(str, version))
| [
[
8,
0,
0.4167,
0.6667,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.8333,
0.1667,
0,
0.66,
0.5,
623,
0,
0,
0,
0,
0,
8,
0
],
[
14,
0,
1,
0.1667,
0,
0.66,
1,... | [
"\"\"\"\nDjango-social-auth application, allows OpenId or OAuth user\nregistration/authentication just adding a few configurations.\n\"\"\"",
"version = (0, 3, 9)",
"__version__ = '.'.join(map(str, version))"
] |
"""
Facebook OAuth support.
This contribution adds support for Facebook OAuth service. The settings
FACEBOOK_APP_ID and FACEBOOK_API_SECRET must be defined with the values
given by Facebook application registration process.
Extended permissions are supported by defining FACEBOOK_EXTENDED_PERMISSIONS
setting, it must ... | [
[
8,
0,
0.0667,
0.1238,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1333,
0.0095,
0,
0.66,
0.0714,
934,
0,
1,
0,
0,
934,
0,
0
],
[
1,
0,
0.1429,
0.0095,
0,
0.66... | [
"\"\"\"\nFacebook OAuth support.\n\nThis contribution adds support for Facebook OAuth service. The settings\nFACEBOOK_APP_ID and FACEBOOK_API_SECRET must be defined with the values\ngiven by Facebook application registration process.\n\nExtended permissions are supported by defining FACEBOOK_EXTENDED_PERMISSIONS",
... |
"""
Orkut OAuth support.
This contribution adds support for Orkut OAuth service. The scope is
limited to http://orkut.gmodules.com/social/ by default, but can be
extended with ORKUT_EXTRA_SCOPE on project settings. Also name, display
name and emails are the default requested user data, but extra values
can be specifie... | [
[
8,
0,
0.0903,
0.1667,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1806,
0.0139,
0,
0.66,
0.0909,
614,
0,
1,
0,
0,
614,
0,
0
],
[
1,
0,
0.2083,
0.0139,
0,
0.66... | [
"\"\"\"\nOrkut OAuth support.\n\nThis contribution adds support for Orkut OAuth service. The scope is\nlimited to http://orkut.gmodules.com/social/ by default, but can be\nextended with ORKUT_EXTRA_SCOPE on project settings. Also name, display\nname and emails are the default requested user data, but extra values\n... |
"""
Linkedin OAuth support
No extra configurations are needed to make this work.
"""
import urlparse
from xml.etree import ElementTree
from social_auth.backends import ConsumerBasedOAuth, OAuthBackend
LINKEDIN_SERVER = 'linkedin.com'
LINKEDIN_REQUEST_TOKEN_URL = 'https://api.%s/uas/oauth/requestToken' % \
... | [
[
8,
0,
0.0375,
0.0625,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.075,
0.0125,
0,
0.66,
0.0833,
857,
0,
1,
0,
0,
857,
0,
0
],
[
1,
0,
0.0875,
0.0125,
0,
0.66,... | [
"\"\"\"\nLinkedin OAuth support\n\nNo extra configurations are needed to make this work.\n\"\"\"",
"import urlparse",
"from xml.etree import ElementTree",
"from social_auth.backends import ConsumerBasedOAuth, OAuthBackend",
"LINKEDIN_SERVER = 'linkedin.com'",
"LINKEDIN_REQUEST_TOKEN_URL = 'https://api.%s/... |
"""Contrib auth modules"""
| [
[
8,
0,
1,
1,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
]
] | [
"\"\"\"Contrib auth modules\"\"\""
] |
"""
Twitter OAuth support.
This adds support for Twitter OAuth service. An application must
be registered first on twitter and the settings TWITTER_CONSUMER_KEY
and TWITTER_CONSUMER_SECRET must be defined with they corresponding
values.
User screen name is used to generate username.
By default account id is stored i... | [
[
8,
0,
0.1061,
0.197,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2121,
0.0152,
0,
0.66,
0.1,
944,
0,
1,
0,
0,
944,
0,
0
],
[
1,
0,
0.2424,
0.0152,
0,
0.66,
... | [
"\"\"\"\nTwitter OAuth support.\n\nThis adds support for Twitter OAuth service. An application must\nbe registered first on twitter and the settings TWITTER_CONSUMER_KEY\nand TWITTER_CONSUMER_SECRET must be defined with they corresponding\nvalues.",
"from django.utils import simplejson",
"from social_auth.backe... |
"""
Yahoo OpenID support
No extra configurations are needed to make this work.
"""
from social_auth.backends import OpenIDBackend, OpenIdAuth
YAHOO_OPENID_URL = 'http://yahoo.com'
class YahooBackend(OpenIDBackend):
"""Yahoo OpenID authentication backend"""
name = 'yahoo'
class YahooAuth(OpenIdAuth):
... | [
[
8,
0,
0.1034,
0.1724,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2069,
0.0345,
0,
0.66,
0.2,
230,
0,
2,
0,
0,
230,
0,
0
],
[
14,
0,
0.3103,
0.0345,
0,
0.66,
... | [
"\"\"\"\nYahoo OpenID support\n\nNo extra configurations are needed to make this work.\n\"\"\"",
"from social_auth.backends import OpenIDBackend, OpenIdAuth",
"YAHOO_OPENID_URL = 'http://yahoo.com'",
"class YahooBackend(OpenIDBackend):\n \"\"\"Yahoo OpenID authentication backend\"\"\"\n name = 'yahoo'",... |
"""OpenId storage that saves to django models"""
import time
import base64
from openid.association import Association as OIDAssociation
from openid.store.interface import OpenIDStore
from openid.store.nonce import SKEW
from social_auth.models import Association, Nonce
class DjangoOpenIDStore(OpenIDStore):
"""St... | [
[
8,
0,
0.0159,
0.0159,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0317,
0.0159,
0,
0.66,
0.1429,
654,
0,
1,
0,
0,
654,
0,
0
],
[
1,
0,
0.0476,
0.0159,
0,
0.66... | [
"\"\"\"OpenId storage that saves to django models\"\"\"",
"import time",
"import base64",
"from openid.association import Association as OIDAssociation",
"from openid.store.interface import OpenIDStore",
"from openid.store.nonce import SKEW",
"from social_auth.models import Association, Nonce",
"class... |
"""Admin settings"""
from django.contrib import admin
from social_auth.models import UserSocialAuth, Nonce, Association
class UserSocialAuthOption(admin.ModelAdmin):
"""Social Auth user options"""
list_display = ('id', 'user', 'provider', 'uid')
search_fields = ('user__name',)
list_filter = ('provide... | [
[
8,
0,
0.0323,
0.0323,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0645,
0.0323,
0,
0.66,
0.125,
302,
0,
1,
0,
0,
302,
0,
0
],
[
1,
0,
0.129,
0.0323,
0,
0.66,
... | [
"\"\"\"Admin settings\"\"\"",
"from django.contrib import admin",
"from social_auth.models import UserSocialAuth, Nonce, Association",
"class UserSocialAuthOption(admin.ModelAdmin):\n \"\"\"Social Auth user options\"\"\"\n list_display = ('id', 'user', 'provider', 'uid')\n search_fields = ('user__nam... |
"""Signals"""
from django.dispatch import Signal
# Pre save signal
# This signal is sent when user instance is about to be updated with
# new values from services provided. This way custom actions can be
# attached and values updated if needed before the saving time.
#
# Handlers must return True if any value ... | [
[
8,
0,
0.05,
0.05,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1,
0.05,
0,
0.66,
0.3333,
548,
0,
1,
0,
0,
548,
0,
0
],
[
14,
0,
0.9,
0.05,
0,
0.66,
0.6667,... | [
"\"\"\"Signals\"\"\"",
"from django.dispatch import Signal",
"pre_update = Signal(providing_args=['user', 'response', 'details'])",
"socialauth_registered = Signal(providing_args=['user', 'response', 'details'])"
] |
"""Update items"""
import os, sys, site
python_version = 'python%s.%s' % sys.version_info[:2]
site_path = os.path.abspath(
os.path.normpath(
os.path.join(os.path.dirname(__file__),
'../lib', python_version, 'site-packages')))
site.addsitedir(site_path)
sys.path.append(os.path.abspath... | [
[
8,
0,
0.0476,
0.0476,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1429,
0.0476,
0,
0.66,
0.1111,
688,
0,
3,
0,
0,
688,
0,
0
],
[
14,
0,
0.2381,
0.0476,
0,
0.6... | [
"\"\"\"Update items\"\"\"",
"import os, sys, site",
"python_version = 'python%s.%s' % sys.version_info[:2]",
"site_path = os.path.abspath(\n os.path.normpath(\n os.path.join(os.path.dirname(__file__),\n '../lib', python_version, 'site-packages')))",
"site.addsitedir(site_path)"... |
from django.conf.urls.defaults import *
from mitems import views as mitems_views
from mitems import ajax as ajax_views
from django.conf import settings
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.conf.urls.static import static
from django.views.generic.simple import direct_to_templat... | [
[
1,
0,
0.007,
0.007,
0,
0.66,
0,
341,
0,
1,
0,
0,
341,
0,
0
],
[
1,
0,
0.0141,
0.007,
0,
0.66,
0.0909,
658,
0,
1,
0,
0,
658,
0,
0
],
[
1,
0,
0.0211,
0.007,
0,
0.66... | [
"from django.conf.urls.defaults import *",
"from mitems import views as mitems_views",
"from mitems import ajax as ajax_views",
"from django.conf import settings",
"from django.contrib.staticfiles.urls import staticfiles_urlpatterns",
"from django.conf.urls.static import static",
"from django.views.gene... |
"""Update items"""
import os, sys, site
python_version = 'python%s.%s' % sys.version_info[:2]
site_path = os.path.abspath(
os.path.normpath(
os.path.join(os.path.dirname(__file__),
'../lib', python_version, 'site-packages')))
site.addsitedir(site_path)
sys.path.append(os.path.abspath... | [
[
8,
0,
0.0476,
0.0476,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1429,
0.0476,
0,
0.66,
0.1111,
688,
0,
3,
0,
0,
688,
0,
0
],
[
14,
0,
0.2381,
0.0476,
0,
0.6... | [
"\"\"\"Update items\"\"\"",
"import os, sys, site",
"python_version = 'python%s.%s' % sys.version_info[:2]",
"site_path = os.path.abspath(\n os.path.normpath(\n os.path.join(os.path.dirname(__file__),\n '../lib', python_version, 'site-packages')))",
"site.addsitedir(site_path)"... |
from django.db.models.signals import class_prepared
def longer_email_username(sender, *args, **kwargs):
# You can't just do `if sender == django.contrib.auth.models.User`
# because you would have to import the model
# You have to test using __name__ and __module__
if (sender.__name__ in ("User", "UserP... | [
[
1,
0,
0.0833,
0.0833,
0,
0.66,
0,
280,
0,
1,
0,
0,
280,
0,
0
],
[
2,
0,
0.5417,
0.6667,
0,
0.66,
0.5,
363,
0,
3,
0,
0,
0,
0,
2
],
[
4,
1,
0.7083,
0.3333,
1,
0.62,... | [
"from django.db.models.signals import class_prepared",
"def longer_email_username(sender, *args, **kwargs):\n # You can't just do `if sender == django.contrib.auth.models.User`\n # because you would have to import the model\n # You have to test using __name__ and __module__\n if (sender.__name__ in (\... |
# coding=utf-8
from shorturls.baseconv import base62
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
from django.core.cache import cache
from django_autoslug.fields import AutoSlugField
from django.template.defaultfilters import slugify
fro... | [
[
1,
0,
0.0031,
0.001,
0,
0.66,
0,
64,
0,
1,
0,
0,
64,
0,
0
],
[
1,
0,
0.0042,
0.001,
0,
0.66,
0.0108,
808,
0,
1,
0,
0,
808,
0,
0
],
[
1,
0,
0.0052,
0.001,
0,
0.66,... | [
"from shorturls.baseconv import base62",
"from django.contrib.auth.models import User",
"from django.core.exceptions import ObjectDoesNotExist",
"from django.db import models",
"from django.core.cache import cache",
"from django_autoslug.fields import AutoSlugField",
"from django.template.defaultfilters... |
import os
from random import Random
import uuid
from django.http import HttpResponse
from django.utils import simplejson
from django.conf import settings
import twitter
import urllib2, urllib
import string
import gdata.oauth
import gdata.contacts.data
import gdata.contacts.client
from PIL import Image
import logging
tr... | [
[
1,
0,
0.0047,
0.0047,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0095,
0.0047,
0,
0.66,
0.0256,
715,
0,
1,
0,
0,
715,
0,
0
],
[
1,
0,
0.0142,
0.0047,
0,
... | [
"import os",
"from random import Random",
"import uuid",
"from django.http import HttpResponse",
"from django.utils import simplejson",
"from django.conf import settings",
"import twitter",
"import urllib2, urllib",
"import string",
"import gdata.oauth",
"import gdata.contacts.data",
"import g... |
import gdata.gauth
import gdata.contacts.client
from django.http import HttpResponseRedirect
CONSUMER_KEY = 'take.8minut.es'
CONSUMER_SECRET = 'w1usAxob4zjpZUzsyMTwQio_'
SCOPES = ['https://www.google.com/m8/feeds/']
oauth_callback_url = 'http://8minutes.trezor.by/get_access_token/'
def get_request_token(request):
... | [
[
1,
0,
0.0323,
0.0323,
0,
0.66,
0,
927,
0,
1,
0,
0,
927,
0,
0
],
[
1,
0,
0.0645,
0.0323,
0,
0.66,
0.125,
728,
0,
1,
0,
0,
728,
0,
0
],
[
1,
0,
0.0968,
0.0323,
0,
0... | [
"import gdata.gauth",
"import gdata.contacts.client",
"from django.http import HttpResponseRedirect",
"CONSUMER_KEY = 'take.8minut.es'",
"CONSUMER_SECRET = 'w1usAxob4zjpZUzsyMTwQio_'",
"SCOPES = ['https://www.google.com/m8/feeds/']",
"oauth_callback_url = 'http://8minutes.trezor.by/get_access_token/'",
... |
# -*- coding: utf8
import mailbox
import lxml.html
from lxml.html.clean import Cleaner
import os
from email.Header import decode_header
from email.utils import parseaddr
from django.conf import settings
from django.utils.encoding import force_unicode
from mitems.models import Item_category, Item, UserProfile, ItemIma... | [
[
1,
0,
0.0152,
0.0051,
0,
0.66,
0,
714,
0,
1,
0,
0,
714,
0,
0
],
[
1,
0,
0.0203,
0.0051,
0,
0.66,
0.0435,
151,
0,
1,
0,
0,
151,
0,
0
],
[
1,
0,
0.0254,
0.0051,
0,
... | [
"import mailbox",
"import lxml.html",
"from lxml.html.clean import Cleaner",
"import os",
"from email.Header import decode_header",
"from email.utils import parseaddr",
"from django.conf import settings",
"from django.utils.encoding import force_unicode",
"from mitems.models import Item_category, It... |
# coding=utf-8
"""Tweet items"""
from datetime import timedelta, datetime
from mitems.tools.utils import post_to_twitter, TWITTER_MAX_LENGTH, TwitterError
from django.conf import settings
from mitems.tools.logs import Log
from mitems.models import Item
log = Log(settings.TWITTER_LOG_FILE, settings.TWITTER_LOG_LOGGER,... | [
[
8,
0,
0.0476,
0.0238,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0952,
0.0238,
0,
0.66,
0.1,
426,
0,
2,
0,
0,
426,
0,
0
],
[
1,
0,
0.119,
0.0238,
0,
0.66,
... | [
"\"\"\"Tweet items\"\"\"",
"from datetime import timedelta, datetime",
"from mitems.tools.utils import post_to_twitter, TWITTER_MAX_LENGTH, TwitterError",
"from django.conf import settings",
"from mitems.tools.logs import Log",
"from mitems.models import Item",
"log = Log(settings.TWITTER_LOG_FILE, sett... |
# coding=utf-8
from datetime import datetime, timedelta
from django.conf import settings
from django.db.models import Q
from django.utils.safestring import mark_safe
from django.core.mail import send_mail
from django.template import Context, Template
from urllib import basejoin
import persistent_messages
from persisten... | [
[
1,
0,
0.0056,
0.0028,
0,
0.66,
0,
426,
0,
2,
0,
0,
426,
0,
0
],
[
1,
0,
0.0084,
0.0028,
0,
0.66,
0.02,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0112,
0.0028,
0,
0.... | [
"from datetime import datetime, timedelta",
"from django.conf import settings",
"from django.db.models import Q",
"from django.utils.safestring import mark_safe",
"from django.core.mail import send_mail",
"from django.template import Context, Template",
"from urllib import basejoin",
"import persisten... |
# -*- coding: utf8
import sys, logging, logging.handlers
class Log(object):
"""Logger class"""
def __init__(self, log_file, logger_name, maxb, count, debug):
try:
fmt = '%(asctime)s: %(name)s: %(levelname)s: %(message)s'
datefmt = '%a, %d %b %Y %H:%M:%S'
self.lo... | [
[
1,
0,
0.0811,
0.027,
0,
0.66,
0,
509,
0,
3,
0,
0,
509,
0,
0
],
[
3,
0,
0.5676,
0.8919,
0,
0.66,
1,
281,
0,
3,
0,
0,
186,
0,
13
],
[
8,
1,
0.1622,
0.027,
1,
0.06,
... | [
"import sys, logging, logging.handlers",
"class Log(object):\n \"\"\"Logger class\"\"\"\n \n def __init__(self, log_file, logger_name, maxb, count, debug):\n try:\n fmt = '%(asctime)s: %(name)s: %(levelname)s: %(message)s'\n datefmt = '%a, %d %b %Y %H:%M:%S'\n self.... |
# coding=utf-8
"""Parse reuters feed and save in database with random user as owner"""
from datetime import timedelta, datetime
import feedparser
import urllib
from django.conf import settings
from django.db.models.fields import BooleanField
import lxml.html
from lxml.html.clean import clean_html
import os
from geopy ... | [
[
8,
0,
0.0104,
0.0052,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0207,
0.0052,
0,
0.66,
0.0312,
426,
0,
2,
0,
0,
426,
0,
0
],
[
1,
0,
0.0259,
0.0052,
0,
0.66... | [
"\"\"\"Parse reuters feed and save in database with random user as owner\"\"\"",
"from datetime import timedelta, datetime",
"import feedparser",
"import urllib",
"from django.conf import settings",
"from django.db.models.fields import BooleanField",
"import lxml.html",
"from lxml.html.clean import cl... |
from datetime import datetime, timedelta
import smtplib
from django.db.utils import IntegrityError
from django.http import HttpResponse
from django.conf import settings
from django.template.loader import render_to_string
from django.template import RequestContext
from django.utils import simplejson
from django.db impor... | [
[
1,
0,
0.0012,
0.0012,
0,
0.66,
0,
426,
0,
2,
0,
0,
426,
0,
0
],
[
1,
0,
0.0023,
0.0012,
0,
0.66,
0.0213,
389,
0,
1,
0,
0,
389,
0,
0
],
[
1,
0,
0.0035,
0.0012,
0,
... | [
"from datetime import datetime, timedelta",
"import smtplib",
"from django.db.utils import IntegrityError",
"from django.http import HttpResponse",
"from django.conf import settings",
"from django.template.loader import render_to_string",
"from django.template import RequestContext",
"from django.util... |
from django.conf import settings
from django.db.models.fields.files import ImageFieldFile
from django.forms import ModelForm
from django.forms.widgets import TextInput, Textarea, FileInput, Select
from mitems.models import Item, Comment, Like, CommentLike, Airtime,\
Share, Follower, UserProfile, Notification, Inque... | [
[
1,
0,
0.0044,
0.0044,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.0088,
0.0044,
0,
0.66,
0.0417,
736,
0,
1,
0,
0,
736,
0,
0
],
[
1,
0,
0.0133,
0.0044,
0,
... | [
"from django.conf import settings",
"from django.db.models.fields.files import ImageFieldFile",
"from django.forms import ModelForm",
"from django.forms.widgets import TextInput, Textarea, FileInput, Select",
"from mitems.models import Item, Comment, Like, CommentLike, Airtime,\\\n Share, Follower, UserP... |
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
Tests that 1 + 1 a... | [
[
8,
0,
0.2188,
0.375,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.5,
0.0625,
0,
0.66,
0.5,
944,
0,
1,
0,
0,
944,
0,
0
],
[
3,
0,
0.8438,
0.375,
0,
0.66,
1,... | [
"\"\"\"\nThis file demonstrates writing tests using the unittest module. These will pass\nwhen you run \"manage.py test\".\n\nReplace this with more appropriate tests for your application.\n\"\"\"",
"from django.test import TestCase",
"class SimpleTest(TestCase):\n def test_basic_addition(self):\n \"\... |
from django import template
register = template.Library()
@register.filter_function
def order_by(queryset, args):
args = [x.strip() for x in args.split(',')]
return queryset.order_by(*args)
@register.filter_function
def reverse(queryset):
return queryset.reverse()
@register.filter_function
def call(obj... | [
[
1,
0,
0.0333,
0.0333,
0,
0.66,
0,
294,
0,
1,
0,
0,
294,
0,
0
],
[
14,
0,
0.1,
0.0333,
0,
0.66,
0.2,
276,
3,
0,
0,
0,
77,
10,
1
],
[
2,
0,
0.2333,
0.1,
0,
0.66,
... | [
"from django import template",
"register = template.Library()",
"def order_by(queryset, args):\n args = [x.strip() for x in args.split(',')]\n return queryset.order_by(*args)",
" args = [x.strip() for x in args.split(',')]",
" return queryset.order_by(*args)",
"def reverse(queryset):\n retu... |
from django.conf import settings
from django.template.loader import render_to_string
def analytics(request):
""" Returns analytics code. """
if getattr(settings, 'GOOGLE_ANALYTICS_KEY', None):
return dict(
analytics_code=render_to_string("google_analytics.html",
... | [
[
1,
0,
0.0714,
0.0714,
0,
0.66,
0,
128,
0,
1,
0,
0,
128,
0,
0
],
[
1,
0,
0.1429,
0.0714,
0,
0.66,
0.5,
970,
0,
1,
0,
0,
970,
0,
0
],
[
2,
0,
0.6429,
0.7857,
0,
0.6... | [
"from django.conf import settings",
"from django.template.loader import render_to_string",
"def analytics(request):\n \"\"\" Returns analytics code. \"\"\"\n if getattr(settings, 'GOOGLE_ANALYTICS_KEY', None):\n return dict(\n analytics_code=render_to_string(\"google_analytics.html\",\n ... |
from datetime import datetime, timedelta, date
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
from django.http import Http404, HttpResponseRedirect
from django.conf import settings
from mitems.models import Item, ItemImage, UserProfile, Notification
from mitems.forms impo... | [
[
1,
0,
0.0025,
0.0025,
0,
0.66,
0,
426,
0,
3,
0,
0,
426,
0,
0
],
[
1,
0,
0.005,
0.0025,
0,
0.66,
0.027,
885,
0,
1,
0,
0,
885,
0,
0
],
[
1,
0,
0.0075,
0.0025,
0,
0.... | [
"from datetime import datetime, timedelta, date",
"from django.contrib.auth.decorators import login_required",
"from django.shortcuts import render",
"from django.http import Http404, HttpResponseRedirect",
"from django.conf import settings",
"from mitems.models import Item, ItemImage, UserProfile, Notif... |
from facegraph.django.middleware import FacebookGraphMiddleware
from django.utils import simplejson as json
from django.contrib import messages
from django.core.urlresolvers import reverse
class GraphMiddleware(FacebookGraphMiddleware):
def access_token(self, request):
try:
return request.user... | [
[
1,
0,
0.0238,
0.0238,
0,
0.66,
0,
137,
0,
1,
0,
0,
137,
0,
0
],
[
1,
0,
0.0476,
0.0238,
0,
0.66,
0.2,
944,
0,
1,
0,
0,
944,
0,
0
],
[
1,
0,
0.0714,
0.0238,
0,
0.6... | [
"from facegraph.django.middleware import FacebookGraphMiddleware",
"from django.utils import simplejson as json",
"from django.contrib import messages",
"from django.core.urlresolvers import reverse",
"class GraphMiddleware(FacebookGraphMiddleware):\n def access_token(self, request):\n try:\n ... |
from django.contrib import admin
from django.contrib.sites.models import Site
from mitems.models import UserProfile, Item, Item_category,\
Item_group, Item_type, Comment, Like, Share, Follower,\
ItemImage, Airtime, Inquestion, Notification
from persistent_messages.models import Message
from django.contrib.auth.models i... | [
[
1,
0,
0.0075,
0.0075,
0,
0.66,
0,
302,
0,
1,
0,
0,
302,
0,
0
],
[
1,
0,
0.015,
0.0075,
0,
0.66,
0.0345,
890,
0,
1,
0,
0,
890,
0,
0
],
[
1,
0,
0.0301,
0.0226,
0,
0... | [
"from django.contrib import admin",
"from django.contrib.sites.models import Site",
"from mitems.models import UserProfile, Item, Item_category,\\\nItem_group, Item_type, Comment, Like, Share, Follower,\\\nItemImage, Airtime, Inquestion, Notification",
"from persistent_messages.models import Message",
"from... |
import re
import datetime
from django.template.defaultfilters import slugify
from django.db.models import SlugField, SubfieldBase
from south.modelsinspector import add_introspection_rules
class AutoSlugField(SlugField):
""" AutoSlugField
By default, sets editable=False, blank=True.
Required arguments:
... | [
[
1,
0,
0.0056,
0.0056,
0,
0.66,
0,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0112,
0.0056,
0,
0.66,
0.1667,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0169,
0.0056,
0,
... | [
"import re",
"import datetime",
"from django.template.defaultfilters import slugify",
"from django.db.models import SlugField, SubfieldBase",
"from south.modelsinspector import add_introspection_rules",
"class AutoSlugField(SlugField):\n \"\"\" AutoSlugField\n\n By default, sets editable=False, blan... |
"""Update items"""
import os, sys, site
python_version = 'python%s.%s' % sys.version_info[:2]
site_path = os.path.abspath(
os.path.normpath(
os.path.join(os.path.dirname(__file__),
'../lib', python_version, 'site-packages')))
site.addsitedir(site_path)
sys.path.append(os.path.abspath... | [
[
8,
0,
0.0476,
0.0476,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1429,
0.0476,
0,
0.66,
0.1111,
688,
0,
3,
0,
0,
688,
0,
0
],
[
14,
0,
0.2381,
0.0476,
0,
0.6... | [
"\"\"\"Update items\"\"\"",
"import os, sys, site",
"python_version = 'python%s.%s' % sys.version_info[:2]",
"site_path = os.path.abspath(\n os.path.normpath(\n os.path.join(os.path.dirname(__file__),\n '../lib', python_version, 'site-packages')))",
"site.addsitedir(site_path)"... |
"""Update items"""
import os, sys, site
python_version = 'python%s.%s' % sys.version_info[:2]
site_path = os.path.abspath(
os.path.normpath(
os.path.join(os.path.dirname(__file__),
'../lib', python_version, 'site-packages')))
site.addsitedir(site_path)
sys.path.append(os.path.abspath... | [
[
8,
0,
0.0455,
0.0455,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1364,
0.0455,
0,
0.66,
0.1111,
688,
0,
3,
0,
0,
688,
0,
0
],
[
14,
0,
0.2273,
0.0455,
0,
0.6... | [
"\"\"\"Update items\"\"\"",
"import os, sys, site",
"python_version = 'python%s.%s' % sys.version_info[:2]",
"site_path = os.path.abspath(\n os.path.normpath(\n os.path.join(os.path.dirname(__file__),\n '../lib', python_version, 'site-packages')))",
"site.addsitedir(site_path)"... |
"""Update items"""
import os, sys, site
python_version = 'python%s.%s' % sys.version_info[:2]
site_path = os.path.abspath(
os.path.normpath(
os.path.join(os.path.dirname(__file__),
'../lib', python_version, 'site-packages')))
site.addsitedir(site_path)
sys.path.append(os.path.abspath... | [
[
8,
0,
0.0476,
0.0476,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1429,
0.0476,
0,
0.66,
0.1111,
688,
0,
3,
0,
0,
688,
0,
0
],
[
14,
0,
0.2381,
0.0476,
0,
0.6... | [
"\"\"\"Update items\"\"\"",
"import os, sys, site",
"python_version = 'python%s.%s' % sys.version_info[:2]",
"site_path = os.path.abspath(\n os.path.normpath(\n os.path.join(os.path.dirname(__file__),\n '../lib', python_version, 'site-packages')))",
"site.addsitedir(site_path)"... |
import sys, os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../')))
sys.path.append(os.path.abspath(os.path.dirname(__file__)))
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
| [
[
1,
0,
0.1429,
0.1429,
0,
0.66,
0,
509,
0,
2,
0,
0,
509,
0,
0
],
[
8,
0,
0.4286,
0.1429,
0,
0.66,
0.2,
243,
3,
1,
0,
0,
0,
0,
4
],
[
8,
0,
0.5714,
0.1429,
0,
0.66,... | [
"import sys, os",
"sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../')))",
"sys.path.append(os.path.abspath(os.path.dirname(__file__)))",
"os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'",
"import django.core.handlers.wsgi",
"application = django.core.handlers.wsgi.WSGIHandler... |
"""Update items"""
import os, sys, site
python_version = 'python%s.%s' % sys.version_info[:2]
site_path = os.path.abspath(
os.path.normpath(
os.path.join(os.path.dirname(__file__),
'../lib', python_version, 'site-packages')))
site.addsitedir(site_path)
sys.path.append(os.path.abspath... | [
[
8,
0,
0.0476,
0.0476,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1429,
0.0476,
0,
0.66,
0.1111,
688,
0,
3,
0,
0,
688,
0,
0
],
[
14,
0,
0.2381,
0.0476,
0,
0.6... | [
"\"\"\"Update items\"\"\"",
"import os, sys, site",
"python_version = 'python%s.%s' % sys.version_info[:2]",
"site_path = os.path.abspath(\n os.path.normpath(\n os.path.join(os.path.dirname(__file__),\n '../lib', python_version, 'site-packages')))",
"site.addsitedir(site_path)"... |
#!/usr/bin/env python2
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... | [
[
1,
0,
0.1818,
0.0909,
0,
0.66,
0,
879,
0,
1,
0,
0,
879,
0,
0
],
[
7,
0,
0.5,
0.5455,
0,
0.66,
0.5,
0,
0,
1,
0,
0,
0,
0,
2
],
[
1,
1,
0.3636,
0.0909,
1,
0.37,
... | [
"from django.core.management import execute_manager",
"try:\n import settings # Assumed to be in the same directory.\nexcept ImportError:\n import sys\n 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 dj... |
#!/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... | [
[
1,
0,
0.0588,
0.0118,
0,
0.66,
0,
715,
0,
1,
0,
0,
715,
0,
0
],
[
1,
0,
0.0706,
0.0118,
0,
0.66,
0.125,
614,
0,
1,
0,
0,
614,
0,
0
],
[
1,
0,
0.0824,
0.0118,
0,
0... | [
"import logging",
"import shutil",
"import sys",
"import urlparse",
"import SimpleHTTPServer",
"import BaseHTTPServer",
"class RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):\n \"\"\"Handle playfoursquare.com requests, for testing.\"\"\"\n\n def do_GET(self):\n logging.warn('do_GET: %s, %s',... |
#!/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... | [
[
1,
0,
0.1111,
0.037,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.1481,
0.037,
0,
0.66,
0.1429,
394,
0,
1,
0,
0,
394,
0,
0
],
[
1,
0,
0.1852,
0.037,
0,
0.6... | [
"import os",
"import subprocess",
"import sys",
"BASEDIR = '../main/src/com/joelapenna/foursquare'",
"TYPESDIR = '../captures/types/v1'",
"captures = sys.argv[1:]",
"if not captures:\n captures = os.listdir(TYPESDIR)",
" captures = os.listdir(TYPESDIR)",
"for f in captures:\n basename = f.split('... |
#!/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.... | [
[
8,
0,
0.0631,
0.0991,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1261,
0.009,
0,
0.66,
0.05,
2,
0,
1,
0,
0,
2,
0,
0
],
[
1,
0,
0.1351,
0.009,
0,
0.66,
0.... | [
"\"\"\"\nPull a oAuth protected page from foursquare.\n\nExpects ~/.oget to contain (one on each line):\nCONSUMER_KEY\nCONSUMER_KEY_SECRET\nUSERNAME\nPASSWORD",
"import httplib",
"import os",
"import re",
"import sys",
"import urllib",
"import urllib2",
"import urlparse",
"import user",
"from xml.... |
#!/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... | [
[
1,
0,
0.0201,
0.0067,
0,
0.66,
0,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0268,
0.0067,
0,
0.66,
0.0769,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0336,
0.0067,
0,
... | [
"import datetime",
"import sys",
"import textwrap",
"import common",
"from xml.dom import pulldom",
"PARSER = \"\"\"\\\n/**\n * Copyright 2009 Joe LaPenna\n */\n\npackage com.joelapenna.foursquare.parsers;\n\nimport com.joelapenna.foursquare.Foursquare;",
"BOOLEAN_STANZA = \"\"\"\\\n } else i... |
#!/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... | [
[
1,
0,
0.0263,
0.0088,
0,
0.66,
0,
715,
0,
1,
0,
0,
715,
0,
0
],
[
1,
0,
0.0439,
0.0088,
0,
0.66,
0.0833,
290,
0,
1,
0,
0,
290,
0,
0
],
[
1,
0,
0.0526,
0.0088,
0,
... | [
"import logging",
"from xml.dom import minidom",
"from xml.dom import pulldom",
"BOOLEAN = \"boolean\"",
"STRING = \"String\"",
"GROUP = \"Group\"",
"DEFAULT_INTERFACES = ['FoursquareType']",
"INTERFACES = {\n}",
"DEFAULT_CLASS_IMPORTS = [\n]",
"CLASS_IMPORTS = {\n# 'Checkin': DEFAULT_CLASS_IMP... |
'''
Module which prompts the user for translations and saves them.
TODO: implement
@author: Rodrigo Damazio
'''
class Translator(object):
'''
classdocs
'''
def __init__(self, language):
'''
Constructor
'''
self._language = language
def Translate(self, string_names):
print string_names | [
[
8,
0,
0.1905,
0.3333,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
3,
0,
0.7143,
0.619,
0,
0.66,
1,
229,
0,
2,
0,
0,
186,
0,
1
],
[
8,
1,
0.5238,
0.1429,
1,
0,
0,
... | [
"'''\nModule which prompts the user for translations and saves them.\n\nTODO: implement\n\n@author: Rodrigo Damazio\n'''",
"class Translator(object):\n '''\n classdocs\n '''\n\n def __init__(self, language):\n '''\n Constructor",
" '''\n classdocs\n '''",
" def __init__(self, language):\n '''... |
'''
Module which brings history information about files from Mercurial.
@author: Rodrigo Damazio
'''
import re
import subprocess
REVISION_REGEX = re.compile(r'(?P<hash>[0-9a-f]{12}):.*')
def _GetOutputLines(args):
'''
Runs an external process and returns its output as a list of lines.
@param args: the argume... | [
[
8,
0,
0.0319,
0.0532,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0745,
0.0106,
0,
0.66,
0.1429,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.0851,
0.0106,
0,
0.66... | [
"'''\nModule which brings history information about files from Mercurial.\n\n@author: Rodrigo Damazio\n'''",
"import re",
"import subprocess",
"REVISION_REGEX = re.compile(r'(?P<hash>[0-9a-f]{12}):.*')",
"def _GetOutputLines(args):\n '''\n Runs an external process and returns its output as a list of lines... |
'''
Module which parses a string XML file.
@author: Rodrigo Damazio
'''
from xml.parsers.expat import ParserCreate
import re
#import xml.etree.ElementTree as ET
class StringsParser(object):
'''
Parser for string XML files.
This object is not thread-safe and should be used for parsing a single file at
a time... | [
[
8,
0,
0.0261,
0.0435,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0609,
0.0087,
0,
0.66,
0.3333,
573,
0,
1,
0,
0,
573,
0,
0
],
[
1,
0,
0.0696,
0.0087,
0,
0.66... | [
"'''\nModule which parses a string XML file.\n\n@author: Rodrigo Damazio\n'''",
"from xml.parsers.expat import ParserCreate",
"import re",
"class StringsParser(object):\n '''\n Parser for string XML files.\n\n This object is not thread-safe and should be used for parsing a single file at\n a time, only.\n... |
#!/usr/bin/python
'''
Entry point for My Tracks i18n tool.
@author: Rodrigo Damazio
'''
import mytracks.files
import mytracks.translate
import mytracks.validate
import sys
def Usage():
print 'Usage: %s <command> [<language> ...]\n' % sys.argv[0]
print 'Commands are:'
print ' cleanup'
print ' translate'
p... | [
[
8,
0,
0.0417,
0.0521,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0833,
0.0104,
0,
0.66,
0.125,
640,
0,
1,
0,
0,
640,
0,
0
],
[
1,
0,
0.0938,
0.0104,
0,
0.66,... | [
"'''\nEntry point for My Tracks i18n tool.\n\n@author: Rodrigo Damazio\n'''",
"import mytracks.files",
"import mytracks.translate",
"import mytracks.validate",
"import sys",
"def Usage():\n print('Usage: %s <command> [<language> ...]\\n' % sys.argv[0])\n print('Commands are:')\n print(' cleanup')\n p... |
'''
Module which compares languague files to the master file and detects
issues.
@author: Rodrigo Damazio
'''
import os
from mytracks.parser import StringsParser
import mytracks.history
class Validator(object):
def __init__(self, languages):
'''
Builds a strings file validator.
Params:
@para... | [
[
8,
0,
0.0304,
0.0522,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0696,
0.0087,
0,
0.66,
0.25,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0783,
0.0087,
0,
0.66,
... | [
"'''\nModule which compares languague files to the master file and detects\nissues.\n\n@author: Rodrigo Damazio\n'''",
"import os",
"from mytracks.parser import StringsParser",
"import mytracks.history",
"class Validator(object):\n\n def __init__(self, languages):\n '''\n Builds a strings file valida... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.