rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
log.init("gtfsdb")
def __init__(self, sqlite_filename, overwrite=False): log.init("gtfsdb") self.dbname = sqlite_filename if overwrite: try: os.remove(sqlite_filename) except: pass self.conn = sqlite3.connect( sqlite_filename )
5cb3ca89a5d953aecb773f70f7f2f38a1f5a8b85 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10974/5cb3ca89a5d953aecb773f70f7f2f38a1f5a8b85/gtfsdb.py
log.debug( "skipping table %s - not included in 'tables' list"%tablename )
print( "skipping table %s - not included in 'tables' list"%tablename )
for tablename, table_def in self.GTFS_DEF: if tables is not None and tablename not in tables: log.debug( "skipping table %s - not included in 'tables' list"%tablename ) continue
5cb3ca89a5d953aecb773f70f7f2f38a1f5a8b85 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10974/5cb3ca89a5d953aecb773f70f7f2f38a1f5a8b85/gtfsdb.py
log.debug( "creating table %s\n"%tablename )
print( "creating table %s\n"%tablename )
for tablename, table_def in self.GTFS_DEF: if tables is not None and tablename not in tables: log.debug( "skipping table %s - not included in 'tables' list"%tablename ) continue
5cb3ca89a5d953aecb773f70f7f2f38a1f5a8b85 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10974/5cb3ca89a5d953aecb773f70f7f2f38a1f5a8b85/gtfsdb.py
log.debug( "loading table %s\n"%tablename )
print( "loading table %s\n"%tablename )
create_table( c, tablename, table_def )
5cb3ca89a5d953aecb773f70f7f2f38a1f5a8b85 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10974/5cb3ca89a5d953aecb773f70f7f2f38a1f5a8b85/gtfsdb.py
log.debug( "NOTICE: GTFS feed has no file %s.txt, cannot load\n"%tablename )
print( "NOTICE: GTFS feed has no file %s.txt, cannot load\n"%tablename )
create_table( c, tablename, table_def )
5cb3ca89a5d953aecb773f70f7f2f38a1f5a8b85 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10974/5cb3ca89a5d953aecb773f70f7f2f38a1f5a8b85/gtfsdb.py
log.debug("usage: python gtfsdb.py gtfsdb_filename [query]")
print("usage: python gtfsdb.py gtfsdb_filename [query]")
def main_inspect_gtfsdb(): from sys import argv if len(argv) < 2: log.debug("usage: python gtfsdb.py gtfsdb_filename [query]") exit() gtfsdb_filename = argv[1] gtfsdb = GTFSDatabase( gtfsdb_filename ) if len(argv) == 2: for table_name, fields in gtfsdb.GTFS_DEF: log.debug("Table: %s"%table_name) for field_name, fiel...
5cb3ca89a5d953aecb773f70f7f2f38a1f5a8b85 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10974/5cb3ca89a5d953aecb773f70f7f2f38a1f5a8b85/gtfsdb.py
log.debug("Table: %s"%table_name)
print("Table: %s"%table_name)
def main_inspect_gtfsdb(): from sys import argv if len(argv) < 2: log.debug("usage: python gtfsdb.py gtfsdb_filename [query]") exit() gtfsdb_filename = argv[1] gtfsdb = GTFSDatabase( gtfsdb_filename ) if len(argv) == 2: for table_name, fields in gtfsdb.GTFS_DEF: log.debug("Table: %s"%table_name) for field_name, fiel...
5cb3ca89a5d953aecb773f70f7f2f38a1f5a8b85 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10974/5cb3ca89a5d953aecb773f70f7f2f38a1f5a8b85/gtfsdb.py
log.debug("\t%s %s"%(field_type, field_name))
print("\t%s %s"%(field_type, field_name))
def main_inspect_gtfsdb(): from sys import argv if len(argv) < 2: log.debug("usage: python gtfsdb.py gtfsdb_filename [query]") exit() gtfsdb_filename = argv[1] gtfsdb = GTFSDatabase( gtfsdb_filename ) if len(argv) == 2: for table_name, fields in gtfsdb.GTFS_DEF: log.debug("Table: %s"%table_name) for field_name, fiel...
5cb3ca89a5d953aecb773f70f7f2f38a1f5a8b85 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10974/5cb3ca89a5d953aecb773f70f7f2f38a1f5a8b85/gtfsdb.py
log.debug(record)
print(record)
def main_inspect_gtfsdb(): from sys import argv if len(argv) < 2: log.debug("usage: python gtfsdb.py gtfsdb_filename [query]") exit() gtfsdb_filename = argv[1] gtfsdb = GTFSDatabase( gtfsdb_filename ) if len(argv) == 2: for table_name, fields in gtfsdb.GTFS_DEF: log.debug("Table: %s"%table_name) for field_name, fiel...
5cb3ca89a5d953aecb773f70f7f2f38a1f5a8b85 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10974/5cb3ca89a5d953aecb773f70f7f2f38a1f5a8b85/gtfsdb.py
def main_inspect_gtfsdb(): from sys import argv if len(argv) < 2: log.debug("usage: python gtfsdb.py gtfsdb_filename [query]") exit() gtfsdb_filename = argv[1] gtfsdb = GTFSDatabase( gtfsdb_filename ) if len(argv) == 2: for table_name, fields in gtfsdb.GTFS_DEF: log.debug("Table: %s"%table_name) for field_name, fiel...
5cb3ca89a5d953aecb773f70f7f2f38a1f5a8b85 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10974/5cb3ca89a5d953aecb773f70f7f2f38a1f5a8b85/gtfsdb.py
def main_inspect_gtfsdb(): from sys import argv if len(argv) < 2: log.debug("usage: python gtfsdb.py gtfsdb_filename [query]") exit() gtfsdb_filename = argv[1] gtfsdb = GTFSDatabase( gtfsdb_filename ) if len(argv) == 2: for table_name, fields in gtfsdb.GTFS_DEF: log.debug("Table: %s"%table_name) for field_name, fiel...
5cb3ca89a5d953aecb773f70f7f2f38a1f5a8b85 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10974/5cb3ca89a5d953aecb773f70f7f2f38a1f5a8b85/gtfsdb.py
def main_inspect_gtfsdb(): from sys import argv if len(argv) < 2: log.debug("usage: python gtfsdb.py gtfsdb_filename [query]") exit() gtfsdb_filename = argv[1] gtfsdb = GTFSDatabase( gtfsdb_filename ) if len(argv) == 2: for table_name, fields in gtfsdb.GTFS_DEF: log.debug("Table: %s"%table_name) for field_name, fiel...
5cb3ca89a5d953aecb773f70f7f2f38a1f5a8b85 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10974/5cb3ca89a5d953aecb773f70f7f2f38a1f5a8b85/gtfsdb.py
log.debug("Converts GTFS file to GTFS-DB, which is super handy\nusage: python process_gtfs.py gtfs_filename gtfsdb_filename")
print("Converts GTFS file to GTFS-DB, which is super handy\nusage: python process_gtfs.py gtfs_filename gtfsdb_filename")
def main_build_gtfsdb(): parser = OptionParser() parser.add_option("-t", "--table", dest="tables", action="append", default=[], help="copy over only the given tables") parser.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False, help="make a bunch of noise" ) (options, args) = parser.parse_...
5cb3ca89a5d953aecb773f70f7f2f38a1f5a8b85 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10974/5cb3ca89a5d953aecb773f70f7f2f38a1f5a8b85/gtfsdb.py
resource_count = list(c.execute( "SELECT count(*) FROM resources WHERE name = ?", (name,) ))[0][0]
resource_count = list(cc.execute( "SELECT count(*) FROM resources WHERE name = ?", (name,) ))[0][0]
def store(self, name, obj, c=None): cc = self.conn.cursor() if c is None else c resource_count = list(c.execute( "SELECT count(*) FROM resources WHERE name = ?", (name,) ))[0][0] if resource_count == 0: cc.execute( "INSERT INTO resources VALUES (?, ?)", (name, cPickle.dumps( obj )) ) if not c: self.conn.commit() if not...
64752f54b6e9904860e4d1fa29d3b25fddbe125e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10974/64752f54b6e9904860e4d1fa29d3b25fddbe125e/graphdb.py
(lgs.cpSoul, c_void_p, [LGSTypes.CustomPayload]),
(lgs.cpSoul, py_object, [LGSTypes.CustomPayload]),
def _declare(fun, restype, argtypes): fun.argtypes = argtypes fun.restype = restype fun.safe = True
c747c96ad1aae59d28dc714d89ab133e52926e01 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10974/c747c96ad1aae59d28dc714d89ab133e52926e01/gsdll.py
"""Represents a path of vertics and edges as returned by ShortestPathTree.path()"""
"""Represents a path of vertices and edges as returned by ShortestPathTree.path()"""
def walk_back(self, state, walk_options): return State.from_pointer(self._cwalk_back(self.soul, state.soul, walk_options.soul))
644bc81cd52baf3e2a5402e8a9f7f1db382b1ed2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10974/644bc81cd52baf3e2a5402e8a9f7f1db382b1ed2/core.py
lgs.vecExpand( addressof(address), amount )
lgs.vecExpand( addressof(self), amount )
def expand(self, amount): lgs.vecExpand( addressof(address), amount )
5ecacea63b31c48e5d6b3ce0c99a4a9b8a78ca53 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10974/5ecacea63b31c48e5d6b3ce0c99a4a9b8a78ca53/vector.py
lgs.vecAdd( addressof(address), element )
lgs.vecAdd( addressof(self), element )
def add(self, element): lgs.vecAdd( addressof(address), element )
5ecacea63b31c48e5d6b3ce0c99a4a9b8a78ca53 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10974/5ecacea63b31c48e5d6b3ce0c99a4a9b8a78ca53/vector.py
if min_transfer_time == None:
if min_transfer_time in ("", None):
def gtfsdb_to_transfer_edges( self ): # load transfers if self.reporter: self.reporter.write( "Loading transfers to graph...\n" ) # keep track to avoid redundancies # this assumes that transfer relationships are bi-directional. # TODO this implementation is also incomplete - it's theoretically possible that # a trans...
59246a369c0de6c1cb36084b75fc82153e20899d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10974/59246a369c0de6c1cb36084b75fc82153e20899d/gdb_import_gtfs.py
yield (s1, s2, ElapseTime(min_transfer_time)) yield (s2, s1, ElapseTime(min_transfer_time))
yield (s1, s2, ElapseTime(int(min_transfer_time))) yield (s2, s1, ElapseTime(int(min_transfer_time)))
def gtfsdb_to_transfer_edges( self ): # load transfers if self.reporter: self.reporter.write( "Loading transfers to graph...\n" ) # keep track to avoid redundancies # this assumes that transfer relationships are bi-directional. # TODO this implementation is also incomplete - it's theoretically possible that # a trans...
59246a369c0de6c1cb36084b75fc82153e20899d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10974/59246a369c0de6c1cb36084b75fc82153e20899d/gdb_import_gtfs.py
yield (s1, s2, ElapseTime(min_transfer_time)) yield (s2, s1, ElapseTime(min_transfer_time))
yield (s1, s2, int(ElapseTime(min_transfer_time))) yield (s2, s1, int(ElapseTime(min_transfer_time)))
def gtfsdb_to_transfer_edges( self ): # load transfers if self.reporter: self.reporter.write( "Loading transfers to graph...\n" ) # keep track to avoid redundancies # this assumes that transfer relationships are bi-directional. # TODO this implementation is also incomplete - it's theoretically possible that # a trans...
59246a369c0de6c1cb36084b75fc82153e20899d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10974/59246a369c0de6c1cb36084b75fc82153e20899d/gdb_import_gtfs.py
assert False, "Support for no-transfer (transfers.txt transfer_type=3) not implemented."
print "WARNING: Support for no-transfer (transfers.txt transfer_type=3) not implemented."
def gtfsdb_to_transfer_edges( self ): # load transfers if self.reporter: self.reporter.write( "Loading transfers to graph...\n" ) # keep track to avoid redundancies # this assumes that transfer relationships are bi-directional. # TODO this implementation is also incomplete - it's theoretically possible that # a trans...
59246a369c0de6c1cb36084b75fc82153e20899d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10974/59246a369c0de6c1cb36084b75fc82153e20899d/gdb_import_gtfs.py
c.execute( "INSERT INTO edges VALUES (?, ?, ?, ?)", (from_v_label, to_v_label, cPickle.dumps( payload.__class__ ), cPickle.dumps( payload.__getstate__() ) ) )
epid = self.put_edge_payload( payload, c ) c.execute( "INSERT INTO edges VALUES (?, ?, ?)", (from_v_label, to_v_label, epid) )
def add_edge(self, from_v_label, to_v_label, payload, outside_c=None): c = outside_c or self.conn.cursor() c.execute( "INSERT INTO edges VALUES (?, ?, ?, ?)", (from_v_label, to_v_label, cPickle.dumps( payload.__class__ ), cPickle.dumps( payload.__getstate__() ) ) ) if hasattr(payload, "__resources__"): for name, reso...
d28e32c744b1d3047aa5404876392eb8aa3b1593 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10974/d28e32c744b1d3047aa5404876392eb8aa3b1593/graphdb.py
def add_edge(self, from_v_label, to_v_label, payload, outside_c=None): c = outside_c or self.conn.cursor() c.execute( "INSERT INTO edges VALUES (?, ?, ?, ?)", (from_v_label, to_v_label, cPickle.dumps( payload.__class__ ), cPickle.dumps( payload.__getstate__() ) ) ) if hasattr(payload, "__resources__"): for name, reso...
d28e32c744b1d3047aa5404876392eb8aa3b1593 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10974/d28e32c744b1d3047aa5404876392eb8aa3b1593/graphdb.py
if vertex_soul == NULL:
if vertex_soul is None:
def getVertex( self, i ): vertex_soul = lgs.pathGetVertex( addressof(self), i ) # reinterpret the error code as an exception if vertex_soul == NULL: raise IndexError("%d is out of bounds"%i) return Vertex.from_pointer( vertex_soul )
3a2d42a888882e42b5836b86138db74f440e1669 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10974/3a2d42a888882e42b5836b86138db74f440e1669/core.py
if edge_soul == NULL:
if edge_soul is None:
def getEdge( self, i ): edge_soul = lgs.pathGetEdge( addressof(self), i ) # reinterpret the error code as an exception if edge_soul == NULL: raise IndexError("%d is out of bounds"%i) return Edge.from_pointer( edge_soul )
3a2d42a888882e42b5836b86138db74f440e1669 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10974/3a2d42a888882e42b5836b86138db74f440e1669/core.py
return edge is not None and isinstance(edge.state, graphserver.core.TripAlight)
return edge is not None and isinstance(edge.payload, graphserver.core.TripAlight)
def applies_to(vertex1, edge, vertex2): return edge is not None and isinstance(edge.state, graphserver.core.TripAlight)
55d5cb5d18365c102f83f25f851d636df5412c34 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10974/55d5cb5d18365c102f83f25f851d636df5412c34/events.py
count = c_int()
count = c_long()
def vertices(self): self.check_destroyed() count = c_int() p_va = lgs.gVertices(self.soul, byref(count)) verts = [] arr = cast(p_va, POINTER(c_void_p)) # a bit of necessary voodoo for i in range(count.value): v = Vertex.from_pointer(arr[i]) verts.append(v) del arr libc.free(p_va) return verts
6582f76e45adde4ea42317979cb2af9dc8338a90 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10974/6582f76e45adde4ea42317979cb2af9dc8338a90/core.py
main()
def main(): usage = """usage: python dedupe.py <graphdb_filename>""" parser = OptionParser(usage=usage) (options, args) = parser.parse_args() if len(args) != 1: parser.print_help() exit(-1) graphdb_filename = args[0] gtfsdb = GTFSDatabase( graphdb_filename ) query = """ SELECT count(*), monday, tuesday, wednesday,...
9b93c2d1a2a43214111732bac71c6636904d5a7a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10974/9b93c2d1a2a43214111732bac71c6636904d5a7a/dedupe.py
(lgs.gAddVertices, None, [LGSTypes.Graph, c_char_p, c_int]),
(lgs.gAddVertices, None, [LGSTypes.Graph, POINTER(c_char_p), c_int]),
def _declare(fun, restype, argtypes): fun.argtypes = argtypes fun.restype = restype fun.safe = True
f05b05f46a934a2a26785d903bebb564bf84108d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/10974/f05b05f46a934a2a26785d903bebb564bf84108d/gsdll.py
self.b *= 1.0 / sqrt(sqmag(self.b))
self.b.x *= 1.0 / sqrt(sqmag(self.b.x))
def normalize(self): self.b *= 1.0 / sqrt(sqmag(self.b))
53018d8b44f27cdbc35ddd4966cb5ffd385b5659 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9024/53018d8b44f27cdbc35ddd4966cb5ffd385b5659/basic.py
img = hg.cvQueryFrame(self.cap)
img = hg.cvRetrieveFrame(self.cap)
def frame(self): if self.framepos == -1: raise Exception('call next before the first frame!') format = self.format img = hg.cvQueryFrame(self.cap) nchannels = 1 if format == FORMAT_GRAY else 3 shape = \ (img.height, img.width) if nchannels == 1 else \ (img.height, img.width, nchannels) if format == FORMAT_BGR: # defa...
3c2eb0284eb932895a410c534f4c2000cc1eefc3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9024/3c2eb0284eb932895a410c534f4c2000cc1eefc3/video.py
def __init__(self, *args):
def __init__(self, fname, format=FORMAT_RGB):
def __init__(self, *args): self.create_capture = hg.cvCreateFileCapture super(video_file, self).__init__(*args)
3c2eb0284eb932895a410c534f4c2000cc1eefc3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9024/3c2eb0284eb932895a410c534f4c2000cc1eefc3/video.py
super(video_file, self).__init__(*args)
super(video_file, self).__init__(format, fname)
def __init__(self, *args): self.create_capture = hg.cvCreateFileCapture super(video_file, self).__init__(*args)
3c2eb0284eb932895a410c534f4c2000cc1eefc3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9024/3c2eb0284eb932895a410c534f4c2000cc1eefc3/video.py
def seek(self, pos): #if pos < self.pos: # self._destr_cap() # self._init_cap() if pos < self.pos: hg.cvSetCaptureProperty(self.cap, hg.CV_CAP_PROP_POS_FRAMES, 0.0) self.framepos = -1 return super(video_file, self).seek(pos)
3c2eb0284eb932895a410c534f4c2000cc1eefc3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9024/3c2eb0284eb932895a410c534f4c2000cc1eefc3/video.py
if pos < self.pos:
if pos < self.framepos:
def seek(self, pos): #if pos < self.pos: # self._destr_cap() # self._init_cap() if pos < self.pos: hg.cvSetCaptureProperty(self.cap, hg.CV_CAP_PROP_POS_FRAMES, 0.0) self.framepos = -1 return super(video_file, self).seek(pos)
3c2eb0284eb932895a410c534f4c2000cc1eefc3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9024/3c2eb0284eb932895a410c534f4c2000cc1eefc3/video.py
def correlate(input, kernel, output=None, accumulate=False): out_shape = tuple(np.subtract(input.shape, kernel.shape) + 1) if output is None: output = np.zeros(out_shape, input.dtype) assert (out_shape == output.shape), "shapes don't match" uin = input for d, kd in enumerate(kernel.shape): uin = unfold(uin, d, kd, 1) ...
pass def gen_correlate_scipy(input, kernel, output=None, accumulate=False): y = sig_correlate(input, kernel, 'valid') if output is None: output = y elif accumulate: output += y else: output[:] = y return output def gen_correlate_noscipy(input, kernel, output=None, accumulate=False): out_shape = tu...
def correlate(input, kernel, output=None, accumulate=False): y = sig_correlate(input, kernel, 'valid') if output is None: output = y elif accumulate: output += y else: output[:] = y return output
72d4921d303ee247f2e66d731b4d8524ea4e9c94 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9024/72d4921d303ee247f2e66d731b4d8524ea4e9c94/correlate.py
def seek(self, pos): #if pos < self.framepos: # self._destr_cap() # self._init_cap() if pos < self.framepos: hg.cvSetCaptureProperty(self.cap, hg.CV_CAP_PROP_POS_FRAMES, 0.0) self.framepos = -1 return super(video_file, self).seek(pos)
87c38f9a963be0f23dde2f92cfc156fb752bd2c6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9024/87c38f9a963be0f23dde2f92cfc156fb752bd2c6/video.py
if pos < self.framepos:
if pos <= self.framepos:
def seek(self, pos): #if pos < self.framepos: # self._destr_cap() # self._init_cap() if pos < self.framepos: hg.cvSetCaptureProperty(self.cap, hg.CV_CAP_PROP_POS_FRAMES, 0.0) self.framepos = -1 return super(video_file, self).seek(pos)
87c38f9a963be0f23dde2f92cfc156fb752bd2c6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9024/87c38f9a963be0f23dde2f92cfc156fb752bd2c6/video.py
self.tbl_jik = sp.asarray([(b,a,k) for (k,(a,b)) in e(conn_table)], int)
self.tbl_jik = sp.asarray([(b,a,k) for (k,(a,b)) in e(conn_table)], 'i')
def __init__(self, kernel_shape, conn_table): super(back_convolution, self).__init__(kernel_shape, conn_table)
5c7afa7f1c91b21b629ff8dc2906996fa39500dd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9024/5c7afa7f1c91b21b629ff8dc2906996fa39500dd/basic.py
def _step_direction(self, p):
def _perform_step(self, p, grad, coeff): states = p.states for (g, state) in zip(grad,states): state.x += coeff * g def _step_direction(self, p, dostep = True):
def iterstats(self): return {'grad norm': self.cur_grad_norm}
0ba80740ba1ae1f95289a79fc05208c58ebe6f01 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9024/0ba80740ba1ae1f95289a79fc05208c58ebe6f01/parameter.py
grad, step_coeff = self._step_direction(p)
grad, step_coeff = self._step_direction(p, dostep = True)
def step(self, p): grad, step_coeff = self._step_direction(p) states = p.states for (g, state) in zip(grad,states): state.x += step_coeff * g
0ba80740ba1ae1f95289a79fc05208c58ebe6f01 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9024/0ba80740ba1ae1f95289a79fc05208c58ebe6f01/parameter.py
for (g, state) in zip(grad,states): state.x += step_coeff * g
def step(self, p): grad, step_coeff = self._step_direction(p) states = p.states for (g, state) in zip(grad,states): state.x += step_coeff * g
0ba80740ba1ae1f95289a79fc05208c58ebe6f01 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9024/0ba80740ba1ae1f95289a79fc05208c58ebe6f01/parameter.py
self.linesearch_stop_code = None
def __init__(self, feval, max_line_steps=10, quiet=True, **kwargs): ''' Gradient-descent parameter update strategy, performing a line-search to select the step size
0ba80740ba1ae1f95289a79fc05208c58ebe6f01 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9024/0ba80740ba1ae1f95289a79fc05208c58ebe6f01/parameter.py
self.linesearch_stop_code = None
def reset(self): self.linesearch_stop_code = None self.cur_num_steps = -1 super(gd_linesearch_update, self).reset()
0ba80740ba1ae1f95289a79fc05208c58ebe6f01 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9024/0ba80740ba1ae1f95289a79fc05208c58ebe6f01/parameter.py
def _step_direction(self, p):
def _step_direction(self, p, dostep=True):
def _step_direction(self, p): grad, step_coeff = \ super(gd_linesearch_update, self)._step_direction(p) feval = self.feval states = p.states bup = p.backup() stop = self.max_line_steps step = 0 cur_energy = feval() new_energy = np.infty while new_energy > cur_energy and step != stop: for (g, state) in zip(gr...
0ba80740ba1ae1f95289a79fc05208c58ebe6f01 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9024/0ba80740ba1ae1f95289a79fc05208c58ebe6f01/parameter.py
super(gd_linesearch_update, self)._step_direction(p)
super(gd_linesearch_update, self)._step_direction(p, False)
def _step_direction(self, p): grad, step_coeff = \ super(gd_linesearch_update, self)._step_direction(p) feval = self.feval states = p.states bup = p.backup() stop = self.max_line_steps step = 0 cur_energy = feval() new_energy = np.infty while new_energy > cur_energy and step != stop: for (g, state) in zip(gr...
0ba80740ba1ae1f95289a79fc05208c58ebe6f01 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9024/0ba80740ba1ae1f95289a79fc05208c58ebe6f01/parameter.py
while new_energy > cur_energy and step != stop: for (g, state) in zip(grad,states): state.x += step_coeff * g
while step != stop: step += 1 self._perform_step(p, grad, step_coeff) new_energy = feval()
def _step_direction(self, p): grad, step_coeff = \ super(gd_linesearch_update, self)._step_direction(p) feval = self.feval states = p.states bup = p.backup() stop = self.max_line_steps step = 0 cur_energy = feval() new_energy = np.infty while new_energy > cur_energy and step != stop: for (g, state) in zip(gr...
0ba80740ba1ae1f95289a79fc05208c58ebe6f01 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9024/0ba80740ba1ae1f95289a79fc05208c58ebe6f01/parameter.py
new_energy = feval()
if new_energy < cur_energy: break
def _step_direction(self, p): grad, step_coeff = \ super(gd_linesearch_update, self)._step_direction(p) feval = self.feval states = p.states bup = p.backup() stop = self.max_line_steps step = 0 cur_energy = feval() new_energy = np.infty while new_energy > cur_energy and step != stop: for (g, state) in zip(gr...
0ba80740ba1ae1f95289a79fc05208c58ebe6f01 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9024/0ba80740ba1ae1f95289a79fc05208c58ebe6f01/parameter.py
step += 1
def _step_direction(self, p): grad, step_coeff = \ super(gd_linesearch_update, self)._step_direction(p) feval = self.feval states = p.states bup = p.backup() stop = self.max_line_steps step = 0 cur_energy = feval() new_energy = np.infty while new_energy > cur_energy and step != stop: for (g, state) in zip(gr...
0ba80740ba1ae1f95289a79fc05208c58ebe6f01 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9024/0ba80740ba1ae1f95289a79fc05208c58ebe6f01/parameter.py
if step == stop: self.linesearch_stop_code = 'iteration limit reached' else: self.linesearch_stop_code = 'energy decreased'
if new_energy >= cur_energy: self.stop_code = 'line search failed'
def _step_direction(self, p): grad, step_coeff = \ super(gd_linesearch_update, self)._step_direction(p) feval = self.feval states = p.states bup = p.backup() stop = self.max_line_steps step = 0 cur_energy = feval() new_energy = np.infty while new_energy > cur_energy and step != stop: for (g, state) in zip(gr...
0ba80740ba1ae1f95289a79fc05208c58ebe6f01 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9024/0ba80740ba1ae1f95289a79fc05208c58ebe6f01/parameter.py
(step, self.linesearch_stop_code)
(step, ('energy decreased' if new_energy < cur_energy else 'iteration limit reached')) if not dostep: p.restore(bup)
def _step_direction(self, p): grad, step_coeff = \ super(gd_linesearch_update, self)._step_direction(p) feval = self.feval states = p.states bup = p.backup() stop = self.max_line_steps step = 0 cur_energy = feval() new_energy = np.infty while new_energy > cur_energy and step != stop: for (g, state) in zip(gr...
0ba80740ba1ae1f95289a79fc05208c58ebe6f01 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9024/0ba80740ba1ae1f95289a79fc05208c58ebe6f01/parameter.py
def __new__(cls, shape, dtype=rtype): shape = ensure_tuple(shape)
def __new__(cls, *args): if len(args) == 0: return object.__new__(cls) shape = ensure_tuple(args[0]) dtype = rtype if len(args) < 2 else args[1]
def __new__(cls, shape, dtype=rtype): shape = ensure_tuple(shape) if shape[0] == 1: return degen_rolling_average(shape, dtype) return object.__new__(cls)
79be038619c6da7bf35a295fc974f3ece25d4d51 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9024/79be038619c6da7bf35a295fc974f3ece25d4d51/util.py
def __new__(cls, shape, dtype=rtype):
def __new__(cls, *args):
def __new__(cls, shape, dtype=rtype): return object.__new__(cls)
79be038619c6da7bf35a295fc974f3ece25d4d51 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9024/79be038619c6da7bf35a295fc974f3ece25d4d51/util.py
base_super = super
_base_super = super
def make_wrapper(inner_name, around_fn): return lambda self, *args, **kwargs: \ around_fn(self, getattr(self, inner_name), *args, **kwargs)
b67276e00c771c5fd29b860e9d5a0224c6dfb5cd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9024/b67276e00c771c5fd29b860e9d5a0224c6dfb5cd/util.py
return base_super(cls, *args)
return _base_super(cls, *args)
def __new__(self, cls, *args): if not hasattr(cls, '__renames__') or not args: return base_super(cls, *args) return object.__new__(self)
b67276e00c771c5fd29b860e9d5a0224c6dfb5cd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9024/b67276e00c771c5fd29b860e9d5a0224c6dfb5cd/util.py
self.__sup = base_super(cls, obj)
self.__sup = _base_super(cls, obj)
def __init__(self, cls, obj): self.__sup = base_super(cls, obj) self.__renames = cls.__renames__
b67276e00c771c5fd29b860e9d5a0224c6dfb5cd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9024/b67276e00c771c5fd29b860e9d5a0224c6dfb5cd/util.py
__builtins__.super = around_super
__builtins__.super = around_super __builtins__._base_super = _base_super
def __getattribute__(self, name): if name.startswith('_around_super__'): return object.__getattribute__(self, name) sup = self.__sup renames = self.__renames if name in renames: name = renames[name] return getattr(sup, name)
b67276e00c771c5fd29b860e9d5a0224c6dfb5cd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9024/b67276e00c771c5fd29b860e9d5a0224c6dfb5cd/util.py
__builtins__['super'] = around_super
__builtins__['super'] = around_super __builtins__['_base_super'] = _base_super
def __getattribute__(self, name): if name.startswith('_around_super__'): return object.__getattribute__(self, name) sup = self.__sup renames = self.__renames if name in renames: name = renames[name] return getattr(sup, name)
b67276e00c771c5fd29b860e9d5a0224c6dfb5cd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9024/b67276e00c771c5fd29b860e9d5a0224c6dfb5cd/util.py
param.updater = gd_update( eta = 0.02, max_iters = 100 )
param.updater = gd_update( eta = 0.02 )
def plot(ds, machine): shape_in, shape_out = ds.shape() assert (shape_in == shape_out == (1,)) inp = state((1,)); out = state((1,)); des = state((1,)) ds.seek(0) size = ds.size() coords = empty(size); outputs = empty(size); targets = empty(size) for i in xrange(size): ds.fprop(inp, des) machine.fprop(inp, out) coords[...
1bec4f450c33dae312d23ee99747eea3a9e9811e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9024/1bec4f450c33dae312d23ee99747eea3a9e9811e/test_supervised.py
trainer.train(50000)
trainer.train(10000)
def plot(ds, machine): shape_in, shape_out = ds.shape() assert (shape_in == shape_out == (1,)) inp = state((1,)); out = state((1,)); des = state((1,)) ds.seek(0) size = ds.size() coords = empty(size); outputs = empty(size); targets = empty(size) for i in xrange(size): ds.fprop(inp, des) machine.fprop(inp, out) coords[...
1bec4f450c33dae312d23ee99747eea3a9e9811e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9024/1bec4f450c33dae312d23ee99747eea3a9e9811e/test_supervised.py
_base_super = super
def make_wrapper(inner_name, around_fn): return lambda self, *args, **kwargs: \ around_fn(self, getattr(self, inner_name), *args, **kwargs)
b8cea842407cd03626a4d527439c172e14899848 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9024/b8cea842407cd03626a4d527439c172e14899848/util.py
__builtins__._base_super = _base_super
def __getattribute__(self, name): if name.startswith('_around_super__'): return object.__getattribute__(self, name) sup = self.__sup renames = self.__renames if name in renames: name = renames[name] return getattr(sup, name)
b8cea842407cd03626a4d527439c172e14899848 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9024/b8cea842407cd03626a4d527439c172e14899848/util.py
__builtins__['_base_super'] = _base_super
def __getattribute__(self, name): if name.startswith('_around_super__'): return object.__getattribute__(self, name) sup = self.__sup renames = self.__renames if name in renames: name = renames[name] return getattr(sup, name)
b8cea842407cd03626a4d527439c172e14899848 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9024/b8cea842407cd03626a4d527439c172e14899848/util.py
min_finished = self.ds_train.size() - self.ds.tell()
min_finished = self.ds_train.size() - self.ds_train.tell()
def train_online(self, niters = -1): if not self.quiet: print 'Starting training on %s%s' % \ (time.asctime(), ' (max %d iterations)' % (niters,) if niters >= 0 else '') parameter = self.parameter age = self.age msg = self.msg hess_interval = self.hess_interval report_interval = self.r...
b817872a0b7618a51622d7c8fdeb0014b4d42cc2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9024/b817872a0b7618a51622d7c8fdeb0014b4d42cc2/trainer.py
eta = 2.0,
eta = 1.0,
def plot_reconstructions(ds, machine, n = 1000, orig_x=5, orig_y=5, max_x=795, scale = 1.0): shape_in, shape_out = ds.shape() assert (len(shape_in) == len(shape_out) == 2) ensure_window(title = 'PSD Reconstructions') spacing, padding = 2, 5 pic = empty((max(shape_in[0], shape_out[0]), shape_in[1] + spacing + shape_out[...
a6950ec749dcb11621df7afae388140e6b5d39c0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9024/a6950ec749dcb11621df7afae388140e6b5d39c0/test_psd.py
hess_interval = 0, report_interval = 1,
hess_interval = 10000, report_interval = 50,
def plot_reconstructions(ds, machine, n = 1000, orig_x=5, orig_y=5, max_x=795, scale = 1.0): shape_in, shape_out = ds.shape() assert (len(shape_in) == len(shape_out) == 2) ensure_window(title = 'PSD Reconstructions') spacing, padding = 2, 5 pic = empty((max(shape_in[0], shape_out[0]), shape_in[1] + spacing + shape_out[...
a6950ec749dcb11621df7afae388140e6b5d39c0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9024/a6950ec749dcb11621df7afae388140e6b5d39c0/test_psd.py
trainer.train(20)
trainer.train(2000)
def plot_reconstructions(ds, machine, n = 1000, orig_x=5, orig_y=5, max_x=795, scale = 1.0): shape_in, shape_out = ds.shape() assert (len(shape_in) == len(shape_out) == 2) ensure_window(title = 'PSD Reconstructions') spacing, padding = 2, 5 pic = empty((max(shape_in[0], shape_out[0]), shape_in[1] + spacing + shape_out[...
a6950ec749dcb11621df7afae388140e6b5d39c0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9024/a6950ec749dcb11621df7afae388140e6b5d39c0/test_psd.py
'http://getbanshee.org/~abock/%{name}-%{version}.tar.bz2'
'http://download.banshee-project.org/banshee/stable/%{version}/%{name}-%{version}.tar.bz2'
def __init__ (self): Package.__init__ (self, 'banshee-1', '1.5.3')
9a64322a098bd5949ae2d1d825a86cf3bab71ca9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/14879/9a64322a098bd5949ae2d1d825a86cf3bab71ca9/banshee.py
'http://ftp.novell.com/pub/%{name}/sources/%{name}/%{name}-%{version}.tar.bz2'
'http://ftp.novell.com/pub/%{name}/sources/%{name}/%{name}-%{version}.tar.bz2', 'patches/mono-runtime-relocation.patch'
def __init__ (self): Package.__init__ (self, 'mono', '2.6.1', sources = [ 'http://ftp.novell.com/pub/%{name}/sources/%{name}/%{name}-%{version}.tar.bz2' ], configure_flags = [ '--with-jit=yes', '--with-ikvm=no', '--with-mcs-docs=no', '--with-moonlight=no', '--enable-quiet-build' ] )
4b2dd20181f9befd3d86d48fc09e72ed29d6d62e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/14879/4b2dd20181f9befd3d86d48fc09e72ed29d6d62e/mono.py
def prep (self): Package.prep (self) self.sh ('patch -p1 < "%{sources[1]}"')
def __init__ (self): Package.__init__ (self, 'mono', '2.6.1', sources = [ 'http://ftp.novell.com/pub/%{name}/sources/%{name}/%{name}-%{version}.tar.bz2' ], configure_flags = [ '--with-jit=yes', '--with-ikvm=no', '--with-mcs-docs=no', '--with-moonlight=no', '--enable-quiet-build' ] )
4b2dd20181f9befd3d86d48fc09e72ed29d6d62e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/14879/4b2dd20181f9befd3d86d48fc09e72ed29d6d62e/mono.py
self.make = 'for((i=0;i<20;i++)); do make && break; done'
def __init__ (self): Package.__init__ (self, 'mono', '2.6.3', sources = [ 'http://ftp.novell.com/pub/%{name}/sources/%{name}/%{name}-%{version}.tar.bz2', 'patches/mono-runtime-relocation.patch' ], configure_flags = [ '--with-jit=yes', '--with-ikvm=no', '--with-mcs-docs=no', '--with-moonlight=no', '--enable-quiet-build'...
6bae79a9728cdbbced7f3f9f009990efd6353a3e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/14879/6bae79a9728cdbbced7f3f9f009990efd6353a3e/mono.py
run_shell ('mono --debug solitary/Solitary.exe '
run_shell ('mono --debug ../../solitary/Solitary.exe '
def make_app_bundle (self): plist_path = os.path.join (self.bundle_skeleton_dir, 'Contents', 'Info.plist') app_name = 'Unknown.app' plist = None if os.path.exists (plist_path): plist = Plist.fromFile (plist_path) app_name = plist['CFBundleExecutable'] else: print 'Warning: no Contents/Info.plist in .app skeleton'
358cc2cdde8601665a6a2a2172bb48b7b4383f2e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/14879/358cc2cdde8601665a6a2a2172bb48b7b4383f2e/darwinprofile.py
(install_prefix, install_prefix, self.bundle_res_dir, files))
(self.prefix, self.prefix, self.bundle_res_dir, files))
def make_app_bundle (self): plist_path = os.path.join (self.bundle_skeleton_dir, 'Contents', 'Info.plist') app_name = 'Unknown.app' plist = None if os.path.exists (plist_path): plist = Plist.fromFile (plist_path) app_name = plist['CFBundleExecutable'] else: print 'Warning: no Contents/Info.plist in .app skeleton'
fa52d2c9f9fecbc9a31107b5fa854ede37eb02bc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/14879/fa52d2c9f9fecbc9a31107b5fa854ede37eb02bc/darwinprofile.py
'--enable-osx',
def __init__ (self): Package.__init__ (self, 'banshee-1', '1.5.4')
d0914675711a17cbd489ab9b906b9eeedc9a7608 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/14879/d0914675711a17cbd489ab9b906b9eeedc9a7608/banshee.py
'http://download.banshee-project.org/banshee/stable/%{version}/%{name}-%{version}.tar.bz2'
'http://download.banshee-project.org/banshee/stable/%{version}/%{name}-%{version}.tar.bz2', 'patches/banshee-1.5.4-ige-mac-integration.patch'
def __init__ (self): Package.__init__ (self, 'banshee-1', '1.5.4')
e2590e459edadafc5c3f852a620507fec6ae73cd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/14879/e2590e459edadafc5c3f852a620507fec6ae73cd/banshee.py
Package.__init__ (self, 'banshee-1', '1.7.3')
Package.__init__ (self, 'banshee-1', '1.7.4')
def __init__ (self): Package.__init__ (self, 'banshee-1', '1.7.3')
93722fb098262ae12282276346cdaaa48c188fcc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/14879/93722fb098262ae12282276346cdaaa48c188fcc/banshee.py
'http://download.banshee.fm/banshee/unstable/%{version}/%{name}-%{version}.tar.bz2'
'http://download.banshee.fm/banshee/unstable/%{version}/%{name}-%{version}.tar.bz2', 'patches/banshee-gnome-doc-utils-fix.patch'
def __init__ (self): Package.__init__ (self, 'banshee-1', '1.7.3')
93722fb098262ae12282276346cdaaa48c188fcc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/14879/93722fb098262ae12282276346cdaaa48c188fcc/banshee.py
'--disable-webkit', '--disable-youtube'
'--disable-boo', '--disable-youtube', '--disable-gnome'
def __init__ (self): Package.__init__ (self, 'banshee-1', '1.7.3')
93722fb098262ae12282276346cdaaa48c188fcc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/14879/93722fb098262ae12282276346cdaaa48c188fcc/banshee.py
'--disable-boo', '--disable-gnome',
def __init__ (self): Package.__init__ (self, 'banshee-1', '1.7.3')
93722fb098262ae12282276346cdaaa48c188fcc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/14879/93722fb098262ae12282276346cdaaa48c188fcc/banshee.py
parser.print_help ()
self.parser.print_help ()
def build (self): packages_to_build = self.cmd_args self.verbose = self.cmd_options.verbose self.run_phases = self.default_run_phases
363cf299d3453866899f8074b7055e7b2db62df1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/14879/363cf299d3453866899f8074b7055e7b2db62df1/profile.py
if docTitle: mwrap = MediawikiXMLWrapper() docTitle = fh.splitCamelCase(docTitle.strip()) docTitle = docTitle.title() output = mwrap.wrapInMinimalHeader(docTitle, output) else: sys.stderr.write('No title found. Omitting XML.\n')
if docTitle: mwrap = MediawikiXMLWrapper() docTitle = fh.splitCamelCase(docTitle.strip()) docTitle = docTitle.title() output = mwrap.wrapInMinimalHeader(docTitle, output) else: sys.stderr.write('No title found. Omitting XML.\n')
def main(source, writer='mediawiki', mediaxml=False, docTitle=None): settings_overrides = { #'halt_level': 2, 'report_level': 5, #'input_encoding': 'utf-8', #'output_encoding': 'utf-8', } kw = {}; kw.setdefault('writer', WikiWriter(visitor=writer)) kw.setdefault('settings_overrides', {}) kw['settings_overrides'].upda...
e3f94633cc7828c6b84704ea180e72808d5899c4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/14824/e3f94633cc7828c6b84704ea180e72808d5899c4/rest2wiki.py
product = party_obj.browse(cursor, user, product, context=context)
product = product_obj.browse(cursor, user, product, context=context)
def compute(self, cursor, user, price_list, party, product, unit_price, quantity, uom, pattern=None, context=None): ''' Compute price based on price list of party
0ba1979f4624b55f4c747acd44fa4bc0b8d6fa97 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9309/0ba1979f4624b55f4c747acd44fa4bc0b8d6fa97/price_list.py
product = party_obj.browse(product)
product = product_obj.browse(product)
def compute(self, price_list, party, product, unit_price, quantity, uom, pattern=None): ''' Compute price based on price list of party
fd1e13fa0516958a2581c3ee55833f0c7c3e117c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9309/fd1e13fa0516958a2581c3ee55833f0c7c3e117c/price_list.py
product = party_obj.browse(product)
product = product_obj.browse(product)
def compute(self, price_list, party, product, unit_price, quantity, uom, pattern=None): ''' Compute price based on price list of party
1b8ce9166d539c812c7bb7cd452c1104b55854bd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9309/1b8ce9166d539c812c7bb7cd452c1104b55854bd/price_list.py
product = party_obj.browse(cursor, user, product, context=context)
product = product_obj.browse(cursor, user, product, context=context)
def compute(self, cursor, user, price_list, party, product, unit_price, quantity, uom, pattern=None, context=None): ''' Compute price based on price list of party
f12bf55e9417eee7b99e2c835f73e1350925ba41 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9309/f12bf55e9417eee7b99e2c835f73e1350925ba41/price_list.py
probe.log("MAPPING_TIMEOUT mapped_ip=%s" % probe.mapped_ip)
probe.log("MAPPING_TIMEOUT")
def run(self): # Advance state of probes that are ready for probe in self.probes: now = time.time() if not probe.next_ts <= now: continue if probe.waiting: # Last ping timed out, so back off a TTL if probe.mapping_tries == probe.max_mapping_tries: probe.mapped = True probe.max_ttl -= 1 probe.log("MAPPED mapped_ip=%s ma...
3c34263318a1e65a32d41818db27c10826efef4c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/13481/3c34263318a1e65a32d41818db27c10826efef4c/probe.py
hosts = ['cnn.com', 'google.com', 'justin.tv', 'yahoo.com', 'nytimes.com', 'ustream.tv', 'ycombinator.com', 'blogtv.com', 'comcast.com', 'ea.com']
hosts = ['cnn.com']
def ping(self, addr, id=1, seq=1, ttl=255, verbose = False): addr = socket.gethostbyname(addr) packet = self.create_packet(addr, id, seq) if verbose: print "Pinging %s (id=%s seq=%s ttl=%s)" % (addr, id, seq, ttl) self.sock.setsockopt(socket.SOL_IP, socket.IP_TTL, ttl) # Python requires a tuple of (addr, port), but the...
3c34263318a1e65a32d41818db27c10826efef4c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/13481/3c34263318a1e65a32d41818db27c10826efef4c/probe.py
self.search_options[k]=v(self.context) return self.search_options
v = v(self.context) options[k] = v return options
def _search_options(self): for k,v in self.search_options.items(): if callable(v): self.search_options[k]=v(self.context) return self.search_options
59a03f2faeb790c895f55991d69ebacda873f6fe /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11908/59a03f2faeb790c895f55991d69ebacda873f6fe/views.py
self.search_util = queryUtility(ISearch)
def search(self, kwargs={}): self.search_util = queryUtility(ISearch) parameters = {} query = self.build_query() flares = self.search_util(query, **parameters) self.contents = [PloneFlare(f) for f in flares]
59a03f2faeb790c895f55991d69ebacda873f6fe /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11908/59a03f2faeb790c895f55991d69ebacda873f6fe/views.py
flares = self.search_util(query, **parameters)
flares = self.search_util(query, **parameters)
def search(self, kwargs={}): self.search_util = queryUtility(ISearch) parameters = {} query = self.build_query() flares = self.search_util(query, **parameters) self.contents = [PloneFlare(f) for f in flares]
59a03f2faeb790c895f55991d69ebacda873f6fe /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11908/59a03f2faeb790c895f55991d69ebacda873f6fe/views.py
def filters(self): return []
def filters(self): return []
086c930a95814e0c914242398727cb342087835f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11908/086c930a95814e0c914242398727cb342087835f/views.py
def filters(self): return []
filters = [] auto_count = None
def filters(self): return []
086c930a95814e0c914242398727cb342087835f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11908/086c930a95814e0c914242398727cb342087835f/views.py
request_filters = [('review_state', 'state')]
request_filters = [('review_state', 'review_state')]
def filters(self): return []
086c930a95814e0c914242398727cb342087835f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11908/086c930a95814e0c914242398727cb342087835f/views.py
template = self.table
template = self.table, auto_count = self.auto_count,
def render_listing(self): generator = queryUtility(ITableGenerator, 'ftw.tablegenerator') return generator.generate(self.batch, self.columns, sortable=True, selected=(self.sort_on, self.sort_order), template = self.table )
086c930a95814e0c914242398727cb342087835f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11908/086c930a95814e0c914242398727cb342087835f/views.py
actions = ai_tool.listActionInfos(object=self.context,categories=('folder_buttons',))
actions = ai_tool.listActionInfos(object=self.context, categories=('folder_buttons',))
def available_actions(self): """ Returns a list of available action ids """ ai_tool = getToolByName(self.context, 'portal_actions') actions = ai_tool.listActionInfos(object=self.context,categories=('folder_buttons',)) available_action_ids = [a['id'] for a in actions if a['available'] and a['visible'] and a['allowed'] ]...
086c930a95814e0c914242398727cb342087835f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11908/086c930a95814e0c914242398727cb342087835f/views.py
def update(self): self.pas_tool = getToolByName(self.context, 'acl_users') kwargs = {}
086c930a95814e0c914242398727cb342087835f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11908/086c930a95814e0c914242398727cb342087835f/views.py
def post_search(self, kwargs): #when we're searching recursively we have to remove the current item if its in self.types if self.depth != 1 and self.context.portal_type in self.types: index = 0 current_path = '/'.join(self.context.getPhysicalPath()) for result in self.contents: if current_path == result.getPath(): sel...
086c930a95814e0c914242398727cb342087835f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11908/086c930a95814e0c914242398727cb342087835f/views.py
parsed_state = json.loads(state) if 'group' in parsed_state: del parsed_state['group'] state = json.dumps(parsed_state)
if state: parsed_state = json.loads(state) if 'group' in parsed_state: del parsed_state['group'] state = json.dumps(parsed_state)
def load_grid_state(self): """Loads the stored grid state - if any is stored. """ # get the key from the key generator generator = queryMultiAdapter((self.context, self, self.request), IGridStateStorageKeyGenerator) key = generator.get_key()
45244261dbf4bbda0a83174ddcbb7bf01f6bd693 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11908/45244261dbf4bbda0a83174ddcbb7bf01f6bd693/listing.py
parsed_state = json.loads(state)
def load_grid_state(self): """Loads the stored grid state - if any is stored. """ # get the key from the key generator generator = queryMultiAdapter((self.context, self, self.request), IGridStateStorageKeyGenerator) key = generator.get_key()
d333bb5bbd5591540be6f3bf6cf56b10ae98b038 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11908/d333bb5bbd5591540be6f3bf6cf56b10ae98b038/listing.py