rem stringlengths 1 322k | add stringlengths 0 2.05M | context stringlengths 4 228k | meta stringlengths 156 215 |
|---|---|---|---|
def execute_http_request (action, args, db, options): | def execute_http_request(action, args, db, options): | def execute_http_request (action, args, db, options): """Executes a raw HTTP command (GET, PUT, POST, DELETE or HEAD) as specified on the command line.""" method = action.upper() if method not in HTTP_METHODS: raise UnrecognizedHTTPMethodError, ('Only supported HTTP methods are' '%s and %s' % (' '.join (HTTP_METHODS[:-... | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
status, result = db.call (method, uri, body, hash) | status, result = db.call(method, uri, body, hash) | def execute_http_request (action, args, db, options): """Executes a raw HTTP command (GET, PUT, POST, DELETE or HEAD) as specified on the command line.""" method = action.upper() if method not in HTTP_METHODS: raise UnrecognizedHTTPMethodError, ('Only supported HTTP methods are' '%s and %s' % (' '.join (HTTP_METHODS[:-... | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
print 'Result: %s' % str (result) def execute_command_line (action, args, options, parser): | print 'Result: %s' % str(result) def execute_command_line(action, args, options, parser): | def execute_http_request (action, args, db, options): """Executes a raw HTTP command (GET, PUT, POST, DELETE or HEAD) as specified on the command line.""" method = action.upper() if method not in HTTP_METHODS: raise UnrecognizedHTTPMethodError, ('Only supported HTTP methods are' '%s and %s' % (' '.join (HTTP_METHODS[:-... | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
execute_http_request (action, args, db, options) | execute_http_request(action, args, db, options) | def execute_command_line (action, args, options, parser): db = FluidDB(host=options.hostname, debug=options.debug) ids_from_queries = chain(*imap(lambda q: get_ids_or_fail(q, db), options.query)) ids = chain(options.id, ids_from_queries) objs = [O({'mode': 'about', 'specifier': a}) for a in options.about] + \ [O({'mo... | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
def choose_host (): | def choose_host(): | def choose_host (): if 'options' in globals(): host = options.hostname if options.verbose: print "Chosen %s as host" % host return host else: return FLUIDDB_PATH | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
def choose_debug_mode (): return options.debug if 'options' in globals () else False def choose_http_timeout (): | def choose_debug_mode(): return options.debug if 'options' in globals() else False def choose_http_timeout(): | def choose_debug_mode (): return options.debug if 'options' in globals () else False | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
class TestFluidDB (unittest.TestCase): db = FluidDB () | class TestFluidDB(unittest.TestCase): db = FluidDB() | def choose_http_timeout (): return (options.timeout if 'options' in globals() else HTTP_TIMEOUT) | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
def setUp (self): self.db.set_connection_from_global () self.db.set_debug_timeout (5.0) self.dadgadID = id ('DADGAD', self.db.host) def testCreateObject (self): | def setUp(self): self.db.set_connection_from_global() self.db.set_debug_timeout(5.0) self.dadgadID = id('DADGAD', self.db.host) def testCreateObject(self): | def setUp (self): self.db.set_connection_from_global () self.db.set_debug_timeout (5.0) self.dadgadID = id ('DADGAD', self.db.host) | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
o = db.create_object ('DADGAD') self.assertEqual (o.id, self.dadgadID) self.assertEqual (o.URI, object_uri (self.dadgadID)) def testCreateObjectNoAbout (self): | o = db.create_object('DADGAD') self.assertEqual(o.id, self.dadgadID) self.assertEqual(o.URI, object_uri(self.dadgadID)) def testCreateObjectNoAbout(self): | def testCreateObject (self): db = self.db o = db.create_object ('DADGAD') self.assertEqual (o.id, self.dadgadID) self.assertEqual (o.URI, object_uri (self.dadgadID)) | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
o = db.create_object () self.assertEqual (type (o) != types.IntType, True) def testCreateObjectFail (self): bad = Credentials ('doesnotexist', 'certainlywiththispassword') db = FluidDB (bad) o = db.create_object ('DADGAD') self.assertEqual (o, STATUS.INTERNAL_SERVER_ERROR) def testCreateTag (self): | o = db.create_object() self.assertEqual(type(o) != types.IntType, True) def testCreateObjectFail(self): bad = Credentials('doesnotexist', 'certainlywiththispassword') db = FluidDB(bad) o = db.create_object('DADGAD') self.assertEqual(o, STATUS.UNAUTHORIZED) def testCreateTag(self): | def testCreateObjectNoAbout (self): db = self.db o = db.create_object () self.assertEqual (type (o) != types.IntType, True) | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
o = db.delete_abstract_tag ('testrating') | o = db.delete_abstract_tag('testrating') | def testCreateTag (self): db = self.db o = db.delete_abstract_tag ('testrating') # doesn't really matter if this works or not | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
o = db.create_abstract_tag ('testrating', | o = db.create_abstract_tag('testrating', | def testCreateTag (self): db = self.db o = db.delete_abstract_tag ('testrating') # doesn't really matter if this works or not | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
self.assertEqual (type (o.id) in types.StringTypes, True) self.assertEqual (o.URI, tag_uri (db.credentials.username, | self.assertEqual(type(o.id) in types.StringTypes, True) self.assertEqual(o.URI, tag_uri(db.credentials.username, | def testCreateTag (self): db = self.db o = db.delete_abstract_tag ('testrating') # doesn't really matter if this works or not | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
def testSetTagByID (self): | def testSetTagByID(self): | def testSetTagByID (self): db = self.db user = db.credentials.username o = db.delete_abstract_tag ('testrating') o = db.create_abstract_tag ('testrating', "%s's testrating (0-10; more is better)" % self.user) o = db.tag_object_by_id (self.dadgadID, '/%s/testrating' % user, 5) self.assertEqual (o, 0) _status, v = db.get... | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
o = db.delete_abstract_tag ('testrating') o = db.create_abstract_tag ('testrating', | o = db.delete_abstract_tag('testrating') o = db.create_abstract_tag('testrating', | def testSetTagByID (self): db = self.db user = db.credentials.username o = db.delete_abstract_tag ('testrating') o = db.create_abstract_tag ('testrating', "%s's testrating (0-10; more is better)" % self.user) o = db.tag_object_by_id (self.dadgadID, '/%s/testrating' % user, 5) self.assertEqual (o, 0) _status, v = db.get... | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
o = db.tag_object_by_id (self.dadgadID, '/%s/testrating' % user, 5) self.assertEqual (o, 0) _status, v = db.get_tag_value_by_id (self.dadgadID, 'testrating') self.assertEqual (v, 5) def testSetTagByAbout (self): | o = db.tag_object_by_id(self.dadgadID, '/%s/testrating' % user, 5) self.assertEqual(o, 0) _status, v = db.get_tag_value_by_id(self.dadgadID, 'testrating') self.assertEqual(v, 5) def testSetTagByAbout(self): | def testSetTagByID (self): db = self.db user = db.credentials.username o = db.delete_abstract_tag ('testrating') o = db.create_abstract_tag ('testrating', "%s's testrating (0-10; more is better)" % self.user) o = db.tag_object_by_id (self.dadgadID, '/%s/testrating' % user, 5) self.assertEqual (o, 0) _status, v = db.get... | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
o = db.delete_abstract_tag ('testrating') o = db.tag_object_by_about ('DADGAD', '/%s/testrating' % user, 'five') self.assertEqual (o, 0) _status, v = db.get_tag_value_by_about ('DADGAD', 'testrating') self.assertEqual (v, 'five') def testDeleteNonExistentTag (self): | o = db.delete_abstract_tag('testrating') o = db.tag_object_by_about('DADGAD', '/%s/testrating' % user, 'five') self.assertEqual(o, 0) _status, v = db.get_tag_value_by_about('DADGAD', 'testrating') self.assertEqual(v, 'five') def testDeleteNonExistentTag(self): | def testSetTagByAbout (self): db = self.db user = db.credentials.username o = db.delete_abstract_tag ('testrating') o = db.tag_object_by_about ('DADGAD', '/%s/testrating' % user, 'five') self.assertEqual (o, 0) _status, v = db.get_tag_value_by_about ('DADGAD', 'testrating') self.assertEqual (v, 'five') | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
o = db.delete_abstract_tag ('testrating') o = db.delete_abstract_tag ('testrating') def testSetNonExistentTag (self): | o = db.delete_abstract_tag('testrating') o = db.delete_abstract_tag('testrating') def testSetNonExistentTag(self): | def testDeleteNonExistentTag (self): db = self.db o = db.delete_abstract_tag ('testrating') o = db.delete_abstract_tag ('testrating') # definitely doesn't exist | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
o = db.delete_abstract_tag ('testrating') o = db.tag_object_by_id (self.dadgadID, 'testrating', 5) self.assertEqual (o, 0) status, v = db.get_tag_value_by_id (self.dadgadID, 'testrating') self.assertEqual (v, 5) def testUntagObjectByID (self): | o = db.delete_abstract_tag('testrating') o = db.tag_object_by_id(self.dadgadID, 'testrating', 5) self.assertEqual(o, 0) status, v = db.get_tag_value_by_id(self.dadgadID, 'testrating') self.assertEqual(v, 5) def testUntagObjectByID(self): | def testSetNonExistentTag (self): db = self.db o = db.delete_abstract_tag ('testrating') o = db.tag_object_by_id (self.dadgadID, 'testrating', 5) self.assertEqual (o, 0) status, v = db.get_tag_value_by_id (self.dadgadID, 'testrating') self.assertEqual (v, 5) | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
o = db.tag_object_by_id (self.dadgadID, 'testrating', 5) self.assertEqual (o, 0) | o = db.tag_object_by_id(self.dadgadID, 'testrating', 5) self.assertEqual(o, 0) | def testUntagObjectByID (self): db = self.db | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
error = db.untag_object_by_id (self.dadgadID, 'testrating') self.assertEqual (error, 0) status, v = db.get_tag_value_by_id (self.dadgadID, 'testrating') self.assertEqual (status, STATUS.NOT_FOUND) | error = db.untag_object_by_id(self.dadgadID, 'testrating') self.assertEqual(error, 0) status, v = db.get_tag_value_by_id(self.dadgadID, 'testrating') self.assertEqual(status, STATUS.NOT_FOUND) | def testUntagObjectByID (self): db = self.db | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
error = db.untag_object_by_id (self.dadgadID, 'testrating') self.assertEqual (error, 0) | error = db.untag_object_by_id(self.dadgadID, 'testrating') self.assertEqual(error, 0) | def testUntagObjectByID (self): db = self.db | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
error = db.untag_object_by_id (self.dadgadID, 'testrating', False) self.assertEqual (error, STATUS.NOT_FOUND) def testUntagObjectByAbout (self): | error = db.untag_object_by_id(self.dadgadID, 'testrating', False) self.assertEqual(error, STATUS.NOT_FOUND) def testUntagObjectByAbout(self): | def testUntagObjectByID (self): db = self.db | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
o = db.tag_object_by_id (self.dadgadID, 'testrating', 5) self.assertEqual (o, 0) | o = db.tag_object_by_id(self.dadgadID, 'testrating', 5) self.assertEqual(o, 0) | def testUntagObjectByAbout (self): db = self.db | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
error = db.untag_object_by_about ('DADGAD', 'testrating') self.assertEqual (error, 0) status, v = db.get_tag_value_by_about ('DADGAD', 'testrating') self.assertEqual (status, STATUS.NOT_FOUND) def testAddValuelessTag (self): | error = db.untag_object_by_about('DADGAD', 'testrating') self.assertEqual(error, 0) status, v = db.get_tag_value_by_about('DADGAD', 'testrating') self.assertEqual(status, STATUS.NOT_FOUND) def testAddValuelessTag(self): | def testUntagObjectByAbout (self): db = self.db | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
o = db.delete_abstract_tag ('testconvtag') o = db.create_abstract_tag ('testconvtag', | o = db.delete_abstract_tag('testconvtag') o = db.create_abstract_tag('testconvtag', | def testAddValuelessTag (self): db = self.db o = db.delete_abstract_tag ('testconvtag') o = db.create_abstract_tag ('testconvtag', "a conventional (valueless) tag") o = db.tag_object_by_id (self.dadgadID, 'testconvtag') self.assertEqual (o, 0) status, v = db.get_tag_value_by_id (self.dadgadID, 'testconvtag') self.asser... | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
o = db.tag_object_by_id (self.dadgadID, 'testconvtag') self.assertEqual (o, 0) status, v = db.get_tag_value_by_id (self.dadgadID, 'testconvtag') self.assertEqual (v, None) class TestFDBUtilityFunctions (unittest.TestCase): db = FluidDB () | o = db.tag_object_by_id(self.dadgadID, 'testconvtag') self.assertEqual(o, 0) status, v = db.get_tag_value_by_id(self.dadgadID, 'testconvtag') self.assertEqual(v, None) class TestFDBUtilityFunctions(unittest.TestCase): db = FluidDB() | def testAddValuelessTag (self): db = self.db o = db.delete_abstract_tag ('testconvtag') o = db.create_abstract_tag ('testconvtag', "a conventional (valueless) tag") o = db.tag_object_by_id (self.dadgadID, 'testconvtag') self.assertEqual (o, 0) status, v = db.get_tag_value_by_id (self.dadgadID, 'testconvtag') self.asser... | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
def setUp (self): self.db.set_connection_from_global () self.db.set_debug_timeout (5.0) self.dadgadID = id ('DADGAD', self.db.host) def testFullTagPath (self): | def setUp(self): self.db.set_connection_from_global() self.db.set_debug_timeout(5.0) self.dadgadID = id('DADGAD', self.db.host) def testFullTagPath(self): | def setUp (self): self.db.set_connection_from_global () self.db.set_debug_timeout (5.0) self.dadgadID = id ('DADGAD', self.db.host) | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
self.assertEqual (db.full_tag_path ('rating'), | self.assertEqual(db.full_tag_path('rating'), | def testFullTagPath (self): db = self.db user = db.credentials.username self.assertEqual (db.full_tag_path ('rating'), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('/%s/rating' % user), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('/tags/%s/rating' % user), '/tags/%s/rating' % user) se... | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
self.assertEqual (db.full_tag_path ('/%s/rating' % user), | self.assertEqual(db.full_tag_path('/%s/rating' % user), | def testFullTagPath (self): db = self.db user = db.credentials.username self.assertEqual (db.full_tag_path ('rating'), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('/%s/rating' % user), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('/tags/%s/rating' % user), '/tags/%s/rating' % user) se... | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
self.assertEqual (db.full_tag_path ('/tags/%s/rating' % user), | self.assertEqual(db.full_tag_path('/tags/%s/rating' % user), | def testFullTagPath (self): db = self.db user = db.credentials.username self.assertEqual (db.full_tag_path ('rating'), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('/%s/rating' % user), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('/tags/%s/rating' % user), '/tags/%s/rating' % user) se... | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
self.assertEqual (db.full_tag_path ('foo/rating'), | self.assertEqual(db.full_tag_path('foo/rating'), | def testFullTagPath (self): db = self.db user = db.credentials.username self.assertEqual (db.full_tag_path ('rating'), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('/%s/rating' % user), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('/tags/%s/rating' % user), '/tags/%s/rating' % user) se... | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
self.assertEqual (db.full_tag_path ('/%s/foo/rating' % user), | self.assertEqual(db.full_tag_path('/%s/foo/rating' % user), | def testFullTagPath (self): db = self.db user = db.credentials.username self.assertEqual (db.full_tag_path ('rating'), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('/%s/rating' % user), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('/tags/%s/rating' % user), '/tags/%s/rating' % user) se... | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
self.assertEqual (db.full_tag_path ('/tags/%s/foo/rating' % user), | self.assertEqual(db.full_tag_path('/tags/%s/foo/rating' % user), | def testFullTagPath (self): db = self.db user = db.credentials.username self.assertEqual (db.full_tag_path ('rating'), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('/%s/rating' % user), '/tags/%s/rating' % user) self.assertEqual (db.full_tag_path ('/tags/%s/rating' % user), '/tags/%s/rating' % user) se... | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
def testAbsTagPath (self): | def testAbsTagPath(self): | def testAbsTagPath (self): db = self.db user = db.credentials.username self.assertEqual (db.abs_tag_path ('rating'), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('/%s/rating' % user), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('/tags/%s/rating' % user), '/%s/rating' % user) self.assertEqual (db.... | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
self.assertEqual (db.abs_tag_path ('rating'), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('/%s/rating' % user), | self.assertEqual(db.abs_tag_path('rating'), '/%s/rating' % user) self.assertEqual(db.abs_tag_path('/%s/rating' % user), | def testAbsTagPath (self): db = self.db user = db.credentials.username self.assertEqual (db.abs_tag_path ('rating'), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('/%s/rating' % user), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('/tags/%s/rating' % user), '/%s/rating' % user) self.assertEqual (db.... | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
self.assertEqual (db.abs_tag_path ('/tags/%s/rating' % user), | self.assertEqual(db.abs_tag_path('/tags/%s/rating' % user), | def testAbsTagPath (self): db = self.db user = db.credentials.username self.assertEqual (db.abs_tag_path ('rating'), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('/%s/rating' % user), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('/tags/%s/rating' % user), '/%s/rating' % user) self.assertEqual (db.... | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
self.assertEqual (db.abs_tag_path ('foo/rating'), | self.assertEqual(db.abs_tag_path('foo/rating'), | def testAbsTagPath (self): db = self.db user = db.credentials.username self.assertEqual (db.abs_tag_path ('rating'), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('/%s/rating' % user), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('/tags/%s/rating' % user), '/%s/rating' % user) self.assertEqual (db.... | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
self.assertEqual (db.abs_tag_path ('/%s/foo/rating' % user), | self.assertEqual(db.abs_tag_path('/%s/foo/rating' % user), | def testAbsTagPath (self): db = self.db user = db.credentials.username self.assertEqual (db.abs_tag_path ('rating'), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('/%s/rating' % user), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('/tags/%s/rating' % user), '/%s/rating' % user) self.assertEqual (db.... | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
self.assertEqual (db.abs_tag_path ('/tags/%s/foo/rating' % user), | self.assertEqual(db.abs_tag_path('/tags/%s/foo/rating' % user), | def testAbsTagPath (self): db = self.db user = db.credentials.username self.assertEqual (db.abs_tag_path ('rating'), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('/%s/rating' % user), '/%s/rating' % user) self.assertEqual (db.abs_tag_path ('/tags/%s/rating' % user), '/%s/rating' % user) self.assertEqual (db.... | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
def testTagPathSplit (self): | def testTagPathSplit(self): | def testTagPathSplit (self): db = self.db | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
self.assertEqual (db.tag_path_split ('rating'), (user, '', 'rating')) self.assertEqual (db.tag_path_split ('/%s/rating' % user), (user, '', 'rating')) self.assertEqual (db.tag_path_split ('/tags/%s/rating' % user), (user, '', 'rating')) self.assertEqual (db.tag_path_split ('foo/rating'), (user, 'foo', 'rating')) self.a... | self.assertEqual(db.tag_path_split('rating'), (user, '', 'rating')) self.assertEqual(db.tag_path_split('/%s/rating' % user), (user, '', 'rating')) self.assertEqual(db.tag_path_split('/tags/%s/rating' % user), (user, '', 'rating')) self.assertEqual(db.tag_path_split('foo/rating'), (user, 'foo', 'rating')) self.assertEqu... | def testTagPathSplit (self): db = self.db | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
v = get_typed_tag_value (s) self.assertEqual ((s, v), (s, target)) self.assertEqual ((s, type (v)), (s, targetType)) | v = get_typed_tag_value(s) self.assertEqual((s, v), (s, target)) self.assertEqual((s, type (v)), (s, targetType)) | def testTypedValueInterpretation (self): corrects = { 'TRUE' : (True, types.BooleanType), 'tRuE' : (True, types.BooleanType), 't' : (True, types.BooleanType), 'T' : (True, types.BooleanType), 'f' : (False, types.BooleanType), 'false' : (False, types.BooleanType), '1' : (1, types.IntType), '+1' : (1, types.IntType), '-1... | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
def __init__ (self): | def __init__(self): | def __init__ (self): self.buffer = [] | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
def write (self, msg): self.buffer.append (msg) def clear (self): | def write(self, msg): self.buffer.append(msg) def clear(self): | def write (self, msg): self.buffer.append (msg) | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
def specify_DADGAD (mode, host): | def specify_DADGAD(mode, host): | def specify_DADGAD (mode, host): if mode == 'about': return ('-a', 'DADGAD') elif mode == 'id': return ('-i', id ('DADGAD', host)) elif mode == 'query': return ('-q', 'fluiddb/about="DADGAD"') else: raise ModeError, 'Bad mode' | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
class TestCLI (unittest.TestCase): db = FluidDB () | class TestCLI(unittest.TestCase): db = FluidDB() | def specify_DADGAD (mode, host): if mode == 'about': return ('-a', 'DADGAD') elif mode == 'id': return ('-i', id ('DADGAD', host)) elif mode == 'query': return ('-q', 'fluiddb/about="DADGAD"') else: raise ModeError, 'Bad mode' | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
def setUp (self): self.db.set_connection_from_global () self.db.set_debug_timeout (5.0) self.dadgadID = id ('DADGAD', self.db.host) | def setUp(self): self.db.set_connection_from_global() self.db.set_debug_timeout(5.0) self.dadgadID = id('DADGAD', self.db.host) | def setUp (self): self.db.set_connection_from_global () self.db.set_debug_timeout (5.0) self.dadgadID = id ('DADGAD', self.db.host) self.stdout = sys.stdout self.stderr = sys.stderr self.stealOutput () | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
self.stealOutput () def stealOutput (self): self.out = SaveOut () self.err = SaveOut () | self.stealOutput() def stealOutput(self): self.out = SaveOut() self.err = SaveOut() | def setUp (self): self.db.set_connection_from_global () self.db.set_debug_timeout (5.0) self.dadgadID = id ('DADGAD', self.db.host) self.stdout = sys.stdout self.stderr = sys.stderr self.stealOutput () | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
def reset (self): | def reset(self): | def reset (self): sys.stdout = self.stdout sys.stderr = self.stderr | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
def Print (self, msg): self.stdout.write (str (msg) + '\n') def testOutputManipulation (self): | def Print(self, msg): self.stdout.write(str(msg) + '\n') def testOutputManipulation(self): | def Print (self, msg): self.stdout.write (str (msg) + '\n') | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
sys.stderr.write ('two') self.reset () self.assertEqual (self.out.buffer, ['one', '\n']) self.assertEqual (self.err.buffer, ['two']) def tagTest (self, mode, verbose=True): self.stealOutput () (flag, spec) = specify_DADGAD (mode, self.db.host) description = describe_by_mode (spec, mode) | sys.stderr.write('two') self.reset() self.assertEqual(self.out.buffer, ['one', '\n']) self.assertEqual(self.err.buffer, ['two']) def tagTest(self, mode, verbose=True): self.stealOutput() (flag, spec) = specify_DADGAD(mode, self.db.host) description = describe_by_mode(spec, mode) | def testOutputManipulation (self): print 'one' sys.stderr.write ('two') self.reset () self.assertEqual (self.out.buffer, ['one', '\n']) self.assertEqual (self.err.buffer, ['two']) | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
self.reset () | self.reset() | def tagTest (self, mode, verbose=True): self.stealOutput () (flag, spec) = specify_DADGAD (mode, self.db.host) description = describe_by_mode (spec, mode) flags = ['-v', flag] if verbose else [flag] hostname = ['--hostname', choose_host()] args = ['tag'] + flags + [spec, 'rating=10'] + hostname execute_command_line(*pa... | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
self.assertEqual (self.out.buffer, target) self.assertEqual (self.err.buffer, []) def untagTest (self, mode, verbose=True): self.stealOutput () (flag, spec) = specify_DADGAD (mode, self.db.host) description = describe_by_mode (spec, mode) | self.assertEqual(self.out.buffer, target) self.assertEqual(self.err.buffer, []) def untagTest(self, mode, verbose=True): self.stealOutput() (flag, spec) = specify_DADGAD(mode, self.db.host) description = describe_by_mode(spec, mode) | def tagTest (self, mode, verbose=True): self.stealOutput () (flag, spec) = specify_DADGAD (mode, self.db.host) description = describe_by_mode (spec, mode) flags = ['-v', flag] if verbose else [flag] hostname = ['--hostname', choose_host()] args = ['tag'] + flags + [spec, 'rating=10'] + hostname execute_command_line(*pa... | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
self.reset () | self.reset() | def untagTest (self, mode, verbose=True): self.stealOutput () (flag, spec) = specify_DADGAD (mode, self.db.host) description = describe_by_mode (spec, mode) flags = ['-v', flag] if verbose else [flag] hostname = ['--hostname', choose_host()] args = ['untag'] + flags + [spec, 'rating'] + hostname execute_command_line(*p... | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
self.assertEqual (self.out.buffer, target) self.assertEqual (self.err.buffer, []) def showTaggedSuccessTest (self, mode): self.stealOutput () (flag, spec) = specify_DADGAD (mode, self.db.host) description = describe_by_mode (spec, mode) | self.assertEqual(self.out.buffer, target) self.assertEqual(self.err.buffer, []) def showTaggedSuccessTest(self, mode): self.stealOutput() (flag, spec) = specify_DADGAD(mode, self.db.host) description = describe_by_mode(spec, mode) | def untagTest (self, mode, verbose=True): self.stealOutput () (flag, spec) = specify_DADGAD (mode, self.db.host) description = describe_by_mode (spec, mode) flags = ['-v', flag] if verbose else [flag] hostname = ['--hostname', choose_host()] args = ['untag'] + flags + [spec, 'rating'] + hostname execute_command_line(*p... | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
self.reset () self.assertEqual (self.out.buffer, | self.reset() self.assertEqual(self.out.buffer, | def showTaggedSuccessTest (self, mode): self.stealOutput () (flag, spec) = specify_DADGAD (mode, self.db.host) description = describe_by_mode (spec, mode) hostname = ['--hostname', choose_host()] args = ['show', '-v', flag, spec, 'rating', '/fluiddb/about'] + hostname execute_command_line(*parse_args(args)) self.reset ... | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
self.assertEqual (self.err.buffer, []) def showUntagSuccessTest (self, mode): self.stealOutput () (flag, spec) = specify_DADGAD (mode, self.db.host) description = describe_by_mode (spec, mode) | self.assertEqual(self.err.buffer, []) def showUntagSuccessTest(self, mode): self.stealOutput() (flag, spec) = specify_DADGAD(mode, self.db.host) description = describe_by_mode(spec, mode) | def showTaggedSuccessTest (self, mode): self.stealOutput () (flag, spec) = specify_DADGAD (mode, self.db.host) description = describe_by_mode (spec, mode) hostname = ['--hostname', choose_host()] args = ['show', '-v', flag, spec, 'rating', '/fluiddb/about'] + hostname execute_command_line(*parse_args(args)) self.reset ... | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
self.reset () | self.reset() | def showUntagSuccessTest (self, mode): self.stealOutput () (flag, spec) = specify_DADGAD (mode, self.db.host) description = describe_by_mode (spec, mode) hostname = ['--hostname', choose_host()] args = ['show', '-v', flag, spec, 'rating', '/fluiddb/about'] + hostname execute_command_line(*parse_args(args)) self.reset (... | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
self.assertEqual (self.out.buffer, | self.assertEqual(self.out.buffer, | def showUntagSuccessTest (self, mode): self.stealOutput () (flag, spec) = specify_DADGAD (mode, self.db.host) description = describe_by_mode (spec, mode) hostname = ['--hostname', choose_host()] args = ['show', '-v', flag, spec, 'rating', '/fluiddb/about'] + hostname execute_command_line(*parse_args(args)) self.reset (... | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
' %s' % cli_bracket ('tag /%s/rating not present' % user), | ' %s' % cli_bracket('tag /%s/rating not present' % user), | def showUntagSuccessTest (self, mode): self.stealOutput () (flag, spec) = specify_DADGAD (mode, self.db.host) description = describe_by_mode (spec, mode) hostname = ['--hostname', choose_host()] args = ['show', '-v', flag, spec, 'rating', '/fluiddb/about'] + hostname execute_command_line(*parse_args(args)) self.reset (... | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
self.assertEqual (self.err.buffer, []) def testTagByAboutVerboseShow (self): self.tagTest ('about') self.showTaggedSuccessTest ('about') def testTagByIDVerboseShow (self): self.tagTest ('id') self.showTaggedSuccessTest ('id') def testTagByQueryVerboseShow (self): self.tagTest ('query', verbose=False) self.showTagged... | self.assertEqual(self.err.buffer, []) def testTagByAboutVerboseShow(self): self.tagTest('about') self.showTaggedSuccessTest('about') def testTagByIDVerboseShow(self): self.tagTest('id') self.showTaggedSuccessTest('id') def testTagByQueryVerboseShow(self): self.tagTest('query', verbose=False) self.showTaggedSuccessTe... | def showUntagSuccessTest (self, mode): self.stealOutput () (flag, spec) = specify_DADGAD (mode, self.db.host) description = describe_by_mode (spec, mode) hostname = ['--hostname', choose_host()] args = ['show', '-v', flag, spec, 'rating', '/fluiddb/about'] + hostname execute_command_line(*parse_args(args)) self.reset (... | e75848841ac96982524448e932e12fd6ff9cbe0c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12637/e75848841ac96982524448e932e12fd6ff9cbe0c/fdb.py |
def frag_ranking(): global db_conn print """\ <a name=" <ol>\ """ curs = db_conn.cursor() curs.execute(''' select fragger, count(*) as frags from frags where fragger != fragged group by lower(fragger) order by count(*) desc, lower(fragger) asc ''') for row in curs: print " <li>%s (%s)</li>" % (row[0], row[1]) prin... | def frag_ranking(): global db_conn print """\ <a name="#3"><h2>Frag-based ranking</h2></a> <ol>\ | 2da7a755003cb7dd8518c21da9a592835e6fff90 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5281/2da7a755003cb7dd8518c21da9a592835e6fff90/q3ut4_log_parser.py | |
<a name=" | <a name="4"><h2>Frag/death ratio-based ranking</h2></a> | def fdratio_ranking(): global db_conn print """\ <a name="#4"><h2>Frag/death ratio-based ranking</h2></a> <ol>\ | 2da7a755003cb7dd8518c21da9a592835e6fff90 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5281/2da7a755003cb7dd8518c21da9a592835e6fff90/q3ut4_log_parser.py |
<li><a href=" <li><a href=" | <li><a href=" <li><a href=" | def main(): global db_conn if (len(sys.argv) < 2): sys.exit(1) create_db() if os.path.isdir(sys.argv[1]): for logrpath in os.listdir(sys.argv[1]): logfpath = ''.join([sys.argv[1], '/', logrpath]) parse_log(logfpath) else: parse_log(sys.argv[1]) print """\ | 2da7a755003cb7dd8518c21da9a592835e6fff90 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5281/2da7a755003cb7dd8518c21da9a592835e6fff90/q3ut4_log_parser.py |
fdratio_ranking() | def main(): global db_conn if (len(sys.argv) < 2): sys.exit(1) create_db() if os.path.isdir(sys.argv[1]): for logrpath in os.listdir(sys.argv[1]): logfpath = ''.join([sys.argv[1], '/', logrpath]) parse_log(logfpath) else: parse_log(sys.argv[1]) print """\ | 2da7a755003cb7dd8518c21da9a592835e6fff90 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5281/2da7a755003cb7dd8518c21da9a592835e6fff90/q3ut4_log_parser.py | |
ratios.append((players_row[0], float(frags_row[0]) / float(deaths_row[0]))) | try: ratios.append((players_row[0], float(frags_row[0]) / float(deaths_row[0]))) except ZeroDivisionError: ratios.append((players_row[0], 666.0)) | def fdratio_ranking(): global db_conn print """\ <a name="#4"><h2>Frag/death ratio-based ranking</h2></a> <ol>\ | 0fa4764d92166362783b7e78034a6818a5d0396d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5281/0fa4764d92166362783b7e78034a6818a5d0396d/q3ut4_log_parser.py |
print " <li>%s (%i:%i:%i)</li>" % (row[0], int(row[1]) / 3600, int(row[1]) / 60, int(row[1]) % 60) | hours = int(row[1]) / 3600 minutes = (int(row[1]) - hours*3600) / 60 seconds = (int(row[1]) - minutes*60) % 60 print " <li>%s (%i:%i:%i)</li>" % (row[0], hours, minutes, seconds) | def presence_ranking(): global db_conn print """\ <a name="5"><h2>Presence-based ranking</h2></a> <ol>\ | 2fb87919213f248770d2a824f93b34e74584a42c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5281/2fb87919213f248770d2a824f93b34e74584a42c/q3ut4_log_parser.py |
presence_ranking() | def main(): global db_conn if (len(sys.argv) < 2): sys.exit(1) create_db() if os.path.isdir(sys.argv[1]): for logrpath in os.listdir(sys.argv[1]): logfpath = ''.join([sys.argv[1], '/', logrpath]) parse_log(logfpath) else: parse_log(sys.argv[1]) print """\ | 417624c15550da2631938ed615c402ca0df99b30 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5281/417624c15550da2631938ed615c402ca0df99b30/q3ut4_log_parser.py | |
db_conn.execute( '''update games set stop=? where player = ? and stop = -1''', (time, idd[m.group(3)])) del idd[m.group(3)] | try: db_conn.execute( '''update games set stop=? where player = ? and stop = -1''', (time, idd[m.group(3)])) del idd[m.group(3)] except KeyError: pass | def parse_log(logpath): global db_conn idd = {} logf = open(logpath, 'r') while 1: logline = logf.readline() if (not logline): break m = frag_prog.match(logline) if (m): # Update the frags table db_conn.execute( '''insert into frags values (?, ?, ?)''', (m.group(1), m.group(2), m.group(3))) continue m = playerjoins... | 61ccc03c481ada66e0d071a2fe1f272d124066b7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5281/61ccc03c481ada66e0d071a2fe1f272d124066b7/q3ut4_log_parser.py |
mime = self.getContentType() if mime.startswith("text"): return file(self._filePath, "r", BUFFER_SIZE) | def getContent(self): """Open content as a stream for reading. See DAVResource.getContent() """ assert not self.isCollection mime = self.getContentType() if mime.startswith("text"): return file(self._filePath, "r", BUFFER_SIZE) return file(self._filePath, "rb", BUFFER_SIZE) | b0c8a4f6708b247e921c3d20ad2459c4bd24ae7f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8193/b0c8a4f6708b247e921c3d20ad2459c4bd24ae7f/fs_dav_provider.py | |
def copy(self, source, destination, body=None, depth='infinity', overwrite=True, headers=None): """Copy DAV resource""" # Set all proper headers if headers is None: headers = {'Destination':destination} else: headers['Destination'] = self._url.geturl() + destination if overwrite is False: headers['Overwrite'] = 'F' hea... | c8071b86fa2a432a1d3d7102d4786c71bc122b75 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8193/c8071b86fa2a432a1d3d7102d4786c71bc122b75/davclient.py | ||
"""Copy DAV collection""" | """Copy DAV collection. Note: support for the 'propertybehavior' request body for COPY and MOVE has been removed with RFC4918 """ | def copy_collection(self, source, destination, depth='infinity', overwrite=True, headers=None): """Copy DAV collection""" body = '<?xml version="1.0" encoding="utf-8" ?><d:propertybehavior xmlns:d="DAV:"><d:keepalive>*</d:keepalive></d:propertybehavior>' # Add proper headers if headers is None: headers = {} headers['C... | c8071b86fa2a432a1d3d7102d4786c71bc122b75 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8193/c8071b86fa2a432a1d3d7102d4786c71bc122b75/davclient.py |
"""Move DAV collection and copy all properties""" | """Move DAV collection and copy all properties. Note: support for the 'propertybehavior' request body for COPY and MOVE has been removed with RFC4918 """ | def move_collection(self, source, destination, depth='infinity', overwrite=True, headers=None): """Move DAV collection and copy all properties""" body = '<?xml version="1.0" encoding="utf-8" ?><d:propertybehavior xmlns:d="DAV:"><d:keepalive>*</d:keepalive></d:propertybehavior>' # Add proper headers if headers is None:... | c8071b86fa2a432a1d3d7102d4786c71bc122b75 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8193/c8071b86fa2a432a1d3d7102d4786c71bc122b75/davclient.py |
object_to_etree(prop_set, set_props, namespace=namespace) | for p in set_props: prop_prop = ElementTree.SubElement(prop_set, '{DAV:}prop') object_to_etree(prop_prop, p, namespace=namespace) | def proppatch(self, path, set_props=None, remove_props=None, namespace='DAV:', headers=None): """Patch properties on a DAV resource. If namespace is not specified the DAV namespace is used for all properties""" root = ElementTree.Element('{DAV:}propertyupdate') if set_props is not None: prop_set = ElementTree.SubEleme... | c8071b86fa2a432a1d3d7102d4786c71bc122b75 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8193/c8071b86fa2a432a1d3d7102d4786c71bc122b75/davclient.py |
object_to_etree(prop_remove, remove_props, namespace=namespace) | for p in remove_props: prop_prop = ElementTree.SubElement(prop_remove, '{DAV:}prop') object_to_etree(prop_prop, p, namespace=namespace) | def proppatch(self, path, set_props=None, remove_props=None, namespace='DAV:', headers=None): """Patch properties on a DAV resource. If namespace is not specified the DAV namespace is used for all properties""" root = ElementTree.Element('{DAV:}propertyupdate') if set_props is not None: prop_set = ElementTree.SubEleme... | c8071b86fa2a432a1d3d7102d4786c71bc122b75 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8193/c8071b86fa2a432a1d3d7102d4786c71bc122b75/davclient.py |
lock["timeout"] = time.time() + timeout | if timeout < 0: lock["timeout"] = -1 else: lock["timeout"] = time.time() + timeout | def refresh(self, locktoken, timeout=None): """Set new timeout for lock, if existing and valid.""" if timeout is None: timeout = LockManager.LOCK_TIME_OUT_DEFAULT self._lock.acquireWrite() try: lock = self.getLock(locktoken) _logger.debug("refresh %s" % _lockString(lock)) if lock: lock["timeout"] = time.time() + timeou... | c578f4c12d11c8ba7c9cf6f6192734ad0d8a3f50 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8193/c578f4c12d11c8ba7c9cf6f6192734ad0d8a3f50/lock_manager.py |
def getIndirectUrlLockList(self, url, username=None): """Return a list of valid lockDicts, that protect <url> directly or indirectly. If a username is given, only locks owned by this principal are returned. Side effect: expired locks for this url and all parents are purged. """ self._lock.acquireRead() try: lockList =... | c578f4c12d11c8ba7c9cf6f6192734ad0d8a3f50 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8193/c578f4c12d11c8ba7c9cf6f6192734ad0d8a3f50/lock_manager.py | ||
if (not self.wsgiSentHeaders): | if not self.wsgiSentHeaders: | def runWSGIApp (self, application, scriptName, pathInfo, query): logging.info ("Running application with SCRIPT_NAME %s PATH_INFO %s" % (scriptName, pathInfo)) if self.command == "PUT": pass # breakpoint env = {"wsgi.version": (1, 0), "wsgi.url_scheme": "http", "wsgi.input": self.rfile, "wsgi.errors": sys.stderr, "ws... | 6a779acbd2e0523698deba5a65c9d82df58f97fe /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8193/6a779acbd2e0523698deba5a65c9d82df58f97fe/ext_wsgiutils_server.py |
self.wsgiWriteData (" ") | self.wsgiWriteData("") | def runWSGIApp (self, application, scriptName, pathInfo, query): logging.info ("Running application with SCRIPT_NAME %s PATH_INFO %s" % (scriptName, pathInfo)) if self.command == "PUT": pass # breakpoint env = {"wsgi.version": (1, 0), "wsgi.url_scheme": "http", "wsgi.input": self.rfile, "wsgi.errors": sys.stderr, "ws... | 6a779acbd2e0523698deba5a65c9d82df58f97fe /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8193/6a779acbd2e0523698deba5a65c9d82df58f97fe/ext_wsgiutils_server.py |
def do_SHUTDOWN (self): """Send 200 OK response, and set server.stop to True. http://code.activestate.com/recipes/336012/ """ print "got SHUTDOWN" self.send_response(200) self.end_headers() self.server.stop = True | def do_SHUTDOWN (self): """Send 200 OK response, and set server.stop to True. http://code.activestate.com/recipes/336012/ """ print "got SHUTDOWN" self.send_response(200) self.end_headers() self.server.stop = True | 7c2367edf75fd27698ddc10dddec2487c13b4016 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8193/7c2367edf75fd27698ddc10dddec2487c13b4016/ext_wsgiutils_server.py | |
def runWSGIApp (self, application, scriptName, pathInfo, query): logging.info ("Running application with SCRIPT_NAME %s PATH_INFO %s" % (scriptName, pathInfo)) if self.command == "PUT": pass # breakpoint env = {"wsgi.version": (1, 0), "wsgi.url_scheme": "http", "wsgi.input": self.rfile, "wsgi.errors": sys.stderr, "ws... | 7c2367edf75fd27698ddc10dddec2487c13b4016 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8193/7c2367edf75fd27698ddc10dddec2487c13b4016/ext_wsgiutils_server.py | ||
def runWSGIApp (self, application, scriptName, pathInfo, query): logging.info ("Running application with SCRIPT_NAME %s PATH_INFO %s" % (scriptName, pathInfo)) if self.command == "PUT": pass # breakpoint env = {"wsgi.version": (1, 0), "wsgi.url_scheme": "http", "wsgi.input": self.rfile, "wsgi.errors": sys.stderr, "ws... | 7c2367edf75fd27698ddc10dddec2487c13b4016 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8193/7c2367edf75fd27698ddc10dddec2487c13b4016/ext_wsgiutils_server.py | ||
assert hasattr(self, "stop"), "serve_forever_stoppable() must be called" | assert hasattr(self, "stop_request"), "serve_forever_stoppable() must be called before" assert not self.stop_request, "stop_serve_forever() must only be called once" self.stop_request = True time.sleep(.01) if self.stopped: return def _shutdownHandler(self): """Send 200 OK response, and set server.stop_request to ... | def stop_serve_forever(self): """Stop serve_forever_stoppable().""" assert hasattr(self, "stop"), "serve_forever_stoppable() must be called" (host, port) = self.server_address | 7c2367edf75fd27698ddc10dddec2487c13b4016 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8193/7c2367edf75fd27698ddc10dddec2487c13b4016/ext_wsgiutils_server.py |
self.stop = True print "stopping serve_forever_stoppable... Sending %s:%s/ SHUTDOWN" % (host, port) | def stop_serve_forever(self): """Stop serve_forever_stoppable().""" assert hasattr(self, "stop"), "serve_forever_stoppable() must be called" (host, port) = self.server_address | 7c2367edf75fd27698ddc10dddec2487c13b4016 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8193/7c2367edf75fd27698ddc10dddec2487c13b4016/ext_wsgiutils_server.py | |
print "serve_forever_stoppable... stopped.", self.stop | assert self.stop_request | def stop_serve_forever(self): """Stop serve_forever_stoppable().""" assert hasattr(self, "stop"), "serve_forever_stoppable() must be called" (host, port) = self.server_address | 7c2367edf75fd27698ddc10dddec2487c13b4016 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8193/7c2367edf75fd27698ddc10dddec2487c13b4016/ext_wsgiutils_server.py |
self.stop = False while not self.stop: | self.stop_request = False self.stopped = False while not self.stop_request: | def serve_forever_stoppable(self): """Handle one request at a time until stop_serve_forever(). http://code.activestate.com/recipes/336012/ """ self.stop = False while not self.stop: self.handle_request() print "serve_forever_stoppable received stop request" | 7c2367edf75fd27698ddc10dddec2487c13b4016 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8193/7c2367edf75fd27698ddc10dddec2487c13b4016/ext_wsgiutils_server.py |
print "serve_forever_stoppable received stop request" | self.stopped = True | def serve_forever_stoppable(self): """Handle one request at a time until stop_serve_forever(). http://code.activestate.com/recipes/336012/ """ self.stop = False while not self.stop: self.handle_request() print "serve_forever_stoppable received stop request" | 7c2367edf75fd27698ddc10dddec2487c13b4016 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8193/7c2367edf75fd27698ddc10dddec2487c13b4016/ext_wsgiutils_server.py |
if contentlength < 0: | if ( (contentlength < 0) and (environ.get("HTTP_TRANSFER_ENCODING", "").lower() != "chunked") ): | def doPUT(self, environ, start_response): """ @see: http://www.webdav.org/specs/rfc4918.html#METHOD_PUT """ path = environ["PATH_INFO"] provider = self._davProvider res = provider.getResourceInst(path, environ) parentRes = provider.getResourceInst(util.getUriParent(path), environ) isnewfile = res is None | c48715ba2f3cde9c19b1a2790f574eb12d233e87 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8193/c48715ba2f3cde9c19b1a2790f574eb12d233e87/request_server.py |
l = int(environ["wsgi.input"].readline(), 16) | buf = environ["wsgi.input"].readline() if buf == '': l = 0 else: l = int(buf, 16) | def doPUT(self, environ, start_response): """ @see: http://www.webdav.org/specs/rfc4918.html#METHOD_PUT """ path = environ["PATH_INFO"] provider = self._davProvider res = provider.getResourceInst(path, environ) parentRes = provider.getResourceInst(util.getUriParent(path), environ) isnewfile = res is None | c48715ba2f3cde9c19b1a2790f574eb12d233e87 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8193/c48715ba2f3cde9c19b1a2790f574eb12d233e87/request_server.py |
l = int(environ["wsgi.input"].readline(), 16) | buf = environ["wsgi.input"].readline() if buf == '': l = 0 else: l = int(buf, 16) | def doPUT(self, environ, start_response): """ @see: http://www.webdav.org/specs/rfc4918.html#METHOD_PUT """ path = environ["PATH_INFO"] provider = self._davProvider res = provider.getResourceInst(path, environ) parentRes = provider.getResourceInst(util.getUriParent(path), environ) isnewfile = res is None | c48715ba2f3cde9c19b1a2790f574eb12d233e87 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8193/c48715ba2f3cde9c19b1a2790f574eb12d233e87/request_server.py |
res.endWrite(hasErrors=True) | res.endWrite(withErrors=True) | def doPUT(self, environ, start_response): """ @see: http://www.webdav.org/specs/rfc4918.html#METHOD_PUT """ path = environ["PATH_INFO"] provider = self._davProvider res = provider.getResourceInst(path, environ) parentRes = provider.getResourceInst(util.getUriParent(path), environ) isnewfile = res is None | c48715ba2f3cde9c19b1a2790f574eb12d233e87 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8193/c48715ba2f3cde9c19b1a2790f574eb12d233e87/request_server.py |
body = StringIO.StringIO() tree.write(body) body = body.getvalue() print body | def proppatch(self, path, set_props=None, remove_props=None, namespace='DAV:', headers=None): """Patch properties on a DAV resource. If namespace is not specified the DAV namespace is used for all properties""" root = ElementTree.Element('{DAV:}propertyupdate') if set_props is not None: prop_set = ElementTree.SubEleme... | 8ac97ca385f1d583757263facf8e22fd6ffb717e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8193/8ac97ca385f1d583757263facf8e22fd6ffb717e/davclient.py | |
def set_lock(self, path, owner, locktype='exclusive', lockscope='write', depth=None, headers=None): | def set_lock(self, path, owner, locktype='write', lockscope='exclusive', depth=None, headers=None): | def set_lock(self, path, owner, locktype='exclusive', lockscope='write', depth=None, headers=None): """Set a lock on a dav resource""" root = ElementTree.Element('{DAV:}lockinfo') object_to_etree(root, {'locktype':locktype, 'lockscope':lockscope, 'owner':{'href':owner}}, namespace='DAV:') tree = ElementTree.ElementTree... | 8ac97ca385f1d583757263facf8e22fd6ffb717e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8193/8ac97ca385f1d583757263facf8e22fd6ffb717e/davclient.py |
locks = self.response.etree.finall('.//{DAV:}locktoken') | locks = self.response.tree.findall('.//{DAV:}locktoken') | def set_lock(self, path, owner, locktype='exclusive', lockscope='write', depth=None, headers=None): """Set a lock on a dav resource""" root = ElementTree.Element('{DAV:}lockinfo') object_to_etree(root, {'locktype':locktype, 'lockscope':lockscope, 'owner':{'href':owner}}, namespace='DAV:') tree = ElementTree.ElementTree... | 8ac97ca385f1d583757263facf8e22fd6ffb717e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8193/8ac97ca385f1d583757263facf8e22fd6ffb717e/davclient.py |
headers['Lock-Tocken'] = '<%s>' % token | headers['Lock-Token'] = '<%s>' % token | def unlock(self, path, token, headers=None): """Unlock DAV resource with token""" if headers is None: headers = {} headers['Lock-Tocken'] = '<%s>' % token self._request('UNLOCK', path, body=None, headers=headers) | 8ac97ca385f1d583757263facf8e22fd6ffb717e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8193/8ac97ca385f1d583757263facf8e22fd6ffb717e/davclient.py |
def unlock(self, path, token, headers=None): """Unlock DAV resource with token""" if headers is None: headers = {} headers['Lock-Tocken'] = '<%s>' % token self._request('UNLOCK', path, body=None, headers=headers) | 8ac97ca385f1d583757263facf8e22fd6ffb717e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8193/8ac97ca385f1d583757263facf8e22fd6ffb717e/davclient.py | ||
self._fail(HTTP_BAD_REQUEST, "PUT request with invalid Content-Length: (%s)" % environ.get("CONTENT_LENGTH")) | if "Microsoft-WebDAV-MiniRedir" in environ.get("HTTP_USER_AGENT", ""): _logger.warning("Setting misssing Content-Length to 0 for MS client") contentlength = 0 else: self._fail(HTTP_LENGTH_REQUIRED, "PUT request with invalid Content-Length: (%s)" % environ.get("CONTENT_LENGTH")) | def doPUT(self, environ, start_response): """ @see: http://www.webdav.org/specs/rfc4918.html#METHOD_PUT """ path = environ["PATH_INFO"] provider = self._davProvider res = provider.getResourceInst(path, environ) parentRes = provider.getResourceInst(util.getUriParent(path), environ) isnewfile = res is None | f2e5164856c15159dbb7d2095bfc05b7ab5f1adf /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8193/f2e5164856c15159dbb7d2095bfc05b7ab5f1adf/request_server.py |
"""Check, if write access is allowed, otherwise raise DAVError.""" | """Raise DAVError(HTTP_LOCKED), if res is locked. If depth=='infinity', we also raise when child resources are locked. """ | def _checkWritePermission(self, res, depth, environ): """Check, if write access is allowed, otherwise raise DAVError.""" lockMan = self._davProvider.lockManager if lockMan is None or res is None: return True | 6fcd0e4411764f3334770805a25ac575e92ad9b9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8193/6fcd0e4411764f3334770805a25ac575e92ad9b9/request_server.py |
def doPROPPATCH(self, environ, start_response): """Handle PROPPATCH request to set or remove a property. @see http://www.webdav.org/specs/rfc4918.html#METHOD_PROPPATCH """ path = environ["PATH_INFO"] res = self._davProvider.getResourceInst(path, environ) | 6fcd0e4411764f3334770805a25ac575e92ad9b9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8193/6fcd0e4411764f3334770805a25ac575e92ad9b9/request_server.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.