rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
if comp == None or comp == 'NULL': | if comp == None or comp == WrapperNULL: | def NewComponent(c): "Converts a string or C icalcomponent into the right component object." wasStr=0 # Were we passed a string or an icalcomponent? if isinstance (c, StringType) and string.find(c,"icalcomponent") == -1: comp = icalparser_parse_string(c) else: comp = c if comp == None or comp == 'NULL': raise Value... |
lastmodified(time_obj) lastmodified('19970101T123000Z') lastmodified(982362522) lastmodified() | last_modified(time_obj) last_modified('19970101T123000Z') last_modified(982362522) last_modified() | def last_modified(self, v=None): """Sets or returns the value of the LAST-MODIFIED property. |
self.assertEqual(instance.backoff, 2) | self.assertEqual(instance.backoff, 0) self.assertEqual(instance.delay, 0) | def test_governor_system_stop(self): options = DummyOptions() config = DummyPConfig('notthere', '/notthere', logfile='/tmp/foo') instance = self._makeOne(options, config) options.backofflimit = 1 options.forever = False instance.backoff = 1 # gt backofflimit instance.laststart = time.time() instance.governor() self.ass... |
self.options.logger.info('received %s' % signame(sig)) | self.options.logger.debug('received %s' % signame(sig)) | def sigchild(self, sig, frame): # do nothing here, we reap our children synchronously self.options.logger.info('received %s' % signame(sig)) |
else: return xmlrpclib.Transport.make_connection(self, serverurl) | else: type, uri = urllib.splittype(serverurl) host, path = urllib.splithost(uri) hostpath = host+path return xmlrpclib.Transport.make_connection(self, hostpath) | def make_connection(self, host): serverurl = self.serverurl if not serverurl.startswith('http'): if serverurl.startswith('unix://'): serverurl = serverurl[7:] http = UnixStreamHTTP(serverurl) return http else: return xmlrpclib.Transport.make_connection(self, serverurl) |
if callback() is NOT_DONE_YET: | result = callback() if result is NOT_DONE_YET: | def restartprocess(): if callback() is NOT_DONE_YET: return NOT_DONE_YET return 'Process %s restarted' % processname |
path = unquote(path) | path = http_server.unquote(path) | def cgi_environment(self): env = {} |
if elapsed < self.delay: return False | if elapsed > self.delay: return True | def writable(self, t=time.time): now = t() if self.delay: # we called a deferred producer on this channel (see refill_buffer) elapsed = now - self.last_writable_check if elapsed < self.delay: return False self.last_writable_check = now |
return True | return http_server.http_channel.writable(self) | def writable(self, t=time.time): now = t() if self.delay: # we called a deferred producer on this channel (see refill_buffer) elapsed = now - self.last_writable_check if elapsed < self.delay: return False self.last_writable_check = now |
options.logger.debug(msg) | options.logger.info(msg) | def log(self, msg): if msg.endswith('\n'): msg = msg[:-1] options.logger.debug(msg) |
self.assertEqual(instance.childlog.args, (config.logfile, 10, '%(message)s', 0, 0)) | self.assertEqual(instance.childlog.args, ( ('/tmp/temp123.log', 20, '%(message)s'), {'rotating': False, 'backups': 0, 'maxbytes': 0})) | def test_ctor(self): options = DummyOptions() config = DummyPConfig('cat', 'bin/cat', logfile='/tmp/temp123.log') instance = self._makeOne(options, config) self.assertEqual(instance.options, options) self.assertEqual(instance.config, config) self.assertEqual(instance.laststart, 0) self.assertEqual(instance.childlog.arg... |
def getLogger(self, *args): | def getLogger(self, *args, **kw): | def getLogger(self, *args): logger = DummyLogger() logger.handlers = [DummyLogger()] logger.args = args return logger |
logger.args = args | logger.args = args, kw | def getLogger(self, *args): logger = DummyLogger() logger.handlers = [DummyLogger()] logger.args = args return logger |
logger.log(5, 'XML-RPC method called: %s()' % method) | logger.debug('XML-RPC method called: %s()' % method) | def continue_request (self, data, request): logger = self.supervisord.options.logger try: |
logger.log(5, 'XML-RPC method %s() returned successfully' % method) | logger.debug('XML-RPC method %s() returned successfully' % method) | def continue_request (self, data, request): logger = self.supervisord.options.logger try: |
self.serverurl, | 'http://127.0.0.1', | def getServerProxy(self): # mostly put here for unit testing return xmlrpclib.ServerProxy( self.serverurl, transport = BasicAuthTransport(self.username, self.password) ) |
self.password) | self.password, self.serverurl) | def getServerProxy(self): # mostly put here for unit testing return xmlrpclib.ServerProxy( self.serverurl, transport = BasicAuthTransport(self.username, self.password) ) |
def __init__(self, username=None, password=None): | def __init__(self, username=None, password=None, serverurl=None): | def __cmp__(self, other): return cmp(self.priority, other.priority) |
h = httplib.HTTP(host) | h = self.make_connection(host) if verbose: h.set_debuglevel(1) | def request(self, host, handler, request_body, verbose=False): # issue XML-RPC request |
def make_connection(self, host): serverurl = self.serverurl if not serverurl.startswith('http'): if serverurl.startswith('unix://'): serverurl = serverurl[7:] http = UnixStreamHTTP(serverurl) return http else: return xmlrpclib.Transport.make_connection(self, serverurl) class UnixStreamHTTPConnection(httplib.HTTPConnec... | def request(self, host, handler, request_body, verbose=False): # issue XML-RPC request | |
document_numbers = [ int(x[1:]) for x in self.resource.get_resource_names() if x.startswith('d') ] if document_numbers: self.document_number = max(document_numbers) + 1 else: self.document_number = 0 | def _load(self, resource): Folder._load(self, resource) # XXX This may be removed.. self.added_documents = {} self.removed_documents = [] | |
documents = [ int(x[1:]) for x in self.resource.get_resource_names() if x.startswith('d') ] documents += self.added_documents.keys() if documents: documents.sort() return documents[-1] + 1 return 0 | document_number = self.document_number self.document_number += 1 return document_number | def get_new_document_number(self): documents = [ int(x[1:]) for x in self.resource.get_resource_names() if x.startswith('d') ] documents += self.added_documents.keys() if documents: documents.sort() return documents[-1] + 1 return 0 |
context = Context(request, '%s:%s' % (server.address, server.port)) | address = request.get_header('X-Forwarded-Host') if address is None: address = '%s:%s' % (server.address, server.port) context = Context(request, address) | 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 ... |
handler = self._get_virtual_handler(segment) | handler = here._get_virtual_handler(segment) | def get_handler(self, path): # Be sure path is a Path if not isinstance(path, Path): path = Path(path) |
if isinstance(content, int): content = str(content) | if isinstance(content, unicode): pass elif isinstance(content, str): content = unicode(content) elif isinstance(content, int): content = unicode(content) else: msg = 'expression "%(expr)s" evaluates to value of' \ ' unexpected type %(type)s' msg = msg % (str(expression), content.__class__.__name__) raise STLTypeError, ... | def process1(self, node, stack, repeat): """ Process stl:if, stl:ifnot, stl:attributes and stl:content. """ attrs = node.attributes stl_uri = 'http://xml.itools.org/namespaces/stl' stl_attrs = attrs.namespaces.get(stl_uri, {}) |
author = "J. David Ibez", | author = u"J. David Ibez", | def get_data_files(self): """Generate list of '(package,src_dir,build_dir,filenames)' tuples""" data = [] if not self.packages: return data for package in self.packages: # Locate package source directory src_dir = self.get_package_dir(package) |
return mtime is None or mtime > self.timestamp | if mtime is None: return True return mtime > self.timestamp | def is_outdated(self): mtime = self.resource.get_mtime() return mtime is None or mtime > self.timestamp |
handler.save() | if handler.resource.get_mtime() is not None: handler.save() | def commit_transaction(cls): transaction = cls.get_transaction() while transaction: handler = transaction.pop() # XXX Maybe we should check the timestamp to know wether the # handler has really changed handler.save() |
note = str(request.uri.path) | note = str(context.request.uri.path) | def commit_transaction(self, context): # Get the transaction transaction = get_transaction() # Nothing to commit if not transaction: return |
handler = None | def get_handler(self, path): # Be sure path is a Path if not isinstance(path, uri.Path): path = uri.Path(path) | |
if key in self.cache: handler, atime = self.cache.pop(key) if handler.is_outdated(): handler = None is_virtual = False if handler is None: if self.resource.has_resource(name): | if self.resource.has_resource(name): if key in self.cache: handler, atime = self.cache[key] if handler.is_outdated(): handler.load() else: | def get_handler(self, path): # Be sure path is a Path if not isinstance(path, uri.Path): path = uri.Path(path) |
else: handler = self._get_virtual_handler(segment) is_virtual = True | handler.parent = self handler.name = segment.name atime = datetime.datetime.now() self.cache[key] = (handler, atime) else: if key in self.cache: del self.cache[key] handler = self._get_virtual_handler(segment) | def get_handler(self, path): # Be sure path is a Path if not isinstance(path, uri.Path): path = uri.Path(path) |
if is_virtual is False: atime = datetime.datetime.now() self.cache[key] = (handler, atime) | def get_handler(self, path): # Be sure path is a Path if not isinstance(path, uri.Path): path = uri.Path(path) | |
mtime = getattr(object, '%s__mtime__' % context.method, None) | mtime = getattr(context.handler, '%s__mtime__' % context.method, None) | def GET(self, context): request, response = context.request, context.response # This is a safe method context.commit = False # Our canonical URLs never end with an slash if context.uri.path.endswith_slash: goto = copy(context.uri) goto.path.endswith_slash = False return 302, goto # Traverse status, method = self.traver... |
thread = Thread(target=handle_request, args=(connection, self)) thread.start() thread.join() | handle_request(connection, self) | def start(self): if self.pid_file is not None: pid = os.getpid() open(self.pid_file, 'w').write(str(pid)) |
'mtime': str(self.timestamp.strftime('%Y%m%d%H%M%S')), | 'mtime': mtime.strftime('%Y%m%d%H%M%S'), | def get_catalog_indexes(self): from access import RoleAware |
line = [ '"%s"' % x for x in line ] | line = [ '"%s"' % x.encode(encoding) for x in line ] | def to_str(self, encoding='UTF-8'): lines = [] # When schema or columns (or both) are None there is plain # string to string conversion if self.schema and self.columns: for line in self.state.lines: line = [ '"%s"' % self.schema[self.columns[i]].encode(value) for i, value in enumerate(line) ] lines.append(','.join(line... |
head = IO.decode_uint32(docs_rsrc[free_block:free_block+8]) size = head[0:4] | head = docs_rsrc[free_block:free_block+8] size = IO.decode_uint32(head[0:4]) | def _index_term(self, term, documents): """ Indexes the given term. The parameter 'documents' is a mapping from document number to list of positions: |
try: connection, client_address = ear.accept() except socket.error: continue handle_request(connection, self) | iready, oready, eready = select(iwtd, owtd, ewtd) for x in iready: if x is ear: try: connection, client_address = ear.accept() except socket.error: continue iwtd.append(connection) else: iwtd.remove(x) handle_request(x, self) | def start(self): if self.pid_file is not None: pid = os.getpid() open(self.pid_file, 'w').write(str(pid)) |
get_transaction().begin() | transaction.begin() | def start_transaction(self): get_transaction().begin() |
get_transaction().abort() | transaction.abort() | def abort_transaction(self): get_transaction().abort() |
get_transaction().commit() | transaction.commit() | def commit_transaction(self): get_transaction().commit() |
class TaskTracker(Text): | class TaskTracker(Text, domains.Domain): | def __init__(self, title, description, state='open'): self.title = title self.description = description self.state = state |
handler = get_handler('TaskTracker_view.xml') | language = self.select_language(['en', 'es']) handler = get_handler('TaskTracker_view.xml.%s' % language) | def view(self): # Load the STL template handler = get_handler('TaskTracker_view.xml') |
return self.resource.get_mimetype() | return vfs.get_mimetype(self.uri) | def get_mimetype(self): return self.resource.get_mimetype() |
'join_url': '%s/;join_form' % path_to_root} | 'join_url': '%s/;register_form' % path_to_root} | def get_user_menu(self): """Return a dict {user_icon, user, joinisopen}.""" context = get_context() user = context.user here = context.handler root = context.root |
user = context.user | if context is None: username = '' else: username = context.user.name | def commit_revision(self): context = get_context() user = context.user |
(None, 'user'): user.name, | (None, 'user'): username, | def commit_revision(self): context = get_context() user = context.user |
if options.debug is True: server.start() else: server.start() | if options.debug is False: pid = os.fork() if pid > 0: sys.exit(0) os.setsid() pid = os.fork() if pid > 0: sys.exit(0) sys.stdin.close() server.start() | def start(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 handler database = get_database(target) root = get_root(database) root.name = roo... |
else: self.removed_documents.append(doc_n) | 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) else: self.removed_documents.append(doc_n) |
elif here.get_prefix(handler_abspath) == '.': pass elif here.startswith(handler_abspath): self.in_path = True else: pass | else: prefix = here.get_prefix(handler_abspath) if prefix != '.': self.in_path = True | def __init__(self, handler, depth=None, count=None): from Folder import Folder as DatabaseFolder |
value = state.headers[name] datatype = headers.get_type(name) value = datatype.encode(value) data.append('%s: %s' % (name, value)) data.append('Server: itools.web') now = datetime.utcnow() data.append('Date: %s' % HTTPDate.encode(now)) | if name not in ['Date', 'Server', 'Last-Modified']: value = state.headers[name] datatype = headers.get_type(name) value = datatype.encode(value) data.append('%s: %s' % (name, value)) | def to_str(self): state = self.state |
def _get_handler_names(self): return self.resource._get_resource_names() def _get_handler(self, segment, resource): return Handler.build_handler(resource) def _get_virtual_handler(self, segment): """ This method must return a handler for the given segment, or raise the exception LookupError. We know there is not a... | def del_resource(self, path): return self.resource.del_resource(path) | |
def _get_handler(self, segment, resource): return Handler.build_handler(resource) def _get_virtual_handler(self, segment): """ This method must return a handler for the given segment, or raise the exception LookupError. We know there is not a resource with the given name, this method is used to return 'virtual' hand... | def get_handlers(self, path='.'): handler = self.get_handler(path) for name in handler.get_handler_names(path): yield handler.get_handler(name) | def _get_handler(self, segment, resource): # Build and return the handler return Handler.build_handler(resource) |
def _set_handler(self, segment, handler): self.resource.set_resource(segment.name, handler.resource) | def _set_handler(self, segment, handler): self.resource.set_resource(segment.name, handler.resource) | |
def _del_handler(self, segment): self.resource.del_resource(segment) | def del_handler(self, path): if not isinstance(path, uri.Path): path = uri.Path(path) | |
s = u'' | s = [] | def __call__(self, namespace={}): # XXX Rewrite with walk. |
s += self.process(child, stack, repeat) | s.extend(self.process(child, stack, repeat)) | def __call__(self, namespace={}): # XXX Rewrite with walk. |
s += unicode(child) return s | s.append(unicode(child)) return u''.join(s) | def __call__(self, namespace={}): # XXX Rewrite with walk. |
return unicode(node) | return [unicode(node)] | def process(self, node, stack, repeat_stack): # Raw nodes if isinstance(node, (XML.Raw, XML.Comment)): return unicode(node) |
s = u'' | s = [] | def process(self, node, stack, repeat_stack): # Raw nodes if isinstance(node, (XML.Raw, XML.Comment)): return unicode(node) |
s += self.process1(node, newstack, newrepeat) | s.extend(self.process1(node, newstack, newrepeat)) | def process(self, node, stack, repeat_stack): # Raw nodes if isinstance(node, (XML.Raw, XML.Comment)): return unicode(node) |
return s + self.process1(node, stack, repeat_stack) | s.extend(self.process1(node, stack, repeat_stack)) return s | def process(self, node, stack, repeat_stack): # Raw nodes if isinstance(node, (XML.Raw, XML.Comment)): return unicode(node) |
return u'' | return [] | def process1(self, node, stack, repeat): """ Process stl:if, stl:ifnot, stl:attributes and stl:content. """ attrs = node.attributes stl_uri = 'http://xml.itools.org/namespaces/stl' stl_attrs = attrs.namespaces.get(stl_uri, {}) |
head = u'<' + node.qname | s = ['<%s' % node.qname] | def process1(self, node, stack, repeat): """ Process stl:if, stl:ifnot, stl:attributes and stl:content. """ attrs = node.attributes stl_uri = 'http://xml.itools.org/namespaces/stl' stl_attrs = attrs.namespaces.get(stl_uri, {}) |
head += ' %s="%s"' % (qname, value) | s.append(' %s="%s"' % (qname, value)) | def process1(self, node, stack, repeat): """ Process stl:if, stl:ifnot, stl:attributes and stl:content. """ attrs = node.attributes stl_uri = 'http://xml.itools.org/namespaces/stl' stl_attrs = attrs.namespaces.get(stl_uri, {}) |
head += '>' | s.append('>') | def process1(self, node, stack, repeat): """ Process stl:if, stl:ifnot, stl:attributes and stl:content. """ attrs = node.attributes stl_uri = 'http://xml.itools.org/namespaces/stl' stl_attrs = attrs.namespaces.get(stl_uri, {}) |
content = unicode(content) | content = [unicode(content)] | def process1(self, node, stack, repeat): """ Process stl:if, stl:ifnot, stl:attributes and stl:content. """ attrs = node.attributes stl_uri = 'http://xml.itools.org/namespaces/stl' stl_attrs = attrs.namespaces.get(stl_uri, {}) |
content = '' | content = [] | def process1(self, node, stack, repeat): """ Process stl:if, stl:ifnot, stl:attributes and stl:content. """ attrs = node.attributes stl_uri = 'http://xml.itools.org/namespaces/stl' stl_attrs = attrs.namespaces.get(stl_uri, {}) |
content += self.process(child, stack, repeat) | content.extend(self.process(child, stack, repeat)) | def process1(self, node, stack, repeat): """ Process stl:if, stl:ifnot, stl:attributes and stl:content. """ attrs = node.attributes stl_uri = 'http://xml.itools.org/namespaces/stl' stl_attrs = attrs.namespaces.get(stl_uri, {}) |
foot = '</%s>' % node.qname return head + content + foot | s.extend(content) s.append('</%s>' % node.qname) return s | def process1(self, node, stack, repeat): """ Process stl:if, stl:ifnot, stl:attributes and stl:content. """ attrs = node.attributes stl_uri = 'http://xml.itools.org/namespaces/stl' stl_attrs = attrs.namespaces.get(stl_uri, {}) |
reference = self.uri.resolve(name) | reference = self.uri.path.resolve2(name) | def _get_resource(self, name): reference = self.uri.resolve(name) return get_resource(reference) |
object._setOb(name, ZopeFile(name, '', resource.get_data())) | object._setObject(name, ZopeFile(name, '', resource.get_data())) | def _set_file_resource(self, name, resource): object = self._get_object() object._setOb(name, ZopeFile(name, '', resource.get_data())) |
object._setOb(name, ZopeFolder(name)) | object._setObject(name, ZopeFolder(name)) | def _set_folder_resource(self, name, resource): object = self._get_object() object._setOb(name, ZopeFolder(name)) |
object._delOb(name) | object._delObject(name) | def _del_file_resource(self, name): object = self._get_object() object._delOb(name) |
object._delOb(name) | object._delObject(name) | def _del_folder_resource(self, name): object = self._get_object() object._delOb(name) |
value = None if hasattr(document, field.name): value = getattr(document, field.name) elif isinstance(document, dict): if field.name in document: value = document[field.name] | if isinstance(document, dict): value = document.get(field.name) else: value = getattr(document, field.name, None) | def index_document(self, document): # Mark as changed self.set_changed() |
if ac.is_allowed_to_remove(user, object): | if ac.is_allowed_to_remove(user, handler): | def remove(self, context): ids = context.get_form_values('ids') if not ids: return context.come_back(u'No objects selected.') |
resource = memory.File('hello') root.set_resource('test.txt', resource) | root.set_resource('test.txt', memory.File('hello')) | def test_add_file(self): root = self.database.get_resource('/') resource = memory.File('hello') root.set_resource('test.txt', resource) |
value = self.request.get_parameter(name) | value = self.request.get_parameter(name, default) | def get_form_value(self, name, default=None): value = self.request.get_parameter(name) if isinstance(value, list): return value[0] return value |
self.body[name] = body | if name not in self.body: self.body[name] = body else: if isinstance(self.body[name], list): self.body[name].append(body) else: self.body[name] = [self.body[name], body] | def non_blocking_load(self, file): """ Loads the request state from in non-blocking mode. Aimed at sockets, it works for files too. """ # Read the request line line = file.readline() while line is None: yield None line = file.readline() # Parse the request line self.request_line = line method, request_uri, http_version... |
for name in self.resource.get_resource_names(): resource.set_resource(name, self.resource.get_resource(name)) | for handler in self.traverse(): if handler is not self: path = self.get_pathto(handler) resource.set_resource(path, handler.resource) | def copy_handler(self): resource = memory.Folder() for name in self.resource.get_resource_names(): resource.set_resource(name, self.resource.get_resource(name)) self.save(resource) return self.__class__(resource) |
if self.get_abspath().startswith('/ui'): | real = self.real_handler or self if real.get_abspath().startswith('/ui'): | def _get_handler(self, segment, uri): name = segment.name # Metadata if name.endswith('.metadata'): return Metadata(uri) # Locks if name.endswith('.lock'): return Lock(uri) |
docs.first_empty = docs_slot_n | docs.state.first_empty = docs_slot_n | def _unindex_term(self, word, documents): """ Un-indexes the given term. The parameter 'documents' is a list with the numbers of the documents that must be un-indexed. """ if word: if self.children is None: self.load_children() |
return id | return str(id) | def checkid(id): """ Checks wether th id is or not a valid Zope id. If it is the id is returned, but stripped. If it is a bad id None is returned to signal the error. """ if isinstance(id, str): id = unicode(id, 'utf8') id = id.strip().translate(transmap).strip('_') # Check wether the id is empty if len(id) == 0: retu... |
yield str(int(value)), 0 | yield unicode(int(value)), 0 | def Bool(value): yield str(int(value)), 0 |
yield value, 0 | yield unicode(value), 0 | def Keyword(value): if value: yield value, 0 |
dict.__setitem__(self, key, value) | if key in self: old_value = self[key] if isinstance(old_value, list): old_value.append(value) else: value = [old_value, value] dict.__setitem__(self, key, value) else: dict.__setitem__(self, key, value) | def __init__(self, query): if query: for x in query.split('&'): x = urllib.unquote_plus(x) if x: key, value = x.split('=', 1) dict.__setitem__(self, key, value) |
return offset.resolve(uri.path) | value = offset.resolve(uri.path) return str(value) | def resolve_pointer(uri, offset): if not uri.scheme and not uri.authority: if uri.path.is_relative(): if uri.path or str(uri) == '.': # XXX Here we loss the query and fragment. return offset.resolve(uri.path) return URI.encode(uri) |
return self.form | if self.method in ('GET', 'HEAD'): return self.uri.query return self.body | def get_form(self): return self.form |
src_base = '%s/%s/database/' % (cwd, target) | src_base = os.path.join(cwd, target, 'database/') | def end_commit_on_success(self): target = self.target transaction = get_transaction() |
dst_base = '%s/%s/database.bak/' % (cwd, target) | dst_base = os.path.join(cwd, target, 'database.bak/') | def end_commit_on_success(self): target = self.target transaction = get_transaction() |
handler = get_handler('../examples/hello.txt.en') | handler = get_handler('hello.txt') | def test_get(self): handler = get_handler('../examples/hello.txt.en') self.assertEqual(handler.to_str(), 'hello world\n') |
data = """ import A import A.B as AB from B.E import F from A.B import C as CC class E(AA, C): pass """ code_0 = """ import A import A.B as AB from A.B import C as CC class D(A.B.C): pass class E(AB.C): pass class F(CC): pass """ dot_0 = """ digraph G { rankdir=BT; "D" -> "A.B.C" "E" -> "A.B.C" "F" -> "A.B.C" }""... | def test_language(self): self.assertEqual(self.var.state.records[0].language, 'de') | |
if name == 'number' or name == 'columns': | if name in ('number', 'columns', 'parent', 'name'): | def __setattr__(self, name, value): if name == 'number' or name == 'columns': list.__setattr__(self, name, value) else: try: column = self.columns.index(name) except ValueError: message = "'%s' object has no attribute '%s'" raise AttributeError, message % (self.__class__.__name__, name) |
def _get_virtual_handler(self, segment): index = int(segment.name) return self.state.lines[index] | ## def _get_virtual_handler(self, segment): | |
return container.cache.keys() | return container._get_handler_names() def _get_handler_names(self): return self.cache.keys() | def get_handler_names(self, path='.'): container = self.get_handler(path) return container.cache.keys() |
def _load_state(self, resource): self.data = resource.read() | def _load_state_from_file(self, file): self.data = file.read() | def _load_state(self, resource): self.data = resource.read() |
if callable(value): value = value() | def index_document(self, document): # Mark as changed self.set_changed() | |
docs_rsrc[8:12] = docs_slot_r | docs_rsrc[8:12] = IO.encode_link(docs_slot_n) | def unindex_word(self, word, doc_number): if word: prefix, suffix = word[0], word[1:] subtree = self.children[prefix] subtree.unindex_word(suffix, doc_number) else: del self.documents[doc_number] # Update resource tree_rsrc = self.root.tree_handler.resource docs = self.root.docs_handler docs_rsrc = docs.resource # Sear... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.