code stringlengths 1 1.49M | vector listlengths 0 7.38k | snippet listlengths 0 7.38k |
|---|---|---|
# snippet to change the LookupTables (colourmaps) of the selected objects
# this should be run in the introspection context of a slice3dVWR
# $Id$
import os
import tempfile
import vtk
className = obj.__class__.__name__
if className == 'slice3dVWR':
# find all polydata objects
so = obj._tdObjects._getSelecte... | [
[
1,
0,
0.1351,
0.027,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.1622,
0.027,
0,
0.66,
0.25,
516,
0,
1,
0,
0,
516,
0,
0
],
[
1,
0,
0.1892,
0.027,
0,
0.66,... | [
"import os",
"import tempfile",
"import vtk",
"className = obj.__class__.__name__",
"if className == 'slice3dVWR':\n\n # find all polydata objects\n so = obj._tdObjects._getSelectedObjects()\n polyDatas = [pd for pd in so if hasattr(pd, 'GetClassName') and\n pd.GetClassName() == 'vt... |
# short DeVIDE matplotlib demo.
from pylab import *
# close previous figure if it exists
try:
obj.mpl_close_figure(numpy_test_figure)
except NameError:
pass
# square figure and square axes looks better for polar plots
numpy_test_figure = obj.mpl_new_figure(figsize=(8,8))
ax = axes([0.1, 0.1, 0.8, 0.8], polar... | [
[
1,
0,
0.1071,
0.0357,
0,
0.66,
0,
735,
0,
1,
0,
0,
735,
0,
0
],
[
7,
0,
0.2679,
0.1429,
0,
0.66,
0.0909,
0,
0,
1,
0,
0,
0,
0,
1
],
[
8,
1,
0.25,
0.0357,
1,
0.64,
... | [
"from pylab import *",
"try:\n obj.mpl_close_figure(numpy_test_figure)\nexcept NameError:\n pass",
" obj.mpl_close_figure(numpy_test_figure)",
"numpy_test_figure = obj.mpl_new_figure(figsize=(8,8))",
"ax = axes([0.1, 0.1, 0.8, 0.8], polar=True, axisbg='#d5de9c')",
"rc('grid', color='#316931', lin... |
# snippet that illustrates programmatic setting of Window/Level
# in the slice3dVWR introspection interface
W = 500
L = 1000
sds = obj.sliceDirections._sliceDirectionsDict.values()
for sd in sds:
ipw = sd._ipws[0]
ipw.SetWindowLevel(W, L, 0)
| [
[
14,
0,
0.4,
0.1,
0,
0.66,
0,
94,
1,
0,
0,
0,
0,
1,
0
],
[
14,
0,
0.5,
0.1,
0,
0.66,
0.3333,
714,
1,
0,
0,
0,
0,
1,
0
],
[
14,
0,
0.7,
0.1,
0,
0.66,
0.6667,
... | [
"W = 500",
"L = 1000",
"sds = obj.sliceDirections._sliceDirectionsDict.values()",
"for sd in sds:\n ipw = sd._ipws[0]\n ipw.SetWindowLevel(W, L, 0)",
" ipw = sd._ipws[0]",
" ipw.SetWindowLevel(W, L, 0)"
] |
# this snippet will rotate the camera in the slice3dVWR that you have
# selected and dump every frame as a PNG to the temporary directory
# you can modify this snippet if you want to make movies of for instance
# deforming surfaces and whatnot
# 1. right click on a slice3dVWR in the graphEditor
# 2. select "Mark Modul... | [
[
1,
0,
0.2449,
0.0204,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.2653,
0.0204,
0,
0.66,
0.2,
516,
0,
1,
0,
0,
516,
0,
0
],
[
1,
0,
0.2857,
0.0204,
0,
0.6... | [
"import os",
"import tempfile",
"import vtk",
"import wx",
"sv = devideApp.ModuleManager.getMarkedModule('slice3dVWR')",
"if sv and sq:\n # bring the window to the front\n sv.view()\n # make sure it actually happens\n wx.Yield()\n \n w2i = vtk.vtkWindowToImageFilter()\n w2i.SetInput(s... |
# short DeVIDE matplotlib demo.
from pylab import *
# close previous figure if it exists
try:
obj.mpl_close_figure(numpy_test_figure)
except NameError:
pass
numpy_test_figure = obj.mpl_new_figure()
# this example from http://matplotlib.sourceforge.net/screenshots/log_shot.py
dt = 0.01
t = arange(dt, 20.0, d... | [
[
1,
0,
0.1034,
0.0345,
0,
0.66,
0,
735,
0,
1,
0,
0,
735,
0,
0
],
[
7,
0,
0.2586,
0.1379,
0,
0.66,
0.0625,
0,
0,
1,
0,
0,
0,
0,
1
],
[
8,
1,
0.2414,
0.0345,
1,
0.07... | [
"from pylab import *",
"try:\n obj.mpl_close_figure(numpy_test_figure)\nexcept NameError:\n pass",
" obj.mpl_close_figure(numpy_test_figure)",
"numpy_test_figure = obj.mpl_new_figure()",
"dt = 0.01",
"t = arange(dt, 20.0, dt)",
"subplot(211)",
"semilogx(t, sin(2*pi*t))",
"ylabel('semilog')"... |
# link cameras of all selected slice3dVWRs
# after having run this, all selected slice3dVWRs will have linked
# cameras, so if you change the view in anyone, all will follow.
# 1. run this in the main DeVIDE introspection window after having
# selected a number of slice3dVWRs
# 2. to unlink views, type unlink_slic... | [
[
2,
0,
0.3936,
0.3404,
0,
0.66,
0,
99,
0,
2,
0,
0,
0,
0,
11
],
[
14,
1,
0.2553,
0.0213,
1,
0.09,
0,
155,
3,
0,
0,
0,
427,
10,
1
],
[
14,
1,
0.2766,
0.0213,
1,
0.09... | [
"def observer_istyle(s3d, s3ds):\n cam = s3d._threedRenderer.GetActiveCamera()\n pos = cam.GetPosition()\n fp = cam.GetFocalPoint()\n vu = cam.GetViewUp()\n\n for other_s3d in s3ds:\n if not other_s3d is s3d:",
" cam = s3d._threedRenderer.GetActiveCamera()",
" pos = cam.GetPosition()... |
import vtk
import wx
def makeBorderPD(ipw):
# setup source
ps = vtk.vtkPlaneSource()
ps.SetOrigin(ipw.GetOrigin())
ps.SetPoint1(ipw.GetPoint1())
ps.SetPoint2(ipw.GetPoint2())
fe = vtk.vtkFeatureEdges()
fe.SetInput(ps.GetOutput())
tubef = vtk.vtkTubeFilter()
tubef.SetNumberOfSides... | [
[
1,
0,
0.0182,
0.0182,
0,
0.66,
0,
665,
0,
1,
0,
0,
665,
0,
0
],
[
1,
0,
0.0364,
0.0182,
0,
0.66,
0.25,
666,
0,
1,
0,
0,
666,
0,
0
],
[
2,
0,
0.2182,
0.3091,
0,
0.... | [
"import vtk",
"import wx",
"def makeBorderPD(ipw):\n\n # setup source\n ps = vtk.vtkPlaneSource()\n ps.SetOrigin(ipw.GetOrigin())\n ps.SetPoint1(ipw.GetPoint1())\n ps.SetPoint2(ipw.GetPoint2())",
" ps = vtk.vtkPlaneSource()",
" ps.SetOrigin(ipw.GetOrigin())",
" ps.SetPoint1(ipw.Get... |
# short DeVIDE matplotlib demo.
from pylab import *
# close previous figure if it exists
try:
obj.mpl_close_figure(numpy_test_figure)
except NameError:
pass
numpy_test_figure = obj.mpl_new_figure()
a = arange(-30, 30, 0.01)
plot(a, sin(a) / a, label='sinc(x)')
plot(a, cos(a), label='cos(x)')
legend()
grid()... | [
[
1,
0,
0.1429,
0.0476,
0,
0.66,
0,
735,
0,
1,
0,
0,
735,
0,
0
],
[
7,
0,
0.3571,
0.1905,
0,
0.66,
0.1111,
0,
0,
1,
0,
0,
0,
0,
1
],
[
8,
1,
0.3333,
0.0476,
1,
0.44... | [
"from pylab import *",
"try:\n obj.mpl_close_figure(numpy_test_figure)\nexcept NameError:\n pass",
" obj.mpl_close_figure(numpy_test_figure)",
"numpy_test_figure = obj.mpl_new_figure()",
"a = arange(-30, 30, 0.01)",
"plot(a, sin(a) / a, label='sinc(x)')",
"plot(a, cos(a), label='cos(x)')",
"l... |
# this DeVIDE snippet will determine the surface area of all selected
# 3D objects in a marked slice3dVWR
# in short:
# 1. right click on a slice3dVWR in the graphEditor
# 2. select "Mark Module" from the drop-down menu
# 3. accept "slice3dVWR" as suggestion for the mark index name
# 4. execute this snippet
import vt... | [
[
1,
0,
0.2857,
0.0286,
0,
0.66,
0,
665,
0,
1,
0,
0,
665,
0,
0
],
[
14,
0,
0.3714,
0.0286,
0,
0.66,
0.5,
868,
3,
1,
0,
0,
685,
10,
1
],
[
4,
0,
0.6857,
0.5429,
0,
0... | [
"import vtk",
"sv = devideApp.ModuleManager.getMarkedModule('slice3dVWR')",
"if sv:\n so = sv._tdObjects._getSelectedObjects()\n polyDatas = [pd for pd in so if hasattr(pd, 'GetClassName') and\n pd.GetClassName() == 'vtkPolyData']\n \n tf = vtk.vtkTriangleFilter()\n mp = vtk.vtkMa... |
# Copyright (c) Charl P. Botha, TU Delft.
# All rights reserved.
# See COPYRIGHT for details.
# I could have done this with just a module variable, but I found this
# Borg thingy too nice not to use. See:
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66531
class CounterBorg:
"""Borg-pattern (similar ... | [
[
3,
0,
0.5781,
0.625,
0,
0.66,
0,
359,
0,
2,
0,
0,
0,
0,
0
],
[
8,
1,
0.4062,
0.2188,
1,
0.92,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
2,
1,
0.7031,
0.0625,
1,
0.92,
0.... | [
"class CounterBorg:\n \"\"\"Borg-pattern (similar to a Singleton) for maintaining a\n monotonically increasing counter.\n\n Instantiate this anywhere, and call get() to return and increment\n the increasing counter. DeVIDE uses this to stamp modified and\n execute times of modules.\n \"\"\"",
"... |
# Copyright (c) Charl P. Botha, TU Delft.
# All rights reserved.
# See COPYRIGHT for details.
"""itk_kit package driver file.
Inserts the following modules in sys.modules: itk, InsightToolkit.
@author: Charl P. Botha <http://cpbotha.net/>
"""
import os
import re
import sys
VERSION = ''
def setDLFlags():
# bro... | [
[
8,
0,
0.067,
0.0536,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1071,
0.0089,
0,
0.66,
0.1429,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.1161,
0.0089,
0,
0.66,... | [
"\"\"\"itk_kit package driver file.\n\nInserts the following modules in sys.modules: itk, InsightToolkit.\n\n@author: Charl P. Botha <http://cpbotha.net/>\n\"\"\"",
"import os",
"import re",
"import sys",
"VERSION = ''",
"def setDLFlags():\n # brought over from ITK Wrapping/CSwig/Python\n\n # Python... |
# $Id: __init__.py 1945 2006-03-05 01:06:37Z cpbotha $
# importing this module shouldn't directly cause other large imports
# do large imports in the init() hook so that you can call back to the
# ModuleManager progress handler methods.
"""matplotlib_kit package driver file.
Inserts the following modules in sys.modu... | [
[
8,
0,
0.1159,
0.0732,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1707,
0.0122,
0,
0.66,
0.1667,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.1829,
0.0122,
0,
0.66... | [
"\"\"\"matplotlib_kit package driver file.\n\nInserts the following modules in sys.modules: matplotlib, pylab.\n\n@author: Charl P. Botha <http://cpbotha.net/>\n\"\"\"",
"import os",
"import re",
"import sys",
"import types",
"VERSION = ''",
"def init(theModuleManager, pre_import=True):\n\n if hasatt... |
# Copyright (c) Charl P. Botha, TU Delft
# All rights reserved.
# See COPYRIGHT for details.
import gdcm
def sort_ipp(filenames):
"""STOP PRESS. This is currently incomplete. I'm waiting to see
what's going to happen with the IPPSorter in GDCM.
Given a list of filenames, make use of the gdcm scanne... | [
[
1,
0,
0.1316,
0.0263,
0,
0.66,
0,
188,
0,
1,
0,
0,
188,
0,
0
],
[
2,
0,
0.5921,
0.8421,
0,
0.66,
1,
450,
0,
1,
1,
0,
0,
0,
12
],
[
8,
1,
0.3289,
0.2632,
1,
0.74,
... | [
"import gdcm",
"def sort_ipp(filenames):\n \"\"\"STOP PRESS. This is currently incomplete. I'm waiting to see\n what's going to happen with the IPPSorter in GDCM.\n \n Given a list of filenames, make use of the gdcm scanner to sort\n them all according to IPP.\n\n @param filenames: list of ful... |
# Copyright (c) Charl P. Botha, TU Delft
# All rights reserved.
# See COPYRIGHT for details.
"""gdcm_kit driver module.
This pre-loads GDCM2, the second generation Grass Roots Dicom library,
used since 2008 by DeVIDE for improved DICOM loading / saving support.
"""
import os
import sys
VERSION = ''
def init(modul... | [
[
8,
0,
0.1667,
0.1042,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.25,
0.0208,
0,
0.66,
0.25,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.2708,
0.0208,
0,
0.66,
... | [
"\"\"\"gdcm_kit driver module.\n\nThis pre-loads GDCM2, the second generation Grass Roots Dicom library,\nused since 2008 by DeVIDE for improved DICOM loading / saving support.\n\"\"\"",
"import os",
"import sys",
"VERSION = ''",
"def init(module_manager, pre_import=True):\n # as of 20080628, the order o... |
# Copyright (c) Charl P. Botha, TU Delft
# All rights reserved.
# See COPYRIGHT for details.
class MedicalMetaData:
def __init__(self):
self.medical_image_properties = None
self.direction_cosines = None
def close(self):
del self.medical_image_properties
del self.direction_cosin... | [
[
3,
0,
0.5833,
0.7917,
0,
0.66,
0,
29,
0,
3,
0,
0,
0,
0,
2
],
[
2,
1,
0.2917,
0.125,
1,
0.19,
0,
555,
0,
1,
0,
0,
0,
0,
0
],
[
14,
2,
0.2917,
0.0417,
2,
0.92,
... | [
"class MedicalMetaData:\n def __init__(self):\n self.medical_image_properties = None\n self.direction_cosines = None\n\n def close(self):\n del self.medical_image_properties\n del self.direction_cosines",
" def __init__(self):\n self.medical_image_properties = None\n ... |
# Copyright (c) Charl P. Botha, TU Delft.
# All rights reserved.
# See COPYRIGHT for details.
class SubjectMixin(object):
def __init__(self):
# dictionary mapping from event name to list of observer
# callables
self._observers = {}
def add_observer(self, event_name, observer):
... | [
[
3,
0,
0.5366,
0.8537,
0,
0.66,
0,
779,
0,
5,
0,
0,
186,
0,
4
],
[
2,
1,
0.2073,
0.0976,
1,
0,
0,
555,
0,
1,
0,
0,
0,
0,
0
],
[
14,
2,
0.2439,
0.0244,
2,
0.76,
... | [
"class SubjectMixin(object):\n\n def __init__(self):\n # dictionary mapping from event name to list of observer\n # callables\n self._observers = {}\n\n def add_observer(self, event_name, observer):",
" def __init__(self):\n # dictionary mapping from event name to list of obse... |
# Copyright (c) Charl P. Botha, TU Delft
# All rights reserved.
# See COPYRIGHT for details.
import sys
VERSION = 'INTEGRATED'
# debug print command: if DEBUG is true, outputs to stdout, if not
# then outputs nothing.
# import with: from module_kits.misc_kit import dprint
DEBUG=False
if DEBUG:
def dprint(*msg):
... | [
[
1,
0,
0.1613,
0.0323,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
14,
0,
0.2258,
0.0323,
0,
0.66,
0.25,
557,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.3871,
0.0323,
0,
0.... | [
"import sys",
"VERSION = 'INTEGRATED'",
"DEBUG=False",
"if DEBUG:\n def dprint(*msg):\n print(msg)\nelse:\n def dprint(*msg):\n pass",
" def dprint(*msg):\n print(msg)",
" print(msg)",
" def dprint(*msg):\n pass",
"def init(module_manager, pre_import=True... |
# Copyright (c) Charl P. Botha, TU Delft
# All rights reserved.
# See COPYRIGHT for details.
import wx
from wx import py
from wx import stc
class DVEditWindow(py.editwindow.EditWindow):
"""DeVIDE EditWindow.
This fixes all of the py screwups by providing a re-usable Python
EditWindow component. The Py ... | [
[
1,
0,
0.0181,
0.0036,
0,
0.66,
0,
666,
0,
1,
0,
0,
666,
0,
0
],
[
1,
0,
0.0217,
0.0036,
0,
0.66,
0.3333,
666,
0,
1,
0,
0,
666,
0,
0
],
[
1,
0,
0.0253,
0.0036,
0,
... | [
"import wx",
"from wx import py",
"from wx import stc",
"class DVEditWindow(py.editwindow.EditWindow):\n\n \"\"\"DeVIDE EditWindow.\n\n This fixes all of the py screwups by providing a re-usable Python\n EditWindow component. The Py components are useful, they've just been put\n together in a rea... |
import wx
from wx import py
class DVShell(py.shell.Shell):
"""DeVIDE shell.
Once again, PyCrust makes some pretty bad calls here and there. With this
override we fix some of them.
1. passing locals=None will result in shell.Shell setting locals to
__main__.__dict__ (!!) in contrast to the defaul... | [
[
1,
0,
0.0345,
0.0345,
0,
0.66,
0,
666,
0,
1,
0,
0,
666,
0,
0
],
[
1,
0,
0.069,
0.0345,
0,
0.66,
0.5,
666,
0,
1,
0,
0,
666,
0,
0
],
[
3,
0,
0.569,
0.8966,
0,
0.66,... | [
"import wx",
"from wx import py",
"class DVShell(py.shell.Shell):\n \"\"\"DeVIDE shell.\n\n Once again, PyCrust makes some pretty bad calls here and there. With this\n override we fix some of them.\n\n 1. passing locals=None will result in shell.Shell setting locals to\n __main__.__dict__ (!!) i... |
# Copyright (c) Charl P. Botha, TU Delft
# All rights reserved.
# See COPYRIGHT for details.
import wx
def get_system_font_size():
# wx.SYS_ANSI_FIXED_FONT seems to return reliable settings under
# Windows and Linux. SYS_SYSTEM_FONT doesn't do so well on Win.
ft = wx.SystemSettings.GetFont(wx.SYS_ANSI_FI... | [
[
1,
0,
0.1471,
0.0294,
0,
0.66,
0,
666,
0,
1,
0,
0,
666,
0,
0
],
[
2,
0,
0.2647,
0.1471,
0,
0.66,
0.5,
265,
0,
0,
1,
0,
0,
0,
2
],
[
14,
1,
0.2941,
0.0294,
1,
0.73... | [
"import wx",
"def get_system_font_size():\n # wx.SYS_ANSI_FIXED_FONT seems to return reliable settings under\n # Windows and Linux. SYS_SYSTEM_FONT doesn't do so well on Win.\n ft = wx.SystemSettings.GetFont(wx.SYS_ANSI_FIXED_FONT)\n return ft.GetPointSize()",
" ft = wx.SystemSettings.GetFont(wx... |
# Copyright (c) Charl P. Botha, TU Delft
# All rights reserved.
# See COPYRIGHT for details.
# importing this module shouldn't directly cause other large imports
# do large imports in the init() hook so that you can call back to the
# ModuleManager progress handler methods.
"""wxpython_kit package driver file.
Inser... | [
[
8,
0,
0.3382,
0.1765,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.5,
0.0294,
0,
0.66,
0.5,
557,
1,
0,
0,
0,
0,
3,
0
],
[
2,
0,
0.7794,
0.4706,
0,
0.66,
1... | [
"\"\"\"wxpython_kit package driver file.\n\nInserts the following modules in sys.modules: wx.\n\n@author: Charl P. Botha <http://cpbotha.net/>\n\"\"\"",
"VERSION = ''",
"def init(theModuleManager, pre_import=True):\n # import the main module itself\n global wx\n import wx\n\n import dvedit_window\n ... |
medical_image_properties_keywords = [
'PatientName',
'PatientID',
'PatientAge',
'PatientSex',
'PatientBirthDate',
'ImageDate',
'ImageTime',
'ImageNumber',
'StudyDescription',
'StudyID',
'StudyDate',
'AcquisitionDate',
... | [
[
14,
0,
0.5,
0.9677,
0,
0.66,
0,
738,
0,
0,
0,
0,
0,
5,
0
]
] | [
"medical_image_properties_keywords = [\n 'PatientName',\n 'PatientID',\n 'PatientAge',\n 'PatientSex',\n 'PatientBirthDate',\n 'ImageDate',\n 'ImageTime',"
] |
# Copyright (c) Charl P. Botha, TU Delft.
# All rights reserved.
# See COPYRIGHT for details.
"""Utility methods for vtk_kit module kit.
@author Charl P. Botha <http://cpbotha.net/>
"""
import vtk
class DVOrientationWidget:
"""Convenience class for embedding orientation widget in any
renderwindowinteractor.... | [
[
8,
0,
0.0406,
0.025,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0625,
0.0063,
0,
0.66,
0.25,
665,
0,
1,
0,
0,
665,
0,
0
],
[
3,
0,
0.2812,
0.4188,
0,
0.66,
... | [
"\"\"\"Utility methods for vtk_kit module kit.\n\n@author Charl P. Botha <http://cpbotha.net/>\n\"\"\"",
"import vtk",
"class DVOrientationWidget:\n \"\"\"Convenience class for embedding orientation widget in any\n renderwindowinteractor. If the data has DeVIDE style orientation\n metadata, this class... |
# $Id$
"""Mixins that are useful for classes using vtk_kit.
@author: Charl P. Botha <http://cpbotha.net/>
"""
from external.vtkPipeline.ConfigVtkObj import ConfigVtkObj
from external.vtkPipeline.vtkMethodParser import VtkMethodParser
from module_base import ModuleBase
from module_mixins import IntrospectModuleMixin ... | [
[
8,
0,
0.0134,
0.0119,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0239,
0.003,
0,
0.66,
0.1,
101,
0,
1,
0,
0,
101,
0,
0
],
[
1,
0,
0.0269,
0.003,
0,
0.66,
... | [
"\"\"\"Mixins that are useful for classes using vtk_kit.\n\n@author: Charl P. Botha <http://cpbotha.net/>\n\"\"\"",
"from external.vtkPipeline.ConfigVtkObj import ConfigVtkObj",
"from external.vtkPipeline.vtkMethodParser import VtkMethodParser",
"from module_base import ModuleBase",
"from module_mixins impo... |
# perceptually linear colour scales based on those published by Haim
# Levkowitz at http://www.cs.uml.edu/~haim/ColorCenter/
# code by Peter R. Krekel (c) 2009
# modified by Charl Botha to cache lookuptable per range
import vtk
class ColorScales():
def __init__(self):
self.BlueToYellow = {}
self.... | [
[
1,
0,
0.0071,
0.0012,
0,
0.66,
0,
665,
0,
1,
0,
0,
665,
0,
0
],
[
3,
0,
0.5035,
0.9894,
0,
0.66,
1,
18,
0,
5,
0,
0,
0,
0,
99
],
[
2,
1,
0.013,
0.0059,
1,
0.52,
... | [
"import vtk",
"class ColorScales():\n def __init__(self):\n self.BlueToYellow = {}\n self.Linear_Heat = {}\n self.Linear_BlackToWhite = {}\n self.Linear_BlueToYellow = {}\n\n def LUT_BlueToYellow(self, LUrange):",
" def __init__(self):\n self.BlueToYellow = {}\n ... |
# $Id$
# importing this module shouldn't directly cause other large imports
# do large imports in the init() hook so that you can call back to the
# ModuleManager progress handler methods.
"""vtk_kit package driver file.
This performs all initialisation necessary to use VTK from DeVIDE. Makes
sure that all VTK clas... | [
[
8,
0,
0.0906,
0.0787,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1417,
0.0079,
0,
0.66,
0.1111,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.1496,
0.0079,
0,
0.66... | [
"\"\"\"vtk_kit package driver file.\n\nThis performs all initialisation necessary to use VTK from DeVIDE. Makes\nsure that all VTK classes have ErrorEvent handlers that report back to\nthe ModuleManager.\n\nInserts the following modules in sys.modules: vtk, vtkdevide.",
"import re",
"import sys",
"import tra... |
# $Id: __init__.py 1945 2006-03-05 01:06:37Z cpbotha $
# importing this module shouldn't directly cause other large imports
# do large imports in the init() hook so that you can call back to the
# ModuleManager progress handler methods.
"""numpy_kit package driver file.
Inserts the following modules in sys.modules: ... | [
[
8,
0,
0.2209,
0.1395,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.3256,
0.0233,
0,
0.66,
0.1667,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.3488,
0.0233,
0,
0.66... | [
"\"\"\"numpy_kit package driver file.\n\nInserts the following modules in sys.modules: numpy.\n\n@author: Charl P. Botha <http://cpbotha.net/>\n\"\"\"",
"import os",
"import re",
"import sys",
"import types",
"VERSION = ''",
"def init(theModuleManager, pre_import=True):\n theModuleManager.setProgress... |
import math
import numpy
epsilon = 1e-12
def abs(v1):
return numpy.absolute(v1)
def norm(v1):
"""Given vector v1, return its norm.
"""
v1a = numpy.array(v1)
norm = numpy.sqrt(numpy.sum(v1a * v1a))
return norm
def normalise_line(p1, p2):
"""Given two points, return normal vector, magnitu... | [
[
1,
0,
0.0046,
0.0046,
0,
0.66,
0,
526,
0,
1,
0,
0,
526,
0,
0
],
[
1,
0,
0.0091,
0.0046,
0,
0.66,
0.0909,
954,
0,
1,
0,
0,
954,
0,
0
],
[
14,
0,
0.0183,
0.0046,
0,
... | [
"import math",
"import numpy",
"epsilon = 1e-12",
"def abs(v1):\n return numpy.absolute(v1)",
" return numpy.absolute(v1)",
"def norm(v1):\n \"\"\"Given vector v1, return its norm.\n \"\"\"\n\n v1a = numpy.array(v1)\n norm = numpy.sqrt(numpy.sum(v1a * v1a))\n return norm",
" \"\"... |
# Copyright (c) Charl P. Botha, TU Delft
# All rights reserved.
# See COPYRIGHT for details.
# importing this module shouldn't directly cause other large imports
# do large imports in the init() hook so that you can call back to the
# ModuleManager progress handler methods.
"""geometry_kit package driver file.
Inser... | [
[
8,
0,
0.2875,
0.15,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.4,
0.025,
0,
0.66,
0.25,
509,
0,
1,
0,
0,
509,
0,
0
],
[
14,
0,
0.475,
0.025,
0,
0.66,
0.5... | [
"\"\"\"geometry_kit package driver file.\n\nInserts the following modules in sys.modules: geometry.\n\n@author: Charl P. Botha <http://cpbotha.net/>\n\"\"\"",
"import sys",
"VERSION = 'INTEGRATED'",
"def init(module_manager, pre_import=True):\n global geometry\n import geometry\n\n # if we don't do t... |
# Copyright (c) Charl P. Botha, TU Delft
# All rights reserved.
# See COPYRIGHT for details.
"""sqlite_kit package driver file.
With this we make sure that sqlite3 is always packaged.
"""
VERSION = ''
def init(module_manager, pre_import=True):
global sqlite3
import sqlite3
global VERSION
VERSION = ... | [
[
8,
0,
0.3421,
0.2105,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.5263,
0.0526,
0,
0.66,
0.5,
557,
1,
0,
0,
0,
0,
3,
0
],
[
2,
0,
0.7895,
0.3684,
0,
0.66,
... | [
"\"\"\"sqlite_kit package driver file.\n\nWith this we make sure that sqlite3 is always packaged.\n\"\"\"",
"VERSION = ''",
"def init(module_manager, pre_import=True):\n global sqlite3\n import sqlite3\n\n global VERSION\n VERSION = '%s (sqlite %s)' % (sqlite3.version,\n sqlite3.sqlite_ve... |
# $Id: __init__.py 1945 2006-03-05 01:06:37Z cpbotha $
# importing this module shouldn't directly cause other large imports
# do large imports in the init() hook so that you can call back to the
# ModuleManager progress handler methods.
"""vtktudoss_kit package driver file.
Inserts the following modules in sys.modul... | [
[
8,
0,
0.2879,
0.1818,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.4242,
0.0303,
0,
0.66,
0.2,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.4545,
0.0303,
0,
0.66,
... | [
"\"\"\"vtktudoss_kit package driver file.\n\nInserts the following modules in sys.modules: vtktudoss.\n\n@author: Charl P. Botha <http://cpbotha.net/>\n\"\"\"",
"import re",
"import sys",
"import types",
"VERSION = 'SVN'",
"def init(theModuleManager, pre_import=True):\n # import the main module itself\... |
# $Id: __init__.py 1945 2006-03-05 01:06:37Z cpbotha $
# importing this module shouldn't directly cause other large imports
# do large imports in the init() hook so that you can call back to the
# ModuleManager progress handler methods.
"""itktudoss_kit package driver file.
This driver makes sure that itktudoss has ... | [
[
8,
0,
0.3704,
0.2593,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.5556,
0.037,
0,
0.66,
0.2,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.5926,
0.037,
0,
0.66,
... | [
"\"\"\"itktudoss_kit package driver file.\n\nThis driver makes sure that itktudoss has been integrated with the main WrapITK\ninstalation.\n\n@author: Charl P. Botha <http://cpbotha.net/>\n\"\"\"",
"import re",
"import sys",
"import types",
"VERSION = 'SVN'",
"def init(theModuleManager, pre_import=True):\... |
# $Id: __init__.py 1945 2006-03-05 01:06:37Z cpbotha $
# importing this module shouldn't directly cause other large imports
# do large imports in the init() hook so that you can call back to the
# ModuleManager progress handler methods.
"""stats_kit package driver file.
Inserts the following modules in sys.modules: ... | [
[
8,
0,
0.2714,
0.1714,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.4,
0.0286,
0,
0.66,
0.25,
509,
0,
1,
0,
0,
509,
0,
0
],
[
14,
0,
0.4857,
0.0286,
0,
0.66,
... | [
"\"\"\"stats_kit package driver file.\n\nInserts the following modules in sys.modules: stats.\n\n@author: Charl P. Botha <http://cpbotha.net/>\n\"\"\"",
"import sys",
"VERSION = 'Strangman - May 10, 2002'",
"def init(theModuleManager, pre_import=True):\n # import the main module itself\n global stats\n ... |
# $Id: module_index.py 2790 2008-02-29 08:33:14Z cpbotha $
class emp_test:
kits = ['vtk_kit']
cats = ['Tests']
keywords = ['test', 'tests', 'testing']
help = \
"""Module to test DeVIDE extra-module-paths functionality.
"""
| [
[
3,
0,
0.4615,
0.5385,
0,
0.66,
0,
657,
0,
0,
0,
0,
0,
0,
0
],
[
14,
1,
0.3077,
0.0769,
1,
0.79,
0,
190,
0,
0,
0,
0,
0,
5,
0
],
[
14,
1,
0.3846,
0.0769,
1,
0.79,
... | [
"class emp_test:\n kits = ['vtk_kit']\n cats = ['Tests']\n keywords = ['test', 'tests', 'testing']\n help = \\\n \"\"\"Module to test DeVIDE extra-module-paths functionality.\n \"\"\"",
" kits = ['vtk_kit']",
" cats = ['Tests']",
" keywords = ['test', 'tests', 'testing']",
" he... |
from module_kits.vtk_kit.mixins import SimpleVTKClassModuleBase
import vtk
class emp_test(SimpleVTKClassModuleBase):
"""This is the minimum you need to wrap a single VTK object. This
__doc__ string will be replaced by the __doc__ string of the encapsulated
VTK object, i.e. vtkStripper in this case.
... | [
[
1,
0,
0.0455,
0.0455,
0,
0.66,
0,
67,
0,
1,
0,
0,
67,
0,
0
],
[
1,
0,
0.0909,
0.0455,
0,
0.66,
0.5,
665,
0,
1,
0,
0,
665,
0,
0
],
[
3,
0,
0.5227,
0.7273,
0,
0.66,... | [
"from module_kits.vtk_kit.mixins import SimpleVTKClassModuleBase",
"import vtk",
"class emp_test(SimpleVTKClassModuleBase):\n \"\"\"This is the minimum you need to wrap a single VTK object. This\n __doc__ string will be replaced by the __doc__ string of the encapsulated\n VTK object, i.e. vtkStripper ... |
"""Module to test basic matplotlib functionality.
"""
import os
import unittest
import tempfile
class MPLTest(unittest.TestCase):
def test_figure_output(self):
"""Test if matplotlib figure can be generated and wrote to disc.
"""
# make sure the pythonshell is running
self._devide_... | [
[
8,
0,
0.0185,
0.0247,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0494,
0.0123,
0,
0.66,
0.2,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0617,
0.0123,
0,
0.66,
... | [
"\"\"\"Module to test basic matplotlib functionality.\n\"\"\"",
"import os",
"import unittest",
"import tempfile",
"class MPLTest(unittest.TestCase):\n def test_figure_output(self):\n \"\"\"Test if matplotlib figure can be generated and wrote to disc.\n \"\"\"\n\n # make sure the pyt... |
"""Module to test basic DeVIDE functionality.
"""
import unittest
class BasicMiscTest(unittest.TestCase):
def test_sqlite3(self):
"""Test if sqlite3 is available.
"""
import sqlite3
v = sqlite3.version
conn = sqlite3.connect(':memory:')
cur = conn.cursor(... | [
[
8,
0,
0.0357,
0.0476,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0952,
0.0238,
0,
0.66,
0.3333,
88,
0,
1,
0,
0,
88,
0,
0
],
[
3,
0,
0.381,
0.5,
0,
0.66,
... | [
"\"\"\"Module to test basic DeVIDE functionality.\n\"\"\"",
"import unittest",
"class BasicMiscTest(unittest.TestCase):\n def test_sqlite3(self):\n \"\"\"Test if sqlite3 is available.\n \"\"\"\n\n import sqlite3\n \n v = sqlite3.version",
" def test_sqlite3(self):\n ... |
# testing.__init__.py copyright 2006 by Charl P. Botha http://cpbotha.net/
# $Id$
# this drives the devide unit testing. neat huh?
import os
import time
import unittest
from testing import misc
from testing import basic_vtk
from testing import basic_wx
from testing import graph_editor
from testing import numpy_tests... | [
[
1,
0,
0.042,
0.0084,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0504,
0.0084,
0,
0.66,
0.0909,
654,
0,
1,
0,
0,
654,
0,
0
],
[
1,
0,
0.0588,
0.0084,
0,
0... | [
"import os",
"import time",
"import unittest",
"from testing import misc",
"from testing import basic_vtk",
"from testing import basic_wx",
"from testing import graph_editor",
"from testing import numpy_tests",
"from testing import matplotlib_tests",
"module_list = [misc, basic_vtk, basic_wx, grap... |
"""Module to test basic DeVIDE functionality.
"""
import unittest
class PythonShellTest(unittest.TestCase):
def test_python_shell(self):
"""Test if PythonShell can be opened successfully.
"""
iface = self._devide_app.get_interface()
iface._handler_menu_python_shell(None)
se... | [
[
8,
0,
0.0312,
0.0417,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0833,
0.0208,
0,
0.66,
0.25,
88,
0,
1,
0,
0,
88,
0,
0
],
[
3,
0,
0.1979,
0.1667,
0,
0.66,
... | [
"\"\"\"Module to test basic DeVIDE functionality.\n\"\"\"",
"import unittest",
"class PythonShellTest(unittest.TestCase):\n def test_python_shell(self):\n \"\"\"Test if PythonShell can be opened successfully.\n \"\"\"\n iface = self._devide_app.get_interface()\n iface._handler_men... |
hiddenimports = ['matplotlib.numerix',
'matplotlib.numerix.fft',
'matplotlib.numerix.linear_algebra',
'matplotlib.numerix.ma',
'matplotlib.numerix.mlab',
'matplotlib.numerix.npyma',
'matplotlib.numerix.random_array',
'matplotlib.backends.backend_wxagg']
print "[... | [
[
14,
0,
0.4091,
0.7273,
0,
0.66,
0,
892,
0,
0,
0,
0,
0,
5,
0
],
[
8,
0,
0.9091,
0.0909,
0,
0.66,
0.5,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
1,
0.0909,
0,
0.66,
1... | [
"hiddenimports = ['matplotlib.numerix', \n 'matplotlib.numerix.fft',\n 'matplotlib.numerix.linear_algebra',\n 'matplotlib.numerix.ma',\n 'matplotlib.numerix.mlab',\n 'matplotlib.numerix.npyma',\n 'matplotlib.numerix.random_array',\n 'matplotlib.backends.backend_wxagg... |
# this hook is responsible for including everything that the DeVIDE
# modules could need. The top-level spec file explicitly excludes
# them.
import os
import sys
# normalize path of this file, get dirname
hookDir = os.path.dirname(os.path.normpath(__file__))
# split dirname, select everything except the ending "ins... | [
[
1,
0,
0.0806,
0.0161,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0968,
0.0161,
0,
0.66,
0.05,
509,
0,
1,
0,
0,
509,
0,
0
],
[
14,
0,
0.1452,
0.0161,
0,
0... | [
"import os",
"import sys",
"hookDir = os.path.dirname(os.path.normpath(__file__))",
"dd = hookDir.split(os.sep)[0:-2]",
"dd[0] = '%s%s' % (dd[0], os.sep)",
"devideDir = os.path.normpath(os.path.join(*dd))",
"sys.path.insert(0, devideDir)",
"import module_kits",
"import ConfigParser",
"config_defau... |
# so vtktudoss.py uses a list of names to construct the various imports
# at runtime, installer doesn't see this. :(
import os
if os.name == 'posix':
hiddenimports = [
'libvtktudossGraphicsPython',
'libvtktudossWidgetsPython',
'libvtktudossSTLibPython']
else:
hiddenimports ... | [
[
1,
0,
0.2222,
0.0556,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
4,
0,
0.5833,
0.5556,
0,
0.66,
0.3333,
0,
0,
0,
0,
0,
0,
0,
0
],
[
14,
1,
0.4722,
0.2222,
1,
0.9... | [
"import os",
"if os.name == 'posix':\n hiddenimports = [\n 'libvtktudossGraphicsPython',\n 'libvtktudossWidgetsPython',\n 'libvtktudossSTLibPython']\nelse:\n hiddenimports = [\n 'vtktudossGraphicsPython',",
" hiddenimports = [\n 'libvtktudossGraphi... |
# miscellaneous imports used by snippets
hiddenimports = ['tempfile']
| [
[
14,
0,
1,
0.3333,
0,
0.66,
0,
892,
0,
0,
0,
0,
0,
5,
0
]
] | [
"hiddenimports = ['tempfile']"
] |
hiddenimports = ['wx.aui', 'wx.lib.mixins']
print "[*] hook-wx.py - HIDDENIMPORTS"
print hiddenimports
| [
[
14,
0,
0.25,
0.25,
0,
0.66,
0,
892,
0,
0,
0,
0,
0,
5,
0
],
[
8,
0,
0.75,
0.25,
0,
0.66,
0.5,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
1,
0.25,
0,
0.66,
1,
535,... | [
"hiddenimports = ['wx.aui', 'wx.lib.mixins']",
"print(\"[*] hook-wx.py - HIDDENIMPORTS\")",
"print(hiddenimports)"
] |
# so vtktud.py uses a list of names to construct the various imports
# at runtime, installer doesn't see this. :(
import os
if os.name == 'posix':
hiddenimports = ['libvtktudCommonPython',
'libvtktudImagingPython', 'libvtktudGraphicsPython',
'libvtktudWidgetsPython']
else:
hiddenimport... | [
[
1,
0,
0.25,
0.0625,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
4,
0,
0.5938,
0.5,
0,
0.66,
0.3333,
0,
0,
0,
0,
0,
0,
0,
0
],
[
14,
1,
0.5,
0.1875,
1,
0.75,
0... | [
"import os",
"if os.name == 'posix':\n hiddenimports = ['libvtktudCommonPython',\n 'libvtktudImagingPython', 'libvtktudGraphicsPython',\n 'libvtktudWidgetsPython']\nelse:\n hiddenimports = ['vtktudCommonPython',\n 'vtktudImagingPython', 'vtktudGraphicsPython',\n '... |
"""Module for independently packaging up whole WrapITK tree.
"""
import itkConfig
import glob
import os
import shutil
import sys
# customise the following variables
if os.name == 'nt':
SO_EXT = 'dll'
SO_GLOB = '*.%s' % (SO_EXT,)
PYE_GLOB = '*.pyd'
# this should be c:/opt/ITK/bin
ITK_SO_DIR = os.p... | [
[
8,
0,
0.009,
0.012,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0241,
0.006,
0,
0.66,
0.0909,
41,
0,
1,
0,
0,
41,
0,
0
],
[
1,
0,
0.0301,
0.006,
0,
0.66,
... | [
"\"\"\"Module for independently packaging up whole WrapITK tree.\n\"\"\"",
"import itkConfig",
"import glob",
"import os",
"import shutil",
"import sys",
"if os.name == 'nt':\n SO_EXT = 'dll'\n SO_GLOB = '*.%s' % (SO_EXT,)\n PYE_GLOB = '*.pyd'\n # this should be c:/opt/ITK/bin\n ITK_SO_DI... |
# example driver script for offline / command-line processing with DeVIDE
# the following variables are magically set in this script:
# interface - instance of ScriptInterface, with the following calls:
# meta_modules = load_and_realise_network()
# execute_network(self, meta_modules)
# clear_network(self)
# in... | [
[
2,
0,
0.6321,
0.6792,
0,
0.66,
0,
624,
0,
0,
0,
0,
0,
0,
14
],
[
14,
1,
0.3774,
0.0189,
1,
0.52,
0,
962,
3,
1,
0,
0,
908,
10,
1
],
[
14,
1,
0.4151,
0.0189,
1,
0.5... | [
"def main():\n # script_params is everything that gets passed on the DeVIDE\n # commandline after --script-params\n # first get the two strings split by a comma\n l,u = script_params.split(',')\n # then cast to float\n LOWER = float(l)\n UPPER = float(u)",
" l,u = script_params.split(',')"... |
# dummy
| [] | [] |
# Copyright (c) Charl P. Botha, TU Delft.
# All rights reserved.
# See COPYRIGHT for details.
import wx # todo: this should go away...
import string
import sys
import traceback
# todo: remove all VTK dependencies from this file!!
def clampVariable(v, min, max):
"""Make sure variable is on the range [min,max]. R... | [
[
1,
0,
0.0303,
0.0061,
0,
0.66,
0,
666,
0,
1,
0,
0,
666,
0,
0
],
[
1,
0,
0.0364,
0.0061,
0,
0.66,
0.0833,
890,
0,
1,
0,
0,
890,
0,
0
],
[
1,
0,
0.0424,
0.0061,
0,
... | [
"import wx # todo: this should go away...",
"import string",
"import sys",
"import traceback",
"def clampVariable(v, min, max):\n \"\"\"Make sure variable is on the range [min,max]. Return clamped variable.\n \"\"\"\n if v < min:\n v = min\n elif v > max:\n v = max",
" \"\"\"... |
# Copyright (c) Charl P. Botha, TU Delft
# All rights reserved.
# See COPYRIGHT for details.
import vtk
from module_kits.misc_kit.mixins import SubjectMixin
from devide_canvas_object import DeVIDECanvasGlyph
import operator
import wx # we're going to use this for event handling
from module_kits.misc_kit import dprin... | [
[
1,
0,
0.0076,
0.0015,
0,
0.66,
0,
665,
0,
1,
0,
0,
665,
0,
0
],
[
1,
0,
0.0091,
0.0015,
0,
0.66,
0.1429,
313,
0,
1,
0,
0,
313,
0,
0
],
[
1,
0,
0.0106,
0.0015,
0,
... | [
"import vtk",
"from module_kits.misc_kit.mixins import SubjectMixin",
"from devide_canvas_object import DeVIDECanvasGlyph",
"import operator",
"import wx # we're going to use this for event handling",
"from module_kits.misc_kit import dprint",
"class DeVIDECanvasEvent:\n def __init__(self):\n ... |
# dummy
| [] | [] |
class canvasSubject:
def __init__(self):
self._observers = {}
def addObserver(self, eventName, observer):
"""Add an observer for a particular event.
eventName can be one of 'enter', 'exit', 'drag', 'buttonDown'
or 'buttonUp'. observer is a callable object that will be
... | [
[
3,
0,
0.5,
0.9474,
0,
0.66,
0,
205,
0,
3,
0,
0,
0,
0,
2
],
[
2,
1,
0.1316,
0.1053,
1,
0.53,
0,
555,
0,
1,
0,
0,
0,
0,
0
],
[
14,
2,
0.1579,
0.0526,
2,
0.71,
0... | [
"class canvasSubject:\n def __init__(self):\n self._observers = {}\n \n def addObserver(self, eventName, observer):\n \"\"\"Add an observer for a particular event.\n\n eventName can be one of 'enter', 'exit', 'drag', 'buttonDown'",
" def __init__(self):\n self._observer... |
from canvasObject import *
from canvas import *
| [
[
1,
0,
0.3333,
0.3333,
0,
0.66,
0,
120,
0,
1,
0,
0,
120,
0,
0
],
[
1,
0,
0.6667,
0.3333,
0,
0.66,
1,
593,
0,
1,
0,
0,
593,
0,
0
]
] | [
"from canvasObject import *",
"from canvas import *"
] |
from wxPython import wx
from canvasSubject import canvasSubject
#############################################################################
class canvasObject(canvasSubject):
def __init__(self, position):
# call parent ctor
canvasSubject.__init__(self)
self._position = posit... | [
[
1,
0,
0.0025,
0.0025,
0,
0.66,
0,
291,
0,
1,
0,
0,
291,
0,
0
],
[
1,
0,
0.0051,
0.0025,
0,
0.66,
0.2,
205,
0,
1,
0,
0,
205,
0,
0
],
[
3,
0,
0.0644,
0.1061,
0,
0.6... | [
"from wxPython import wx",
"from canvasSubject import canvasSubject",
"class canvasObject(canvasSubject):\n \n def __init__(self, position):\n # call parent ctor\n canvasSubject.__init__(self)\n \n self._position = position\n self._canvas = None",
" def __init__(sel... |
import wx
from canvasSubject import canvasSubject
from canvasObject import *
class canvas(wx.wxScrolledWindow, canvasSubject):
def __init__(self, parent, id = -1, size = wx.wxDefaultSize):
# parent 1 ctor
wx.wxScrolledWindow.__init__(self, parent, id, wx.wxPoint(0, 0), size,
... | [
[
1,
0,
0.0031,
0.0031,
0,
0.66,
0,
666,
0,
1,
0,
0,
666,
0,
0
],
[
1,
0,
0.0063,
0.0031,
0,
0.66,
0.3333,
205,
0,
1,
0,
0,
205,
0,
0
],
[
1,
0,
0.0094,
0.0031,
0,
... | [
"import wx",
"from canvasSubject import canvasSubject",
"from canvasObject import *",
"class canvas(wx.wxScrolledWindow, canvasSubject):\n def __init__(self, parent, id = -1, size = wx.wxDefaultSize):\n # parent 1 ctor\n wx.wxScrolledWindow.__init__(self, parent, id, wx.wxPoint(0, 0), size,\n... |
# dummy
| [] | [] |
# dummy
| [] | [] |
# Copyright (c) Charl P. Botha, TU Delft.
# All rights reserved.
# See COPYRIGHT for details.
"""Module containing base class for devide modules.
author: Charl P. Botha <[email protected]>
"""
#########################################################################
class GenericObject(object):
"""Generic object ... | [
[
8,
0,
0.0275,
0.0169,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
3,
0,
0.053,
0.0169,
0,
0.66,
0.3333,
837,
0,
0,
0,
0,
186,
0,
0
],
[
8,
1,
0.053,
0.0085,
1,
0.75,
... | [
"\"\"\"Module containing base class for devide modules.\n\nauthor: Charl P. Botha <[email protected]>\n\"\"\"",
"class GenericObject(object):\n \"\"\"Generic object into which we can stuff whichever attributes we want.\n \"\"\"\n pass",
" \"\"\"Generic object into which we can stuff whichever attribu... |
#!/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 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
"""
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 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
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... |
import os, sys, time
# usage: parse_log.py log-file [socket-index to focus on]
socket_filter = None
if len(sys.argv) >= 3:
socket_filter = sys.argv[2].strip()
if socket_filter == None:
print "scanning for socket with the most packets"
file = open(sys.argv[1], 'rb')
sockets = {}
for l in file:
... | [
[
1,
0,
0.5,
0.5,
0,
0.66,
0,
688,
0,
3,
0,
0,
688,
0,
0
]
] | [
"import os, sys, time"
] |
# -*- coding: utf-8 -*-
import os
from setuptools import setup, Library
from utp import VERSION
sources = [os.path.join("..", "utp.cpp"),
os.path.join("..", "utp_utils.cpp")]
include_dirs = ["..", os.path.join("..", "utp_config_lib")]
define_macros = []
libraries = []
extra_link_args = []
if os.name == "nt... | [
[
1,
0,
0.0417,
0.0208,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0625,
0.0208,
0,
0.66,
0.0909,
182,
0,
2,
0,
0,
182,
0,
0
],
[
1,
0,
0.1042,
0.0208,
0,
... | [
"import os",
"from setuptools import setup, Library",
"from utp import VERSION",
"sources = [os.path.join(\"..\", \"utp.cpp\"),\n os.path.join(\"..\", \"utp_utils.cpp\")]",
"include_dirs = [\"..\", os.path.join(\"..\", \"utp_config_lib\")]",
"define_macros = []",
"libraries = []",
"extra_lin... |
import os
import ctypes
import socket
import platform
from utp.utp_h import *
from utp.sockaddr_types import *
basepath = os.path.join(os.path.dirname(__file__), "..")
if platform.system() == "Windows":
utp = ctypes.cdll.LoadLibrary(os.path.join(basepath, "utp.dll"))
elif platform.system() == "Darwin":
utp = c... | [
[
1,
0,
0.0061,
0.0061,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0122,
0.0061,
0,
0.66,
0.0476,
182,
0,
1,
0,
0,
182,
0,
0
],
[
1,
0,
0.0183,
0.0061,
0,
... | [
"import os",
"import ctypes",
"import socket",
"import platform",
"from utp.utp_h import *",
"from utp.sockaddr_types import *",
"basepath = os.path.join(os.path.dirname(__file__), \"..\")",
"if platform.system() == \"Windows\":\n utp = ctypes.cdll.LoadLibrary(os.path.join(basepath, \"utp.dll\"))\n... |
# This module can go away when Python supports IPv6 (meaning inet_ntop and inet_pton on all platforms)
# http://bugs.python.org/issue7171
import socket
import ctypes
from utp.utp_socket import utp
# XXX: the exception types vary from socket.inet_ntop
def inet_ntop(address_family, packed_ip):
if address_f... | [
[
1,
0,
0.0833,
0.0208,
0,
0.66,
0,
687,
0,
1,
0,
0,
687,
0,
0
],
[
1,
0,
0.1042,
0.0208,
0,
0.66,
0.1667,
182,
0,
1,
0,
0,
182,
0,
0
],
[
1,
0,
0.125,
0.0208,
0,
0... | [
"import socket",
"import ctypes",
"from utp.utp_socket import utp",
"def inet_ntop(address_family, packed_ip):\n if address_family == socket.AF_INET:\n # The totals are derived from the following data:\n # 15: IPv4 address \n # 1: Terminating null byte\n length = 16\n ... |
import ctypes
from utp.sockaddr_types import *
# hork
if not hasattr(ctypes, "c_bool"):
ctypes.c_bool = ctypes.c_byte
# Lots of stuff which has to be kept in sync with utp.h...
# I wish ctypes had a C header parser.
UTP_STATE_CONNECT = 1
UTP_STATE_WRITABLE = 2
UTP_STATE_EOF = 3
UTP_STATE_DESTROYING = 4
# typed... | [
[
1,
0,
0.0196,
0.0196,
0,
0.66,
0,
182,
0,
1,
0,
0,
182,
0,
0
],
[
1,
0,
0.0392,
0.0196,
0,
0.66,
0.0667,
374,
0,
1,
0,
0,
374,
0,
0
],
[
4,
0,
0.1078,
0.0392,
0,
... | [
"import ctypes",
"from utp.sockaddr_types import *",
"if not hasattr(ctypes, \"c_bool\"):\n ctypes.c_bool = ctypes.c_byte",
" ctypes.c_bool = ctypes.c_byte",
"UTP_STATE_CONNECT = 1",
"UTP_STATE_WRITABLE = 2",
"UTP_STATE_EOF = 3",
"UTP_STATE_DESTROYING = 4",
"UTPOnReadProc = ctypes.CFUNCTYPE(No... |
VERSION = '0.1'
| [
[
14,
0,
1,
1,
0,
0.66,
0,
557,
1,
0,
0,
0,
0,
3,
0
]
] | [
"VERSION = '0.1'"
] |
import sys
import utp.utp_socket as utp
import types
import socket
from cStringIO import StringIO
from zope.interface import implements
from twisted.python import failure, log
from twisted.python.util import unsignedID
from twisted.internet import abstract, main, interfaces, error, base, task
from twisted.internet imp... | [
[
1,
0,
0.0019,
0.0019,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0039,
0.0019,
0,
0.66,
0.027,
579,
0,
1,
0,
0,
579,
0,
0
],
[
1,
0,
0.0058,
0.0019,
0,
0... | [
"import sys",
"import utp.utp_socket as utp",
"import types",
"import socket",
"from cStringIO import StringIO",
"from zope.interface import implements",
"from twisted.python import failure, log",
"from twisted.python.util import unsignedID",
"from twisted.internet import abstract, main, interfaces,... |
import ctypes
import socket
import struct
class SOCKADDR(ctypes.Structure):
_fields_ = (
('family', ctypes.c_ushort),
('data', ctypes.c_byte*14),
)
LPSOCKADDR = ctypes.POINTER(SOCKADDR)
class SOCKET_ADDRESS(ctypes.Structure):
_fields_ = (
('address', LPSOCKADDR),
('le... | [
[
1,
0,
0.0125,
0.0125,
0,
0.66,
0,
182,
0,
1,
0,
0,
182,
0,
0
],
[
1,
0,
0.025,
0.0125,
0,
0.66,
0.0476,
687,
0,
1,
0,
0,
687,
0,
0
],
[
1,
0,
0.0375,
0.0125,
0,
0... | [
"import ctypes",
"import socket",
"import struct",
"class SOCKADDR(ctypes.Structure):\n _fields_ = (\n ('family', ctypes.c_ushort),\n ('data', ctypes.c_byte*14),\n )",
" _fields_ = (\n ('family', ctypes.c_ushort),\n ('data', ctypes.c_byte*14),\n )",
"LPSOCKA... |
'''
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... |
#!/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... |
'''
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.79,
... | [
"'''\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 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
#Developed by Florin Nicusor Coada for 216 CR
#Based on the udp_chat_server2.py tutorial from professor Christopher Peters
import socket
HOST = '192.168.1.2' #Defaults to "this machine"
IPORT = 50007 #In
OPORT = 50008 #Out
in_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
... | [
[
1,
0,
0.0284,
0.0071,
0,
0.66,
0,
687,
0,
1,
0,
0,
687,
0,
0
],
[
14,
0,
0.0496,
0.0071,
0,
0.66,
0.0625,
180,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.0567,
0.0071,
0,
... | [
"import socket",
"HOST = '192.168.1.2' #Defaults to \"this machine\"",
"IPORT = 50007 #In",
"OPORT = 50008 #Out",
"in_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)",
"in_socket.bind((HOST, IPORT))",
"out_socket= socket.socket(socket.AF_INET, socket.SOCK_DGRAM)",
"users={}",
"def sendA... |
##Developed by Florin Nicusor Coada for 216CR
##Based on the tutorial offered by Christopher Peters
import sqlite3 as sqlite
import SimpleXMLRPCServer
##connect to the database and create a simple users table
con = sqlite.connect(":memory:")
con.execute("create table users(name varchar primary key, pass varchar, ban ... | [
[
1,
0,
0.0405,
0.0135,
0,
0.66,
0,
790,
0,
1,
0,
0,
790,
0,
0
],
[
1,
0,
0.0541,
0.0135,
0,
0.66,
0.0714,
73,
0,
1,
0,
0,
73,
0,
0
],
[
14,
0,
0.0946,
0.0135,
0,
0... | [
"import sqlite3 as sqlite",
"import SimpleXMLRPCServer",
"con = sqlite.connect(\":memory:\")",
"con.execute(\"create table users(name varchar primary key, pass varchar, ban integer, admin integer)\")",
"cur=con.cursor()",
"cur.execute(\"insert into users values ('Florin','cocouta',0,1)\")",
"cur.execute... |
#!/usr/bin/python
#Developed by Florin Nicusor Coada for 216 CR
#Based on the udp_chat_client2.py tutorial from professor Christopher Peters
from Tkinter import *
import socket,select
from login import *
import sys
HOST = '192.168.1.2' #Server
OPORT = 50007 # The same port as used by the server
IPORT=50008 #Listeni... | [
[
1,
0,
0.0244,
0.0061,
0,
0.66,
0,
368,
0,
1,
0,
0,
368,
0,
0
],
[
1,
0,
0.0305,
0.0061,
0,
0.66,
0.0526,
687,
0,
2,
0,
0,
687,
0,
0
],
[
1,
0,
0.0366,
0.0061,
0,
... | [
"from Tkinter import *",
"import socket,select",
"from login import *",
"import sys",
"HOST = '192.168.1.2' #Server",
"OPORT = 50007 # The same port as used by the server",
"IPORT=50008 #Listening port",
"out_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)",
"in_socket = socket.socket(s... |
from Tkinter import *
import xmlrpclib
from time import clock, time
server = xmlrpclib.ServerProxy("http://192.168.1.2:8888")
def userType(user):
return server.userType(user)
def newName(oldUname,newUname):
return server.newName(oldUname,newUname)
def banUser(name):
server.banUser(name)
class MyDetails... | [
[
1,
0,
0.0052,
0.0052,
0,
0.66,
0,
368,
0,
1,
0,
0,
368,
0,
0
],
[
1,
0,
0.0104,
0.0052,
0,
0.66,
0.1,
251,
0,
1,
0,
0,
251,
0,
0
],
[
1,
0,
0.0156,
0.0052,
0,
0.6... | [
"from Tkinter import *",
"import xmlrpclib",
"from time import clock, time",
"server = xmlrpclib.ServerProxy(\"http://192.168.1.2:8888\")",
"def userType(user):\n return server.userType(user)",
" return server.userType(user)",
"def newName(oldUname,newUname):\n return server.newName(oldUname,ne... |
# This is Python example on how to use Mongoose embeddable web server,
# http://code.google.com/p/mongoose
#
# Before using the mongoose module, make sure that Mongoose shared library is
# built and present in the current (or system library) directory
import mongoose
import sys
# Handle /show and /form URIs.
def Even... | [
[
1,
0,
0.1129,
0.0161,
0,
0.66,
0,
755,
0,
1,
0,
0,
755,
0,
0
],
[
1,
0,
0.129,
0.0161,
0,
0.66,
0.1667,
509,
0,
1,
0,
0,
509,
0,
0
],
[
2,
0,
0.4597,
0.5806,
0,
0... | [
"import mongoose",
"import sys",
"def EventHandler(event, conn, info):\n if event == mongoose.HTTP_ERROR:\n conn.printf('%s', 'HTTP/1.0 200 OK\\r\\n')\n conn.printf('%s', 'Content-Type: text/plain\\r\\n\\r\\n')\n conn.printf('HTTP error: %d\\n', info.status_code)\n return True\n ... |
# Copyright (c) 2004-2009 Sergey Lyubka
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publ... | [
[
8,
0,
0.1855,
0.0881,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2453,
0.0063,
0,
0.66,
0.0909,
182,
0,
1,
0,
0,
182,
0,
0
],
[
1,
0,
0.2516,
0.0063,
0,
0.66... | [
"\"\"\"\nThis module provides python binding for the Mongoose web server.\n\nThere are two classes defined:\n\n Connection: - wraps all functions that accept struct mg_connection pointer\n as first argument.",
"import ctypes",
"import os",
"NEW_REQUEST = 0",
"HTTP_ERROR = 1",
"EVENT_LOG = 2",
"INIT_... |
'''
Created on 30/03/2011
@author: Eran_Z
Utilities
'''
def sum(x,y):
return x+y
| [
[
8,
0,
0.3636,
0.6364,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
2,
0,
0.8636,
0.1818,
0,
0.66,
1,
824,
0,
2,
1,
0,
0,
0,
0
],
[
13,
1,
0.9091,
0.0909,
1,
0.59,
... | [
"'''\nCreated on 30/03/2011\n\n@author: Eran_Z\n\nUtilities\n'''",
"def sum(x,y):\n return x+y",
" return x+y"
] |
'''
Created on 08/04/2011
@author: Eran_Z
Google search (num results), based on Dima's implementation
currently uses deprecated API
'''
import json
import urllib
#N = 25270000000L #25.27 billion, roughly google's index size. Should be reduced for other engines.
N = 1870000000L #roughly the index of the... | [
[
8,
0,
0.1731,
0.3077,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.3846,
0.0385,
0,
0.66,
0.3333,
463,
0,
1,
0,
0,
463,
0,
0
],
[
1,
0,
0.4231,
0.0385,
0,
0.66... | [
"'''\nCreated on 08/04/2011\n\n@author: Eran_Z\n\nGoogle search (num results), based on Dima's implementation\ncurrently uses deprecated API\n'''",
"import json",
"import urllib",
"def showsome(searchfor):\n query = urllib.urlencode({'q': searchfor})\n \n url = 'http://ajax.googleapis.com/ajax/servic... |
'''
Created on 29/03/2011
@author: Eran_Z
Weighting
'''
import search_m
from util_m import sum
from math import log
#Helper functions
def __singleNGDWeight(term1, term2):
return 0 if term1 == term2 else max(0, 1 - search_m.NGD(term1, term2))
def __singleMutualInformationWeight(term1, term2):
... | [
[
8,
0,
0.069,
0.1207,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1552,
0.0172,
0,
0.66,
0.0714,
784,
0,
1,
0,
0,
784,
0,
0
],
[
1,
0,
0.1724,
0.0172,
0,
0.66,... | [
"'''\nCreated on 29/03/2011\n\n@author: Eran_Z\n\nWeighting\n'''",
"import search_m",
"from util_m import sum",
"from math import log",
"def __singleNGDWeight(term1, term2):\n return 0 if term1 == term2 else max(0, 1 - search_m.NGD(term1, term2))",
" return 0 if term1 == term2 else max(0, 1 - search... |
import json
import urllib
def showsome(searchfor):
query = urllib.urlencode({'q': searchfor})
url = 'http://ajax.googleapis.com/ajax/services/search/web?v=1.0&%s'%query
search_response = urllib.urlopen(url)
search_results = search_response.read()
results = json.loads(search_results)
... | [
[
1,
0,
0.0588,
0.0588,
0,
0.66,
0,
463,
0,
1,
0,
0,
463,
0,
0
],
[
1,
0,
0.1176,
0.0588,
0,
0.66,
0.25,
614,
0,
1,
0,
0,
614,
0,
0
],
[
2,
0,
0.5294,
0.6471,
0,
0.... | [
"import json",
"import urllib",
"def showsome(searchfor):\n query = urllib.urlencode({'q': searchfor})\n \n url = 'http://ajax.googleapis.com/ajax/services/search/web?v=1.0&%s'%query\n search_response = urllib.urlopen(url)\n search_results = search_response.read()\n results = json.loads(search... |
from apiclient.discovery import build
def search(searchfor):
service = build("customsearch", "v1",
developerKey="AIzaSyB1KoWaQxP9_o--plv19-JYDevfdhKFzjs")
res = service.cse().list(
q=searchfor,
cx='017576662512468239146:omuauf_lfve',
).execute()
ret = res['queries'][... | [
[
1,
0,
0.1765,
0.0588,
0,
0.66,
0,
78,
0,
1,
0,
0,
78,
0,
0
],
[
2,
0,
0.4706,
0.5294,
0,
0.66,
0.3333,
163,
0,
1,
1,
0,
0,
0,
4
],
[
14,
1,
0.3235,
0.1176,
1,
0.0... | [
"from apiclient.discovery import build",
"def search(searchfor):\n service = build(\"customsearch\", \"v1\",\n developerKey=\"AIzaSyB1KoWaQxP9_o--plv19-JYDevfdhKFzjs\")\n res = service.cse().list(\n q=searchfor,\n cx='017576662512468239146:omuauf_lfve',\n ).execute()\n ret = res[... |
# Copyright (C) 2010 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 writ... | [
[
8,
0,
0.2,
0.0588,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2353,
0.0118,
0,
0.66,
0.1,
439,
0,
1,
0,
0,
439,
0,
0
],
[
14,
0,
0.2588,
0.0118,
0,
0.66,
... | [
"\"\"\"Setup script for Google API Python client.\n\nAlso installs included versions of third party libraries, if those libraries\nare not already installed.\n\"\"\"",
"import setup_utils",
"has_setuptools = False",
"try:\n from setuptools import setup\n has_setuptools = True\nexcept ImportError:\n from di... |
"""
The MIT License
Copyright (c) 2007-2010 Leah Culver, Joe Stump, Mark Paschal, Vic Fryzel
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the ... | [
[
8,
0,
0.0163,
0.0313,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.034,
0.0014,
0,
0.66,
0.0357,
614,
0,
1,
0,
0,
614,
0,
0
],
[
1,
0,
0.0354,
0.0014,
0,
0.66,... | [
"\"\"\"\nThe MIT License\n\nCopyright (c) 2007-2010 Leah Culver, Joe Stump, Mark Paschal, Vic Fryzel\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including withou... |
"""
The MIT License
Copyright (c) 2007-2010 Leah Culver, Joe Stump, Mark Paschal, Vic Fryzel
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the ... | [
[
8,
0,
0.3,
0.575,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.625,
0.025,
0,
0.66,
0.3333,
311,
0,
1,
0,
0,
311,
0,
0
],
[
1,
0,
0.65,
0.025,
0,
0.66,
0.6... | [
"\"\"\"\nThe MIT License\n\nCopyright (c) 2007-2010 Leah Culver, Joe Stump, Mark Paschal, Vic Fryzel\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including withou... |
"""
The MIT License
Copyright (c) 2007-2010 Leah Culver, Joe Stump, Mark Paschal, Vic Fryzel
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the ... | [
[
8,
0,
0.2927,
0.561,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.6098,
0.0244,
0,
0.66,
0.25,
311,
0,
1,
0,
0,
311,
0,
0
],
[
1,
0,
0.6341,
0.0244,
0,
0.66,
... | [
"\"\"\"\nThe MIT License\n\nCopyright (c) 2007-2010 Leah Culver, Joe Stump, Mark Paschal, Vic Fryzel\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including withou... |
# Copyright (C) 2011 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 writ... | [
[
1,
0,
0.5769,
0.0385,
0,
0.66,
0,
182,
0,
1,
0,
0,
182,
0,
0
],
[
8,
0,
0.8269,
0.3846,
0,
0.66,
1,
234,
3,
9,
0,
0,
0,
0,
1
]
] | [
"from setuptools import setup",
"setup(name='oauth2client',\n version='1.0beta1',\n description='Google OAuth 2.0 Client Libary for Python',\n license='Apache 2.0',\n author='Google Inc.',\n packages = ['oauth2client'],\n package_dir = {'': '..'},\n author_email='jcgregorio@goog... |
# Copyright 2010 Google Inc. All Rights Reserved.
"""An OAuth 2.0 client
Tools for interacting with OAuth 2.0 protected
resources.
"""
__author__ = '[email protected] (Joe Gregorio)'
import copy
import datetime
import httplib2
import logging
import urllib
import urlparse
try: # pragma: no cover
import simple... | [
[
8,
0,
0.0113,
0.0113,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0203,
0.0023,
0,
0.66,
0.05,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.0248,
0.0023,
0,
0.66,
... | [
"\"\"\"An OAuth 2.0 client\n\nTools for interacting with OAuth 2.0 protected\nresources.\n\"\"\"",
"__author__ = '[email protected] (Joe Gregorio)'",
"import copy",
"import datetime",
"import httplib2",
"import logging",
"import urllib",
"import urlparse",
"try: # pragma: no cover\n import simp... |
# Copyright 2010 Google Inc. All Rights Reserved.
"""Utilities for OAuth.
Utilities for making it easier to work with OAuth 2.0
credentials.
"""
__author__ = '[email protected] (Joe Gregorio)'
import pickle
import threading
from client import Storage as BaseStorage
class Storage(BaseStorage):
"""Store and ... | [
[
8,
0,
0.0962,
0.0962,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.1731,
0.0192,
0,
0.66,
0.2,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.2115,
0.0192,
0,
0.66,
... | [
"\"\"\"Utilities for OAuth.\n\nUtilities for making it easier to work with OAuth 2.0\ncredentials.\n\"\"\"",
"__author__ = '[email protected] (Joe Gregorio)'",
"import pickle",
"import threading",
"from client import Storage as BaseStorage",
"class Storage(BaseStorage):\n \"\"\"Store and retrieve a s... |
# Copyright 2010 Google Inc. All Rights Reserved.
"""OAuth 2.0 utilities for Django.
Utilities for using OAuth 2.0 in conjunction with
the Django datastore.
"""
__author__ = '[email protected] (Joe Gregorio)'
import oauth2client
import base64
import pickle
from django.db import models
from oauth2client.client ... | [
[
8,
0,
0.049,
0.049,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0882,
0.0098,
0,
0.66,
0.1111,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.1078,
0.0098,
0,
0.66,
... | [
"\"\"\"OAuth 2.0 utilities for Django.\n\nUtilities for using OAuth 2.0 in conjunction with\nthe Django datastore.\n\"\"\"",
"__author__ = '[email protected] (Joe Gregorio)'",
"import oauth2client",
"import base64",
"import pickle",
"from django.db import models",
"from oauth2client.client import St... |
# Copyright (C) 2010 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 writ... | [
[
8,
0,
0.1204,
0.0292,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.146,
0.0073,
0,
0.66,
0.1111,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.1606,
0.0073,
0,
0.66,
... | [
"\"\"\"Utilities for Google App Engine\n\nUtilities for making it easier to use OAuth 2.0 on Google App Engine.\n\"\"\"",
"__author__ = '[email protected] (Joe Gregorio)'",
"import pickle",
"from google.appengine.ext import db",
"from client import Credentials",
"from client import Flow",
"from clie... |
# Copyright (C) 2010 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 writ... | [
[
8,
0,
0.2885,
0.0192,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.3462,
0.0192,
0,
0.66,
0.3333,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.3846,
0.0192,
0,
0.66,... | [
"\"\"\"Utility functions for setup.py file(s).\"\"\"",
"__author__ = '[email protected] (Tom Miller)'",
"import sys",
"def is_missing(packages):\n \"\"\"Return True if a package can't be imported.\"\"\"\n\n retval = True\n sys_path_original = sys.path[:]\n # Remove the current directory from the list... |
#!/usr/bin/python2.4
#
# Copyright 2010 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 o... | [
[
8,
0,
0.1121,
0.023,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.1322,
0.0057,
0,
0.66,
0.0625,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.1437,
0.0057,
0,
0.66,
... | [
"\"\"\"Discovery document tests\n\nUnit tests for objects created from discovery documents.\n\"\"\"",
"__author__ = '[email protected] (Joe Gregorio)'",
"import httplib2",
"import unittest",
"import urlparse",
"try:\n from urlparse import parse_qs\nexcept ImportError:\n from cgi import parse_qs"... |
#!/usr/bin/python2.4
#
# Copyright 2010 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 o... | [
[
8,
0,
0.2011,
0.023,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.2299,
0.0115,
0,
0.66,
0.1429,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.2644,
0.0115,
0,
0.66,
... | [
"\"\"\"Tests for errors handling\n\"\"\"",
"__author__ = '[email protected] (Ali Afshar)'",
"import unittest",
"import httplib2",
"from apiclient.errors import HttpError",
"JSON_ERROR_CONTENT = \"\"\"\n{\n \"error\": {\n \"errors\": [\n {\n \"domain\": \"global\",\n \"reason\": \"required\",\n ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.