rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
result = self.run_test( test, etags ) | result = self.run_test( test, etags, label="%s | %s" % (label, test.name) ) | def run_test_suite( self, suite ): descriptor = " Test Suite: %s" % suite.name descriptor += " " * max(1, STATUSTXT_WIDTH - len(descriptor)) self.manager.log(manager.LOG_HIGH, "%s" % (descriptor,), before=1, after=0) ok = 0 failed = 0 ignored = 0 if suite.ignore: self.manager.log(manager.LOG_HIGH, "[IGNORED]") ignor... |
def run_test( self, test, etags ): | def run_test( self, test, etags, label = "" ): | def run_test( self, test, etags ): descriptor = " Test: %s" % test.name descriptor += " " * max(1, STATUSTXT_WIDTH - len(descriptor)) self.manager.log(manager.LOG_HIGH, "%s" % (descriptor,), before=1, after=0) if test.ignore: self.manager.log(manager.LOG_HIGH, "[IGNORED]") return "i" elif len(test.missingFeature... |
result, resulttxt, _ignore_response, _ignore_respdata = self.dorequest( req, test.details, True, False, reqstats, etags = etags ) | result, resulttxt, _ignore_response, _ignore_respdata = self.dorequest( req, test.details, True, False, reqstats, etags = etags, label=label ) | def run_test( self, test, etags ): descriptor = " Test: %s" % test.name descriptor += " " * max(1, STATUSTXT_WIDTH - len(descriptor)) self.manager.log(manager.LOG_HIGH, "%s" % (descriptor,), before=1, after=0) if test.ignore: self.manager.log(manager.LOG_HIGH, "[IGNORED]") return "i" elif len(test.missingFeature... |
def dorequests( self, description, list, doverify = True, forceverify = False ): | def dorequests( self, description, list, doverify = True, forceverify = False, label = "" ): | def dorequests( self, description, list, doverify = True, forceverify = False ): if len(list) == 0: return True description += " " * max(1, STATUSTXT_WIDTH - len(description)) self.manager.log(manager.LOG_HIGH, description, before=1, after=0) ctr = 1 for req in list: result, resulttxt, _ignore_response, _ignore_respdat... |
result, resulttxt, _ignore_response, _ignore_respdata = self.dorequest( req, False, doverify, forceverify ) | result, resulttxt, _ignore_response, _ignore_respdata = self.dorequest( req, False, doverify, forceverify, label=label ) | def dorequests( self, description, list, doverify = True, forceverify = False ): if len(list) == 0: return True description += " " * max(1, STATUSTXT_WIDTH - len(description)) self.manager.log(manager.LOG_HIGH, description, before=1, after=0) ctr = 1 for req in list: result, resulttxt, _ignore_response, _ignore_respdat... |
def dofindall( self, collection): | def dofindall( self, collection, label = "" ): | def dofindall( self, collection): hrefs = [] req = request(self.manager) req.method = "PROPFIND" req.ruris.append(collection[0]) req.ruri = collection[0] req.headers["Depth"] = "1" if len(collection[1]): req.user = collection[1] if len(collection[2]): req.pswd = collection[2] req.data = data() req.data.value = """<?xml... |
result, _ignore_resulttxt, response, respdata = self.dorequest( req, False, False ) | result, _ignore_resulttxt, response, respdata = self.dorequest( req, False, False, label=label ) | def dofindall( self, collection): hrefs = [] req = request(self.manager) req.method = "PROPFIND" req.ruris.append(collection[0]) req.ruri = collection[0] req.headers["Depth"] = "1" if len(collection[1]): req.user = collection[1] if len(collection[2]): req.pswd = collection[2] req.data = data() req.data.value = """<?xml... |
def dodeleteall( self, deletes ): | def dodeleteall( self, deletes, label = "" ): | def dodeleteall( self, deletes ): if len(deletes) == 0: return True for deleter in deletes: req = request(self.manager) req.method = "DELETE" req.ruris.append(deleter[0]) req.ruri = deleter[0] if len(deleter[1]): req.user = deleter[1] if len(deleter[2]): req.pswd = deleter[2] self.dorequest( req, False, False ) |
self.dorequest( req, False, False ) def dofindnew( self, collection): | self.dorequest( req, False, False, label=label ) def dofindnew( self, collection, label = "" ): | def dodeleteall( self, deletes ): if len(deletes) == 0: return True for deleter in deletes: req = request(self.manager) req.method = "DELETE" req.ruris.append(deleter[0]) req.ruri = deleter[0] if len(deleter[1]): req.user = deleter[1] if len(deleter[2]): req.pswd = deleter[2] self.dorequest( req, False, False ) |
result, _ignore_resulttxt, response, respdata = self.dorequest( req, False, False ) | result, _ignore_resulttxt, response, respdata = self.dorequest( req, False, False, label="%s | %s" % (label, "FINDNEW") ) | def dofindnew( self, collection): hresult = "" req = request(self.manager) req.method = "PROPFIND" req.ruris.append(collection[0]) req.ruri = collection[0] req.headers["Depth"] = "1" if len(collection[1]): req.user = collection[1] if len(collection[2]): req.pswd = collection[2] req.data = data() req.data.value = """<?x... |
def dowaitcount( self, collection, count): | def dowaitcount( self, collection, count, label = ""): | def dowaitcount( self, collection, count): for _ignore in range(30): req = request(self.manager) req.method = "PROPFIND" req.ruris.append(collection[0]) req.ruri = collection[0] req.headers["Depth"] = "1" if len(collection[1]): req.user = collection[1] if len(collection[2]): req.pswd = collection[2] req.data = data() ... |
result, _ignore_resulttxt, response, respdata = self.dorequest( req, False, False ) | result, _ignore_resulttxt, response, respdata = self.dorequest( req, False, False, label="%s | %s %d" % (label, "WAITCOUNT", count) ) | def dowaitcount( self, collection, count): for _ignore in range(30): req = request(self.manager) req.method = "PROPFIND" req.ruris.append(collection[0]) req.ruri = collection[0] req.headers["Depth"] = "1" if len(collection[1]): req.user = collection[1] if len(collection[2]): req.pswd = collection[2] req.data = data() ... |
def dowaitchanged( self, uri, etag, user, pswd ): | def dowaitchanged( self, uri, etag, user, pswd, label = "" ): | def dowaitchanged( self, uri, etag, user, pswd ): for _ignore in range(30): req = request(self.manager) req.method = "HEAD" req.ruris.append(uri) req.ruri = uri if user: req.user = user if pswd: req.pswd = pswd result, _ignore_resulttxt, response, _ignore_respdata = self.dorequest( req, False, False ) if result and (... |
result, _ignore_resulttxt, response, _ignore_respdata = self.dorequest( req, False, False ) | result, _ignore_resulttxt, response, _ignore_respdata = self.dorequest( req, False, False, label="%s | %s" % (label, "WAITCHANGED") ) | def dowaitchanged( self, uri, etag, user, pswd ): for _ignore in range(30): req = request(self.manager) req.method = "HEAD" req.ruris.append(uri) req.ruri = uri if user: req.user = user if pswd: req.pswd = pswd result, _ignore_resulttxt, response, _ignore_respdata = self.dorequest( req, False, False ) if result and (... |
def doenddelete( self, description ): | def doenddelete( self, description, label = "" ): | def doenddelete( self, description ): if len(self.end_deletes) == 0: return True description += " " * max(1, STATUSTXT_WIDTH - len(description)) self.manager.log(manager.LOG_HIGH, description, before=1, after=0) for deleter in self.end_deletes: req = request(self.manager) req.method = "DELETE" req.ruris.append(deleter[... |
self.dorequest( req, False, False ) | self.dorequest( req, False, False, label=label ) | def doenddelete( self, description ): if len(self.end_deletes) == 0: return True description += " " * max(1, STATUSTXT_WIDTH - len(description)) self.manager.log(manager.LOG_HIGH, description, before=1, after=0) for deleter in self.end_deletes: req = request(self.manager) req.method = "DELETE" req.ruris.append(deleter[... |
def dorequest( self, req, details=False, doverify = True, forceverify = False, stats = None, etags = None ): | def dorequest( self, req, details=False, doverify = True, forceverify = False, stats = None, etags = None, label = "" ): | def dorequest( self, req, details=False, doverify = True, forceverify = False, stats = None, etags = None ): # Special check for DELETEALL if req.method == "DELETEALL": for ruri in req.ruris: collection = (ruri, req.user, req.pswd) hrefs = self.dofindall(collection) self.dodeleteall(hrefs) return True, "", None, None ... |
hrefs = self.dofindall(collection) self.dodeleteall(hrefs) | hrefs = self.dofindall(collection, label="%s | %s" % (label, "DELETEALL")) self.dodeleteall(hrefs, label="%s | %s" % (label, "DELETEALL")) | def dorequest( self, req, details=False, doverify = True, forceverify = False, stats = None, etags = None ): # Special check for DELETEALL if req.method == "DELETEALL": for ruri in req.ruris: collection = (ruri, req.user, req.pswd) hrefs = self.dofindall(collection) self.dodeleteall(hrefs) return True, "", None, None ... |
self.grabbedlocation = self.dofindnew(collection) | self.grabbedlocation = self.dofindnew(collection, label=label) | def dorequest( self, req, details=False, doverify = True, forceverify = False, stats = None, etags = None ): # Special check for DELETEALL if req.method == "DELETEALL": for ruri in req.ruris: collection = (ruri, req.user, req.pswd) hrefs = self.dofindall(collection) self.dodeleteall(hrefs) return True, "", None, None ... |
if self.dowaitcount(collection, count): | if self.dowaitcount(collection, count, label=label): | def dorequest( self, req, details=False, doverify = True, forceverify = False, stats = None, etags = None ): # Special check for DELETEALL if req.method == "DELETEALL": for ruri in req.ruris: collection = (ruri, req.user, req.pswd) hrefs = self.dofindall(collection) self.dodeleteall(hrefs) return True, "", None, None ... |
if not self.dowaitchanged(uri, etags[uri], req.user, req.pswd): | if not self.dowaitchanged(uri, etags[uri], req.user, req.pswd, label=label): | def dorequest( self, req, details=False, doverify = True, forceverify = False, stats = None, etags = None ): # Special check for DELETEALL if req.method == "DELETEALL": for ruri in req.ruris: collection = (ruri, req.user, req.pswd) hrefs = self.dofindall(collection) self.dodeleteall(hrefs) return True, "", None, None ... |
elif len(date) == 2 or date.startswith('00'): | elif self._numeric.match(date) and (len(date) == 2 or date.startswith('00')): | def parse(self, date): qualifiers = [] if dateutil_parser is None: return None date = orig_date = date.strip() |
assert len(dbs) >= 1, 'No spreadsheet of that name/id' | else: dbs = self.gd_client.GetDatabases(spreadsheet_key=self.source) assert len(dbs) >= 1, 'No spreadsheet of that name/id' | def load_text_db_table(self, sheet_name='Sheet1'): '''Load text_db Table object corresponding to specified sheet_name. ''' super(GDocsReaderTextDb, self).read(None) if self.id_is_name: dbs = self.gd_client.GetDatabases(name=self.source) assert len(dbs) >= 1, 'No spreadsheet of that name/id' db = dbs[0] table = db.GetTa... |
if hasattr(obj,'__doc__') and obj.__doc__ and ('|ydeprecated|' in obj.__doc__ or '|ynodoc|' in obj.__doc__): return True | if hasattr(obj,'__doc__') and obj.__doc__ and ('|ydeprecated|' in obj.__doc__ or '|yhidden|' in obj.__doc__): return True | def customExclude(app, what, name, obj, skip, options): if name=='clone': if 'Serializable.clone' in str(obj): return False return True if hasattr(obj,'__doc__') and obj.__doc__ and ('|ydeprecated|' in obj.__doc__ or '|ynodoc|' in obj.__doc__): return True #if re.match(r'\b(__init__|__reduce__|__repr__|__str__)\b',name... |
s=re.sub(r'(?<!\\)\$([^\$]+)(?<!\\)\$',r':math:`\1`',s) | s=re.sub(r'(?<!\\)\$([^\$]+)(?<!\\)\$',r'\ :math:`\1`\ ',s) | def replaceLaTeX(s): # replace single non-escaped dollars $...$ by :math:`...` # then \$ by single $ s=re.sub(r'(?<!\\)\$([^\$]+)(?<!\\)\$',r':math:`\1`',s) return re.sub(r'\\\$',r'$',s) |
if i.has_key('url'): line+=' `[download fulltext] <%s>`_'%escapeUrl(i['url']) | if i.has_key('url'): line+=' `(fulltext) <%s>`_'%escapeUrl(i['url']) | def escapeUrl(url): return url.replace('<','%3c').replace('>','%3e') |
templates_path = ['_templates'] | templates_path = ['templates'] | def setup(app): from sphinx.highlighting import lexers from pygments.lexers.compiled import CppLexer lexers['cpp'] = CppLexer(tabsize=3) lexers['c++'] = CppLexer(tabsize=3) from pygments.lexers.agile import PythonLexer lexers['python'] = PythonLexer(tabsize=3) app.connect('source-read',fixSrc) app.connect('autodoc-sk... |
version = '0.5' | version = yade.config.version | def setup(app): from sphinx.highlighting import lexers from pygments.lexers.compiled import CppLexer lexers['cpp'] = CppLexer(tabsize=3) lexers['c++'] = CppLexer(tabsize=3) from pygments.lexers.agile import PythonLexer lexers['python'] = PythonLexer(tabsize=3) app.connect('source-read',fixSrc) app.connect('autodoc-sk... |
html_logo = 'fig/yade-logo.png' | def setup(app): from sphinx.highlighting import lexers from pygments.lexers.compiled import CppLexer lexers['cpp'] = CppLexer(tabsize=3) lexers['c++'] = CppLexer(tabsize=3) from pygments.lexers.agile import PythonLexer lexers['python'] = PythonLexer(tabsize=3) app.connect('source-read',fixSrc) app.connect('autodoc-sk... | |
html_favicon = 'fig/yade-favicon.ico' | def setup(app): from sphinx.highlighting import lexers from pygments.lexers.compiled import CppLexer lexers['cpp'] = CppLexer(tabsize=3) lexers['c++'] = CppLexer(tabsize=3) from pygments.lexers.agile import PythonLexer lexers['python'] = PythonLexer(tabsize=3) app.connect('source-read',fixSrc) app.connect('autodoc-sk... | |
html_additional_pages = { 'index':'index.html'} | def setup(app): from sphinx.highlighting import lexers from pygments.lexers.compiled import CppLexer lexers['cpp'] = CppLexer(tabsize=3) lexers['c++'] = CppLexer(tabsize=3) from pygments.lexers.agile import PythonLexer lexers['python'] = PythonLexer(tabsize=3) app.connect('source-read',fixSrc) app.connect('autodoc-sk... | |
sect('Rendering','',['OpenGLRenderer','GlShapeFunctor','GlStateFunctor','GlBoundFunctor','GlInteractionGeometryFunctor','GlInteractionPhysicsFunctor'])+ | sect('Rendering','',['OpenGLRenderer','GlShapeFunctor','GlStateFunctor','GlBoundFunctor','GlIGeomFunctor','GlIPhysFunctor'])+ | def genWrapperRst(): global docClasses docClasses=set() # reset globals wrapper=file('yade.wrapper.rst','w') wrapper.write(""".. _yade.wrapper |
html_theme_options = {'stickysidebar':'true'} | html_theme_options = {'stickysidebar':'true','collapsiblesidebar':'true','rightsidebar':'false'} | def setup(app): from sphinx.highlighting import lexers from pygments.lexers.compiled import CppLexer lexers['cpp'] = CppLexer(tabsize=3) lexers['c++'] = CppLexer(tabsize=3) from pygments.lexers.agile import PythonLexer lexers['python'] = PythonLexer(tabsize=3) app.connect('source-read',fixSrc) app.connect('autodoc-sk... |
\usepackage{euler} | \usepackage{euler} % must be loaded before fontspec for the whole doc (below); this must be kept for pngmath, however | def setup(app): from sphinx.highlighting import lexers from pygments.lexers.compiled import CppLexer lexers['cpp'] = CppLexer(tabsize=3) lexers['c++'] = CppLexer(tabsize=3) from pygments.lexers.agile import PythonLexer lexers['python'] = PythonLexer(tabsize=3) app.connect('source-read',fixSrc) app.connect('autodoc-sk... |
fontpkg='\\usepackage{fontspec,xunicode,xltxtra}\setmainfont[BoldFont={LMRoman10 Bold}]{CMU Concrete}', | fontpkg=r''' \usepackage{euler} \usepackage{fontspec,xunicode,xltxtra} \setmainfont[BoldFont={LMRoman10 Bold}]{CMU Concrete} ''', | def setup(app): from sphinx.highlighting import lexers from pygments.lexers.compiled import CppLexer lexers['cpp'] = CppLexer(tabsize=3) lexers['c++'] = CppLexer(tabsize=3) from pygments.lexers.agile import PythonLexer lexers['python'] = PythonLexer(tabsize=3) app.connect('source-read',fixSrc) app.connect('autodoc-sk... |
sect('Rendering','',['OpenGLRenderingEngine','GlShapeFunctor','GlStateFunctor','GlBoundFunctor','GlInteractionGeometryFunctor','GlInteractionPhysicsFunctor'])+ | sect('Rendering','',['OpenGLRenderingEngine','GlShapeFunctor','GlStateFunctor','GlBoundFunctor','GlInteractionGeometryFunctor','GlInteractionPhysicsFunctor','GlShapeDispatcher','GlStateDispatcher','GlBoundDispatcher,','GlInteractionGeometryDispatcher','GlInteractionPhysicsDispatcher'])+ | def genWrapperRst(): global docClasses docClasses=set() # reset globals wrapper=file('yade.wrapper.rst','w') wrapper.write(""".. _yade.wrapper |
return u"".join(self.cn) | if hasattr(self, "cn"): return u"".join(self.cn) else: return self.dn | def __unicode__(self): """ Returns a display value for this result based on the common name. """ return u"".join(self.cn) |
def has_permission(obj, user, codename, roles=[]): | def has_permission(obj, user, codename, roles=None): | def has_permission(obj, user, codename, roles=[]): """Checks whether the passed user has passed permission for passed object. **Parameters:** obj The object for which the permission should be checked. codename The permission's codename which should be checked. user The user for which the permission should be checke... |
if obj is not None: | while obj: | def get_roles(principal, obj=None): """Returns all roles of passed user for passed content object. This takes direct and roles via a group into account. If an object is passed local roles will also added. **Parameters:** obj The object from which the roles are removed. principal The principal (user or group) from wh... |
user The user for which the permission should be checked. | request The current request. | def has_permission(obj, user, codename, roles=None): """Checks whether the passed user has passed permission for passed object. **Parameters:** obj The object for which the permission should be checked. codename The permission's codename which should be checked. user The user for which the permission should be chec... |
def check_permission(obj, user, permission, roles=None): | def check_permission(obj, user, codename, roles=None): | def check_permission(obj, user, permission, roles=None): """Checks whether passed user has passed permission for passed obj. **Parameters:** obj The object for which the permission should be checked. codename The permission's codename which should be checked. user The user for which the permission should be checked... |
if not has_permission(obj, user, permission): | if not has_permission(obj, user, codename): | def check_permission(obj, user, permission, roles=None): """Checks whether passed user has passed permission for passed obj. **Parameters:** obj The object for which the permission should be checked. codename The permission's codename which should be checked. user The user for which the permission should be checked... |
user.permissions[cache_key] = result | user.permissions[cache_key] = data | def _cache_permission(user, cache_key, data): """Stores the passed data on the passed user object. **Parameters:** user The user on which the data is stored. cache_key The key under which the data is stored. data The data which is stored. """ if not getattr(user, "permissions", None): user.permissions = {} user.per... |
used to display only reasonable permissions for an object. | used to display only reasonable permissions for an object. This must be a Django ContentType | def register_permission(name, codename, ctypes=[]): """Registers a permission to the framework. Returns the permission if the registration was successfully, otherwise False. **Parameters:** name The unique name of the permission. This is displayed to the customer. codename The unique codename of the permission. This ... |
p.content_types = ctypes p.save() | ctypes = [ContentType.objects.get_for_model(ctype) for ctype in ctypes] if ctypes: p.content_types = ctypes p.save() | def register_permission(name, codename, ctypes=[]): """Registers a permission to the framework. Returns the permission if the registration was successfully, otherwise False. **Parameters:** name The unique name of the permission. This is displayed to the customer. codename The unique codename of the permission. This ... |
"""Returns local for passed user and content object. | """Returns local roles for passed user and content object. | def get_local_roles(obj, principal): """Returns local for passed user and content object. """ ctype = ContentType.objects.get_for_model(obj) if isinstance(principal, User): return [prr.role for prr in PrincipalRoleRelation.objects.filter( user=principal, content_id=obj.id, content_type=ctype)] else: return [prr.role f... |
if '13' in error: raise DownloaderError('Need higher permissions to write' + 'settings') else: raise DownloaderError('File error') | msg = 'Error, probably need permissions to write settings,' + \ ' please run as root' print msg | def write_file(file_path, data): try: out_file = open(file_path, 'w') out_file.write(data) out_file.close() except IOError as error: if '13' in error: raise DownloaderError('Need higher permissions to write' + 'settings') else: raise DownloaderError('File error') |
play = Button( button_frame, text='Play', command=self.play_cb) pause = Button( button_frame, text='Pause', command=self.pause_cb) rewind = Button( button_frame, text='Rewind', command=self.rewind_cb) step_back = Button( button_frame, text='Step Forward', command=self.step_forward_cb) step_forward = Button( button_fram... | play_button = Button( button_frame, text='Play', command=self.play) pause_button = Button( button_frame, text='Pause', command=self.pause) rewind_button = Button( button_frame, text='Rewind', command=self.rewind) back_button = Button( button_frame, text='Step Forward', command=self.step_forward) forward_button = Button... | def __init__(self, filename): |
for button in (play, pause, rewind, step_back, step_forward, fast): | for button in (play_button, pause_button, rewind_button, back_button, forward_button): | def __init__(self, filename): |
self.step_rate=0.55 | self.step_rate=0.6 | def __init__(self, filename): |
def fast_cb(self): self.step_rate=0.001 | def __init__(self, filename): | |
def play_cb(self): | def play(self): | def play_cb(self): if not self.paused and not self.finished: self.step_forward_cb() self.source.after(int(self.step_rate * 1000), self.play_cb) |
self.step_forward_cb() self.source.after(int(self.step_rate * 1000), self.play_cb) | self.step_forward() self.source.after(int(self.step_rate * 1000), self.play) | def play_cb(self): if not self.paused and not self.finished: self.step_forward_cb() self.source.after(int(self.step_rate * 1000), self.play_cb) |
def pause_cb(self): | def pause(self): | def pause_cb(self): self.paused=not self.paused if not self.paused: self.play_cb() |
self.play_cb() | self.play() | def pause_cb(self): self.paused=not self.paused if not self.paused: self.play_cb() |
def step_forward_cb(self): | def step_forward(self): | def step_forward_cb(self): '''Moves to the next trace dictionary and inserts the data it contains, advancing the highlighting as appropriate.''' |
self.source.see('%d.0' % (step['line']+1)) | def step_forward_cb(self): '''Moves to the next trace dictionary and inserts the data it contains, advancing the highlighting as appropriate.''' | |
def step_back_cb(self): | def step_back(self): | def step_forward_cb(self): '''Moves to the next trace dictionary and inserts the data it contains, advancing the highlighting as appropriate.''' |
self.rewind_cb() | self.rewind() | def step_back_cb(self): if self.current_line <= 0: self.rewind_cb() |
current_text=self.stdout.get('1.0', 'end+1c') | def step_back_cb(self): if self.current_line <= 0: self.rewind_cb() | |
self.stdout.insert('1.0', current_text.replace(step['stdout'], '', 1)) | for previous in range(self.current_line): prev_step=self.trace[previous] if 'stdout' in prev_step: self.stdout.insert('insert', prev_step['stdout']) | def step_back_cb(self): if self.current_line <= 0: self.rewind_cb() |
if self.finished: self.finished = False | def step_back_cb(self): if self.current_line <= 0: self.rewind_cb() | |
def rewind_cb(self): '''Sets all parameters back to their original states (including unpausing)''' | def rewind(self): '''Sets all parameters back to their original states (including unpausing)''' | def rewind_cb(self): '''Sets all parameters back to their original states (including unpausing)''' self.clear_highlighting() self.stdout_clear() self.current_line=0 self.finished=False self.paused=False self.source.see('1.0') |
'padx': 5, 'wrap': 'none', | def __init__(self, flist=None, filename=None, key=None, root=None): if TraceDisplayWindow.help_url is None: dochome = os.path.join(sys.prefix, 'Doc', 'index.html') if sys.platform.count('linux'): # look for html docs in a couple of standard places pyver = 'python-docs-' + '%s.%s.%s' % sys.version_info[:3] if os.path.i... | |
self.text = text = Text(text_frame, wrap=WORD, borderwidth=3) | self.text = text = Text(text_frame, wrap=WORD) | def __init__(self, flist=None, filename=None, key=None, root=None): if TraceDisplayWindow.help_url is None: dochome = os.path.join(sys.prefix, 'Doc', 'index.html') if sys.platform.count('linux'): # look for html docs in a couple of standard places pyver = 'python-docs-' + '%s.%s.%s' % sys.version_info[:3] if os.path.i... |
self.annotation = Text(anno_frame, height=7, wrap=WORD, borderwidth=3) self.globals = Text(anno_frame, height=7, wrap=WORD, borderwidth=3) self.locals = Text(anno_frame, height=7, wrap=WORD, borderwidth=3) | self.annotation = Text(anno_frame, height=7, wrap=WORD) self.globals = Text(anno_frame, height=7, wrap=WORD) self.locals = Text(anno_frame, height=7, wrap=WORD) | def __init__(self, flist=None, filename=None, key=None, root=None): if TraceDisplayWindow.help_url is None: dochome = os.path.join(sys.prefix, 'Doc', 'index.html') if sys.platform.count('linux'): # look for html docs in a couple of standard places pyver = 'python-docs-' + '%s.%s.%s' % sys.version_info[:3] if os.path.i... |
def highlight_line(self, target, lineno): | def highlight_line(self, target, lineno, clear_highlighting = True): | def highlight_line(self, target, lineno): '''Highlights the line linenno in the target Text widget.''' |
self.clear_highlighting(target) | if clear_highlighting: self.clear_highlighting(target) | def highlight_line(self, target, lineno): '''Highlights the line linenno in the target Text widget.''' |
self.highlight_line(target, lineno) | self.highlight_line(target, lineno, clear_highlighting = False) | def highlight_changes(self, current_step, previous_step): '''Inserts the globals and locals into their respective Text boxes, highlighting any differences between the previous contents and the current one.''' for target in ('globals', 'locals'): if target in current_step: self.clear(target) globals=current_step[target... |
self._init_monthes() | self._init_months() | def __init__(self): """Initialize the state of the converter""" self._init_monthes() self._compile_regular_expressions() |
def _init_monthes(self): | def _init_months(self): | def _init_monthes(self): """Defines a dictionary matching the name of the month with its corresponding number""" |
self._monthes = {'jan':'01', 'january':'01', | self._months = {'jan':'01', 'january':'01', | def _init_monthes(self): """Defines a dictionary matching the name of the month with its corresponding number""" |
self._month_name_to_month_number.update(self._monthes) | self._month_name_to_month_number.update(self._months) | def _init_monthes(self): """Defines a dictionary matching the name of the month with its corresponding number""" |
monthes_match = '' for month_name in self._monthes.keys(): monthes_match = monthes_match + month_name + '|' monthes_match = r'\b(' + monthes_match[0:-1] + r')\b' return monthes_match | months_match = '' for month_name in self._months.keys(): months_match = months_match + month_name + '|' months_match = r'\b(' + months_match[0:-1] + r')\b' return months_match | def _get_month_names_match(self): """Retruns part of a patter that matches month in a date""" |
if 'fulltext' in user_info['uri'] and CFG_WEBSEARCH_FULLTEXT_SNIPPETS: | if CFG_WEBSEARCH_FULLTEXT_SNIPPETS and user_info and \ 'fulltext' in user_info['uri']: | def call_bibformat(recID, format="HD", ln=CFG_SITE_LANG, search_pattern=None, user_info=None, verbose=0): """ Calls BibFormat and returns formatted record. BibFormat will decide by itself if old or new BibFormat must be used. """ from invenio.bibformat_utils import get_pdf_snippets keywords = [] if search_pattern is... |
res = run_sql("SELECT * from collection_collection WHERE id_dad=%s", (colID, )) res2 = run_sql("SELECT * from collection_collection WHERE id_son=%s", (colID, )) | res = run_sql("SELECT id_dad,id_son,type,score from collection_collection WHERE id_dad=%s", (colID, )) res2 = run_sql("SELECT id_dad,id_son,type,score from collection_collection WHERE id_son=%s", (colID, )) | def perform_deletecollection(colID, ln, confirm=-1, callback='yes'): """form to delete a collection colID - id of collection """ subtitle ='' output = """ <span class="warning"> <strong> <dl> <dt>WARNING:</dt> <dd>When deleting a collection, you also deletes all data related to the collection like translations, relat... |
res = run_sql("DELETE FROM collection_collection WHERE id_son=%s and id_dad=%s", (id_son, id_dad)) | run_sql("DELETE FROM collection_collection WHERE id_son=%s and id_dad=%s", (id_son, id_dad)) | def remove_col_subcol(id_son, id_dad, type): """Remove a collection as a son of another collection in the tree, if collection isn't used elsewhere in the tree, remove all registered sons of the id_son. id_son - collection id of son to remove id_dad - the id of the dad""" try: if id_son != id_dad: tree = get_col_tree(i... |
res = run_sql("DELETE FROM collection_collection WHERE id_son=%s and id_dad=%s and type=%s", (id_son, id_dad, type)) if not run_sql("SELECT * from collection_collection WHERE id_son=%s and type=%s", (id_son, type)): | run_sql("DELETE FROM collection_collection WHERE id_son=%s and id_dad=%s and type=%s", (id_son, id_dad, type)) if not run_sql("SELECT id_dad,id_son,type,score from collection_collection WHERE id_son=%s and type=%s", (id_son, type)): | def remove_col_subcol(id_son, id_dad, type): """Remove a collection as a son of another collection in the tree, if collection isn't used elsewhere in the tree, remove all registered sons of the id_son. id_son - collection id of son to remove id_dad - the id of the dad""" try: if id_son != id_dad: tree = get_col_tree(i... |
res = run_sql("DELETE FROM collection_collection WHERE id_son=%s and id_dad=%s", (id, dad)) | run_sql("DELETE FROM collection_collection WHERE id_son=%s and id_dad=%s", (id, dad)) | def remove_col_subcol(id_son, id_dad, type): """Remove a collection as a son of another collection in the tree, if collection isn't used elsewhere in the tree, remove all registered sons of the id_son. id_son - collection id of son to remove id_dad - the id of the dad""" try: if id_son != id_dad: tree = get_col_tree(i... |
res = run_sql("SELECT * FROM collection_field_fieldvalue where id_field=%s and id_collection=%s and type=%s and id_fieldvalue=%s", (fldID, colID, type, fldvID)) | res = run_sql("SELECT id_collection,id_field,id_fieldvalue,type,score,score_fieldvalue FROM collection_field_fieldvalue where id_field=%s and id_collection=%s and type=%s and id_fieldvalue=%s", (fldID, colID, type, fldvID)) | def add_col_fld(colID, fldID, type, fldvID=''): """Add a sort/search/field to the collection. colID - the id of the collection involved fldID - the id of the field. fldvID - the id of the fieldvalue. type - which type, seo, sew... score - the score of the format, decides sorting, if not given, place the format on top""... |
res = run_sql("SELECT * FROM collection_field_fieldvalue WHERE id_collection=%s AND type=%s and id_field=%s and id_fieldvalue is NULL", (colID, type, fldID)) | res = run_sql("SELECT id_collection,id_field,id_fieldvalue,type,score,score_fieldvalue FROM collection_field_fieldvalue WHERE id_collection=%s AND type=%s and id_field=%s and id_fieldvalue is NULL", (colID, type, fldID)) | def add_col_fld(colID, fldID, type, fldvID=''): """Add a sort/search/field to the collection. colID - the id of the collection involved fldID - the id of the field. fldvID - the id of the fieldvalue. type - which type, seo, sew... score - the score of the format, decides sorting, if not given, place the format on top""... |
SIGNAL('selected(const QaPolygon &)'), | SIGNAL('selected(const QPolygon &)'), | def __init__(self, *args): QMainWindow.__init__(self, *args) |
except Die as e: inform('%s\n' % e.args) | except Die: inform('%s\n' % sys.exc_info()[1]) | def main(): """Generate the build tree and the Makefiles """ options, args = parse_args() inform('Command line options:\n%s\n' % pprint.pformat(options.__dict__)) configuration = get_pyqt_configuration(options) options = check_sip(configuration, options) options = check_os(configuration, options) options = check_com... |
print content | def sychronize_with_vcs(self, vcs_sync_url): """ Synchronizes the Mantis issues and the VCS history. """ try: file_object = urllib2.urlopen(vcs_sync_url) content = file_object.read() print content self.logger.debug(content) file_object.close() except IOError, error: self.logger.error("Cannot open URL. Reason: '%s'" % ... | |
def __init__(self,basedir,workdir,vaspcmd): self.basedir = basedir self.workdir = workdir self.vaspcmd = vaspcmd | self.readXml(vasprun) def readXml(self,filename): doc = Sax2.FromXmlFile(filename).documentElement results = xpath.Evaluate( "/modeling/calculation/energy/i[@name='e_fr_energy']", doc) if results: self.toten = float(results[0].firstChild.nodeValue) | def __init__(self,basedir,workdir,vaspcmd): self.basedir = basedir self.workdir = workdir self.vaspcmd = vaspcmd # Read parameter input os.chdir(self.basedir) if not os.path.isfile('convergencetest.in'): print "convergencetest.in not found!" sys.exit(1) f = open('convergencetest.in','r') lines = f.readlines() f.close(... |
os.chdir(self.basedir) if not os.path.isfile('convergencetest.in'): print "convergencetest.in not found!" sys.exit(1) f = open('convergencetest.in','r') lines = f.readlines() f.close() self.param = lines[0].strip() self.paramValues = [l.strip() for l in lines[1:]] self.numSteps = len(self.paramValues) print "A total nu... | print '%.6f' % (self.toten) | def __init__(self,basedir,workdir,vaspcmd): self.basedir = basedir self.workdir = workdir self.vaspcmd = vaspcmd # Read parameter input os.chdir(self.basedir) if not os.path.isfile('convergencetest.in'): print "convergencetest.in not found!" sys.exit(1) f = open('convergencetest.in','r') lines = f.readlines() f.close(... |
summaryfile.write("Run | summaryfile.write(self.param+"\t | def start(self,analyzeOnly = False): |
'%s\\1=\\2\x00%s' % (self.param,self.paramValues[stepNo]), | '%s\\1=\\2 %s' % (self.param,self.paramValues[stepNo]), | def start(self,analyzeOnly = False): |
os.system(vaspcmd) | os.system(self.vaspcmd) | def start(self,analyzeOnly = False): |
summaryline = "%d\t%d\t%.3f\t%.4f\t%.0f\t%.4f\t%.4f\t%.4f" % ( stepNo, | summaryline = "%s\t%d\t%.3f\t%.4f\t%.0f\t%.4f\t%.4f\t%.4f" % ( self.paramValues[stepNo], | def start(self,analyzeOnly = False): |
self.filters.append(start.strftime('%B %Y')) | def __call__(self): """ Get all the Blogentries and return the listingview template. If there was a CategoryUid or a date in the querystring, the results would be filtered. """ | |
aq_parent(aq_inner(self.context)).absolute_url()) | aq_parent(aq_inner(self.context)).absolute_url()+ querystring) | def __call__(self): """ Get all the Blogentries and return the listingview template. If there was a CategoryUid or a date in the querystring, the results would be filtered. """ context = aq_inner(self.context).aq_explicit req = context.REQUEST query = {} self.filters = [] querystring = context.REQUEST.get('QUERY_STR... |
voice = self.login() pagenum = 1 morepages = True msgs = [] convs = {} while morepages : xmlparser = fetchfolderpage(voice,"sms",pagenum) xmlparser() infolder = xmlparser.folder htmlsms = xmlparser.html (msgpage, morepages) = extractsms(htmlsms) msgs.extend(msgpage) self.logger.info("Fetched %d conversations from Go... | (msgs, convs) = self.fetchconversations() | def fetchitems(self) : # fetch more items from feed source try : voice = self.login() # log in if necessary pagenum = 1 # start at page 1 of results morepages = True # there are more pages to do msgs = [] # messages retrieved convs = {} # map id -> conversation object while mor... |
return(voice.sms()) | pagenum = 1 morepages = True msgs = [] convs = {} while morepages : xmlparser = fetchfolderpage(voice,"sms",pagenum) xmlparser() infolder = xmlparser.folder htmlsms = xmlparser.html (msgpage, morepages) = extractsms(htmlsms) msgs.extend(msgpage) self.logger.info("Fetched %d conversations from Google Voice page %d; %... | def fetchconversations(self) : # fetch SMS conversation folders try : voice = self.login() # log in if necessary return(voice.sms()) |
folder = self.fetchconversations() for conv in folder.messages : | (msgs, convs) = self.fetchconversations() for conv in convs.values() : | def deleteoldmsgs(self, msgs) : # delete old messages on server if not self.inqueue.empty() : # if output queue not empty return now = time.time() # time now if now - self.lastdelete < self.kdeleteinterval : # too soon for delete cycle return self.logger.info("Deleting conversations older than %1.1f min... |
_createObjectByType('TempFolder', self.folder, 'tf') self.tfview = self.folder.tf.restrictedTraverse('@@plone_context_state') | tf = _createObjectByType('TempFolder', self.folder, 'tf') tfview = tf.restrictedTraverse('@@plone_context_state') | def test_view_template_id_nonbrowserdefault(self): # The view template id is taken from the FTI for non-browserdefault # (non ATContentTypes) content _createObjectByType('TempFolder', self.folder, 'tf') self.tfview = self.folder.tf.restrictedTraverse('@@plone_context_state') # 'tf'?? smells like a bug in the way this i... |
self.assertEquals(self.tfview.view_template_id(), 'tf') | self.assertEquals(tfview.view_template_id(), 'tf') def test_view_template_id_nonbrowserdefault_restricted(self): fti = self.portal.portal_types.TempFolder fti.getActionObject('object/view').edit( permissions=(u'Modify Portal Content')) tf = _createObjectByType('TempFolder', self.folder, 'tf') tf.manage_addLocalRol... | def test_view_template_id_nonbrowserdefault(self): # The view template id is taken from the FTI for non-browserdefault # (non ATContentTypes) content _createObjectByType('TempFolder', self.folder, 'tf') self.tfview = self.folder.tf.restrictedTraverse('@@plone_context_state') # 'tf'?? smells like a bug in the way this i... |
if bool(self.anonymous): | if not _checkPermission('CMFEditions: Access previous versions', self.context): | def show_history(self): if bool(self.anonymous): return False if IViewView.providedBy(self.__parent__): return True return False |
action = fti.getActionInfo(actionId)['url'].split('/')[-1] | action = fti.getActionInfo(actionId, object=context)['url'].split('/')[-1] | def _lookupTypeActionTemplate(self, actionId): context = aq_inner(self.context) fti = context.getTypeInfo() try: # XXX: This isn't quite right since it assumes the action starts with ${object_url} action = fti.getActionInfo(actionId)['url'].split('/')[-1] except ValueError: # If the action doesn't exist, stop return No... |
self.search_input_id = "" | self.search_input_id = "nonlivesearchGadget" | def update(self): super(SearchBoxViewlet, self).update() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.