rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
if self.is_autoblock: | if self._isAutoblock: | def getUserPage(self, subpage=u''): """ Return a pywikibot.Page object corresponding to this user's main page, or a subpage of it if subpage is set. |
if self.is_autoblock: | if self._isAutoblock: | def getUserTalkPage(self, subpage=u''): """ Return a pywikibot.Page object corresponding to this user's main talk page, or a subpage of it if subpage is set. |
""" Yield tuples describing this user edits. Each tuple is composed of a pywikibot.Page object, | """ Yield tuples describing this user edits with an upper bound of 'limit'. Each tuple is composed of a pywikibot.Page object, | def contributions(self, total=500, namespaces=[]): """ Yield tuples describing this user edits. Each tuple is composed of a pywikibot.Page object, the revision id (int), the edit timestamp (as int in mediawiki's internal format), and the comment (unicode). Pages returned are not guaranteed to be unique. |
yield Page(Link(contrib['title'], self.site, defaultNamespace=contrib['ns'])), \ | yield Page(self.site, contrib['title'], contrib['ns']), \ | def contributions(self, total=500, namespaces=[]): """ Yield tuples describing this user edits. Each tuple is composed of a pywikibot.Page object, the revision id (int), the edit timestamp (as int in mediawiki's internal format), and the comment (unicode). Pages returned are not guaranteed to be unique. |
ISO8601 format), comment (unicode) and a bool (always False...). | ISO8601 format), comment (unicode) and a bool for pageid > 0. | def uploadedImages(self, total=10): """ Yield tuples describing files uploaded by this user. Each tuple is composed of a pywikibot.Page, the timestamp (str in ISO8601 format), comment (unicode) and a bool (always False...). Pages returned are not guaranteed to be unique. |
yield item.title(), str(item.timestamp()), item.comment(), False | yield ImagePage(self.site, item.title().title()), \ unicode(item.timestamp()), item.comment(), item.pageid() > 0 | def uploadedImages(self, total=10): """ Yield tuples describing files uploaded by this user. Each tuple is composed of a pywikibot.Page, the timestamp (str in ISO8601 format), comment (unicode) and a bool (always False...). Pages returned are not guaranteed to be unique. |
@param content: if True, load the current content of each iterated page (default False); note that this means the content of the image description page, not the image itself """ imtitle = page.title(withSection=False).encode(self.encoding()) | def pageimages(self, page, step=None, total=None): """Iterate images used (not just linked) on the page.""" | |
def LinksearchPageGenerator(link, limit=None, site=None): | def LinksearchPageGenerator(link, namespaces=None, step=None, total=None, site=None): | def LinksearchPageGenerator(link, limit=None, site=None): """Yields all pages that include a specified link, according to [[Special:Linksearch]]. """ if site is None: site = pywikibot.Site() for page in site.linksearch(link, limit=limit): yield page |
for page in site.linksearch(link, limit=limit): | for page in site.exturlusage(link, namespaces=namespaces, step=step, total=total, content=False): | def LinksearchPageGenerator(link, limit=None, site=None): """Yields all pages that include a specified link, according to [[Special:Linksearch]]. """ if site is None: site = pywikibot.Site() for page in site.linksearch(link, limit=limit): yield page |
pywikibot.log('showHelp:', exc_info=True) | def showHelp(name=""): # argument, if given, is ignored modname = calledModuleName() if not modname: try: modname = sys.modules['__main__'].main.__module__ except NameError: modname = "no_module" globalHelp = u'''\ | |
params = self.http_params() | paramstring = self.http_params() | def submit(self): """Submit a query and parse the response. |
write = action in ( "edit", "move", "rollback", "delete", "undelete", "protect", "block", "unblock" ) self.site.throttle(write=write) | self.site.throttle(write=self.write) | def submit(self): """Submit a query and parse the response. |
body=params) | body=paramstring) | def submit(self): """Submit a query and parse the response. |
logger.debug(u"Caught 504 error") | pywikibot.output(u"Caught 504 error", level=pywikibot.DEBUG) | def submit(self): """Submit a query and parse the response. |
pywikibot.output(u"%s, %s" % (uri, params), | pywikibot.output(u"%s, %s" % (uri, paramstring), | def submit(self): """Submit a query and parse the response. |
logger.debug(u"API response received:\n" + rawdata) | pywikibot.output(u"API response received:\n" + rawdata, level=pywikibot.DEBUG) | def submit(self): """Submit a query and parse the response. |
% self.site, level=pywikibot.WARNING) logger.debug(rawdata) | % self.site, level=pywikibot.WARNING) pywikibot.output(rawdata, level=pywikibot.DEBUG) | def submit(self): """Submit a query and parse the response. |
logger.debug(u"%s: Set query_limit to %i." % (self.__class__.__name__, self.query_limit)) | pywikibot.output(u"%s: Set query_limit to %i." % (self.__class__.__name__, self.query_limit), level=pywikibot.DEBUG) | def update_limit(self): """Set query_limit for self.module based on api response""" |
logger.debug( | pywikibot.output( | def __iter__(self): """Submit request and iterate the response based on self.resultkey |
% self.__class__.__name__) | % self.__class__.__name__, level=pywikibot.DEBUG) | def __iter__(self): """Submit request and iterate the response based on self.resultkey |
% (self.__class__.__name__, self.resultkey)) logger.debug(unicode(self.data)) | % (self.__class__.__name__, self.resultkey), level=pywikibot.DEBUG) pywikibot.output(unicode(self.data), level=pywikibot.DEBUG) | def __iter__(self): """Submit request and iterate the response based on self.resultkey |
logger.debug(u"%s received %s; limit=%s" % (self.__class__.__name__, resultdata.keys(), self.limit)) | pywikibot.output(u"%s received %s; limit=%s" % (self.__class__.__name__, resultdata.keys(), self.limit), level=pywikibot.DEBUG) | def __iter__(self): """Submit request and iterate the response based on self.resultkey |
logger.debug(u"%s received %s; limit=%s" % (self.__class__.__name__, resultdata, self.limit)) | pywikibot.output(u"%s received %s; limit=%s" % (self.__class__.__name__, resultdata, self.limit), level=pywikibot.DEBUG) | def __iter__(self): """Submit request and iterate the response based on self.resultkey |
pywikibot.output(u"NOTE: Ignoring link from page %s in namespace %i to page %s in namespace %i." % (self.linkingPage, self.linkingPage.namespace(), linkedPage, linkedPage.namespace())) | pywikibot.output(u"NOTE: Ignoring link from page %s in namespace %i to page %s in namespace %i." % (linkingPage, linkingPage.namespace(), linkedPage, linkedPage.namespace())) | def namespaceMismatch(self, linkingPage, linkedPage, counter): """ Checks whether or not the given page has another namespace than the origin page. |
pywikibot.output(u"NOTE: Ignoring link from page %s in namespace %i to page %s in namespace %i because page %s in the correct namespace has already been found." % (self.linkingPage, self.linkingnPage.namespace(), linkedPage, linkedPage.namespace(), preferredPage)) | pywikibot.output(u"NOTE: Ignoring link from page %s in namespace %i to page %s in namespace %i because page %s in the correct namespace has already been found." % (linkingPage, linkingPage.namespace(), linkedPage, linkedPage.namespace(), preferredPage)) | def namespaceMismatch(self, linkingPage, linkedPage, counter): """ Checks whether or not the given page has another namespace than the origin page. |
wikipedia.output(u'BUG: Tried to create duplicate edge from %s to %s' % (refPage.aslink(), page.aslink())) | pywikibot.output( u'BUG: Tried to create duplicate edge from %s to %s' % (refPage.title(asLink=True), page.title(asLink=True))) | def addDirectedEdge(self, page, refPage): # if page was given as a hint, referrers would be [None] if refPage is not None: sourceLabel = self.getLabel(refPage) targetLabel = self.getLabel(page) edge = pydot.Edge(sourceLabel, targetLabel) oppositeEdge = self.graph.get_edge(targetLabel, sourceLabel) if oppositeEdge: #opp... |
validOptions = set(Bot.availableOptions) | validOptions = set(self.availableOptions) | def setOptions(self, **kwargs): """ Sets the instance options """ # contains the options overriden from defaults self.options = {} |
return self.options.get(option, Bot.availableOptions[option]) | return self.options.get(option, self.availableOptions[option]) | def getOption(self, option): """ Get the current value of an option. @param option: key defined in Bot.availableOptions """ try: return self.options.get(option, Bot.availableOptions[option]) except KeyError: raise pywikibot.Error(u'%s is not a valid bot option.' % option) |
if wait > config.noisysleep or pywikibot.verbose: | if wait > config.noisysleep or self.verbosedelay: | def __call__(self, requestsize=1, write=False): """Block the calling program if the throttle time has not expired. |
if self.api_number is None: self.api_number = 'max' | def __init__(self, xmlFilename=None, namespaces=[], offset=-1, use_move_log=False, use_api=False, start=None, until=None, number=None): self.site = pywikibot.getSite() | |
if not forceLogin and (site.logged_in(sysop) and site.user()) != None: pywikibot.output(u'Already logged in on %s' % site) | if site.logged_in(sysop) \ and site.user() == site.username(sysop): pywikibot.output(u"Login successful on %(site)s." % locals()) | def main(*args): password = None sysop = False logall = False forceLogin = False for arg in pywikibot.handleArgs(*args): if arg.startswith("-pass"): if len(arg) == 5: password = pywikibot.input(u'Password for all accounts:', password = True) else: password = arg[6:] elif arg == "-sysop": sysop = True elif arg == "-all"... |
loginMan = LoginManager(password, sysop=sysop, site=site) loginMan.login() | pywikibot.output(u"Not logged in on %(site)s." % locals()) | def main(*args): password = None sysop = False logall = False forceLogin = False for arg in pywikibot.handleArgs(*args): if arg.startswith("-pass"): if len(arg) == 5: password = pywikibot.input(u'Password for all accounts:', password = True) else: password = arg[6:] elif arg == "-sysop": sysop = True elif arg == "-all"... |
loginMan = pywikibot.data.api.LoginManager(password, sysop=sysop) loginMan.login() | site = pywikibot.Site(sysop=sysop) if site.logged_in(sysop) and site.user() == site.username(sysop): pywikibot.output(u"Login successful on %(site)s." % locals()) else: pywikibot.output(u"Not logged in on %(site)s." % locals()) | def main(*args): password = None sysop = False logall = False forceLogin = False for arg in pywikibot.handleArgs(*args): if arg.startswith("-pass"): if len(arg) == 5: password = pywikibot.input(u'Password for all accounts:', password = True) else: password = arg[6:] elif arg == "-sysop": sysop = True elif arg == "-all"... |
if rmsite != page.site: rmPage = old[rmsite] new[rmsite] = old[rmsite] pywikibot.output(u"WARNING: %s is either deleted or has a mismatching disambiguation state." % rmPage) | if rmsite == page.site: continue rmPage = old[rmsite] if not globalvar.cleanup or \ rmPage.title(asLink=True, forceInterwiki=True) not in globalvar.remove: new[rmsite] = rmPage pywikibot.output( u"WARNING: %s is either deleted or has a mismatching disambiguation state." % rmPage) | def replaceLinks(self, page, newPages, bot): """ Returns True if saving was successful. """ if globalvar.localonly: # In this case only continue on the Page we started with if page != self.originPage: raise SaveError(u'-localonly and page != originPage') |
result = '{| border="1"\n' | result = '{| class="wikitable"\n' | def getVersionHistoryTable(self, forceReload=False, reverseOrder=False, step=None, total=None): """Return the version history as a wiki table.""" |
if root.level == 30: | if not root.level: | def output(text, decoder=None, newline=True, toStdout=False, level=INFO): """Output a message to the user via the userinterface. Works like print, but uses the encoding used by the user's console (console_encoding in the configuration file) instead of ASCII. If decoder is None, text should be a unicode string. Otherwi... |
logger.debug(u"handleArgs() completed.") | pywikibot.output(u"handleArgs() completed.", level=pywikibot.DEBUG) | def handleArgs(*args): """Handle standard command line arguments, return the rest as a list. Takes the commandline arguments, converts them to Unicode, processes all global parameters such as -lang or -log. Returns a list of all arguments that are not global. This makes sure that global arguments are applied first, re... |
step=step, total=total) if not withTemplateInclusion: return self.pagebacklinks(page, followRedirects, namespaces=namespaces, | filterRedirects=filterRedirects, step=step, total=total) if not withTemplateInclusion: return self.pagebacklinks(page, followRedirects=followRedirects, filterRedirects=filterRedirects, namespaces=namespaces, | def pagereferences(self, page, followRedirects=False, filterRedirects=None, withTemplateInclusion=True, onlyTemplateInclusion=False, namespaces=None, step=None, total=None): """Convenience method combining pagebacklinks and page_embeddedin.""" |
imtitle = page.title(withSection=False).encode(self.encoding()) | @param content: if True, load the current content of each iterated page (default False); note that this means the content of the image description page, not the image itself """ imtitle = page.title(withSection=False).encode(self.encoding()) | def pageimages(self, page, step=None, total=None): """Iterate images used (not just linked) on the page.""" |
newtext = pywikibot.replaceCategoryInPlace(oldtext, oldCat, newCat) | if newcat in article.categories(): newtext = pywikibot.replaceCategoryInPlace(oldtext, oldCat, None) else: newtext = pywikibot.replaceCategoryInPlace(oldtext, oldCat, newCat) | def change_category(self, article, oldCat, newCat, comment=None, sortKey=None): """Given an article in category oldCat, moves it to category newCat. Moves subcategories of oldCat as well. oldCat and newCat should be Category objects. If newCat is None, the category will be removed. |
default = set(self._site.family.disambig('_default')) | default = set(self.site.family.disambig('_default')) | def isDisambig(self, get_Index=True): """Return True if this is a disambiguation page, False otherwise. |
disambigs = set(link.title(withNamespace=False) | disambigs = set(link | def isDisambig(self, get_Index=True): """Return True if this is a disambiguation page, False otherwise. |
return self.site.loadrevisions(self, getText=True, rvdir=reverseOrder, step=step, total=total) | self.site.loadrevisions(self, getText=True, rvdir=reverseOrder, step=step, total=total) return [( self._revisions[rev].revid, self._revisions[rev].timestamp, self._revisions[rev].user, self._revisions[rev].text ) for rev in sorted(self._revisions, reverse=not reverseOrder) ] | def fullVersionHistory(self, reverseOrder=False, step=None, total=None): """Iterate previous versions including wikitext. |
named = {} | def templatesWithParams(self): """Iterate templates used on this Page. | |
int(key) | intkeys[int(key)] = args[key] | def templatesWithParams(self): """Iterate templates used on this Page. |
positional.append(args[key]) | for k in intkeys: if k < 1 or k >= i: named[str(k)] = intkeys[k] break | def templatesWithParams(self): """Iterate templates used on this Page. |
if newcat in article.categories(): newtext = pywikibot.replaceCategoryInPlace(oldtext, oldCat, None) | if newCat in article.categories(): newtext = pywikibot.replaceCategoryInPlace(oldtext, oldCat, None, site=self.site) | def change_category(self, article, oldCat, newCat, comment=None, sortKey=None): """Given an article in category oldCat, moves it to category newCat. Moves subcategories of oldCat as well. oldCat and newCat should be Category objects. If newCat is None, the category will be removed. |
newtext = pywikibot.replaceCategoryInPlace(oldtext, oldCat, newCat) | newtext = pywikibot.replaceCategoryInPlace(oldtext, oldCat, newCat, site=self.site) | def change_category(self, article, oldCat, newCat, comment=None, sortKey=None): """Given an article in category oldCat, moves it to category newCat. Moves subcategories of oldCat as well. oldCat and newCat should be Category objects. If newCat is None, the category will be removed. |
pywikibot.output(u"%s has a backlink from %s."%(page,linkingPage)) | try: pywikibot.output(u"%s has a backlink from %s." % (page, linkingPage)) except UnicodeDecodeError: pywikibot.output(u"Found a backlink for a page.") | def addIfNew(self, page, counter, linkingPage): """ Adds the pagelink given to the todo list, but only if we didn't know it before. If it is added, update the counter accordingly. |
pywikibot.output(u"\03{lightpurple}Updating links on page %s.\03{default}" % page) | def replaceLinks(self, page, newPages, bot): """ Returns True if saving was successful. """ if globalvar.localonly: # In this case only continue on the Page we started with if page != self.originPage: raise SaveError(u'-localonly and page != originPage') | |
pywikibot.output(u'No changes needed' ) | if not globalvar.quiet: pywikibot.output(u'No changes needed on page %s' % page.title(asLink=True, forceInterwiki=True)) | def replaceLinks(self, page, newPages, bot): """ Returns True if saving was successful. """ if globalvar.localonly: # In this case only continue on the Page we started with if page != self.originPage: raise SaveError(u'-localonly and page != originPage') |
both = [[l.split(',')[0], l.split(',')[1]] for l in left] + \ [[r.split(',')[0], r.split(',')[1]] for r in right] for uid, height in both: _d[uid.replace('uid_', '')] = height | if right or left: for uid, height in [right] + [left]: _d[uid.replace('uid_', '')] = height | def setBlockHeights(self, uids=[], left=[], right=[]): """ usage: needs a list of uid, height pairs... if the uid of a block is missing, the height attribute of this block will be deleted """ # create a dict _d = {} real_uids = [u.replace('uid_', '') for u in uids] both = [[l.split(',')[0], l.split(',')[1]] for l in le... |
return None, (0, 0) | return dict(width = 0, height = 0) | def get_image_attributes(self, content): """Returns a dict with image attributes, like width and height. currently we are only interesst in height |
img = content.getField('image').getRaw(content) | field = content.getField('image') if field: img = field.getRaw(content) else: return dict(width = 0, height = 0) | def get_image_attributes(self, content): """Returns a dict with image attributes, like width and height. currently we are only interesst in height |
for kernel in ['linux-2.6.18', 'linux-2.6.26']: run_command(['python', 'scons.py', kernel]) | kernels = ['liblinux2.6.18.so', 'liblinux2.6.26.so'] run_command(['python', 'scons.py'] + kernels) | def build_nsc(): # XXX: Detect gcc major version(s) available to build supported stacks for kernel in ['linux-2.6.18', 'linux-2.6.26']: run_command(['python', 'scons.py', kernel]) |
self.nbook.set_border_width(7) | self.nbook.set_border_width(9) | def __init__(self, app): # Dialog initialization flags = gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT buttons = (gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE) gtk.Dialog.__init__(self, "Preferences", app.gui.win, flags, buttons) self.app = app self.set_default_size(600, 400) self.set_position(gtk.WIN_POS_CENTER_ON_PARENT) ... |
for code,w in sorted(categs[cg], cmp=lambda x,y: cmp(x[0],y[0])): | for code,w in sorted(categs[cg], key=lambda x: x[0]): | def __init__(self, app): gtk.ScrolledWindow.__init__(self) self.app = app self.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS) container = gtk.VBox() container.set_spacing(21) container.set_border_width(15) categs = {} for code,lv,cv in self.app.prefm.iter_prefs_data(): cg = code.split('_')[0] w = self.build_widget(cod... |
curr_tab = self.app.gui.get_current_tab() | def save(self): """Save the project into a file.""" tabs_infos = self.app.gui.get_tabs_infos() curr_tab = self.app.gui.get_current_tab() for urim in self.listfiles: for opt,val in self.get_status(urim, tabs_infos).iteritems(): self.set_opt(urim, opt, val) cf = curr_tab.get_file_infos()[1] if cf is not None: urim = iofi... | |
cf = curr_tab.get_file_infos()[1] if cf is not None: urim = iofiles.URImanager(cf.uri, self.rootdir) self.cparser.set('General', 'lastDocument', self.get_id(urim)) | curr_tab = self.app.gui.get_current_tab() if curr_tab is not None: cf = curr_tab.get_file_infos()[1] if cf is not None: urim = iofiles.URImanager(cf.uri, self.rootdir) self.cparser.set('General', 'lastDocument', self.get_id(urim)) | def save(self): """Save the project into a file.""" tabs_infos = self.app.gui.get_tabs_infos() curr_tab = self.app.gui.get_current_tab() for urim in self.listfiles: for opt,val in self.get_status(urim, tabs_infos).iteritems(): self.set_opt(urim, opt, val) cf = curr_tab.get_file_infos()[1] if cf is not None: urim = iofi... |
val = qi.get_attribute_as_string(*arg) if val == 'TRUE': self.infos[a] = True elif val == 'FALSE': self.infos[a] = False | if not arg: self.infos[a] = None | def update_infos(self): """Update file infos.""" try: qi = self.gfile.query_info("standard::*,access::*") except StandardError: for a in self.infos: self.infos[a] = None self.mime = None return False attrs = qi.list_attributes("standard") + qi.list_attributes("access") for a in self.infos: fn = "get_" + a.replace('-', ... |
self.infos[a] = val | val = qi.get_attribute_as_string(*arg) if val == 'TRUE': self.infos[a] = True elif val == 'FALSE': self.infos[a] = False else: self.infos[a] = val | def update_infos(self): """Update file infos.""" try: qi = self.gfile.query_info("standard::*,access::*") except StandardError: for a in self.infos: self.infos[a] = None self.mime = None return False attrs = qi.list_attributes("standard") + qi.list_attributes("access") for a in self.infos: fn = "get_" + a.replace('-', ... |
[], None, | common_functions.RECENT_TYPES, 'Recent', | def usage( self ): # # Usage # print """\ |
return valueNames | return value_names | def normalizeValueNames( self, classification, value_names ): if self.func_normalizeValueNames == None: return valueNames else: return self.func_normalizeValueNames(classification, value_names) |
def parse_stats(run_paths, types, run_as_key = False): | def parse_stats(run_paths, types, dataset, value_names, run_as_key = False): | def parse_stats(run_paths, types, run_as_key = False): # make sure the datalib files exist for path in run_paths: __get_stats( path ) # parse the stats for all the runs tables = datalib.parse_all( map(lambda x: path_stats( x ), run_paths), types, datalib.REQUIRED, keycolname = 'step' ) if run_as_key: # modify the map... |
return int(header[start:]) | return int(header[start:]) + 1 | def __num_input_neurons(header): start = header.rfind('-') + 1 return int(header[start:]) |
if x_data_type not in common_complexity.COMPLEXITY_TYPES and | if x_data_type not in common_complexity.COMPLEXITY_TYPES and \ | def parse_args(): try: opts, args = getopt.getopt(sys.argv[1:], 'dpbx:y:', ['driven', 'passive', 'both', 'x_data_type', 'y_data_type']) except getopt.GetoptError, err: print str(err) usage() exit(2) if len(args) < 1: usage() print 'using defaults:', '--'+DEFAULT_GROUP, '-x', DEFAULT_X_DATA_TYPE, '-y', DEFAULT_Y_DATA_T... |
if y_data_type not in common_complexity.COMPLEXITY_TYPES and | if y_data_type not in common_complexity.COMPLEXITY_TYPES and \ | def parse_args(): try: opts, args = getopt.getopt(sys.argv[1:], 'dpbx:y:', ['driven', 'passive', 'both', 'x_data_type', 'y_data_type']) except getopt.GetoptError, err: print str(err) usage() exit(2) if len(args) < 1: usage() print 'using defaults:', '--'+DEFAULT_GROUP, '-x', DEFAULT_X_DATA_TYPE, '-y', DEFAULT_Y_DATA_T... |
hf_table = datalib.parse(y_path)['HF'] | hf_table = datalib.parse(y_path)['hf'] | def retrieve_data(run_dir, x_data_type, y_data_type): recent_dir = os.path.join(run_dir, 'brain/Recent') x_filename = get_filename(x_data_type) x_path = os.path.join(recent_dir, x_filename) y_filename = get_filename(y_data_type) y_path = os.path.join(recent_dir, y_filename) if not (os.path.exists(x_path) and os.path.ex... |
hf_table = datalib.parse(x_path)['HF'] | hf_table = datalib.parse(x_path)['hf'] | def retrieve_data(run_dir, x_data_type, y_data_type): recent_dir = os.path.join(run_dir, 'brain/Recent') x_filename = get_filename(x_data_type) x_path = os.path.join(recent_dir, x_filename) y_filename = get_filename(y_data_type) y_path = os.path.join(recent_dir, y_filename) if not (os.path.exists(x_path) and os.path.ex... |
if not linetype: | if linetype == None: | def createStyleGroup(self, name = None, linetype = None, linewidth = StyleGroup.THIN, make_context = True): if not linetype: linetype = self.linetypes.pop(0) else: self.linetypes.remove(linetype) |
create_date,unicode_sanitize(title), date,unicode_sanitize(portal_name),url | unicode_sanitize(create_date),unicode_sanitize(title), unicode_sanitize(date),unicode_sanitize(portal_name),unicode_sanitize(url) | def getCitationInfo(self): """ Gets the citation information """ |
create_date,date,unicode_sanitize(portal_name), url | unicode_sanitize(create_date),unicode_sanitize(date),unicode_sanitize(portal_name), unicode_sanitize(url) | def getCitationInfo(self): """ Gets the citation information """ |
create_op = "mkdir -p " + tcm_loop_root + sas_target_address + "/tpgt_" + sas_target_tpgt + "/nexus/" + sas_initiator_address | tpgt_dir = tcm_loop_root + sas_target_address + "/tpgt_" + sas_target_tpgt create_op = "mkdir -p " + tpgt_dir ret = os.system(create_op) if ret: print "Unable to create virtual Target Port: " + create_op sys.exit(1) nexus_dir = tpgt_dir + "/nexus" if os.path.isfile(nexus_dir): create_op = "echo " + sas_initiator_add... | def tcm_loop_create_nexus(option, opt_str, value, parser): sas_target_address = tcm_generate_naa_sas_address(); sas_target_tpgt = str(value) sas_initiator_address = tcm_generate_naa_sas_address(); create_op = "mkdir -p " + tcm_loop_root + sas_target_address + "/tpgt_" + sas_target_tpgt + "/nexus/" + sas_initiator_addr... |
nexus_dir = tcm_loop_root + sas_target_address + "/tpgt_" + sas_target_tpgt + "/nexus/" | nexus_dir = tcm_loop_root + sas_target_address + "/tpgt_" + sas_target_tpgt + "/nexus" if os.path.isfile(nexus_dir): delete_op = "echo NULL > " + nexus_dir ret = os.system(delete_op) if ret: print "Unable to delete virtual SCSI I_T Nexus between TCM and Linux/SCSI HBA" sys.exit(1) print "Successfully deleted virtual... | def tcm_loop_delete_nexus(option, opt_str, value, parser): sas_target_address = str(value[0]) sas_target_tpgt = str(value[1]) sas_initiator_address = ""; nexus_dir = tcm_loop_root + sas_target_address + "/tpgt_" + sas_target_tpgt + "/nexus/" for nexus in os.listdir(nexus_dir): delete_op = "rmdir " + nexus_dir + "/" + ... |
port_link = lun_dir + "/" + port | port_link_tmp = lun_dir + "/" + port if not os.path.islink(port_link_tmp): continue port_link = port_link_tmp break if port_link == "": print "Active TCM_Loop port link does not exist!" sys.exit(1) | def tcm_loop_dellun(option, opt_str, value, parser): sas_target_address = str(value[0]) sas_target_tpgt = str(value[1]) sas_target_lun = str(value[2]) port_link = "" lun_dir = tcm_loop_root + sas_target_address + "/tpgt_" + sas_target_tpgt + "/lun/lun_" + sas_target_lun for port in os.listdir(lun_dir): port_link = lu... |
self.f = open(tmpname, 'w+') | ffd = os.open(tmpname, os.O_CREAT|os.O_RDWR|os.O_EXCL) _close_on_exec(ffd, True) self.f = os.fdopen(ffd, 'w+') | def start(self): assert(self.lock.owned) t = self.t tmpname = self.tmpname if not self.shouldbuildfunc(t): # target doesn't need to be built; skip the whole task return self._after2(0) if (os.path.exists(t) and not state.is_generated(t) and not os.path.exists('%s.do' % t)): # an existing source file that is not marked ... |
t = os.path.normpath(os.path.join(os.getcwd(), t)) | global _cwd if not _cwd: _cwd = os.getcwd() t = os.path.normpath(os.path.join(_cwd, t)) | def relpath(t, base): t = os.path.normpath(os.path.join(os.getcwd(), t)) tparts = t.split('/') bparts = base.split('/') for tp,bp in zip(tparts,bparts): if tp != bp: break tparts.pop(0) bparts.pop(0) while bparts: tparts.insert(0, '..') bparts.pop(0) return '/'.join(tparts) |
debug2('sname: (%r) %r -> %r\n' % (os.getcwd(), t, tnew)) | if vars.DEBUG >= 2: debug2('sname: (%r) %r -> %r\n' % (os.getcwd(), t, tnew)) | def _sname(typ, t): # FIXME: t.replace(...) is non-reversible and non-unique here! tnew = relpath(t, vars.BASE) v = vars.BASE + ('/.redo/%s^%s' % (typ, tnew.replace('/', '^'))) debug2('sname: (%r) %r -> %r\n' % (os.getcwd(), t, tnew)) return v |
if vars.DEBUG >= 1: debug('%s?%s\n' % (depth, f.name)) | if vars.DEBUG >= 1: debug('%s?%s\n' % (depth, _nice(f.name))) | def dirty_deps(f, depth, max_changed): if vars.DEBUG >= 1: debug('%s?%s\n' % (depth, f.name)) if f.failed_runid: debug('%s-- DIRTY (failed last time)\n' % depth) return True if f.changed_runid == None: debug('%s-- DIRTY (never built)\n' % depth) return True if f.changed_runid > max_changed: debug('%s-- DIRTY (built)\n... |
debug('%s?%s\n' % (depth, f.name)) | if vars.DEBUG >= 1: debug('%s?%s\n' % (depth, f.name)) | def dirty_deps(f, depth, max_changed): debug('%s?%s\n' % (depth, f.name)) if f.changed_runid == None: debug('%s-- DIRTY (never built)\n' % depth) return True if f.changed_runid > max_changed: debug('%s-- DIRTY (built)\n' % depth) return True # has been built more recently than parent if f.is_checked(): debug('%s-- CL... |
debug('%s-- CLEAN (checked)\n' % depth) | if vars.DEBUG >= 1: debug('%s-- CLEAN (checked)\n' % depth) | def dirty_deps(f, depth, max_changed): debug('%s?%s\n' % (depth, f.name)) if f.changed_runid == None: debug('%s-- DIRTY (never built)\n' % depth) return True if f.changed_runid > max_changed: debug('%s-- DIRTY (built)\n' % depth) return True # has been built more recently than parent if f.is_checked(): debug('%s-- CL... |
raise BuildError('%s: exit code %d' % (t,rv)) | raise BuildError('%s: exit code %d' % (_nice(t),rv)) | def _build(t): if (os.path.exists(t) and not state.is_generated(t) and not os.path.exists('%s.do' % t)): # an existing source file that is not marked as a generated file. # This step is mentioned by djb in his notes. It turns out to be # important to prevent infinite recursion. For example, a rule # called default.c.... |
if os.path.exists(t) and not os.path.exists(sname('gen', t)): | if (os.path.exists(t) and not os.path.exists(sname('gen', t)) and not os.path.exists('%s.do' % t)): | def _build(t): if os.path.exists(t) and not os.path.exists(sname('gen', t)): # an existing source file that is not marked as a generated file. # This step is mentioned by djb in his notes. It turns out to be # important to prevent infinite recursion. For example, a rule # called default.o.do could be used to try to p... |
_fds = os.pipe() | _fds1 = os.pipe() _fds = (fcntl.fcntl(_fds1[0], fcntl.F_DUPFD, 100), fcntl.fcntl(_fds1[1], fcntl.F_DUPFD, 101)) os.close(_fds1[0]) os.close(_fds1[1]) | def setup(maxjobs): global _fds, _toplevel if _fds: return # already set up _debug('setup(%d)\n' % maxjobs) flags = ' ' + os.getenv('MAKEFLAGS', '') + ' ' FIND = ' --jobserver-fds=' ofs = flags.find(FIND) if ofs >= 0: s = flags[ofs+len(FIND):] (arg,junk) = s.split(' ', 1) (a,b) = arg.split(',', 1) a = atoi.atoi(a) b =... |
b = os.read(_fds[0], 1) except OSError, e: if e.errno == errno.EAGAIN: return '' else: raise | try: b = os.read(_fds[0], 1) except OSError, e: if e.errno == errno.EAGAIN: return '' else: raise finally: fcntl.fcntl(_fds[0], fcntl.F_SETFL, 0) | def _try_read(fd, n): fcntl.fcntl(_fds[0], fcntl.F_SETFL, os.O_NONBLOCK) try: b = os.read(_fds[0], 1) # FIXME try: block except OSError, e: if e.errno == errno.EAGAIN: return '' else: raise return b and b or None |
mkdirp('%s/.redo' % base) | def build(t): unlink(sname('dep', t)) open(sname('dep', t), 'w').close() dofile = find_do_file(t) if not dofile: if os.path.exists(t): # an existing source file stamp(t) return # success else: raise Exception('no rule to make %r' % t) unlink(t) tmpname = '%s.redo.tmp' % t unlink(tmpname) f = open(tmpname, 'w+') argv ... | |
os.rename(self.tmpname1, t) | try: os.rename(self.tmpname1, t) except OSError, e: if e.errno == errno.ENOENT: unlink(t) else: raise | def _after1(self, t, rv): f = self.f before_t = self.before_t after_t = _try_stat(t) st1 = os.fstat(f.fileno()) st2 = _try_stat(self.tmpname2) if after_t != before_t and not stat.S_ISDIR(after_t.st_mode): err('%s modified %s directly!\n' % (self.argv[2], t)) err('...you should update $3 (a temp file) or stdout, not $1.... |
unlink(t) | def _build(t): if (os.path.exists(t) and not state.is_generated(t) and not os.path.exists('%s.do' % t)): # an existing source file that is not marked as a generated file. # This step is mentioned by djb in his notes. It turns out to be # important to prevent infinite recursion. For example, a rule # called default.c.... | |
else: l.unlock() | def done(t, rv): if rv == 199: locked.append(t) elif rv: err('%s: exit code was %r\n' % (t, rv)) retcode[0] = 1 | |
if vars.DEBUG_LOCKS and len(locked) >= 1: | if vars.DEBUG_LOCKS: | def done(t, rv): if rv: retcode[0] = 1 |
for mode,source_id in db().execute(q, [self.id]): | for mode,source_id in db().execute(q, [self.id]).fetchall(): | def deps(self): q = "select mode, source from Deps where target=?" for mode,source_id in db().execute(q, [self.id]): assert(mode in ('c', 'm')) name = File(id=source_id).name yield mode,name |
raise Exception('on exit: expected %d tokens; found only %d' % (_toplevel-1, len(b))) | raise Exception('on exit: expected %d tokens; found only %r' % (_toplevel-1, len(bb))) | def wait_all(): _debug("wait_all\n") while running(): _debug("wait_all: wait()\n") wait(want_token=0) _debug("wait_all: empty list\n") if _toplevel: bb = '' while 1: b = _try_read(_fds[0], 8192) bb += b if not b: break if len(bb) != _toplevel-1: raise Exception('on exit: expected %d tokens; found only %d' % (_toplevel-... |
f = open(path) | f = self.open(path) | def checkversion(self): path = os.path.join(self.location, 'version') try: f = open(path) version = f.read() f.close() if version != suds.__version__: raise Exception() except: self.clear() f = open(path, 'w') f.write(suds.__version__) f.close() |
f = open(path, 'w') | f = self.open(path, 'w') | def checkversion(self): path = os.path.join(self.location, 'version') try: f = open(path) version = f.read() f.close() if version != suds.__version__: raise Exception() except: self.clear() f = open(path, 'w') f.write(suds.__version__) f.close() |
the sax parsed DOM tree for the reply. | the sax parsed DOM tree for the reply before it is unmarshalled. | def parsed(self, context): """ Suds has sax parsed the received reply. Provides the plugin with the opportunity to inspect/modify the sax parsed DOM tree for the reply. @param context: The reply context. The I{reply} is DOM tree. @type context: L{MessageContext} """ pass |
Suds has sax parsed the received reply. Provides the plugin with the opportunity to inspect/modify the unmarshalled reply. | Suds has unmarshalled the received reply. Provides the plugin with the opportunity to inspect/modify the unmarshalled reply object before it is returned. | def unmarshalled(self, context): """ Suds has sax parsed the received reply. Provides the plugin with the opportunity to inspect/modify the unmarshalled reply. @param context: The reply context. The I{reply} is DOM tree. @type context: L{MessageContext} """ pass |
The I{reply} is DOM tree. | The I{reply} is unmarshalled suds object. | def unmarshalled(self, context): """ Suds has sax parsed the received reply. Provides the plugin with the opportunity to inspect/modify the unmarshalled reply. @param context: The reply context. The I{reply} is DOM tree. @type context: L{MessageContext} """ pass |
if fn.startswith(self.fnprefix) and fn.endswith(self.fnsuffix): | if fn.startswith(self.fnprefix): | def clear(self): for fn in os.listdir(self.location): if os.path.isdir(fn): continue if fn.startswith(self.fnprefix) and fn.endswith(self.fnsuffix): log.debug('deleted: %s', fn) os.remove(os.path.join(self.location, fn)) |
def basic_doc_literal(): | def rhqTest(): | def basic_doc_literal(): global errors try: url = 'http://localhost:7080/rhq-rhq-enterprise-server-ejb3/WebServiceTestBean?wsdl' start(url) client = Client(url, transport=mytransport) print client # # create name # name = client.factory.create('name') name.first = u'Jeff'+unichr(1234) name.last = 'Ortel &lt; Comp... |
try: url = 'http://localhost:7080/rhq-rhq-enterprise-server-ejb3/WebServiceTestBean?wsdl' start(url) client = Client(url, transport=mytransport) print client | url = 'http://localhost.localdomain:7080/rhq-rhq-enterprise-server-ejb3/WebservicesManagerBean?wsdl' start(url) client = Client(url, cache=None) print client try: | def basic_doc_literal(): global errors try: url = 'http://localhost:7080/rhq-rhq-enterprise-server-ejb3/WebServiceTestBean?wsdl' start(url) client = Client(url, transport=mytransport) print client # # create name # name = client.factory.create('name') name.first = u'Jeff'+unichr(1234) name.last = 'Ortel &lt; Comp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.