bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def clickedLabelButton(self): button = self.get_checked_label_button() label_name = str(button.text()) if label_name != self.last_checked_label: print label_name, self.last_checked_label self.last_checked_label = label_name self.update_buttons() | def clickedLabelButton(self): button = self.get_checked_label_button() label_name = str(button.text()) if label_name != self.last_checked_label: print "ButtonArea:", label_name, self.last_checked_label self.last_checked_label = label_name self.update_buttons() | 479,100 |
def clickedLabelButton(self): button = self.get_checked_label_button() label_name = str(button.text()) if label_name != self.last_checked_label: print label_name, self.last_checked_label self.last_checked_label = label_name self.update_buttons() | def clickedLabelButton(self): button = self.get_checked_label_button() label_name = str(button.text()) if label_name != self.last_checked_label: print label_name, self.last_checked_label self.last_checked_label = label_name self.update_buttons() | 479,101 |
def load(self, config_filepath): execfile(config_filepath) #if self.get_checked_label_button() == None: # if len(self.label_buttongroup.buttons()) != 0: # self.label_buttongroup.buttons()[0].setChecked(True) # #self.last_checked_label = str(self.get_checked_label_button().text()) self.update_label_buttons() s... | def load(self, config_filepath): execfile(config_filepath) #if self.get_checked_label_button() == None: # if len(self.label_buttongroup.buttons()) != 0: # self.label_buttongroup.buttons()[0].setChecked(True) # #self.last_checked_label = str(self.get_checked_label_button().text()) self.update_label_buttons() s... | 479,102 |
def load(self, config_filepath): execfile(config_filepath) #if self.get_checked_label_button() == None: # if len(self.label_buttongroup.buttons()) != 0: # self.label_buttongroup.buttons()[0].setChecked(True) # #self.last_checked_label = str(self.get_checked_label_button().text()) self.update_label_buttons() s... | def load(self, config_filepath): execfile(config_filepath) #if self.get_checked_label_button() == None: # if len(self.label_buttongroup.buttons()) != 0: # self.label_buttongroup.buttons()[0].setChecked(True) # #self.last_checked_label = str(self.get_checked_label_button().text()) self.init_button_lists() | 479,103 |
def itemChange(self, change, value): print change if change == QGraphicsItem.ItemScenePositionHasChanged: self.updateModel() return AnnotationGraphicsItem.itemChange(self, change, value) | def itemChange(self, change, value): if change == QGraphicsItem.ItemScenePositionHasChanged: self.updateModel() return AnnotationGraphicsItem.itemChange(self, change, value) | 479,104 |
def updateModel(self): if not self._delayedDirty(): self.data_['x'] = self.scenePos().x() self.data_['y'] = self.scenePos().y() print "updateModel (point)", self.data_ self.index().model().setData(self.index(), QVariant(self.data_), DataRole) | def updateModel(self): if not self._delayedDirty(): self.data_['x'] = self.scenePos().x() self.data_['y'] = self.scenePos().y() self.index().model().setData(self.index(), QVariant(self.data_), DataRole) | 479,105 |
def __init__(self, scene, model=None): self.scene_ = scene self.mode_ = None | def __init__(self, scene, mode=None): self.scene_ = scene self.mode_ = None | 479,106 |
def __init__(self, scene, model=None): self.scene_ = scene self.mode_ = None | def __init__(self, scene, model=None): self.scene_ = scene self.mode_ = None | 479,107 |
def mousePressEvent(self, event, index): pos = event.scenePos() # TODO create it in the model instead item = QGraphicsEllipseItem(QRectF(pos.x()-1, pos.y()-1, 2, 2)) self.scene().addItem(item) | def mousePressEvent(self, event, index): pos = event.scenePos() # TODO create it in the model instead item = QGraphicsEllipseItem(QRectF(pos.x()-1, pos.y()-1, 2, 2)) self.scene().addItem(item) | 479,108 |
def __init__(self, scene, model=None): ItemInserter.__init__(self, scene, model) self.current_item_ = None self.init_pos_ = None | def __init__(self, scene, mode=None): ItemInserter.__init__(self, scene, mode) self.current_item_ = None self.init_pos_ = None | 479,109 |
def mouseMoveEvent(self, event, index): if self.current_item_ is not None: assert self.init_pos_ is not None pos = event.scenePos() rect = QRectF(self.init_pos_.x(), self.init_pos_.y(), pos.x() - self.init_pos_.x(), pos.y() - self.init_pos_.y()) self.current_item_.setRect(rect.normalized()) | def mouseMoveEvent(self, event, index): if self.current_item_ is not None: assert self.init_pos_ is not None pos = event.scenePos() rect = QRectF(self.init_pos_.x(), self.init_pos_.y(), pos.x() - self.init_pos_.x(), pos.y() - self.init_pos_.y()) self.current_item_.setRect(rect.normalized()) | 479,110 |
def mouseReleaseEvent(self, event, index): if self.current_item_ is not None: if self.current_item_.rect().width() > 1 and \ self.current_item_.rect().height() > 1: # TODO commit to the model print "added rect:", self.current_item_ rect = self.current_item_.rect() ann = {'type': 'rect', 'x': rect.x(), 'y': rect.y(), 'w... | def mouseReleaseEvent(self, event, index): if self.current_item_ is not None: if self.current_item_.rect().width() > 1 and \ self.current_item_.rect().height() > 1: # TODO commit to the modelrect = self.current_item_.rect() ann = {'type': 'rect', 'x': rect.x(), 'y': rect.y(), 'width': rect.width(), 'height': rect.heigh... | 479,111 |
def __init__(self, scene, model=None): ItemInserter.__init__(self, scene, model) self.current_item_ = None | def __init__(self, scene, mode=None): ItemInserter.__init__(self, scene, mode) self.current_item_ = None | 479,112 |
def __init__(self, parent=None): super(AnnotationScene, self).__init__(parent) | def __init__(self, parent=None): super(AnnotationScene, self).__init__(parent) | 479,113 |
def keyPressEvent(self, event): ## handle deletions of items if event.key() == Qt.Key_Delete: index = self.currentIndex() if not index.isValid(): return parent = self.model().parent(index) self.model().removeRow(index.row(), parent) | def keyPressEvent(self, event): ## handle deletions of items if event.key() == Qt.Key_Delete: index = self.currentIndex() if not index.isValid(): return parent = self.model().parent(index) self.model().removeRow(index.row(), parent) | 479,114 |
def gotoNext(self): # TODO move this to the scene if self.model_ is not None and self.current_index_ is not None: next_index = self.model_.getNextIndex(self.current_index_) self.setCurrentFileIndex(next_index) | def gotoNext(self): # TODO move this to the scene if self.model_ is not None and self.current_index_ is not None: next_index = self.model_.getNextIndex(self.current_index_) self.setCurrentFileIndex(next_index) | 479,115 |
def gotoPrevious(self): # TODO move this to the scene if self.model_ is not None and self.current_index_ is not None: next_index = self.model_.getNextIndex(self.current_index_) self.setCurrentFileIndex(next_index) | def gotoPrevious(self): # TODO move this to the scene if self.model_ is not None and self.current_index_ is not None: next_index = self.model_.getNextIndex(self.current_index_) self.setCurrentFileIndex(next_index) | 479,116 |
def gotoPrevious(self): # TODO move this to the scene if self.model_ is not None and self.current_index_ is not None: next_index = self.model_.getNextIndex(self.current_index_) self.setCurrentIndex(next_index) | def gotoPrevious(self): # TODO move this to the scene if self.model_ is not None and self.current_index_ is not None: next_index = self.model_.getNextIndex(self.current_index_) self.setCurrentIndex(next_index) | 479,117 |
def __init__(self, parent=None): QGraphicsView.__init__(self, parent) self.setRenderHint(QPainter.Antialiasing) self.setRenderHint(QPainter.TextAntialiasing) self.setFrameStyle(QFrame.NoFrame) | def __init__(self, parent=None): QGraphicsView.__init__(self, parent) self.setRenderHint(QPainter.Antialiasing) self.setRenderHint(QPainter.TextAntialiasing) self.setFrameStyle(QFrame.NoFrame) | 479,118 |
def activate(self): if not self.active_: self.active_ = True self.setFocus(Qt.OtherFocusReason) self.setFrameStyle(QFrame.Panel) self.update() | def activate(self): if not self.active_: self.active_ = True self.setFocus(Qt.OtherFocusReason) self.setStyleSheet("QFrame { border: 3px solid red }"); self.update() | 479,119 |
def deactivate(self): if self.active_: self.active_ = False self.clearFocus() self.setFrameStyle(QFrame.NoFrame) self.update() | def deactivate(self): if self.active_: self.active_ = False self.clearFocus() self.setStyleSheet("QFrame { border: 3px solid black }"); self.update() | 479,120 |
def update_buttons(self): layout = self.hlayout.takeAt(1) | def update_buttons(self): layout = self.hlayout.takeAt(1) | 479,121 |
def set_bands(self, bands, current): | def set_bands(self, bands, current): | 479,122 |
def set_prefs(self, prefs, current): model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_INT) | def set_prefs(self, modes, current): model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_INT) | 479,123 |
def set_prefs(self, prefs, current): model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_INT) | def set_prefs(self, prefs, current): model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_INT) | 479,124 |
def save(self): props = { 'connection': { 'name': 'connection', 'id': self.name, 'type': 'gsm', 'uuid': self.uuid, 'autoconnect': self.autoconnect}, 'gsm': { 'name': 'gsm', 'number': '*99#', 'apn': self.apn.strip()}, 'ppp': { 'name': 'ppp', 'refuse-pap': True, 'refuse-chap': True, 'refuse-eap': True, 'refuse-mschap': T... | def save(self): props = { 'connection': { 'name': 'connection', 'id': self.name, 'type': 'gsm', 'uuid': self.uuid, 'autoconnect': self.autoconnect}, 'gsm': { 'name': 'gsm', 'number': '*99#', 'apn': self.apn.strip()}, 'ppp': { 'name': 'ppp', 'refuse-pap': True, 'refuse-chap': True, 'refuse-eap': True, 'refuse-mschap': T... | 479,125 |
def run(self): for filename in glob(join('.', 'resources', 'po', '*.po')): lang = basename(filename)[:-3] | def run(self): for filename in glob(join('.', 'resources', 'po', '*.po')): lang = basename(filename)[:-3] | 479,126 |
def __init__(self, ctrl): | def __init__(self, ctrl): | 479,127 |
def sim_network(sim_data): # let's look up what we think this SIM's network is. # so we want to display the country and network operator | def sim_network(sim_data): # let's look up what we think this SIM's network is. # so we want to display the country and network operator | 479,128 |
def sim_imsi(sim_data): # ok we don't have a model the data is coming from dbus from the # core lets tell the view to set the imei in the correct place logger.info("payt-controller sim_imsi - IMSI number is: %s" % sim_data) # FIXME - Removed not needed yet #self.view.set_imsi_info(sim_data) | def sim_imsi(sim_data): # ok we don't have a model the data is coming from dbus from the # core lets tell the view to set the imei in the correct place logger.info("payt-controller sim_imsi - IMSI number is: %s" % sim_data) # FIXME - Removed not needed yet #self.view.set_imsi_info(sim_data) | 479,129 |
def check_voucher_update_response(self, ussd_voucher_update_response): device = self.model.get_device() # ok my job is to work out what happened after a credit voucher update message was sent. # we can have three possibilities, it was succesfull, the voucher code was wrong, or you tried with # an illegal number too ma... | def check_voucher_update_response(self, ussd_voucher_update_response): device = self.model.get_device() # ok my job is to work out what happened after a credit voucher update message was sent. # we can have three possibilities, it was succesfull, the voucher code was wrong, or you tried with # an illegal number too ma... | 479,130 |
def save(self): | def save(self): | 479,131 |
def get_transferred_gprs(self, offset): # filter out all the items that respond True to "is_gprs" gprs_items = [item for item in self._get_month(offset) if item.is_gprs] # get a list with the total transferred for every item and sum them up result = sum((item.total() for item in gprs_items)) if offset == 0: result += s... | def get_transferred_gprs(self, offset): # filter out all the items that respond True to "is_gprs" gprs_items = [item for item in self._get_month(offset) if item.is_gprs()] # get a list with the total transferred for every item and sum them up result = sum((item.total() for item in gprs_items)) if offset == 0: result +=... | 479,132 |
def setup_view(self): self.get_top_widget().set_position(gtk.WIN_POS_CENTER_ON_PARENT) self['sim_image'].set_from_file(self.Sim_Image) self['payt_image'].set_from_file(self.Computer_Image) self['credit_card_image'].set_from_file(self.Modem_Image) self['voucher_image'].set_from_file(self.Betavine_Image) | def setup_view(self): self.get_top_widget().set_position(gtk.WIN_POS_CENTER_ON_PARENT) self['sim_image'].set_from_file(self.sim_image) self['payt_image'].set_from_file(self.Computer_Image) self['credit_card_image'].set_from_file(self.Modem_Image) self['voucher_image'].set_from_file(self.Betavine_Image) | 479,133 |
def get_msisdn(self, cb): if self.msisdn: logger.info("MSISDN from model cache %s: " % self.msisdn) cb(self.msisdn) return | def get_msisdn(self, cb): if self.msisdn: logger.info("MSISDN from model cache: %s" % self.msisdn) cb(self.msisdn) return | 479,134 |
def get_imsi_cb(imsi): if imsi: msisdn = self.conf.get("sim/%s" % imsi, 'msisdn') if msisdn: logger.info("MSISDN from gconf %s: " % msisdn) self.msisdn = msisdn cb(self.msisdn) return | def get_imsi_cb(imsi): if imsi: msisdn = self.conf.get("sim/%s" % imsi, 'msisdn') if msisdn: logger.info("MSISDN from gconf: %s" % msisdn) self.msisdn = msisdn cb(self.msisdn) return | 479,135 |
def get_profiles(self): ret = {} for profile in self.manager.get_profiles(): settings = profile.get_settings() # filter out wlan profiles if 'ppp' in settings: uuid = settings['connection']['uuid'] ret[uuid] = ProfileModel(self, profile=profile, device_callable=self.device_callable, parent_model_callable=self.parent_mo... | def get_profiles(self): ret = {} for profile in self.manager.get_profiles(): settings = profile.get_settings() # filter out wlan profilesuuid = settings['connection']['uuid'] ret[uuid] = ProfileModel(self, profile=profile, device_callable=self.device_callable, parent_model_callable=self.parent_model_callable) return re... | 479,136 |
def __ne__(self, other): if other is None: return True return self.uuid != other.uuid | def __ne__(self, other): if other is None: return True return self.uuid != other.uuid | 479,137 |
def _load_settings(self, settings): try: self.uuid = settings['connection']['uuid'] self.name = settings['connection']['id'] self.username = settings['gsm']['username'] self.apn = settings['gsm']['apn'] self.autoconnect = settings['connection'].get('autoconnect', False) self.static_dns = settings['ipv4'].get('ignore-au... | def _load_settings(self, settings): try: self.uuid = settings['connection']['uuid'] self.name = settings['connection']['id'] self.username = settings['gsm'].get('username', '') self.apn = settings['gsm']['apn'] self.autoconnect = settings['connection'].get('autoconnect', False) self.static_dns = settings['ipv4'].get('i... | 479,138 |
def _load_settings(self, settings): try: self.uuid = settings['connection']['uuid'] self.name = settings['connection']['id'] self.username = settings['gsm']['username'] self.apn = settings['gsm']['apn'] self.autoconnect = settings['connection'].get('autoconnect', False) self.static_dns = settings['ipv4'].get('ignore-au... | def _load_settings(self, settings): try: self.uuid = settings['connection']['uuid'] self.name = settings['connection']['id'] self.username = settings['gsm']['username'] self.apn = settings['gsm']['apn'] self.autoconnect = settings['connection'].get('autoconnect', False) self.static_dns = settings['ipv4'].get('ignore-au... | 479,139 |
def save(self): props = { 'connection': { 'name': 'connection', 'id': self.name, 'type': 'gsm', 'uuid': self.uuid, 'autoconnect': self.autoconnect}, 'gsm': { 'name': 'gsm', 'band': self.band, 'username': self.username, 'number': '*99#', 'network-type': self.network_pref, 'apn': self.apn}, 'ppp': { 'name': 'ppp', 'refus... | def save(self): props = { 'connection': { 'name': 'connection', 'id': self.name, 'type': 'gsm', 'uuid': self.uuid, 'autoconnect': self.autoconnect}, 'gsm': { 'name': 'gsm', 'number': '*99#', 'network-type': self.network_pref, 'apn': self.apn}, 'ppp': { 'name': 'ppp', 'refuse-pap': True, 'refuse-chap': True, 'refuse-eap... | 479,140 |
def save(self): props = { 'connection': { 'name': 'connection', 'id': self.name, 'type': 'gsm', 'uuid': self.uuid, 'autoconnect': self.autoconnect}, 'gsm': { 'name': 'gsm', 'band': self.band, 'username': self.username, 'number': '*99#', 'network-type': self.network_pref, 'apn': self.apn}, 'ppp': { 'name': 'ppp', 'refus... | def save(self): props = { 'connection': { 'name': 'connection', 'id': self.name, 'type': 'gsm', 'uuid': self.uuid, 'autoconnect': self.autoconnect}, 'gsm': { 'name': 'gsm', 'band': self.band, 'username': self.username, 'number': '*99#', 'apn': self.apn}, 'ppp': { 'name': 'ppp', 'refuse-pap': True, 'refuse-chap': True, ... | 479,141 |
def save(self): props = { 'connection': { 'name': 'connection', 'id': self.name, 'type': 'gsm', 'uuid': self.uuid, 'autoconnect': self.autoconnect}, 'gsm': { 'name': 'gsm', 'band': self.band, 'username': self.username, 'number': '*99#', 'network-type': self.network_pref, 'apn': self.apn}, 'ppp': { 'name': 'ppp', 'refus... | def save(self): props = { 'connection': { 'name': 'connection', 'id': self.name, 'type': 'gsm', 'uuid': self.uuid, 'autoconnect': self.autoconnect}, 'gsm': { 'name': 'gsm', 'band': self.band, 'username': self.username, 'number': '*99#', 'network-type': self.network_pref, 'apn': self.apn}, 'ppp': { 'name': 'ppp', 'refus... | 479,142 |
def property_device_value_change(self, model, old, new): if self.model.device is not None: sm = self.model.device.connect_to_signal("DeviceEnabled", self.on_device_enabled_cb) self.signal_matches.append(sm) # connect to SIG_SMS_COMP and display SMS sm = self.model.device.connect_to_signal(SIG_SMS_COMP, self.on_sms_rece... | def property_device_value_change(self, model, old, new): if self.model.device is not None: sm = self.model.device.connect_to_signal("DeviceEnabled", self.on_device_enabled_cb) self.signal_matches.append(sm) # connect to SIG_SMS_COMP and display SMS sm = self.model.device.connect_to_signal(SIG_SMS_COMP, self.on_sms_rece... | 479,143 |
def nick_debug(s): if 1: with open(BCM_FAST_LOG, 'a', 0) as f: f.write("%s\n" % s) | def nick_debug(s): if 0: with open(BCM_FAST_LOG, 'a', 0) as f: f.write("%s\n" % s) | 479,144 |
def ask_for_new_profile(self): nick_debug("main.py: controller - ask_for_new_profile called") logger.info("main.py: controller - ask_for_new_profile called") | defask_for_new_profile(self):nick_debug("main.py:controller-ask_for_new_profilecalled")logger.info("main.py:controller-ask_for_new_profilecalled") | 479,145 |
def _generate_customer_support_text(self, imsi): utxt = '"' + _('Unknown') + '"' args = {'url':APP_URL, 'shortcode':utxt, 'international':utxt} | def _generate_customer_support_text(self, imsi): utxt = '"' + _('Unknown') + '"' args = {'url':APP_URL, 'shortcode':utxt, 'international':utxt} | 479,146 |
def property_profile_required_value_change(self, model, old, new): logger.info("main.py: controller - property_profile value changed - begining method") if new: logger.info("main.py: controller - property_profile value changed - calling 'ask_for_new_profile' ") self.ask_for_new_profile() | def property_profile_required_value_change(self, model, old, new): logger.info("main.py: controller - property_profile value changed" " - begining method") if new: logger.info("main.py: controller - property_profile value changed - calling 'ask_for_new_profile' ") self.ask_for_new_profile() | 479,147 |
def property_profile_required_value_change(self, model, old, new): logger.info("main.py: controller - property_profile value changed - begining method") if new: logger.info("main.py: controller - property_profile value changed - calling 'ask_for_new_profile' ") self.ask_for_new_profile() | def property_profile_required_value_change(self, model, old, new): logger.info("main.py: controller - property_profile value changed - begining method") if new: logger.info("main.py: controller - property_profile value " "changed - calling 'ask_for_new_profile' ") self.ask_for_new_profile() | 479,148 |
def on_mm_props_change_cb(self, ifname, ifprops): if ifname == consts.NET_INTFACE and 'AccessTechnology' in ifprops: self.model.tech = self._map_access_tech(ifprops['AccessTechnology']) logger.info("TECH changed %s", self.model.tech) | def on_mm_props_change_cb(self, ifname, ifprops): if ifname == consts.NET_INTFACE and 'AccessTechnology' in ifprops: self.model.tech = self._map_access_tech( ifprops['AccessTechnology']) logger.info("TECH changed %s", self.model.tech) | 479,149 |
def on_device_enabled_cb(self, opath): self.model.status = _('Scanning') self.model.pin_is_enabled(self.on_is_pin_enabled_cb, lambda *args: True) | def on_device_enabled_cb(self, opath): self.model.status = _('Scanning') self.model.pin_is_enabled(self.on_is_pin_enabled_cb, lambda *args: True) | 479,150 |
def property_status_value_change(self, model, old, new): if new == _('Initialising'): self.view.set_initialising(True) elif new == _('No device'): self.view.set_disconnected(device_present=False) elif new in [_('Registered'), _('Roaming')]: self.view.set_initialising(False) | def property_status_value_change(self, model, old, new): if new == _('Initialising'): self.view.set_initialising(True) elif new == _('No device'): self.view.set_disconnected() elif new in [_('Registered'), _('Roaming')]: self.view.set_initialising(False) | 479,151 |
def enable_send_button(self, sensitive): self['button2'].set_sensitive(sensitive) | def enable_send_button(self, sensitive): self['button2'].set_sensitive(sensitive) | 479,152 |
def _check_result(req, result): """ Check that a page handler actually wrote something, and properly finish the apache request.""" if result or req.bytes_sent > 0: if result is None: result = "" else: result = str(result) # unless content_type was manually set, we will attempt # to guess it if not req.content_type_s... | def _check_result(req, result): """ Check that a page handler actually wrote something, and properly finish the apache request. @param req: the request. @param result: the produced output. @type result: string @return: an apache error code @rtype: int @raise apache.SERVER_RETURN: in case of a HEAD request. @note: that... | 479,153 |
def _check_result(req, result): """ Check that a page handler actually wrote something, and properly finish the apache request.""" if result or req.bytes_sent > 0: if result is None: result = "" else: result = str(result) # unless content_type was manually set, we will attempt # to guess it if not req.content_type_s... | def_check_result(req,result):"""Checkthatapagehandleractuallywrotesomething,andproperlyfinishtheapacherequest."""ifresultorreq.bytes_sent>0:ifresultisNone:result=""else:result=str(result)#unlesscontent_typewasmanuallyset,wewillattempt#toguessitifnotreq.content_type_set_p:#makeanattempttoguesscontent-typeifresult[:100].... | 479,154 |
def _check_result(req, result): """ Check that a page handler actually wrote something, and properly finish the apache request.""" if result or req.bytes_sent > 0: if result is None: result = "" else: result = str(result) # unless content_type was manually set, we will attempt # to guess it if not req.content_type_s... | def _check_result(req, result): """ Check that a page handler actually wrote something, and properly finish the apache request.""" if result or req.bytes_sent > 0: if result is None: result = "" else: result = str(result) # unless content_type was manually set, we will attempt # to guess it if not req.content_type_s... | 479,155 |
def _check_result(req, result): """ Check that a page handler actually wrote something, and properly finish the apache request.""" if result or req.bytes_sent > 0: if result is None: result = "" else: result = str(result) # unless content_type was manually set, we will attempt # to guess it if not req.content_type_s... | def _check_result(req, result): """ Check that a page handler actually wrote something, and properly finish the apache request.""" if result or req.bytes_sent > 0: if result is None: result = "" else: result = str(result) # unless content_type was manually set, we will attempt # to guess it if not req.content_type_s... | 479,156 |
def _traverse(self, req, path, do_head=False, guest_p=True): """ Locate the handler of an URI by traversing the elements of the path.""" | def _traverse(self, req, path, do_head=False, guest_p=True): """ Locate the handler of an URI by traversing the elements of the path.""" | 479,157 |
def _traverse(self, req, path, do_head=False, guest_p=True): """ Locate the handler of an URI by traversing the elements of the path.""" | def _traverse(self, req, path, do_head=False, guest_p=True): """ Locate the handler of an URI by traversing the elements of the path.""" | 479,158 |
def _traverse(self, req, path, do_head=False, guest_p=True): """ Locate the handler of an URI by traversing the elements of the path.""" | def _traverse(self, req, path, do_head=False, guest_p=True): """ Locate the handler of an URI by traversing the elements of the path.""" | 479,159 |
def _traverse(self, req, path, do_head=False, guest_p=True): """ Locate the handler of an URI by traversing the elements of the path.""" | def _traverse(self, req, path, do_head=False, guest_p=True): """ Locate the handler of an URI by traversing the elements of the path.""" | 479,160 |
def __call__(self, req, form): """ Maybe resolve the final / of a directory """ | def __call__(self, req, form): """ Maybe resolve the final / of a directory """ | 479,161 |
def __call__(self, req, form): """ Maybe resolve the final / of a directory """ | def __call__(self, req, form): """ Maybe resolve the final / of a directory """ | 479,162 |
def _profiler(req): """ This handler wrap the default handler with a profiler. Profiling data is written into CFG_TMPDIR/invenio-profile-stats-datetime.raw, and is displayed at the bottom of the webpage. To use add profile=1 to your url. To change sorting algorithm you can provide profile=algorithm_name. You can add mo... | def _profiler(req): """ This handler wrap the default handler with a profiler. Profiling data is written into CFG_TMPDIR/invenio-profile-stats-datetime.raw, and is displayed at the bottom of the webpage. To use add profile=1 to your url. To change sorting algorithm you can provide profile=algorithm_name. You can add mo... | 479,163 |
def _profiler(req): """ This handler wrap the default handler with a profiler. Profiling data is written into CFG_TMPDIR/invenio-profile-stats-datetime.raw, and is displayed at the bottom of the webpage. To use add profile=1 to your url. To change sorting algorithm you can provide profile=algorithm_name. You can add mo... | def _profiler(req): """ This handler wrap the default handler with a profiler. Profiling data is written into CFG_TMPDIR/invenio-profile-stats-datetime.raw, and is displayed at the bottom of the webpage. To use add profile=1 to your url. To change sorting algorithm you can provide profile=algorithm_name. You can add mo... | 479,164 |
def _handler(req): """ This handler is invoked by mod_python with the apache request.""" try: allowed_methods = ("GET", "POST", "HEAD", "OPTIONS") req.allow_methods(allowed_methods, 1) if req.method not in allowed_methods: raise apache.SERVER_RETURN, apache.HTTP_METHOD_NOT_ALLOWED | def _handler(req): """ This handler is invoked by mod_python with the apache request.""" try: allowed_methods = ("GET", "POST", "HEAD", "OPTIONS") req.allow_methods(allowed_methods, 1) if req.method not in allowed_methods: raise apache.SERVER_RETURN, apache.HTTP_METHOD_NOT_ALLOWED | 479,165 |
def _handler(req): """ This handler is invoked by mod_python with the apache request.""" try: allowed_methods = ("GET", "POST", "HEAD", "OPTIONS") req.allow_methods(allowed_methods, 1) if req.method not in allowed_methods: raise apache.SERVER_RETURN, apache.HTTP_METHOD_NOT_ALLOWED | def _handler(req): """ This handler is invoked by mod_python with the apache request.""" try: allowed_methods = ("GET", "POST", "HEAD", "OPTIONS") req.allow_methods(allowed_methods, 1) if req.method not in allowed_methods: raise apache.SERVER_RETURN, apache.HTTP_METHOD_NOT_ALLOWED | 479,166 |
def _traverse(self, req, path): """ Locate the handler of an URI by traversing the elements of the path.""" | def _traverse(self, req, path): """ Locate the handler of an URI by traversing the elements of the path.""" | 479,167 |
def mp_legacy_publisher(req, possible_module, possible_handler): """ mod_python legacy publisher minimum implementation. """ the_module = open(possible_module).read() module_globals = {} exec(the_module, module_globals) if possible_handler in module_globals and callable(module_globals[possible_handler]): from invenio.w... | def mp_legacy_publisher(req, possible_module, possible_handler): """ mod_python legacy publisher minimum implementation. """ the_module = open(possible_module).read() module_globals = {} exec(the_module, module_globals) if possible_handler in module_globals and callable(module_globals[possible_handler]): from invenio.w... | 479,168 |
def mp_legacy_publisher(req, possible_module, possible_handler): """ mod_python legacy publisher minimum implementation. """ the_module = open(possible_module).read() module_globals = {} exec(the_module, module_globals) if possible_handler in module_globals and callable(module_globals[possible_handler]): from invenio.w... | def mp_legacy_publisher(req, possible_module, possible_handler): """ mod_python legacy publisher minimum implementation. """ the_module = open(possible_module).read() module_globals = {} exec(the_module, module_globals) if possible_handler in module_globals and callable(module_globals[possible_handler]): from invenio.w... | 479,169 |
def mp_legacy_publisher(req, possible_module, possible_handler): """ mod_python legacy publisher minimum implementation. """ the_module = open(possible_module).read() module_globals = {} exec(the_module, module_globals) if possible_handler in module_globals and callable(module_globals[possible_handler]): from invenio.w... | def mp_legacy_publisher(req, possible_module, possible_handler): """ mod_python legacy publisher minimum implementation. """ the_module = open(possible_module).read() module_globals = {} exec(the_module, module_globals) if possible_handler in module_globals and callable(module_globals[possible_handler]): from invenio.w... | 479,170 |
def mp_legacy_publisher(req, possible_module, possible_handler): """ mod_python legacy publisher minimum implementation. """ the_module = open(possible_module).read() module_globals = {} exec(the_module, module_globals) if possible_handler in module_globals and callable(module_globals[possible_handler]): from invenio.w... | def mp_legacy_publisher(req, possible_module, possible_handler): """ mod_python legacy publisher minimum implementation. """ the_module = open(possible_module).read() module_globals = {} exec(the_module, module_globals) if possible_handler in module_globals and callable(module_globals[possible_handler]): from invenio.w... | 479,171 |
def mp_legacy_publisher(req, possible_module, possible_handler): """ mod_python legacy publisher minimum implementation. """ the_module = open(possible_module).read() module_globals = {} exec(the_module, module_globals) if possible_handler in module_globals and callable(module_globals[possible_handler]): from invenio.w... | def mp_legacy_publisher(req, possible_module, possible_handler): """ mod_python legacy publisher minimum implementation. """ the_module = open(possible_module).read() module_globals = {} exec(the_module, module_globals) if possible_handler in module_globals and callable(module_globals[possible_handler]): from invenio.w... | 479,172 |
def playSong(key): client.connect(mpdHost, mpdPort) client.password(mpdPass) songs = songLookup[key] song = songs[random.randint(0, len(songs)-1)] pl = client.playlist() if song['file'] in pl: client.play(pl.index(song['file'])) else: client.add(song['file']) client.play(len(pl)) #length one higher now, with added... | def playSong(key): client.connect(mpdHost, mpdPort) client.password(mpdPass) songs = songLookup[key] song = songs[random.randint(0, len(songs)-1)] pl = client.playlist() if(pl): idx = client.playlist().index(client.currentsong()['file']) client.addid(song['file'], idx+1) client.play(idx+1) else: client.add(song['file']... | 479,173 |
def playSong(key): client.connect(mpdHost, mpdPort) client.password(mpdPass) songs = songLookup[key] song = songs[random.randint(0, len(songs)-1)] pl = client.playlist() if song['file'] in pl: client.play(pl.index(song['file'])) else: client.add(song['file']) client.play(len(pl)) #length one higher now, with added... | def playSong(key): client.connect(mpdHost, mpdPort) client.password(mpdPass) songs = songLookup[key] song = songs[random.randint(0, len(songs)-1)] pl = client.playlist() if song['file'] in pl: client.play(pl.index(song['file'])) else: client.add(song['file']) client.play() #length one higher now, with added song c... | 479,174 |
def playSong(key): client.connect(mpdHost, mpdPort) client.password(mpdPass) songs = songLookup[key] song = songs[random.randint(0, len(songs)-1)] pl = client.playlist() if song['file'] in pl: client.play(pl.index(song['file'])) else: client.add(song['file']) client.play(len(pl)) #length one higher now, with added... | def playSong(key): client.connect(mpdHost, mpdPort) client.password(mpdPass) songs = songLookup[key] song = songs[random.randint(0, len(songs)-1)] pl = client.playlist() if song['file'] in pl: client.play(pl.index(song['file'])) else: client.add(song['file']) client.play(len(pl)) #length one higher now, with added... | 479,175 |
def playSong(key): client.connect(mpdHost, mpdPort) client.password(mpdPass) songs = songLookup[key] song = songs[random.randint(0, len(songs)-1)] pl = client.playlist() if song['file'] in pl: client.play(pl.index(song['file'])) else: client.add(song['file']) client.play(len(pl)) #length one higher now, with added... | def playSong(key): client.connect(mpdHost, mpdPort) client.password(mpdPass) songs = songLookup[key] song = songs[random.randint(0, len(songs)-1)] pl = client.playlist() if song['file'] in pl: client.play(pl.index(song['file'])) else: client.add(song['file']) client.play(len(pl)) #length one higher now, with added... | 479,176 |
def playSong(key): client.connect(mpdHost, mpdPort) client.password(mpdPass) songs = songLookup[key] song = songs[random.randint(0, len(songs)-1)] pl = client.playlist() if(pl): idx = client.playlist().index(client.currentsong()['file']) client.addid(song['file'], idx+1) client.play(idx+1) #length one higher now, ... | def playSong(key): client.connect(mpdHost, mpdPort) client.password(mpdPass) songs = songLookup[key] song = songs[random.randint(0, len(songs)-1)] pl = client.playlist() cur = client.currentsong() if(pl and cur): idx = client.playlist().index(cur['file']) client.addid(song['file'], idx+1) client.play(idx+1) #lengt... | 479,177 |
def playSong(key): client.connect(mpdHost, mpdPort) client.password(mpdPass) songs = songLookup[key] song = songs[random.randint(0, len(songs)-1)] pl = client.playlist() if(pl): idx = client.playlist().index(client.currentsong()['file']) client.addid(song['file'], idx+1) client.play(idx+1) #length one higher now, ... | def playSong(key): client.connect(mpdHost, mpdPort) client.password(mpdPass) songs = songLookup[key] song = songs[random.randint(0, len(songs)-1)] pl = client.playlist() if(pl): idx = client.playlist().index(client.currentsong()['file']) client.addid(song['file'], idx+1) client.play(idx+1) #length one higher now, ... | 479,178 |
def retrieveData(self): sfbc = getToolByName(self.context, 'portal_salesforcebaseconnector') sfa = self.getRelevantSFAdapter() if sfa is None: return {} sObjectType = sfa.getSFObjectType() econtext = getExprContext(sfa) econtext.setGlobal('sanitize_soql', sanitize_soql) updateMatchExpression = sfa.getUpdateMatchExpres... | def retrieveData(self): sfbc = getToolByName(self.context, 'portal_salesforcebaseconnector') sfa = self.getRelevantSFAdapter() if sfa is None: return {} sObjectType = sfa.getSFObjectType() econtext = getExprContext(sfa) econtext.setGlobal('sanitize_soql', sanitize_soql) updateMatchExpression = sfa.getUpdateMatchExpres... | 479,179 |
def startup (self): global CXXFLAGS, TARGET | def startup (self): global CXXFLAGS, TARGET | 479,180 |
def detect_platform (): global HOST, TARGET, DEVNULL if sys.platform [:3] == "win": HOST = ["windows"] TARGET = ["windows"] DEVNULL = "nul" elif sys.platform [:6] == "darwin": HOST = ["mac"] TARGET = ["mac"] DEVNULL = "/dev/null" else: # Default to POSIX HOST = ["posix"] TARGET = ["posix"] DEVNULL = "/dev/null" arch ... | def detect_platform (): global HOST, TARGET, DEVNULL if sys.platform [:3] == "win": HOST = ["windows"] TARGET = ["windows"] DEVNULL = "nul" elif sys.platform [:6] == "darwin": HOST = ["mac"] TARGET = ["mac"] DEVNULL = "/dev/null" else: # Default to POSIX HOST = ["posix"] TARGET = ["posix"] DEVNULL = "/dev/null" arch ... | 479,181 |
def check_cflags (cflags, var, xcflags = ""): """Check if compiler supports certain flags. This is done by creating a dummy source file and trying to compile it using the requested flags. :Parameters: `cflags` : str The compiler flags to check for `var` : str The name of the variable to append the flags to in the case... | def check_cflags (cflags, var, xcflags = ""): """Check if compiler supports certain flags. This is done by creating a dummy source file and trying to compile it using the requested flags. :Parameters: `cflags` : str The compiler flags to check for `var` : str The name of the variable to append the flags to in the case... | 479,182 |
def check_header (hdr, cflags = None, reqtext = None): """Check if a header file is available to the compiler. This is done by creating a dummy source file and trying to compile it. :Parameters: `hdr` : str The name of the header file to check for `reqtext` : str The message to print in the fatal error message when th... | def check_header (hdr, cflags = None, reqtext = None): """Check if a header file is available to the compiler. This is done by creating a dummy source file and trying to compile it. :Parameters: `hdr` : str The name of the header file to check for `reqtext` : str The message to print in the fatal error message when th... | 479,183 |
def linklib (self, library, path = None): tmp = "" if path: tmp = "-libpath:" + path.replace ('/', '\\\\') + " " return tmp + ".lib ".join (library.split ()) + ".lib" | def linklib (self, library, path = None): tmp = "" if path: tmp = "-libpath:" + path.replace ('/', '\\\\') + " " return tmp + ".lib ".join (library.split ()) + ".lib" | 479,184 |
def start (): global HOST, TARGET, EXE, TOOLKIT global PREFIX, BINDIR, LIBDIR, SYSCONFDIR, DATADIR, DOCDIR global INCLUDEDIR, LIBEXECDIR, SHAREDLIBS detect_platform () # Read environment variables first for e in ENVARS: globals () [e [0]] = os.getenv (e [0], e [1]) # Parse command-line skip_opt = False for optidx in... | def start (): """Start the autoconfiguring process. This includes searching the environment for variables, parsing the command line, detecting host/target and compiler and setting the base variables. """ global HOST, TARGET, EXE, TOOLKIT, COMPILER global PREFIX, BINDIR, LIBDIR, SYSCONFDIR, DATADIR, DOCDIR global INCLU... | 479,185 |
def detect_platform (): global HOST, TARGET, DEVNULL if sys.platform [:3] == "win": HOST = ["windows"] TARGET = ["windows"] DEVNULL = "nul" elif sys.platform [:6] == "darwin": HOST = ["mac"] TARGET = ["mac"] DEVNULL = "/dev/null" else: # Default to POSIX HOST = ["posix"] TARGET = ["posix"] DEVNULL = "/dev/null" arch ... | def detect_platform (): global HOST, TARGET, DEVNULL if sys.platform [:3] == "win": HOST = ["windows"] TARGET = ["windows"] DEVNULL = "nul" elif sys.platform [:6] == "darwin": HOST = ["mac"] TARGET = ["mac"] DEVNULL = "/dev/null" else: # Default to POSIX HOST = ["posix"] TARGET = ["posix"] DEVNULL = "/dev/null" arch ... | 479,186 |
def add_config_h (macro, val = "1"): global CONFIG_H macro = macro.strip () CONFIG_H [macro] = val.strip () _CONFIG_H.append (macro) | def add_config_h (macro, val = "1"): """Add a macro definition to config.h file. The contents of config.h is accumulated during configure run in the tibs.CONFIG_H variable and finally is written out with a tibs.update_file() call. :Parameters: `macro` : str The name of the macro to define. Usually upper-case. `val` : ... | 479,187 |
def add_config_mak (macro, val = "1"): global CONFIG_MAK macro = macro.strip () CONFIG_MAK [macro] = val.strip () _CONFIG_MAK.append (macro) | def add_config_mak (macro, val = "1"): """Add a macro definition to config.mak file. The contents of config.mak is accumulated during configure run in the tibs.CONFIG_MAK variable and finally is written out with a tibs.update_file() call. :Parameters: `macro` : str The name of the macro to define. Usually upper-case. ... | 479,188 |
def check_program (name, prog, ver_regex, req_version, failifnot = False): check_started ("Checking for " + name + " >= " + req_version) rc = False version = None try: fd = os.popen (prog + " 2>&1") line = fd.readline ().strip () fd.close () if VERBOSE: print "\n# '" + prog + "' returned '" + line + "'" m = re.match ... | def check_program (name, prog, ver_regex, req_version, failifnot = False): check_started ("Checking for " + name + " >= " + req_version) rc = False version = None try: fd = os.popen (prog + " 2>&1") lines = fd.readlines () fd.close () if VERBOSE: print "\n# '" + prog + "' returned '" + line + "'" m = re.match (ver_re... | 479,189 |
def check_program (name, prog, ver_regex, req_version, failifnot = False): check_started ("Checking for " + name + " >= " + req_version) rc = False version = None try: fd = os.popen (prog + " 2>&1") line = fd.readline ().strip () fd.close () if VERBOSE: print "\n# '" + prog + "' returned '" + line + "'" m = re.match ... | def check_program (name, prog, ver_regex, req_version, failifnot = False): check_started ("Checking for " + name + " >= " + req_version) rc = False version = None try: fd = os.popen (prog + " 2>&1") line = fd.readline ().strip () fd.close () if VERBOSE: print "\n# '" + prog + "' returned '" + line + "'" m = re.match ... | 479,190 |
def check_program (name, prog, ver_regex, req_version, failifnot = False): check_started ("Checking for " + name + " >= " + req_version) rc = False version = None try: fd = os.popen (prog + " 2>&1") line = fd.readline ().strip () fd.close () if VERBOSE: print "\n# '" + prog + "' returned '" + line + "'" m = re.match ... | def check_program (name, prog, ver_regex, req_version, failifnot = False): check_started ("Checking for " + name + " >= " + req_version) rc = False version = None try: fd = os.popen (prog + " 2>&1") line = fd.readline ().strip () fd.close () if VERBOSE: print "\n# '" + prog + "' returned '" + line + "'" m = re.match ... | 479,191 |
def pkgconfig (prog, args, lib = None): # Check if target overrides this library tmp_lib = lib if not tmp_lib: tmp_lib = prog.replace ("_config", "").replace ("-config", "") # Allow user to override any pkgconfig data with environment env_var = "PKGCONFIG_" + tmp_lib + "_" + args env_val = os.getenv (env_var, None) if... | def pkgconfig (prog, args, lib = None): # Check if target overrides this library tmp_lib = lib if not tmp_lib: tmp_lib = prog.replace ("_config", "").replace ("-config", "") # Allow user to override any pkgconfig data with environment env_var = "PKGCONFIG_" + tmp_lib + "_" + args env_val = os.getenv (env_var, None) if... | 479,192 |
def substmacros (infile, outfile = None, macros = None): if not outfile: if infile.endswith (".in"): outfile = infile [:-3] else: abort_configure ( | def substmacros (infile, outfile = None, macros = None): if not outfile: if infile.endswith (".in"): outfile = infile [:-3] else: abort_configure ( | 479,193 |
def _read_member_header(self): """Fills self._chlen and self._chunks by the read header data. """ header = _read_gzip_header(self._fileobj) offset = self._fileobj.tell() if "RA" not in header["extra_field"]: raise IOError("Not an idzip file: %r" % self.name) | def _read_member_header(self): """Fills self._chlen and self._chunks by the read header data. """ header = _read_gzip_header(self._fileobj) offset = self._fileobj.tell() if "RA" not in header["extra_field"]: raise IOError("Not an idzip file: %r" % self.name) | 479,194 |
def _readchunk(self, chunk_index): """Reads the specified chunk or throws EOFError. """ while chunk_index >= len(self._chunks): self._reach_member_end() _read_member_header() | def _readchunk(self, chunk_index): """Reads the specified chunk or throws EOFError. """ while chunk_index >= len(self._chunks): self._reach_member_end() _read_member_header() | 479,195 |
def _reach_member_end(self): """Seeks the _fileobj at the end of the last known member. """ offset, comp_len = self._chunks[-1] self._fileobj.seek(offset + comp_len) # The zlib stream could end with an empty block. deobj = zlib.decompressobj(-zlib.MAX_WBITS) extra = "" while deobj.unused_data == "" and not extra: extra... | def _reach_member_end(self): """Seeks the _fileobj at the end of the last known member. """ offset, comp_len = self._chunks[-1] self._fileobj.seek(offset + comp_len) # The zlib stream could end with an empty block. deobj = zlib.decompressobj(-zlib.MAX_WBITS) extra = "" while deobj.unused_data == "" and not extra: extra... | 479,196 |
def _compress_member(input, in_size, output, basename, mtime): comp_lenghts_pos = _prepare_header(output, in_size, basename, mtime) comp_lengths = _compress_data(input, in_size, output) end_pos = output.tell() output.seek(comp_lenghts_pos) for comp_len in comp_lengths: _write16(output, comp_len) output.seek(end_pos) ... | def _compress_member(input, in_size, output, basename, mtime): comp_lengths_pos = _prepare_header(output, in_size, basename, mtime) comp_lengths = _compress_data(input, in_size, output) end_pos = output.tell() output.seek(comp_lenghts_pos) for comp_len in comp_lengths: _write16(output, comp_len) output.seek(end_pos) ... | 479,197 |
def _compress_member(input, in_size, output, basename, mtime): comp_lenghts_pos = _prepare_header(output, in_size, basename, mtime) comp_lengths = _compress_data(input, in_size, output) end_pos = output.tell() output.seek(comp_lenghts_pos) for comp_len in comp_lengths: _write16(output, comp_len) output.seek(end_pos) ... | def _compress_member(input, in_size, output, basename, mtime): comp_lenghts_pos = _prepare_header(output, in_size, basename, mtime) comp_lengths = _compress_data(input, in_size, output) end_pos = output.tell() output.seek(comp_lengths_pos) for comp_len in comp_lengths: _write16(output, comp_len) output.seek(end_pos) ... | 479,198 |
def _prepare_header(output, in_size, basename, mtime): """Returns a prepared gzip header StringIO. The gzip header is defined in RFC 1952. """ output.write("\x1f\x8b\x08") # Gzip-deflate identification flags = FEXTRA if basename: flags |= FNAME output.write(chr(flags)) # The mtime will be undefined if it does not fit... | def _prepare_header(output, in_size, basename, mtime): """Returns a prepared gzip header StringIO. The gzip header is defined in RFC 1952. """ output.write("\x1f\x8b\x08") # Gzip-deflate identification flags = FEXTRA if basename: flags |= FNAME output.write(chr(flags)) # The mtime will be undefined if it does not fit... | 479,199 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.