bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def save_section(values, root_section=None): for k, v in values.iteritems(): if isinstance(v, (int, float, basestring)): if root_section is not None and not self.config.has_section(root_section): self.config.add_section(root_section) self.config.set(root_section, k, unicode(v)) elif isinstance(v, dict): new_section = '... | def save_section(values, root_section=None): for k, v in values.iteritems(): if isinstance(v, (int, float, basestring)): if root_section is not None and not self.config.has_section(root_section): self.config.add_section(root_section) self.config.set(root_section, k, unicode(v)) elif isinstance(v, dict): new_section = '... | 446,200 |
def set(self, *args): v = self.values for k in args[:-2]: if k not in v: v[k] = {} v = v[k] v[args[-2]] = args[-1] | def set(self, *args): v = self.values for k in args[:-2]: if k not in v: v[k] = OrderedDict() v = v[k] v[args[-2]] = args[-1] | 446,201 |
def do(self, function, *args, **kwargs): """ Do calls on loaded backends with specified arguments, in separated threads. | def do(self, function, *args, **kwargs): """ Do calls on loaded backends with specified arguments, in separated threads. | 446,202 |
def get_accounts_list(self): | def get_accounts_list(self): | 446,203 |
def get_accounts_list(self): | def get_accounts_list(self): | 446,204 |
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 _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... | 446,205 |
def __init__(self, display_keys=True, return_only=False, result_funcname='get_string'): IFormatter.__init__(self, display_keys, return_only) self.result_funcname = result_funcname | def __init__(self, display_keys=True, return_only=False, result_funcname='get_string'): IFormatter.__init__(self, display_keys=display_keys, return_only=return_only) self.result_funcname = result_funcname | 446,206 |
def _repeat_callback(self, count, interval, function, args): function(*args) with self.mutex: e = self.queue[count] self.logger.debug('function "%s" will be called in %s seconds' % (function.__name__, e.interval)) | def _repeat_callback(self, count, interval, function, args): function(*args) with self.mutex: e = self.queue[count] self.logger.debug('function "%s" will be called in %s seconds' % (function.__name__, e.interval)) | 446,207 |
def __init__(self, api='etree'): HTMLParser.__init__(self, tree=treebuilders.getTreeBuilder(api, ElementTree)) | def __init__(self, api='etree'): HTMLParser.__init__(self, tree=treebuilders.getTreeBuilder(api, ElementTree)) | 446,208 |
def get_history(self): index = 0 for tr in self.document.getiterator('tr'): first_td = tr.getchildren()[0] if first_td.attrib.get('class', '') == 'i g' or first_td.attrib.get('class', '') == 'p g': operation = Operation(index) index += 1 operation.date = first_td.text operation.label = tr.getchildren()[2].text.replace(... | def get_history(self): index = 0 for tr in self.document.getiterator('tr'): first_td = tr.getchildren()[0] if first_td.attrib.get('class', '') == 'i g' or first_td.attrib.get('class', '') == 'p g': operation = Operation(index) index += 1 operation.date = first_td.text operation.label = tr.getchildren()[2].text.replace(... | 446,209 |
def f(x): return x.startswith('command_' + command) | def f(x): return x.startswith('command_' + command) | 446,210 |
def parse_date(self, date_s): return local2utc(datetime.strptime(unicode(date_s.strip()), u'le %d/%m/%Y à %H:%M.')) | def parse_date(self, date_s): return local2utc(datetime.strptime(unicode(date_s.strip()), u'le %d/%m/%Y à %H:%M.')) | 446,211 |
def __str__(self): return '%s\n%s' % (Exception.__str__(self), self.original_backtrace) | def __str__(self): return '%s\n%s' % (Exception.__str__(self), self.original_backtrace) | 446,212 |
def __init__(self, website, *args, **kwargs): self.DOMAIN = website self.PAGES = {'https://%s/' % website: pages.LoginPage, 'https://%s/.*\.c.*' % website: pages.AccountsList, } Browser.__init__(self, *args, **kwargs) | def __init__(self, website, *args, **kwargs): self.DOMAIN = website self.PAGES = {'https://%s/' % website: pages.LoginPage, 'https://%s/.*\.c.*' % website: pages.AccountsList, 'https://%s/login/process' % website: pages.AccountsList, } Browser.__init__(self, *args, **kwargs) | 446,213 |
def home(self): self.location('https://%s/' % self.DOMAIN) | def home(self): self.location('https://%s/' % self.DOMAIN) | 446,214 |
def is_logged(self): return not self.is_on_page(pages.LoginPage) or self.is_logging | def is_logged(self): return not self.is_on_page(pages.LoginPage) or self.is_logging | 446,215 |
def __repr__(self): return u"<Account id='%s' label='%s'>" % (self.id, self.label) | def __repr__(self): return u"<Account id='%s' label='%s'>" % (self.id, self.label) | 446,216 |
def utc2local(d): d = d.replace(tzinfo=tz.tzutc()) d = d.astimezone(tz.tzlocal()) return d | def utc2local(d): d = d.replace(tzinfo=tz.tzutc()) d = d.astimezone(tz.tzlocal()) return d | 446,217 |
def start(self): if self.config is None: return False | def start(self): if self.config is None: return False | 446,218 |
def __init__(self, weboob, name, config, storage): self.weboob = weboob self.name = name self.config = {} for name, field in self.CONFIG.iteritems(): value = config.get(name, field.default) | def __init__(self, weboob, name, config, storage): self.weboob = weboob self.name = name self.config = {} for name, field in self.CONFIG.iteritems(): value = config.get(name, field.default) | 446,219 |
def __init__(self, weboob, name, config, storage): self.weboob = weboob self.name = name self.config = {} for name, field in self.CONFIG.iteritems(): value = config.get(name, field.default) | def __init__(self, weboob, name, config, storage): self.weboob = weboob self.name = name self.config = {} for name, field in self.CONFIG.iteritems(): value = config.get(name, field.default) | 446,220 |
def __init__(self, weboob, name, config, storage): self.weboob = weboob self.name = name self.config = {} for name, field in self.CONFIG.iteritems(): value = config.get(name, field.default) | def __init__(self, weboob, name, config, storage): self.weboob = weboob self.name = name self.config = {} for name, field in self.CONFIG.iteritems(): value = config.get(name, field.default) | 446,221 |
def load_section(section): sections = section.split(':') if len(sections) > 1: for s in sections: values = load_section(s) else: return {section: dict(self.config.items(section))} | def load_section(section): sections = section.split(':') if len(sections) > 1: for s in sections: result[s] = load_section(s) return result else: return {section: dict(self.config.items(section))} | 446,222 |
def get_coming_operations(self, account): if not self.is_on_page(pages.AccountComing) or self.page.account.id != account.id: self.location('/NS_AVEET?ch4=%s' % account.link_id) return self.page.get_operations() | def get_coming_operations(self, account): if not self.is_on_page(pages.AccountComing) or self.page.account.id != account.id: self.location('/NS_AVEDT?ch4=%s' % account.link_id) return self.page.get_operations() | 446,223 |
def fill_contact(self, contact, fields): if 'profile' in fields: contact = self.get_contact(contact) if 'photos' in fields: for name, photo in contact.photos.iteritems(): with self.browser: if photo.url: data = self.browser.openurl(photo.url).read() contact.set_photo(name, data=data) if photo.thumbnail_url: data = self... | def fill_contact(self, contact, fields): if 'profile' in fields: contact = self.get_contact(contact) if 'photos' in fields and contact.photos: for name, photo in contact.photos.iteritems(): with self.browser: if photo.url: data = self.browser.openurl(photo.url).read() contact.set_photo(name, data=data) if photo.thumbna... | 446,224 |
def get_transfer_id(self): p = self.document.xpath("//form/div/p")[0] text = to_unicode(p.text).strip() | def get_transfer_id(self): p = self.document.xpath("//form/div/p")[0] text = to_unicode(p.text).strip() | 446,225 |
def post_mesage(self, message): with self.browser: return self.browser.post_reply(message.thread.id, message.parent.id, message.title, message.content) | def post_message(self, message): if not message.parent: raise CantSendMessage('Posting news and telegrams on DLFP is not supported yet') assert message.thread with self.browser: return self.browser.post_reply(message.thread.id, message.parent.id, message.title, message.content) | 446,226 |
def check_godchilds(self): with self.browser: try: my_id = self.browser.get_my_id() nb_godchilds = self.browser.nb_godchilds() except AdopteWait: nb_godchilds = 0 except BrowserUnavailable: # We'll check later return | def check_godchilds(self): with self.browser: try: my_id = self.browser.get_my_id() nb_godchilds = self.browser.nb_godchilds() except AdopteWait: nb_godchilds = 0 except BrowserUnavailable: # We'll check later return | 446,227 |
def check_godchilds(self): with self.browser: try: my_id = self.browser.get_my_id() nb_godchilds = self.browser.nb_godchilds() except AdopteWait: nb_godchilds = 0 except BrowserUnavailable: # We'll check later return | def check_godchilds(self): with self.browser: try: my_id = self.browser.get_my_id() nb_godchilds = self.browser.nb_godchilds() except AdopteWait: nb_godchilds = 0 except BrowserUnavailable: # We'll check later return | 446,228 |
def activity_fakes(self): fakes = self.storage.get('priority_connection', 'fakes', default={}) while 1: name = random.choice(fakes.keys()) fake = fakes[name] try: browser = AuMBrowser(fake['username'], fake['password'], proxy=self.browser.proxy) except (AdopteBanned,BrowserIncorrectPassword), e: self.warning('Fake %s c... | def activity_fakes(self): fakes = self.storage.get('priority_connection', 'fakes', default={}) while 1: name = random.choice(fakes.keys()) fake = fakes[name] try: browser = AuMBrowser(fake['username'], fake['password'], proxy=self.browser.proxy) except (AdopteBanned,BrowserIncorrectPassword), e: self.warning('Fake %s c... | 446,229 |
def activity_fakes(self): fakes = self.storage.get('priority_connection', 'fakes', default={}) while 1: name = random.choice(fakes.keys()) fake = fakes[name] try: browser = AuMBrowser(fake['username'], fake['password'], proxy=self.browser.proxy) except (AdopteBanned,BrowserIncorrectPassword), e: self.warning('Fake %s c... | def activity_fakes(self): fakes = self.storage.get('priority_connection', 'fakes', default={}) while 1: name = random.choice(fakes.keys()) fake = fakes[name] try: browser = AuMBrowser(fake['username'], fake['password'], proxy=self.browser.proxy) except (AdopteBanned,BrowserIncorrectPassword), e: self.warning('Fake %s c... | 446,230 |
def activity_fakes(self): fakes = self.storage.get('priority_connection', 'fakes', default={}) while 1: name = random.choice(fakes.keys()) fake = fakes[name] try: browser = AuMBrowser(fake['username'], fake['password'], proxy=self.browser.proxy) except (AdopteBanned,BrowserIncorrectPassword), e: self.warning('Fake %s c... | def activity_fakes(self): fakes = self.storage.get('priority_connection', 'fakes', default={}) while 1: name = random.choice(fakes.keys()) fake = fakes[name] try: browser = AuMBrowser(fake['username'], fake['password'], proxy=self.browser.proxy) except (AdopteBanned,BrowserIncorrectPassword), e: self.warning('Fake %s c... | 446,231 |
def label_set(self, value): self._label = str(value) | def label(self, value): self._label = str(value) | 446,232 |
def amount_set(self, value): self._amount = float(value) | def amount(self, value): self._amount = float(value) | 446,233 |
def _callback_thread_run(self, callback, errback): responses = [] while not self.finish_event.isSet(): self.response_event.wait() with self.mutex: responses = self.responses self.responses = [] | def _callback_thread_run(self, callback, errback): responses = [] while not self.finish_event.isSet() or self.response_event.isSet(): self.response_event.wait() with self.mutex: responses = self.responses self.responses = [] | 446,234 |
def __iter__(self): # Don't know how to factorize with _callback_thread_run responses = [] while not self.finish_event.isSet(): self.response_event.wait() with self.mutex: responses = self.responses self.responses = [] | def __iter__(self): # Don't know how to factorize with _callback_thread_run responses = [] while not self.finish_event.isSet() or self.response_event.isSet(): self.response_event.wait() with self.mutex: responses = self.responses self.responses = [] | 446,235 |
def get_thread(self, id, profiles=None): """ Get a thread and its messages. | def get_thread(self, id, profiles=None): """ Get a thread and its messages. | 446,236 |
def get_contact(self, contact): try: with self.browser: 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) | def get_contact(self, contact): try: with self.browser: 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) | 446,237 |
def get(self, backend, *args, **kwargs): raise NotImplementedError() | def get(self, backend, *args, **kwargs): raise NotImplementedError() | 446,238 |
def onecmd(self, line): """ This REPL method is overrided to catch some particular exceptions. """ cmd, arg, ignored = self.parseline(line) | def onecmd(self, line): """ This REPL method is overrided to catch some particular exceptions. """ cmd, arg, ignored = self.parseline(line) | 446,239 |
def do_logging(self, line): """ logging [LEVEL] | def do_logging(self, line): """ logging [LEVEL] | 446,240 |
def get_email_address_ident(self, msg, header): s = msg.get(header) m = re.match('.*<(.*)@(.*)>', s) if m: return m.group(1) else: try: return s.split('@')[0] except IndexError: return s | def get_email_address_ident(self, msg, header): s = msg.get(header) m = re.match('.*<([^@]*)@(.*)>', s) if m: return m.group(1) else: try: return s.split('@')[0] except IndexError: return s | 446,241 |
def get_accounts_list(self): if not self.is_on_page(pages.AccountsList): self.home() return self.page.get_list() | def get_accounts_list(self): if not self.is_on_page(pages.AccountsList) or self.page.is_account_page(): self.home() return self.page.get_list() | 446,242 |
def __init__(self): html5lib.HTMLParser.__init__(tree=treebuilders.getTreeBuilder("dom")) | def __init__(self): html5lib.HTMLParser.__init__(tree=treebuilders.getTreeBuilder("dom")) | 446,243 |
def submit(self, *args, **kwargs): try: self.__changeLocation(mechanize.Browser.submit(self, *args, **kwargs)) except (mechanize.response_seek_wrapper, urllib2.HTTPError, urllib2.URLError), e: error(e) self.page = None raise BrowserUnavailable() except (mechanize.BrowserStateError,BrowserRetry): self.home() raise Brows... | def submit(self, *args, **kwargs): try: self.__change_location(mechanize.Browser.submit(self, *args, **kwargs)) except (mechanize.response_seek_wrapper, urllib2.HTTPError, urllib2.URLError), e: error(e) self.page = None raise BrowserUnavailable() except (mechanize.BrowserStateError,BrowserRetry): self.home() raise Brow... | 446,244 |
def follow_link(self, *args, **kwargs): try: self.__changeLocation(mechanize.Browser.follow_link(self, *args, **kwargs)) except (mechanize.response_seek_wrapper, urllib2.HTTPError, urllib2.URLError), e: error(e) self.page = None raise BrowserUnavailable() except (mechanize.BrowserStateError,BrowserRetry): self.home() r... | def follow_link(self, *args, **kwargs): try: self.__change_location(mechanize.Browser.follow_link(self, *args, **kwargs)) except (mechanize.response_seek_wrapper, urllib2.HTTPError, urllib2.URLError), e: error(e) self.page = None raise BrowserUnavailable() except (mechanize.BrowserStateError,BrowserRetry): self.home() ... | 446,245 |
def location(self, *args, **kwargs): keep_args = copy(args) keep_kwargs = kwargs.copy() | def location(self, *args, **kwargs): keep_args = copy(args) keep_kwargs = kwargs.copy() | 446,246 |
def __change_location(self, result): # Find page from url pageCls = None for key, value in self.PAGES.items(): regexp = re.compile('^%s$' % key) m = regexp.match(result.geturl()) if m: pageCls = value break | def __change_location(self, result): # Find page from url pageCls = None for key, value in self.PAGES.items(): regexp = re.compile('^%s$' % key) m = regexp.match(result.geturl()) if m: pageCls = value break | 446,247 |
def get_thread(self, id): thread = None if isinstance(id, Thread): thread = id id = thread.id | def get_thread(self, id, profiles=None): """ Get a thread and its messages. The 'profiles' parameter is only used for internal calls. """ thread = None if isinstance(id, Thread): thread = id id = thread.id | 446,248 |
def iter_unread_messages(self, thread=None): try: with self.browser: contacts = self.browser.get_threads_list() for contact in contacts: slut = self._get_slut(contact.get_id()) if contact.get_lastmsg_date() > slut['lastmsg']: thread = self.get_thread(contact.get_id()) for m in thread.iter_all_messages(): if m.flags & m... | def iter_unread_messages(self, thread=None): try: with self.browser: contacts = self.browser.get_threads_list() for contact in contacts: slut = self._get_slut(contact.get_id()) if contact.get_lastmsg_date() > slut['lastmsg']: thread = self.get_thread(contact.get_id(), profiles) for m in thread.iter_all_messages(): if m... | 446,249 |
def f(x): return x.startswith('command_' + command) | def f(x): return x.startswith('command_' + command) | 446,250 |
def getArguments(func, skip=0): """ Get arguments of a function as a string. skip is the number of skipped arguments. """ skip += 1 args, varargs, varkw, defaults = getargspec(func) cut = len(args) if defaults: cut -= len(defaults) args = ["<%s>" % a for a in args[skip:cut]] + \ ["[%s]" % a for a in args[cut:]] if vara... | def getArguments(func, skip=0): """ Get arguments of a function as a string. skip is the number of skipped arguments. """ skip += 1 args, varargs, varkw, defaults = getargspec(func) cut = len(args) if defaults: cut -= len(defaults) args = ["<%s>" % a for a in args[skip:cut]] + \ ["[%s]" % a for a in args[cut:]] if vara... | 446,251 |
def getArguments(func, skip=0): """ Get arguments of a function as a string. skip is the number of skipped arguments. """ skip += 1 args, varargs, varkw, defaults = getargspec(func) cut = len(args) if defaults: cut -= len(defaults) args = ["<%s>" % a for a in args[skip:cut]] + \ ["[%s]" % a for a in args[cut:]] if vara... | def getArguments(func, skip=0): """ Get arguments of a function as a string. skip is the number of skipped arguments. """ skip += 1 args, varargs, varkw, defaults = getargspec(func) cut = len(args) if defaults: cut -= len(defaults) args = ["<%s>" % a for a in args[skip:cut]] + \ ["[%s]" % a for a in args[cut:]] if vara... | 446,252 |
def get_date_and_duration(self): duration_regexp = re.compile('(.+) - (.+)min(.+)s') el = self.document.getroot().cssselect('.bloc-video-edito h3')[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, month, day)... | 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... | 446,253 |
def get_title(self): el = self.document.getroot().cssselect('.bloc-video-edito h2')[0] if el is not None: return unicode(el.text.strip()) else: return None | def get_title(self): el = self.document.getroot().cssselect('div.bloc-produit-haut h1')[0] if el is not None: return unicode(el.text.strip()) else: return None | 446,254 |
def not_loaded(v): return (v is NotLoaded or isinstance(value, CapBaseObject) and not value.__iscomplete__()) | def not_loaded(v): return (v is NotLoaded or isinstance(value, CapBaseObject) and not value.__iscomplete__()) | 446,255 |
def command_listconfigured(self): self.set_default_formatter('table') for instance_name, name, params in sorted(self.weboob.backends_config.iter_backends()): backend = self.weboob.modules_loader.get_or_load_module(name) row = OrderedDict([('Instance name', instance_name), ('Backend name', name), ('Configuration', ', '.... | def command_listconfigured(self): self.set_default_formatter('table') for instance_name, name, params in sorted(self.weboob.backends_config.iter_backends()): backend = self.weboob.modules_loader.get_or_load_module(name) row = OrderedDict([('Instance name', instance_name), ('Backend name', name), ('Configuration', ', '.... | 446,256 |
def do(self, function, *args, **kwargs): """ Do calls on loaded backends with specified arguments, in separated threads. | def do(self, function, *args, **kwargs): """ Do calls on loaded backends with specified arguments, in separated threads. | 446,257 |
def iter_select_and_decorate(d): if hasattr(obj, '__id__'): id_attr = getattr(obj, '__id__') if not isinstance(id_attr, (set, list, tuple)): id_attr = (id_attr,) id_fields = id_attr else: id_fields = ('id',) if selected_fields is None or '*' in selected_fields: for k, v in d: if k in id_fields and backend_name is not N... | def iter_select_and_decorate(d): if hasattr(obj, '__id__'): id_attr = getattr(obj, '__id__') if not isinstance(id_attr, (set, list, tuple)): id_attr = (id_attr,) id_fields = id_attr else: id_fields = ('id',) if selected_fields is None or '*' in selected_fields: for k, v in d: if k in id_fields and backend_name is not N... | 446,258 |
def iter_torrents(self): table = self.document.getroot().cssselect('table.torrent_table') if not table: table = self.document.getroot().cssselect('table#browse_torrent_table') if table: table = table[0] current_group = None for tr in table.findall('tr'): if tr.attrib.get('class', '') == 'group': tds = tr.findall('td') ... | def iter_torrents(self): table = self.document.getroot().cssselect('table.torrent_table') if not table: table = self.document.getroot().cssselect('table#browse_torrent_table') if table: table = table[0] current_group = None for tr in table.findall('tr'): if tr.attrib.get('class', '') == 'group': tds = tr.findall('td') ... | 446,259 |
def iter_torrents(self): table = self.document.getroot().cssselect('table.torrent_table') if not table: table = self.document.getroot().cssselect('table#browse_torrent_table') if table: table = table[0] current_group = None for tr in table.findall('tr'): if tr.attrib.get('class', '') == 'group': tds = tr.findall('td') ... | def iter_torrents(self): table = self.document.getroot().cssselect('table.torrent_table') if not table: table = self.document.getroot().cssselect('table#browse_torrent_table') if table: table = table[0] current_group = None for tr in table.findall('tr'): if tr.attrib.get('class', '') == 'group': tds = tr.findall('td') ... | 446,260 |
def iter_torrents(self): table = self.document.getroot().cssselect('table.torrent_table') if not table: table = self.document.getroot().cssselect('table#browse_torrent_table') if table: table = table[0] current_group = None for tr in table.findall('tr'): if tr.attrib.get('class', '') == 'group': tds = tr.findall('td') ... | def iter_torrents(self): table = self.document.getroot().cssselect('table.torrent_table') if not table: table = self.document.getroot().cssselect('table#browse_torrent_table') if table: table = table[0] current_group = None for tr in table.findall('tr'): if tr.attrib.get('class', '') == 'group': tds = tr.findall('td') ... | 446,261 |
def command_applications(self, *caps): import weboob.applications path = weboob.applications.__path__[0] applications = [] regexp = re.compile('^%s/([\w\d_]+)$' % path) for root, dirs, files in os.walk(path): m = regexp.match(root) if m and '__init__.py' in files: applications.append(m.group(1)) | def command_applications(self, *caps): import weboob.applications path = weboob.applications.__path__[0] applications = [] regexp = re.compile('^%s/([\w\d_]+)$' % path) for root, dirs, files in os.walk(path): m = regexp.match(root) if m and '__init__.py' in files: applications.append(m.group(1)) | 446,262 |
def parse_profile_link(self): tables = self.tr.getElementsByTagName('div') | def parse_profile_link(self): tables = self.tr.getElementsByTagName('div') | 446,263 |
def iter_videos(self): ul = select(self.document.getroot(), 'div.container-videos ul', 1) for li in ul.findall('li'): id = re.sub(r'/video/(.+)\.html', r'\1', li.find('a').attrib['href']) | def iter_videos(self): try: ul = select(self.document.getroot(), 'div.container-videos ul', 1) except SelectElementException: return for li in ul.findall('li'): id = re.sub(r'/video/(.+)\.html', r'\1', li.find('a').attrib['href']) | 446,264 |
def do_backends(self, line): """ backends [CAPS ...] | def do_backends(self, line): """ backends [CAPS ...] | 446,265 |
def do_backends(self, line): """ backends [CAPS ...] | def do_backends(self, line): """ backends [CAPS ...] | 446,266 |
def get_title(self): el = self.document.getroot().cssselect('h1') if el: return unicode(el[0].getchildren()[0].tail).strip() | def get_title(self): el = self.document.getroot().cssselect(' if el: return unicode(el[0].getchildren()[0].tail).strip() | 446,267 |
def get_transfer_id(self): p = self.document.xpath("//form/div/p")[0] text = to_unicode(p.text).strip() | def get_transfer_id(self): p = self.document.xpath("//form/div/p")[0] text = to_unicode(p.text).strip() | 446,268 |
def process_incoming_mail(self, msg): to = self.get_email_address_ident(msg, 'To') reply_to = self.get_email_address_ident(msg, 'In-Reply-To') if not reply_to: print >>sys.stderr, 'This is not a reply (no Reply-To field)' return 1 | def process_incoming_mail(self, msg): to = self.get_email_address_ident(msg, 'To') reply_to = self.get_email_address_ident(msg, 'In-Reply-To') if not reply_to: print >>sys.stderr, 'This is not a reply (no Reply-To field)' return 1 | 446,269 |
def is_logged(self): for form in self.document.xpath('/html/body//form//input[@name = "code"]'): return False | def is_logged(self): for form in self.document.xpath('/html/body//form//input[@name = "code"]'): return False | 446,270 |
def ICON(self): try: import xdg.IconTheme except ImportError: self.logger.debug(u'Python xdg module was not found. Please install it to read icon files.') else: return xdg.IconTheme.getIconPath(self.NAME) | def ICON(klass): try: import xdg.IconTheme except ImportError: self.logger.debug(u'Python xdg module was not found. Please install it to read icon files.') else: return xdg.IconTheme.getIconPath(self.NAME) | 446,271 |
def ICON(self): try: import xdg.IconTheme except ImportError: self.logger.debug(u'Python xdg module was not found. Please install it to read icon files.') else: return xdg.IconTheme.getIconPath(self.NAME) | def ICON(self): try: import xdg.IconTheme except ImportError: getLogger(klass.NAME).debug(u'Python xdg module was not found. Please install it to read icon files.') else: return xdg.IconTheme.getIconPath(self.NAME) | 446,272 |
def ICON(self): try: import xdg.IconTheme except ImportError: self.logger.debug(u'Python xdg module was not found. Please install it to read icon files.') else: return xdg.IconTheme.getIconPath(self.NAME) | def ICON(self): try: import xdg.IconTheme except ImportError: self.logger.debug(u'Python xdg module was not found. Please install it to read icon files.') else: return xdg.IconTheme.getIconPath(self.NAME) | 446,273 |
def _insert_load_button(self, pos): button = QPushButton(self.tr('More messages...')) self.connect(button, SIGNAL('clicked()'), lambda: self._load_button_pressed(button)) if pos >= 0: self.ui.scrollAreaContent.layout().insertWidget(i, button) else: self.ui.scrollAreaContent.layout().addWidget(button) | def _insert_load_button(self, pos): button = QPushButton(self.tr('More messages...')) self.connect(button, SIGNAL('clicked()'), lambda: self._load_button_pressed(button)) if pos >= 0: self.ui.scrollAreaContent.layout().insertWidget(pos, button) else: self.ui.scrollAreaContent.layout().addWidget(button) | 446,274 |
def resolve_gpr64(u, inst, gpr_op): """64bit General Purpose Register-Selection.""" if gpr_op in range(OP_rAXr8, OP_rDIr15) : index = (gpr_op - OP_rAXr8) |(REX_B(inst.pfx.rex) << 3) else: index = gpr_op - OP_rAX if inst.opr_mode == 16: return GPR[16][index] elif u.dis_mode == 32 and not(inst.opr_mode == 64 or REX_W(in... | def resolve_gpr64(u, inst, gpr_op): """64bit General Purpose Register-Selection.""" if gpr_op in range(OP_rAXr8, OP_rDIr15) : index = (gpr_op - OP_rAXr8) |(REX_B(inst.pfx.rex) << 3) else: index = gpr_op - OP_rAX if inst.opr_mode == 16: return GPR[16][index] elif u.dis_mode == 32 or not(inst.opr_mode == 32 and REX_W(in... | 446,275 |
def __init__(self, source, base_address): BufferHook.__init__(self, source, base_address) import pefile self.pe = pefile.PE(data = source) self.source = self.pe.get_memory_mapped_image() self.base_address = self.pe.OPTIONAL_HEADER.ImageBase self.entry_point = (self.base_address + self.pe.OPTIONAL_HEADER.AddressOfEntryP... | def __init__(self, source, base_address): BufferHook.__init__(self, source, base_address) try : import pefile except : print('pefile module not found. see http://code.google.com/p/pefile/') exit() self.pe = pefile.PE(data = source) self.source = self.pe.get_memory_mapped_image() self.base_address = self.pe.OPTIONAL_HEA... | 446,276 |
def symbols(self): ret = {} for entry in self.pe.DIRECTORY_ENTRY_IMPORT: for imp in entry.imports: if imp.name: ret[imp.address] = imp.name | def symbols(self): ret = {} for entry in self.pe.DIRECTORY_ENTRY_IMPORT: for imp in entry.imports: if imp.name: ret[imp.address] = imp.name | 446,277 |
def resolve_gpr64(u, inst, gpr_op): """64bit General Purpose Register-Selection.""" if gpr_op in range(OP_rAXr8, OP_rDIr15) : index = (gpr_op - OP_rAXr8) |(REX_B(inst.pfx.rex) << 3) else: index = gpr_op - OP_rAX if inst.opr_mode == 16: return GPR[16][index] elif u.dis_mode == 32 or not(inst.opr_mode == 32 and REX_W(in... | def resolve_gpr64(u, inst, gpr_op): """64bit General Purpose Register-Selection.""" if gpr_op in range(OP_rAXr8, OP_rDIr15 + 1) : index = (gpr_op - OP_rAXr8) |(REX_B(inst.pfx.rex) << 3) else: index = gpr_op - OP_rAX if inst.opr_mode == 16: return GPR[16][index] elif u.dis_mode == 32 or not(inst.opr_mode == 32 and REX_... | 446,278 |
def __init__(self,graphe,dist,angle,mark): self.graphe = graphe self.dist = dist self.angle = angle self.mark = mark | def __init__(self,graphe,dist,angle,text): self.graphe = graphe self.dist = dist self.angle = angle self.mark = mark | 446,279 |
def __init__(self,graphe,dist,angle,mark): self.graphe = graphe self.dist = dist self.angle = angle self.mark = mark | def __init__(self,graphe,dist,angle,mark): self.graphe = graphe self.dist = dist self.angle = angle self.mark = mark | 446,280 |
def mark(self,dist,angle,mark): self.marque = True self.mark = Mark(self,dist,angle,mark) | def put_mark(self,dist,angle,text): self.marque = True self.mark = Mark(self,dist,angle,mark) | 446,281 |
def mark(self,dist,angle,mark): self.marque = True self.mark = Mark(self,dist,angle,mark) | def mark(self,dist,angle,mark): self.marque = True self.mark = Mark(self,dist,angle,mark) | 446,282 |
def bounding_box(self,pspict): """ return the bounding box of the point including its mark | def bounding_box(self,pspict): """ return the bounding box of the point including its mark | 446,283 |
def bounding_box(self,pspict): """ return the bounding box of the point including its mark | def bounding_box(self,pspict): """ return the bounding box of the point including its mark | 446,284 |
def drawing(self): #print "Je passe" a = [] # ++++++++++++ Le bord ++++++++ if self.draw_border : if self.BB.SO().x <> int(self.BB.SO().x): #print "SOx" seg = Segment( self.BB.SO(),self.BB.NO() ) S = GraphOfASegment(seg) S.merge_options(self.border) a.append(S) if self.BB.NE().y <> int(self.BB.NE().y): #print "NEy" seg... | defdrawing(self):#print"Jepasse"a=[]#++++++++++++Lebord++++++++ifself.draw_border:ifself.BB.SO().x<>int(self.BB.SO().x):#print"SOx"seg=Segment(self.BB.SO(),self.BB.NO())S=GraphOfASegment(seg)S.merge_options(self.border)a.append(S)ifself.BB.NE().y<>int(self.BB.NE().y):#print"NEy"seg=Segment(self.BB.NO(),self.BB.NE())S=G... | 446,285 |
def latex_code_for_eps(self): code = ["\documentclass{article}\n","\usepackage{pstricks,pst-eucl,pstricks-add}\n","\usepackage{pst-plot}\n","\usepackage{pst-eps}\n","\pagestyle{empty}\n"] # Allows to add some lines, like packages or macro definitions required. This is useful when one add formulas in the picture # that ... | def latex_code_for_eps(self): code = ["\documentclass{article}\n","\usepackage{pstricks,pst-eucl,pstricks-add}\n","\usepackage{pst-plot}\n","\usepackage{pst-eps}\n","\pagestyle{empty}\n\usepackage{calc}\n"] # Allows to add some lines, like packages or macro definitions required. This is useful when one add formulas in ... | 446,286 |
def latex_code_for_eps(self): code = ["\documentclass{article}\n","\usepackage{pstricks,pst-eucl,pstricks-add}\n","\usepackage{pst-plot}\n","\usepackage{pst-eps}\n","\pagestyle{empty}\n"] # Allows to add some lines, like packages or macro definitions required. This is useful when one add formulas in the picture # that ... | def latex_code_for_eps(self): code = ["\documentclass{article}\n","\usepackage{pstricks,pst-eucl,pstricks-add}\n","\usepackage{pst-plot}\n","\usepackage{pst-eps}\n","\pagestyle{empty}\n"] # Allows to add some lines, like packages or macro definitions required. This is useful when one add formulas in the picture # that ... | 446,287 |
def __init__(self,name="CAN_BE_A_PROBLEM_IF_TRY_TO_PRODUCE_EPS"): r""" A name is required for producing intermediate files. This is the case when one wants to produce eps/pdf files of one wants to make interactions with LaTeX (see pspict.get_counter_value). """ self.name = name # self.name is used in order to name the... | def __init__(self,name="CAN_BE_A_PROBLEM_IF_TRY_TO_PRODUCE_EPS_OR_PDF"): r""" A name is required for producing intermediate files. This is the case when one wants to produce eps/pdf files of one wants to make interactions with LaTeX (see pspict.get_counter_value). """ self.name = name # self.name is used in order to n... | 446,288 |
def get_counter_value(self,counter_name,default_value=0): """ return the value of the (LaTeX) counter <name> at this point of the LaTeX file | def get_counter_value(self,counter_name,default_value=0): """ return the value of the (LaTeX) counter <name> at this point of the LaTeX file | 446,289 |
def get_counter_value(self,counter_name,default_value=0): """ return the value of the (LaTeX) counter <name> at this point of the LaTeX file | def get_counter_value(self,counter_name,default_value=0): """ return the value of the (LaTeX) counter <name> at this point of the LaTeX file | 446,290 |
def get_counter_value(self,counter_name,default_value=0): """ return the value of the (LaTeX) counter <name> at this point of the LaTeX file | def get_counter_value(self,counter_name,default_value=0): """ return the value of the (LaTeX) counter <name> at this point of the LaTeX file | 446,291 |
def get_counter_value(self,counter_name,default_value=0): """ return the value of the (LaTeX) counter <name> at this point of the LaTeX file | def get_counter_value(self,counter_name,default_value=0): """ return the value of the (LaTeX) counter <name> at this point of the LaTeX file | 446,292 |
def get_counter_value(self,counter_name,default_value=0): """ return the value of the (LaTeX) counter <name> at this point of the LaTeX file | def get_counter_value(self,counter_name,default_value=0): """ return the value of the (LaTeX) counter <name> at this point of the LaTeX file | 446,293 |
def get_box_dimension(self,tex_expression,dimension_name): """ Return the dimension of the LaTeX box corresponding to the LaTeX expression tex_expression. | def get_box_dimension(self,tex_expression,dimension_name): """ Return the dimension of the LaTeX box corresponding to the LaTeX expression tex_expression. | 446,294 |
def TraceBB(self): self.TraceRectangle( Rectangle(self.BB.bg,self.BB.hd), "linecolor=cyan") | def TraceBB(self): self.TraceRectangle( Rectangle(self.BB.bg,self.BB.hd), "linecolor=cyan") | 446,295 |
def DrawGraphOfAPoint(self,graphe): p = graphe.point self.BB.AddPoint(p) self.add_latex_line( p.code(graphe.params()) ) if graphe.marque : mark = graphe.mark if p.psNom not in self.listePoint : self.AddPoint(p) #self.add_latex_line("\\rput("+p.psNom+"){\\rput("+str(dist)+";"+str(angle)+"){"+marque+"}}") self.add_latex_... | def DrawGraphOfAPoint(self,graphe): p = graphe.point self.BB.AddPoint(p) self.add_latex_line( p.code(graphe.params()) ) if graphe.marque : mark = graphe.mark if p.psNom not in self.listePoint : self.AddPoint(p) #self.add_latex_line("\\rput("+p.psNom+"){\\rput("+str(dist)+";"+str(angle)+"){"+marque+"}}") self.add_latex_... | 446,296 |
def DrawGraphOfAVector(self,graphe): if graphe.marque == False : self.DrawVector(graphe.vector,graphe.params()) if graphe.marque == True : mark = graphe.mark self.DrawVector(graphe.vector,graphe.params()).MarkTheVector(mark.dist,mark.angle,mark.mark) | def DrawGraphOfAVector(self,graphe): if graphe.marque == False : self.DrawVector(graphe.vector,graphe.params()) if graphe.marque == True : mark = graphe.mark self.DrawVector(graphe.vector,graphe.params()).MarkTheVector(mark.dist,mark.angle,mark.mark) | 446,297 |
def contenu(self): """ Notice that if the option --eps is given, this method launches some compilations when creating contenu_eps """ for sortie in globals.list_exits: if globals.__getattribute__(sortie+"_exit"): print "je vois %s"%sortie return self.__getattribute__("contenu_"+sortie)() # Erreur très intéressante si... | def contenu(self): """ Notice that if the option --eps/pdf is given, this method launches some compilations when creating contenu_eps/pdf """ for sortie in globals.list_exits: if globals.__getattribute__(sortie+"_exit"): print "je vois %s"%sortie return self.__getattribute__("contenu_"+sortie)() # Erreur très intéres... | 446,298 |
def central_point(self,pspict): """ return the central point of the mark, that is the point where the mark arrives | def central_point(self,pspict): """ return the central point of the mark, that is the point where the mark arrives | 446,299 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.