rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
stack.append(Element(None, value))
schema = elements_schema.get(value, {'type': BlockElement}) element_class = schema['type'] stack.append(element_class(None, value))
def _load(self, resource): self._encoding = 'UTF-8' self.document_type = None self.children = []
dc7d811dc73f926f85a6ba425702eadebd81c43e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/dc7d811dc73f926f85a6ba425702eadebd81c43e/HTML.py
lines = self._data.splitlines()
state = self.state lines = state.data.splitlines()
def _load_state(self, resource=None): # Load the resource as a unicode string Text._load_state(self, resource) # Split the raw data in lines. lines = self._data.splitlines() # Append None to signal the end of the data. lines.append(None) # Free the un-needed data structure, 'self._data' del self._data
e619dac608a0ffcd74a728fec09d947d7e352962 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/e619dac608a0ffcd74a728fec09d947d7e352962/TaskTracker.py
del self._data
del state.data
def _load_state(self, resource=None): # Load the resource as a unicode string Text._load_state(self, resource) # Split the raw data in lines. lines = self._data.splitlines() # Append None to signal the end of the data. lines.append(None) # Free the un-needed data structure, 'self._data' del self._data
e619dac608a0ffcd74a728fec09d947d7e352962 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/e619dac608a0ffcd74a728fec09d947d7e352962/TaskTracker.py
self.tasks = []
state.tasks = []
def _load_state(self, resource=None): # Load the resource as a unicode string Text._load_state(self, resource) # Split the raw data in lines. lines = self._data.splitlines() # Append None to signal the end of the data. lines.append(None) # Free the un-needed data structure, 'self._data' del self._data
e619dac608a0ffcd74a728fec09d947d7e352962 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/e619dac608a0ffcd74a728fec09d947d7e352962/TaskTracker.py
self.tasks.append(task)
state.tasks.append(task)
def _load_state(self, resource=None): # Load the resource as a unicode string Text._load_state(self, resource) # Split the raw data in lines. lines = self._data.splitlines() # Append None to signal the end of the data. lines.append(None) # Free the un-needed data structure, 'self._data' del self._data
e619dac608a0ffcd74a728fec09d947d7e352962 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/e619dac608a0ffcd74a728fec09d947d7e352962/TaskTracker.py
for task in self.tasks:
for task in self.state.tasks:
def to_unicode(self, encoding=None): lines = [] for task in self.tasks: lines.append(u'title:%s' % task.title) description = u'description:%s' % task.description description = textwrap.wrap(description) lines.append(description[0]) for line in description[1:]: lines.append(u' %s' % line) lines.append(u'state:%s' % task...
e619dac608a0ffcd74a728fec09d947d7e352962 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/e619dac608a0ffcd74a728fec09d947d7e352962/TaskTracker.py
self.tasks.append(task)
self.state.tasks.append(task)
def add_task(self, title, description): task = Task(title, description) self.tasks.append(task)
e619dac608a0ffcd74a728fec09d947d7e352962 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/e619dac608a0ffcd74a728fec09d947d7e352962/TaskTracker.py
for id, task in enumerate(self.tasks):
for id, task in enumerate(self.state.tasks):
def show_open_tasks(self): for id, task in enumerate(self.tasks): if task.state == 'open': print 'Task #%d: %s' % (id, task.title) print print textwrap.fill(task.description) print print
e619dac608a0ffcd74a728fec09d947d7e352962 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/e619dac608a0ffcd74a728fec09d947d7e352962/TaskTracker.py
task = self.tasks[id]
task = self.state.tasks[id]
def close_task(self, id): task = self.tasks[id] task.state = u'closed'
e619dac608a0ffcd74a728fec09d947d7e352962 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/e619dac608a0ffcd74a728fec09d947d7e352962/TaskTracker.py
return list(cls.options)
"""Returns a copy of options list of dictionaries.""" return [dict(option) for option in cls.options]
def get_options(cls): return list(cls.options)
ed442016ebef5be0691faa03dd3d72c9c2516f64 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/ed442016ebef5be0691faa03dd3d72c9c2516f64/metadata.py
metadata_name = '.%s.metadata' % self.name
metadata_name = '%s.metadata' % self.name
def get_metadata(self): if self.real_handler is not None: return self.real_handler.get_metadata()
1857a6bba83f773d5739330cfea47bda1e2a9206 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/1857a6bba83f773d5739330cfea47bda1e2a9206/Handler.py
version = "0.6.3",
version = "0.6.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"
59f01c8f053841cbdc4bba5547edf57c124c218c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/59f01c8f053841cbdc4bba5547edf57c124c218c/setup.py
def search_range(self, left, right): left = self._normalise_word(left) right = self._normalise_word(right)
37ef5ea1106df29445103dbfffc86e1779a16240 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/37ef5ea1106df29445103dbfffc86e1779a16240/itools_csv.py
if getattr(datatype, 'index', False):
if getattr(datatype, 'index', None) is not None:
def _index_init(self): """Initialize csv values index list""" for column in self.columns: datatype = self.schema[column] if getattr(datatype, 'index', False): indexes.append(Index()) else: indexes.append(None)
37ef5ea1106df29445103dbfffc86e1779a16240 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/37ef5ea1106df29445103dbfffc86e1779a16240/itools_csv.py
if isinstance(reference, uri.Reference):
if isinstance(reference, Reference):
def remove(reference): if isinstance(reference, uri.Reference): path = str(reference.path) elif isinstance(reference, uri.Path): path = str(path)
5acb3d078dee387b8946120b0bf5136ea2650552 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/5acb3d078dee387b8946120b0bf5136ea2650552/file.py
elif isinstance(reference, uri.Path):
elif isinstance(reference, Path):
def remove(reference): if isinstance(reference, uri.Reference): path = str(reference.path) elif isinstance(reference, uri.Path): path = str(path)
5acb3d078dee387b8946120b0bf5136ea2650552 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/5acb3d078dee387b8946120b0bf5136ea2650552/file.py
control = Handler.gettext('%(start)s-%(end)s of %(total)s') \
control = Handler.gettext(u'%(start)s-%(end)s of %(total)s') \
def batch_control(self): """Return a dict. as {'total', 'previous', 'next', 'control'}""" context = get_context() request = context.request
00e7ddd41b88d97f9c0abc4da986e718be4415e3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/00e7ddd41b88d97f9c0abc4da986e718be4415e3/widgets.py
if not results:
if results is None:
def browse_namespace(self, icon_size, sortby='title_or_name', sortorder='up', batchstart='0', batchsize='20', query={}, results=None): context = get_context() request = context.request
92014554332e3a818a726bdf2006831ae0f34cb9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/92014554332e3a818a726bdf2006831ae0f34cb9/Folder.py
email = context.get_form_value('ikaaro:email') users = self.get_handler('users') error = users.new_user(email, password, password2) message = self.gettext(u'Thanks for register, please log in') message = quote(message.encode('utf8')) goto = ';login_form?username=%s&message=%s' % (email, message) return uri.get_refere...
if password != password2: message = u'The passwords do not match.' return context.come_back(message) user = users.set_user(email, password) message = u'Thanks for register, please log in' goto = ';login_form?username=%s' % email return context.come_back(message, goto=goto)
def register(self, context): password = context.get_form_value('password') password2 = context.get_form_value('password2') email = context.get_form_value('ikaaro:email')
f2ced445f4a24962015eaa50961be93d0031af31 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/f2ced445f4a24962015eaa50961be93d0031af31/WebSite.py
response = self.GET(context) content_length = response.get_content_length() response.set_header('content-length', content_length) response.set_body(None) return response
status, body = self.GET(context) if isinstance(body, str): response = context.response response.set_header('content-length', len(body)) body = None return status, body
def HEAD(self, context): if context.method == 'HEAD': context.method = 'GET' response = self.GET(context) content_length = response.get_content_length() response.set_header('content-length', content_length) response.set_body(None) return response
0d682f80d21143341d24fefbd0b4ddedc4b42d17 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/0d682f80d21143341d24fefbd0b4ddedc4b42d17/server.py
key, value = x.split('=', 1)
if '=' in x: key, value = x.split('=', 1) else: key, value = x, None
def __init__(self, query): # XXX Right now when we find more than one value with the same # name we store all values as a list, otherwise it will be a # singleton. to Look http://docs.python.org/lib/node472.html # and maybe implement something similar. if query: for x in query.split('&'): x = urllib.unquote_plus(x) if ...
9b4d07bd773a8dd179743a0a8097b1b89264127e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/9b4d07bd773a8dd179743a0a8097b1b89264127e/generic.py
return '&'.join([ '%s=%s' % (k, urllib.quote_plus(v)) for k, v in self.items() ])
line = [] for key, value in self.items(): if value is None: line.append(key) else: line.append('%s=%s' % (key, urllib.quote_plus(value))) return '&'.join(line)
def __str__(self): return '&'.join([ '%s=%s' % (k, urllib.quote_plus(v)) for k, v in self.items() ])
9b4d07bd773a8dd179743a0a8097b1b89264127e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/9b4d07bd773a8dd179743a0a8097b1b89264127e/generic.py
def test_varsion(self):
def test_version(self):
def test_varsion(self): value = '20050217' encoded_value = IO.encode_version(value) self.assertEqual(IO.decode_version(encoded_value), value)
e0a77956160567ae17903d03a65014e50cc1ced2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/e0a77956160567ae17903d03a65014e50cc1ced2/test_io.py
if ('http-equiv', 'Content-Type') in attrs: for attribute_name, attribute_value in attrs: if attribute_name == 'content': encoding = attribute_value.split(';')[-1].strip()[8:] self.encoding = encoding break
is_content_type = False for attribute_name, attribute_value in attrs: if attribute_name == 'http-equiv': if attribute_value.lower() == 'content-type': is_content_type = True elif attribute_name == 'content': content_value = attribute_value if is_content_type is True: self.encoding = attribute_value.split(';')[-1].strip...
def handle_starttag(self, name, attrs): line_number = self.getpos()[0]
15724cbde0f88a8060cc9b907a9f2f44e65f5676 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/15724cbde0f88a8060cc9b907a9f2f44e65f5676/parser.py
body = root.after_traverse(context, body)
body = context.root.after_traverse(context, body)
def POST(self, context): request, response = context.request, context.response # Not a safe method context.commit = True # Traverse status, method = self.traverse(context) # Call the method body = method(context) if isinstance(body, str): # Post-process (used to wrap the body in a skin) body = root.after_traverse(conte...
9a1217feac50563129e1f1633a3184f965d86920 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/9a1217feac50563129e1f1633a3184f965d86920/server.py
def new_resource_form(self, context): type = context.get_form_value('type') if type is None: # Build the namespace namespace = {} namespace['types'] = []
d30b139d9fc76da5c7a224cd2c13568190a47d6c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d30b139d9fc76da5c7a224cd2c13568190a47d6c/Folder.py
return context.come_back(replace)
return context.come_back(message)
def new_resource(self, context): class_id = context.get_form_value('class_id') name = context.get_form_value('name') title = context.get_form_value('dc:title')
d30b139d9fc76da5c7a224cd2c13568190a47d6c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d30b139d9fc76da5c7a224cd2c13568190a47d6c/Folder.py
self._set_message(msgid, msgstrm, comments)
self._set_message(msgid, msgstr, comments)
def next_entry(self): # Load the next line line_type, value = self.next_line()
92fbac2762ad6f7abb01e267b4ed5b254274700f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/92fbac2762ad6f7abb01e267b4ed5b254274700f/PO.py
def set_message(self, msgid, msgstr=[''], comments=[], references={}):
def set_message(self, msgid, msgstr=[u''], comments=[], references={}):
def set_message(self, msgid, msgstr=[''], comments=[], references={}): self._set_message(msgid, msgstr, comments, references) self.save()
92fbac2762ad6f7abb01e267b4ed5b254274700f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/92fbac2762ad6f7abb01e267b4ed5b254274700f/PO.py
def _set_message(self, msgid, msgstr=[''], comments=[], references={}):
def _set_message(self, msgid, msgstr=[u''], comments=[], references={}):
def _set_message(self, msgid, msgstr=[''], comments=[], references={}): if isinstance(msgid, (str, unicode)): msgid = [msgid] if isinstance(msgstr, (str, unicode)): msgstr = [msgstr]
92fbac2762ad6f7abb01e267b4ed5b254274700f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/92fbac2762ad6f7abb01e267b4ed5b254274700f/PO.py
context.messages.add(attribute.value)
value = attribute.value.strip() if value: context.messages.add(attribute.value)
def before(node, context): message = context.message if isinstance(node, XML.Raw): message.append(node.data) elif isinstance(node, XML.Element): # Skip <script> (XXX do the same with <style>??) if node.name == 'script': process_message(context) return True # Attributes for attribute in node.attributes: if node.is_trans...
d8e7dd804f7150f28c421627e71c3757ed1b9969 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d8e7dd804f7150f28c421627e71c3757ed1b9969/XHTML.py
for x, context in handler.traverse2(context):
for x, context in handler.traverse2(context, caching=caching):
def traverse2(self, context=None, caching=True): if context is None: context = Context()
0f1dc1517051769572fd8293756779d649798ba7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/0f1dc1517051769572fd8293756779d649798ba7/Folder.py
atom = Query.Simple(key, value) if query is None: query = atom
if key in field_numbers: atom = Query.Simple(key, value) if query is None: query = atom else: query = Query.Complex(query, 'and', atom)
def _search(self, query=None, **kw): # Build the query if it is passed through keyword parameters if query is None: for key, value in kw.items(): atom = Query.Simple(key, value) if query is None: query = atom else: query = Query.Complex(query, 'and', atom) # Check wether there is a query at all if query is None: raise ...
c9c54c873a2c5d984ecc6cc98ea68a5ccce38883 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/c9c54c873a2c5d984ecc6cc98ea68a5ccce38883/Catalog.py
query = Query.Complex(query, 'and', atom)
warnings.warn('unknown field "%s"' % key)
def _search(self, query=None, **kw): # Build the query if it is passed through keyword parameters if query is None: for key, value in kw.items(): atom = Query.Simple(key, value) if query is None: query = atom else: query = Query.Complex(query, 'and', atom) # Check wether there is a query at all if query is None: raise ...
c9c54c873a2c5d984ecc6cc98ea68a5ccce38883 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/c9c54c873a2c5d984ecc6cc98ea68a5ccce38883/Catalog.py
resource = memory.Folder()
self.resource = memory.Folder()
def __init__(self, resource=None, **kw): self.cache = {}
3087e2705f050d266a54f1ffe1f8b3ea3b070db8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/3087e2705f050d266a54f1ffe1f8b3ea3b070db8/Folder.py
else: skeleton = None self.resource = resource if skeleton is not None:
def __init__(self, resource=None, **kw): self.cache = {}
3087e2705f050d266a54f1ffe1f8b3ea3b070db8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/3087e2705f050d266a54f1ffe1f8b3ea3b070db8/Folder.py
@staticmethod def get_mimetype(reference):
@classmethod def get_mimetype(cls, reference):
def get_atime(reference): raise NotImplementedError
728a0a47ca22f1a4fcb60243b3cf37f39806d56c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/728a0a47ca22f1a4fcb60243b3cf37f39806d56c/base.py
if self.is_file(reference):
if cls.is_file(reference):
def get_mimetype(reference): """ Try to guess the mimetype for a resource, given the resource itself and its name. To guess from the name we need to extract the type extension, we use an heuristic for this task, but it needs to be improved because there are many patterns:
728a0a47ca22f1a4fcb60243b3cf37f39806d56c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/728a0a47ca22f1a4fcb60243b3cf37f39806d56c/base.py
data = unicode(context.get_form_value('data'), 'UTF-8') self.set_data(data)
data = context.get_form_value('data') resource = memory.File(data) self.load_state(resource)
def edit(self, context): data = unicode(context.get_form_value('data'), 'UTF-8') self.set_data(data)
1d208a8b0a263b75f6063f0f59a4a1c940068c8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/1d208a8b0a263b75f6063f0f59a4a1c940068c8c/text.py
date = self.get_current_date()
date = self.get_current_date(context.get_form_value('DTSTART1'))
def edit_event(self, context): if context.has_form_value('remove'): return self.remove(context)
aedcbe7c6fc02100aee27cbbd0c8d672b57ee6a2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/aedcbe7c6fc02100aee27cbbd0c8d672b57ee6a2/ical.py
goto = ';table_view?date=%s' % date
goto = ';table_view?date=%s' % date.strftime('%Y-%m-%d')
def edit_event(self, context): if context.has_form_value('remove'): return self.remove(context)
aedcbe7c6fc02100aee27cbbd0c8d672b57ee6a2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/aedcbe7c6fc02100aee27cbbd0c8d672b57ee6a2/ical.py
print '****************************************************************'
print '*'
def init(parser, options, target): try: os.mkdir(target) except OSError: parser.error('can not create the instance (check permissions)') # Create the config file config = get_config() if options.root: config.set('instance', 'root', options.root) if options.port: config.set('instance', 'port', options.port) config.writ...
5192ec38d3e7aea0d57784fc22b2e8497f892a0a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/5192ec38d3e7aea0d57784fc22b2e8497f892a0a/icms.py
print '* A user with administration rights has been created for you:' print '* username: admin' print '* password: %s' % password
if options.source is None: print '* A user with administration rights has been created for you:' print '* username: admin' print '* password: %s' % password
def init(parser, options, target): try: os.mkdir(target) except OSError: parser.error('can not create the instance (check permissions)') # Create the config file config = get_config() if options.root: config.set('instance', 'root', options.root) if options.port: config.set('instance', 'port', options.port) config.writ...
5192ec38d3e7aea0d57784fc22b2e8497f892a0a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/5192ec38d3e7aea0d57784fc22b2e8497f892a0a/icms.py
version = "0.9.1",
version = "0.9.2",
def finalize_options (self): self.set_undefined_options('install', ('install_purelib', 'install_dir'), ('root', 'root'), ('force', 'force'), )
8a9484965a3fe829952e3bc1553433235ceb5d15 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/8a9484965a3fe829952e3bc1553433235ceb5d15/setup.py
data = str(data)
if isinstance(data, str): pass elif isinstance(data, unicode): data = data.encode('utf-8') else: data = str(data)
def substitute(data, stack, repeat_stack, encoding='utf-8'): data = str(data) # Solo, preserve the value None match = subs_expr_solo.match(data) if match is not None: expr = Expression(match.group(1)) value = expr.evaluate(stack, repeat_stack) # Preserve the value None if value is None: return None, 1 # Send the string...
a1a252f7f32e7cae955fa0eef4357fa17a8073fe /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/a1a252f7f32e7cae955fa0eef4357fa17a8073fe/stl.py
type, default = schema[name] if issubclass(type, SimpleType): value = unicode(node.children) value = type.decode(value) elif issubclass(type, ComplexType): value = type.decode(node)
if name in schema: type, default = schema[name] if issubclass(type, SimpleType): value = unicode(node.children) value = type.decode(value) elif issubclass(type, ComplexType): value = type.decode(node) else: raise ValueError, 'bad type for "%s"' % name if 'lang' in node.attributes: language = node.attributes['lang'].va...
def decode(cls, node): schema = cls.schema property = cls() for node in node.get_elements(): name = node.name # Decode the value type, default = schema[name] if issubclass(type, SimpleType): value = unicode(node.children) value = type.decode(value) elif issubclass(type, ComplexType): value = type.decode(node) else: rai...
5c78ff8e791d5c1d7f89fc4c05a8e2a229df6747 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/5c78ff8e791d5c1d7f89fc4c05a8e2a229df6747/Schema.py
raise ValueError, 'bad type for "%s"' % name if 'lang' in node.attributes: language = node.attributes['lang'].value else: language = None property.set_property(name, value, language=language)
warnings.warn('The schema does not define "%s"' % name)
def decode(cls, node): schema = cls.schema property = cls() for node in node.get_elements(): name = node.name # Decode the value type, default = schema[name] if issubclass(type, SimpleType): value = unicode(node.children) value = type.decode(value) elif issubclass(type, ComplexType): value = type.decode(node) else: rai...
5c78ff8e791d5c1d7f89fc4c05a8e2a229df6747 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/5c78ff8e791d5c1d7f89fc4c05a8e2a229df6747/Schema.py
mtime = mtime()
mtime = mtime().replace(microsecond=0)
def handle_request(connection, server): # Build the request object resource = File(connection) try: request = Request(resource) except BadRequest, exception: request = None request_line = exception.args[0] else: # Keep here (though redundant) to be used later in the access log request_line = request.state.request_line ...
10da2c0028eeb634793e6a67401d1a2d374698e1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/10da2c0028eeb634793e6a67401d1a2d374698e1/server.py
def _load_state(self, resource): data = resource.read()
row_class = iRow
def _load_state(self, resource): data = resource.read()
3db18d733c8b07e2f853c3c8aecb4094d10c2cd7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/3db18d733c8b07e2f853c3c8aecb4094d10c2cd7/csv_.py
lines = [] index = 0 for line in parse(data, self.schema): row = Row(line) row.index = index lines.append(row) index = index + 1
def _load_state(self, resource): data = resource.read()
3db18d733c8b07e2f853c3c8aecb4094d10c2cd7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/3db18d733c8b07e2f853c3c8aecb4094d10c2cd7/csv_.py
self.state.lines = lines self.state.encoding = self.guess_encoding(data)
def _load_state(self, resource): data = resource.read()
3db18d733c8b07e2f853c3c8aecb4094d10c2cd7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/3db18d733c8b07e2f853c3c8aecb4094d10c2cd7/csv_.py
if name.startswith('.') or name.endswith('.metadata'):
if (name.startswith('.') or name.endswith('.metadata') or name.endswith('.lock')):
def on_del_handler(self, segment): from root import Root
a2d0bffb5e96ac2b45f3b3c7fdab177a0d431be2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/a2d0bffb5e96ac2b45f3b3c7fdab177a0d431be2/Folder.py
def __init__(self, id, title, description, state): self.id = id
def __init__(self, title, description, state='open'):
def __init__(self, id, title, description, state): self.id = id self.title = title self.description = description self.state = state
b77211e2f1147243dd1e01d42af1f82ebe4cff20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/b77211e2f1147243dd1e01d42af1f82ebe4cff20/TaskTracker.py
root = server.pool.pop()
root = server.root
def handle_request(connection, server): # Build the request object resource = File(connection) try: request = Request(resource) except BadRequest, exception: request = None request_line = exception.args[0] else: # Keep here (though redundant) to be used later in the access log request_line = request.state.request_line ...
869db13f355be95f734bd0bcee6da5af85dbabb9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/869db13f355be95f734bd0bcee6da5af85dbabb9/server.py
server.pool.push(root)
def handle_request(connection, server): # Build the request object resource = File(connection) try: request = Request(resource) except BadRequest, exception: request = None request_line = exception.args[0] else: # Keep here (though redundant) to be used later in the access log request_line = request.state.request_line ...
869db13f355be95f734bd0bcee6da5af85dbabb9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/869db13f355be95f734bd0bcee6da5af85dbabb9/server.py
self.pool = Pool(root)
self.root = root
def __init__(self, root, address='127.0.0.1', port=None, access_log=None, error_log=None, pid_file=None): if port is None: port = 8080 # The application's root self.pool = Pool(root) # The address and port the server will listen to self.address = address self.port = port # The access and error logs if access_log is not...
869db13f355be95f734bd0bcee6da5af85dbabb9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/869db13f355be95f734bd0bcee6da5af85dbabb9/server.py
return cls('%s/database')
return cls('%s/database' % target)
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')
d0b7d44415c6df5609cebc417b3ed6e90e0e2c2e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d0b7d44415c6df5609cebc417b3ed6e90e0e2c2e/server.py
def to_str(self):
def to_str(self, encoding='UTF-8'):
def to_str(self): s = [] # The comments for comment in self.comments: s.append('#%s\n' % comment) # The reference comments for filename, lines in self.references.items(): for line in lines: s.append('#: %s:%s\n' % (filename, line)) # The Fuzzy flag if self.fuzzy: s.append('#, fuzzy\n') # The msgid s.append('msgid "%s"\...
3dca643585e4656477668283622453425eeb4794 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/3dca643585e4656477668283622453425eeb4794/PO.py
s.append('
s.append('
def to_str(self): s = [] # The comments for comment in self.comments: s.append('#%s\n' % comment) # The reference comments for filename, lines in self.references.items(): for line in lines: s.append('#: %s:%s\n' % (filename, line)) # The Fuzzy flag if self.fuzzy: s.append('#, fuzzy\n') # The msgid s.append('msgid "%s"\...
3dca643585e4656477668283622453425eeb4794 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/3dca643585e4656477668283622453425eeb4794/PO.py
s.append('msgid "%s"\n' % escape(self.msgid[0]))
s.append('msgid "%s"\n' % escape(self.msgid[0].encode(encoding)))
def to_str(self): s = [] # The comments for comment in self.comments: s.append('#%s\n' % comment) # The reference comments for filename, lines in self.references.items(): for line in lines: s.append('#: %s:%s\n' % (filename, line)) # The Fuzzy flag if self.fuzzy: s.append('#, fuzzy\n') # The msgid s.append('msgid "%s"\...
3dca643585e4656477668283622453425eeb4794 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/3dca643585e4656477668283622453425eeb4794/PO.py
s.append('"%s"\n' % escape(string))
s.append('"%s"\n' % escape(string.encode(encoding)))
def to_str(self): s = [] # The comments for comment in self.comments: s.append('#%s\n' % comment) # The reference comments for filename, lines in self.references.items(): for line in lines: s.append('#: %s:%s\n' % (filename, line)) # The Fuzzy flag if self.fuzzy: s.append('#, fuzzy\n') # The msgid s.append('msgid "%s"\...
3dca643585e4656477668283622453425eeb4794 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/3dca643585e4656477668283622453425eeb4794/PO.py
s.append('msgstr "%s"\n' % escape(self.msgstr[0]))
s.append('msgstr "%s"\n' % escape(self.msgstr[0].encode(encoding)))
def to_str(self): s = [] # The comments for comment in self.comments: s.append('#%s\n' % comment) # The reference comments for filename, lines in self.references.items(): for line in lines: s.append('#: %s:%s\n' % (filename, line)) # The Fuzzy flag if self.fuzzy: s.append('#, fuzzy\n') # The msgid s.append('msgid "%s"\...
3dca643585e4656477668283622453425eeb4794 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/3dca643585e4656477668283622453425eeb4794/PO.py
s.append('"%s"\n' % escape(string))
s.append('"%s"\n' % escape(string.encode(encoding)))
def to_str(self): s = [] # The comments for comment in self.comments: s.append('#%s\n' % comment) # The reference comments for filename, lines in self.references.items(): for line in lines: s.append('#: %s:%s\n' % (filename, line)) # The Fuzzy flag if self.fuzzy: s.append('#, fuzzy\n') # The msgid s.append('msgid "%s"\...
3dca643585e4656477668283622453425eeb4794 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/3dca643585e4656477668283622453425eeb4794/PO.py
def to_str(self, encoding=None):
def to_str(self, encoding='UTF-8'):
def to_str(self, encoding=None): messages = self.state.messages message_ids = messages.keys() message_ids.sort() messages = [ messages[x].to_str() for x in message_ids ] return '\n'.join(messages)
3dca643585e4656477668283622453425eeb4794 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/3dca643585e4656477668283622453425eeb4794/PO.py
messages = [ messages[x].to_str() for x in message_ids ]
messages = [ messages[x].to_str(encoding) for x in message_ids ]
def to_str(self, encoding=None): messages = self.state.messages message_ids = messages.keys() message_ids.sort() messages = [ messages[x].to_str() for x in message_ids ] return '\n'.join(messages)
3dca643585e4656477668283622453425eeb4794 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/3dca643585e4656477668283622453425eeb4794/PO.py
def is_allowed_to_register(self): return get_context().root.get_property('ikaaro:website_is_open')
def is_allowed_to_register(self, user, object): return self.get_property('ikaaro:website_is_open')
def is_allowed_to_register(self): return get_context().root.get_property('ikaaro:website_is_open')
e44da83301a854e42a03d1e454a2060614f10bb3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/e44da83301a854e42a03d1e454a2060614f10bb3/WebSite.py
source = root_class(username='a', password='a').resource
password = [ random.choice(string.ascii_letters + string.digits) for x in range(8) ] password = ''.join(password) source = root_class(username='admin', password=password).resource
def init(parser, options, target): try: os.mkdir(target) except OSError: parser.error('can not create the instance (check permissions)') # Create the config file config = get_config() if options.root: config.set('instance', 'root', options.root) if options.port: config.set('instance', 'port', options.port) config.writ...
b1a6e98aedf81d2d666fc796ce1e6352fc8eb1d2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/b1a6e98aedf81d2d666fc796ce1e6352fc8eb1d2/icms.py
print 'To start the new instance type:' print ' %s start %s' % (parser.get_prog_name(), target)
print '****************************************************************' print '* Welcome to itools.cms' print '* A user with administration rights has been created for you:' print '* username: admin' print '* password: %s' % password print '*' print '* To start the new instance type:' print '* %s start %s' % (pa...
def init(parser, options, target): try: os.mkdir(target) except OSError: parser.error('can not create the instance (check permissions)') # Create the config file config = get_config() if options.root: config.set('instance', 'root', options.root) if options.port: config.set('instance', 'port', options.port) config.writ...
b1a6e98aedf81d2d666fc796ce1e6352fc8eb1d2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/b1a6e98aedf81d2d666fc796ce1e6352fc8eb1d2/icms.py
XXX It does not work if name is 'itools-0.7.0.pdf', because it thinks the extension is '0'.
def get_mimetype(self): """ Try to guess the mimetype for a resource, given the resource itself and its name. To guess from the name we need to extract the type extension, we use an heuristic for this task, but it needs to be improved because there are many patterns:
332516e2cfac1041f3e17054c0e4c90248dd51bf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/332516e2cfac1041f3e17054c0e4c90248dd51bf/base.py
if len(name) > 1: if len(name) > 2: extension = name[-2] else: extension = name[-1] mimetype, encoding = mimetypes.guess_type('.%s' % extension) else: mimetype = 'application/octet-stream'
if name[-1] in i18n.languages: name = name[:-1] mimetype, encoding = mimetypes.guess_type('.'.join(name)) if mimetype is None: return 'application/octet-stream'
def get_mimetype(self): """ Try to guess the mimetype for a resource, given the resource itself and its name. To guess from the name we need to extract the type extension, we use an heuristic for this task, but it needs to be improved because there are many patterns:
332516e2cfac1041f3e17054c0e4c90248dd51bf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/332516e2cfac1041f3e17054c0e4c90248dd51bf/base.py
raise NotImplementedError
language = os.environ.get('LANGUAGE') language = language.split('.')[0] language = language.replace('_', '-') accept_language = AcceptLanguage(language) return accept_language.select_language(languages)
def select_language(self, languages): raise NotImplementedError
fe77da676bca92b048bf6c3e7497a1530157ee03 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/fe77da676bca92b048bf6c3e7497a1530157ee03/domains.py
handler_path = context.handler.get_abspath() method = context.method
response = context.response encoding = 'UTF-8'
def send_email(self, from_addr, to_addr, subject, body, **kw): context = get_context() handler_path = context.handler.get_abspath() method = context.method # Build the message message_pattern = u'To: %(to_addr)s\n' \ u'From: %(from_addr)s\n' \ u'Subject: %(subject)s\n' \ u'\n' \ u'%(body)s\n' message = message_pattern...
ad84881c1322f363c3bbb6f30e365ad070f8adb2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/ad84881c1322f363c3bbb6f30e365ad070f8adb2/root.py
message_pattern = u'To: %(to_addr)s\n' \ u'From: %(from_addr)s\n' \ u'Subject: %(subject)s\n' \ u'\n' \ u'%(body)s\n'
message_pattern = ( u'To: %(to_addr)s\n' u'From: %(from_addr)s\n' u'Subject: %(subject)s\n' u'Content-Transfer-Encoding: 8bit\n' u'Content-Type: text/plain; charset="%(encoding)s"\n' u'\n' u'%(body)s\n')
def send_email(self, from_addr, to_addr, subject, body, **kw): context = get_context() handler_path = context.handler.get_abspath() method = context.method # Build the message message_pattern = u'To: %(to_addr)s\n' \ u'From: %(from_addr)s\n' \ u'Subject: %(subject)s\n' \ u'\n' \ u'%(body)s\n' message = message_pattern...
ad84881c1322f363c3bbb6f30e365ad070f8adb2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/ad84881c1322f363c3bbb6f30e365ad070f8adb2/root.py
'body': body} message = message.encode('UTF-8')
'body': body, 'encoding': encoding} message = message.encode(encoding)
def send_email(self, from_addr, to_addr, subject, body, **kw): context = get_context() handler_path = context.handler.get_abspath() method = context.method # Build the message message_pattern = u'To: %(to_addr)s\n' \ u'From: %(from_addr)s\n' \ u'Subject: %(subject)s\n' \ u'\n' \ u'%(body)s\n' message = message_pattern...
ad84881c1322f363c3bbb6f30e365ad070f8adb2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/ad84881c1322f363c3bbb6f30e365ad070f8adb2/root.py
now = datetime.datetime.now().strftime('%d-%m-%Y %H:%M:%S') uri = "%s/;%s" % (handler_path , method)
def send_email(self, from_addr, to_addr, subject, body, **kw): context = get_context() handler_path = context.handler.get_abspath() method = context.method # Build the message message_pattern = u'To: %(to_addr)s\n' \ u'From: %(from_addr)s\n' \ u'Subject: %(subject)s\n' \ u'\n' \ u'%(body)s\n' message = message_pattern...
ad84881c1322f363c3bbb6f30e365ad070f8adb2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/ad84881c1322f363c3bbb6f30e365ad070f8adb2/root.py
'user_theme': String(default='surf'),
'user_theme': String(default='aruni'),
def encode(cls, value): lines = [] for key, value in value.items(): prefix, local_name = key datatype = schemas.get_datatype(key) value = datatype.encode(value) qname = QName.encode(key) lines.append('\n <%s>%s</%s>' % (qname, value, qname)) return ''.join(lines) + '\n'
5aefa0164d52bac5e00d42ecbf1951d09243cfc3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/5aefa0164d52bac5e00d42ecbf1951d09243cfc3/Metadata.py
data.append('HTTP/1.1 %d %s' % (status_code, status_message))
data.append('HTTP/1.0 %d %s' % (status_code, status_message))
def to_str(self): state = self.state
6c2d2d650798878146be18225f8e3ae8bf1ff2a6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/6c2d2d650798878146be18225f8e3ae8bf1ff2a6/response.py
data.append('Connection: close')
def to_str(self): state = self.state
6c2d2d650798878146be18225f8e3ae8bf1ff2a6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/6c2d2d650798878146be18225f8e3ae8bf1ff2a6/response.py
parameters.append('; Expires=%s' % cookie.expires)
parameters.append('; expires=%s' % cookie.expires)
def to_str(self): state = self.state
6c2d2d650798878146be18225f8e3ae8bf1ff2a6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/6c2d2d650798878146be18225f8e3ae8bf1ff2a6/response.py
parameters.append('; Domain=%s' % cookie.domain)
parameters.append('; domain=%s' % cookie.domain)
def to_str(self): state = self.state
6c2d2d650798878146be18225f8e3ae8bf1ff2a6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/6c2d2d650798878146be18225f8e3ae8bf1ff2a6/response.py
parameters.append('; Path=%s' % cookie.path)
parameters.append('; path=%s' % cookie.path) else: parameters.append('; path=/')
def to_str(self): state = self.state
6c2d2d650798878146be18225f8e3ae8bf1ff2a6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/6c2d2d650798878146be18225f8e3ae8bf1ff2a6/response.py
parameters.append('; Max-Age=%s' % cookie.max_age)
parameters.append('; max-Age=%s' % cookie.max_age)
def to_str(self): state = self.state
6c2d2d650798878146be18225f8e3ae8bf1ff2a6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/6c2d2d650798878146be18225f8e3ae8bf1ff2a6/response.py
parameters.append('; Comment=%s' % cookie.comment)
parameters.append('; comment=%s' % cookie.comment)
def to_str(self): state = self.state
6c2d2d650798878146be18225f8e3ae8bf1ff2a6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/6c2d2d650798878146be18225f8e3ae8bf1ff2a6/response.py
parameters.append('; Secure=%s' % cookie.secure)
parameters.append('; secure=%s' % cookie.secure)
def to_str(self): state = self.state
6c2d2d650798878146be18225f8e3ae8bf1ff2a6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/6c2d2d650798878146be18225f8e3ae8bf1ff2a6/response.py
parser.StartCdataSectionHandler = self.null_handler parser.EndCdataSectionHandler = self.null_handler
def parse(self, data): self.namespaces = {}
b8822066f0afef0926e01cc9a82a355b533a69cb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/b8822066f0afef0926e01cc9a82a355b533a69cb/parser.py
from_handler=context.object)
from_handler=context.handler)
def __init__(self, handler, depth=None, count=None): from Folder import Folder as DatabaseFolder
08cc877b72cd9cd91dfe7ad5ecc2cd16ce7a1dd1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/08cc877b72cd9cd91dfe7ad5ecc2cd16ce7a1dd1/widgets.py
def _search(self, query):
def __search(self, query):
def _search(self, query): if isinstance(query, Query.Simple): # A simple query fields = self.get_handler('fields') documents = {} field_number = fields.field_numbers[query.name] field = fields.fields[field_number] if field_number in fields.indexed_fields: tree = self.get_handler('f%d' % field_number) # XXX Analyse valu...
24f5ae2688285eadb944da262a4798fc6f82877d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/24f5ae2688285eadb944da262a4798fc6f82877d/Catalog.py
r1 = self._search(query.left) r2 = self._search(query.right)
r1 = self.__search(query.left) r2 = self.__search(query.right)
def _search(self, query): if isinstance(query, Query.Simple): # A simple query fields = self.get_handler('fields') documents = {} field_number = fields.field_numbers[query.name] field = fields.fields[field_number] if field_number in fields.indexed_fields: tree = self.get_handler('f%d' % field_number) # XXX Analyse valu...
24f5ae2688285eadb944da262a4798fc6f82877d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/24f5ae2688285eadb944da262a4798fc6f82877d/Catalog.py
def search(self, query=None, **kw):
def _search(self, query=None, **kw):
def search(self, query=None, **kw): # Build the query if it is passed through keyword parameters if query is None: for key, value in kw.items(): atom = Query.Simple(key, value) if query is None: query = atom else: query = Query.Complex(query, 'and', atom) # Check wether there is a query at all if query is None: raise V...
24f5ae2688285eadb944da262a4798fc6f82877d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/24f5ae2688285eadb944da262a4798fc6f82877d/Catalog.py
documents = self._search(query)
return self.__search(query) def how_many(self, query=None, **kw): """ Returns the number of documents found. """ return len(self._search(query, **kw)) def search(self, query=None, **kw): documents = self._search(query, **kw)
def search(self, query=None, **kw): # Build the query if it is passed through keyword parameters if query is None: for key, value in kw.items(): atom = Query.Simple(key, value) if query is None: query = atom else: query = Query.Complex(query, 'and', atom) # Check wether there is a query at all if query is None: raise V...
24f5ae2688285eadb944da262a4798fc6f82877d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/24f5ae2688285eadb944da262a4798fc6f82877d/Catalog.py
return self.get_end_tag()
return '</%s>' % self.qname
def get_end_tag_as_html(self): if self.name in empty_elements: return '' return self.get_end_tag()
9b8cc9ff753836808bdfc6a5822bbfcac355b31a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/9b8cc9ff753836808bdfc6a5822bbfcac355b31a/XHTML.py
self.target = target if target.endswith('/'): self.target = target[:-1]
self.target = target.rstrip('/')
def __init__(self, target, address=None, port=None): self.target = target # FIXME This is not robust, what if the target has two or more # trailing slashes. TODO "self.target" should be a Path object. if target.endswith('/'): self.target = target[:-1]
d46244d69ecd985fcf84eeed425367f2c247d01a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d46244d69ecd985fcf84eeed425367f2c247d01a/server.py
raise NotImplementedError
return None
def get_atime(self): raise NotImplementedError
335524c197f94ed0f1ae61f34581c57bdd742e8a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/335524c197f94ed0f1ae61f34581c57bdd742e8a/zope2.py
raise NotImplementedError
return None
def get_ctime(self): raise NotImplementedError
335524c197f94ed0f1ae61f34581c57bdd742e8a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/335524c197f94ed0f1ae61f34581c57bdd742e8a/zope2.py
head.append(self.get_content(encoding))
content = self.get_content(encoding) lines = content.splitlines() while lines and lines[0].strip() == u'': lines = lines[1:] head.append('\n'.join(lines))
def to_unicode(self, encoding='UTF-8'): head = [] head.append(u'<head>\n') head.append(u' <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=%s" />\n' % encoding) head.append(self.get_content(encoding)) head.append(u'</head>') return ''.join(head)
b1376814556d42d6f0c6c841a068a04f1b81d3f6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/b1376814556d42d6f0c6c841a068a04f1b81d3f6/XHTML.py
if expr.startswith('not '):
if expr.startswith('not') and expr[3].isspace():
def decode(data): attributes = [] for x in data.split(';'): x = x.strip().split(' ', 1) if len(x) == 1: raise STLSyntaxError, \ 'attributes expression expects two fields'
d767781acf3449a3cd850be229a4196d8bade6f8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d767781acf3449a3cd850be229a4196d8bade6f8/stl.py
if data.startswith('not '):
if data.startswith('not') and data[3].isspace():
def decode(data): if data.startswith('not '): return NotExpression(data) return Expression(data)
d767781acf3449a3cd850be229a4196d8bade6f8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/d767781acf3449a3cd850be229a4196d8bade6f8/stl.py
frequency = IO.encode_uint32(0)
frequency = IO.encode_link(None)
def _get_free_slot(self): """ Internal method that returns a free slot. If none exists a new one is allocated.
51eb36a817138ff485eeb1b9a616f10eb8b4fcc1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/51eb36a817138ff485eeb1b9a616f10eb8b4fcc1/IIndex.py
slot_number = self.root.tree_handler._get_free_slot() subtree = self.children[prefix] = Tree(self.root, slot_number)
free_slot_n = self.root.tree_handler._get_free_slot() subtree = self.children[prefix] = Tree(self.root, free_slot_n)
def index_word(self, word, doc_number, position): if word: prefix, suffix = word[0], word[1:] if prefix in self.children: subtree = self.children[prefix] else: # Get an empty slot slot_number = self.root.tree_handler._get_free_slot() # Update data structure on memoty subtree = self.children[prefix] = Tree(self.root, sl...
51eb36a817138ff485eeb1b9a616f10eb8b4fcc1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/51eb36a817138ff485eeb1b9a616f10eb8b4fcc1/IIndex.py
base = 16 + slot_number * 16 r[base:base+4] = IO.encode_character(prefix) r[base+4:base+8] = IO.encode_link(None) r[base+8:base+12] = IO.encode_link(None)
free_slot = 16 + free_slot_n * 16 r[free_slot:free_slot+4] = IO.encode_character(prefix) r[free_slot+4:free_slot+8] = IO.encode_link(None) r[free_slot+8:free_slot+12] = IO.encode_link(None)
def index_word(self, word, doc_number, position): if word: prefix, suffix = word[0], word[1:] if prefix in self.children: subtree = self.children[prefix] else: # Get an empty slot slot_number = self.root.tree_handler._get_free_slot() # Update data structure on memoty subtree = self.children[prefix] = Tree(self.root, sl...
51eb36a817138ff485eeb1b9a616f10eb8b4fcc1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12681/51eb36a817138ff485eeb1b9a616f10eb8b4fcc1/IIndex.py