rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
data.append('HTTP/1.1 %d %s\n' % (status_code, status_message))
data.append('HTTP/1.1 %d %s' % (status_code, status_message))
def to_str(self): state = self.state
416f800d511b64f2a9a6332dcd1c387a46fa3796 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/416f800d511b64f2a9a6332dcd1c387a46fa3796/response.py
data.append('%s: %s\n' % (name, value))
data.append('%s: %s' % (name, value)) data.append('Server: Zope') now = datetime.utcnow() data.append('Date: %s' % now.strftime("%a, %d %b %Y %H:%M:%S +0000"))
def to_str(self): state = self.state
416f800d511b64f2a9a6332dcd1c387a46fa3796 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/416f800d511b64f2a9a6332dcd1c387a46fa3796/response.py
data.append('Content-Length: %d\n' % len(state.body))
data.append('Content-Length: %d' % len(state.body)) data.append('Connection: close')
def to_str(self): state = self.state
416f800d511b64f2a9a6332dcd1c387a46fa3796 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/416f800d511b64f2a9a6332dcd1c387a46fa3796/response.py
data.append( 'Set-Cookie: %s="%s"%s\n' % (name, value, ''.join(parameters)))
data.append('Set-Cookie: %s="%s"%s' % (name, value, ''.join(parameters)))
def to_str(self): state = self.state
416f800d511b64f2a9a6332dcd1c387a46fa3796 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/416f800d511b64f2a9a6332dcd1c387a46fa3796/response.py
data.append('\n')
data.append('')
def to_str(self): state = self.state
416f800d511b64f2a9a6332dcd1c387a46fa3796 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/416f800d511b64f2a9a6332dcd1c387a46fa3796/response.py
return ''.join(data)
return '\r\n'.join(data)
def to_str(self): state = self.state
416f800d511b64f2a9a6332dcd1c387a46fa3796 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/416f800d511b64f2a9a6332dcd1c387a46fa3796/response.py
class Distance(object): def __init__(self, first_text, second_text): self.first_text = first_text self.second_text = second_text
class Fuzzy_test(unittest.TestCase): def test_fuzzy_abrevation(self): first_text = """ Mr toto is here """ second_text = """ toto is here Monsieur """ p = fuzzy.Distance(first_text, second_text) print 'test_fuzzy_abrevation', p.distance()
def create_new_text(self): """ Return a text without abrevation. """ t = ' '+self.text+' ' for i in punctuations: t = t.replace(i , ' '+i+' ') for word, abrevations in dictionary.items(): for abrevation in abrevations: t = t.replace(' '+abrevation+' ', ' '+word+' ') return t
dfb1988a57a8adf0d004b7d809532c37a030fb65 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/dfb1988a57a8adf0d004b7d809532c37a030fb65/test_fuzzy.py
def distance(self):
def test_fuzzy_no_abrevation(self): first_text = """ Monsieur toto is here
def distance(self): """ Return a gap and a percent that takes account of abrevations. """ a = SelectText(self.first_text) b = SelectText(self.second_text) a_create = a.create_new_text() b_create = b.create_new_text() dist = max (len(a.text), len(b.text)) dist_create = 5*(max (len(a_create), len(b_create))) gap = self.g...
dfb1988a57a8adf0d004b7d809532c37a030fb65 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/dfb1988a57a8adf0d004b7d809532c37a030fb65/test_fuzzy.py
Return a gap and a percent that takes account of abrevations.
second_text = """ toto is here Monsieur
def distance(self): """ Return a gap and a percent that takes account of abrevations. """ a = SelectText(self.first_text) b = SelectText(self.second_text) a_create = a.create_new_text() b_create = b.create_new_text() dist = max (len(a.text), len(b.text)) dist_create = 5*(max (len(a_create), len(b_create))) gap = self.g...
dfb1988a57a8adf0d004b7d809532c37a030fb65 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/dfb1988a57a8adf0d004b7d809532c37a030fb65/test_fuzzy.py
a = SelectText(self.first_text) b = SelectText(self.second_text) a_create = a.create_new_text() b_create = b.create_new_text() dist = max (len(a.text), len(b.text)) dist_create = 5*(max (len(a_create), len(b_create))) gap = self.gap(self.first_text, self.second_text) gap_create = 5*(self.gap(a_create, b_create)) percen...
p = fuzzy.Distance(first_text, second_text) print 'test_fuzzy_no_abrevation', p.distance()
def distance(self): """ Return a gap and a percent that takes account of abrevations. """ a = SelectText(self.first_text) b = SelectText(self.second_text) a_create = a.create_new_text() b_create = b.create_new_text() dist = max (len(a.text), len(b.text)) dist_create = 5*(max (len(a_create), len(b_create))) gap = self.g...
dfb1988a57a8adf0d004b7d809532c37a030fb65 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/dfb1988a57a8adf0d004b7d809532c37a030fb65/test_fuzzy.py
def gap(self, a, b):
def test_fuzzy_abrevation_differente(self): first_text = """ Why toto is here
def gap(self, a, b): """ This function was giving by Magnus Lie Hetland. It calculates the gap (mathematical distance) between two strings with the cost of word's translation inside the string. """ c = {} n = len(a); m = len(b) for i in range(0,n+1): c[i,0] = i for j in range(0,m+1): c[0,j] = j for i in range(1,n+1): f...
dfb1988a57a8adf0d004b7d809532c37a030fb65 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/dfb1988a57a8adf0d004b7d809532c37a030fb65/test_fuzzy.py
This function was giving by Magnus Lie Hetland. It calculates the gap (mathematical distance) between two strings with the cost of word's translation inside the string.
second_text = """ toto is here Monsieur
def gap(self, a, b): """ This function was giving by Magnus Lie Hetland. It calculates the gap (mathematical distance) between two strings with the cost of word's translation inside the string. """ c = {} n = len(a); m = len(b) for i in range(0,n+1): c[i,0] = i for j in range(0,m+1): c[0,j] = j for i in range(1,n+1): f...
dfb1988a57a8adf0d004b7d809532c37a030fb65 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/dfb1988a57a8adf0d004b7d809532c37a030fb65/test_fuzzy.py
c = {} n = len(a); m = len(b) for i in range(0,n+1): c[i,0] = i for j in range(0,m+1): c[0,j] = j for i in range(1,n+1): for j in range(1,m+1): x = c[i-1,j] + 1 y = c[i,j-1] + 1 if a[i-1] == b[j-1]: z = c[i-1,j-1] else: z = c[i-1,j-1] + 1 c[i,j] = min(x,y,z) return c[n,m]
p = fuzzy.Distance(first_text, second_text) print 'test_fuzzy_abrevation_differente', p.distance()
def gap(self, a, b): """ This function was giving by Magnus Lie Hetland. It calculates the gap (mathematical distance) between two strings with the cost of word's translation inside the string. """ c = {} n = len(a); m = len(b) for i in range(0,n+1): c[i,0] = i for j in range(0,m+1): c[0,j] = j for i in range(1,n+1): f...
dfb1988a57a8adf0d004b7d809532c37a030fb65 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/dfb1988a57a8adf0d004b7d809532c37a030fb65/test_fuzzy.py
def test_fuzzy_translation(self): first_text = """ toto is here now """ second_text = """ now toto is here """ p = fuzzy.Distance(first_text, second_text) print 'test_fuzzy_translation', p.distance() def test_fuzzy_not_all_translation(self): first_text = """ Juan is here now """ second_text = """ now toto is here ""...
def gap(self, a, b): """ This function was giving by Magnus Lie Hetland. It calculates the gap (mathematical distance) between two strings with the cost of word's translation inside the string. """ c = {} n = len(a); m = len(b) for i in range(0,n+1): c[i,0] = i for j in range(0,m+1): c[0,j] = j for i in range(1,n+1): f...
dfb1988a57a8adf0d004b7d809532c37a030fb65 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/dfb1988a57a8adf0d004b7d809532c37a030fb65/test_fuzzy.py
value = value.strip()
def decode(cls, value): value = value.strip() if not value: return None return int(value)
b1da6be3f0aef4638b9ed05e670f2889d59f5b55 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/b1da6be3f0aef4638b9ed05e670f2889d59f5b55/IO.py
value = value.strip()
def decode(cls, value, encoding='utf8'): value = value.strip() return unicode(value, encoding)
b1da6be3f0aef4638b9ed05e670f2889d59f5b55 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/b1da6be3f0aef4638b9ed05e670f2889d59f5b55/IO.py
value = value.strip()
def encode(cls, value): value = value.strip() return value
b1da6be3f0aef4638b9ed05e670f2889d59f5b55 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/b1da6be3f0aef4638b9ed05e670f2889d59f5b55/IO.py
value = value.strip()
def decode(cls, value): value = value.strip() return value
b1da6be3f0aef4638b9ed05e670f2889d59f5b55 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/b1da6be3f0aef4638b9ed05e670f2889d59f5b55/IO.py
value = value.strip()
def decode(cls, value): value = value.strip() return bool(int(value))
b1da6be3f0aef4638b9ed05e670f2889d59f5b55 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/b1da6be3f0aef4638b9ed05e670f2889d59f5b55/IO.py
value = value.strip()
def decode(cls, value): value = value.strip() if not value: return None year, month, day = value.split('-') year, month, day = int(year), int(month), int(day) return datetime.date(year, month, day)
b1da6be3f0aef4638b9ed05e670f2889d59f5b55 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/b1da6be3f0aef4638b9ed05e670f2889d59f5b55/IO.py
value = value.strip()
def decode(cls, value): value = value.strip() if not value: return None date, time = value.split() year, month, day = date.split('-') year, month, day = int(year), int(month), int(day) hours, minutes = time.split(':') hours, minutes = int(hours), int(minutes) return datetime.datetime(year, month, day, hours, minutes)
b1da6be3f0aef4638b9ed05e670f2889d59f5b55 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/b1da6be3f0aef4638b9ed05e670f2889d59f5b55/IO.py
version = "0.9.2",
version = "0.9.3",
def finalize_options (self): self.set_undefined_options('install', ('install_purelib', 'install_dir'), ('root', 'root'), ('force', 'force'), )
1f26a57068e762ab15047c0c6f415ab5ef8501fd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/1f26a57068e762ab15047c0c6f415ab5ef8501fd/setup.py
for x in handler.traverse(): root.unindex_handler(x)
for x, context in handler.traverse2(): if x.real_handler is None: root.unindex_handler(x) else: context.skip = True
def on_del_handler(self, segment): from root import Root
1340f5ce51149317c628304ee4603e19fc912b40 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/1340f5ce51149317c628304ee4603e19fc912b40/Folder.py
def view(self):
def view(self, context):
def view(self): namespace = {} namespace['format'] = self.get_mimetype()
14fa43c3a5e1451dbc24fcb59d72a111aa7961c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/14fa43c3a5e1451dbc24fcb59d72a111aa7961c2/binary.py
version = "0.6.2",
version = "0.6.3",
def build_module(self, module, module_file, package): if isinstance(package, str): package = package.split('.') elif not isinstance(package, (list, tuple)): raise TypeError, \ "'package' must be a string (dot-separated), list, or tuple"
34d61a75b03b8c9dbb4b2d4dc5ece05ba3621efd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/34d61a75b03b8c9dbb4b2d4dc5ece05ba3621efd/setup.py
gettext = self.object.gettext(message)
gettext = self.handler.gettext(message)
def come_back(self, message, **kw): # Translate the source message, gettext = self.object.gettext(message) message = Template(message).substitute(kw) # Build and the return the uri reference to go referrer = self.request.referrer return referrer.replace(message=message)
95f5423a36fd9f95eb69c75a372dfa43f65b2c87 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/95f5423a36fd9f95eb69c75a372dfa43f65b2c87/context.py
def new(self, title=''):
def new(self):
def new(self, title=''): # XXX Old style (like in the "get_skeleton" times) skeleton = self.get_skeleton(title) file = StringIO() file.write(skeleton) file.seek(0) self.load_state_from_file(file)
ff7fd91e1eda69047b7e2b74befb0cae69793b1c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/ff7fd91e1eda69047b7e2b74befb0cae69793b1c/PO.py
skeleton = self.get_skeleton(title) file = StringIO() file.write(skeleton) file.seek(0) self.load_state_from_file(file)
skeleton = self.get_skeleton() self.load_state_from_string(skeleton)
def new(self, title=''): # XXX Old style (like in the "get_skeleton" times) skeleton = self.get_skeleton(title) file = StringIO() file.write(skeleton) file.seek(0) self.load_state_from_file(file)
ff7fd91e1eda69047b7e2b74befb0cae69793b1c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/ff7fd91e1eda69047b7e2b74befb0cae69793b1c/PO.py
conn = HTTPConnection(str(reference.authority)) conn.request('HEAD', str(reference.path)) response = conn.getresponse()
response = HTTPFS._head(reference)
def exists(reference): conn = HTTPConnection(str(reference.authority)) # XXX Add the query conn.request('HEAD', str(reference.path)) response = conn.getresponse() status = int(response.status) return status < 400 or status >= 500
40625dc97f7e684e6d217d1aadd162512a7d003c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/40625dc97f7e684e6d217d1aadd162512a7d003c/vfs.py
def open(reference):
def open(reference, mode=None):
def open(reference): reference = str(reference) return urlopen(reference)
40625dc97f7e684e6d217d1aadd162512a7d003c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/40625dc97f7e684e6d217d1aadd162512a7d003c/vfs.py
query = urllib.unquote_plus(query)
def __init__(self, query): if query: query = urllib.unquote_plus(query) for x in query.split('&'): if x: key, value = x.split('=', 1) dict.__setitem__(self, key, value)
c7fe76ee9c9dd1e69923db3295414f0642bc44cd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/c7fe76ee9c9dd1e69923db3295414f0642bc44cd/generic.py
message = u'We did not find results for "%s".' namespace['not_found'] = self.gettext(message) % text
message = u'We did not find results for "%s".' % text namespace['not_found'] = self.gettext(message)
def site_search(self, context): text = context.get_form_value('site_search_text').strip() if not text: return context.come_back(u"Empty search value.")
68447597de7856209a7d3a20e02d3dbfdfe5ac84 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/68447597de7856209a7d3a20e02d3dbfdfe5ac84/WebSite.py
if context.has_parameter('add_and_return'):
if context.has_form_value('add_and_return'):
def new_user(self, context): username = context.get_form_value('username') password = context.get_form_value('password') password2 = context.get_form_value('password2') groups = context.get_form_values('groups')
d0407d80a3d5dfaa25b8550915c14f3883bb1f50 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d0407d80a3d5dfaa25b8550915c14f3883bb1f50/users.py
new_query(('%s:int' % key, str(value)))
new_query.append(('%s:int' % key, str(value)))
def build_url(self, url=None, preserve=[], **kw): """ Builds and returns a new url from the one we are now. Preserves only the query parameters that start with any of the specified prefixes in the 'preserve' argument. The keywords argument is used to add or modify query parameters. """ if url is None: url = self.uri.pa...
4766dbdc05877bdc9e1a9a89fc91498fab242f2f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/4766dbdc05877bdc9e1a9a89fc91498fab242f2f/Request.py
storage = FileStorage('%s/database.fs' % target) database = zodb.Database(storage)
def init(parser, options, target): try: os.mkdir(target) except OSError: parser.error('can not create the instance (check permissions)') # Create the database storage = FileStorage('%s/database.fs' % target) database = zodb.Database(storage) # Create the config file config = RawConfigParser() config.add_section('inst...
fa68d086a1fe877a8ae1d77a6739a1d5a8a6179f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/fa68d086a1fe877a8ae1d77a6739a1d5a8a6179f/icms.py
config = RawConfigParser() config.add_section('instance')
config = get_config()
def init(parser, options, target): try: os.mkdir(target) except OSError: parser.error('can not create the instance (check permissions)') # Create the database storage = FileStorage('%s/database.fs' % target) database = zodb.Database(storage) # Create the config file config = RawConfigParser() config.add_section('inst...
fa68d086a1fe877a8ae1d77a6739a1d5a8a6179f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/fa68d086a1fe877a8ae1d77a6739a1d5a8a6179f/icms.py
print ' icms.py start %s' % target
print ' %s start %s' % (parser.get_prog_name(), target)
def init(parser, options, target): try: os.mkdir(target) except OSError: parser.error('can not create the instance (check permissions)') # Create the database storage = FileStorage('%s/database.fs' % target) database = zodb.Database(storage) # Create the config file config = RawConfigParser() config.add_section('inst...
fa68d086a1fe877a8ae1d77a6739a1d5a8a6179f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/fa68d086a1fe877a8ae1d77a6739a1d5a8a6179f/icms.py
if options.source is not None: parser.error('option --import not allowed in this context') if options.root is not None: parser.error('option --root not allowed in this context')
def start(parser, options, target): if options.source is not None: parser.error('option --import not allowed in this context') if options.root is not None: parser.error('option --root not allowed in this context') # Load the config config = RawConfigParser() config.add_section('instance') config.read(['%s/config.ini'...
fa68d086a1fe877a8ae1d77a6739a1d5a8a6179f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/fa68d086a1fe877a8ae1d77a6739a1d5a8a6179f/icms.py
config = RawConfigParser() config.add_section('instance') config.read(['%s/config.ini' % target]) storage = FileStorage('%s/database.fs' % target) database = zodb.Database(storage) root_resource = database.get_resource('/')
config = get_config(target)
def start(parser, options, target): if options.source is not None: parser.error('option --import not allowed in this context') if options.root is not None: parser.error('option --root not allowed in this context') # Load the config config = RawConfigParser() config.add_section('instance') config.read(['%s/config.ini'...
fa68d086a1fe877a8ae1d77a6739a1d5a8a6179f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/fa68d086a1fe877a8ae1d77a6739a1d5a8a6179f/icms.py
metadata = root_resource.get_resource('.metadata') metadata = Metadata(metadata) format = metadata.get_property('format') root = Root.build_handler(root_resource, format=format)
database = get_database(target) root = get_root(database)
def start(parser, options, target): if options.source is not None: parser.error('option --import not allowed in this context') if options.root is not None: parser.error('option --root not allowed in this context') # Load the config config = RawConfigParser() config.add_section('instance') config.read(['%s/config.ini'...
fa68d086a1fe877a8ae1d77a6739a1d5a8a6179f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/fa68d086a1fe877a8ae1d77a6739a1d5a8a6179f/icms.py
' icms.py init creates a new instance\n' ' icms.py start starts the web server')
' %prog init creates a new instance\n' ' %prog start starts the web server\n' ' %prog update updates the instance (if needed)')
def start(parser, options, target): if options.source is not None: parser.error('option --import not allowed in this context') if options.root is not None: parser.error('option --root not allowed in this context') # Load the config config = RawConfigParser() config.add_section('instance') config.read(['%s/config.ini'...
fa68d086a1fe877a8ae1d77a6739a1d5a8a6179f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/fa68d086a1fe877a8ae1d77a6739a1d5a8a6179f/icms.py
'-i', '--import', help='use the SOURCE directory to init the database', dest='source')
'-s', '--source', help='use the SOURCE directory to init the database')
def start(parser, options, target): if options.source is not None: parser.error('option --import not allowed in this context') if options.root is not None: parser.error('option --root not allowed in this context') # Load the config config = RawConfigParser() config.add_section('instance') config.read(['%s/config.ini'...
fa68d086a1fe877a8ae1d77a6739a1d5a8a6179f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/fa68d086a1fe877a8ae1d77a6739a1d5a8a6179f/icms.py
command, target = args if command == 'init': init(parser, options, target) elif command == 'start': start(parser, options, target) else: parser.error('unexpected command "%s"' % command)
command_name, target = args commands = {'init': (init, ['source', 'root', 'port']), 'start': (start, ['port']), 'update': (update, [])} if command_name not in commands: parser.error('unexpected command "%s"' % command_name) command, allowed_options = commands[command_name] for key, value in options.__dict__.items...
def start(parser, options, target): if options.source is not None: parser.error('option --import not allowed in this context') if options.root is not None: parser.error('option --root not allowed in this context') # Load the config config = RawConfigParser() config.add_section('instance') config.read(['%s/config.ini'...
fa68d086a1fe877a8ae1d77a6739a1d5a8a6179f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/fa68d086a1fe877a8ae1d77a6739a1d5a8a6179f/icms.py
pid = open('%s/pid' % self.target).read()
try: pid = open('%s/pid' % self.target).read() except IOError: return None
def get_pid(self): pid = open('%s/pid' % self.target).read() pid = int(pid) try: # XXX This only works on Unix os.getpgid(pid) except OSError: return None
9af97f9c61c6811493d43f907e4328149b2c8f77 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/9af97f9c61c6811493d43f907e4328149b2c8f77/server.py
html = self.to_html().encode('UTF-8')
html = self.to_html()
def to_text(self): if self.__text_output__ is not None: return self.__text_output__
05a42d2105d57086282999aa1378cbdd147088ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/05a42d2105d57086282999aa1378cbdd147088ce/binary.py
request_uri.path = uri.Path(request.get_parameter('REAL_PATH'))
real_path = request.get_parameter('REAL_PATH') request_uri.path = uri.Path('/' + real_path)
def __init__(self, request): self.request = request self.response = Response()
af27da4806f82585dc6a259408a19498a8582115 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/af27da4806f82585dc6a259408a19498a8582115/context.py
parent = None
def __cmp__(self, other): if not isinstance(other, self.__class__): return 1 return cmp(self.data, other.data)
415fd50c094a7812130094a2e5feaaac410f73f0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/415fd50c094a7812130094a2e5feaaac410f73f0/XML.py
clone.children = deepcopy(self.children)
for child in self.children: if isinstance(child, unicode): self.children.append(child) else: self.children.append(child.copy())
def copy(self): """ DOM: cloneNode. """ # Build a new node clone = self.__class__(self.prefix, self.name) # Copy the attributes clone.attributes = self.attributes.copy() clone.prefixes = self.prefixes.copy() # Copy the children (XXX) clone.children = deepcopy(self.children)
415fd50c094a7812130094a2e5feaaac410f73f0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/415fd50c094a7812130094a2e5feaaac410f73f0/XML.py
for handler in list(self): if hasattr(handler, 'before_commit'): handler.before_commit()
try: for handler in list(self): if hasattr(handler, 'before_commit'): handler.before_commit() except: self.rollback() raise
def commit(self): # Event: before commit for handler in list(self): if hasattr(handler, 'before_commit'): handler.before_commit()
7b7ca81941ca2e76c47c46b76a502060c6de1b43 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/7b7ca81941ca2e76c47c46b76a502060c6de1b43/transactions.py
def update_20060503(self):
def update_20060602(self):
def update_20060503(self): root = vfs.open(self.uri) # Remove ".archive" root.remove('.archive')
1a7b2f2341e0fe89869a6f2e96165eb0116cb46f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/1a7b2f2341e0fe89869a6f2e96165eb0116cb46f/root.py
def update_20060602(self):
def update_20060503(self): root = vfs.open(self.uri) # Remove ".archive" root.remove('.archive')
1a7b2f2341e0fe89869a6f2e96165eb0116cb46f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/1a7b2f2341e0fe89869a6f2e96165eb0116cb46f/root.py
admins = self.get_handler('admins/.users').get_usernames() self.set_handler('.admins.users', ListOfUsers(users=admins))
root.move('admins/.users', '.admins.users')
def update_20060602(self): # Add '.admins.users' admins = self.get_handler('admins/.users').get_usernames() self.set_handler('.admins.users', ListOfUsers(users=admins)) # Remove handlers self.del_handler('.users') self.del_handler('admins') self.del_handler('.admins.metadata') self.del_handler('reviewers') self.del_han...
1a7b2f2341e0fe89869a6f2e96165eb0116cb46f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/1a7b2f2341e0fe89869a6f2e96165eb0116cb46f/root.py
self.del_handler('.users') self.del_handler('admins') self.del_handler('.admins.metadata') self.del_handler('reviewers') self.del_handler('.reviewers.metadata')
root.remove('.users') root.remove('admins') root.remove('admins.metadata') root.remove('reviewers') root.remove('reviewers.metadata')
def update_20060602(self): # Add '.admins.users' admins = self.get_handler('admins/.users').get_usernames() self.set_handler('.admins.users', ListOfUsers(users=admins)) # Remove handlers self.del_handler('.users') self.del_handler('admins') self.del_handler('.admins.metadata') self.del_handler('reviewers') self.del_han...
1a7b2f2341e0fe89869a6f2e96165eb0116cb46f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/1a7b2f2341e0fe89869a6f2e96165eb0116cb46f/root.py
self.del_handler('en.po')
if root.exists('en.po'): root.remove('en.po') root.remove('en.po.metadata')
def update_20060602(self): # Add '.admins.users' admins = self.get_handler('admins/.users').get_usernames() self.set_handler('.admins.users', ListOfUsers(users=admins)) # Remove handlers self.del_handler('.users') self.del_handler('admins') self.del_handler('.admins.metadata') self.del_handler('reviewers') self.del_han...
1a7b2f2341e0fe89869a6f2e96165eb0116cb46f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/1a7b2f2341e0fe89869a6f2e96165eb0116cb46f/root.py
self.uri = uri.get_reference('http://%s/%s' % (authority, path))
if request.has_parameter('REAL_PATH'): real_path = request.get_parameter('REAL_PATH') reference = 'http://%s/%s' % (authority, real_path) else: reference = 'http://%s/%s' % (authority, path) self.uri = uri.get_reference(reference)
def __init__(self, request, authority): self.request = request self.response = Response()
996a08344322addb3526a2fe7bb50bc4769e7b8b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/996a08344322addb3526a2fe7bb50bc4769e7b8b/context.py
handler.schema = {'name': Unicode, 'url': URI, 'number': Integer, 'date': Date}
handler.schema = {'name': Unicode, 'url': URI, 'number': Integer, 'date': Date}
def test_load_state_with_schema(self): resource = memory.File(TEST_DATA_1) handler = itools_csv.CSV() handler.columns = ['name', 'url', 'number', 'date'] handler.schema = {'name': Unicode, 'url': URI, 'number': Integer, 'date': Date} handler.load_state(resource) self.assertEqual(handler.get_rows(), [ [u"python", URI.de...
d1c92817f2412181e68be715a2a81901cf1a83ed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d1c92817f2412181e68be715a2a81901cf1a83ed/test_itools_csv.py
[u"python", URI.decode('http://python.org'), 52343, Date.decode('2003-10-23')], [u"ruby", URI.decode('http://ruby-lang.org'), 42352, Date.decode('2001-03-28')]])
[u"python", URI.decode('http://python.org'), 52343, Date.decode('2003-10-23')], [u"ruby", URI.decode('http://ruby-lang.org'), 42352, Date.decode('2001-03-28')]])
def test_load_state_with_schema(self): resource = memory.File(TEST_DATA_1) handler = itools_csv.CSV() handler.columns = ['name', 'url', 'number', 'date'] handler.schema = {'name': Unicode, 'url': URI, 'number': Integer, 'date': Date} handler.load_state(resource) self.assertEqual(handler.get_rows(), [ [u"python", URI.de...
d1c92817f2412181e68be715a2a81901cf1a83ed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d1c92817f2412181e68be715a2a81901cf1a83ed/test_itools_csv.py
handler.schema = {'name': Unicode, 'url': URI, 'number': Integer, 'date': Date}
handler.schema = {'name': Unicode, 'url': URI, 'number': Integer, 'date': Date}
def test_load_state_without_schema(self): resource = memory.File(TEST_DATA_1) handler = itools_csv.CSV() handler.schema = {'name': Unicode, 'url': URI, 'number': Integer, 'date': Date} handler.load_state(resource) self.assertEqual(handler.get_rows(), [ [u"python", u'http://python.org', u'52343', u'2003-10-23'], [u"ruby...
d1c92817f2412181e68be715a2a81901cf1a83ed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d1c92817f2412181e68be715a2a81901cf1a83ed/test_itools_csv.py
handler.schema = {'name': Unicode, 'url': URI, 'number': Integer, 'date': Date} handler.load_state(resource) self.assertEqual(handler.to_str(), u'"python","http://python.org","52343","2003-10-23"\n' +
handler.schema = {'name': Unicode, 'url': URI, 'number': Integer, 'date': Date} handler.load_state(resource) self.assertEqual( handler.to_str(), u'"python","http://python.org","52343","2003-10-23"\n'
def test_to_str_with_schema(self): resource = memory.File(TEST_DATA_1) handler = itools_csv.CSV() handler.columns = ['name', 'url', 'number', 'date'] handler.schema = {'name': Unicode, 'url': URI, 'number': Integer, 'date': Date} handler.load_state(resource) self.assertEqual(handler.to_str(), u'"python","http://python....
d1c92817f2412181e68be715a2a81901cf1a83ed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d1c92817f2412181e68be715a2a81901cf1a83ed/test_itools_csv.py
self.assertEqual(handler.to_str(), u'"python","http://python.org","52343","2003-10-23"\n' +
self.assertEqual( handler.to_str(), u'"python","http://python.org","52343","2003-10-23"\n'
def test_to_str_without_schema(self): resource = memory.File(TEST_DATA_1) handler = itools_csv.CSV() handler.load_state(resource) self.assertEqual(handler.to_str(), u'"python","http://python.org","52343","2003-10-23"\n' + u'"ruby","http://ruby-lang.org","42352","2001-03-28"')
d1c92817f2412181e68be715a2a81901cf1a83ed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d1c92817f2412181e68be715a2a81901cf1a83ed/test_itools_csv.py
def test_add_row(self): resource = memory.File(TEST_DATA_2) handler = itools_csv.CSV(resource) handler.add_row(['a', 'b', 'c']) self.assertEqual(handler.get_row(3), ['a', 'b', 'c'])
d1c92817f2412181e68be715a2a81901cf1a83ed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d1c92817f2412181e68be715a2a81901cf1a83ed/test_itools_csv.py
def test_del_row(self): resource = memory.File(TEST_DATA_2) handler = itools_csv.CSV(resource) handler.del_row(1) self.assertEqual(handler.get_row(1), ['seven', 'eight', 'nine'])
d1c92817f2412181e68be715a2a81901cf1a83ed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d1c92817f2412181e68be715a2a81901cf1a83ed/test_itools_csv.py
def test_del_rows(self): resource = memory.File(TEST_DATA_2) handler = itools_csv.CSV(resource) handler.del_rows([0, 1]) self.assertEqual(handler.get_row(0), ['seven', 'eight', 'nine'])
d1c92817f2412181e68be715a2a81901cf1a83ed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d1c92817f2412181e68be715a2a81901cf1a83ed/test_itools_csv.py
handler.schema = {'name': Unicode, 'url': URI, 'number': Integer(index=True), 'date': Date(index=True)}
handler.schema = {'name': Unicode, 'url': URI, 'number': Integer(index=True), 'date': Date(index=True)}
def test_indexes_hit_in_one_row(self): data = TEST_DATA_1 resource = memory.File(data) handler = itools_csv.CSV() handler.columns = ['name', 'url', 'number', 'date'] handler.schema = {'name': Unicode, 'url': URI, 'number': Integer(index=True), 'date': Date(index=True)} handler.load_state(resource) self.assertEqual(len(...
d1c92817f2412181e68be715a2a81901cf1a83ed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d1c92817f2412181e68be715a2a81901cf1a83ed/test_itools_csv.py
self.assertEqual(handler.search([('url', URI.decode('http://slashdot.org/'))]), None)
self.assertEqual( handler.search([('url', URI.decode('http://slashdot.org/'))]),None)
def test_indexes_hit_in_one_row(self): data = TEST_DATA_1 resource = memory.File(data) handler = itools_csv.CSV() handler.columns = ['name', 'url', 'number', 'date'] handler.schema = {'name': Unicode, 'url': URI, 'number': Integer(index=True), 'date': Date(index=True)} handler.load_state(resource) self.assertEqual(len(...
d1c92817f2412181e68be715a2a81901cf1a83ed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d1c92817f2412181e68be715a2a81901cf1a83ed/test_itools_csv.py
self.assertEqual(handler.search([('date', Date.decode('2001-03-28'))]), [1])
self.assertEqual( handler.search([('date', Date.decode('2001-03-28'))]), [1])
def test_indexes_hit_in_one_row(self): data = TEST_DATA_1 resource = memory.File(data) handler = itools_csv.CSV() handler.columns = ['name', 'url', 'number', 'date'] handler.schema = {'name': Unicode, 'url': URI, 'number': Integer(index=True), 'date': Date(index=True)} handler.load_state(resource) self.assertEqual(len(...
d1c92817f2412181e68be715a2a81901cf1a83ed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d1c92817f2412181e68be715a2a81901cf1a83ed/test_itools_csv.py
self.assertEqual(handler.search([('name', Unicode.decode('house'))]), None) self.assertEqual(handler.search([('date', Date.decode('2005-01-01'))]), []) self.assertEqual(handler.search([('date', Date.decode('2005-10-10'))]), [0, 2])
self.assertEqual( handler.search([('name', Unicode.decode('house'))]), None) self.assertEqual( handler.search([('date', Date.decode('2005-01-01'))]), []) self.assertEqual( handler.search([('date', Date.decode('2005-10-10'))]), [0, 2])
def test_indexes_hit_in_many_rows(self): data = 'house,2005-10-10\nwindow,2005-05-10\ncomputer,2005-10-10' resource = memory.File(data) handler = itools_csv.CSV() handler.columns = ['name', 'date'] handler.schema = {'name': Unicode, 'date': Date(index=True)} handler.load_state(resource) self.assertEqual(handler.search(...
d1c92817f2412181e68be715a2a81901cf1a83ed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d1c92817f2412181e68be715a2a81901cf1a83ed/test_itools_csv.py
self.assertEqual(handler.search([('date', Date.decode('2005-05-10'))]), [1, 3])
self.assertEqual( handler.search([('date', Date.decode('2005-05-10'))]), [1, 3])
def test_index_new_row(self): data = 'house,2005-10-10\nwindow,2005-05-10\ncomputer,2005-10-10' resource = memory.File(data) handler = itools_csv.CSV() handler.columns = ['name', 'date'] handler.schema = {'name': Unicode, 'date': Date(index=True)} handler.load_state(resource) handler.add_row(['flower', Date.decode('200...
d1c92817f2412181e68be715a2a81901cf1a83ed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d1c92817f2412181e68be715a2a81901cf1a83ed/test_itools_csv.py
handler.schema = {'name': Unicode(index=True), 'date': Date(index=True)}
handler.schema = {'name': Unicode(index=True), 'date': Date(index=True)}
def test_index_del_row(self): data = 'house,2005-10-10\nwindow,2005-05-10\ncomputer,2005-10-10' resource = memory.File(data) handler = itools_csv.CSV() handler.columns = ['name', 'date'] handler.schema = {'name': Unicode(index=True), 'date': Date(index=True)} handler.load_state(resource) self.assertEqual(handler.search...
d1c92817f2412181e68be715a2a81901cf1a83ed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d1c92817f2412181e68be715a2a81901cf1a83ed/test_itools_csv.py
handler.schema = {'name': Unicode, 'surname': Unicode(index=True), 'date': Date(index=True)}
handler.schema = {'name': Unicode, 'surname': Unicode(index=True), 'date': Date(index=True)}
def test_build_csv_data(self): resource = memory.File('') handler = itools_csv.CSV() handler.columns = ['name', 'surname', 'date'] handler.schema = {'name': Unicode, 'surname': Unicode(index=True), 'date': Date(index=True)} handler.load_state(resource) handler.add_row(['Piotr', 'Macuk', '1975-12-08']) handler.add_row([...
d1c92817f2412181e68be715a2a81901cf1a83ed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d1c92817f2412181e68be715a2a81901cf1a83ed/test_itools_csv.py
handler.schema = {'id': Integer, 'name': Unicode(index=True), 'country': Unicode(index=True), 'date': Date(index=True)}
handler.schema = {'id': Integer, 'name': Unicode(index=True), 'country': Unicode(index=True), 'date': Date(index=True)}
def test_advanced_search(self): resource = get_resource('test_adv.csv') handler = itools_csv.CSV() handler.columns = ['id', 'name', 'country', 'date'] handler.schema = {'id': Integer, 'name': Unicode(index=True), 'country': Unicode(index=True), 'date': Date(index=True)} handler.load_state(resource) result1 = handler.se...
d1c92817f2412181e68be715a2a81901cf1a83ed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d1c92817f2412181e68be715a2a81901cf1a83ed/test_itools_csv.py
def test_advanced_search(self): resource = get_resource('test_adv.csv') handler = itools_csv.CSV() handler.columns = ['id', 'name', 'country', 'date'] handler.schema = {'id': Integer, 'name': Unicode(index=True), 'country': Unicode(index=True), 'date': Date(index=True)} handler.load_state(resource) result1 = handler.se...
d1c92817f2412181e68be715a2a81901cf1a83ed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d1c92817f2412181e68be715a2a81901cf1a83ed/test_itools_csv.py
stored_field = doc_handler.get_handler('s%d' %field.number) setattr(document, field.name, stored_field.value)
name = 's%d' % field.number if doc_handler.has_handler(name): stored_field = doc_handler.get_handler(name) value = stored_field.value else: value = None setattr(document, field.name, value)
def search(self, query=None, **kw): # Search documents = self._search(query, **kw) # Sort by weight documents = [ (weight, doc_number) for doc_number, weight in documents.items() ] documents.sort() documents.reverse() # Build the document objects fields = self.get_handler('fields') for i, document in enumerate(document...
4065d4973f5fda9bc5d591a8044a463b97f1bd81 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/4065d4973f5fda9bc5d591a8044a463b97f1bd81/Catalog.py
version = "0.5.1",
version = "0.6.0",
def build_module(self, module, module_file, package): if isinstance(package, str): package = package.split('.') elif not isinstance(package, (list, tuple)): raise TypeError, \ "'package' must be a string (dot-separated), list, or tuple"
2b91848bc5d554a2007b1ae908ed17a795560d7f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/2b91848bc5d554a2007b1ae908ed17a795560d7f/setup.py
self.removed_documents.append(doc_n)
else: self.removed_documents.append(doc_n)
def unindex_document(self, doc_n): if doc_n in self.added_documents: self.added_documents.remove(doc_n) self.removed_documents.append(doc_n)
20d8b4c9b2edb8f79ebc810f7526c3e49b7c0786 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/20d8b4c9b2edb8f79ebc810f7526c3e49b7c0786/documents.py
for i, document in enumerate(documents):
for document in documents:
def search(self, query=None, **kw): # Search documents = self._search(query, **kw) # Sort by weight documents = [ (weight, doc_number) for doc_number, weight in documents.items() ] documents.sort() documents.reverse() # Build the document objects fields = self.get_handler('fields') for i, document in enumerate(document...
956d5770cff10ef8403d95812a1b3779f10d8b80 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/956d5770cff10ef8403d95812a1b3779f10d8b80/Catalog.py
documents[i] = document return documents
yield document
def search(self, query=None, **kw): # Search documents = self._search(query, **kw) # Sort by weight documents = [ (weight, doc_number) for doc_number, weight in documents.items() ] documents.sort() documents.reverse() # Build the document objects fields = self.get_handler('fields') for i, document in enumerate(document...
956d5770cff10ef8403d95812a1b3779f10d8b80 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/956d5770cff10ef8403d95812a1b3779f10d8b80/Catalog.py
remains = size - len(buffer[0])
def non_blocking_load(self, read): buffer = '' # Read the first line while True: data = read(512) data_size = len(data) # Check there is some data, if not we abort the request, something # may be wrong. if data_size == 0: raise BadRequest buffer += data buffer = buffer.split('\r\n', 1) if len(buffer) == 2: request_line...
56f958660ac98c83990816804227df68fbc2d6bf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/56f958660ac98c83990816804227df68fbc2d6bf/request.py
if body and 'content-type' in self.headers:
if body:
def non_blocking_load(self, read): buffer = '' # Read the first line while True: data = read(512) data_size = len(data) # Check there is some data, if not we abort the request, something # may be wrong. if data_size == 0: raise BadRequest buffer += data buffer = buffer.split('\r\n', 1) if len(buffer) == 2: request_line...
56f958660ac98c83990816804227df68fbc2d6bf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/56f958660ac98c83990816804227df68fbc2d6bf/request.py
self._body = uri.generic.Query.decode(body)
self.body = uri.generic.Query.decode(body)
def non_blocking_load(self, read): buffer = '' # Read the first line while True: data = read(512) data_size = len(data) # Check there is some data, if not we abort the request, something # may be wrong. if data_size == 0: raise BadRequest buffer += data buffer = buffer.split('\r\n', 1) if len(buffer) == 2: request_line...
56f958660ac98c83990816804227df68fbc2d6bf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/56f958660ac98c83990816804227df68fbc2d6bf/request.py
' %prog update updates the instance (if needed)')
' %prog update updates the instance (if needed)\n' ' %prog pack packs the database')
def update(parser, options, target): # Load the config config = get_config(target) # Import the root class if is not the default if config.has_option('instance', 'root'): exec('import %s' % config.get('instance', 'root')) # Load the root resource database = get_database(target) root = get_root(database) instance_ver...
03c622a24159a217034db224a2fc372e58727d37 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/03c622a24159a217034db224a2fc372e58727d37/icms.py
'update': (update, [])}
'update': (update, []), 'pack': (pack, [])}
def update(parser, options, target): # Load the config config = get_config(target) # Import the root class if is not the default if config.has_option('instance', 'root'): exec('import %s' % config.get('instance', 'root')) # Load the root resource database = get_database(target) root = get_root(database) instance_ver...
03c622a24159a217034db224a2fc372e58727d37 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/03c622a24159a217034db224a2fc372e58727d37/icms.py
size = len([ x for x in resource.get_names()
size = len([ x for x in vfs.get_names(self.uri)
def get_human_size(self): uri = self.uri if vfs.is_file(uri): bytes = resource.get_size() kbytes = bytes / 1024.0 if kbytes >= 1024: mbytes = kbytes / 1024.0 size = self.gettext(u'%.01f MB') % mbytes else: size = self.gettext(u'%.01f KB') % kbytes else: size = len([ x for x in resource.get_names() if not x.startswith('...
83f7aa137cfbbe7add3d64d9963d7748ef72f059 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/83f7aa137cfbbe7add3d64d9963d7748ef72f059/Handler.py
version = "0.9.0",
version = "0.9.1",
def finalize_options (self): self.set_undefined_options('install', ('install_purelib', 'install_dir'), ('root', 'root'), ('force', 'force'), )
ade10a4faeb3ecd88d452d24955cb7811b82b6d5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/ade10a4faeb3ecd88d452d24955cb7811b82b6d5/setup.py
message = i18n.segment.Message(node.children)
message = Message(node.children)
def process_message(message, keep_spaces): # Normalize the message message.normalize() # Left strip if message: x = message[0] if isinstance(x, unicode) and x.strip() == u'': del message[0] yield x # Right strip if message: x = message[-1] if isinstance(x, unicode) and x.strip() == u'': del message[-1] yield x # Proces...
c739b4f97afe8840a74ebda80ca18c7e05965f49 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/c739b4f97afe8840a74ebda80ca18c7e05965f49/XHTML.py
message = i18n.segment.Message()
message = Message()
def f(match): x = match.group(0) if x.endswith(';'): return x return "&amp;" + x[1:]
c739b4f97afe8840a74ebda80ca18c7e05965f49 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/c739b4f97afe8840a74ebda80ca18c7e05965f49/XHTML.py
message = i18n.segment.Message()
message = Message()
def f(match): x = match.group(0) if x.endswith(';'): return x return "&amp;" + x[1:]
c739b4f97afe8840a74ebda80ca18c7e05965f49 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/c739b4f97afe8840a74ebda80ca18c7e05965f49/XHTML.py
message = i18n.segment.Message()
message = Message()
def f(match): x = match.group(0) if x.endswith(';'): return x return "&amp;" + x[1:]
c739b4f97afe8840a74ebda80ca18c7e05965f49 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/c739b4f97afe8840a74ebda80ca18c7e05965f49/XHTML.py
message = i18n.segment.Message(node.children)
message = Message(node.children)
def process_message(message, keep_spaces): # Normalize the message message.normalize() # Left strip if message: x = message[0] if isinstance(x, unicode) and x.strip() == u'': del message[0] # Right strip if message: x = message[-1] if isinstance(x, unicode) and x.strip() == u'': del message[-1] # Process if message: # ...
c739b4f97afe8840a74ebda80ca18c7e05965f49 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/c739b4f97afe8840a74ebda80ca18c7e05965f49/XHTML.py
message = i18n.segment.Message()
message = Message()
def process_message(message, keep_spaces): # Normalize the message message.normalize() # Left strip if message: x = message[0] if isinstance(x, unicode) and x.strip() == u'': del message[0] # Right strip if message: x = message[-1] if isinstance(x, unicode) and x.strip() == u'': del message[-1] # Process if message: # ...
c739b4f97afe8840a74ebda80ca18c7e05965f49 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/c739b4f97afe8840a74ebda80ca18c7e05965f49/XHTML.py
message = i18n.segment.Message()
message = Message()
def process_message(message, keep_spaces): # Normalize the message message.normalize() # Left strip if message: x = message[0] if isinstance(x, unicode) and x.strip() == u'': del message[0] # Right strip if message: x = message[-1] if isinstance(x, unicode) and x.strip() == u'': del message[-1] # Process if message: # ...
c739b4f97afe8840a74ebda80ca18c7e05965f49 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/c739b4f97afe8840a74ebda80ca18c7e05965f49/XHTML.py
message = i18n.segment.Message()
message = Message()
def process_message(message, keep_spaces): # Normalize the message message.normalize() # Left strip if message: x = message[0] if isinstance(x, unicode) and x.strip() == u'': del message[0] # Right strip if message: x = message[-1] if isinstance(x, unicode) and x.strip() == u'': del message[-1] # Process if message: # ...
c739b4f97afe8840a74ebda80ca18c7e05965f49 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/c739b4f97afe8840a74ebda80ca18c7e05965f49/XHTML.py
def _get_handler(self, segment):
def _get_handler(self, segment, resource):
def _get_handler(self, segment): name = segment.name if self.has_resource(name): resource = self.get_resource(name) if name == 'segments': return Segments(resource) elif name == 'deletable': return Deletable(resource) elif name.count('.') == 1: # Maybe it is a segment file segments = self.get_handler('segments') name, ...
482914637eb1a6c73258013dff2e05da9c811f3b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/482914637eb1a6c73258013dff2e05da9c811f3b/Index.py
if self.has_resource(name): resource = self.get_resource(name) if name == 'segments': return Segments(resource) elif name == 'deletable': return Deletable(resource) elif name.count('.') == 1: segments = self.get_handler('segments') name, extension = name.split('.') if name in segments.segments: if extension == 'fnm':...
if name == 'segments': return Segments(resource) elif name == 'deletable': return Deletable(resource) elif name.count('.') == 1: segments = self.get_handler('segments') name, extension = name.split('.') if name in segments.segments: if extension == 'fnm': return Lucene.FieldInfos(resource) elif extension == 'fdx': nd...
def _get_handler(self, segment): name = segment.name if self.has_resource(name): resource = self.get_resource(name) if name == 'segments': return Segments(resource) elif name == 'deletable': return Deletable(resource) elif name.count('.') == 1: # Maybe it is a segment file segments = self.get_handler('segments') name, ...
482914637eb1a6c73258013dff2e05da9c811f3b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/482914637eb1a6c73258013dff2e05da9c811f3b/Index.py
version = "0.4.3",
version = "0.4.4",
def build_module(self, module, module_file, package): if isinstance(package, str): package = package.split('.') elif not isinstance(package, (list, tuple)): raise TypeError, \ "'package' must be a string (dot-separated), list, or tuple"
d9d3fba3b3f2790ff37da4de0dfff751aef7535b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d9d3fba3b3f2790ff37da4de0dfff751aef7535b/setup.py
def finish_commit(folder): """Continue to replace resources by their new state.""" for name in folder.get_names(): if name == '.catalog': if folder.exists('.catalog.bak'): folder.remove('.catalog.bak') folder.copy(name, '.catalog.bak') elif name == '.catalog.bak': continue elif folder.is_folder(name): subfolder = fo...
def get_root(target): # Get the root resource metadata = Metadata('%s/database/.metadata' % target) format = metadata.get_property('format') # Build and return the root handler cls = registry.get_object_class(format) return cls('%s/database' % target)
eac120230b225e05e894523f5e76fd887c3fbbc9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/eac120230b225e05e894523f5e76fd887c3fbbc9/server.py
codepoint = htmlentitydefs.name2codepoint[name] char = unichr(codepoint).encode(self._encoding) self.char_data_handler(char)
if name in htmlentitydefs.name2codepoint: codepoint = htmlentitydefs.name2codepoint[name] char = unichr(codepoint).encode(self._encoding) self.char_data_handler(char) else: warnings.warn('Unknown entity reference "%s" (ignoring)' % name)
def skipped_entity_handler(self, name, is_param_entity): # XXX HTML specific codepoint = htmlentitydefs.name2codepoint[name] char = unichr(codepoint).encode(self._encoding) self.char_data_handler(char)
3e3b2350ed0a669d1aaf1dc9391498da167b3229 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/3e3b2350ed0a669d1aaf1dc9391498da167b3229/XML.py
def get_lines(data): """ Unfold the folded lines. """ i = 0 lines = data.splitlines() line = '' while i < len(lines): next = lines[i] if next.startswith(' ') or next.startswith('\t'): line += next[1:] else: if line: yield line line = next i += 1 if line: yield line NAME, PNAME, PVALUE, VALUE = range(4) def parse_lin...
if __name__ == '__main__': unittest.main()
def get_lines(data): """ Unfold the folded lines. """ i = 0 lines = data.splitlines() line = '' while i < len(lines): next = lines[i] if next.startswith(' ') or next.startswith('\t'): line += next[1:] else: if line: yield line line = next i += 1 if line: yield line
323487d6c8d5eaea5064e998d028c331ce562be9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/323487d6c8d5eaea5064e998d028c331ce562be9/test_ical.py
base = vfs.open(self.uri) tree_file = base.open('tree') docs_file = base.open('docs')
if self.uri is None: tree_file = None docs_file = None else: base = vfs.open(self.uri) tree_file = base.open('tree') docs_file = base.open('docs')
def search_word(self, word): # Search in the data structure base = vfs.open(self.uri) tree_file = base.open('tree') docs_file = base.open('docs') try: documents = self._index.search_word(tree_file, docs_file, word) finally: tree_file.close() docs_file.close()
094004588f2bcc87b253e195b398ded1ba4b2b39 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/094004588f2bcc87b253e195b398ded1ba4b2b39/index.py
tree_file.close() docs_file.close()
if self.uri is not None: tree_file.close() docs_file.close()
def search_word(self, word): # Search in the data structure base = vfs.open(self.uri) tree_file = base.open('tree') docs_file = base.open('docs') try: documents = self._index.search_word(tree_file, docs_file, word) finally: tree_file.close() docs_file.close()
094004588f2bcc87b253e195b398ded1ba4b2b39 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/094004588f2bcc87b253e195b398ded1ba4b2b39/index.py