bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def _load(self, resource): self._encoding = 'UTF-8' self.document_type = None self.children = [] | def _load(self, resource): self._encoding = 'UTF-8' self.document_type = None self.children = [] | 38,300 |
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 | def _load_state(self, resource=None): # Load the resource as a unicode string Text._load_state(self, resource) # Split the raw data in lines. state = self.state lines = state.data.splitlines() # Append None to signal the end of the data. lines.append(None) # Free the un-needed data structure, 'self._data' del self._dat... | 38,301 |
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 | 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 | 38,302 |
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 | 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 | 38,303 |
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 | 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 | 38,304 |
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... | def to_unicode(self, encoding=None): lines = [] for task in self.state.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' ... | 38,305 |
def add_task(self, title, description): task = Task(title, description) self.tasks.append(task) | def add_task(self, title, description): task = Task(title, description) self.tasks.append(task) | 38,306 |
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 | def show_open_tasks(self): for id, task in enumerate(self.state.tasks): if task.state == 'open': print 'Task #%d: %s' % (id, task.title) print print textwrap.fill(task.description) print print | 38,307 |
def close_task(self, id): task = self.tasks[id] task.state = u'closed' | def close_task(self, id): task = self.state.tasks[id] task.state = u'closed' | 38,308 |
def get_options(cls): return list(cls.options) | def get_options(cls): return list(cls.options) | 38,309 |
def get_metadata(self): if self.real_handler is not None: return self.real_handler.get_metadata() | def get_metadata(self): if self.real_handler is not None: return self.real_handler.get_metadata() | 38,310 |
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" | 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" | 38,311 |
def search_range(self, left, right): left = self._normalise_word(left) right = self._normalise_word(right) | def search_range(self, left, right): left = self._normalise_word(left) right = self._normalise_word(right) | 38,312 |
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) | def _index_init(self): """Initialize csv values index list""" for column in self.columns: datatype = self.schema[column] if getattr(datatype, 'index', None) is not None: indexes.append(Index()) else: indexes.append(None) | 38,313 |
def remove(reference): if isinstance(reference, uri.Reference): path = str(reference.path) elif isinstance(reference, uri.Path): path = str(path) | def remove(reference): if isinstance(reference, Reference): path = str(reference.path) elif isinstance(reference, uri.Path): path = str(path) | 38,314 |
def remove(reference): if isinstance(reference, uri.Reference): path = str(reference.path) elif isinstance(reference, uri.Path): path = str(path) | def remove(reference): if isinstance(reference, uri.Reference): path = str(reference.path) elif isinstance(reference, Path): path = str(path) | 38,315 |
def batch_control(self): """Return a dict. as {'total', 'previous', 'next', 'control'}""" context = get_context() request = context.request | def batch_control(self): """Return a dict. as {'total', 'previous', 'next', 'control'}""" context = get_context() request = context.request | 38,316 |
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 | 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 | 38,317 |
def register(self, context): password = context.get_form_value('password') password2 = context.get_form_value('password2') email = context.get_form_value('ikaaro:email') | def register(self, context): password = context.get_form_value('password') password2 = context.get_form_value('password2') email = context.get_form_value('ikaaro:email') | 38,318 |
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 | 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 | 38,319 |
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 ... | 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 ... | 38,320 |
def __str__(self): return '&'.join([ '%s=%s' % (k, urllib.quote_plus(v)) for k, v in self.items() ]) | def __str__(self): return '&'.join([ '%s=%s' % (k, urllib.quote_plus(v)) for k, v in self.items() ]) | 38,321 |
def test_varsion(self): value = '20050217' encoded_value = IO.encode_version(value) self.assertEqual(IO.decode_version(encoded_value), value) | def test_version(self): value = '20050217' encoded_value = IO.encode_version(value) self.assertEqual(IO.decode_version(encoded_value), value) | 38,322 |
def handle_starttag(self, name, attrs): line_number = self.getpos()[0] | def handle_starttag(self, name, attrs): line_number = self.getpos()[0] | 38,323 |
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... | 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 = context.root.after_traver... | 38,324 |
def new_resource_form(self, context): type = context.get_form_value('type') if type is None: # Build the namespace namespace = {} namespace['types'] = [] | defnew_resource_form(self,context):type=context.get_form_value('type')iftypeisNone:#Buildthenamespacenamespace={}namespace['types']=[] | 38,325 |
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') | 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') | 38,326 |
def next_entry(self): # Load the next line line_type, value = self.next_line() | def next_entry(self): # Load the next line line_type, value = self.next_line() | 38,327 |
def set_message(self, msgid, msgstr=[''], comments=[], references={}): self._set_message(msgid, msgstr, comments, references) self.save() | def set_message(self, msgid, msgstr=[u''], comments=[], references={}): self._set_message(msgid, msgstr, comments, references) self.save() | 38,328 |
def _set_message(self, msgid, msgstr=[''], comments=[], references={}): if isinstance(msgid, (str, unicode)): msgid = [msgid] if isinstance(msgstr, (str, unicode)): msgstr = [msgstr] | def _set_message(self, msgid, msgstr=[u''], comments=[], references={}): if isinstance(msgid, (str, unicode)): msgid = [msgid] if isinstance(msgstr, (str, unicode)): msgstr = [msgstr] | 38,329 |
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... | 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... | 38,330 |
def traverse2(self, context=None, caching=True): if context is None: context = Context() | def traverse2(self, context=None, caching=True): if context is None: context = Context() | 38,331 |
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 ... | 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(): if key in field_numbers: atom = Query.Simple(key, value) if query is None: query = atom else: query = Query.Complex(query, 'and', atom) else: query = Query.Complex(query, 'an... | 38,332 |
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 ... | 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: warnings.warn('unknown field "%s"' % key) # Check wether there is a query at all if query is None: raise... | 38,333 |
def __init__(self, resource=None, **kw): self.cache = {} | def __init__(self, resource=None, **kw): self.cache = {} | 38,334 |
def __init__(self, resource=None, **kw): self.cache = {} | def __init__(self, resource=None, **kw): self.cache = {} | 38,335 |
def get_atime(reference): raise NotImplementedError | def get_atime(reference): raise NotImplementedError | 38,336 |
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: | 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: | 38,337 |
def edit(self, context): data = unicode(context.get_form_value('data'), 'UTF-8') self.set_data(data) | def edit(self, context): data = unicode(context.get_form_value('data'), 'UTF-8') self.set_data(data) | 38,338 |
def edit_event(self, context): if context.has_form_value('remove'): return self.remove(context) | def edit_event(self, context): if context.has_form_value('remove'): return self.remove(context) | 38,339 |
def edit_event(self, context): if context.has_form_value('remove'): return self.remove(context) | def edit_event(self, context): if context.has_form_value('remove'): return self.remove(context) | 38,340 |
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... | 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... | 38,341 |
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... | 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... | 38,342 |
def finalize_options (self): self.set_undefined_options('install', ('install_purelib', 'install_dir'), ('root', 'root'), ('force', 'force'), ) | def finalize_options (self): self.set_undefined_options('install', ('install_purelib', 'install_dir'), ('root', 'root'), ('force', 'force'), ) | 38,343 |
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... | def substitute(data, stack, repeat_stack, encoding='utf-8'): if isinstance(data, str): pass elif isinstance(data, unicode): data = data.encode('utf-8') else: 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(... | 38,344 |
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... | def decode(cls, node): schema = cls.schema property = cls() for node in node.get_elements(): name = node.name # Decode the value 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.dec... | 38,345 |
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... | 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... | 38,346 |
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 ... | 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 ... | 38,347 |
def _load_state(self, resource): data = resource.read() | def _load_state(self, resource): data = resource.read() | 38,348 |
def _load_state(self, resource): data = resource.read() | def _load_state(self, resource): data = resource.read() | 38,349 |
def _load_state(self, resource): data = resource.read() | def _load_state(self, resource): data = resource.read() | 38,350 |
def on_del_handler(self, segment): from root import Root | def on_del_handler(self, segment): from root import Root | 38,351 |
def __init__(self, id, title, description, state): self.id = id self.title = title self.description = description self.state = state | def __init__(self, title, description, state='open'): self.title = title self.description = description self.state = state | 38,352 |
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 ... | 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 ... | 38,353 |
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 ... | 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 ... | 38,354 |
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... | 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.root = 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 None:... | 38,355 |
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') | 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) | 38,356 |
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"\... | def to_str(self, encoding='UTF-8'): 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.a... | 38,357 |
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"\... | 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"\... | 38,358 |
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"\... | 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"\... | 38,359 |
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"\... | 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"\... | 38,360 |
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"\... | 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"\... | 38,361 |
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"\... | 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"\... | 38,362 |
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) | def to_str(self, encoding='UTF-8'): 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) | 38,363 |
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) | def to_str(self, encoding=None): messages = self.state.messages message_ids = messages.keys() message_ids.sort() messages = [ messages[x].to_str(encoding) for x in message_ids ] return '\n'.join(messages) | 38,364 |
def is_allowed_to_register(self): return get_context().root.get_property('ikaaro:website_is_open') | def is_allowed_to_register(self): return get_context().root.get_property('ikaaro:website_is_open') | 38,365 |
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... | 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... | 38,366 |
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... | 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... | 38,367 |
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: | 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: | 38,368 |
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: | 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: | 38,369 |
def select_language(self, languages): raise NotImplementedError | def select_language(self, languages): raise NotImplementedError | 38,370 |
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... | def send_email(self, from_addr, to_addr, subject, body, **kw): context = get_context() response = context.response encoding = 'UTF-8' # 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 % {'to_addr': to_add... | 38,371 |
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... | 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'Content-Transfer-Encoding: 8bit\n' u'Content-Type... | 38,372 |
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... | 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... | 38,373 |
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... | 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... | 38,374 |
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' | 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' | 38,375 |
def to_str(self): state = self.state | def to_str(self): state = self.state | 38,376 |
def to_str(self): state = self.state | def to_str(self): state = self.state | 38,377 |
def to_str(self): state = self.state | def to_str(self): state = self.state | 38,378 |
def to_str(self): state = self.state | def to_str(self): state = self.state | 38,379 |
def to_str(self): state = self.state | def to_str(self): state = self.state | 38,380 |
def to_str(self): state = self.state | def to_str(self): state = self.state | 38,381 |
def to_str(self): state = self.state | def to_str(self): state = self.state | 38,382 |
def to_str(self): state = self.state | def to_str(self): state = self.state | 38,383 |
def parse(self, data): self.namespaces = {} | def parse(self, data): self.namespaces = {} | 38,384 |
def __init__(self, handler, depth=None, count=None): from Folder import Folder as DatabaseFolder | def __init__(self, handler, depth=None, count=None): from Folder import Folder as DatabaseFolder | 38,385 |
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... | 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 val... | 38,386 |
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... | 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... | 38,387 |
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... | 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 ... | 38,388 |
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... | 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... | 38,389 |
def get_end_tag_as_html(self): if self.name in empty_elements: return '' return self.get_end_tag() | def get_end_tag_as_html(self): if self.name in empty_elements: return '' return self.get_end_tag() | 38,390 |
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] | 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] | 38,391 |
def get_atime(self): raise NotImplementedError | def get_atime(self): raise NotImplementedError | 38,392 |
def get_ctime(self): raise NotImplementedError | def get_ctime(self): raise NotImplementedError | 38,393 |
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) | 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) content = self.get_content(encoding) lines = content.splitlines() while lines and lines[0].strip() == u'': lines = lines[1:] head.a... | 38,394 |
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' | 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' | 38,395 |
def decode(data): if data.startswith('not '): return NotExpression(data) return Expression(data) | def decode(data): if data.startswith('not') and data[3].isspace(): return NotExpression(data) return Expression(data) | 38,396 |
def _get_free_slot(self): """ Internal method that returns a free slot. If none exists a new one is allocated. | def _get_free_slot(self): """ Internal method that returns a free slot. If none exists a new one is allocated. | 38,397 |
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... | 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... | 38,398 |
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... | 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... | 38,399 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.