rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
load = [] run = [] ignore = [DependencyItem(x, '', "|DefaultIgnoredNamesDynamic|") for x in DefaultIgnoredNamesDynamic] classDeps.data['ignore'] = ignore | depsData = classDeps.data depsData['ignore'] = [DependencyItem(x, '', "|DefaultIgnoredNamesDynamic|") for x in DefaultIgnoredNamesDynamic] | def buildShallowDeps(variants): |
load.extend(DependencyItem(x, '', self.id, "|hints|") for x in metaLoad) run.extend(DependencyItem(x, '', self.id, "|hints|") for x in metaRun) ignore.extend(DependencyItem(x, '', self.id, "|hints|") for x in metaIgnore) | depsData['require'].extend(DependencyItem(x, '', self.id, "|hints|") for x in metaLoad) depsData['use'] .extend(DependencyItem(x, '', self.id, "|hints|") for x in metaRun) depsData['ignore'] .extend(DependencyItem(x, '', self.id, "|hints|") for x in metaIgnore) | def buildShallowDeps(variants): |
console.outdent() | def buildShallowDeps(variants): | |
return classDeps | return classDeps, cached | def getNodeDeps(node): ltime = rtime = [] # distinction is in the depsItems that populate this array self._analyzeClassDepsNode(node, ltime, rtime, True, variants) # we force inFunction, to not track recursive deps return ltime |
__slots__ = ('name', 'attribute', 'requestor', 'line', 'inFunction') def __init__(self, name, attribute, requestor, line=-1, inFunction=False): self.name = name | def __init__(self, name, attribute, requestor, line=-1, isLoadDep=False): self.name = name | def getOptionals(self, includeWithDeps): result = [] |
self.attribute = attribute self.requestor = requestor self.line = line self.inFunction = inFunction | self.attribute = attribute self.requestor = requestor self.line = line self.isLoadDep = isLoadDep self.needsRecursion = False | def __init__(self, name, attribute, requestor, line=-1, inFunction=False): self.name = name # "qx.Class" [dependency to(class)] assert isinstance(name, types.StringTypes) self.attribute = attribute # "define" [dependency to(attribute)] self.requestor = requestor # "gui.Application" [the one depending on ... |
packageContent = u''''qx.$$packageData["%s"]=%s;' | packageContent = u'''qx.$$packageData["%s"]=%s; | def getHash(buffer): hashCode = sha_construct(buffer).hexdigest() return hashCode |
});''' % (contentHash, getDataString(), contentHash, getClassesString()) | });''' % (contentHash, dataString, contentHash, classesString) | def getHash(buffer): hashCode = sha_construct(buffer).hexdigest() return hashCode |
execfile(candidate_filepath+".py",candidate_globals) | candidateMainFile = open(candidate_filepath+".py","r") exec(candidateMainFile,candidate_globals) | def loadPlugins(self, callback=None): """ Load the candidate plugins that have been identified through a previous call to locatePlugins. For each plugin candidate look for its category, load it and store it in the appropriate slot of the ``category_mapping``. |
if self.category_mapping.has_key(category): | if category in self.category_mapping: | def getPluginByName(self,name,category="Default"): """ Get the plugin correspoding to a given category and name """ if self.category_mapping.has_key(category): for item in self.category_mapping[category]: if item.name == name: return item return None |
if self.category_mapping.has_key(category): | if category in self.category_mapping: | def deactivatePluginByName(self,name,category="Default"): """ Desactivate a plugin corresponding to a given category + name. """ if self.category_mapping.has_key(category): plugin_to_deactivate = None for item in self.category_mapping[category]: if item.name == name: plugin_to_deactivate = item.plugin_object break if p... |
Set the namle and path of the plugin as well as the default | Set the name and path of the plugin as well as the default | def __init__(self, plugin_name, plugin_path): """ Set the namle and path of the plugin as well as the default values for other usefull variables. """ PluginInfo.__init__(self, plugin_name, plugin_path) # version number is now required to be a StrictVersion object self.version = StrictVersion("0.0") |
Manage several plugins by ordering them in several categories with versioning capabilities. | Handle plugin versioning by making sure that when several versions are present for a same plugin, only the latest version is manipulated via the standard methods (eg for activation and deactivation) More precisely, for operations that must be applied on a single named plugin at a time (``getPluginByName``, ``activateP... | def setVersion(self, vstring): self.version = StrictVersion(vstring) |
self._prepareVersionMapping() | self._prepareAttic() | def __init__(self, decorated_manager=None, categories_filter={"Default":IPlugin}, directories_list=None, plugin_info_ext="yapsy-plugin"): """ Create the plugin manager and record the ConfigParser instance that will be used afterwards. The ``config_change_trigger`` argument can be used to set a specific method to call ... |
def _prepareVersionMapping(self): | def _prepareAttic(self): | def _prepareVersionMapping(self): """ Create a mapping that will make it possible to easily provide the latest version of each plugin. """ self.latest_mapping = {} for categ in self._component.categories_interfaces.keys(): self.latest_mapping[categ] = [] |
Create a mapping that will make it possible to easily provide the latest version of each plugin. | Create and correctly initialize the storage where the wrong version of the plugins will be stored. | def _prepareVersionMapping(self): """ Create a mapping that will make it possible to easily provide the latest version of each plugin. """ self.latest_mapping = {} for categ in self._component.categories_interfaces.keys(): self.latest_mapping[categ] = [] |
self.latest_mapping = {} for categ in self._component.categories_interfaces.keys(): self.latest_mapping[categ] = [] | self._attic = {} for categ in self.getCategories(): self._attic[categ] = [] | def _prepareVersionMapping(self): """ Create a mapping that will make it possible to easily provide the latest version of each plugin. """ self.latest_mapping = {} for categ in self._component.categories_interfaces.keys(): self.latest_mapping[categ] = [] |
def setCategoriesFilter(self, categories_filter): """ Set the categories of plugins to be looked for as well as the way to recognise them. The ``categories_filter`` first defines the various categories in which the plugins will be stored via its keys and it also defines the interface tha has to be inherited by the act... | def _prepareVersionMapping(self): """ Create a mapping that will make it possible to easily provide the latest version of each plugin. """ self.latest_mapping = {} for categ in self._component.categories_interfaces.keys(): self.latest_mapping[categ] = [] | |
return self.latest_mapping[category_name] | return self.getPluginsOfCategory(category_name) | def getLatestPluginsOfCategory(self,category_name): """ Return the list of all plugins belonging to a category. """ |
for categ, items in self._component.category_mapping.iteritems(): unique_items = {} for item in items: if item.name in unique_items: stored = unique_items[item.name] if item.version > stored.version: unique_items[item.name] = item | for categ in self.getCategories(): latest_plugins = {} allPlugins = self.getPluginsOfCategory(categ) for plugin in allPlugins: name = plugin.name version = plugin.version if name in latest_plugins: if version > latest_plugins[name].version: older_plugin = latest_plugins[name] latest_plugins[name] = plugin self.removeP... | def loadPlugins(self, callback=None): """ Load the candidate plugins that have been identified through a previous call to locatePlugins. |
unique_items[item.name] = item self.latest_mapping[categ] = unique_items.values() | latest_plugins[name] = plugin def getPluginsOfCategoryFromAttic(self,categ): """ Access the older version of plugins for which only the latest version is available through standard methods. """ return self._attic[categ] | def loadPlugins(self, callback=None): """ Load the candidate plugins that have been identified through a previous call to locatePlugins. |
if val is not None: tmp = util.testXMLValue(val) | tmp = util.testXMLValue(val) if tmp is not None: | def __init__(self, elem, namespace=DEFAULT_OWS_NAMESPACE): self.minx = None self.miny = None self.maxx = None self.maxy = None |
node1 = etree.SubElement(node3, util.nspath('And', namespaces['ogc'])) | node1 = etree.SubElement(node0, util.nspath('And', namespaces['ogc'])) | def set(self, parent=False, qtype=None, keywords=[], typenames='csw:Record', propertyname='AnyText', bbox=None): """ |
passman.add_password(None, self.url, self.username, self.password) | passman.add_password(None, url_base, username, password) | def openURL(url_base, data, method='Get', cookies=None, username=None, password=None): ''' function to open urls - wrapper around urllib2.urlopen but with additional checks for OGC service exceptions and url formatting, also handles cookies and simple user password authentication''' url_base.strip() lastchar = url_base... |
opener = build_opener(auth_handler) | opener = urllib2.build_opener(auth_handler) | def openURL(url_base, data, method='Get', cookies=None, username=None, password=None): ''' function to open urls - wrapper around urllib2.urlopen but with additional checks for OGC service exceptions and url formatting, also handles cookies and simple user password authentication''' url_base.strip() lastchar = url_base... |
self._setconstraint(node1, qtype, propertyname, keywords, bbox, cql) | self._setconstraint(node1, None, propertyname, keywords, bbox, cql) | def transaction(self, ttype=None, typename='csw:Record', record=None, propertyname=None, propertyvalue=None, bbox=None, keywords=[], cql=None): """ |
for i in self._exml.findall(util.nspath('TransactionResponse/InsertResult', namespaces['csw'])): | for i in self._exml.findall(util.nspath('InsertResult', namespaces['csw'])): | def _parseinsertresult(self): self.results['inserted'] = [] for i in self._exml.findall(util.nspath('TransactionResponse/InsertResult', namespaces['csw'])): for j in i.findall(util.nspath('BriefRecord', namespaces['csw']) + '/' + util.nspath('identifier', namespaces['dc'])): self.results['inserted'].append(util.testXML... |
val = self._exml.find(util.nspath('TransactionResponse/TransactionSummary', namespaces['csw'])) | val = self._exml.find(util.nspath('TransactionSummary', namespaces['csw'])) | def _parsetransactionsummary(self): val = self._exml.find(util.nspath('TransactionResponse/TransactionSummary', namespaces['csw'])) if val is not None: id = val.attrib.get('requestId') self.results['requestid'] = util.testXMLValue(id, True) ts = val.find(util.nspath('totalInserted', namespaces['csw'])) self.results['in... |
self.contents[subcm.id]=subcm | self.contents[subcm.id]=subcm for subsubelem in subelem.findall('Layer'): subsubcm=ContentMetadata(subsubelem, cm) self.contents[subsubcm.id]=subsubcm | def _buildMetadata(self): ''' set up capabilities metadata objects ''' #serviceIdentification metadata serviceelem=self._capabilities.find('Service') self.identification=ServiceIdentification(serviceelem, self.version) #serviceProvider metadata self.provider=ServiceProvider(serviceelem) #serviceOperations metadata s... |
setattr(self, key.lower(), None) self.id=self.name | setattr(self, key.lower(), 'unnamed_layer') self.id=self.name | def __init__(self, elem, parent=None): self.parent = parent if elem.tag != 'Layer': raise ValueError('%s should be a Layer' % (elem,)) for key in ('Name', 'Title'): val = elem.find(key) if val is not None: setattr(self, key.lower(), val.text.strip()) else: setattr(self, key.lower(), None) self.id=self.name #conform to ... |
for elem in caps.findall('Layer'): cm=ContentMetadata(elem) self.contents[cm.id]=cm for subelem in elem.findall('Layer'): subcm=ContentMetadata(subelem, cm) self.contents[subcm.id]=subcm for subsubelem in subelem.findall('Layer'): subsubcm=ContentMetadata(subsubelem, subcm) self.contents[subsubcm.id]=subsubcm | def gather_layers(parent_elem, parent_metadata): for index, elem in enumerate(parent_elem.findall('Layer')): cm = ContentMetadata(elem, parent=parent_metadata, index=index+1) if cm.id: if cm.id in self.contents: raise KeyError('Content metadata for layer "%s" already exists' % cm.id) self.contents[cm.id] = cm gather_la... | def _buildMetadata(self): ''' set up capabilities metadata objects ''' #serviceIdentification metadata serviceelem=self._capabilities.find('Service') self.identification=ServiceIdentification(serviceelem, self.version) #serviceProvider metadata self.provider=ServiceProvider(serviceelem) #serviceOperations metadata s... |
def __init__(self, elem, parent=None): self.parent = parent | def __init__(self, elem, parent=None, index=0): | def __init__(self, elem, parent=None): self.parent = parent if elem.tag != 'Layer': raise ValueError('%s should be a Layer' % (elem,)) for key in ('Name', 'Title'): val = elem.find(key) if val is not None: setattr(self, key.lower(), val.text.strip()) else: setattr(self, key.lower(), 'unnamed_layer') self.id=self.name #... |
for key in ('Name', 'Title'): val = elem.find(key) if val is not None: setattr(self, key.lower(), val.text.strip()) else: setattr(self, key.lower(), 'unnamed_layer') | self.parent = parent if parent: self.index = "%s.%d" % (parent.index, index) else: self.index = str(index) self.title = elem.find('Title').text.strip() name = elem.find('Name') self.name = name.text.strip() if name is not None else None | def __init__(self, elem, parent=None): self.parent = parent if elem.tag != 'Layer': raise ValueError('%s should be a Layer' % (elem,)) for key in ('Name', 'Title'): val = elem.find(key) if val is not None: setattr(self, key.lower(), val.text.strip()) else: setattr(self, key.lower(), 'unnamed_layer') self.id=self.name #... |
self.keywords = Spdom(val) | self.keywords = Keywords(val) | def __init__(self, md): val = md.find('idinfo/datasetid') self.datasetid = util.testXMLValue(val) |
for key in ('Name', 'Title', 'Attribution'): | for key in ('Name', 'Title'): | def __init__(self, elem, parent=None): self.parent = parent if elem.tag != 'Layer': raise ValueError('%s should be a Layer' % (elem,)) for key in ('Name', 'Title', 'Attribution'): val = elem.find(key) if val is not None: setattr(self, key.lower(), val.text.strip()) else: setattr(self, key.lower(), None) self.id=self.na... |
attribution = elem.find('Attribution') if attribution is not None: self.attribution = dict() title = attribution.find('Title') url = attribution.find('OnlineResource') logo = attribution.find('LogoURL') if title is not None: self.attribution['title'] = title.text if url is not None: self.attribution['url'] = url.attrib... | def __init__(self, elem, parent=None): self.parent = parent if elem.tag != 'Layer': raise ValueError('%s should be a Layer' % (elem,)) for key in ('Name', 'Title', 'Attribution'): val = elem.find(key) if val is not None: setattr(self, key.lower(), val.text.strip()) else: setattr(self, key.lower(), None) self.id=self.na... | |
subsubcm=ContentMetadata(subsubelem, cm) | subsubcm=ContentMetadata(subsubelem, subcm) | def _buildMetadata(self): ''' set up capabilities metadata objects ''' #serviceIdentification metadata serviceelem=self._capabilities.find('Service') self.identification=ServiceIdentification(serviceelem, self.version) #serviceProvider metadata self.provider=ServiceProvider(serviceelem) #serviceOperations metadata s... |
tmp = etree.SubElement(parent, util.nspath('SortBy', namespaces1['ogc'])) tmp2 = etree.SubElement(tmp, util.nspath('SortProperty', namespaces1['ogc'])) | tmp = etree.SubElement(parent, util.nspath('SortBy', namespaces['ogc'])) tmp2 = etree.SubElement(tmp, util.nspath('SortProperty', namespaces['ogc'])) | def setsortby(self, parent, propertyname, order='ASC'): """ |
self.sysTray.setToolTip("printer", "Printer Applet", tooltipText) | self.sysTray.setToolTip("printer", i18n("Printer Applet"), tooltipText) | def set_statusicon_tooltip (self, tooltip=None): if not self.trayicon: return |
self.sysTray.setStatus(KStatusNotifierItem.Active) | def __init__(self, parent = None): QObject.__init__(self) | |
self.sysTray.show() | self.sysTray.setStatus(KStatusNotifierItem.Active) | def notify_new_printer (self, printer, title, text): self.sysTray.show() KNotification.event(title, text, KIcon("konqueror").pixmap(QSize(22,22))) |
applet.sysTray.show() | applet.sysTray.setStatus(KStatusNotifierItem.Active) | def NewPrinter (self, status, name, mfg, mdl, des, cmd): """hal-cups-utils has set up a new printer""" """ print "status: " + str(status) print "name: " + name print "mfg: " + mfg print "mdl: " + mdl print "des: " + des print "cmd: " + cmd """ |
result = KMessageBox.warning(self.mainWindow, markup, i18n("Print Error")) | result = KMessageBox.sorry(self.mainWindow, markup, i18n("Print Error")) | def job_event (self, mon, jobid, eventname, event, jobdata): monitor.Watcher.job_event (self, mon, jobid, eventname, event, jobdata) |
uic.loadUi(APPDIR + '/' + "printer-applet.ui", self.mainWindow) | uic.loadUi(unicode(APPDIR + '/' + "printer-applet.ui"), self.mainWindow) | def __init__(self, parent = None): QObject.__init__(self) |
uic.loadUi(APPDIR + '/' + "printer-applet-printers.ui", self.printersWindow) | uic.loadUi(unicode(APPDIR + '/' + "printer-applet-printers.ui"), self.printersWindow) | def __init__(self, parent = None): QObject.__init__(self) |
tooltipText = i18n("No documents queued") | tooltip = i18n("No documents queued") | def set_statusicon_tooltip (self, tooltip=None): if not self.trayicon: return |
tooltipText = i18np("1 document queued", "%1 documents queued", num_jobs) self.sysTray.setToolTip("printer", i18n("Print Status"), tooltipText) | tooltip = i18np("1 document queued", "%1 documents queued", num_jobs) self.sysTray.setToolTip("printer", i18n("Print Status"), tooltip) | def set_statusicon_tooltip (self, tooltip=None): if not self.trayicon: return |
showCompletedJobsAction = KToggleAction("Show Completed Jobs", self.mainWindow) | showCompletedJobsAction = KToggleAction( i18n( "Show Completed Jobs"), self.mainWindow) | def __init__(self, parent = None): QObject.__init__(self) |
showPrinterStatusAction = KToggleAction("Show Printer Status", self.mainWindow) | showPrinterStatusAction = KToggleAction( i18n( "Show Printer Status"), self.mainWindow) | def __init__(self, parent = None): QObject.__init__(self) |
url='http://plone.org/products/Products.BibfolderFlexibleView', | url='http://pypi.python.org/pypi/Products.BibfolderFlexibleView', | def read(*rnames): return open(os.path.join(os.path.dirname(__file__), *rnames)).read() |
url='http://plone.org/products/BibfolderFlexibleView', | url='http://plone.org/products/Products.BibfolderFlexibleView', | def read(*rnames): return open(os.path.join(os.path.dirname(__file__), *rnames)).read() |
if __name__ == '__main__': | if __name__ == '__main__': import unittest | def testMockCreationAlias(self): self.assertEquals(mock, Mock) |
self.assertEquals(mock, Mock) | warnings.simplefilter("ignore") self.assertTrue(isinstance(Mock(), mock)) | def testMockCreationAlias(self): self.assertEquals(mock, Mock) |
def testLeavesOriginalMethodUntouchedWhenCreatingStubFromRealClass(self): class Person: def get_name(self): return "original name" person = Person() mockPerson = mock(Person) when(mockPerson).get_name().thenReturn("stubbed name") self.assertEquals("stubbed name", mockPerson.get_name()) self.assertEquals("original... | def testStubsWithMultipleChainedExceptions(self): theMock = mock() when(theMock).getStuff().thenRaise(Exception("foo"), Exception("bar")).thenRaise(Exception("foobar")) self.assertRaisesMessage("foo", theMock.getStuff) self.assertRaisesMessage("bar", theMock.getStuff) self.assertRaisesMessage("foobar", theMock.getStuf... | |
def testStubbingOverrides(self): | def testStubbingOverrides2(self): | def testStubbingOverrides(self): mock = Mock() when(mock).foo(any()).thenReturn(1) when(mock).foo("oh").thenReturn(2) self.assertEquals(2, mock.foo("oh")) self.assertEquals(1, mock.foo("xxx")) |
execdir = os.path.dirname(sys.executable) | if sys.executable is None: execdir = os.getcwd() else: execdir = os.path.dirname(sys.executable) | def __init__(self, input, output): self.input = input self.output = output self.docdir = None execdir = os.path.dirname(sys.executable) homedir = os.environ.get('PYTHONHOME') for dir in [os.environ.get('PYTHONDOCS'), homedir and os.path.join(homedir, 'doc'), os.path.join(execdir, 'doc'), '/usr/doc/python-docs-' + split... |
Thread.sleep(500) | Thread.sleep(300) | def run(self, args, javaHome, jythonHome, jythonOpts): ''' creates a start script, executes it and captures the output ''' (starterPath, outfilePath) = self.writeStarter(args, javaHome, jythonHome, jythonOpts) try: process = Runtime.getRuntime().exec(starterPath) stdoutMonitor = StdoutMonitor(process) stderrMonitor = S... |
self.assertOutput(["-J-DmyProperty='myValue'"]) | self.assertOutput(["-J-DmyProperty='myValue'"]) def __test_property_singlequote_space(self): self.assertOutput(["-J-DmyProperty='my Value'"]) | def test_property_singlequote(self): self.assertOutput(["-J-DmyProperty='myValue'"]) # a space inside value does not work in jython.bat |
self.assertOutput(['-J-DmyProperty="myValue"']) | self.assertOutput(['-J-DmyProperty="myValue"']) def __test_property_doublequote_space(self): self.assertOutput(['-J-DmyProperty="my Value"']) | def test_property_doublequote(self): self.assertOutput(['-J-DmyProperty="myValue"']) # a space inside value does not work in jython.bat |
GlobPatternTest) | GlobPatternTest, ArgsSpacesTest, ArgsSpecialCharsTest) | def test_main(): if os._name == 'nt': test_support.run_unittest(VanillaTest, JavaHomeTest, JythonHomeTest, JythonOptsTest, JavaOptsTest, ArgsTest, DoubleDashTest, GlobPatternTest) else: # provide at least one test for the other platforms - happier build bots test_support.run_unittest(DummyTest) |
import os | def getuser(): """Get the username from the environment or password database. First try various environment variables, then the password database. This works on Windows as long as USERNAME is set. """ import os for name in ('LOGNAME', 'USER', 'LNAME', 'USERNAME'): user = os.environ.get(name) if user: return user ... | |
getpass = default_getpass | if os.name == 'java': getpass = jython_getpass else: getpass = default_getpass | def getuser(): """Get the username from the environment or password database. First try various environment variables, then the password database. This works on Windows as long as USERNAME is set. """ import os for name in ('LOGNAME', 'USER', 'LNAME', 'USERNAME'): user = os.environ.get(name) if user: return user ... |
self._test_append('ab') def test_appendplus(self): self._test_append('a+') def _test_append(self, mode): | def test_append(self): self._test_append('ab') | |
return _wrap_close(proc.stdout, proc) | fp = proc.stdout | def popen(cmd, mode='r', bufsize=-1): """popen(command [, mode='r' [, bufsize]]) -> pipe Open a pipe to/from a command returning a file object. """ if not isinstance(cmd, (str, unicode)): raise TypeError('invalid cmd type (%s, expected string)' % type(cmd)) if mode not in ('r', 'w'): raise ValueError("invalid mode %r"... |
return _wrap_close(proc.stdin, proc) | fp = proc.stdin fp = fdopen(fp.fileno(), mode, bufsize) return _wrap_close(fp, proc) | def popen(cmd, mode='r', bufsize=-1): """popen(command [, mode='r' [, bufsize]]) -> pipe Open a pipe to/from a command returning a file object. """ if not isinstance(cmd, (str, unicode)): raise TypeError('invalid cmd type (%s, expected string)' % type(cmd)) if mode not in ('r', 'w'): raise ValueError("invalid mode %r"... |
self._cont_handler.characters(str(String(char, start, len))) | self._cont_handler.characters(String(char, start, len).getBytes('utf-8').tostring().decode('utf-8')) | def characters(self, char, start, len): self._cont_handler.characters(str(String(char, start, len))) |
'''Encodes and decodes using utf-8 after in an environment without the standard library | """Encodes and decodes using utf-8 after in an environment without the standard library | def test_print_sans_lib(self): '''Encodes and decodes using utf-8 after in an environment without the standard library |
Checks that the builtin utf-8 codec is always available: http://bugs.jython.org/issue1458''' | Checks that the builtin utf-8 codec is always available: http://bugs.jython.org/issue1458""" | def test_print_sans_lib(self): '''Encodes and decodes using utf-8 after in an environment without the standard library |
test_support.run_unittest(AccessBuiltinCodecs) | test_support.run_unittest(CodecsTestCase) | def test_main(): test_support.run_unittest(AccessBuiltinCodecs) |
pass | print "Not implemented: read_init_file", filename | def read_init_file(filename=None): pass |
new_history.addToHistory(line) | new_history.addToHistory(line.rstrip()) | def read_history_file(filename="~/.history"): expanded = os.path.expanduser(filename) new_history = reader.getHistory().getClass()() with open(expanded) as f: for line in f: new_history.addToHistory(line) reader.history = new_history |
raise Exception("not implemented") | if history_list: history_list.remove(pos) else: print "Cannot remove history item at position:", pos | def remove_history_item(pos): # TODO possible? raise Exception("not implemented") |
pass | sys._jy_interpreter.startupHook = function def set_pre_input_hook(function=None): print "Not implemented: set_pre_input_hook", function | def set_startup_hook(function=None): # TODO add pass |
def set_pre_input_hook(function=None): pass _completion_function = None | _completer_function = None | def set_pre_input_hook(function=None): # TODO add pass |
_completion_function = function | global _completer_function _completer_function = function | def set_completer(function=None): """set_completer([function]) -> None Set or remove the completer function. The function is called as function(text, state), for state in 0, 1, 2, ..., until it returns a non-string. It should return the next possible completion starting with 'text'.""" _completion_function = function ... |
completion = function(buffer[:cursor], state) | completion = function(delimited, state) | def complete_handler(buffer, cursor, candidates): for state in xrange(100): # TODO arbitrary, what's the number used by gnu readline? completion = None try: completion = function(buffer[:cursor], state) except: pass if completion: candidates.add(completion) else: break return 0 |
return 0 | return start | def complete_handler(buffer, cursor, candidates): for state in xrange(100): # TODO arbitrary, what's the number used by gnu readline? completion = None try: completion = function(buffer[:cursor], state) except: pass if completion: candidates.add(completion) else: break return 0 |
return _completion_function | return _completer_function def _get_delimited(buffer, cursor): start = cursor for i in xrange(cursor-1, -1, -1): if buffer[i] in _completer_delims: break start = i return start, cursor | def get_completer(): return _completion_function |
pass | return _get_delimited(str(reader.cursorBuffer.buffer), reader.cursorBuffer.cursor)[0] | def get_begidx(): # TODO add pass |
pass | return _get_delimited(str(reader.cursorBuffer.buffer), reader.cursorBuffer.cursor)[1] | def get_endidx(): # TODO add pass |
pass | global _completer_delims, _completer_delims_set _completer_delims = string _completer_delims_set = set(string) | def set_completer_delims(string): pass |
pass | return _completer_delims | def get_completer_delims(): pass |
test.test_support.run_unittest(SysTest, ShadowingTest) | test.test_support.run_unittest(SysTest, ShadowingTest, SyspathResourceTest) | def test_main(): test.test_support.run_unittest(SysTest, ShadowingTest) |
MethodHashCodeTestCase) | MethodHashCodeTestCase, SingleMethodInterfaceTestCase) | def test_main(): test_support.run_unittest(FunctionTypeTestCase, MethodHashCodeTestCase) |
warn("Cannot bind tab key to complete. You need to do this in a .jlinebindings.properties file instead", SecurityWarning) | warn("Cannot bind tab key to complete. You need to do this in a .jlinebindings.properties file instead", SecurityWarning, stacklevel=2) | def parse_and_bind(string): if string == "tab: complete": try: keybindings_field = _reader.class.getDeclaredField("keybindings") keybindings_field.setAccessible(True) keybindings = keybindings_field.get(_reader) COMPLETE = _reader.KEYMAP_NAMES.get('COMPLETE') if java.lang.reflect.Array.getShort(keybindings, 9) != COMPL... |
warn("Cannot bind key %s. You need to do this in a .jlinebindings.properties file instead" % (string,), NotImplementedWarning) | warn("Cannot bind key %s. You need to do this in a .jlinebindings.properties file instead" % (string,), NotImplementedWarning, stacklevel=2) | def parse_and_bind(string): if string == "tab: complete": try: keybindings_field = _reader.class.getDeclaredField("keybindings") keybindings_field.setAccessible(True) keybindings = keybindings_field.get(_reader) COMPLETE = _reader.KEYMAP_NAMES.get('COMPLETE') if java.lang.reflect.Array.getShort(keybindings, 9) != COMPL... |
warn("read_init_file: %s" % (filename,), NotImplementedWarning) | warn("read_init_file: %s" % (filename,), NotImplementedWarning, "module", 2) | def read_init_file(filename=None): warn("read_init_file: %s" % (filename,), NotImplementedWarning) |
warn("Cannot remove history item at position: %s" % (pos,), SecurityWarning) | warn("Cannot remove history item at position: %s" % (pos,), SecurityWarning, stacklevel=2) | def remove_history_item(pos): if _history_list: _history_list.remove(pos) else: warn("Cannot remove history item at position: %s" % (pos,), SecurityWarning) |
warn("set_pre_input_hook %s" % (function,), NotImplementedWarning) | warn("set_pre_input_hook %s" % (function,), NotImplementedWarning, stacklevel=2) | def set_pre_input_hook(function=None): warn("set_pre_input_hook %s" % (function,), NotImplementedWarning) |
SerializationTest) | SerializationTest, UnicodeTest) | def test_main(): test_support.run_unittest(InstantiationTest, BeanTest, SysIntegrationTest, IOTest, JavaReservedNamesTest, PyReservedNamesTest, ImportTest, ColorTest, TreePathTest, BigNumberTest, JavaStringTest, JavaDelegationTest, SecurityManagerTest, JavaWrapperCustomizationTest, SerializationTest) |
def handle_request(self): """Handle one request, possibly blocking.""" | def handle_error(self, request, client_address): self.close_request(request) self.server_close() raise teststring = "hello world\n" def receive(sock, n, timeout=20): r, w, x = select.select([sock], [], [], timeout) if sock in r: return sock.recv(n) else: raise RuntimeError, "timed out on %r" % (sock,) def testdgram(... | def serve_forever(self): """Handle one request at a time until doomsday.""" while 1: self.handle_request() |
request, client_address = self.get_request() except socket.error: return if self.verify_request(request, client_address): | os.remove(fn) except os.error: pass testfiles[:] = [] def testloop(proto, servers, hdlrcls, testfunc): for svrcls in servers: addr = pickaddr(proto) if verbose: print "ADDR =", addr print "CLASS =", svrcls t = ServerThread(addr, svrcls, hdlrcls) if verbose: print "server created" t.start() if verbose: print "server ru... | def handle_request(self): """Handle one request, possibly blocking.""" try: request, client_address = self.get_request() except socket.error: return if self.verify_request(request, client_address): try: self.process_request(request, client_address) except: self.handle_error(request, client_address) self.close_request(r... |
self.process_request(request, client_address) except: self.handle_error(request, client_address) self.close_request(request) def verify_request(self, request, client_address): """Verify the request. May be overridden. Return True if we should proceed with this request. """ return True def process_request(self, req... | self.server_address = host, port TCPServer.server_bind(self) break except socket.error, (err, msg): if err != errno.EADDRINUSE: raise print >>sys.__stderr__, \ ' WARNING: failed to listen on port %d, trying another' % port tcpservers = [ForgivingTCPServer, ThreadingTCPServer] if hasattr(os, 'fork') and os.name not in... | def handle_request(self): """Handle one request, possibly blocking.""" try: request, client_address = self.get_request() except socket.error: return if self.verify_request(request, client_address): try: self.process_request(request, client_address) except: self.handle_error(request, client_address) self.close_request(r... |
def check_list(self, control, results, initial): for result in results: | def _arraylist_of(self, xs): """ Converts a python list to a java.util.ArrayList """ a = ArrayList() a.addAll( xs ) return a def check_list(self, control, results, list_type_names, initial, test_name): for result, type_name in zip(results, list_type_names): | def check_list(self, control, results, initial): for result in results: try: len(result) except: print result self.assertEquals(len(control), len(result), "%s is wrong for %s" % (type(result), initial)) for pvalue, jvalue in zip(control, result): self.assertEquals(pvalue, jvalue) |
self.assertEquals(len(control), len(result), "%s is wrong for %s" % (type(result), initial)) for pvalue, jvalue in zip(control, result): self.assertEquals(pvalue, jvalue) def _list_op_test(self, initial_value, op_func, check_value): | self.assertEquals(len(control), len(result), "%s: length for %s does not match that of list" % (test_name, type_name)) for control_value, result_value in zip(control, result): self.assertEquals(control_value, result_value, "%s: values from %s do not match those from list" % (test_name, type_name)) def _list_op_test(se... | def check_list(self, control, results, initial): for result in results: try: len(result) except: print result self.assertEquals(len(control), len(result), "%s is wrong for %s" % (type(result), initial)) for pvalue, jvalue in zip(control, result): self.assertEquals(pvalue, jvalue) |
givens the same result in both cases | gives the same result in both cases | def _list_op_test(self, initial_value, op_func, check_value): """ Tests a list operation |
self.check_list(lists[0], lists[1:], initial_value) if check_value or not isinstance(results[0], list): for r in results[1:]: self.assertEquals(results[0], r) | self.check_list(lists[0], lists[1:], list_type_names[1:], initial_value, test_name) if not isinstance(results[0], list): for r,n in zip(results[1:], list_type_names[1:]): self.assertEquals(results[0], r, '%s: result for list does not match result for java type %s' % (test_name,n) ) | def _list_op_test(self, initial_value, op_func, check_value): """ Tests a list operation |
self.check_list(results[0], results[1:], initial_value) | self.check_list(results[0], results[1:], list_type_names[1:], initial_value, test_name) | def _list_op_test(self, initial_value, op_func, check_value): """ Tests a list operation |
self._list_op_test(initial_value, lambda xs: xs[i], True) | self._list_op_test(initial_value, lambda xs: xs[i], 'get_integer [%d]' % (i,)) def test_get_slice(self): initial_value = range(0, 5) for i in [None] + range(-7, 7): for j in [None] + range(-7, 7): for k in [None] + range(-7, 7): self._list_op_test(initial_value, lambda xs: xs[i:j:k], 'get_slice [%s:%s:%s]' % (i,j,k)) | def test_get_integer(self): initial_value = range(0, 5) |
self._list_op_test(initial_value, make_op_func(i), True) | self._list_op_test(initial_value, make_op_func(i), 'set_integer [%d]' % (i,)) | def _f(xs): xs[index] = 100 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.