rem
stringlengths 1
322k
| add
stringlengths 0
2.05M
| context
stringlengths 4
228k
| meta
stringlengths 156
215
|
---|---|---|---|
call(object.manage_addFile, id=name, file=open(f)) | call(object.manage_addFile, id=name, file=open(f,'rb')) | def upload_file(object, f): if os.path.isdir(f): return upload_dir(object, f) dir, name = os.path.split(f) root, ext = os.path.splitext(name) if ext in ('file', 'dir'): ext='' else: ext=string.lower(ext) if ext and ext[0] in '.': ext=ext[1:] if ext and globals().has_key('upload_'+ext): if verbose: print 'upload_'+ext, f return globals()['upload_'+ext](object, f) if verbose: print 'upload_file', f, ext call(object.manage_addFile, id=name, file=open(f)) | 9d889bec612f3bf809e69d44817c619206e3be32 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/9d889bec612f3bf809e69d44817c619206e3be32/load_site.py |
title, head, body = parse_html(f) | if doctor: title, head, body = parse_html(f) else: if old: f=f.read() title, head, body = '', '', f | def upload_html(object, f): dir, name = os.path.split(f) f=open(f) # There is a Document bugs that causes file uploads to fail. # Waaa. This will be fixed in 1.10.2. #f=f.read() title, head, body = parse_html(f) if old: call(object.manage_addDocument, id=name, file=body) else: call(object.manage_addDTMLDocument, id=name, title=title, file=body) # Now add META and other tags as property if head: object=object.__class__(object.url+'/'+name, username=object.username, password=object.password) call(object.manage_addProperty, id="loadsite-head", type="text", value=head) | 9d889bec612f3bf809e69d44817c619206e3be32 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/9d889bec612f3bf809e69d44817c619206e3be32/load_site.py |
call(object.manage_addProperty, id="loadsite-head", type="text", value=head) | call(object.manage_addProperty, id="loadsite-head", type="text", value=head) | def upload_html(object, f): dir, name = os.path.split(f) f=open(f) # There is a Document bugs that causes file uploads to fail. # Waaa. This will be fixed in 1.10.2. #f=f.read() title, head, body = parse_html(f) if old: call(object.manage_addDocument, id=name, file=body) else: call(object.manage_addDTMLDocument, id=name, title=title, file=body) # Now add META and other tags as property if head: object=object.__class__(object.url+'/'+name, username=object.username, password=object.password) call(object.manage_addProperty, id="loadsite-head", type="text", value=head) | 9d889bec612f3bf809e69d44817c619206e3be32 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/9d889bec612f3bf809e69d44817c619206e3be32/load_site.py |
call(object.manage_addDocument, id=name, file=open(f)) | f=f.read() call(object.manage_addDocument, id=name, file=f) | def upload_dtml(object, f): dir, name = os.path.split(f) if old: call(object.manage_addDocument, id=name, file=open(f)) else: call(object.manage_addDTMLDocument, id=name, file=f) | 9d889bec612f3bf809e69d44817c619206e3be32 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/9d889bec612f3bf809e69d44817c619206e3be32/load_site.py |
call(object.manage_addDTMLDocument, id=name, file=f) | call(object.manage_addDTMLMethod, id=name, file=f) | def upload_dtml(object, f): dir, name = os.path.split(f) if old: call(object.manage_addDocument, id=name, file=open(f)) else: call(object.manage_addDTMLDocument, id=name, file=f) | 9d889bec612f3bf809e69d44817c619206e3be32 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/9d889bec612f3bf809e69d44817c619206e3be32/load_site.py |
call(object.manage_addImage, id=name, file=open(f)) | call(object.manage_addImage, id=name, file=open(f,'rb')) | def upload_gif(object, f): dir, name = os.path.split(f) call(object.manage_addImage, id=name, file=open(f)) | 9d889bec612f3bf809e69d44817c619206e3be32 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/9d889bec612f3bf809e69d44817c619206e3be32/load_site.py |
d['rand']=math d['whrand']=math | d['rand']=rand d['whrand']=whrand | def careful_getslice(md, seq, *indexes): v=len(indexes) if v==2: v=seq[indexes[0]:indexes[1]] elif v==1: v=seq[indexes[0]:] else: v=seq[:] if type(seq) is type(''): return v # Short-circuit common case validate=md.validate if validate is not None: for e in v: if not validate(seq,seq,'',e,md): raise ValidationError, 'unauthorized access to slice member' return v | c320a496c2a68f7bb4f41542c8337e408dab6e8a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/c320a496c2a68f7bb4f41542c8337e408dab6e8a/DT_Util.py |
query=self.template(self,argdata) | query=apply(self.template, (self,), argdata) | def __call__(self,REQUEST=None): | 3c5cb149e3d3eb004863a240a3d43523d20ede11 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/3c5cb149e3d3eb004863a240a3d43523d20ede11/DA.py |
self.__name__=args or tname | self.__name__="%s %s" % (tname, args) args = parse_params(args, required=1) self.args=args if args.has_key('required'): self.required=args['required'] elif args.has_key('') and args['']=='required': self.required=1 | def __init__(self, blocks): | d0c296670e90f08af6657187aa320632c8cec078 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/d0c296670e90f08af6657187aa320632c8cec078/sqlgroup.py |
product.manage_options=OFS.Folder.Folder.manage_options | product.manage_options=Folder.manage_options | def initializeProduct(productp, name, home, app): # Initialize a levered product products=app.Control_Panel.Products if hasattr(productp, '__import_error__'): ie=productp.__import_error__ else: ie=None try: fver=strip(open(home+'/version.txt').read()) except: fver='' old=None try: if ihasattr(products,name): old=getattr(products, name) if (ihasattr(old,'version') and old.version==fver and hasattr(old, '__import_error__') and old.__import_error__==ie): return except: pass try: f=CompressedInputFile(open(home+'/product.dat'),name+' shshsh') meta=cPickle.Unpickler(f).load() product=Globals.Bobobase._jar.import_file(f) product._objects=meta['_objects'] except: f=fver and (" (%s)" % fver) product=Product(name, 'Installed product %s%s' % (name,f)) if old is not None: products._delObject(name) products._setObject(name, product) product.__of__(products)._postCopy(products) product.manage_options=OFS.Folder.Folder.manage_options product.icon='p_/InstalledProduct_icon' product.version=fver product._distribution=None product.manage_distribution=None product.thisIsAnInstalledProduct=1 if ie: product.import_error_=ie product.title='Broken product %s' % name product.icon='p_/BrokenProduct_icon' product.manage_options=( {'label':'Traceback', 'action':'manage_traceback'}, ) if os.path.exists(os.path.join(home, 'README.txt')): product.manage_options=product.manage_options+( {'label':'README', 'action':'manage_readme'}, ) | 698b82127f36a69b8c62f9ee4be28aa2d5518a09 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/698b82127f36a69b8c62f9ee4be28aa2d5518a09/Product.py |
self.report(join( traceback.format_tb(tb_tb)) + '\n') | self.report(string.join(traceback.format_tb(tb_tb)) + '\n') | def getSuiteFromFile(self, filepath): if not os.path.isfile(filepath): raise ValueError, '%s is not a file' % filepath path, filename=os.path.split(filepath) name, ext=os.path.splitext(filename) file, pathname, desc=imp.find_module(name, [path]) saved_syspath = sys.path[:] try: sys.path.append(path) # let module find things in its dir try: module=imp.load_module(name, file, pathname, desc) except: (tb_t, tb_v, tb_tb) = sys.exc_info() | 22a11903c0e5b78c95b1708ca63fa1723173d9ad /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/22a11903c0e5b78c95b1708ca63fa1723173d9ad/testrunner.py |
def custom_default_report(id, result, action='', no_table=0): | def custom_default_report(id, result, action='', no_table=0, goofy=regex.compile('[^a-zA-Z0-9_]').search ): | def custom_default_report(id, result, action='', no_table=0): columns=result._searchable_result_columns() __traceback_info__=columns heading=('<tr>\n%s\t</tr>' % string.joinfields( map(lambda c: '\t<th>%s</th>\n' % nicify(c['name']), columns), '' ) ) if no_table: tr, _tr, td, _td, delim = '<p>', '</p>', '', '', ', ' else: tr, _tr, td, _td, delim = '<tr>', '</tr>', '<td>', '</td>', '' if no_table: tr='<p>', '</p>' else: tr, _tr = '<tr>', '</tr>' row=('%s\n%s\t%s' % (tr,string.joinfields( map(lambda c, td=td, _td=_td: '\t%s<!--#var %s%s-->%s\n' % (td,urllib.quote(c['name']), c['type']!='s' and ' null=""' or '',_td), columns), delim), _tr)) return custom_default_report_src( id=id,heading=heading,row=row,action=action,no_table=no_table) | 4776034943fa9e517a9f521f56917e83d3dbc338 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4776034943fa9e517a9f521f56917e83d3dbc338/Aqueduct.py |
row=('%s\n%s\t%s' % (tr,string.joinfields( map(lambda c, td=td, _td=_td: '\t%s<!-- % (td,urllib.quote(c['name']), c['type']!='s' and ' null=""' or '',_td), columns), delim), _tr)) | row=[] for c in columns: n=c['name'] if goofy(n) >= 0: n='expr="_vars[\'%s]"' % (`'"'+n`[2:]) row.append('\t%s<!-- % (td,n,c['type']!='s' and ' null=""' or '',_td)) row=('%s\n%s\t%s' % (tr,string.joinfields(row,delim), _tr)) | def custom_default_report(id, result, action='', no_table=0): columns=result._searchable_result_columns() __traceback_info__=columns heading=('<tr>\n%s\t</tr>' % string.joinfields( map(lambda c: '\t<th>%s</th>\n' % nicify(c['name']), columns), '' ) ) if no_table: tr, _tr, td, _td, delim = '<p>', '</p>', '', '', ', ' else: tr, _tr, td, _td, delim = '<tr>', '</tr>', '<td>', '</td>', '' if no_table: tr='<p>', '</p>' else: tr, _tr = '<tr>', '</tr>' row=('%s\n%s\t%s' % (tr,string.joinfields( map(lambda c, td=td, _td=_td: '\t%s<!--#var %s%s-->%s\n' % (td,urllib.quote(c['name']), c['type']!='s' and ' null=""' or '',_td), columns), delim), _tr)) return custom_default_report_src( id=id,heading=heading,row=row,action=action,no_table=no_table) | 4776034943fa9e517a9f521f56917e83d3dbc338 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4776034943fa9e517a9f521f56917e83d3dbc338/Aqueduct.py |
if not ifhdr: RESPONSE.setStatus(412) | if not ifhdr: raise 'Precondition Failed', 'If Header Missing' | def LOCK(self, REQUEST, RESPONSE): """Lock a resource""" self.dav__init(REQUEST, RESPONSE) security = getSecurityManager() creator = security.getUser() body = REQUEST.get('BODY', '') ifhdr = REQUEST.get_header('If', None) depth = REQUEST.get_header('Depth', 'infinite') alreadylocked = Lockable.wl_isLocked(self) | 957c59aaf381c33dcd61a13860171f5e4a939d9a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/957c59aaf381c33dcd61a13860171f5e4a939d9a/Resource.py |
raise SyntaxError, "sort oder must be either ASC or DESC" | raise SyntaxError, "sort direction must be either ASC or DESC" | def make_sortfunctions(sortfields, _): """Accepts a list of sort fields; splits every field, finds comparison function. Returns a list of 3-tuples (field, cmp_function, asc_multplier)""" sf_list = [] for field in sortfields: f = list(field) l = len(f) if l == 1: f.append("cmp") f.append("asc") elif l == 2: f.append("asc") elif l == 3: pass else: raise SyntaxError, "sort option must contains no more than 2 fields" f_name = f[1] # predefined function? if f_name == "cmp": func = cmp # builtin elif f_name == "nocase": func = nocase elif f_name in ("locale", "strcoll"): func = strcoll elif f_name in ("locale_nocase", "strcoll_nocase"): func = strcoll_nocase else: # no - look it up in the namespace func = _.getitem(f_name, 0) sort_order = f[2].lower() if sort_order == "asc": multiplier = +1 elif sort_order == "desc": multiplier = -1 else: raise SyntaxError, "sort oder must be either ASC or DESC" sf_list.append((f[0], func, multiplier)) return sf_list | 439b7d37c880170bbb9ff35f11558acbd767b349 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/439b7d37c880170bbb9ff35f11558acbd767b349/SortEx.py |
Cache._setPropValue(self, id, value) | PropertyManager._setPropValue(self, id, value) | def _setPropValue(self, id, value): Cache._setPropValue(self, id, value) self.ZCacheable_invalidate() | 255d1174daada068be0087f8f724324d956ac323 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/255d1174daada068be0087f8f724324d956ac323/ZopePageTemplate.py |
r.append(name, value) | r.append((name, value)) | def parse_qsl(qs, keep_blank_values=0, strict_parsing=0): """Parse a query given as a string argument. Arguments: qs: URL-encoded query string to be parsed keep_blank_values: flag indicating whether blank values in URL encoded queries should be treated as blank strings. A true value inicates that blanks should be retained as blank strings. The default false value indicates that blank values are to be ignored and treated as if they were not included. strict_parsing: flag indicating what to do with parsing errors. If false (the default), errors are silently ignored. If true, errors raise a ValueError exception. Returns a list, as God intended. """ name_value_pairs = string.splitfields(qs, '&') r=[] for name_value in name_value_pairs: nv = string.splitfields(name_value, '=') if len(nv) != 2: if strict_parsing: raise ValueError, "bad query field: %s" % `name_value` continue name = urllib.unquote(string.replace(nv[0], '+', ' ')) value = urllib.unquote(string.replace(nv[1], '+', ' ')) r.append(name, value) return r | d8f773825075f9ec012276b9f3055919bb608dd2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/d8f773825075f9ec012276b9f3055919bb608dd2/cgi.py |
'cst':'Us/Central','cuba':'Cuba','est':'US/Eastern','egypt':'Egypt', | 'cst':'US/Central','cuba':'Cuba','est':'US/Eastern','egypt':'Egypt', | def info(self,t=None): idx=self.index(t)[0] zs =self.az[self.tinfo[idx][2]:] return self.tinfo[idx][0],self.tinfo[idx][1],zs[:find(zs,'\000')] | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
def _findLocalTimeZoneName(isDST): if not daylight: isDST = 0 try: _localzone = _cache._zmap[lower(tzname[isDST])] except: try: _localzone = _cache._zmap[lower(tzname[0])] except: try: if isDST: localzone = altzone else: localzone = timezone offset=(-localzone/(60*60)) majorOffset=int(offset) if majorOffset != 0 : minorOffset=abs(int((offset % majorOffset) * 60.0)) else: minorOffset = 0 m=majorOffset >= 0 and '+' or '' lz='%s%0.02d%0.02d' % (m, majorOffset, minorOffset) _localzone = _cache._zmap[lower('GMT%s' % lz)] except: _localzone = '' return _localzone def _calcSD(t): dd = t + EPOCH - 86400.0 d = dd / 86400.0 s = d - math.floor(d) return s, d def _calcDependentSecond(tz, t): fset = _tzoffset(tz, t) return fset + long(math.floor(t)) + long(EPOCH) - 86400L def _calcDependentSecond2(yr,mo,dy,hr,mn,sc): ss = int(hr) * 3600 + int(mn) * 60 + int(sc) x = long(_julianday(yr,mo,dy)-jd1901) * 86400 + ss return x def _calcIndependentSecondEtc(tz, x, ms): fsetAtEpoch = _tzoffset(tz, 0.0) nearTime = x - fsetAtEpoch - long(EPOCH) + 86400L + ms fset = long(_tzoffset(tz, nearTime)) x_adjusted = x - fset + ms d = x_adjusted / 86400.0 t = x_adjusted - long(EPOCH) + 86400L millis = (x + 86400 - fset) * 1000 + \ long(ms * 1000.0) - long(EPOCH * 1000.0) s = d - math.floor(d) return s,d,t,millis def _calcHMS(x, ms): hr = x / 3600 x = x - hr * 3600 mn = x / 60 sc = x - mn * 60 + ms return hr,mn,sc def _calcYMDHMS(x, ms): yr,mo,dy=_calendarday(x / 86400 + jd1901) x = int(x - (x / 86400) * 86400) hr = x / 3600 x = x - hr * 3600 mn = x / 60 sc = x - mn * 60 + ms return yr,mo,dy,hr,mn,sc def _julianday(yr,mo,dy): y,m,d=long(yr),long(mo),long(dy) if m > 12L: y=y+m/12L m=m%12L elif m < 1L: m=-m y=y-m/12L-1L m=12L-m%12L if y > 0L: yr_correct=0L else: yr_correct=3L if m < 3L: y, m=y-1L,m+12L if y*10000L+m*100L+d > 15821014L: b=2L-y/100L+y/400L else: b=0L return (1461L*y-yr_correct)/4L+306001L*(m+1L)/10000L+d+1720994L+b def _calendarday(j): j=long(j) if(j < 2299160L): b=j+1525L else: a=(4L*j-7468861L)/146097L b=j+1526L+a-a/4L c=(20L*b-2442L)/7305L d=1461L*c/4L e=10000L*(b-d)/306001L dy=int(b-d-306001L*e/10000L) mo=(e < 14L) and int(e-1L) or int(e-13L) yr=(mo > 2) and (c-4716L) or (c-4715L) return int(yr),int(mo),int(dy) def _tzoffset(tz, t): try: return DateTime._tzinfo[tz].info(t)[0] except: if numericTimeZoneMatch(tz) > 0: return atoi(tz[1:3])*3600+atoi(tz[3:5])*60 else: return 0 def safegmtime(t): '''gmtime with a safety zone.''' try: t_int = int(t) except OverflowError: raise 'TimeError', 'The time %f is beyond the range ' \ 'of this Python implementation.' % float(t) rval = gmtime(t_int) return rval def safelocaltime(t): '''localtime with a safety zone.''' try: t_int = int(t) except OverflowError: raise 'TimeError', 'The time %f is beyond the range ' \ 'of this Python implementation.' % float(t) rval = localtime(t_int) return rval | def __getitem__(self,k): try: n=self._zmap[lower(k)] except KeyError: if numericTimeZoneMatch(k) <= 0: raise 'DateTimeError','Unrecognized timezone: %s' % k return k try: return self._d[n] except KeyError: z=self._d[n]=_timezone(self._db[n]) return z | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
|
t,tz=time(),self._localzone ms=(t-int(t)) yr,mo,dy,hr,mn,sc=gmtime(int(t))[:6] s=(hr/24.0+mn/1440.0+(sc+ms)/86400.0) d=(self._julianday(yr,mo,dy)-jd1901)+s yr,mo,dy,hr,mn,sc=localtime(t)[:6] | t = time() lt = safelocaltime(t) tz = self.localZone(lt) ms = (t - math.floor(t)) s,d = _calcSD(t) yr,mo,dy,hr,mn,sc=lt[:6] | def __init__(self,*args): """Return a new date-time object | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
def __init__(self,*args): """Return a new date-time object | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
||
ms=(t-int(t)) yr,mo,dy,hr,mn,sc=gmtime(t)[:6] s=(hr/24.0+mn/1440.0+(sc+ms)/86400.0) d=(self._julianday(yr,mo,dy)-jd1901)+s x=d+(self._tzinfo[tz].info(t)[0]/86400.0) yr,mo,dy=self._calendarday(x+jd1901) x=(x-int(x))*86400.0 hr=int(x/3600) x=x-(hr*3600) mn=int(x/60) sc=x-(mn*60) | ms=(t-math.floor(t)) s,d = _calcSD(t) x = _calcDependentSecond(tz, t) yr,mo,dy,hr,mn,sc = _calcYMDHMS(x, ms) | def __init__(self,*args): """Return a new date-time object | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
try: tz=self._tzinfo._zmap[lower(tz)] except KeyError: if numericTimeZoneMatch(tz) <= 0: raise self.DateTimeError, 'Invalid date: %s' % arg | def __init__(self,*args): """Return a new date-time object | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
|
s=(hr/24.0+mn/1440.0+sc/86400.0) d=(self._julianday(yr,mo,dy)-jd1901)+s t=(d*86400.0)-EPOCH+86400.0 try: a=self._tzinfo[tz].info(t)[0] except: if numericTimeZoneMatch(tz) > 0: a=atoi(tz[1:3])*3600+atoi(tz[3:5])*60 d,t=d-(a/86400.0),t-a | ms = sc - math.floor(sc) x = _calcDependentSecond2(yr,mo,dy,hr,mn,sc) if tz: try: tz=self._tzinfo._zmap[lower(tz)] except KeyError: if numericTimeZoneMatch(tz) <= 0: raise self.DateTimeError, \ 'Unknown time zone in date: %s' % arg else: tz = self._calcTimezoneName(x, ms) s,d,t,millisecs = _calcIndependentSecondEtc(tz, x, ms) | def __init__(self,*args): """Return a new date-time object | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
t,tz=arg,self._localzone ms=(t-int(t)) yr,mo,dy,hr,mn,sc=gmtime(int(t))[:6] s=(hr/24.0+mn/1440.0+(sc+ms)/86400.0) d=(self._julianday(yr,mo,dy)-jd1901)+s yr,mo,dy,hr,mn,sc=localtime(t)[:6] | t = arg lt = safelocaltime(t) tz = self.localZone(lt) ms=(t-math.floor(t)) s,d = _calcSD(t) yr,mo,dy,hr,mn,sc=lt[:6] | def __init__(self,*args): """Return a new date-time object | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
ms=(t-int(t)) | ms = (t - math.floor(t)) | def __init__(self,*args): """Return a new date-time object | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
yr,mo,dy,hr,mn,sc=gmtime(t)[:6] s=(hr/24.0+mn/1440.0+(sc+ms)/86400.0) d=(self._julianday(yr,mo,dy)-jd1901)+s x=d+(self._tzinfo[tz].info(t)[0]/86400.0) yr,mo,dy=self._calendarday(x+jd1901) x=(x-int(x))*86400.0 hr=int(x/3600) x=x-(hr*3600) mn=int(x/60) sc=x-(mn*60) if(hr==23 and mn==59 and sc>59.999): hr,mn,sc=0,0,0.0 else: if hr<0: hr=23+hr if mn<0: mn=59+mn if sc<0: if (sc-int(sc)>=0.999): sc=round(sc) sc=59+sc | s,d = _calcSD(t) x = _calcDependentSecond(tz, t) yr,mo,dy,hr,mn,sc = _calcYMDHMS(x, ms) | def __init__(self,*args): """Return a new date-time object | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
tz=self._localzone | t = time() lt = safelocaltime(t) tz = self.localZone(lt) | def __init__(self,*args): """Return a new date-time object | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
d=(self._julianday(yr,1,0)-jd1901)+jul yr,mo,dy=self._calendarday(d+jd1901) x=(d-int(d))*86400.0 hr=int(x/3600) x=x-(hr*3600) mn=int(x/60) sc=x-(mn*60) if(hr==23 and mn==59 and sc>59.999): hr,mn,sc=0,0,0.0 else: if hr<0: hr=23+hr if mn<0: mn=59+mn if sc<0: if (sc-int(sc)>=0.999): sc=round(sc) sc=59+sc d=d-(self._tzinfo[tz].info(t)[0]/86400.0) s=d-int(d) t=(d*86400.0)-EPOCH | d=(_julianday(yr,1,0)-jd1901)+jul x_float = d * 86400.0 x_floor = math.floor(x_float) ms = x_float - x_floor x = long(x_floor) yr,mo,dy,hr,mn,sc = _calcYMDHMS(x, ms) s,d,t,millisecs = _calcIndependentSecondEtc(tz, x, ms) | def __init__(self,*args): """Return a new date-time object | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
if not tz: tz=self._localzone else: tz=self._tzinfo._zmap[lower(tz)] leap=yr%4==0 and (yr%100!=0 or yr%400==0) s=(hr/24.0+mn/1440.0+sc/86400.0) d=(self._julianday(yr,mo,dy)-jd1901)+s t=(d*86400.0)-EPOCH+86400.0 a=self._tzinfo[tz].info(t)[0] d,t=d-(a/86400.0),t-a | leap = (yr % 4 == 0) and (yr % 100 != 0 or yr % 400 == 0) x = _calcDependentSecond2(yr,mo,dy,hr,mn,sc) ms = sc - math.floor(sc) if tz: try: tz=self._tzinfo._zmap[lower(tz)] except KeyError: if numericTimeZoneMatch(tz) <= 0: raise self.DateTimeError, \ 'Unknown time zone: %s' % tz else: tz = self._calcTimezoneName(x, ms) s,d,t,millisecs = _calcIndependentSecondEtc(tz, x, ms) | def __init__(self,*args): """Return a new date-time object | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
self._dayoffset=dx=int((self._julianday(yr,mo,dy)+2L)%7) | self._dayoffset=dx=int((_julianday(yr,mo,dy)+2L)%7) | def __init__(self,*args): """Return a new date-time object | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
if millisecs is None: millisecs = long(math.floor(t * 1000.0)) self._millis = millisecs | def __init__(self,*args): """Return a new date-time object | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
|
try: _localzone=_cache._zmap[lower(tzname[0])] except: | _localzone0 = _findLocalTimeZoneName(0) _localzone1 = _findLocalTimeZoneName(1) _multipleZones = (_localzone0 != _localzone1) _isDST = localtime(time())[8] _localzone = _isDST and _localzone1 or _localzone0 _tzinfo = _cache() def localZone(self, ltm=None): '''Returns the time zone on the given date. The time zone can change according to daylight savings.''' if not DateTime._multipleZones: return DateTime._localzone0 if ltm == None: ltm = localtime(time()) isDST = ltm[8] lz = isDST and DateTime._localzone1 or DateTime._localzone0 return lz def _calcTimezoneName(self, x, ms): if not DateTime._multipleZones: return DateTime._localzone0 fsetAtEpoch = _tzoffset(DateTime._localzone0, 0.0) nearTime = x - fsetAtEpoch - long(EPOCH) + 86400L + ms | def __init__(self,*args): """Return a new date-time object | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
t=time() localzone=float(int(mktime(gmtime(t))) - int(t)) offset=(-localzone/(60*60)) majorOffset=int(offset) if majorOffset != 0 : minorOffset=abs(int((offset % majorOffset) * 60.0)) else: minorOffset = 0 m=majorOffset >= 0 and '+' or '' lz='%s%0.02d%0.02d' % (m, majorOffset, minorOffset) _localzone=_cache._zmap[lower('GMT%s' % lz)] except: _localzone='' _tzinfo =_cache() | ltm = safelocaltime(nearTime) except: yr,mo,dy,hr,mn,sc = _calcYMDHMS(x, 0) yr = ((yr - 1970) % 28) + 1970 x = _calcDependentSecond2(yr,mo,dy,hr,mn,sc) nearTime = x - fsetAtEpoch - long(EPOCH) + 86400L + ms ltm = safelocaltime(nearTime) tz = self.localZone(ltm) return tz | def __init__(self,*args): """Return a new date-time object | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
sp=split(strip(string)) | string = strip(string) sp=split(string) | def _parse(self,string): # Parse date-time components from a string month=year=tz=tm=None spaces =self.space_chars intpat =self.int_pattern fltpat =self.flt_pattern wordpat =self.name_pattern delimiters =self.delimiters MonthNumbers =self._monthmap DayOfWeekNames=self._daymap ValidZones =self._tzinfo._zidx TimeModifiers =['am','pm'] | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
else: tz=self._localzone | else: tz = None | def _parse(self,string): # Parse date-time components from a string month=year=tz=tm=None spaces =self.space_chars intpat =self.int_pattern fltpat =self.flt_pattern wordpat =self.name_pattern delimiters =self.delimiters MonthNumbers =self._monthmap DayOfWeekNames=self._daymap ValidZones =self._tzinfo._zidx TimeModifiers =['am','pm'] | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
if day is None: raise self.SyntaxError, string | if day is None: year,month,day = localtime(time())[:3] | def _parse(self,string): # Parse date-time components from a string month=year=tz=tm=None spaces =self.space_chars intpat =self.int_pattern fltpat =self.flt_pattern wordpat =self.name_pattern delimiters =self.delimiters MonthNumbers =self._monthmap DayOfWeekNames=self._daymap ValidZones =self._tzinfo._zidx TimeModifiers =['am','pm'] | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
hr=int(t/3600) t=t-hr*3600 mn=int(t/60) sc=t-mn*60 tz=tz or self._localzone | t_int = long(math.floor(t)) hr,mn,sc = _calcHMS(t_int, t - t_int) if not tz: x = _calcDependentSecond2(year,month,day,hr,mn,sc) tz = self._calcTimezoneName(x, t - t_int) | def _parse(self,string): # Parse date-time components from a string month=year=tz=tm=None spaces =self.space_chars intpat =self.int_pattern fltpat =self.flt_pattern wordpat =self.name_pattern delimiters =self.delimiters MonthNumbers =self._monthmap DayOfWeekNames=self._daymap ValidZones =self._tzinfo._zidx TimeModifiers =['am','pm'] | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
def _parse(self,string): # Parse date-time components from a string month=year=tz=tm=None spaces =self.space_chars intpat =self.int_pattern fltpat =self.flt_pattern wordpat =self.name_pattern delimiters =self.delimiters MonthNumbers =self._monthmap DayOfWeekNames=self._daymap ValidZones =self._tzinfo._zidx TimeModifiers =['am','pm'] | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
||
def _julianday(self,yr,mo,dy): y,m,d=long(yr),long(mo),long(dy) if m > 12L: y=y+m/12L m=m%12L elif m < 1L: m=-m y=y-m/12L-1L m=12L-m%12L if y > 0L: yr_correct=0L else: yr_correct=3L if m < 3L: y, m=y-1L,m+12L if y*10000L+m*100L+d > 15821014L: b=2L-y/100L+y/400L else: b=0L return (1461L*y-yr_correct)/4L+306001L*(m+1L)/10000L+d+1720994L+b def _calendarday(self,j): j=long(j) if(j < 2299160L): b=j+1525L else: a=(4L*j-7468861L)/146097L b=j+1526L+a-a/4L c=(20L*b-2442L)/7305L d=1461L*c/4L e=10000L*(b-d)/306001L dy=int(b-d-306001L*e/10000L) mo=(e < 14L) and int(e-1L) or int(e-13L) yr=(mo > 2) and (c-4716L) or (c-4715L) return int(yr),int(mo),int(dy) | def _julianday(self,yr,mo,dy): y,m,d=long(yr),long(mo),long(dy) if m > 12L: y=y+m/12L m=m%12L elif m < 1L: m=-m y=y-m/12L-1L m=12L-m%12L if y > 0L: yr_correct=0L else: yr_correct=3L if m < 3L: y, m=y-1L,m+12L if y*10000L+m*100L+d > 15821014L: b=2L-y/100L+y/400L else: b=0L return (1461L*y-yr_correct)/4L+306001L*(m+1L)/10000L+d+1720994L+b | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
|
if (t>0 and ((t/86400.0) < 24837)): yr,mo,dy,hr,mn,sc=gmtime(t+self._tzinfo[tz].info(t)[0])[:6] | millis = self.millis() try: yr,mo,dy,hr,mn,sc=safegmtime(t+_tzoffset(tz, t))[:6] | def toZone(self, z): """Return a DateTime with the value as the current object, represented in the indicated timezone.""" t,tz=self._t,self._tzinfo._zmap[lower(z)] if (t>0 and ((t/86400.0) < 24837)): # Try to cheat and use time module for speed... yr,mo,dy,hr,mn,sc=gmtime(t+self._tzinfo[tz].info(t)[0])[:6] sc=self._second return self.__class__(yr,mo,dy,hr,mn,sc,tz,t,self._d,self.time) d=self._d+(self._tzinfo[tz].info(t)[0]/86400.0) yr,mo,dy=self._calendarday((d+jd1901)) s=(d-int(d))*86400.0 hr=int(s/3600) s=s-(hr*3600) mn=int(s/60) sc=s-(mn*60) if(hr==23 and mn==59 and sc>59.999): # Fix formatting for positives hr,mn,sc=0,0,0.0 else: # Fix formatting for negatives if hr<0: hr=23+hr if mn<0: mn=59+mn if sc<0: if (sc-int(sc)>=0.999): sc=round(sc) sc=59+sc return self.__class__(yr,mo,dy,hr,mn,sc,tz,t,self._d,self.time) | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
return self.__class__(yr,mo,dy,hr,mn,sc,tz,t,self._d,self.time) d=self._d+(self._tzinfo[tz].info(t)[0]/86400.0) yr,mo,dy=self._calendarday((d+jd1901)) s=(d-int(d))*86400.0 hr=int(s/3600) s=s-(hr*3600) mn=int(s/60) sc=s-(mn*60) if(hr==23 and mn==59 and sc>59.999): hr,mn,sc=0,0,0.0 else: if hr<0: hr=23+hr if mn<0: mn=59+mn if sc<0: if (sc-int(sc)>=0.999): sc=round(sc) sc=59+sc return self.__class__(yr,mo,dy,hr,mn,sc,tz,t,self._d,self.time) | return self.__class__(yr,mo,dy,hr,mn,sc,tz,t, self._d,self.time,millis) except: tzdiff = _tzoffset(tz, t) - _tzoffset(self._tz, t) if tzdiff == 0: return self sc = self._second ms = sc - math.floor(sc) x = _calcDependentSecond2(self._year, self._month, self._day, self._hour, self._minute, sc) x_new = x + tzdiff yr,mo,dy,hr,mn,sc = _calcYMDHMS(x_new, ms) return self.__class__(yr,mo,dy,hr,mn,sc,tz,t, self._d,self.time,millis) | def toZone(self, z): """Return a DateTime with the value as the current object, represented in the indicated timezone.""" t,tz=self._t,self._tzinfo._zmap[lower(z)] if (t>0 and ((t/86400.0) < 24837)): # Try to cheat and use time module for speed... yr,mo,dy,hr,mn,sc=gmtime(t+self._tzinfo[tz].info(t)[0])[:6] sc=self._second return self.__class__(yr,mo,dy,hr,mn,sc,tz,t,self._d,self.time) d=self._d+(self._tzinfo[tz].info(t)[0]/86400.0) yr,mo,dy=self._calendarday((d+jd1901)) s=(d-int(d))*86400.0 hr=int(s/3600) s=s-(hr*3600) mn=int(s/60) sc=s-(mn*60) if(hr==23 and mn==59 and sc>59.999): # Fix formatting for positives hr,mn,sc=0,0,0.0 else: # Fix formatting for negatives if hr<0: hr=23+hr if mn<0: mn=59+mn if sc<0: if (sc-int(sc)>=0.999): sc=round(sc) sc=59+sc return self.__class__(yr,mo,dy,hr,mn,sc,tz,t,self._d,self.time) | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
return gmtime(t+self._tzinfo[self._tz].info(t)[0])[0]==self._year | return safegmtime(t+_tzoffset(self._tz, t))[0]==self._year | def isCurrentYear(self): """Return true if this object represents a date/time that falls within the current year, in the context of this object\'s timezone representation""" t=time() return gmtime(t+self._tzinfo[self._tz].info(t)[0])[0]==self._year | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
return gmtime(t+self._tzinfo[self._tz].info(t)[0])[1]==self._month | return safegmtime(t+_tzoffset(self._tz, t))[1]==self._month | def isCurrentMonth(self): """Return true if this object represents a date/time that falls within the current month, in the context of this object\'s timezone representation""" t=time() return gmtime(t+self._tzinfo[self._tz].info(t)[0])[1]==self._month | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
return gmtime(t+self._tzinfo[self._tz].info(t)[0])[2]==self._day | return safegmtime(t+_tzoffset(self._tz, t))[2]==self._day | def isCurrentDay(self): """Return true if this object represents a date/time that falls within the current day, in the context of this object\'s timezone representation""" t=time() return gmtime(t+self._tzinfo[self._tz].info(t)[0])[2]==self._day | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
return gmtime(t+self._tzinfo[self._tz].info(t)[0])[3]==self._hour | return safegmtime(t+_tzoffset(self._tz, t))[3]==self._hour | def isCurrentHour(self): """Return true if this object represents a date/time that falls within the current hour, in the context of this object\'s timezone representation""" t=time() return gmtime(t+self._tzinfo[self._tz].info(t)[0])[3]==self._hour | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
return gmtime(t+self._tzinfo[self._tz].info(t)[0])[4]==self._minute | return safegmtime(t+_tzoffset(self._tz, t))[4]==self._minute | def isCurrentMinute(self): """Return true if this object represents a date/time that falls within the current minute, in the context of this object\'s timezone representation""" t=time() return gmtime(t+self._tzinfo[self._tz].info(t)[0])[4]==self._minute | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
or time module style time.""" try: return (self._d > t._d) | or time module style time. Revised to give more correct results through comparison of long integer milliseconds. """ try: return (self.millis() > t.millis()) | def greaterThan(self,t): """Compare this DateTime object to another DateTime object OR a floating point number such as that which is returned by the python time module. Returns true if the object represents a date/time greater than the specified DateTime or time module style time.""" try: return (self._d > t._d) except: return (self._t > t) | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
specified DateTime or time module style time.""" try: return (self._d >= t._d) | specified DateTime or time module style time. Revised to give more correct results through comparison of long integer milliseconds. """ try: return (self.millis() >= t.millis()) | def greaterThanEqualTo(self,t): """Compare this DateTime object to another DateTime object OR a floating point number such as that which is returned by the python time module. Returns true if the object represents a date/time greater than or equal to the specified DateTime or time module style time.""" try: return (self._d >= t._d) except: return (self._t >= t) | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
or time module style time.""" try: return (self._d == t._d) | or time module style time. Revised to give more correct results through comparison of long integer milliseconds. """ try: return (self.millis() == t.millis()) | def equalTo(self,t): """Compare this DateTime object to another DateTime object OR a floating point number such as that which is returned by the python time module. Returns true if the object represents a date/time equal to the specified DateTime or time module style time.""" try: return (self._d == t._d) except: return (self._t == t) | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
or time module style time.""" try: return (self._d != t._d) | or time module style time. Revised to give more correct results through comparison of long integer milliseconds. """ try: return (self.millis() != t.millis()) | def notEqualTo(self,t): """Compare this DateTime object to another DateTime object OR a floating point number such as that which is returned by the python time module. Returns true if the object represents a date/time not equal to the specified DateTime or time module style time.""" try: return (self._d != t._d) except: return (self._t != t) | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
or time module style time.""" try: return (self._d < t._d) | or time module style time. Revised to give more correct results through comparison of long integer milliseconds. """ try: return (self.millis() < t.millis()) | def lessThan(self,t): """Compare this DateTime object to another DateTime object OR a floating point number such as that which is returned by the python time module. Returns true if the object represents a date/time less than the specified DateTime or time module style time.""" try: return (self._d < t._d) except: return (self._t < t) | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
DateTime or time module style time.""" try: return (self._d <= t._d) | DateTime or time module style time. Revised to give more correct results through comparison of long integer milliseconds. """ try: return (self.millis() <= t.millis()) | def lessThanEqualTo(self,t): """Compare this DateTime object to another DateTime object OR a floating point number such as that which is returned by the python time module. Returns true if the object represents a date/time less than or equal to the specified DateTime or time module style time.""" try: return (self._d <= t._d) except: return (self._t <= t) | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
d=int(self._d+(self._tzinfo[self._tz].info(self._t)[0]/86400.0)) return int((d+jd1901)-self._julianday(self._year,1,0)) | d=int(self._d+(_tzoffset(self._tz, self._t)/86400.0)) return int((d+jd1901)-_julianday(self._year,1,0)) | def dayOfYear(self): """Return the day of the year, in context of the timezone representation of the object""" d=int(self._d+(self._tzinfo[self._tz].info(self._t)[0]/86400.0)) return int((d+jd1901)-self._julianday(self._year,1,0)) | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
d,t,tz=(self._d+o),(self._t+(o*86400.0)),self._tz x=d+(self._tzinfo[tz].info(t)[0]/86400.0) yr,mo,dy=self._calendarday((x+jd1901)) s=(x-int(x))*86400.0 hr=int(s/3600) s=s-(hr*3600) mn=int(s/60) s=s-(mn*60) return self.__class__(yr,mo,dy,hr,mn,s,self._tz,t,d,(d-int(d))) | tz = self._tz t = (self._t + (o*86400.0)) d = (self._d + o) s = d - math.floor(d) ms = t - math.floor(t) x = _calcDependentSecond(tz, t) yr,mo,dy,hr,mn,sc = _calcYMDHMS(x, ms) return self.__class__(yr,mo,dy,hr,mn,sc,self._tz,t,d,s) | def __add__(self,other): """A DateTime may be added to a number and a number may be added to a DateTime; two DateTimes cannot be added.""" if hasattr(other,'_t'): raise self.DateTimeError,'Cannot add two DateTimes' o=float(other) d,t,tz=(self._d+o),(self._t+(o*86400.0)),self._tz x=d+(self._tzinfo[tz].info(t)[0]/86400.0) yr,mo,dy=self._calendarday((x+jd1901)) s=(x-int(x))*86400.0 hr=int(s/3600) s=s-(hr*3600) mn=int(s/60) s=s-(mn*60) return self.__class__(yr,mo,dy,hr,mn,s,self._tz,t,d,(d-int(d))) | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
return '%4.4d/%2.2d/%2.2d %2.2d:%2.2d:%g %s' % ( y,m,d,h,mn,s,t) else: return '%4.4d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d %s' % ( y,m,d,h,mn,s,t) | try: subsec = split('%g' % s, '.')[1] return '%4.4d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d.%s %s' % ( y,m,d,h,mn,s,subsec,t) except: pass return '%4.4d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d %s' % ( y,m,d,h,mn,s,t) return '%4.4d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d %s' % ( y,m,d,h,mn,s,t) | def __str__(self): """Convert a DateTime to a string.""" y,m,d =self._year,self._month,self._day h,mn,s,t=self._hour,self._minute,self._second,self._tz if(h+mn+s): if (s-int(s))> 0.0001: return '%4.4d/%2.2d/%2.2d %2.2d:%2.2d:%g %s' % ( y,m,d,h,mn,s,t) else: return '%4.4d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d %s' % ( y,m,d,h,mn,s,t) else: return '%4.4d/%2.2d/%2.2d' % (y,m,d) | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
try: return cmp(self._d,obj._d) | try: return cmp(self.millis(), obj.millis()) | def __cmp__(self,obj): """Compare a DateTime with another DateTime object, or a float such as those returned by time.time(). | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
return int(self._t) | return int(self.millis() / 1000) | def __int__(self): """Convert to an integer number of seconds since the epoch (gmt)""" return int(self._t) | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
return long(self._t) | return long(self.millis() / 1000) | def __long__(self): """Convert to a long-int number of seconds since the epoch (gmt)""" return long(self._t) | befc802c3f8f99550f565b61586bed86f5a03c2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/befc802c3f8f99550f565b61586bed86f5a03c2d/DateTime.py |
elif lower(strip(b))[:6]=='<html>': | elif lower(strip(b))[:6]=='<html>' or lower(strip(b))[:14]=='<!doctype html': | def exception(self, fatal=0, info=None, absuri_match=regex.compile( "^" "\(/\|\([a-zA-Z0-9+.-]+:\)\)" "[^\000- \"\\#<>]*" "\\(#[^\000- \"\\#<>]*\\)?" "$" ).match, tag_search=regex.compile('[a-zA-Z]>').search, ): if type(info) is type(()) and len(info)==3: t,v,tb = info else: t,v,tb = sys.exc_info() | afc624a5d1244a241f448bafd5586a8f9c8c6dd0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/afc624a5d1244a241f448bafd5586a8f9c8c6dd0/HTTPResponse.py |
Add an external method to an ObjectManager. | Add an external method to an 'ObjectManager'. | def manage_addExternalMethod(self, id, title, module, function): """ Add an external method to an ObjectManager. In addition to the standard object-creation arguments, 'id' and title, the following arguments are defined: function -- The name of the python function. This can be a an ordinary Python function, or a bound method. module -- The name of the file containing the function definition. The module normally resides in the 'Extensions' directory, however, the file name may have a prefix of 'product.', indicating that it should be found in a product directory. For example, if the module is: 'ACMEWidgets.foo', then an attempt will first be made to use the file 'lib/python/Products/ACMEWidgets/Extensions/foo.py'. If this failes, then the file 'Extensions/ACMEWidgets.foo.py' will be used. """ | a6e256ebfbc53fee66f44c8c1d918e15db6c4530 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/a6e256ebfbc53fee66f44c8c1d918e15db6c4530/ExternalMethod.py |
Web-callable functions that encapsulate external python functions. | Web-callable functions that encapsulate external Python functions. | def manage_addExternalMethod(self, id, title, module, function): """ Add an external method to an ObjectManager. In addition to the standard object-creation arguments, 'id' and title, the following arguments are defined: function -- The name of the python function. This can be a an ordinary Python function, or a bound method. module -- The name of the file containing the function definition. The module normally resides in the 'Extensions' directory, however, the file name may have a prefix of 'product.', indicating that it should be found in a product directory. For example, if the module is: 'ACMEWidgets.foo', then an attempt will first be made to use the file 'lib/python/Products/ACMEWidgets/Extensions/foo.py'. If this failes, then the file 'Extensions/ACMEWidgets.foo.py' will be used. """ | a6e256ebfbc53fee66f44c8c1d918e15db6c4530 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/a6e256ebfbc53fee66f44c8c1d918e15db6c4530/ExternalMethod.py |
Change the external method | Change the External Method. | def manage_edit(self, title, module, function, REQUEST=None): """ Change the external method | a6e256ebfbc53fee66f44c8c1d918e15db6c4530 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/a6e256ebfbc53fee66f44c8c1d918e15db6c4530/ExternalMethod.py |
Call an ExternalMethod | Call the External Method. | def __call__(self, *args, **kw): | a6e256ebfbc53fee66f44c8c1d918e15db6c4530 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/a6e256ebfbc53fee66f44c8c1d918e15db6c4530/ExternalMethod.py |
def testEmptyLists(self): self.assertEqual(len(mass_weightedIntersection([])), 0) self.assertEqual(len(mass_weightedUnion([])), 0) def testIdentity(self): t = IIBTree([(1, 2)]) b = IIBucket([(1, 2)]) for x in t, b: for func in mass_weightedUnion, mass_weightedIntersection: result = func([(x, 1)]) self.assertEqual(len(result), 1) self.assertEqual(list(result.items()), list(x.items())) def testScalarMultiply(self): t = IIBTree([(1, 2), (2, 3), (3, 4)]) allkeys = [1, 2, 3] b = IIBucket(t) for x in t, b: self.assertEqual(list(x.keys()), allkeys) for func in mass_weightedUnion, mass_weightedIntersection: for factor in 0, 1, 5, 10: result = func([(x, factor)]) self.assertEqual(allkeys, list(result.keys())) for key in x.keys(): self.assertEqual(x[key] * factor, result[key]) def testPairs(self): t1 = IIBTree([(1, 10), (3, 30), (7, 70)]) t2 = IIBTree([(3, 30), (5, 50), (7, 7), (9, 90)]) allkeys = [1, 3, 5, 7, 9] b1 = IIBucket(t1) b2 = IIBucket(t2) for x in t1, t2, b1, b2: for key in x.keys(): self.assertEqual(key in allkeys, 1) for y in t1, t2, b1, b2: for w1, w2 in (0, 0), (1, 10), (10, 1), (2, 3): expected = [] for key in allkeys: if x.has_key(key) or y.has_key(key): result = x.get(key, 0) * w1 + y.get(key, 0) * w2 expected.append((key, result)) expected.sort() got = mass_weightedUnion([(x, w1), (y, w2)]) self.assertEqual(expected, list(got.items())) got = mass_weightedUnion([(y, w2), (x, w1)]) self.assertEqual(expected, list(got.items())) expected = [] for key in allkeys: if x.has_key(key) and y.has_key(key): result = x.get(key, 0) * w1 + y.get(key, 0) * w2 expected.append((key, result)) expected.sort() got = mass_weightedIntersection([(x, w1), (y, w2)]) self.assertEqual(expected, list(got.items())) got = mass_weightedIntersection([(y, w2), (x, w1)]) self.assertEqual(expected, list(got.items())) def test_suite(): return makeSuite(TestSetOps) if __name__=="__main__": main(defaultTest='test_suite') | def mass_weightedUnion(L): "A list of (mapping, weight) pairs -> their weightedUnion IIBTree." if not L: return IIBTree() if len(L) == 1: x, weight = L[0] dummy, result = weightedUnion(IIBTree(), x, 1, weight) return result assert len(L) > 1 merge = NBest(len(L)) for x, weight in L: merge.add((x, weight), len(x)) while len(merge) > 1: (x, wx), dummy = merge.pop_smallest() (y, wy), dummy = merge.pop_smallest() dummy, z = weightedUnion(x, y, wx, wy) merge.add((z, 1), len(z)) (result, weight), dummy = merge.pop_smallest() return result | def testEmptyLists(self): self.assertEqual(len(mass_weightedIntersection([])), 0) self.assertEqual(len(mass_weightedUnion([])), 0) | 08fe38f47371237d87218791877ebd7fb0062cdb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/08fe38f47371237d87218791877ebd7fb0062cdb/SetOps.py |
class Navigation: | class Navigation(ExtensionClass.Base): | def tabs_path_info(self, script, path): url=script out=[] while path[:1]=='/': path=path[1:] while path[-1:]=='/': path=path[:-1] while script[:1]=='/': script=script[1:] while script[-1:]=='/': script=script[:-1] path=split(path,'/')[:-1] if script: path=[script]+path if not path: return '' script='' last=path[-1] del path[-1] for p in path: script="%s/%s" % (script, p) out.append('<a href="%s/manage_workspace">%s</a>' % (script, p)) out.append(last) return join(out,' / ') | 5b3808aa090f89f09652d7fb6cb416be5716fbd0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/5b3808aa090f89f09652d7fb6cb416be5716fbd0/Management.py |
pc.__propset_attrs__=tuple(map(lambda o: o[0], self._objects)) | pc.__propset_attrs__=tuple(map(lambda o: o['id'], self._objects)) | def _delOb(self, id): delattr(self, id) pc=self.aq_inner.aq_parent.aq_parent._zclass_propertysheets_class delattr(pc,id) pc.__propset_attrs__=tuple(map(lambda o: o[0], self._objects)) rclass(pc) | d137d925e99c4855373937116bc7b8c83fe85e87 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/d137d925e99c4855373937116bc7b8c83fe85e87/Property.py |
""") | (%s)""" % repr(self)) | def __getstate__(self): raise SystemError, ( """This object was originally created by a product that is no longer installed. It cannot be updated. """) | 86c71d1641382e5e9027aefc265438a9a4ef225f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/86c71d1641382e5e9027aefc265438a9a4ef225f/Uninstalled.py |
'manage_tabs','manage_propertiesForm','manage_UndoForm', 'objectIds', 'objectValues', 'objectItems','hasProperty',)), | 'manage_tabs','manage_propertiesForm','manage_UndoForm',)), | def manage_addFolder(self,id,title='',createPublic=0,createUserF=0, REQUEST=None): """Add a new Folder object with id *id*. If the 'createPublic' and 'createUserF' parameters are set to any true value, an 'index_html' and a 'UserFolder' objects are created respectively in the new folder. """ i=self.folderClass()() i.id=id i.title=title self._setObject(id,i) if createUserF: i.manage_addUserFolder() if createPublic: i.manage_addDocument(id='index_html',title='') if REQUEST: return self.manage_main(self,REQUEST,update_menu=1) | 4f6c4876adcf78294316c1d1879b8a99f3edbb9a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4f6c4876adcf78294316c1d1879b8a99f3edbb9a/Folder.py |
"""Return the object in the format used in the HTML4.0 specification, one of the standard forms in ISO8601. See | """Return the object in the format used in the HTML4.0 specification, one of the standard forms in ISO8601. See | def HTML4(self): """Return the object in the format used in the HTML4.0 specification, one of the standard forms in ISO8601. See http://www.w3.org/TR/NOTE-datetime | 961c6ad8a6a9fb51f2b1fa241e796c00c4b91e41 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/961c6ad8a6a9fb51f2b1fa241e796c00c4b91e41/DateTime.py |
'multiple selection': field2lines, | def convert_unicode(self,v): return field2utext.convert_unicode(v).split('\n') | 36a4864bf4dc3e627735ccc6c8297f772ac57e2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/36a4864bf4dc3e627735ccc6c8297f772ac57e2d/Converters.py |
|
__import_error__=None | import_error_=None | def _canCopy(self, op=0): return 0 | 4467942d44ddb03545adf92a2151069efb0f9e20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4467942d44ddb03545adf92a2151069efb0f9e20/Product.py |
if hasattr(productp, '__import_error__'): ie=productp.__import_error__ | if hasattr(productp, 'import_error_'): ie=productp.import_error_ | def initializeProduct(productp, name, home, app): # Initialize a levered product products=app.Control_Panel.Products if hasattr(productp, '__import_error__'): ie=productp.__import_error__ else: ie=None try: fver=strip(open(home+'/version.txt').read()) except: fver='' old=None try: if ihasattr(products,name): old=getattr(products, name) if (ihasattr(old,'version') and old.version==fver and hasattr(old, '__import_error__') and old.__import_error__==ie): return except: pass try: f=CompressedInputFile(open(home+'/product.dat'),name+' shshsh') meta=cPickle.Unpickler(f).load() product=Globals.Bobobase._jar.import_file(f) product._objects=meta['_objects'] except: f=fver and (" (%s)" % fver) product=Product(name, 'Installed product %s%s' % (name,f)) if old is not None: products._delObject(name) products._setObject(name, product) product.__of__(products)._postCopy(products) product.manage_options=Folder.manage_options product.icon='p_/InstalledProduct_icon' product.version=fver product._distribution=None product.manage_distribution=None product.thisIsAnInstalledProduct=1 if ie: product.import_error_=ie product.title='Broken product %s' % name product.icon='p_/BrokenProduct_icon' product.manage_options=( {'label':'Traceback', 'action':'manage_traceback'}, ) if os.path.exists(os.path.join(home, 'README.txt')): product.manage_options=product.manage_options+( {'label':'README', 'action':'manage_readme'}, ) | 4467942d44ddb03545adf92a2151069efb0f9e20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4467942d44ddb03545adf92a2151069efb0f9e20/Product.py |
hasattr(old, '__import_error__') and old.__import_error__==ie): | hasattr(old, 'import_error_') and old.import_error_==ie): | def initializeProduct(productp, name, home, app): # Initialize a levered product products=app.Control_Panel.Products if hasattr(productp, '__import_error__'): ie=productp.__import_error__ else: ie=None try: fver=strip(open(home+'/version.txt').read()) except: fver='' old=None try: if ihasattr(products,name): old=getattr(products, name) if (ihasattr(old,'version') and old.version==fver and hasattr(old, '__import_error__') and old.__import_error__==ie): return except: pass try: f=CompressedInputFile(open(home+'/product.dat'),name+' shshsh') meta=cPickle.Unpickler(f).load() product=Globals.Bobobase._jar.import_file(f) product._objects=meta['_objects'] except: f=fver and (" (%s)" % fver) product=Product(name, 'Installed product %s%s' % (name,f)) if old is not None: products._delObject(name) products._setObject(name, product) product.__of__(products)._postCopy(products) product.manage_options=Folder.manage_options product.icon='p_/InstalledProduct_icon' product.version=fver product._distribution=None product.manage_distribution=None product.thisIsAnInstalledProduct=1 if ie: product.import_error_=ie product.title='Broken product %s' % name product.icon='p_/BrokenProduct_icon' product.manage_options=( {'label':'Traceback', 'action':'manage_traceback'}, ) if os.path.exists(os.path.join(home, 'README.txt')): product.manage_options=product.manage_options+( {'label':'README', 'action':'manage_readme'}, ) | 4467942d44ddb03545adf92a2151069efb0f9e20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/4467942d44ddb03545adf92a2151069efb0f9e20/Product.py |
text="%s %s %s" % (text, api.SearchableText()) | text="%s %s" % (text, api.SearchableText()) | def SearchableText(self): "The full text of the Help Topic, for indexing purposes" text="%s %s" % (self.title, self.doc) for api in self.apis: text="%s %s %s" % (text, api.SearchableText()) return text | 832f5c636d86bdcb8bef63a1bcffaaeb284b9867 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/832f5c636d86bdcb8bef63a1bcffaaeb284b9867/APIHelpTopic.py |
!='text/html'): raise | !='text/html'): raise t, v, traceback | def zpublisher_exception_hook(published, REQUEST, t, v, traceback): try: if isinstance(t, StringType): if t.lower() in ('unauthorized', 'redirect'): raise else: if t is SystemExit: raise if issubclass(t, ConflictError): # First, we need to close the current connection. We'll # do this by releasing the hold on it. There should be # some sane protocol for this, but for now we'll use # brute force: global conflict_errors conflict_errors = conflict_errors + 1 method_name = REQUEST.get('PATH_INFO', '') err = ('ZODB conflict error at %s ' '(%s conflicts since startup at %s)') LOG(err % (method_name, conflict_errors, startup_time), INFO, '') LOG('Conflict traceback', BLATHER, '', error=sys.exc_info()) raise ZPublisher.Retry(t, v, traceback) if t is ZPublisher.Retry: v.reraise() try: log = aq_acquire(published, '__error_log__', containment=1) except AttributeError: error_log_url = '' else: error_log_url = log.raising((t, v, traceback)) if (getattr(REQUEST.get('RESPONSE', None), '_error_format', '') !='text/html'): raise if (published is None or published is app or type(published) is ListType): # At least get the top-level object published=app.__bobo_traverse__(REQUEST).__of__( RequestContainer(REQUEST)) get_transaction().begin() # Just to be sure. published=getattr(published, 'im_self', published) while 1: f=getattr(published, 'raise_standardErrorMessage', None) if f is None: published=getattr(published, 'aq_parent', None) if published is None: raise t, v, traceback else: break client=published while 1: if getattr(client, 'standard_error_message', None) is not None: break client=getattr(client, 'aq_parent', None) if client is None: raise t, v, traceback if REQUEST.get('AUTHENTICATED_USER', None) is None: REQUEST['AUTHENTICATED_USER']=AccessControl.User.nobody try: f(client, REQUEST, t, v, traceback, error_log_url=error_log_url) except TypeError: # Pre 2.6 call signature f(client, REQUEST, t, v, traceback) finally: traceback=None | 7ec7171d71b58e647c5192aa595209548e07e1cb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/7ec7171d71b58e647c5192aa595209548e07e1cb/startup.py |
return self.manage_cacheParameters(self,REQUEST) | if REQUEST is not None: response=REQUEST['RESPONSE'] response.redirect(REQUEST['URL1']+'/manage_cacheParameters') | def manage_cache_age(self,value,REQUEST): "set cache age" try: v=self._p_jar.getVersion() except: # BoboPOS2: if self._p_jar.db is not Globals.Bobobase._jar.db: raise 'Version Error', ( '''You may not change the database cache age while working in a <em>version</em>''') self._cache_age=Globals.Bobobase._jar.cache.cache_age=value else: if v: self._vcache_age=value self._p_jar.db().setVersionCacheDeactivateAfter(value) else: self._cache_age=value self._p_jar.db().setCacheDeactivateAfter(value) | 93134a644322e3d4768e743498faddead223d85a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/93134a644322e3d4768e743498faddead223d85a/CacheManager.py |
def cache_size(self): try: if self._p_jar.getVersion(): return self._vcache_size except: pass | 93134a644322e3d4768e743498faddead223d85a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/93134a644322e3d4768e743498faddead223d85a/CacheManager.py |
||
return self.manage_cacheParameters(self,REQUEST) | if REQUEST is not None: response=REQUEST['RESPONSE'] response.redirect(REQUEST['URL1']+'/manage_cacheParameters') | def manage_cache_size(self,value,REQUEST): "set cache size" try: v=self._p_jar.getVersion() except: # BoboPOS2: if self._p_jar.db is not Globals.Bobobase._jar.db: raise 'Version Error', ( '''You may not change the database cache size while working in a <em>version</em>''') self._cache_size=Globals.Bobobase._jar.cache.cache_size=value else: if v: self._vcache_size=value self._p_jar.db().setVersionCacheSize(value) else: self._cache_size=value self._p_jar.db().setCacheSize(value) | 93134a644322e3d4768e743498faddead223d85a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/93134a644322e3d4768e743498faddead223d85a/CacheManager.py |
return self.manage_cacheGC(self,REQUEST) | if REQUEST is not None: response=REQUEST['RESPONSE'] response.redirect(REQUEST['URL1']+'/manage_cacheGC') | def manage_full_sweep(self,value,REQUEST): "Perform a full sweep through the cache" try: db=self._p_jar.db() except: # BoboPOS2 Globals.Bobobase._jar.cache.full_sweep(value) else: db.cacheFullSweep(value) | 93134a644322e3d4768e743498faddead223d85a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/93134a644322e3d4768e743498faddead223d85a/CacheManager.py |
return self.manage_cacheGC(self,REQUEST) | if REQUEST is not None: response=REQUEST['RESPONSE'] response.redirect(REQUEST['URL1']+'/manage_cacheGC') | def manage_minimize(self,value,REQUEST): "Perform a full sweep through the cache" try: db=self._p_jar.db() except: # BoboPOS2 Globals.Bobobase._jar.cache.minimize(value) else: db.cacheMinimize(value) | 93134a644322e3d4768e743498faddead223d85a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/93134a644322e3d4768e743498faddead223d85a/CacheManager.py |
security.declareProtected('query', search_zcatalog) | security.declareProtected(search_zcatalog, 'query') | def getLexicon(self): """Get the lexicon for this index """ if hasattr(aq_base(self), 'lexicon'): # Fix up old ZCTextIndexes by removing direct lexicon ref # and changing it to an ID lexicon = getattr(aq_parent(aq_inner(self)), self.lexicon.getId()) self.lexicon_id = lexicon.getId() del self.lexicon | fb6ede6bf7a66c5e2840b99a25f0b13b96b3ef80 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/fb6ede6bf7a66c5e2840b99a25f0b13b96b3ef80/ZCTextIndex.py |
schema[lower(name)]=i schema[upper(name)]=i | n=lower(name) if n != name: aliases.append((n, SQLAlias(name))) n=upper(name) if n != name: aliases.append((n, SQLAlias(name))) | def __init__(self,file,brains=NoBrains, parent=None, zbrains=None): | 867a0555f053e7f9a19e094d1a66b78adb94ddbe /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/867a0555f053e7f9a19e094d1a66b78adb94ddbe/RDB.py |
for _def in defs: _def=strip(_def) if not _def: raise ValueError, ('Empty column definition for %s' % names[i]) if defre.match(_def) < 0: raise ValueError, ( 'Invalid column definition for, %s, for %s' % _def, names[i]) type=lower(defre.group(2)) width=defre.group(1) if width: width=atoi(width) else: width=8 | 867a0555f053e7f9a19e094d1a66b78adb94ddbe /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/867a0555f053e7f9a19e094d1a66b78adb94ddbe/RDB.py |
||
d=r.__dict__ for k, v in aliases: if not hasattr(r,k): d[k]=v | for _def in defs: _def=strip(_def) if not _def: raise ValueError, ('Empty column definition for %s' % names[i]) if defre.match(_def) < 0: raise ValueError, ( 'Invalid column definition for, %s, for %s' % _def, names[i]) type=lower(defre.group(2)) width=defre.group(1) if width: width=atoi(width) else: width=8 | 867a0555f053e7f9a19e094d1a66b78adb94ddbe /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/867a0555f053e7f9a19e094d1a66b78adb94ddbe/RDB.py |
|
self.assertEqual(factory.host, '') | self.assertEqual(factory.host, DEFAULT_HOSTNAME) | def test_ftp_factory(self): factory = self.load_factory("""\ <ftp-server> address 84 </ftp-server> """) self.assert_(isinstance(factory, ZServer.datatypes.FTPServerFactory)) self.assertEqual(factory.host, '') self.assertEqual(factory.port, 84) self.check_prepare(factory) factory.create().close() | e9480b298c1f1b56e340d02ebc5a16d32fff28d0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/e9480b298c1f1b56e340d02ebc5a16d32fff28d0/test_config.py |
realm=request.environ['BOBO_REALM'] | realm=os.environ['BOBO_REALM'] | def get_module_info(module_name, modules={}, acquire=_l.acquire, release=_l.release, ): if modules.has_key(module_name): return modules[module_name] if module_name[-4:]=='.cgi': module_name=module_name[:-4] acquire() tb=None try: try: module=__import__(module_name, globals(), globals(), ('__doc__',)) realm=module_name # Let the app specify a realm if hasattr(module,'__bobo_realm__'): realm=module.__bobo_realm__ elif os.environ.has_key('BOBO_REALM'): realm=request.environ['BOBO_REALM'] else: realm=module_name # Check for debug mode if hasattr(module,'__bobo_debug_mode__'): debug_mode=not not module.__bobo_debug_mode__ elif os.environ.has_key('BOBO_DEBUG_MODE'): debug_mode=lower(os.environ['BOBO_DEBUG_MODE']) if debug_mode=='y' or debug_mode=='yes': debug_mode=1 else: try: debug_mode=atoi(debug_mode) except: debug_mode=None else: debug_mode=None # Check whether tracebacks should be hidden: if hasattr(module,'__bobo_hide_tracebacks__'): hide_tracebacks=not not module.__bobo_hide_tracebacks__ elif os.environ.has_key('BOBO_HIDE_TRACEBACKS'): hide_tracebacks=lower(os.environ['BOBO_HIDE_TRACEBACKS']) if hide_tracebacks=='y' or hide_tracebacks=='yes': hide_tracebacks=1 else: try: hide_tracebacks=atoi(hide_tracebacks) except: hide_tracebacks=None else: hide_tracebacks=1 # Reset response handling of tracebacks, if necessary: if debug_mode or not hide_tracebacks: def hack_response(): import Response Response._tbopen = '<PRE>' Response._tbclose = '</PRE>' hack_response() if hasattr(module,'__bobo_before__'): bobo_before=module.__bobo_before__ else: bobo_before=None if hasattr(module,'__bobo_after__'): bobo_after=module.__bobo_after__ else: bobo_after=None # Get request data from outermost environment: if hasattr(module,'__request_data__'): request_params=module.__request_data__ else: request_params=None # Get initial group data: inherited_groups=[] if hasattr(module,'__allow_groups__'): groups=module.__allow_groups__ inherited_groups.append(groups) else: groups=None web_objects=None roles=UNSPECIFIED_ROLES if hasattr(module,'bobo_application'): object=module.bobo_application if hasattr(object,'__allow_groups__'): groups=object.__allow_groups__ inherited_groups.append(groups) else: groups=None if hasattr(object,'__roles__'): roles=object.__roles__ else: if hasattr(module,'web_objects'): web_objects=module.web_objects object=web_objects else: object=module published=web_objects try: doc=module.__doc__ except: if web_objects is not None: doc=' ' else: doc=None info= (bobo_before, bobo_after, request_params, inherited_groups, groups, roles, object, doc, published, realm, module_name, debug_mode) modules[module_name]=modules[module_name+'.cgi']=info return info except: if hasattr(sys, 'exc_info'): t,v,tb=sys.exc_info() else: t, v, tb = sys.exc_type, sys.exc_value, sys.exc_traceback v=str(v) raise ImportError, (t, v), tb finally: tb=None release() | d61daf3c4663ddd112e39feb64ad135f23ff5a4c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/d61daf3c4663ddd112e39feb64ad135f23ff5a4c/Publish.py |
columns=result._searchable_result_columns() | columns=result._searchable_result_columns() __traceback_info__=columns | def custom_default_report(id, result, action=''): columns=result._searchable_result_columns() heading=('<tr>\n%s</tr>' % string.joinfields( map(lambda c: '\t<th>%s</th>\n' % nicify(c['name']), columns), '' ) ) row=('<tr>\n%s</tr>' % string.joinfields( map(lambda c: '\t\t<td><!--#var %s%s--></td>\n' % (urllib.quote(c['name']), c['type']!='s' and ' null=""' or '', ), columns), '' ) ) return custom_default_report_src( id=id,heading=heading,row=row,action=action) | 033942a7176bd1b10ac8a241f15415863a5653e8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/033942a7176bd1b10ac8a241f15415863a5653e8/Aqueduct.py |
self._v_cache={} | self._v_cache={}, IOBTree.Bucket() | def manage_advanced(self, key, max_rows, max_cache, cache_time, | 820c7c14877fa771d21f5af3109279d4d99493aa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/820c7c14877fa771d21f5af3109279d4d99493aa/DA.py |
rec.append(default_value, name) | rec.append(default_value) | def addColumn(self, name, default_value=None): """ adds a row to the meta data schema """ schema = self.schema names = list(self.names) | 422a17d8959ec03fa742c6be4d1859067fdd8e2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/422a17d8959ec03fa742c6be4d1859067fdd8e2d/Catalog.py |
del self.data[rid] del self.uids[uid] del self.paths[rid] | try: del self.data[rid] except: pass try: del self.uids[uid] except: pass try: del self.paths[rid] except: pass | def uncatalogObject(self, uid): """ | 422a17d8959ec03fa742c6be4d1859067fdd8e2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/422a17d8959ec03fa742c6be4d1859067fdd8e2d/Catalog.py |
if not basic_type(k): | if not basic_type(type(k)): | def sort_sequence(self, sequence): | b8e170d1348a6bb205c2ac0ba13701b7f1b0a79a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/b8e170d1348a6bb205c2ac0ba13701b7f1b0a79a/DT_In.py |
for name, who_cares in method.ac_inherited_permissions(1): p=perms.get(getPermissionMapping(name, wrapper), '') a({'permission_name': name, 'class_permission': p}) | for ac_perms in method.ac_inherited_permissions(1): p=perms.get(getPermissionMapping(ac_perms[0], wrapper), '') a({'permission_name': ac_perms[0], 'class_permission': p}) | def manage_getPermissionMapping(self): """Return the permission mapping for the object | 62063ba723bca04c77ea8c288075345b584ef10c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/62063ba723bca04c77ea8c288075345b584ef10c/Method.py |
has_key = request.has_key if has_key(cidid): keys = request[cidid] elif has_key(id): keys = request[id] else: return None if type(keys) is not ListType and not TupleType: | if request.has_key(cidid): keys = request[cidid] elif request.has_key(id): keys = request[id] else: return None if not type(keys) in (ListType, TupleType): | def _apply_index(self, request, cid=''): """Apply the index to query parameters given in the argument, request | 6daa42b5ad2d6484a816b5497f7df1ae5dae6379 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/6daa42b5ad2d6484a816b5497f7df1ae5dae6379/UnIndex.py |
manage_options=({'label':'Join/Leave', 'action':'manage_main'}, {'label':'Properties', 'action':'manage_editForm'}, {'label':'Security', 'action':'manage_access'}, ) | manage_options=( {'label':'Join/Leave', 'action':'manage_main'}, {'label':'Save/Discard', 'action':'manage_end'}, {'label':'Properties', 'action':'manage_editForm'}, {'label':'Security', 'action':'manage_access'}, ) | def manage_addVersion(self, id, title, REQUEST=None): """ """ self=self.this() self._setObject(id, Version(id,title,REQUEST)) if REQUEST is not None: REQUEST['RESPONSE'].redirect(self.absolute_url()+'/manage_main') | dfa721abb02ad6dc74cd93713b66b30539e92c90 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/dfa721abb02ad6dc74cd93713b66b30539e92c90/Version.py |
('Join/leave Versions', ('enter','leave','leave_another')), ('Save/discard Version changes', ('save','discard')), | ('Join/leave Versions', ('manage_main', 'enter','leave','leave_another')), ('Save/discard Version changes', ('manage_end', 'save','discard')), | def manage_addVersion(self, id, title, REQUEST=None): """ """ self=self.this() self._setObject(id, Version(id,title,REQUEST)) if REQUEST is not None: REQUEST['RESPONSE'].redirect(self.absolute_url()+'/manage_main') | dfa721abb02ad6dc74cd93713b66b30539e92c90 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/dfa721abb02ad6dc74cd93713b66b30539e92c90/Version.py |
manage=manage_main=Globals.HTMLFile('version', globals()) | manage_main=Globals.HTMLFile('version', globals()) manage_end=Globals.HTMLFile('versionEnd', globals()) | def __init__(self, id, title, REQUEST): self.id=id self.title=title | dfa721abb02ad6dc74cd93713b66b30539e92c90 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/dfa721abb02ad6dc74cd93713b66b30539e92c90/Version.py |
def discard(self, REQUEST=None): | def discard(self, remark='', REQUEST=None): | def discard(self, REQUEST=None): 'Discard changes made during the version' try: db=self._p_jar.db() except: # BoboPOS 2 Globals.VersionBase[self.cookie].abort() else: # ZODB 3 db.abortVersion(self.cookie) | dfa721abb02ad6dc74cd93713b66b30539e92c90 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/dfa721abb02ad6dc74cd93713b66b30539e92c90/Version.py |
print 'path', path | def undoable_transactions(self, AUTHENTICATION_PATH=None, first_transaction=None, last_transaction=None, PrincipiaUndoBatchSize=None): | 259a8dcb2ee40acfb0f082f105cdbf262063fca1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/259a8dcb2ee40acfb0f082f105cdbf262063fca1/Undo.py |
|
if aq_base(accessed) is aq_base(container): raise Unauthorized, name return 0 | raise Unauthorized, name | def validate(self, accessed, container, name, value, *args): if aq_base(accessed) is aq_base(container): raise Unauthorized, name return 0 | 3e1072c98505121089b41cddfa4af4a4fe2de277 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/3e1072c98505121089b41cddfa4af4a4fe2de277/testTraverse.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.