rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
"VirtualMachineQuestionInfo" : Object.FEATURE__ANY_TYPE } removed_object_features = { "DynamicProperty" : Object.FEATURE__SERIALIZE, "ObjectContent" : Object.FEATURE__SERIALIZE, "ObjectUpdate" : Object.FEATURE__SERIALIZE, "PropertyChange" : Object.FEATURE__SERIALIZE, "Propert...
"VirtualMachineQuestionInfo" : Object.FEATURE__ANY_TYPE, "VirtualMachineSnapshotTree" : Object.FEATURE__DEEP_COPY | Object.FEATURE__ANY_TYPE } removed_object_features = { "DynamicProperty" : Object.FEATURE__SERIALIZE, "ObjectContent" : Object.FEATURE__SERIALIZE, "ObjectUpdate" : ...
def open_and_print(filename): if filename.startswith("./"): print " GEN " + filename[2:] else: print " GEN " + filename return open(filename, "wb")
property.type not in predefined_objects:
property.type not in predefined_objects and \ property.type in objects_by_name:
typedef = open_and_print(os.path.join(output_dirname, "esx_vi_types.generated.typedef"))
eventStrings = ( "Added", "Removed",
eventStrings = ( "Defined", "Undefined",
def eventToString(event): eventStrings = ( "Added", "Removed", "Started", "Suspended", "Resumed", "Stopped", "Saved", "Restored" ); return eventStrings[event];
"Stopped", "Saved", "Restored" );
"Stopped" );
def eventToString(event): eventStrings = ( "Added", "Removed", "Started", "Suspended", "Resumed", "Stopped", "Saved", "Restored" ); return eventStrings[event];
print "myDomainEventCallback1 EVENT: Domain %s(%s) %s %d" % (dom.name(), dom.ID(), eventToString(event), detail)
print "myDomainEventCallback1 EVENT: Domain %s(%s) %s %s" % (dom.name(), dom.ID(), eventToString(event), detailToString(event, detail))
def myDomainEventCallback1 (conn, dom, event, detail, opaque): print "myDomainEventCallback1 EVENT: Domain %s(%s) %s %d" % (dom.name(), dom.ID(), eventToString(event), detail)
print "myDomainEventCallback2 EVENT: Domain %s(%s) %s %d" % (dom.name(), dom.ID(), eventToString(event), detail)
print "myDomainEventCallback2 EVENT: Domain %s(%s) %s %s" % (dom.name(), dom.ID(), eventToString(event), detailToString(event, detail))
def myDomainEventCallback2 (conn, dom, event, detail, opaque): print "myDomainEventCallback2 EVENT: Domain %s(%s) %s %d" % (dom.name(), dom.ID(), eventToString(event), detail)
"virStream"]
"virStream", "virDomainSnapshot"]
def buildStubs(): global py_types global py_return_types global unknown_types try: f = open(os.path.join(srcPref,"libvirt-api.xml")) data = f.read() (parser, target) = getparser() parser.feed(data) parser.close() except IOError, msg: try: f = open(os.path.join(srcPref,"..","docs","libvirt-api.xml")) data = f.read() (...
resp.headers['Access-Control-Allow-Origin'] = '*' resp.headers['Access-Control-Allow-Methods'] = 'GET,POST,OPTIONS'
add_access_headers(resp)
def application(req): if req.method == 'OPTIONS': resp = Response('', content_type='text/plain') resp.allow = 'GET,POST,OPTIONS' resp.headers['Access-Control-Allow-Origin'] = '*' resp.headers['Access-Control-Allow-Methods'] = 'GET,POST,OPTIONS' return resp script_path = None if req.path_info == '/graphs.html': # Must r...
resp.headers['Access-Control-Allow-Methods'] = 'GET,POST,OPTIONS' return resp
resp.headers['Access-Control-Allow-Methods'] = 'GET,OPTIONS' resp.headers['Access-Control-Allow-Headers'] = 'X-Requested-With' resp.headers['Access-Control-Max-Age'] = str(60 * 60 * 24)
def application(req): if req.method == 'OPTIONS': resp = Response('', content_type='text/plain') resp.allow = 'GET,POST,OPTIONS' resp.headers['Access-Control-Allow-Origin'] = '*' resp.headers['Access-Control-Allow-Methods'] = 'GET,POST,OPTIONS' return resp script_path = None if req.path_info == '/graphs.html': # Must r...
if(attribute == 'values'):
if attribute == 'values':
def getTestRun(id, attribute, form): if(attribute == 'values'): return getTestRunValues(id) elif(attribute == 'latest'): return getLatestTestRunValues(id, form) else: sql = """SELECT test_runs.*, builds.id as build_id, builds.ref_build_id as ref_build_id, builds.ref_changeset as changeset FROM test_runs INNER JOIN buil...
elif(attribute == 'latest'):
elif attribute == 'latest':
def getTestRun(id, attribute, form): if(attribute == 'values'): return getTestRunValues(id) elif(attribute == 'latest'): return getLatestTestRunValues(id, form) else: sql = """SELECT test_runs.*, builds.id as build_id, builds.ref_build_id as ref_build_id, builds.ref_changeset as changeset FROM test_runs INNER JOIN buil...
cursor.execute(sql, (id))
cursor.execute(sql, (id,))
def getTest(id, attribute, form): if(attribute == 'runs'): return getTestRuns(id) else: sql = """SELECT tests.id, tests.pretty_name AS test_name, machines.name as machine_name, branches.name AS branch_name, os_list.name AS os_name, test_runs.date_run FROM tests INNER JOIN test_runs ON (tests.id = test_runs.test_id) INN...
WHERE test_runs.test_id = %s AND machines.id = %s AND branches.id = %s ORDER BY date_run ASC"""
WHERE test_runs.test_id = %s AND machines.id = %s AND branches.id = %s AND machines.is_active <> 0 ORDER BY date_run ASC"""
def getTestRuns(id, attribute, form): machineid = int(form.getvalue('machineid')) branchid = int(form.getvalue('branchid')) sql = """SELECT test_runs.*, builds.id as build_id, builds.ref_build_id, builds.ref_changeset FROM test_runs INNER JOIN builds ON (builds.id = test_runs.build_id) INNER JOIN branches ON (builds....
print l
print "abnormal lines:", lines
def line2def(self, lines): results = [] for l in lines: if not l: continue ####################### # ctags bug?! it seem that it could not handle two continous # doulbe quota charaecters ("")rightly in Exuberant Ctags 5.6, at least. # so here we resume "\xd3" to "", workaround :( ###### l = l.replace("\xd3", '""') fiel...
import shlex
def runCommand(self, args): # such names means private methods import subprocess as sp import shlex if self.cwd: cwd = os.getcwd() os.chdir(self.cwd) p = sp.Popen(args, stdout=sp.PIPE, stderr=sp.PIPE, cwd=self.cwd) os.chdir(cwd) else: p = sp.Popen(args, stdout=sp.PIPE, stderr=sp.PIPE) stdout, stderr = p.communicate() i...
print "cscope said below words at stderr:"
print "%s said below words at stderr:" % args[0]
def runCommand(self, args): # such names means private methods import subprocess as sp import shlex if self.cwd: cwd = os.getcwd() os.chdir(self.cwd) p = sp.Popen(args, stdout=sp.PIPE, stderr=sp.PIPE, cwd=self.cwd) os.chdir(cwd) else: p = sp.Popen(args, stdout=sp.PIPE, stderr=sp.PIPE) stdout, stderr = p.communicate() i...
print "abnormal attrtab",f print "abnormal lines:", lines
print "abnormal attrtab", f print "abnormal lines:" for t in lines: print `t` print 'abnormal line', `l` import traceback traceback.print_stack()
def line2def(self, lines): results = [] for l in lines: if not l: continue ####################### # ctags bug?! it seem that it could not handle two continous # doulbe quota charaecters ("")rightly in Exuberant Ctags 5.6, at least. # so here we resume "\xd3" to "", workaround :( ###### l = l.replace("\xd3", '""') fiel...
self.valid = 0 returnval = 0
def __init__(self, file): core.Music.__init__(self) self.valid = 0 returnval = 0 tags = M4ATags(file) if tags['FileType'] == 'M4A ': try: self.title = tags['Title'] self.artist = tags['Artist'] self.album = tags['Album'] self.trackno = tags['Track'] self.year = tags['Year'] self.encoder = tags['Tool'] self.length = tag...
if tags['FileType'] == 'M4A ': try: self.title = tags['Title'] self.artist = tags['Artist'] self.album = tags['Album'] self.trackno = tags['Track'] self.year = tags['Year'] self.encoder = tags['Tool'] self.length = tags['Length'] self.samplerate = tags['SampleRate'] self.valid = 1 self.mime = 'audio/mp4' self.filename ...
if tags.get('FileType') != 'M4A ':
def __init__(self, file): core.Music.__init__(self) self.valid = 0 returnval = 0 tags = M4ATags(file) if tags['FileType'] == 'M4A ': try: self.title = tags['Title'] self.artist = tags['Artist'] self.album = tags['Album'] self.trackno = tags['Track'] self.year = tags['Year'] self.encoder = tags['Tool'] self.length = tag...
log.debug("trying ext %s" % e[1:])
log.debug("trying ext %s on file %s", e[1:], file.name)
def create_from_file(self, file, force=True): """ create based on the file stream 'file """ # Check extension as a hint e = os.path.splitext(file.name)[1].lower() parser = None if e and e.startswith('.') and e[1:] in self.extmap: log.debug("trying ext %s" % e[1:]) parsers = self.extmap[e[1:]] for info in parsers: file....
key = t[i:i+4] sz = struct.unpack('<I',t[i+4:i+8])[0] i+=8 value = t[i:] if key == 'strh': retval[key] = self._parseSTRH(value)
while i < len(t) - 8: key = t[i:i+4] sz = struct.unpack('<I',t[i+4:i+8])[0] i+=8 value = t[i:] if key == 'strh': retval[key] = self._parseSTRH(value) elif key == 'strf': retval[key] = self._parseSTRF(value, retval['strh']) else: log.debug("_parseSTRL: unsupported stream tag '%s'", key)
def _parseSTRL(self,t): retval = {} size = len(t) i = 0 key = t[i:i+4] sz = struct.unpack('<I',t[i+4:i+8])[0] i+=8 value = t[i:]
else: log.debug("_parseSTRL: Error") key = t[i:i+4] sz = struct.unpack('<I',t[i+4:i+8])[0] i+=8 value = t[i:] if key == 'strf': retval[key] = self._parseSTRF(value, retval['strh']) i += sz return ( retval, i )
return retval, i
def _parseSTRL(self,t): retval = {} size = len(t) i = 0 key = t[i:i+4] sz = struct.unpack('<I',t[i+4:i+8])[0] i+=8 value = t[i:]
try: t = time.strptime(value, "%a %b %d %H:%M:%S %Y") except ValueError:
specs = ('%a %b %d %H:%M:%S %Y', '%Y/%m/%d/ %H:%M', '%B %d, %Y') for tmspec in specs:
def _parseLIST(self,t): retval = {} i = 0 size = len(t)
t = time.strptime(value, "%Y/%m/%d/ %H:%M") except ValueError, e: log.debug('no support for time format %s', value) t = 0 if t: self.timestamp = int(time.mktime(t))
tm = time.strptime(value, tmspec) self.timestamp = int(time.mktime(tm)) break except ValueError: pass else: log.debug('no support for time format %s', value)
def _parseLIST(self,t): retval = {} i = 0 size = len(t)
if len(h) < 4:
if len(h) < 8:
def _parseRIFFChunk(self,file): h = file.read(8) if len(h) < 4: return False name = h[:4] size = struct.unpack('<I',h[4:8])[0]
MODE_SCREENSHOT,
MODE_SNAPSHOT,
def extract_arg(self, function, arg, arg_type, lvalue, rvalue): if (function.name in self.pointer_function_names and arg.name == 'pointer' or function.name in self.draw_elements_function_names and arg.name == 'indices'): print ' if (dynamic_cast<Trace::Null *>(&%s)) {' % rvalue print ' %s = 0;' % (lvalue) pri...
if (!__reshape_window && (__mode == MODE_SCREENSHOT || __mode == MODE_COMPARE)) {
if (!__reshape_window && (__mode == MODE_SNAPSHOT || __mode == MODE_COMPARE)) {
def extract_arg(self, function, arg, arg_type, lvalue, rvalue): if (function.name in self.pointer_function_names and arg.name == 'pointer' or function.name in self.draw_elements_function_names and arg.name == 'indices'): print ' if (dynamic_cast<Trace::Null *>(&%s)) {' % rvalue print ' %s = 0;' % (lvalue) pri...
snprintf(filename, sizeof filename, "screenshot_%04u.png", __frame);
snprintf(filename, sizeof filename, "%s%04u.png", __snapshot_prefix, __frame);
def extract_arg(self, function, arg, arg_type, lvalue, rvalue): if (function.name in self.pointer_function_names and arg.name == 'pointer' or function.name in self.draw_elements_function_names and arg.name == 'indices'): print ' if (dynamic_cast<Trace::Null *>(&%s)) {' % rvalue print ' %s = 0;' % (lvalue) pri...
if (__mode == MODE_SCREENSHOT) {
if (__mode == MODE_SNAPSHOT) {
def extract_arg(self, function, arg, arg_type, lvalue, rvalue): if (function.name in self.pointer_function_names and arg.name == 'pointer' or function.name in self.draw_elements_function_names and arg.name == 'indices'): print ' if (dynamic_cast<Trace::Null *>(&%s)) {' % rvalue print ' %s = 0;' % (lvalue) pri...
" -c compare against screenshots\n"
" -c compare against snapshots\n"
def extract_arg(self, function, arg, arg_type, lvalue, rvalue): if (function.name in self.pointer_function_names and arg.name == 'pointer' or function.name in self.draw_elements_function_names and arg.name == 'indices'): print ' if (dynamic_cast<Trace::Null *>(&%s)) {' % rvalue print ' %s = 0;' % (lvalue) pri...
__mode = MODE_SCREENSHOT;
__mode = MODE_SNAPSHOT;
def extract_arg(self, function, arg, arg_type, lvalue, rvalue): if (function.name in self.pointer_function_names and arg.name == 'pointer' or function.name in self.draw_elements_function_names and arg.name == 'indices'): print ' if (dynamic_cast<Trace::Null *>(&%s)) {' % rvalue print ' %s = 0;' % (lvalue) pri...
print ' Log::BeginCall("%s");' % (function.name)
print ' unsigned __call = Log::BeginEnter("%s");' % (function.name)
def trace_function_impl(self, function): pvalue = self.function_pointer_value(function) print function.prototype() + ' {' if function.type is stdapi.Void: result = '' else: print ' %s __result;' % function.type result = '__result = ' self._get_true_pointer(function) print ' Log::BeginCall("%s");' % (function.name...
print ' Log::EndCall();'
print ' Log::EndLeave();'
def trace_function_impl(self, function): pvalue = self.function_pointer_value(function) print function.prototype() + ' {' if function.type is stdapi.Void: result = '' else: print ' %s __result;' % function.type result = '__result = ' self._get_true_pointer(function) print ' Log::BeginCall("%s");' % (function.name...
def __init__(self, type, name, args **kwargs): DllFunction.__init__(self, type, name, args **kwargs)
def __init__(self, type, name, args, **kwargs): DllFunction.__init__(self, type, name, args, **kwargs)
def __init__(self, type, name, args **kwargs): DllFunction.__init__(self, type, name, args **kwargs) self.functions = []
F(Void, "glGenBuffersARB", [(GLsizei, "n"), (Array(GLuint, "n"), "buffer")]),
F(Void, "glGenBuffersARB", [(GLsizei, "n"), Out(Array(GLuint, "n"), "buffer")]),
def F(*args, **kwargs): kwargs.setdefault('call', 'GLAPIENTRY') return Function(*args, **kwargs)
WglFunction(Void, "glGetAttachedShaders", [(GLuint, "program"), (GLsizei, "maxCount"), (Pointer(GLsizei), "count"), (Pointer(GLuint), "obj")]), WglFunction(Void, "glGetProgramInfoLog", [(GLuint, "program"), (GLsizei, "bufSize"), (Pointer(GLsizei), "length"), (Pointer(GLchar), "infoLog")]), WglFunction(Void, "glGetProgr...
WglFunction(Void, "glGetAttachedShaders", [(GLuint, "program"), (GLsizei, "maxCount"), (OutPointer(GLsizei), "count"), (Pointer(GLuint), "obj")]), WglFunction(Void, "glGetProgramInfoLog", [(GLuint, "program"), (GLsizei, "bufSize"), (OutPointer(GLsizei), "length"), (Out(GLstring), "infoLog")]), WglFunction(Void, "glGetP...
def get_true_pointer(self): ptype = self.pointer_type() pvalue = self.pointer_value() print ' if(!%s)' % (pvalue,) self.fail_impl()
WglFunction(Void, "glGetProgramivARB", [(GLenum, "target"), (GLenum, "pname"), (Pointer(GLint), "params")]), WglFunction(Void, "glGetVertexAttribdv", [(GLuint, "index"), (GLenum, "pname"), (Pointer(GLdouble), "params")]), WglFunction(Void, "glGetVertexAttribdvARB", [(GLuint, "index"), (GLenum, "pname"), (Pointer(GLdoub...
WglFunction(Void, "glGetProgramivARB", [(GLenum, "target"), (GLenum, "pname"), (OutPointer(GLint), "params")]), WglFunction(Void, "glGetVertexAttribdv", [(GLuint, "index"), (GLenum, "pname"), (OutPointer(GLdouble), "params")]), WglFunction(Void, "glGetVertexAttribdvARB", [(GLuint, "index"), (GLenum, "pname"), (OutPoint...
def get_true_pointer(self): ptype = self.pointer_type() pvalue = self.pointer_value() print ' if(!%s)' % (pvalue,) self.fail_impl()
WglFunction(Void, "glGetQueryObjectivARB", [(GLuint, "id"), (GLenum, "pname"), (Pointer(GLint), "params")]), WglFunction(Void, "glGetQueryObjectuivARB", [(GLuint, "id"), (GLenum, "pname"), (Pointer(GLuint), "params")]), WglFunction(Void, "glGetQueryivARB", [(GLenum, "target"), (GLenum, "pname"), (Pointer(GLint), "param...
WglFunction(Void, "glGetQueryObjectivARB", [(GLuint, "id"), (GLenum, "pname"), (OutPointer(GLint), "params")]), WglFunction(Void, "glGetQueryObjectuivARB", [(GLuint, "id"), (GLenum, "pname"), (OutPointer(GLuint), "params")]), WglFunction(Void, "glGetQueryivARB", [(GLenum, "target"), (GLenum, "pname"), (OutPointer(GLint...
def get_true_pointer(self): ptype = self.pointer_type() pvalue = self.pointer_value() print ' if(!%s)' % (pvalue,) self.fail_impl()
WglFunction(Void, "glGetShaderSource", [(GLhandleARB, "shader"), (GLsizei, "bufSize"), (Pointer(GLsizei), "length"), (Pointer(GLcharARB), "source")]), WglFunction(Void, "glGetShaderSourceARB", [(GLhandleARB, "shader"), (GLsizei, "bufSize"), (Pointer(GLsizei), "length"), (Pointer(GLcharARB), "source")]),
WglFunction(Void, "glGetShaderSource", [(GLhandleARB, "shader"), (GLsizei, "bufSize"), (Pointer(GLsizei), "length"), (Out(GLstringARB), "source")]), WglFunction(Void, "glGetShaderSourceARB", [(GLhandleARB, "shader"), (GLsizei, "bufSize"), (Pointer(GLsizei), "length"), (Out(GLstringARB), "source")]),
def get_true_pointer(self): ptype = self.pointer_type() pvalue = self.pointer_value() print ' if(!%s)' % (pvalue,) self.fail_impl()
Log::DumpString((char *)pDisassembly->GetBufferPointer());
Log::LiteralString((char *)pDisassembly->GetBufferPointer());
typedef HRESULT
if 'backends' in kwargs and kwargs['backends']: if isinstance(kwargs['backends'], BaseBackend): backends = [kwargs.pop('backends')] elif isinstance(kwargs['backends'], (str,unicode)) and kwargs['backends']: backends = [self.backend_instances[kwargs.pop('backends')]] elif isinstance(kwargs['backends'], (list,tuple)):
if 'backends' in kwargs: _backends = kwargs.pop('backends') if isinstance(_backends, BaseBackend): backends = [_backends] elif isinstance(_backends, (str,unicode)) and _backends: backends = [self.backend_instances[_backends]] elif isinstance(_backends, (list,tuple)):
def do(self, function, *args, **kwargs): """ Do calls on loaded backends with specified arguments, in separated threads.
for backend in kwargs.pop('backends'):
for backend in _backends:
def do(self, function, *args, **kwargs): """ Do calls on loaded backends with specified arguments, in separated threads.
backends = [backend for backend in backends if backend.has_caps(kwargs.pop('caps'))]
caps = kwargs.pop('caps') backends = [backend for backend in backends if backend.has_caps(caps)]
def do(self, function, *args, **kwargs): """ Do calls on loaded backends with specified arguments, in separated threads.
coming = a[0].text coming = coming.replace('.','').replace(',','.') account.coming = float(coming)
if len(a) == 0: account.coming = 0.0 else: coming = a[0].text coming = coming.replace('.','').replace(',','.') account.coming = float(coming)
def get_list(self): l = [] for tr in self.document.getiterator('tr'): if tr.attrib.get('class', '') == 'comptes': account = Account() for td in tr.getiterator('td'): if td.attrib.get('headers', '').startswith('Numero_'): id = td.text account.id = ''.join(id.split(' ')).strip() elif td.attrib.get('headers', '').startswi...
def get_contact(self, _id):
def get_contact(self, contact):
def get_contact(self, _id): try: with self.browser: profile = self.browser.get_profide(_id)
profile = self.browser.get_profide(_id)
if isinstance(contact, Contact): _id = contact.id elif isinstance(contact, (int,long,str,unicode)): _id = contact else: raise TypeError("The parameter 'contact' isn't a contact nor a int/long/str/unicode: %s" % contact) profile = self.browser.get_profile(_id)
def get_contact(self, _id): try: with self.browser: profile = self.browser.get_profide(_id)
contact = Contact(_id, profile.get_name(), s)
if isinstance(contact, Contact): contact.id = _id contact.name = profile.get_name() contact.status = s else: contact = Contact(_id, profile.get_name(), s)
def get_contact(self, _id): try: with self.browser: profile = self.browser.get_profide(_id)
contact.photos = profile.photos
for photo in profile.photos: contact.set_photo(photo.split('/')[-1], url=photo, thumbnail_url=photo.replace('image', 'thumb1_'))
def get_contact(self, _id): try: with self.browser: profile = self.browser.get_profide(_id)
for label, value in self.get_stats().iteritems():
for label, value in profile.get_stats().iteritems():
def get_contact(self, _id): try: with self.browser: profile = self.browser.get_profide(_id)
for section, d in self.get_table().iteritems():
for section, d in profile.get_table().iteritems():
def get_contact(self, _id): try: with self.browser: profile = self.browser.get_profide(_id)
c.thumbnail_url = contact['cover']
c.set_photo(contact['cover'].split('/')[-1].replace('thumb0_', 'image'), thumbnail_url=contact['cover'])
def iter_contacts(self, status=Contact.STATUS_ALL, ids=None): with self.browser: for contact in self.browser.iter_contacts(): s = 0 if contact['cat'] == 1: s = Contact.STATUS_ONLINE elif contact['cat'] == 3: s = Contact.STATUS_OFFLINE elif contact['cat'] == 2: s = Contact.STATUS_AWAY else: warning('Unknown AuM contact ...
duration_regexp = re.compile('(.+) - (.+)min(.+)s')
duration_regexp = re.compile('(.+) - ((.+)h)?((.+)min)?(.+)s')
def get_date_and_duration(self): duration_regexp = re.compile('(.+) - (.+)min(.+)s') el = self.document.getroot().cssselect('div.bloc-produit-haut p.date')[0] if el is not None: m = duration_regexp.match(el.text.strip()) if m: day, month, year = [int(s) for s in m.group(1).split('/')] date = datetime.datetime(year, mon...
duration = datetime.timedelta(minutes=int(m.group(3)), seconds=int(m.group(2)))
duration = datetime.timedelta(hours=int(m.group(3) if m.group(3) is not None else 0), minutes=int(m.group(5) if m.group(5) is not None else 0), seconds=int(m.group(6)))
def get_date_and_duration(self): duration_regexp = re.compile('(.+) - (.+)min(.+)s') el = self.document.getroot().cssselect('div.bloc-produit-haut p.date')[0] if el is not None: m = duration_regexp.match(el.text.strip()) if m: day, month, year = [int(s) for s in m.group(1).split('/')] date = datetime.datetime(year, mon...
return None
raise SelectElementException('Unable to find date and duration element')
def get_date_and_duration(self): duration_regexp = re.compile('(.+) - (.+)min(.+)s') el = self.document.getroot().cssselect('div.bloc-produit-haut p.date')[0] if el is not None: m = duration_regexp.match(el.text.strip()) if m: day, month, year = [int(s) for s in m.group(1).split('/')] date = datetime.datetime(year, mon...
self.choices=None
self.choices = choices
def __init__(self, default=None, is_masked=False, regexp=None, description=None, choices=None): self.default = default self.is_masked = is_masked self.regexp = regexp self.description = description self.choices=None
raise BaseBackend.ConfigError('Value of "%s" might be in this list: %s' %
raise BaseBackend.ConfigError('Value of "%s" might be in this list: %s' % (name,
def __init__(self, weboob, name, config, storage): self.weboob = weboob self.name = name self.lock = RLock()
else field.choices)]))
else field.choices)])))
def __init__(self, weboob, name, config, storage): self.weboob = weboob self.name = name self.lock = RLock()
sender=content.author,
sender=content.author or u'',
def get_thread(self, id): if isinstance(id, Thread): thread = id id = thread.id else: thread = None
sender=com.author,
sender=com.author or u'',
def _insert_comment(self, com, parent): """" Insert 'com' comment and its children in the parent message. """ flags = Message.IS_HTML if not com.id in self.storage.get('seen', parent.thread.id, 'comments', default=[]): flags |= Message.IS_UNREAD
'.*layout=HomeConnexion': pages.ConfirmPage,
'.*layout=HomeConnexion.*': pages.ConfirmPage,
def parse(self, data, encoding): s = data.read() s = s.replace('<?Pub Caret>', '') data = StringIO(s) return ElementTidyParser.parse(self, data, encoding)
raise OSError(errno.ENOENT, '"rtmpdump" binary not found')
self.logger.warning('"rtmpdump" binary not found') return self._play_default(media)
def _play_rtmp(self, media): """ Download data with rtmpdump and pipe them to a media player.
logging.warning('Your media object does not have a "swf_player" attribute. SWF verification will be ' 'disabled and may prevent correct media playback.')
self.logger.warning('Your media object does not have a "swf_player" attribute. SWF verification will be ' 'disabled and may prevent correct media playback.')
def _play_rtmp(self, media): """ Download data with rtmpdump and pipe them to a media player.
rtmp = 'rtmpdump -r %s' % media_url
return self._play_default(media)
def _play_rtmp(self, media): """ Download data with rtmpdump and pipe them to a media player.
if len(tds[0].childNodes) > 2: b = tds[0].childNodes[2] if hasattr(b, 'tagName') and b.tagName == 'b':
if len(tds[0].childNodes) > 0: b = len(tds[0].childNodes) > 2 and tds[0].childNodes[2] if b and hasattr(b, 'tagName') and b.tagName == 'b':
def parse_table(self, div): d = self.table[self.tables[div.getAttribute('id')]] fields = self.fields[self.tables[div.getAttribute('id')]] table = div.getElementsByTagName('table')[1]
for child in tds[0].childNodes[2:]: value1 += child.data
for child in tds[0].childNodes: if child.data != u'\xa0': value1 += child.data value2 = value2.strip()
def parse_table(self, div): d = self.table[self.tables[div.getAttribute('id')]] fields = self.fields[self.tables[div.getAttribute('id')]] table = div.getElementsByTagName('table')[1]
if len(tds[1].childNodes) > 2: b = tds[1].childNodes[2] if hasattr(b, 'tagName') and b.tagName == 'b':
if len(tds[1].childNodes) > 0: b = tds[1].childNodes[0] if b and hasattr(b, 'tagName') and b.tagName == 'b':
def parse_table(self, div): d = self.table[self.tables[div.getAttribute('id')]] fields = self.fields[self.tables[div.getAttribute('id')]] table = div.getElementsByTagName('table')[1]
for child in tds[1].childNodes[2:]: if hasattr(child, 'data'):
for child in tds[1].childNodes: if hasattr(child, 'data') and child.data != u'\xa0':
def parse_table(self, div): d = self.table[self.tables[div.getAttribute('id')]] fields = self.fields[self.tables[div.getAttribute('id')]] table = div.getElementsByTagName('table')[1]
l = list(self.backend.iter_search_results('futanari', nsfw=True))
l = list(self.backend.iter_search_results('anal', nsfw=True))
def test_youjizz(self): self.assertTrue(len(self.backend.iter_search_results('anus', nsfw=False)) == 0)
module = self.weboob.modules_loader.modules[name]
module = self.weboob.modules_loader.get_or_load_module(name)
def command_modinfo(self, name): try: module = self.weboob.modules_loader.modules[name] except KeyError: print >>sys.stderr, 'No such module: %s' % name return 1
It take mail from stdin. Use it with postfix for example.
It takes mail from stdin. Use it with postfix for example.
def do_confirm(self, backend_name): """ confirm BACKEND
debug('%s: Called function %s returned: "%s"' % (backend, function, result))
debug('%s: Called function %s returned: %r' % (backend, function, result))
def _caller(self, backend, function, args, kwargs): debug('%s: Thread created successfully' % backend) with backend: try: # Call method on backend try: debug('%s: Calling function %s' % (backend, function)) if callable(function): result = function(backend, *args, **kwargs) else: result = getattr(backend, function)(*arg...
def _complete_obj(self, backend, obj, fields):
def _complete_obj(self, backend, fields, obj):
def _complete_obj(self, backend, obj, fields): if fields: if '*' in fields: fields = [k for k, v in iter_fields(obj)] try: backend.fillobj(obj, fields) except ObjectNotAvailable, e: logging.warning(u'Could not retrieve required fields (%s): %s' % (','.join(fields), e)) for field in set(fields) - set('*'): if getattr(ob...
if 'backends' in kwargs: _backends = kwargs.pop('backends')
_backends = kwargs.pop('backends', None) if _backends:
def do(self, function, *args, **kwargs): """ Do calls on loaded backends with specified arguments, in separated threads.
balance = u'' for c in s: if c.isdigit(): balance += c if c == ',': balance += '.' account.balance = float(balance)
account.balance = clean_amount(s)
def get_list(self): """ Returns the list of available bank accounts """ l = []
data = self.extract_text(body_elmt).replace(',', '.').replace(' ', '').replace(u'\xa0', '') matches = re.findall('^(-?[0-9]+\.[0-9]{2}).*$', data) operation.amount = float(matches[0]) if (matches) else 0.0
operation.amount = clean_amount(self.extract_text(body_elmt))
def get_history(self, start_index = 0): """ Returns the history of a specific account. Note that this function expects the current page page to be the one dedicated to this history. """ # tested on CA Lorraine, Paris, Toulouse # avoir parsing the page as an account-dedicated page if it is not the case if not self.is_ac...
data = self.extract_text(interesting_divs[(i*3)+1]).replace(',', '.').replace(' ', '').replace(u'\xa0', '') matches = re.findall('^(-?[0-9]+\.[0-9]{2}).*$', data) operation.amount = float(matches[0]) if (matches) else 0.0
operation.amount = clean_amount(self.extract_text(interesting_divs[(i*3)+1]))
def get_history(self, start_index = 0): """ Returns the history of a specific account. Note that this function expects the current page page to be the one dedicated to this history. """ # tested on CA Lorraine, Paris, Toulouse # avoir parsing the page as an account-dedicated page if it is not the case if not self.is_ac...
self.klass.ICON = xdg.IconTheme.getIconPath(self.klass.NAME)
try: import xdg.IconTheme except ImportError: pass else: self.klass.ICON = xdg.IconTheme.getIconPath(self.klass.NAME)
def icon_path(self): if self.klass.ICON is None: self.klass.ICON = xdg.IconTheme.getIconPath(self.klass.NAME) return self.klass.ICON
contacts = self.browser.get_threads_list() for contact in contacts: if not contact.get_id() in self.storage.get('sluts'): slut = {'lastmsg': datetime(1970,1,1), 'msgstatus': ''} else: slut = self.storage.get('sluts', contact.get_id())
if thread: slut = self._get_slut(int(thread)) for mail in self._iter_thread_messages(thread, only_new, slut['lastmsg'], {}): if slut['lastmsg'] < mail.get_date(): slut['lastmsg'] = mail.get_date() yield mail
def _iter_messages(self, thread, only_new): with self.browser: try: profiles = {}
last_msg = slut['lastmsg'].replace(tzinfo=tz.tzutc()) new_lastmsg = last_msg
self.storage.set('sluts', int(thread), slut) self.storage.save() else: contacts = self.browser.get_threads_list() for contact in contacts: slut = self._get_slut(contact.get_id()) last_msg = slut['lastmsg']
def _iter_messages(self, thread, only_new): with self.browser: try: profiles = {}
if only_new and contact.get_lastmsg_date() < last_msg and contact.get_status() == slut['msgstatus'] or \ not thread is None and int(thread) != contact.get_id(): continue mails = self.browser.get_thread_mails(contact.get_id()) for mail in mails: if only_new and mail.get_date() <= last_msg:
if only_new and contact.get_lastmsg_date() < last_msg and contact.get_status() == slut['msgstatus'] or \ not thread is None and int(thread) != contact.get_id():
def _iter_messages(self, thread, only_new): with self.browser: try: profiles = {}
if not mail.profile_link in profiles: profiles[mail.profile_link] = self.browser.get_profile(mail.profile_link) mail.signature += u'\n%s' % profiles[mail.profile_link].get_profile_text()
for mail in self._iter_thread_messages(contact.get_id(), only_new, last_msg, profiles): if last_msg < mail.get_date(): last_msg = mail.get_date()
def _iter_messages(self, thread, only_new): with self.browser: try: profiles = {}
if new_lastmsg < mail.get_date(): new_lastmsg = mail.get_date()
yield mail
def _iter_messages(self, thread, only_new): with self.browser: try: profiles = {}
yield mail
slut['lastmsg'] = last_msg slut['msgstatus'] = contact.get_status() self.storage.set('sluts', contact.get_id(), slut) self.storage.save()
def _iter_messages(self, thread, only_new): with self.browser: try: profiles = {}
slut['lastmsg'] = new_lastmsg slut['msgstatus'] = contact.get_status() self.storage.set('sluts', contact.get_id(), slut) self.storage.save()
new_baskets = self.browser.nb_new_baskets() if new_baskets: ids = self.browser.get_baskets() while new_baskets > 0: new_baskets -= 1 profile = self.browser.get_profile(ids[new_baskets])
def _iter_messages(self, thread, only_new): with self.browser: try: profiles = {}
new_baskets = self.browser.nb_new_baskets() if new_baskets: ids = self.browser.get_baskets() while new_baskets > 0: new_baskets -= 1 profile = self.browser.get_profile(ids[new_baskets]) yield Message(profile.get_id(), 1, title='Basket of %s' % profile.get_name(), sender=profile.get_name(), content='You are taken in he...
yield Message(profile.get_id(), 1, title='Basket of %s' % profile.get_name(), sender=profile.get_name(), content='You are taken in her basket!', signature=profile.get_profile_text())
def _iter_messages(self, thread, only_new): with self.browser: try: profiles = {}
self.warning('Fake %s can\'t login: %s' % (name, e))
self.logger.warning('Fake %s can\'t login: %s' % (name, e))
def activity_fakes(self): try: fakes = self.storage.get('priority_connection', 'fakes', default={}) if len(fakes) == 0: return while 1: name = random.choice(fakes.keys()) fake = fakes[name] try: browser = AuMBrowser(fake['username'], fake['password'], proxy=self.browser.proxy) except (AdopteBanned,BrowserIncorrectPassw...
return self.thread.id == msg.thread.id and self.id == msg.id
return unicode(self.thread.id) == unicode(msg.thread.id) and \ unicode(self.id) == unicode(msg.id)
def __eq__(self, msg): return self.thread.id == msg.thread.id and self.id == msg.id
@return the BackendsCall object (iteratable)
@return the BackendsCall object (iterable)
def do(self, function, *args, **kwargs): """ Do calls on loaded backends with specified arguments, in separated threads.
pass
debug(u'Python xdg module was not found. Please install it to read icon files.')
def icon_path(self): if self.klass.ICON is None: try: import xdg.IconTheme except ImportError: pass else: self.klass.ICON = xdg.IconTheme.getIconPath(self.klass.NAME) return self.klass.ICON
body += u'\n\t\t%s' % unicode(photo)
body += u'\n\t\t%s%s' % (unicode(photo['url']), (' (hidden)' if photo['hidden'] else ''))
def get_profile_text(self): body = u'Status: %s' % unicode(self.status) if self.photos: body += u'\nPhotos:' for photo in self.photos: body += u'\n\t\t%s' % unicode(photo) body += u'\nStats:' for label, value in self.get_stats().iteritems(): body += u'\n\t\t%-15s %s' % (label + ':', value) body += u'\n\nInformations:' ...
v.author = li.find('i').text
author = li.find('i') if author is None: author = li.find('a') if author is None: v.author = value else: v.author = author.text
def set_details(self, v): div = self.document.getroot().cssselect('div[id=details]') if not div: return
if name not in [name for name, backend in self.weboob.backends_loader.loaded.iteritems()]:
if name not in [_name for _name, backend in self.weboob.backends_loader.loaded.iteritems()]:
def command_add(self, name, *options): self.weboob.backends_loader.load_all() if name not in [name for name, backend in self.weboob.backends_loader.loaded.iteritems()]: logging.error(u'Backend "%s" does not exist.' % name) return 1
result +=u'%s Total %8s %8s' % (('-' * 15) if not self.interactive else '',
result +=u'%s Total %8s %8s' % ((' ' * 15) if not self.interactive else '',
def flush(self): result = u'------------------------------------------%s+----------+----------\n' % (('-' * 15) if not self.interactive else '') result +=u'%s Total %8s %8s' % (('-' * 15) if not self.interactive else '', '%.2f' % self.tot_balance, '%.2f' % self.tot_coming) self.af...
self.tot_balance = 0 self.tot_coming = 0
self.tot_balance = 0.0 self.tot_coming = 0.0
def flush(self): result = u'------------------------------------------%s+----------+----------\n' % (('-' * 15) if not self.interactive else '') result +=u'%s Total %8s %8s' % (('-' * 15) if not self.interactive else '', '%.2f' % self.tot_balance, '%.2f' % self.tot_coming) self.af...
item['label'], '%.2f' % item['balance'], '%.2f' % item['coming'])
item['label'], '%.2f' % item['balance'], '%.2f' % (item['coming'] or 0.0))
def format_dict(self, item): self.count += 1 if self.interactive: backend = item['id'].split('@', 1)[1] id = '#%d (%s)' % (self.count, backend) else: id = item['id']
self._target.data(unichr(htmlentitydefs.name2codepoint[name]))
try: self._target.data(unichr(htmlentitydefs.name2codepoint[name])) except KeyError: self._target.data('&' + name)
def handle_entityref(self, name): self._target.data(unichr(htmlentitydefs.name2codepoint[name]))
data = self.extract_text(body_elmt).replace(',', '.').replace(' ', '')
data = self.extract_text(body_elmt).replace(',', '.').replace(' ', '').replace(u'\xa0', '')
def get_history(self, start_index = 0): """ Returns the history of a specific account. Note that this function expects the current page page to be the one dedicated to this history. """ # tested on CA Lorraine, Paris, Toulouse # avoir parsing the page as an account-dedicated page if it is not the case if not self.is_ac...
data = self.extract_text(interesting_divs[(i*3)+1]).replace(',', '.').replace(' ', '')
data = self.extract_text(interesting_divs[(i*3)+1]).replace(',', '.').replace(' ', '').replace(u'\xa0', '')
def get_history(self, start_index = 0): """ Returns the history of a specific account. Note that this function expects the current page page to be the one dedicated to this history. """ # tested on CA Lorraine, Paris, Toulouse # avoir parsing the page as an account-dedicated page if it is not the case if not self.is_ac...
def do_current(self, city):
def do_current(self, line):
def do_current(self, city): """ current CITY
self.format(current)
if current: self.format(current)
def do_current(self, city): """ current CITY