rem
stringlengths 1
322k
| add
stringlengths 0
2.05M
| context
stringlengths 4
228k
| meta
stringlengths 156
215
|
---|---|---|---|
print label_name, self.last_checked_label | print "ButtonArea:", label_name, self.last_checked_label | 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() | 142f548695693cef661e597f3671d76c6a78dea0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/142/142f548695693cef661e597f3671d76c6a78dea0/buttonarea.py |
self.update_buttons() | self.show_only_label_properties(label_name) | 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() | 142f548695693cef661e597f3671d76c6a78dea0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/142/142f548695693cef661e597f3671d76c6a78dea0/buttonarea.py |
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() self.update_buttons() | 142f548695693cef661e597f3671d76c6a78dea0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/142/142f548695693cef661e597f3671d76c6a78dea0/buttonarea.py |
||
self.update_label_buttons() self.update_buttons() | self.init_button_lists() | 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() self.update_buttons() | 142f548695693cef661e597f3671d76c6a78dea0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/142/142f548695693cef661e597f3671d76c6a78dea0/buttonarea.py |
print change | def itemChange(self, change, value): print change if change == QGraphicsItem.ItemScenePositionHasChanged: self.updateModel() return AnnotationGraphicsItem.itemChange(self, change, value) | 3aa920cf0f46c558617dc95d264f22b8d33e3a44 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/142/3aa920cf0f46c558617dc95d264f22b8d33e3a44/annotationitem.py |
|
print "updateModel (point)", self.data_ | 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) | 3aa920cf0f46c558617dc95d264f22b8d33e3a44 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/142/3aa920cf0f46c558617dc95d264f22b8d33e3a44/annotationitem.py |
|
def __init__(self, scene, model=None): | def __init__(self, scene, mode=None): | def __init__(self, scene, model=None): self.scene_ = scene self.mode_ = None | 59720e8500c047dc53a2f7acc4138d6750381259 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/142/59720e8500c047dc53a2f7acc4138d6750381259/annotationscene.py |
self.mode_ = None | self.mode_ = mode | def __init__(self, scene, model=None): self.scene_ = scene self.mode_ = None | 59720e8500c047dc53a2f7acc4138d6750381259 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/142/59720e8500c047dc53a2f7acc4138d6750381259/annotationscene.py |
item = QGraphicsEllipseItem(QRectF(pos.x()-1, pos.y()-1, 2, 2)) self.scene().addItem(item) | ann = {'type': 'point', 'x': event.pos().x(), 'y': event.pos().y()} index.model().addAnnotation(index, ann) | 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) | 59720e8500c047dc53a2f7acc4138d6750381259 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/142/59720e8500c047dc53a2f7acc4138d6750381259/annotationscene.py |
def __init__(self, scene, model=None): ItemInserter.__init__(self, scene, model) | def __init__(self, scene, mode=None): ItemInserter.__init__(self, scene, mode) | def __init__(self, scene, model=None): ItemInserter.__init__(self, scene, model) self.current_item_ = None self.init_pos_ = None | 59720e8500c047dc53a2f7acc4138d6750381259 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/142/59720e8500c047dc53a2f7acc4138d6750381259/annotationscene.py |
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()) | rect = QRectF(self.init_pos_, event.scenePos()).normalized() self.current_item_.setRect(rect) | 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()) | 59720e8500c047dc53a2f7acc4138d6750381259 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/142/59720e8500c047dc53a2f7acc4138d6750381259/annotationscene.py |
print "added rect:", self.current_item_ | 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(), 'width': rect.width(), 'height': rect.height()} index.model().addAnnotation(index, ann) self.scene().removeItem(self.current_item_) self.current_item_ = None self.init_pos_ = None | 59720e8500c047dc53a2f7acc4138d6750381259 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/142/59720e8500c047dc53a2f7acc4138d6750381259/annotationscene.py |
|
def __init__(self, scene, model=None): ItemInserter.__init__(self, scene, model) | def __init__(self, scene, mode=None): ItemInserter.__init__(self, scene, mode) | def __init__(self, scene, model=None): ItemInserter.__init__(self, scene, model) self.current_item_ = None | 59720e8500c047dc53a2f7acc4138d6750381259 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/142/59720e8500c047dc53a2f7acc4138d6750381259/annotationscene.py |
self.addItemInserter('point', PointItemInserter(self)) self.addItemInserter('rect', RectItemInserter(self)) self.addItemInserter('poly', PolygonItemInserter(self)) self.addItemInserter('polygon', PolygonItemInserter(self)) self.setMode({'type': 'rect'}) | self.addItemInserter('point', PointItemInserter(self)) self.addItemInserter('rect', RectItemInserter(self)) self.addItemInserter('ratiorect', FixedRatioRectItemInserter(self)) self.addItemInserter('poly', PolygonItemInserter(self)) self.addItemInserter('polygon', PolygonItemInserter(self)) self.setMode(None) | def __init__(self, parent=None): super(AnnotationScene, self).__init__(parent) | 59720e8500c047dc53a2f7acc4138d6750381259 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/142/59720e8500c047dc53a2f7acc4138d6750381259/annotationscene.py |
if event.key() == ord('A'): index = self.currentIndex() if not index.isValid(): return self.model().addAnnotation(index, {'type':'beer', 'alc': '5.1', 'name': 'rothaus'}) if event.key() == ord('D'): index = self.currentIndex() if not index.isValid(): return self.model().removeAnnotation(index) | 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) | 28363c24f0576c37694ba68b8c9bb3d163d0321e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/142/28363c24f0576c37694ba68b8c9bb3d163d0321e/annotationmodel.py |
|
self.setCurrentFileIndex(next_index) | self.setCurrentIndex(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) | e6cbdb7cb849cb25999d9e0a952d80329c6a1b1c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/142/e6cbdb7cb849cb25999d9e0a952d80329c6a1b1c/labeltool.py |
self.setCurrentFileIndex(next_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.setCurrentFileIndex(next_index) | e6cbdb7cb849cb25999d9e0a952d80329c6a1b1c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/142/e6cbdb7cb849cb25999d9e0a952d80329c6a1b1c/labeltool.py |
next_index = self.model_.getNextIndex(self.current_index_) self.setCurrentIndex(next_index) | prev_index = self.model_.getPreviousIndex(self.current_index_) self.setCurrentIndex(prev_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) | 485a4fb757936c52cac89e6cc6ce0cfa94ef4106 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/142/485a4fb757936c52cac89e6cc6ce0cfa94ef4106/labeltool.py |
self.setFrameStyle(QFrame.NoFrame) | self.setStyleSheet("QFrame { border: 3px solid black }"); | def __init__(self, parent=None): QGraphicsView.__init__(self, parent) self.setRenderHint(QPainter.Antialiasing) self.setRenderHint(QPainter.TextAntialiasing) self.setFrameStyle(QFrame.NoFrame) | 7d2de1ce0067cb6f5a099b6f4e737c30825aa8ba /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/142/7d2de1ce0067cb6f5a099b6f4e737c30825aa8ba/FrameViewer.py |
self.setFrameStyle(QFrame.Panel) | self.setStyleSheet("QFrame { border: 3px solid red }"); | def activate(self): if not self.active_: self.active_ = True self.setFocus(Qt.OtherFocusReason) self.setFrameStyle(QFrame.Panel) self.update() | 7d2de1ce0067cb6f5a099b6f4e737c30825aa8ba /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/142/7d2de1ce0067cb6f5a099b6f4e737c30825aa8ba/FrameViewer.py |
self.setFrameStyle(QFrame.NoFrame) | self.setStyleSheet("QFrame { border: 3px solid black }"); | def deactivate(self): if self.active_: self.active_ = False self.clearFocus() self.setFrameStyle(QFrame.NoFrame) self.update() | 7d2de1ce0067cb6f5a099b6f4e737c30825aa8ba /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/142/7d2de1ce0067cb6f5a099b6f4e737c30825aa8ba/FrameViewer.py |
self.update() self.updateGeometry() | def update_buttons(self): layout = self.hlayout.takeAt(1) | a71dc3d7492a71fac406a6121072b49794240451 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/142/a71dc3d7492a71fac406a6121072b49794240451/buttonarea.py |
|
def get_bands(bitwised_band): """Returns all the bitwised bands in ``bitwised_band``""" return [band for band in MM_NETWORK_BANDS if band & bitwised_band] | def set_bands(self, bands, current): | 6cd484c0a5dfd829bdf40d072204fc8217c17415 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12037/6cd484c0a5dfd829bdf40d072204fc8217c17415/profile.py |
|
def set_prefs(self, prefs, current): | def set_prefs(self, modes, current): | def set_prefs(self, prefs, current): model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_INT) | 6cd484c0a5dfd829bdf40d072204fc8217c17415 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12037/6cd484c0a5dfd829bdf40d072204fc8217c17415/profile.py |
for value in prefs: | for value in [MM_NETWORK_MODE_ANY] + get_network_modes(modes): | def set_prefs(self, prefs, current): model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_INT) | 6cd484c0a5dfd829bdf40d072204fc8217c17415 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12037/6cd484c0a5dfd829bdf40d072204fc8217c17415/profile.py |
if self.username is not None: | if self.username: | 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': True, 'refuse-mschapv2': True}, 'serial': { 'name': 'serial', 'baud': 115200}, 'ipv4': { 'name': 'ipv4', 'addresses': [], 'method': 'auto', 'ignore-auto-dns': self.static_dns, 'routes': []}, } | 440cfd7e54ea237a7669c078f46f7208ee71102d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12037/440cfd7e54ea237a7669c078f46f7208ee71102d/profile.py |
def run(self): for filename in glob(join('.', 'resources', 'po', '*.po')): lang = basename(filename)[:-3] | 3693d4e6212a055915053882b891f63a1410f83e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12037/3693d4e6212a055915053882b891f63a1410f83e/setup.py |
||
if True: height = 420 GLADE_FILE = os.path.join(GLADE_DIR, "VMC-reduced.glade") else: height = WIN_HEIGHT GLADE_FILE = os.path.join(GLADE_DIR, "VMC.glade") | height = 420 GLADE_FILE = os.path.join(GLADE_DIR, "bcm.glade") | def __init__(self, ctrl): | ee2a7d3c1cacad37879b6316724ca81fa9f459ae /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12037/ee2a7d3c1cacad37879b6316724ca81fa9f459ae/main.py |
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 | af78a1b9628c9abc67c152692f3653c15861ea95 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12037/af78a1b9628c9abc67c152692f3653c15861ea95/payt_controller.py |
||
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) | af78a1b9628c9abc67c152692f3653c15861ea95 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12037/af78a1b9628c9abc67c152692f3653c15861ea95/payt_controller.py |
||
set_voucher_entry_view(ussd_voucher_update_response) | self.view.set_voucher_entry_view(ussd_voucher_update_response) | 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 many times. For now I only do something when it works, the other two # possibilities I just report the error provided by the network. if (ussd_voucher_update_response.find('TopUp successful') == -1): # ok we got a -1 from our 'find' so it failed just log for now as we report the message to the view no matter what happens. logger.info("payt-controoler check_voucher_update_response - topup failed: " + ussd_voucher_update_response) | af78a1b9628c9abc67c152692f3653c15861ea95 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12037/af78a1b9628c9abc67c152692f3653c15861ea95/payt_controller.py |
logger.info("INFO profile.py: model - save properties dictionary is: %s" %props ) | def save(self): | 7a2c9df2adb54391d78889c467d8c4a4bd61ca4c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12037/7a2c9df2adb54391d78889c467d8c4a4bd61ca4c/profile.py |
|
gprs_items = [item for item in self._get_month(offset) if item.is_gprs] | gprs_items = [item for item in self._get_month(offset) if item.is_gprs()] | 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 += self.twog_session return result | a339f10beaa63e6a968c932afc344363ece6951a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12037/a339f10beaa63e6a968c932afc344363ece6951a/main.py |
self['sim_image'].set_from_file(self.Sim_Image) | self['sim_image'].set_from_file(self.sim_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) | 646bfea6ab1335ecd9443bea25359bec5d9579ac /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12037/646bfea6ab1335ecd9443bea25359bec5d9579ac/payt_view.py |
logger.info("MSISDN from model cache %s: " % self.msisdn) | logger.info("MSISDN from model cache: %s" % self.msisdn) | def get_msisdn(self, cb): if self.msisdn: logger.info("MSISDN from model cache %s: " % self.msisdn) cb(self.msisdn) return | f8468efdf6828fa609322bc2d5cf3998068fef40 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12037/f8468efdf6828fa609322bc2d5cf3998068fef40/main.py |
logger.info("MSISDN from gconf %s: " % msisdn) | logger.info("MSISDN from gconf: %s" % msisdn) | 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 | f8468efdf6828fa609322bc2d5cf3998068fef40 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12037/f8468efdf6828fa609322bc2d5cf3998068fef40/main.py |
if 'ppp' in settings: uuid = settings['connection']['uuid'] ret[uuid] = ProfileModel(self, profile=profile, device_callable=self.device_callable, parent_model_callable=self.parent_model_callable) | uuid = settings['connection']['uuid'] ret[uuid] = ProfileModel(self, profile=profile, device_callable=self.device_callable, parent_model_callable=self.parent_model_callable) | 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_model_callable) return ret | f30c29237a4f6123525997cdc941bc70c9fec4e6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12037/f30c29237a4f6123525997cdc941bc70c9fec4e6/profile.py |
if other is None: return True return self.uuid != other.uuid | return not self.__eq__(other) | def __ne__(self, other): if other is None: return True return self.uuid != other.uuid | f30c29237a4f6123525997cdc941bc70c9fec4e6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12037/f30c29237a4f6123525997cdc941bc70c9fec4e6/profile.py |
self.username = settings['gsm']['username'] | self.username = settings['gsm'].get('username', '') | 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-auto-dns') if settings['ipv4'].get('dns', None): dns = settings['ipv4'].get('dns') self.primary_dns = dns[0] if len(dns) > 1: self.secondary_dns = dns[1] | f30c29237a4f6123525997cdc941bc70c9fec4e6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12037/f30c29237a4f6123525997cdc941bc70c9fec4e6/profile.py |
if settings['gsm'].get('password', None): | if settings['gsm'].get('password') is not None: | 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-auto-dns') if settings['ipv4'].get('dns', None): dns = settings['ipv4'].get('dns') self.primary_dns = dns[0] if len(dns) > 1: self.secondary_dns = dns[1] | f30c29237a4f6123525997cdc941bc70c9fec4e6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12037/f30c29237a4f6123525997cdc941bc70c9fec4e6/profile.py |
'band': self.band, 'username': self.username, | 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', 'refuse-pap': True, 'refuse-chap': True, 'refuse-eap': True, 'refuse-mschap': True, 'refuse-mschapv2': True}, 'serial': { 'name': 'serial', 'baud': 115200}, 'ipv4': { 'name': 'ipv4', 'addresses': [], 'method': 'auto', 'ignore-auto-dns': self.static_dns, 'routes': []}, } | f30c29237a4f6123525997cdc941bc70c9fec4e6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12037/f30c29237a4f6123525997cdc941bc70c9fec4e6/profile.py |
|
'network-type': self.network_pref, | 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', 'refuse-pap': True, 'refuse-chap': True, 'refuse-eap': True, 'refuse-mschap': True, 'refuse-mschapv2': True}, 'serial': { 'name': 'serial', 'baud': 115200}, 'ipv4': { 'name': 'ipv4', 'addresses': [], 'method': 'auto', 'ignore-auto-dns': self.static_dns, 'routes': []}, } | f30c29237a4f6123525997cdc941bc70c9fec4e6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12037/f30c29237a4f6123525997cdc941bc70c9fec4e6/profile.py |
|
if props['gsm']['band'] is None: del props['gsm']['band'] if props['gsm']['network-type'] is None: del props['gsm']['network-type'] | 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', 'refuse-pap': True, 'refuse-chap': True, 'refuse-eap': True, 'refuse-mschap': True, 'refuse-mschapv2': True}, 'serial': { 'name': 'serial', 'baud': 115200}, 'ipv4': { 'name': 'ipv4', 'addresses': [], 'method': 'auto', 'ignore-auto-dns': self.static_dns, 'routes': []}, } | f30c29237a4f6123525997cdc941bc70c9fec4e6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12037/f30c29237a4f6123525997cdc941bc70c9fec4e6/profile.py |
|
logger.info("main-controller: property_device_value_change - device : " + self.model.device) | logger.info("main-controller: property_device_value_change") | 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_received_cb) self.signal_matches.append(sm) else: while self.signal_matches: sm = self.signal_matches.pop() sm.remove() self.view['connect_button'].set_sensitive(False) self.view['topup_tool_button'].set_sensitive(False) logger.info("main-controller: property_device_value_change - device : " + self.model.device) | a356776b4023d3c17006a44927f187797cc1c4c6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12037/a356776b4023d3c17006a44927f187797cc1c4c6/main.py |
if 1: | if 0: | def nick_debug(s): if 1: with open(BCM_FAST_LOG, 'a', 0) as f: f.write("%s\n" % s) | 431e7fadb206b7727b1c25dc3226a225cb22cb00 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12037/431e7fadb206b7727b1c25dc3226a225cb22cb00/main.py |
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") | 431e7fadb206b7727b1c25dc3226a225cb22cb00 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12037/431e7fadb206b7727b1c25dc3226a225cb22cb00/main.py |
||
args = {'url':APP_URL, 'shortcode':utxt, 'international':utxt} | 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} | 431e7fadb206b7727b1c25dc3226a225cb22cb00 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12037/431e7fadb206b7727b1c25dc3226a225cb22cb00/main.py |
logger.info("main.py: controller - property_profile value changed - begining method") | logger.info("main.py: controller - property_profile value changed" " - begining method") | 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() | 431e7fadb206b7727b1c25dc3226a225cb22cb00 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12037/431e7fadb206b7727b1c25dc3226a225cb22cb00/main.py |
logger.info("main.py: controller - property_profile value changed - calling 'ask_for_new_profile' ") | logger.info("main.py: controller - property_profile value " "changed - calling '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() | 431e7fadb206b7727b1c25dc3226a225cb22cb00 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12037/431e7fadb206b7727b1c25dc3226a225cb22cb00/main.py |
self.model.tech = self._map_access_tech(ifprops['AccessTechnology']) | self.model.tech = self._map_access_tech( ifprops['AccessTechnology']) | 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) | 431e7fadb206b7727b1c25dc3226a225cb22cb00 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12037/431e7fadb206b7727b1c25dc3226a225cb22cb00/main.py |
lambda *args: True) | 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) | 431e7fadb206b7727b1c25dc3226a225cb22cb00 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12037/431e7fadb206b7727b1c25dc3226a225cb22cb00/main.py |
self.view.set_disconnected(device_present=False) | self.view.set_disconnected() | 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) | 0a210f6fa451e827e08df09dad92469a20cd287c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12037/0a210f6fa451e827e08df09dad92469a20cd287c/main.py |
self['button2'].set_sensitive(sensitive) | self['voucher_button'].set_sensitive(sensitive) | def enable_send_button(self, sensitive): self['button2'].set_sensitive(sensitive) | 84edc475fe8d50b5ddd705276f7a226f4e96b262 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12037/84edc475fe8d50b5ddd705276f7a226f4e96b262/payt_view.py |
""" Check that a page handler actually wrote something, and properly finish the apache request.""" | """ 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 this function actually takes care of writing the result to the client. """ | 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_set_p: # make an attempt to guess content-type if result[:100].strip()[:6].lower() == '<html>' \ or result.find('</') > 0: req.content_type = 'text/html' else: req.content_type = 'text/plain' if req.header_only: if req.status in (apache.HTTP_NOT_FOUND, ): raise apache.SERVER_RETURN, req.status else: req.write(result) return apache.OK else: req.log_error("publisher: %s returned nothing." % `object`) return apache.HTTP_INTERNAL_SERVER_ERROR | 34e3759fd8d988daf736478f488636d4ab5bc8a2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/2111/34e3759fd8d988daf736478f488636d4ab5bc8a2/webinterface_handler.py |
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_set_p: # make an attempt to guess content-type if result[:100].strip()[:6].lower() == '<html>' \ or result.find('</') > 0: req.content_type = 'text/html' else: req.content_type = 'text/plain' if req.header_only: if req.status in (apache.HTTP_NOT_FOUND, ): raise apache.SERVER_RETURN, req.status else: req.write(result) return apache.OK else: req.log_error("publisher: %s returned nothing." % `object`) return apache.HTTP_INTERNAL_SERVER_ERROR | 34e3759fd8d988daf736478f488636d4ab5bc8a2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/2111/34e3759fd8d988daf736478f488636d4ab5bc8a2/webinterface_handler.py |
||
""" A directory groups web pages, and can delegate dispatching of | """ A directory groups web pages, and can delegate dispatching of | 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_set_p: # make an attempt to guess content-type if result[:100].strip()[:6].lower() == '<html>' \ or result.find('</') > 0: req.content_type = 'text/html' else: req.content_type = 'text/plain' if req.header_only: if req.status in (apache.HTTP_NOT_FOUND, ): raise apache.SERVER_RETURN, req.status else: req.write(result) return apache.OK else: req.log_error("publisher: %s returned nothing." % `object`) return apache.HTTP_INTERNAL_SERVER_ERROR | 34e3759fd8d988daf736478f488636d4ab5bc8a2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/2111/34e3759fd8d988daf736478f488636d4ab5bc8a2/webinterface_handler.py |
from Quixote's dispatching mechanism, with specific adaptations.""" | from Quixote's dispatching mechanism, with specific adaptations. """ | 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_set_p: # make an attempt to guess content-type if result[:100].strip()[:6].lower() == '<html>' \ or result.find('</') > 0: req.content_type = 'text/html' else: req.content_type = 'text/plain' if req.header_only: if req.status in (apache.HTTP_NOT_FOUND, ): raise apache.SERVER_RETURN, req.status else: req.write(result) return apache.OK else: req.log_error("publisher: %s returned nothing." % `object`) return apache.HTTP_INTERNAL_SERVER_ERROR | 34e3759fd8d988daf736478f488636d4ab5bc8a2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/2111/34e3759fd8d988daf736478f488636d4ab5bc8a2/webinterface_handler.py |
if req.is_https() and self._force_https: if not req.is_https(): original_parts = urlparse.urlparse(req.unparsed_uri) plain_prefix_parts = urlparse.urlparse(CFG_SITE_URL) secure_prefix_parts = urlparse.urlparse(CFG_SITE_SECURE_URL) plain_path = original_parts[2] plain_path = secure_prefix_parts[2] + plain_path[len(plain_prefix_parts[2]):] final_parts = list(secure_prefix_parts) final_parts[2] = plain_path final_parts[-3:] = original_parts[-3:] target = urlparse.urlunparse(final_parts) redirect_to_url(req, target) | if CFG_HAS_HTTPS_SUPPORT and self._force_https and not req.is_https(): original_parts = urlparse.urlparse(req.unparsed_uri) plain_prefix_parts = urlparse.urlparse(CFG_SITE_URL) secure_prefix_parts = urlparse.urlparse(CFG_SITE_SECURE_URL) plain_path = original_parts[2] plain_path = secure_prefix_parts[2] + \ plain_path[len(plain_prefix_parts[2]):] final_parts = list(secure_prefix_parts) final_parts[2] = plain_path final_parts[-3:] = original_parts[-3:] target = urlparse.urlunparse(final_parts) redirect_to_url(req, target) | def _traverse(self, req, path, do_head=False, guest_p=True): """ Locate the handler of an URI by traversing the elements of the path.""" | 34e3759fd8d988daf736478f488636d4ab5bc8a2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/2111/34e3759fd8d988daf736478f488636d4ab5bc8a2/webinterface_handler.py |
(iden, p_un, p_pw, msgcode) = loginUser(req, '', '', CFG_EXTERNAL_AUTH_USING_SSO) | (iden, p_un, dummy, dummy) = loginUser(req, '', '', CFG_EXTERNAL_AUTH_USING_SSO) | def _traverse(self, req, path, do_head=False, guest_p=True): """ Locate the handler of an URI by traversing the elements of the path.""" | 34e3759fd8d988daf736478f488636d4ab5bc8a2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/2111/34e3759fd8d988daf736478f488636d4ab5bc8a2/webinterface_handler.py |
uid = update_Uid(req, p_un) | update_Uid(req, p_un) | def _traverse(self, req, path, do_head=False, guest_p=True): """ Locate the handler of an URI by traversing the elements of the path.""" | 34e3759fd8d988daf736478f488636d4ab5bc8a2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/2111/34e3759fd8d988daf736478f488636d4ab5bc8a2/webinterface_handler.py |
if not form.has_key('ln') and \ req.uri not in no_lang_recognition_uris: | if 'ln' not in form and \ req.uri not in CFG_NO_LANG_RECOGNITION_URIS: | def _traverse(self, req, path, do_head=False, guest_p=True): """ Locate the handler of an URI by traversing the elements of the path.""" | 34e3759fd8d988daf736478f488636d4ab5bc8a2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/2111/34e3759fd8d988daf736478f488636d4ab5bc8a2/webinterface_handler.py |
util.redirect(req, req.uri + "/", permanent=True) | redirect_to_url(req, req.uri + "/", apache.HTTP_MOVED_PERMANENTLY) | def __call__(self, req, form): """ Maybe resolve the final / of a directory """ | 34e3759fd8d988daf736478f488636d4ab5bc8a2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/2111/34e3759fd8d988daf736478f488636d4ab5bc8a2/webinterface_handler.py |
re_slashes = re.compile('/+') re_special_uri = re.compile('^/record/\d+|^/collection/.+') | def __call__(self, req, form): """ Maybe resolve the final / of a directory """ | 34e3759fd8d988daf736478f488636d4ab5bc8a2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/2111/34e3759fd8d988daf736478f488636d4ab5bc8a2/webinterface_handler.py |
|
Profiling data is written into CFG_TMPDIR/invenio-profile-stats-datetime.raw, and | Profiling data is written into CFG_TMPDIR/invenio-profile-stats-datetime.raw, and | 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 more than one profile requirement like ?profile=time&profile=cumulative. The list of available algorithm is displayed at the end of the profile. """ args = {} if req.args: args = cgi.parse_qs(req.args) if 'profile' in args: if not isUserSuperAdmin(collect_user_info(req)): return _handler(req) | 34e3759fd8d988daf736478f488636d4ab5bc8a2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/2111/34e3759fd8d988daf736478f488636d4ab5bc8a2/webinterface_handler.py |
import hotshot, hotshot.stats | import hotshot import hotshot.stats | 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 more than one profile requirement like ?profile=time&profile=cumulative. The list of available algorithm is displayed at the end of the profile. """ args = {} if req.args: args = cgi.parse_qs(req.args) if 'profile' in args: if not isUserSuperAdmin(collect_user_info(req)): return _handler(req) | 34e3759fd8d988daf736478f488636d4ab5bc8a2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/2111/34e3759fd8d988daf736478f488636d4ab5bc8a2/webinterface_handler.py |
uri = re_slashes.sub('/', uri) | uri = RE_SLASHES.sub('/', uri) | 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 | 34e3759fd8d988daf736478f488636d4ab5bc8a2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/2111/34e3759fd8d988daf736478f488636d4ab5bc8a2/webinterface_handler.py |
if req.header_only and not re_special_uri.match(req.uri): | if req.header_only and not RE_SPECIAL_URI.match(req.uri): | 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 | 34e3759fd8d988daf736478f488636d4ab5bc8a2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/2111/34e3759fd8d988daf736478f488636d4ab5bc8a2/webinterface_handler.py |
return obj._traverse(req, path) | if hasattr(obj, '_traverse'): return obj._traverse(req, path) else: raise apache.SERVER_RETURN, apache.HTTP_NOT_FOUND | def _traverse(self, req, path): """ Locate the handler of an URI by traversing the elements of the path.""" | ee211c0cbc5ede007587ff1dcfce9e6a6184bcc8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/2111/ee211c0cbc5ede007587ff1dcfce9e6a6184bcc8/webinterface_handler.py |
expected_args = inspect.getargspec(module_globals[possible_handler])[0] | inspected_args = inspect.getargspec(module_globals[possible_handler]) expected_args = list(inspected_args[0]) expected_defaults = list(inspected_args[3]) expected_args.reverse() expected_defaults.reverse() | 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.webinterface_handler import _check_result ## the req.form must be casted to dict because of Python 2.4 and earlier ## otherwise any object exposing the mapping interface can be ## used with the magic ** form = dict(req.form) for key, value in form.items(): ## FIXME: this is a backward compatibility workaround ## because most of the old administration web handler ## expect parameters to be of type str. ## When legacy publisher will be removed all this ## pain will go away anyway :-) if isinstance(value, str): form[key] = str(value) try: return _check_result(req, module_globals[possible_handler](req, **form)) except TypeError, err: if ("%s() got an unexpected keyword argument" % possible_handler) in str(err) or ('%s() takes at least' % possible_handler) in str(err): import inspect expected_args = inspect.getargspec(module_globals[possible_handler])[0] register_exception(req=req, prefix="Wrong GET parameter set in calling a legacy publisher handler for %s: expected_args=%s, found_args=%s" % (possible_handler, repr(expected_args), repr(req.form.keys())), alert_admin=CFG_DEVEL_SITE) cleaned_form = {} for arg in expected_args: if arg == 'req': continue cleaned_form[arg] = form.get(arg, None) return _check_result(req, module_globals[possible_handler](req, **cleaned_form)) else: raise else: raise SERVER_RETURN, HTTP_NOT_FOUND | bf3e488f4c5bf7a89aadf8ab433a2aaa71f59c40 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/2111/bf3e488f4c5bf7a89aadf8ab433a2aaa71f59c40/webinterface_handler_wsgi.py |
for arg in expected_args: | for index, arg in enumerate(expected_args): | 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.webinterface_handler import _check_result ## the req.form must be casted to dict because of Python 2.4 and earlier ## otherwise any object exposing the mapping interface can be ## used with the magic ** form = dict(req.form) for key, value in form.items(): ## FIXME: this is a backward compatibility workaround ## because most of the old administration web handler ## expect parameters to be of type str. ## When legacy publisher will be removed all this ## pain will go away anyway :-) if isinstance(value, str): form[key] = str(value) try: return _check_result(req, module_globals[possible_handler](req, **form)) except TypeError, err: if ("%s() got an unexpected keyword argument" % possible_handler) in str(err) or ('%s() takes at least' % possible_handler) in str(err): import inspect expected_args = inspect.getargspec(module_globals[possible_handler])[0] register_exception(req=req, prefix="Wrong GET parameter set in calling a legacy publisher handler for %s: expected_args=%s, found_args=%s" % (possible_handler, repr(expected_args), repr(req.form.keys())), alert_admin=CFG_DEVEL_SITE) cleaned_form = {} for arg in expected_args: if arg == 'req': continue cleaned_form[arg] = form.get(arg, None) return _check_result(req, module_globals[possible_handler](req, **cleaned_form)) else: raise else: raise SERVER_RETURN, HTTP_NOT_FOUND | bf3e488f4c5bf7a89aadf8ab433a2aaa71f59c40 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/2111/bf3e488f4c5bf7a89aadf8ab433a2aaa71f59c40/webinterface_handler_wsgi.py |
cleaned_form[arg] = form.get(arg, None) | if index < len(expected_defaults): cleaned_form[arg] = form.get(arg, expected_defaults[index]) else: cleaned_form[arg] = form.get(arg, None) | 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.webinterface_handler import _check_result ## the req.form must be casted to dict because of Python 2.4 and earlier ## otherwise any object exposing the mapping interface can be ## used with the magic ** form = dict(req.form) for key, value in form.items(): ## FIXME: this is a backward compatibility workaround ## because most of the old administration web handler ## expect parameters to be of type str. ## When legacy publisher will be removed all this ## pain will go away anyway :-) if isinstance(value, str): form[key] = str(value) try: return _check_result(req, module_globals[possible_handler](req, **form)) except TypeError, err: if ("%s() got an unexpected keyword argument" % possible_handler) in str(err) or ('%s() takes at least' % possible_handler) in str(err): import inspect expected_args = inspect.getargspec(module_globals[possible_handler])[0] register_exception(req=req, prefix="Wrong GET parameter set in calling a legacy publisher handler for %s: expected_args=%s, found_args=%s" % (possible_handler, repr(expected_args), repr(req.form.keys())), alert_admin=CFG_DEVEL_SITE) cleaned_form = {} for arg in expected_args: if arg == 'req': continue cleaned_form[arg] = form.get(arg, None) return _check_result(req, module_globals[possible_handler](req, **cleaned_form)) else: raise else: raise SERVER_RETURN, HTTP_NOT_FOUND | bf3e488f4c5bf7a89aadf8ab433a2aaa71f59c40 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/2111/bf3e488f4c5bf7a89aadf8ab433a2aaa71f59c40/webinterface_handler_wsgi.py |
return _check_result(req, module_globals[possible_handler](req, **dict(req.form))) | return _check_result(req, module_globals[possible_handler](req, **form)) | 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.webinterface_handler import _check_result ## the req.form must be casted to dict because of Python 2.4 and earlier ## otherwise any object exposing the mapping interface can be ## used with the magic ** try: return _check_result(req, module_globals[possible_handler](req, **dict(req.form))) except TypeError, err: if ("%s() got an unexpected keyword argument" % possible_handler) in str(err) or ('%s() takes at least' % possible_handler) in str(err): import inspect expected_args = inspect.getargspec(module_globals[possible_handler])[0] register_exception(req=req, prefix="Wrong GET parameter set in calling a legacy publisher handler for %s: expected_args=%s, found_args=%s" % (possible_handler, repr(expected_args), repr(req.form.keys())), alert_admin=CFG_DEVEL_SITE) cleaned_form = {} for arg in expected_args: if arg == 'req': continue cleaned_form[arg] = req.form.get(arg, None) return _check_result(req, module_globals[possible_handler](req, **cleaned_form)) else: raise else: raise SERVER_RETURN, HTTP_NOT_FOUND | c12125684f88ca584afd08d5cfc119e2b276aa58 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/2111/c12125684f88ca584afd08d5cfc119e2b276aa58/webinterface_handler_wsgi.py |
cleaned_form[arg] = req.form.get(arg, None) | cleaned_form[arg] = form.get(arg, None) | 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.webinterface_handler import _check_result ## the req.form must be casted to dict because of Python 2.4 and earlier ## otherwise any object exposing the mapping interface can be ## used with the magic ** try: return _check_result(req, module_globals[possible_handler](req, **dict(req.form))) except TypeError, err: if ("%s() got an unexpected keyword argument" % possible_handler) in str(err) or ('%s() takes at least' % possible_handler) in str(err): import inspect expected_args = inspect.getargspec(module_globals[possible_handler])[0] register_exception(req=req, prefix="Wrong GET parameter set in calling a legacy publisher handler for %s: expected_args=%s, found_args=%s" % (possible_handler, repr(expected_args), repr(req.form.keys())), alert_admin=CFG_DEVEL_SITE) cleaned_form = {} for arg in expected_args: if arg == 'req': continue cleaned_form[arg] = req.form.get(arg, None) return _check_result(req, module_globals[possible_handler](req, **cleaned_form)) else: raise else: raise SERVER_RETURN, HTTP_NOT_FOUND | c12125684f88ca584afd08d5cfc119e2b276aa58 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/2111/c12125684f88ca584afd08d5cfc119e2b276aa58/webinterface_handler_wsgi.py |
if song['file'] in pl: client.play(pl.index(song['file'])) | if(pl): idx = client.playlist().index(client.currentsong()['file']) client.addid(song['file'], idx+1) client.play(idx+1) | 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 song client.close() client.disconnect() | 53efdec748405816d41c7667e1b1f87d1c4a08dc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/2109/53efdec748405816d41c7667e1b1f87d1c4a08dc/singalong.py |
client.play(len(pl)) | client.play() | 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 song client.close() client.disconnect() | 53efdec748405816d41c7667e1b1f87d1c4a08dc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/2109/53efdec748405816d41c7667e1b1f87d1c4a08dc/singalong.py |
first_frame=df.nframes-1, num_frames=1) sch0 = schedule[0] | first_frame=df.nframes-1, num_frames=1)[0] | 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 song client.close() client.disconnect() | 53efdec748405816d41c7667e1b1f87d1c4a08dc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/2109/53efdec748405816d41c7667e1b1f87d1c4a08dc/singalong.py |
while lst > sch0[0]: try: sch0 = schedule.pop(0) except IndexError: print "Schedule out of commands! Do something! Forget about music!" sys.exit(1) print "Passed threshold", sch0[0], "<", lst, "for region", sch0[1] newsong = True if newsong: for region in songLookup.keys: if sch0[1].find(region) >= 0: print "New song!", sch0[1], "matches", region playSong(region) break else: print "Could not find song match for", sch0[1] time.sleep(5) | try: while lst > schedule[1][0]: schedule.pop(0) print "Passed threshold", schedule[0][0], "<", lst, \ "for region", schedule[0][1] newsong = True if newsong: for region in songLookup.iterkeys(): if schedule[0][1].find(region) >= 0: print "New song!", schedule[0][1], "matches", region playSong(region) break else: print "Could not find song match for", schedule[0][1] time.sleep(5) except IndexError: print "Schedule out of commands! Do something! Forget about music!" sys.exit(1) | 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 song client.close() client.disconnect() | 53efdec748405816d41c7667e1b1f87d1c4a08dc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/2109/53efdec748405816d41c7667e1b1f87d1c4a08dc/singalong.py |
if(pl): idx = client.playlist().index(client.currentsong()['file']) | cur = client.currentsong() if(pl and cur): idx = client.playlist().index(cur['file']) | 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, with added song else: client.add(song['file']) client.play() client.close() client.disconnect() | 510a80ec63cc5a54608d4acd890a215ebc54f17d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/2109/510a80ec63cc5a54608d4acd890a215ebc54f17d/singalong.py |
client.play() | client.play(len(pl)) | 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, with added song else: client.add(song['file']) client.play() client.close() client.disconnect() | 510a80ec63cc5a54608d4acd890a215ebc54f17d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/2109/510a80ec63cc5a54608d4acd890a215ebc54f17d/singalong.py |
value = str(value) + ' ' + DateTime().localZone() | value = str(value) + ' +00:00' | 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.getUpdateMatchExpression(expression_context = econtext) mappings = sfa.getFieldMap() | 309965bbe57d13a7d8fcb3bfcd369c93b436fd6b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9109/309965bbe57d13a7d8fcb3bfcd369c93b436fd6b/prepopulator.py |
try: self.sse_supported.index (TARGET [2]) if check_cflags ("-mfpmath=sse", "CFLAGS"): add_config_h ("TUNE_SSE") except: pass | def startup (self): global CXXFLAGS, TARGET | 3336832c0e0352f722b6bdae92de0f40754d8f13 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/2556/3336832c0e0352f722b6bdae92de0f40754d8f13/tibs.py |
|
cpu = platform.processor () if (not cpu) or (len (cpu) == 0): cpu = platform.machine () TARGET.append (cpu.replace ("-", "_")) | TARGET.append (platform.machine ()) | 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 = platform.machine () # Python 2.5 on windows returns empty string here if (arch == "") or \ (len (arch) >= 4 and arch [0] == "i" and arch [2:4] == "86" and arch [4:] == ""): arch = "x86" HOST.append (arch) TARGET.append (arch) cpu = platform.processor () if (not cpu) or (len (cpu) == 0): cpu = platform.machine () TARGET.append (cpu.replace ("-", "_")) # HOST contains ["platform", "arch"] # TARGET contains ["platform", "arch", "tune"] | 3336832c0e0352f722b6bdae92de0f40754d8f13 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/2556/3336832c0e0352f722b6bdae92de0f40754d8f13/tibs.py |
if var == "CFLAGS": | if var.endswith ("CFLAGS"): | 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 if the flags are supported (e.g. "CFLAGS", "CXXFLAGS" etc) `xcflags` : str Additional flags to use during test compilation. These won't be appended to var. :Returns: True if the flags are supported, False if not. """ check_started ("Checking if compiler supports " + cflags) if var == "CFLAGS": srcf = "conftest.c" else: srcf = "conftest.cpp" write_file (srcf, """ | 3336832c0e0352f722b6bdae92de0f40754d8f13 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/2556/3336832c0e0352f722b6bdae92de0f40754d8f13/tibs.py |
add_config_h ("HAVE_" + make_identifier (hdr)) | add_config_h ("HAVE_" + make_identifier (hdr.replace (".", "_"))) | 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 the header file is not available. If it is None, the missing file is not considered a fatal error. :Returns: True if header file exists, False if not. """ rc = False check_started ("Checking for header file " + hdr) write_file ("conftest.c", """ | 89164a8717dc0e6b922625e6420949165b512fa4 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/2556/89164a8717dc0e6b922625e6420949165b512fa4/tibs.py |
"gcc": lambda: compiler_gcc (), "msvc": lambda: compiler_msvc (), | "GCC": lambda: compiler_gcc (), "MSVC": lambda: compiler_msvc (), | def linklib (self, library, path = None): tmp = "" if path: tmp = "-libpath:" + path.replace ('/', '\\\\') + " " return tmp + ".lib ".join (library.split ()) + ".lib" | d1d05a728990bf02584bb70d0eca5637dcaae898 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/2556/d1d05a728990bf02584bb70d0eca5637dcaae898/tibs.py |
global HOST, TARGET, EXE, TOOLKIT | """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 | 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 range (1, len (sys.argv)): if skip_opt: skip_opt = False continue opt = sys.argv [optidx] optarg = None opt_ok = False if opt [:2] == "--": opt = opt [2:] opt_short = False for o in OPTIONS: if o [1] and o [1] == opt [:len (o [1])]: optarg = opt [len (o [1]):] if optarg [:1] == '=' or len (opt) == len (o [1]): opt_ok = True optarg = optarg [1:] break elif opt [:1] == "-": opt = opt [1:] opt_short = True for o in OPTIONS: if o [0] and o [0] == opt: opt_ok = True break if not opt_ok: print "Unknown command-line option: '" + opt + "'" sys.exit (1) # Check if option needs argument if o [2] and opt_short: if optidx >= len (sys.argv): print "Option '" + opt + "' needs an argument" sys.exit (1) skip_opt = True optarg = sys.argv [optidx + 1] if not o [2] and optarg: print "Option '" + opt + "' does not accept an argument" sys.exit (1) exec o [3] # Print the host and target platforms print "Compiling on host " + ".".join (HOST) + " for target " + \ ".".join (TARGET [:2]) + " (tune for " + TARGET [2] + ")" # Now set target-specific defaults if TARGET [0] == "windows": EXE = ".exe" else: EXE = "" add_config_h ("CONF_PACKAGE", '"' + PROJ + '"') add_config_mak ("CONF_PACKAGE", PROJ) add_config_h ("CONF_VERSION", '"' + VERSION + '"') add_config_mak ("CONF_VERSION", VERSION) add_config_h ("PLATFORM_" + TARGET [0].upper ()) add_config_h ("ARCH_" + TARGET [1].upper ()) add_config_h ("TUNE_" + TARGET [2].upper ()) add_config_mak ("HOST", HOST [0]) add_config_mak ("TARGET", TARGET [0]) add_config_mak ("ARCH", TARGET [1]) add_config_mak ("TUNE", TARGET [2]) if BINDIR is None: BINDIR = PREFIX + "/bin" if SYSCONFDIR is None: SYSCONFDIR = PREFIX + "/etc/" + PROJ if DATADIR is None: DATADIR = PREFIX + "/share/" + PROJ if DOCDIR is None: DOCDIR = PREFIX + "/share/doc/" + PROJ + "-" + VERSION # http://www.pathname.com/fhs/pub/fhs-2.3.html#LIB64 if LIBDIR is None: if TARGET [1] [-2:] == "64": LIBDIR = PREFIX + "/lib64" # Debian doesn't follow LFS in this regard try: os.stat (LIBDIR) except: LIBDIR = PREFIX + "/lib" else: LIBDIR = PREFIX + "/lib" if INCLUDEDIR is None: INCLUDEDIR = PREFIX + "/include" if LIBEXECDIR is None: LIBEXECDIR = PREFIX + "/libexec/" + PROJ # Instantiate the compiler-dependent class TOOLKIT = COMPILERS.get (COMPILER); if not TOOLKIT: print "Unsupported compiler: " + COMPILER sys.exit (1) TOOLKIT = TOOLKIT () TOOLKIT.startup () add_config_h ("CONF_COMPILER_" + COMPILER) if PREFIX != "": add_config_h ("CONF_PREFIX", '"' + PREFIX + '"') add_config_mak ("CONF_PREFIX", PREFIX + '/') if BINDIR != "": add_config_h ("CONF_BINDIR", '"' + BINDIR + '"') add_config_mak ("CONF_BINDIR", BINDIR + '/') if SYSCONFDIR != "": add_config_h ("CONF_SYSCONFDIR", '"' + SYSCONFDIR + '"') add_config_mak ("CONF_SYSCONFDIR", SYSCONFDIR + '/') if DATADIR != "": add_config_h ("CONF_DATADIR", '"' + DATADIR + '"') add_config_mak ("CONF_DATADIR", DATADIR + '/') if LIBDIR != "": add_config_h ("CONF_LIBDIR", '"' + LIBDIR + '"') add_config_mak ("CONF_LIBDIR", LIBDIR + '/') if INCLUDEDIR != "": add_config_h ("CONF_INCLUDEDIR", '"' + INCLUDEDIR + '"') add_config_mak ("CONF_INCLUDEDIR", INCLUDEDIR + '/') if DOCDIR != "": add_config_h ("CONF_DOCDIR", '"' + DOCDIR + '"') add_config_mak ("CONF_DOCDIR", DOCDIR + '/') if LIBEXECDIR != "": add_config_h ("CONF_LIBEXECDIR", '"' + LIBEXECDIR + '"') add_config_mak ("CONF_LIBEXECDIR", LIBEXECDIR + '/') if SHAREDLIBS: add_config_h ("CONF_SHAREDLIBS", "1") add_config_mak ("SHAREDLIBS", "1") else: add_config_h ("CONF_SHAREDLIBS", "0") add_config_mak ("SHAREDLIBS", "") | d1d05a728990bf02584bb70d0eca5637dcaae898 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/2556/d1d05a728990bf02584bb70d0eca5637dcaae898/tibs.py |
cpu = platform.processor ().replace ("-", "_") TARGET.append (cpu) | cpu = platform.processor () if (not cpu) or (len (cpu) == 0): cpu = platform.machine () TARGET.append (cpu.replace ("-", "_")) | 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 = platform.machine () # Python 2.5 on windows returns empty string here if (arch == "") or \ (len (arch) >= 4 and arch [0] == "i" and arch [2:4] == "86" and arch [4:] == ""): arch = "x86" HOST.append (arch) TARGET.append (arch) cpu = platform.processor ().replace ("-", "_") TARGET.append (cpu) # HOST contains ["platform", "arch"] # TARGET contains ["platform", "arch", "tune"] | d1d05a728990bf02584bb70d0eca5637dcaae898 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/2556/d1d05a728990bf02584bb70d0eca5637dcaae898/tibs.py |
global CONFIG_H | """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` : str The value of the macro. If not specified, defaults to "1". """ global CONFIG_H, _CONFIG_H | def add_config_h (macro, val = "1"): global CONFIG_H macro = macro.strip () CONFIG_H [macro] = val.strip () _CONFIG_H.append (macro) | d1d05a728990bf02584bb70d0eca5637dcaae898 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/2556/d1d05a728990bf02584bb70d0eca5637dcaae898/tibs.py |
global CONFIG_MAK | """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. `val` : str The value of the macro. If not specified, defaults to "1". """ global CONFIG_MAK, _CONFIG_MAK | def add_config_mak (macro, val = "1"): global CONFIG_MAK macro = macro.strip () CONFIG_MAK [macro] = val.strip () _CONFIG_MAK.append (macro) | d1d05a728990bf02584bb70d0eca5637dcaae898 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/2556/d1d05a728990bf02584bb70d0eca5637dcaae898/tibs.py |
line = fd.readline ().strip () | lines = fd.readlines () | 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 (ver_regex, line) if not m: raise version = m.group (1) if not compare_version (version, req_version): raise check_finished (version + ", OK") rc = True except: if version: check_finished (version + " < " + req_version + ", FAILED") else: check_finished ("FAILED") if not rc and failifnot: print "\n" + name + " version " + req_version + " and above is required to build this project" sys.exit (1) return rc | d1d05a728990bf02584bb70d0eca5637dcaae898 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/2556/d1d05a728990bf02584bb70d0eca5637dcaae898/tibs.py |
if VERBOSE: print "\n m = re.match (ver_regex, line) | for line in lines: line = line.strip () if VERBOSE: print "\n m = re.match (ver_regex, line) if m: version = m.group (1) if not compare_version (version, req_version): raise break | 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 (ver_regex, line) if not m: raise version = m.group (1) if not compare_version (version, req_version): raise check_finished (version + ", OK") rc = True except: if version: check_finished (version + " < " + req_version + ", FAILED") else: check_finished ("FAILED") if not rc and failifnot: print "\n" + name + " version " + req_version + " and above is required to build this project" sys.exit (1) return rc | d1d05a728990bf02584bb70d0eca5637dcaae898 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/2556/d1d05a728990bf02584bb70d0eca5637dcaae898/tibs.py |
raise version = m.group (1) if not compare_version (version, req_version): | 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 (ver_regex, line) if not m: raise version = m.group (1) if not compare_version (version, req_version): raise check_finished (version + ", OK") rc = True except: if version: check_finished (version + " < " + req_version + ", FAILED") else: check_finished ("FAILED") if not rc and failifnot: print "\n" + name + " version " + req_version + " and above is required to build this project" sys.exit (1) return rc | d1d05a728990bf02584bb70d0eca5637dcaae898 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/2556/d1d05a728990bf02584bb70d0eca5637dcaae898/tibs.py |
|
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 env_val: if args == "exists": return True return env_val # Check if there's a static library configuration defined if tmp_lib in PKGCONFIG: if args == "exists": return True pkg = PKGCONFIG [tmp_lib] if args in pkg: return pkg [args] return "" # Do not use pkg-config if cross-compiling if HOST [:1] != TARGET [:1]: abort_configure ( | d1d05a728990bf02584bb70d0eca5637dcaae898 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/2556/d1d05a728990bf02584bb70d0eca5637dcaae898/tibs.py |
||
update_file (outfile, content) | return update_file (outfile, content) | def substmacros (infile, outfile = None, macros = None): if not outfile: if infile.endswith (".in"): outfile = infile [:-3] else: abort_configure ( | d1d05a728990bf02584bb70d0eca5637dcaae898 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/2556/d1d05a728990bf02584bb70d0eca5637dcaae898/tibs.py |
self._chunks = [] | 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) | 1da061d4da3b9f091dd5a7347eba000f3be61b78 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/4495/1da061d4da3b9f091dd5a7347eba000f3be61b78/decompressor.py |
|
_read_member_header() | self._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() | d5fa0eadc9aa409a53ee33459579e1dae85f20ce /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/4495/d5fa0eadc9aa409a53ee33459579e1dae85f20ce/decompressor.py |
extra += deobj.decompress(self.fileobj.read(3)) | extra += deobj.decompress(self._fileobj.read(3)) | 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 += deobj.decompress(self.fileobj.read(3)) | d5fa0eadc9aa409a53ee33459579e1dae85f20ce /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/4495/d5fa0eadc9aa409a53ee33459579e1dae85f20ce/decompressor.py |
comp_lenghts_pos = _prepare_header(output, in_size, basename, mtime) | comp_lengths_pos = _prepare_header(output, in_size, basename, mtime) | 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) | 599e1e2a4e20b94572217d36e0d7135c9204a61d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/4495/599e1e2a4e20b94572217d36e0d7135c9204a61d/compressor.py |
output.seek(comp_lenghts_pos) | output.seek(comp_lengths_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_lenghts_pos) for comp_len in comp_lengths: _write16(output, comp_len) output.seek(end_pos) | 599e1e2a4e20b94572217d36e0d7135c9204a61d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/4495/599e1e2a4e20b94572217d36e0d7135c9204a61d/compressor.py |
comp_lenghts_pos = _write_extra_fields(output, in_size) | comp_lengths_pos = _write_extra_fields(output, in_size) | 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. if mtime > 0xffffffffL: mtime = 0 _write32(output, mtime) deflate_flags = "\0" if COMPRESSION_LEVEL == zlib.Z_BEST_COMPRESSION: deflate_flags = "\x02" # slowest compression algorithm output.write(deflate_flags) output.write(chr(OS_CODE_UNIX)) comp_lenghts_pos = _write_extra_fields(output, in_size) if basename: output.write(basename + '\0') # original basename return comp_lenghts_pos | 599e1e2a4e20b94572217d36e0d7135c9204a61d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/4495/599e1e2a4e20b94572217d36e0d7135c9204a61d/compressor.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.