rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
if isinstance(attr.value, DerivedAttributeValue): | if attr.value.inherited: print 'inheriting ' + attr.id + ' from ' + attr.parent.id elif isinstance(attr.value, DerivedAttributeValue): | def write_idea_scheme(filename): name, ext = os.path.splitext(os.path.basename(filename)) scheme = ET.Element("scheme", name=name, version="1", parent_scheme="Default") ET.SubElement(scheme, 'option', name='LINE_SPACING', value='1.0') ET.SubElement(scheme, 'option', name='EDITOR_FONT_SIZE', value='12') ET.SubElement(sc... |
if event.type() == QEvent.LayoutDirectionChange: | event_type = event.type() if event_type == QEvent.LayoutDirectionChange: | def event(self, event): if event.type() == QEvent.LayoutDirectionChange: box_direction = QBoxLayout.RightToLeft if self.isRightToLeft() else QBoxLayout.LeftToRight self.left_layout.setDirection(box_direction) self.right_layout.setDirection(box_direction) elif event.type() == QEvent.DynamicPropertyChange and event.prope... |
elif event.type() == QEvent.DynamicPropertyChange and event.propertyName() == 'widgetSpacing': self.left_layout.setSpacing(self.widgetSpacing) self.right_layout.setSpacing(self.widgetSpacing) self._update_text_margins() | elif event_type == QEvent.DynamicPropertyChange: property_name = event.propertyName() if property_name == 'widgetSpacing': self.left_layout.setSpacing(self.widgetSpacing) self.right_layout.setSpacing(self.widgetSpacing) self._update_text_margins() elif property_name == 'inactiveText': self.update() | def event(self, event): if event.type() == QEvent.LayoutDirectionChange: box_direction = QBoxLayout.RightToLeft if self.isRightToLeft() else QBoxLayout.LeftToRight self.left_layout.setDirection(box_direction) self.right_layout.setDirection(box_direction) elif event.type() == QEvent.DynamicPropertyChange and event.prope... |
self.username = user_info.username | self.username = user_info.username.lower().replace(' ', '.') | def _initialize(self): self.display_name = user_info.fullname self.username = user_info.username self.sip_address = u'' self.password = u'' self.verify_password = u'' self.email_address = u'' |
position = self.accounts.index(notification.sender) | try: position = self.accounts.index(notification.sender) except ValueError: return | def _NH_SIPAccountWillRegister(self, notification): position = self.accounts.index(notification.sender) self.accounts[position].registration_state = 'started' self.dataChanged.emit(self.index(position), self.index(position)) |
position = self.accounts.index(notification.sender) | try: position = self.accounts.index(notification.sender) except ValueError: return | def _NH_SIPAccountRegistrationDidSucceed(self, notification): position = self.accounts.index(notification.sender) self.accounts[position].registration_state = 'succeeded' self.dataChanged.emit(self.index(position), self.index(position)) |
position = self.accounts.index(notification.sender) | try: position = self.accounts.index(notification.sender) except ValueError: return | def _NH_SIPAccountRegistrationDidFail(self, notification): position = self.accounts.index(notification.sender) self.accounts[position].registration_state = 'failed' self.dataChanged.emit(self.index(position), self.index(position)) |
position = self.accounts.index(notification.sender) | try: position = self.accounts.index(notification.sender) except ValueError: return | def _NH_SIPAccountRegistrationDidEnd(self, notification): position = self.accounts.index(notification.sender) self.accounts[position].registration_state = 'ended' self.dataChanged.emit(self.index(position), self.index(position)) |
self.main_window.add_account_dialog.open_for_create() | self.main_window.preferences_window.show_create_account_dialog() | def _NH_SIPApplicationDidStart(self, notification): self.fetch_account() self.main_window.show() settings = SIPSimpleSettings() accounts = AccountManager().get_accounts() if not accounts or (self.first_run and accounts==[BonjourAccount()]): self.main_window.add_account_dialog.open_for_create() if settings.google_contac... |
contacts = [self.items[index.row()] for index in indexes if index.isValid()] | contacts = [self.data(index) for index in indexes if index.isValid()] | def mimeData(self, indexes): mime_data = QMimeData() contacts = [self.items[index.row()] for index in indexes if index.isValid()] if contacts: mime_data.setData('application/x-blink-contact-list', QByteArray(pickle.dumps(contacts))) return mime_data |
self.setFocusProxy(parent) | def __init__(self, name, parent=None): super(ContactGroupWidget, self).__init__(parent) with Resources.directory: self.setupUi(self) self.name = name self.selected = False self.drop_indicator = None self._disable_dnd = False self.setFocusProxy(parent) self.label_widget.setFocusProxy(self) self.name_view.setCurrentWidge... | |
selection_model.setCurrentIndex(model.index(0, 0), selection_model.Select) | def focusInEvent(self, event): super(ContactSearchListView, self).focusInEvent(event) model = self.model() selection_model = self.selectionModel() if not selection_model.selectedIndexes() and model.rowCount() > 0: selection_model.select(model.index(0, 0), selection_model.Select) selection_model.setCurrentIndex(model.in... | |
self.credits_text.setMinimumWidth(credits_width) | self.credits_text.setFixedWidth(credits_width) | def __init__(self, parent=None): super(AboutPanel, self).__init__(parent) |
size.setHeight(max(size.height(), 168)) | def _credits_size_changed(self, size): size.setHeight(max(size.height(), 168)) self.credits_text.document().documentLayout().documentSizeChanged.disconnect(self._credits_size_changed) self.credits_text.setFixedSize(size.toSize() + QSize(6, 6)) | |
self.credits_text.setFixedSize(size.toSize() + QSize(6, 6)) | self.setFixedSize(self.minimumSize().width(), self.minimumSize().width()*1.40) row_height = QFontMetrics(self.credits_text.currentFont()).height() + 2 max_credits_height = 8*row_height + 2 + 14 if self.credits_text.height() > max_credits_height: self.setFixedHeight(self.height() - (self.credits_text.height() - max_cred... | def _credits_size_changed(self, size): size.setHeight(max(size.height(), 168)) self.credits_text.document().documentLayout().documentSizeChanged.disconnect(self._credits_size_changed) self.credits_text.setFixedSize(size.toSize() + QSize(6, 6)) |
self.stream_info_label.session_type = session.codec_info | self.stream_info_label.codec_info = session.codec_info | def __init__(self, session, parent=None): super(SessionWidget, self).__init__(parent) with Resources.directory: self.setupUi(self) font = self.latency_label.font() font.setPointSizeF(self.status_label.fontInfo().pointSizeF() - 1) self.latency_label.setFont(font) font = self.packet_loss_label.font() font.setPointSizeF(s... |
index = selection.indexes()[0] if not selection.isEmpty() else self.model().index(-1) | index = selection.indexes()[0] if not selection.isEmpty() else self.model().index(-1, -1) | def _SH_SelectionModelSelectionChanged(self, selected, deselected): selection_model = self.selectionModel() selection = selection_model.selection() if selection_model.currentIndex() not in selection: index = selection.indexes()[0] if not selection.isEmpty() else self.model().index(-1) selection_model.setCurrentIndex(in... |
self.beginInsertRows(QModelIndex(), 0, len(items)-1) | self.beginResetModel() | def load(self): try: try: file = open(ApplicationData.get('contacts')) items = pickle.load(file) except (IOError, OSError): file = open(ApplicationData.get('contacts.bak')) items = pickle.load(file) except (IOError, OSError): file = None group = ContactGroup('Test') contacts = [Contact(group, 'Call Test', '3333@sip2sip... |
self.endInsertRows() | self.endResetModel() | def load(self): try: try: file = open(ApplicationData.get('contacts')) items = pickle.load(file) except (IOError, OSError): file = open(ApplicationData.get('contacts.bak')) items = pickle.load(file) except (IOError, OSError): file = None group = ContactGroup('Test') contacts = [Contact(group, 'Call Test', '3333@sip2sip... |
self.display_name.setText(account.display_name) | self.display_name.setText(account.display_name or u'') | def _SH_IdentityCurrentIndexChanged(self, index): if index != -1: account = self.identity.itemData(index).toPyObject().account self.display_name.setText(account.display_name) self.display_name.setEnabled(True) self.activity_note.setEnabled(True) self.status.setEnabled(True) if not self.session_model.active_sessions: se... |
self.enable_call_buttons(account_manager.default_account is not None and len(selected_items)==1) | self.enable_call_buttons(account_manager.default_account is not None and len(selected_items)<=1) | def _SH_SearchBoxTextChanged(self, text): account_manager = AccountManager() if text: self.switch_view_button.view = SwitchViewButton.ContactView selected_items = self.search_list.selectionModel().selectedIndexes() self.enable_call_buttons(account_manager.default_account is not None and len(selected_items)==1) else: se... |
self.enable_call_buttons(account_manager.default_account is not None and len(selected_items)==1) | self.enable_call_buttons(account_manager.default_account is not None and len(selected_items)<=1) | def _SH_SearchListSelectionChanged(self, selected, deselected): account_manager = AccountManager() selected_items = self.search_list.selectionModel().selectedIndexes() self.enable_call_buttons(account_manager.default_account is not None and len(selected_items)==1) |
video_stream = self.create_stream(account, 'vidoe') if video else None | video_stream = self.create_stream(account, 'video') if video else None | def start_call(self, name, address, contact=None, account=None, conference_sibling=None, audio=True, video=False): account_manager = AccountManager() account = account or account_manager.default_account if account is None or not account.enabled: return try: remote_uri = self.create_uri(account, address) except Exceptio... |
self.items.append(contact) | self.items.insert(position, contact) | def addContact(self, contact): if contact.group in self.items: for position in xrange(self.items.index(contact.group)+1, len(self.items)): item = self.items[position] if type(item) is ContactGroup or item.name > contact.name: break else: position = len(self.items) self.beginInsertRows(QModelIndex(), position, position)... |
notification_center.add_observer(self, sender=AccountManager()) | def __init__(self, parent=None): super(MainWindow, self).__init__(parent) self.idle_status_index = 0 | |
self.username_editor.regexp = re.compile('^[a-z1-9][a-z0-9_.-]{1,65}[a-z0-9]$') | self.username_editor.regexp = re.compile('^[a-z1-9][a-z0-9_.-]{1,65}[a-z0-9]$', re.I | re.L) | def __init__(self, parent=None): super(AddAccountDialog, self).__init__(parent) with Resources.directory: self.setupUi(self) self.background_frame.setStyleSheet("") self.button_group = QButtonGroup(self) self.button_group.setObjectName("button_group") self.button_group.addButton(self.add_account_button, self.panel_view... |
cls._cached_directory = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, True)[0] | cls._cached_directory = os.path.join(NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, True)[0], u'Blink') | def directory(cls): if cls._cached_directory is None: if platform.system() == 'Darwin': from Foundation import NSApplicationSupportDirectory, NSSearchPathForDirectoriesInDomains, NSUserDomainMask cls._cached_directory = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, True)[0] elif p... |
except (ConnectionLost, RequestError, socket.error): | except (ConnectionLost, RequestError, httplib.HTTPException, socket.error): | def load_contacts(self): if self.greenlet is not None: api.kill(self.greenlet, api.GreenletExit()) self.greenlet = api.getcurrent() if self._load_timer is not None and self._load_timer.active(): self._load_timer.cancel() self._load_timer = None |
except (BadAuthentication, RequestError): | except RequestError: | def _authorize_google_account(self): red = '#cc0000' captcha_response = unicode(self.captcha_editor.text()) if self.captcha_token else None username = unicode(self.username_editor.text()) password = unicode(self.password_editor.text()) client = ContactsClient() try: client.client_login(email=username, password=password... |
self.account_menu.removeAction(action) | self.accounts_menu.removeAction(action) | def _NH_SIPAccountManagerDidRemoveAccount(self, notification): account = notification.data.account action = (action for action in self.accounts_menu.actions() if action.data().toPyObject() is account).next() self.account_menu.removeAction(action) if isinstance(account, Account) and account.enabled and account.message_s... |
search_string = unicode(self.filterRegExp().pattern()) | search_string = unicode(self.filterRegExp().pattern()).lower() | def filterAcceptsRow(self, source_row, source_parent): source_model = self.sourceModel() source_index = source_model.index(source_row, 0, source_parent) item = source_model.data(source_index, Qt.DisplayRole) if type(item) is ContactGroup: return False search_string = unicode(self.filterRegExp().pattern()) return search... |
self.username_editor.regexp = re.compile('^\w(?<=[^0_])[\w.-]{3,30}(?<=[^_.-])$', re.IGNORECASE) | self.username_editor.regexp = re.compile('^\w(?<=[^0_])[\w.-]{4,31}(?<=[^_.-])$', re.IGNORECASE) | def __init__(self, parent=None): super(AddAccountDialog, self).__init__(parent) with Resources.directory: self.setupUi(self) self.background_frame.setStyleSheet("") self.button_group = QButtonGroup(self) self.button_group.setObjectName("button_group") self.button_group.addButton(self.add_account_button, self.panel_view... |
added_items = [contact.group, contact] if contact.group in self.items else [contact] | added_items = [contact] if contact.group in self.items else [contact.group, contact] | def addContact(self, contact): if contact in self.items: return added_items = [contact.group, contact] if contact.group in self.items else [contact] self._add_contact(contact) self.itemsAdded.emit(added_items) |
else: index = self.index(self.items.index(contact)) self.dataChanged.emit(index, index) | index = self.index(self.items.index(contact)) self.dataChanged.emit(index, index) | def updateContact(self, contact, attributes): group = attributes.pop('group') for name, value in attributes.iteritems(): setattr(contact, name, value) if contact.group != group: new_group = group not in self.items self._pop_contact(contact) contact.group = group self._add_contact(contact) if new_group: self.itemsAdded.... |
self.latency = stats['rtt']['avg'] / 1000 self.packet_loss = int(stats['rx']['packets_lost']*100.0/stats['rx']['packets']) if stats['rx']['packets'] else 0 | if stats is not None: self.latency = stats['rtt']['avg'] / 1000 self.packet_loss = int(stats['rx']['packets_lost']*100.0/stats['rx']['packets']) if stats['rx']['packets'] else 0 | def _SH_TimerFired(self): stats = self.video_stream.statistics if self.video_stream else self.audio_stream.statistics self.latency = stats['rtt']['avg'] / 1000 self.packet_loss = int(stats['rx']['packets_lost']*100.0/stats['rx']['packets']) if stats['rx']['packets'] else 0 self.duration += timedelta(seconds=1) |
address = cls.number_strip_re.sub('', address) if isinstance(account, Account) and account.pstn.idd_prefix is not None: address = re.sub(r'^\+', account.pstn.idd_prefix, address) | if cls.number_re.match(address): address = cls.number_strip_re.sub('', address) if isinstance(account, Account) and account.pstn.idd_prefix is not None: address = re.sub(r'^\+', account.pstn.idd_prefix, address) | def normalize_number(cls, account, address): address = cls.number_strip_re.sub('', address) if isinstance(account, Account) and account.pstn.idd_prefix is not None: address = re.sub(r'^\+', account.pstn.idd_prefix, address) return address |
except (IOError, OSError): | except Exception: | def load(self): try: try: file = open(ApplicationData.get('contacts')) items = pickle.load(file) except (IOError, OSError): file = open(ApplicationData.get('contacts.bak')) items = pickle.load(file) except (IOError, OSError): file = None group = ContactGroup('Test') contacts = [Contact(group, 'Call Test', '3333@sip2sip... |
version = blink.__version__, | version = __version__, | def find_packages(toplevel): return [directory.replace('/', '.') for directory, subdirs, files in os.walk(toplevel) if '__init__.py' in files] |
self.setupUi(self) | self.setupUi() self.setWindowTitle('Blink') self.setWindowIconText('Blink') self.set_user_icon(Resources.get("icons/default-avatar.png")) self.enable_call_buttons(False) self.account_model = AccountModel(self) self.enabled_account_model = ActiveAccountModel(self.account_model, self) self.identity.setModel(self.enabl... | def __init__(self, parent=None): super(MainWindow, self).__init__(parent) |
self.setWindowTitle('Blink') self.setWindowIconText('Blink') self.set_user_icon(Resources.get("icons/default-avatar.png")) self.enable_call_buttons(False) self.account_model = AccountModel(self) self.enabled_account_model = ActiveAccountModel(self.account_model, self) self.identity.setModel(self.enabled_account_model... | option = QStyleOptionComboBox() self.status.initStyleOption(option) frame_width = self.status.style().pixelMetric(QStyle.PM_DefaultFrameWidth, option, self.status) font = self.status.font() font.setFamily('Sans Serif') font.setPointSize(font.pointSize() - 1) font_metrics = QFontMetrics(font) if font_metrics.height() > ... | def __init__(self, parent=None): super(MainWindow, self).__init__(parent) |
self.beginInsertRows(QModelIndex(), len(self.items), len(self.items)+end) | self.beginInsertRows(QModelIndex(), len(self.items), len(self.items)+contacts_count) | def moveGroup(self, group, position): contact_groups = self.contact_groups if group not in contact_groups or contact_groups.index(group) == position: return contacts_count = len([item for item in self.items if isinstance(item, Contact) and item.group==group]) start = self.items.index(group) end = start + contacts_count... |
position = items.index(contact_groups[self.bonjour_group.previous_position+1]) items.insert(position, self.bonjour_group) | position = self.bonjour_group.previous_position if contact_groups.index(self.bonjour_group) < position: position += 1 items.insert(items.index(contact_groups[position]), self.bonjour_group) | def save(self): items = [item for item in self.items if item.savable] contact_groups = self.contact_groups if self.bonjour_group in contact_groups and self.bonjour_group.previous_position != contact_groups.index(self.bonjour_group) and self.bonjour_group.previous_position is not None: items.remove(self.bonjour_group) i... |
self.sip_address_editor.regexp = re.compile('^[^@]+@.+$') | self.sip_address_editor.regexp = re.compile('^[^@\s]+@[^@\s]+$') | def __init__(self, parent=None): super(AddAccountDialog, self).__init__(parent) with Resources.directory: self.setupUi(self) self.background_frame.setStyleSheet("") self.button_group = QButtonGroup(self) self.button_group.setObjectName("button_group") self.button_group.addButton(self.add_account_button, self.panel_view... |
self.email_address_editor.regexp = re.compile('^[^@]+@.+$') | self.email_address_editor.regexp = re.compile('^[^@\s]+@[^@\s]+$') | def __init__(self, parent=None): super(AddAccountDialog, self).__init__(parent) with Resources.directory: self.setupUi(self) self.background_frame.setStyleSheet("") self.button_group = QButtonGroup(self) self.button_group.setObjectName("button_group") self.button_group.addButton(self.add_account_button, self.panel_view... |
super(IncomingDialog, self).__init__(parent, flags=Qt.WindowStaysOnTopHint) | super(IncomingDialog, self).__init__(parent) self.setWindowFlags(Qt.WindowStaysOnTopHint) | def __init__(self, parent=None): super(IncomingDialog, self).__init__(parent, flags=Qt.WindowStaysOnTopHint) self.setAttribute(Qt.WA_DeleteOnClose) with Resources.directory: self.setupUi(self) font = self.username_label.font() font.setPointSizeF(self.uri_label.fontInfo().pointSizeF() + 3) font.setFamily("Sans Serif") s... |
inactiveText = QtDynamicProperty('inactiveText', str) | inactiveText = QtDynamicProperty('inactiveText', unicode) | def event(self, event): if event.type() == QEvent.LayoutRequest: self.sizeHintChanged.emit() return QWidget.event(self, event) |
action.setEnabled(True if account is not BonjourAccount() else account.enabled) | action.setEnabled(True if account is not BonjourAccount() else BonjourAccount.mdns_available) | def _NH_SIPApplicationWillStart(self, notification): settings = SIPSimpleSettings() self.silent_action.setChecked(settings.audio.silent) self.silent_button.setChecked(settings.audio.silent) if settings.google_contacts.authorization_token: self.google_contacts_action.setText(u'Disable Google Contacts') elif settings.goo... |
main_window.contact_editor.open_for_add(main_window.search_box.text(), preferred_group) | main_window.contact_editor_dialog.open_for_add(main_window.search_box.text(), preferred_group) | def _AH_AddContact(self): model = self.model() main_window = model.main_window selected_items = ((index.row(), model.data(index)) for index in self.selectionModel().selectedIndexes()) try: item = (item for row, item in sorted(selected_items) if type(item) in (Contact, ContactGroup)).next() preferred_group = item if typ... |
model.main_window.contact_editor.open_for_edit(item) | model.main_window.contact_editor_dialog.open_for_edit(item) | def _AH_EditItem(self): model = self.model() index = self.selectionModel().selectedIndexes()[0] item = model.data(index) if isinstance(item, ContactGroup): self.scrollTo(index) item.widget.edit() else: model.main_window.contact_editor.open_for_edit(item) |
model.main_window.contact_editor.open_for_edit(contact) | model.main_window.contact_editor_dialog.open_for_edit(contact) | def _AH_EditItem(self): model = self.model() contact = model.data(self.selectionModel().selectedIndexes()[0]) model.main_window.contact_editor.open_for_edit(contact) |
return Qt.ItemIsEnabled return Qt.ItemFlags(QAbstractListModel.flags(self, index) | Qt.ItemIsEditable) | return QAbstractListModel.flags(self, index) return QAbstractListModel.flags(self, index) | Qt.ItemIsEditable | def flags(self, index): if not index.isValid(): return Qt.ItemIsEnabled return Qt.ItemFlags(QAbstractListModel.flags(self, index) | Qt.ItemIsEditable) |
account_manager = AccountManager() notification_center = NotificationCenter() notification_center.add_observer(self, sender=notification.sender) notification_center.add_observer(self, sender=account_manager) | def _NH_SIPApplicationWillStart(self, notification): settings = SIPSimpleSettings() account_manager = AccountManager() notification_center = NotificationCenter() notification_center.add_observer(self, sender=notification.sender) notification_center.add_observer(self, sender=account_manager) self.silent_action.setChecke... | |
self.create_status_label.value = Status("Display name cannot be empty", color=red) | self.create_status_label.value = Status("Name cannot be empty", color=red) | def _SH_ValidityStatusChanged(self): red = '#cc0000' # validate the add panel if not self.display_name_editor.valid: self.add_status_label.value = Status("Display name cannot be empty", color=red) elif not self.sip_address_editor.valid: self.add_status_label.value = Status("SIP address should be specified as user@domai... |
selection_model = self.selectionModel() selected_indexes = selection_model.selectedIndexes() if digit is not None and digit in '0123456789ABCD self.model().data(selected_indexes[0]).send_dtmf(digit) | if digit is not None and digit in '0123456789ABCD for session in (s for s in self.model().sessions if s.active): session.send_dtmf(digit) | def keyPressEvent(self, event): digit = chr(event.key()) if event.key() < 256 else None selection_model = self.selectionModel() selected_indexes = selection_model.selectedIndexes() if digit is not None and digit in '0123456789ABCD#*' and selected_indexes: self.model().data(selected_indexes[0]).send_dtmf(digit) elif eve... |
last_group = model.contact_groups[-1] if last_group.widget.drop_indicator is self.BelowItem: | contact_groups = model.contact_groups if contact_groups and contact_groups[-1].widget.drop_indicator is self.BelowItem: | def paintEvent(self, event): super(ContactListView, self).paintEvent(event) if self.drop_indicator_index.isValid(): rect = self.visualRect(self.drop_indicator_index) painter = QPainter(self.viewport()) painter.setRenderHint(QPainter.Antialiasing, True) painter.setBrush(Qt.NoBrush) painter.setPen(QPen(QBrush(QColor('#dc... |
self.enable_call_buttons(len(selected_items)==1 and type(self.contact_model.data(selected_items[0])) is Contact) | self.enable_call_buttons(len(selected_items)==1 and isinstance(self.contact_model.data(selected_items[0]), Contact)) | def contact_list_selection_changed(self, selected, deselected): selected_items = self.contact_list.selectionModel().selectedIndexes() self.enable_call_buttons(len(selected_items)==1 and type(self.contact_model.data(selected_items[0])) is Contact) |
self.username_editor.regexp = re.compile('^\w(?<=[^0_])[\w.-]{1,65}(?<=[^_.-])$', re.IGNORECASE) | self.username_editor.regexp = re.compile('^\w(?<=[^0_])[\w.-]{3,30}(?<=[^_.-])$', re.IGNORECASE) | def __init__(self, parent=None): super(AddAccountDialog, self).__init__(parent) with Resources.directory: self.setupUi(self) self.background_frame.setStyleSheet("") self.button_group = QButtonGroup(self) self.button_group.setObjectName("button_group") self.button_group.addButton(self.add_account_button, self.panel_view... |
super(QLabel, self).__init__(parent) | super(IconSelector, self).__init__(parent) | def __init__(self, parent=None): super(QLabel, self).__init__(parent) self.setMinimumSize(36, 36) self.filename = None self.default_icon = None self.last_icon_directory = os.path.expanduser('~') |
sliders_knobs() | def glade_icons(): make_glade_icon("gxknob.png","gxbigknob") make_glade_icon("gxknob.png","gxsmallknob",scale=0.7) make_glade_icon("gxhslider.png") make_glade_icon("gxvslider.png") make_glade_icon("gxswitch.png") make_glade_icon("gxeqslider.png", scale=0.9) make_glade_icon("gxminislider.png", scale=0.8) make_glade_icon... | |
address = options["billing_address"] | address = options.get("billing_address", {}) | def add_address(self, options={}): """add address details to the request parameters""" address = options["billing_address"] self.hosted_customer.Title = address.get("salutation", "Mr./Ms.") self.hosted_customer.Address = address["address1"] + address.get("address2", "") self.hosted_customer.Suburb = address.get("city")... |
self.hosted_customer.Address = address["address1"] + address.get("address2", "") | self.hosted_customer.Address = address.get("address1", '') + address.get("address2", "") | def add_address(self, options={}): """add address details to the request parameters""" address = options["billing_address"] self.hosted_customer.Title = address.get("salutation", "Mr./Ms.") self.hosted_customer.Address = address["address1"] + address.get("address2", "") self.hosted_customer.Suburb = address.get("city")... |
options.get("invoice"), options.get("description")) is_response = getattr(pymt_response, "CCPaymentResponse", None) if not is_response: | options.get("invoice", 'test'), options.get("description", 'test')) if not pymt_response: | def purchase(self, money, credit_card, options={}): """Using Eway payment gateway , charge the given credit card for specified money""" if not self.validate_card(credit_card): raise InvalidCard("Invalid Card") self.add_creditcard(credit_card) self.add_address(options) customer_id = self.client.create_hosted_customer(s... |
response = getattr(pymt_response, "CCPaymentResponse") | def purchase(self, money, credit_card, options={}): """Using Eway payment gateway , charge the given credit card for specified money""" if not self.validate_card(credit_card): raise InvalidCard("Invalid Card") self.add_creditcard(credit_card) self.add_address(options) customer_id = self.client.create_hosted_customer(s... | |
response=response) return {"status": "SUCCESS", "response": response} | response=pymt_response) return {"status": "SUCCESS", "response": pymt_response} | def purchase(self, money, credit_card, options={}): """Using Eway payment gateway , charge the given credit card for specified money""" if not self.validate_card(credit_card): raise InvalidCard("Invalid Card") self.add_creditcard(credit_card) self.add_address(options) customer_id = self.client.create_hosted_customer(s... |
import ipdb ipdb.set_trace() | def request(self, url, data, headers={}): """Make POST request to the payment gateway with the data and return gateway RESPONSE_CODE, RESPONSE_REASON_CODE, RESPONSE_REASON_TEXT""" conn = urllib2.Request(url=url, data=data, headers=headers) try: open_conn = urllib2.urlopen(conn) response = open_conn.read() except urllib... | |
latex.append(view.convert(self.context.Title())) latex.append(r'(\href{%s}{%s})' % ( | latex.append(r'\begin{description}') title = view.convert(self.context.Title()) url = r'(\href{%s}{%s})' % ( | def __call__(self, context, view): super(LinkLatexConverter, self).__call__(context, view) latex = [] |
view.convert(self.context.remoteUrl))) latex.append(r'\newline') latex.append(r'%s' % view.convert(self.context.getRawDescription())) | view.convert(self.context.remoteUrl)) latex.append(r'\item[%s (%s)]{%s}' % ( title, url, view.convert(self.context.getRawDescription()))) latex.append(r'\end{description}') | def __call__(self, context, view): super(LinkLatexConverter, self).__call__(context, view) latex = [] |
description="", | description="" + \ ' (Maintainer %s)' % maintainer, | def read(*rnames): return open(os.path.join(os.path.dirname(__file__), *rnames)).read() |
author='Julian Infanger', author_email='info@4teamwork.ch', | author='%s, 4teamwork GmbH' % maintainer, author_email='mailto:info@4teamwork.ch', | def read(*rnames): return open(os.path.join(os.path.dirname(__file__), *rnames)).read() |
+ '\n' + read('CHANGES.txt') | def read(*rnames): return open(os.path.join(os.path.dirname(__file__), *rnames)).read() | |
'plonegov.pdflatex', | def read(*rnames): return open(os.path.join(os.path.dirname(__file__), *rnames)).read() | |
entry_points=""" [distutils.setup_keywords] paster_plugins = setuptools.dist:assert_string_list [egg_info.writers] paster_plugins.txt = setuptools.command.egg_info:write_arg """, paster_plugins = ["ZopeSkel"], | def read(*rnames): return open(os.path.join(os.path.dirname(__file__), *rnames)).read() | |
main_black() main_poly() | def main_black(): print 'making black page, you tool' axes([0,0,1,1], axisbg='k') savefig('black' + plot_format) | |
return ((m-mint)*a[mint] +(mint+1-m)*a[mint+1]) | return ((mint+1-m)*a[mint] +(m-mint)*a[mint+1]) | def stiffline(x, xa, a): m = stiffline_match(x, xa) mint = floor(m).astype(int) return ((m-mint)*a[mint] +(mint+1-m)*a[mint+1]) |
matcha= zeros_like(x.astype(int)) | matcha= zeros_like(x) | def stiffline_match(x, xa): matcha= zeros_like(x.astype(int)) for ii,xx in enumerate(x): indx = argmin((xa-xx)**2) if xx < xa[indx]: indx -= 1 matcha[ii] = indx+(xx-xa[indx])/(xa[indx+1]-xa[indx]) return matcha |
weight = 0.0 | def stiffline_wls(x, y, sigmay, xa, epsilon, a=None): d = 1 maxiter = 10000 tolerance = 1e-6 * epsilon matcha = stiffline_match(x, xa) # initialize na = len(xa) if a == None: a = zeros(na) + mean(y) iter = 0 dchi2 = 100 * tolerance chi2 = stiffline_chi2(x, y, sigmay, xa, a, epsilon) while (iter < maxiter) and (dchi2 > ... | |
weight = (mm - jj) / sigmay[ii]**2 | ww = jj + 1 - mm numerator += (y[ii] - (1.0 - ww) * a[j+1]) * ww / sigmay[ii]**2 denominator += ww**2 / sigmay[ii]**2 | def stiffline_wls(x, y, sigmay, xa, epsilon, a=None): d = 1 maxiter = 10000 tolerance = 1e-6 * epsilon matcha = stiffline_match(x, xa) # initialize na = len(xa) if a == None: a = zeros(na) + mean(y) iter = 0 dchi2 = 100 * tolerance chi2 = stiffline_chi2(x, y, sigmay, xa, a, epsilon) while (iter < maxiter) and (dchi2 > ... |
weight = (jj + 1 - mm) / sigmay[ii]**2 numerator += weight * y[ii] denominator += weight | ww = mm - jj numerator += (y[ii] - (1.0 - ww) * a[j-1]) * ww / sigmay[ii]**2 denominator += ww**2 / sigmay[ii]**2 | def stiffline_wls(x, y, sigmay, xa, epsilon, a=None): d = 1 maxiter = 10000 tolerance = 1e-6 * epsilon matcha = stiffline_match(x, xa) # initialize na = len(xa) if a == None: a = zeros(na) + mean(y) iter = 0 dchi2 = 100 * tolerance chi2 = stiffline_chi2(x, y, sigmay, xa, a, epsilon) while (iter < maxiter) and (dchi2 > ... |
return (a, ln_gaussian_1d(y[iout], yiout, sigmay[iout]**2)) | return (a.copy(), ln_gaussian_1d(y[iout], yiout, sigmay[iout]**2)) | def ln_loo_stiffline(x, y, sigmay, xa, epsilon, iout, a=None): I = (arange(len(x)) != iout) a = stiffline_wls(x[I], y[I], sigmay[I], xa, epsilon, a=a) yiout = stiffline(array([x[iout]]), xa, a) return (a, ln_gaussian_1d(y[iout], yiout, sigmay[iout]**2)) |
"v1.55-kambi4\n\n") | "v1.55-kambi5\n\n") | def writeHeader(self): bfile = sys.expandpath(Blender.Get('filename')) self.file.write("#VRML V2.0 utf8\n\n") self.file.write("# This file was authored with Blender " \ "(http://www.blender.org/)\n") self.file.write("# Blender version %s\n" % Blender.Get('version')) self.file.write("# Blender file %s\n" % sys.basename(... |
self.writeIndented("direction 0.0 -1.0 0.0\n") | self.writeIndented("direction 0.0 0.0 -1.0\n") | def writeSpotLight(self, object, lamp): # Note: location and orientation are handled by the # transform node above this object if self.world: ambi = self.world.getAmb() ambientIntensity = ((float(ambi[0] + ambi[1] + ambi[2]))/3)/2.5 else: ambi = 0 ambientIntensity = 0 |
def __init__(self, xpath, trim=None, split=None, regex=None): | def __init__(self, xpath, trim=None, split=None, regex=None, log=LoggerFactory().empty()): self.log = log | def __init__(self, xpath, trim=None, split=None, regex=None): self.xpath = xpath self.trim = trim self.split = split self.regex = regex |
class TargetPair: def __init__(self, source, proc): self.source = source self.proc = proc | def writeToFile(self, html, outfile): file = open(outfile, 'w') file.write(html) file.close() | |
def __init__(self, linkfmt, actionLinkfmt, procRecFile, spacechar, srcTe, procTe, actionResult): | def __init__(self, linkfmt, actionLinkfmt, procRecFile, spacechar, srcTe, procTe, actionResult, log=LoggerFactory().empty()): self.log = log | def __init__(self, linkfmt, actionLinkfmt, procRecFile, spacechar, srcTe, procTe, actionResult): self.linkfmt = linkfmt self.actionLinkfmt = actionLinkfmt self.procRecFile = procRecFile self.spacechar = spacechar self.downloader = HttpDownloader() self.srcTe = srcTe self.procTe = procTe self.actionResult = actionResult |
self.downloader = HttpDownloader() | def __init__(self, linkfmt, actionLinkfmt, procRecFile, spacechar, srcTe, procTe, actionResult): self.linkfmt = linkfmt self.actionLinkfmt = actionLinkfmt self.procRecFile = procRecFile self.spacechar = spacechar self.downloader = HttpDownloader() self.srcTe = srcTe self.procTe = procTe self.actionResult = actionResult | |
def process(self, feedUrl): feedXml = self.downloader.download(feedUrl) srcTargets = self.srcTe.getTargets(feedXml) procTargets = self.getProcTargets(srcTargets) return self.handleProcTargets(procTargets) def handleProcTargets(self, procTargets): targetStrings = [pt.getString('{0}') for pt in procTargets] pr... | self.downloader = HttpDownloader(log=log) def process(self, feedUrl): try: self.log.debug('processing feed') feedXml = self.downloader.download(feedUrl) srcTargets = self.srcTe.getTargets(feedXml) self.log.debug('source targets: %i' % len(srcTargets)) procTargets = self.getProcTargets(srcTargets) self.log.debug(... | def __init__(self, linkfmt, actionLinkfmt, procRecFile, spacechar, srcTe, procTe, actionResult): self.linkfmt = linkfmt self.actionLinkfmt = actionLinkfmt self.procRecFile = procRecFile self.spacechar = spacechar self.downloader = HttpDownloader() self.srcTe = srcTe self.procTe = procTe self.actionResult = actionResult |
for ts in targetStrings: if ts not in procRecord: actionUrl = self.actionLinkfmt % urllib.quote(ts) | for pt in procTargets: ts = pt.proc.getString('{0}') actionUrl = self.actionLinkfmt % urllib.quote(ts) try: | def handleProcTargets(self, procTargets): # get a list of formatted processed target strings targetStrings = [pt.getString('{0}') for pt in procTargets] # get a list of already processed targets procRecord = self.getprocRecord() handled = 0 for ts in targetStrings: # only process targets that haven't been processed ... |
self.appendProcRec(ts) | self.appendProcRec(pt.source) | def handleProcTargets(self, procTargets): # get a list of formatted processed target strings targetStrings = [pt.getString('{0}') for pt in procTargets] # get a list of already processed targets procRecord = self.getprocRecord() handled = 0 for ts in targetStrings: # only process targets that haven't been processed ... |
print 'Result: ' + result print "Error: Did not get expected result (%s)." % self.actionResult | self.log.warning('result: %s' % result) self.log.error('did not get expected result (%s).' % self.actionResult) except Exception, e: self.log.error('unable to download: %s' % e) | def handleProcTargets(self, procTargets): # get a list of formatted processed target strings targetStrings = [pt.getString('{0}') for pt in procTargets] # get a list of already processed targets procRecord = self.getprocRecord() handled = 0 for ts in targetStrings: # only process targets that haven't been processed ... |
def getProcTargets(self, srcTargets): | def getProcTargets(self, srcTargets): procRecord = self.getProcRecord() | def getProcTargets(self, srcTargets): procTargets = list() for source in srcTargets: feedUrl = source.getString(self.linkfmt, self.spacechar) # assume that each target will get us a link to an xml feed xml = self.downloader.download(feedUrl) # get some sub-targets as can be found in the xml subTargets = self.procTe.g... |
feedUrl = source.getString(self.linkfmt, self.spacechar) xml = self.downloader.download(feedUrl) subTargets = self.procTe.getTargets(xml) if len(subTargets) > 0: procTargets.append(subTargets[0]) | sourceUrl = source.getString(self.linkfmt, self.spacechar) if sourceUrl not in procRecord: xml = self.downloader.download(sourceUrl) subTargets = self.procTe.getTargets(xml) if len(subTargets) > 0: procTargets.append(TargetPair(sourceUrl, subTargets[0])) else: self.log.debug( 'ignoring already successful source... | def getProcTargets(self, srcTargets): procTargets = list() for source in srcTargets: feedUrl = source.getString(self.linkfmt, self.spacechar) # assume that each target will get us a link to an xml feed xml = self.downloader.download(feedUrl) # get some sub-targets as can be found in the xml subTargets = self.procTe.g... |
def getprocRecord(self): | def getProcRecord(self): | def getprocRecord(self): if os.path.exists(self.procRecFile): doc = libxml2.parseFile(self.procRecFile) nodes = doc.xpathEval('/procrec/target') return [node.content for node in nodes] else: return list() |
curslist = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] curs = "".join([chr(x) for x in curslist]) | def __init__(self, lsysargv, sysarg): | |
self.panimated = fl_create_animated_cursor(curs, 200) | self.create_other_cursors() | def __init__(self, lsysargv, sysarg): |
pbitmapcur = fl_create_bitmap_cursor(bm1_bits, bm2_bits, \ bm1_width, bm1_height, bm1_width / 2, bm1_height / 2) fl_set_cursor(FL_ObjWin(pobj), pbitmapcur) | fl_set_cursor(FL_ObjWin(pobj), self.pbitmapcur) | def setbitmapcursor_cb(self, pobj, data): fl_reset_cursor(FL_ObjWin(pobj)) # back to default pbitmapcur = fl_create_bitmap_cursor(bm1_bits, bm2_bits, \ bm1_width, bm1_height, bm1_width / 2, bm1_height / 2) fl_set_cursor(FL_ObjWin(pobj), pbitmapcur) fl_redraw_form(self.fd_cursor.cursor) |
del singdict | def convertlistsindict(self): #return 0 # organize key-value pairs in dict self.listdictsofelem = [] #* (len(self.listpairsofelem)/2) | |
if singdict: | if isinstance(singdict, dict): | def convertlistsindict(self): #return 0 # organize key-value pairs in dict self.listdictsofelem = [] #* (len(self.listpairsofelem)/2) |
self.gropnum += 1 | self.groupnum += 1 | def getgeneric_flgroupname(self): nameflgroup = "ptrgroup%s" % str(self.groupnum) while nameflgroup in self.nameflgrouplist: self.gropnum += 1 nameflgroup = "ptrgroup%s" % str(self.groupnum) self.nameflgrouplist.append(nameflgroup) return nameflgroup |
errcliargs("Cannot write <outfile>.py on disk.", 5) | errorcliargs("Cannot write <outfile>.py on disk.", 5) | def savepyfile(self): # save elements of func lists in .py file try: fdout = open(self.outfile, 'w') except IOError: errcliargs("Cannot write <outfile>.py on disk.", 5) else: try: for line in self.headertext: if not line: break fdout.write(line) for line in self.inittext: if not line: break fdout.write(line) for line i... |
errcliargs("Cannot write <outfile>.py on disk", 5) | errorcliargs("Cannot write <outfile>.py on disk", 5) | def savepyfile(self): # save elements of func lists in .py file try: fdout = open(self.outfile, 'w') except IOError: errcliargs("Cannot write <outfile>.py on disk.", 5) else: try: for line in self.headertext: if not line: break fdout.write(line) for line in self.inittext: if not line: break fdout.write(line) for line i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.