Wed, 09 Oct 2013 18:34:30 +0200
Continued to shorten the code lines to max. 79 characters.
--- a/Globals/__init__.py Tue Oct 08 19:52:11 2013 +0200 +++ b/Globals/__init__.py Wed Oct 09 18:34:30 2013 +0200 @@ -191,9 +191,9 @@ return QDir.toNativeSeparators(path) -################################################################################ +############################################################################### ## functions for searching a Python2 interpreter -################################################################################ +############################################################################### def findPython2Interpreters():
--- a/Graphics/PackageDiagramBuilder.py Tue Oct 08 19:52:11 2013 +0200 +++ b/Graphics/PackageDiagramBuilder.py Wed Oct 09 18:34:30 2013 +0200 @@ -82,7 +82,8 @@ moduleDict = {} modules = [] for ext in supportedExt: - modules.extend(glob.glob(Utilities.normjoinpath(self.package, ext))) + modules.extend(glob.glob( + Utilities.normjoinpath(self.package, ext))) tot = len(modules) try: prog = 0
--- a/Graphics/UMLDialog.py Tue Oct 08 19:52:11 2013 +0200 +++ b/Graphics/UMLDialog.py Wed Oct 09 18:34:30 2013 +0200 @@ -177,8 +177,8 @@ self, self.umlView, self.__project, path, **kwargs) elif diagramType == UMLDialog.ApplicationDiagram: from .ApplicationDiagramBuilder import ApplicationDiagramBuilder - return ApplicationDiagramBuilder(self, self.umlView, self.__project, - **kwargs) + return ApplicationDiagramBuilder( + self, self.umlView, self.__project, **kwargs) elif diagramType == UMLDialog.NoDiagram: return None else:
--- a/Snapshot/SnapshotFreehandGrabber.py Tue Oct 08 19:52:11 2013 +0200 +++ b/Snapshot/SnapshotFreehandGrabber.py Wed Oct 09 18:34:30 2013 +0200 @@ -121,7 +121,8 @@ # Draw outline around selection. # Important: the 1px-wide outline is *also* part of the # captured free-region - pen = QPen(handleColor, 1, Qt.SolidLine, Qt.SquareCap, Qt.BevelJoin) + pen = QPen(handleColor, 1, Qt.SolidLine, Qt.SquareCap, + Qt.BevelJoin) painter.setPen(pen) painter.drawPolygon(pol)
--- a/Tasks/Task.py Tue Oct 08 19:52:11 2013 +0200 +++ b/Tasks/Task.py Wed Oct 09 18:34:30 2013 +0200 @@ -111,13 +111,17 @@ boldFont.setBold(True) for col in range(5): if self.taskType == Task.TypeFixme: - self.setBackgroundColor(col, Preferences.getTasks("TasksFixmeColor")) + self.setBackgroundColor( + col, Preferences.getTasks("TasksFixmeColor")) elif self.taskType == Task.TypeWarning: - self.setBackgroundColor(col, Preferences.getTasks("TasksWarningColor")) + self.setBackgroundColor( + col, Preferences.getTasks("TasksWarningColor")) elif self.taskType == Task.TypeTodo: - self.setBackgroundColor(col, Preferences.getTasks("TasksTodoColor")) + self.setBackgroundColor( + col, Preferences.getTasks("TasksTodoColor")) else: - self.setBackgroundColor(col, Preferences.getTasks("TasksNoteColor")) + self.setBackgroundColor( + col, Preferences.getTasks("TasksNoteColor")) if self._isProjectTask: self.setFont(col, boldFont) @@ -222,7 +226,8 @@ def isProjectFileTask(self): """ - Public slot to get an indication, if this task is related to a project file. + Public slot to get an indication, if this task is related to a + project file. @return flag indicating a project file task (boolean) """
--- a/Tasks/TaskFilter.py Tue Oct 08 19:52:11 2013 +0200 +++ b/Tasks/TaskFilter.py Wed Oct 09 18:34:30 2013 +0200 @@ -26,7 +26,8 @@ self.filenameFilter = None self.typeFilter = Task.TypeNone # task type self.scopeFilter = None # global (False) or project (True) - self.statusFilter = None # uncompleted (False) or completed (True) + self.statusFilter = None # uncompleted (False) or + # completed (True) self.prioritiesFilter = None # list of priorities # [0 (high), 1 (normal), 2 (low)]
--- a/Tasks/TaskFilterConfigDialog.py Tue Oct 08 19:52:11 2013 +0200 +++ b/Tasks/TaskFilterConfigDialog.py Wed Oct 09 18:34:30 2013 +0200 @@ -55,7 +55,8 @@ self.typeCombo.setCurrentIndex(0) else: self.typeGroup.setChecked(True) - self.typeCombo.setCurrentIndex(self.typeCombo.findData(taskFilter.typeFilter)) + self.typeCombo.setCurrentIndex( + self.typeCombo.findData(taskFilter.typeFilter)) if taskFilter.scopeFilter is None: self.scopeGroup.setChecked(False) @@ -84,9 +85,12 @@ self.priorityLowCheckBox.setChecked(False) else: self.priorityGroup.setChecked(True) - self.priorityHighCheckBox.setChecked(0 in taskFilter.prioritiesFilter) - self.priorityNormalCheckBox.setChecked(1 in taskFilter.prioritiesFilter) - self.priorityLowCheckBox.setChecked(2 in taskFilter.prioritiesFilter) + self.priorityHighCheckBox.setChecked( + 0 in taskFilter.prioritiesFilter) + self.priorityNormalCheckBox.setChecked( + 1 in taskFilter.prioritiesFilter) + self.priorityLowCheckBox.setChecked( + 2 in taskFilter.prioritiesFilter) def configureTaskFilter(self, taskFilter): """
--- a/Tasks/TaskPropertiesDialog.py Tue Oct 08 19:52:11 2013 +0200 +++ b/Tasks/TaskPropertiesDialog.py Wed Oct 09 18:34:30 2013 +0200 @@ -38,8 +38,9 @@ if task is not None: self.summaryEdit.setText(task.summary) self.descriptionEdit.setText(task.description) - self.creationLabel.setText(time.strftime("%Y-%m-%d, %H:%M:%S", - time.localtime(task.created))) + self.creationLabel.setText( + time.strftime("%Y-%m-%d, %H:%M:%S", + time.localtime(task.created))) self.priorityCombo.setCurrentIndex(task.priority) self.projectCheckBox.setChecked(task._isProjectTask) self.completedCheckBox.setChecked(task.completed) @@ -63,8 +64,11 @@ Public method to retrieve the dialogs data. @return tuple of description, priority, completion flag, - project flag and long text (string, string, boolean, boolean, string) + project flag and long text (string, string, boolean, + boolean, string) """ - return (self.summaryEdit.text(), self.priorityCombo.currentIndex(), - self.completedCheckBox.isChecked(), self.projectCheckBox.isChecked(), + return (self.summaryEdit.text(), + self.priorityCombo.currentIndex(), + self.completedCheckBox.isChecked(), + self.projectCheckBox.isChecked(), self.descriptionEdit.toPlainText())
--- a/Tasks/TaskViewer.py Tue Oct 08 19:52:11 2013 +0200 +++ b/Tasks/TaskViewer.py Wed Oct 09 18:34:30 2013 +0200 @@ -15,8 +15,9 @@ import fnmatch from PyQt4.QtCore import pyqtSignal, Qt -from PyQt4.QtGui import QHeaderView, QLineEdit, QTreeWidget, QDialog, QInputDialog, \ - QApplication, QMenu, QAbstractItemView, QProgressDialog, QTreeWidgetItem +from PyQt4.QtGui import QHeaderView, QLineEdit, QTreeWidget, QDialog, \ + QInputDialog, QApplication, QMenu, QAbstractItemView, QProgressDialog, \ + QTreeWidgetItem from E5Gui.E5Application import e5App from E5Gui import E5MessageBox @@ -54,8 +55,10 @@ self.__headerItem = QTreeWidgetItem(["", "", self.trUtf8("Summary"), self.trUtf8("Filename"), self.trUtf8("Line"), ""]) - self.__headerItem.setIcon(0, UI.PixmapCache.getIcon("taskCompleted.png")) - self.__headerItem.setIcon(1, UI.PixmapCache.getIcon("taskPriority.png")) + self.__headerItem.setIcon( + 0, UI.PixmapCache.getIcon("taskCompleted.png")) + self.__headerItem.setIcon( + 1, UI.PixmapCache.getIcon("taskPriority.png")) self.setHeaderItem(self.__headerItem) self.header().setSortIndicator(2, Qt.AscendingOrder) @@ -86,54 +89,66 @@ self.__menu = QMenu(self) self.__menu.addAction(self.trUtf8("&New Task..."), self.__newTask) self.__menu.addSeparator() - self.projectTasksMenuItem = self.__menu.addMenu(self.__projectTasksMenu) - self.__menu.addSeparator() - self.gotoItem = self.__menu.addAction(self.trUtf8("&Go To"), self.__goToTask) + self.projectTasksMenuItem = self.__menu.addMenu( + self.__projectTasksMenu) self.__menu.addSeparator() - self.copyItem = self.__menu.addAction(self.trUtf8("&Copy"), self.__copyTask) - self.pasteItem = self.__menu.addAction(self.trUtf8("&Paste"), self.__pasteTask) - self.deleteItem = self.__menu.addAction(self.trUtf8("&Delete"), self.__deleteTask) + self.gotoItem = self.__menu.addAction( + self.trUtf8("&Go To"), self.__goToTask) self.__menu.addSeparator() - self.markCompletedItem = self.__menu.addAction(self.trUtf8("&Mark Completed"), - self.__markCompleted) - self.__menu.addAction(self.trUtf8("Delete Completed &Tasks"), - self.__deleteCompleted) + self.copyItem = self.__menu.addAction( + self.trUtf8("&Copy"), self.__copyTask) + self.pasteItem = self.__menu.addAction( + self.trUtf8("&Paste"), self.__pasteTask) + self.deleteItem = self.__menu.addAction( + self.trUtf8("&Delete"), self.__deleteTask) self.__menu.addSeparator() - self.__menu.addAction(self.trUtf8("P&roperties..."), self.__editTaskProperties) + self.markCompletedItem = self.__menu.addAction( + self.trUtf8("&Mark Completed"), self.__markCompleted) + self.__menu.addAction( + self.trUtf8("Delete Completed &Tasks"), self.__deleteCompleted) self.__menu.addSeparator() - self.__menuFilteredAct = self.__menu.addAction(self.trUtf8("&Filtered display")) + self.__menu.addAction( + self.trUtf8("P&roperties..."), self.__editTaskProperties) + self.__menu.addSeparator() + self.__menuFilteredAct = self.__menu.addAction( + self.trUtf8("&Filtered display")) self.__menuFilteredAct.setCheckable(True) self.__menuFilteredAct.setChecked(False) self.__menuFilteredAct.triggered[bool].connect(self.__activateFilter) - self.__menu.addAction(self.trUtf8("Filter c&onfiguration..."), - self.__configureFilter) + self.__menu.addAction( + self.trUtf8("Filter c&onfiguration..."), self.__configureFilter) self.__menu.addSeparator() - self.__menu.addAction(self.trUtf8("Resi&ze columns"), self.__resizeColumns) + self.__menu.addAction( + self.trUtf8("Resi&ze columns"), self.__resizeColumns) self.__menu.addSeparator() self.__menu.addAction(self.trUtf8("Configure..."), self.__configure) self.__backMenu = QMenu(self) self.__backMenu.addAction(self.trUtf8("&New Task..."), self.__newTask) self.__backMenu.addSeparator() - self.backProjectTasksMenuItem = self.__backMenu.addMenu(self.__projectTasksMenu) + self.backProjectTasksMenuItem = self.__backMenu.addMenu( + self.__projectTasksMenu) self.__backMenu.addSeparator() - self.backPasteItem = self.__backMenu.addAction(self.trUtf8("&Paste"), - self.__pasteTask) + self.backPasteItem = self.__backMenu.addAction( + self.trUtf8("&Paste"), self.__pasteTask) self.__backMenu.addSeparator() - self.__backMenu.addAction(self.trUtf8("Delete Completed &Tasks"), - self.__deleteCompleted) + self.__backMenu.addAction( + self.trUtf8("Delete Completed &Tasks"), self.__deleteCompleted) self.__backMenu.addSeparator() - self.__backMenuFilteredAct = \ - self.__backMenu.addAction(self.trUtf8("&Filtered display")) + self.__backMenuFilteredAct = self.__backMenu.addAction( + self.trUtf8("&Filtered display")) self.__backMenuFilteredAct.setCheckable(True) self.__backMenuFilteredAct.setChecked(False) - self.__backMenuFilteredAct.triggered[bool].connect(self.__activateFilter) - self.__backMenu.addAction(self.trUtf8("Filter c&onfiguration..."), - self.__configureFilter) + self.__backMenuFilteredAct.triggered[bool].connect( + self.__activateFilter) + self.__backMenu.addAction( + self.trUtf8("Filter c&onfiguration..."), self.__configureFilter) self.__backMenu.addSeparator() - self.__backMenu.addAction(self.trUtf8("Resi&ze columns"), self.__resizeColumns) + self.__backMenu.addAction( + self.trUtf8("Resi&ze columns"), self.__resizeColumns) self.__backMenu.addSeparator() - self.__backMenu.addAction(self.trUtf8("Configure..."), self.__configure) + self.__backMenu.addAction( + self.trUtf8("Configure..."), self.__configure) self.__activating = False @@ -275,7 +290,8 @@ """ self.addTask(summary, filename=filename, lineno=lineno, isProjectTask=( - self.project and self.project.isProjectSource(filename)), + self.project and + self.project.isProjectSource(filename)), taskType=taskType, description=description) def getProjectTasks(self): @@ -372,8 +388,8 @@ dlg = TaskPropertiesDialog(None, self, self.projectOpen) if dlg.exec_() == QDialog.Accepted: data = dlg.getData() - self.addTask(data[0], data[1], completed=data[2], isProjectTask=data[3], - description=data[4]) + self.addTask(data[0], data[1], completed=data[2], + isProjectTask=data[3], description=data[4]) def __markCompleted(self): """ @@ -460,8 +476,9 @@ if on and not self.taskFilter.hasActiveFilter(): res = E5MessageBox.yesNo(self, self.trUtf8("Activate task filter"), - self.trUtf8("""The task filter doesn't have any active filters.""" - """ Do you want to configure the filter settings?"""), + self.trUtf8( + """The task filter doesn't have any active filters.""" + """ Do you want to configure the filter settings?"""), yesDefault=True) if not res: on = False @@ -500,10 +517,12 @@ def __regenerateProjectTasks(self): """ - Private slot to handle the "Regenerated project tasks" context menu entry. + Private slot to handle the "Regenerated project tasks" context menu + entry. """ markers = { - Task.TypeWarning: Preferences.getTasks("TasksWarningMarkers").split(), + Task.TypeWarning: + Preferences.getTasks("TasksWarningMarkers").split(), Task.TypeNote: Preferences.getTasks("TasksNoteMarkers").split(), Task.TypeTodo: Preferences.getTasks("TasksTodoMarkers").split(), Task.TypeFixme: Preferences.getTasks("TasksFixmeMarkers").split(),
--- a/Templates/TemplateMultipleVariablesDialog.py Tue Oct 08 19:52:11 2013 +0200 +++ b/Templates/TemplateMultipleVariablesDialog.py Wed Oct 09 18:34:30 2013 +0200 @@ -8,8 +8,9 @@ """ from PyQt4.QtCore import QSize, Qt -from PyQt4.QtGui import QSizePolicy, QSpacerItem, QWidget, QHBoxLayout, QLineEdit, \ - QPushButton, QTextEdit, QDialog, QScrollArea, QFrame, QGridLayout, QVBoxLayout, QLabel +from PyQt4.QtGui import QSizePolicy, QSpacerItem, QWidget, QHBoxLayout, \ + QLineEdit, QPushButton, QTextEdit, QDialog, QScrollArea, QFrame, \ + QGridLayout, QVBoxLayout, QLabel class TemplateMultipleVariablesDialog(QDialog): @@ -26,7 +27,8 @@ super().__init__(parent) self.TemplateMultipleVariablesDialogLayout = QVBoxLayout(self) - self.TemplateMultipleVariablesDialogLayout.setContentsMargins(6, 6, 6, 6) + self.TemplateMultipleVariablesDialogLayout.setContentsMargins( + 6, 6, 6, 6) self.TemplateMultipleVariablesDialogLayout.setSpacing(6) self.TemplateMultipleVariablesDialogLayout.setObjectName( "TemplateMultipleVariablesDialogLayout") @@ -35,7 +37,8 @@ # generate the scrollarea self.variablesView = QScrollArea(self) self.variablesView.setObjectName("variablesView") - self.TemplateMultipleVariablesDialogLayout.addWidget(self.variablesView) + self.TemplateMultipleVariablesDialogLayout.addWidget( + self.variablesView) self.variablesView.setWidgetResizable(True) self.variablesView.setFrameStyle(QFrame.NoFrame) @@ -66,7 +69,8 @@ self.variablesEntries[var] = t row += 1 # add a spacer to make the entries aligned at the top - spacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) + spacer = QSpacerItem( + 20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) self.grid.addItem(spacer, row, 1) self.variablesEntries[variables[0]].setFocus() self.top.adjustSize() @@ -77,7 +81,8 @@ layout1.setSpacing(6) layout1.setObjectName("layout1") - spacer1 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) + spacer1 = QSpacerItem( + 40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) layout1.addItem(spacer1) self.okButton = QPushButton(self) @@ -89,7 +94,8 @@ self.cancelButton.setObjectName("cancelButton") layout1.addWidget(self.cancelButton) - spacer2 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) + spacer2 = QSpacerItem( + 40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) layout1.addItem(spacer2) self.TemplateMultipleVariablesDialogLayout.addLayout(layout1)
--- a/Templates/TemplatePropertiesDialog.py Tue Oct 08 19:52:11 2013 +0200 +++ b/Templates/TemplatePropertiesDialog.py Wed Oct 09 18:34:30 2013 +0200 @@ -106,33 +106,38 @@ E5MessageBox.information(self, self.trUtf8("Template Help"), self.trUtf8( - """<p>To use variables in a template, you just have to enclose""" - """ the variablename with $-characters. When you use the template,""" - """ you will then be asked for a value for this variable.</p>""" + """<p>To use variables in a template, you just have to""" + """ enclose the variablename with $-characters. When you""" + """ use the template, you will then be asked for a value""" + """ for this variable.</p>""" """<p>Example template: This is a $VAR$</p>""" - """<p>When you use this template you will be prompted for a value""" - """ for the variable $VAR$. Any occurrences of $VAR$ will then be""" - """ replaced with whatever you've entered.</p>""" - """<p>If you need a single $-character in a template, which is not""" - """ used to enclose a variable, type $$(two dollar characters)""" - """ instead. They will automatically be replaced with a single""" - """ $-character when you use the template.</p>""" - """<p>If you want a variables contents to be treated specially,""" - """ the variablename must be followed by a ':' and one formatting""" - """ specifier (e.g. $VAR:ml$). The supported specifiers are:""" + """<p>When you use this template you will be prompted for""" + """ a value for the variable $VAR$. Any occurrences of $VAR$""" + """ will then be replaced with whatever you've entered.</p>""" + """<p>If you need a single $-character in a template, which""" + """ is not used to enclose a variable, type $$(two dollar""" + """ characters) instead. They will automatically be replaced""" + """ with a single $-character when you use the template.</p>""" + """<p>If you want a variables contents to be treated""" + """ specially, the variablename must be followed by a ':'""" + """ and one formatting specifier (e.g. $VAR:ml$). The""" + """ supported specifiers are:""" """<table>""" """<tr><td>ml</td><td>Specifies a multiline formatting.""" - """ The first line of the variable contents is prefixed with the string""" - """ occurring before the variable on the same line of the template.""" - """ All other lines are prefixed by the same amount of whitespace""" - """ as the line containing the variable.""" + """ The first line of the variable contents is prefixed with""" + """ the string occurring before the variable on the same""" + """ line of the template. All other lines are prefixed by""" + """ the same amount of whitespace as the line containing""" + """ the variable.""" """</td></tr>""" """<tr><td>rl</td><td>Specifies a repeated line formatting.""" - """ Each line of the variable contents is prefixed with the string""" - """ occuring before the variable on the same line of the template.""" + """ Each line of the variable contents is prefixed with the""" + """ string occuring before the variable on the same line of""" + """ the template.""" """</td></tr>""" """</table></p>""" - """<p>The following predefined variables may be used in a template:""" + """<p>The following predefined variables may be used in a""" + """ template:""" """<table>""" """<tr><td>date</td>""" """<td>today's date in ISO format (YYYY-MM-DD)</td></tr>""" @@ -149,25 +154,29 @@ """<tr><td>file_name</td>""" """<td>the current file name (without directory)</td></tr>""" """<tr><td>base_name</td>""" - """<td>like <i>file_name</i>, but without extension</td></tr>""" + """<td>like <i>file_name</i>, but without extension""" + """</td></tr>""" """<tr><td>ext</td>""" """<td>the extension of the current file</td></tr>""" """<tr><td>cur_select</td>""" """<td>the currently selected text</td></tr>""" """<tr><td>insertion</td>""" - """<td>Sets insertion point for cursor after template is inserted.</td>""" + """<td>Sets insertion point for cursor after template is""" + """ inserted.</td>""" """</tr>""" """<tr><td>select_start</td>""" - """<td>Sets span of selected text in template after template is """ - """inserted (used together with 'select_end').</td></tr>""" + """<td>Sets span of selected text in template after template""" + """ is inserted (used together with 'select_end').</td></tr>""" """<tr><td>select_end</td>""" - """<td>Sets span of selected text in template after template is """ - """inserted (used together with 'select_start').</td></tr>""" + """<td>Sets span of selected text in template after template""" + """ is inserted (used together with 'select_start').""" + """</td></tr>""" """<tr><td>clipboard</td>""" """<td>the text of the clipboard</td></tr>""" """</table></p>""" - """<p>If you want to change the default delimiter to anything""" - """ different, please use the configuration dialog to do so.</p>""")) + """<p>If you want to change the default delimiter to""" + """ anything different, please use the configuration""" + """ dialog to do so.</p>""")) def setSelectedGroup(self, name): """ @@ -182,9 +191,9 @@ """ Public method to get the data entered into the dialog. - @return a tuple of two strings (name, language), if the dialog is in group mode, - and a tuple of four strings (name, description, group name, template) - otherwise. + @return a tuple of two strings (name, language), if the dialog is in + group mode, and a tuple of four strings (name, description, group + name, template) otherwise. """ if self.groupMode: return (self.nameEdit.text(),
--- a/Templates/TemplateViewer.py Tue Oct 08 19:52:11 2013 +0200 +++ b/Templates/TemplateViewer.py Wed Oct 09 18:34:30 2013 +0200 @@ -12,7 +12,8 @@ import re from PyQt4.QtCore import QFile, QFileInfo, QIODevice, Qt -from PyQt4.QtGui import QTreeWidget, QDialog, QApplication, QMenu, QTreeWidgetItem +from PyQt4.QtGui import QTreeWidget, QDialog, QApplication, QMenu, \ + QTreeWidgetItem from E5Gui.E5Application import e5App from E5Gui import E5MessageBox, E5FileDialog @@ -92,15 +93,17 @@ if not quiet: E5MessageBox.critical(None, QApplication.translate("TemplateGroup", "Add Template"), - QApplication.translate("TemplateGroup", - """<p>The group <b>{0}</b> already contains a""" - """ template named <b>{1}</b>.</p>""")\ + QApplication.translate( + "TemplateGroup", + """<p>The group <b>{0}</b> already contains a""" + """ template named <b>{1}</b>.</p>""") .format(self.name, name)) return self.entries[name] = TemplateEntry(self, name, description, template) - if Preferences.getTemplates("AutoOpenGroups") and not self.isExpanded(): + if Preferences.getTemplates("AutoOpenGroups") and \ + not self.isExpanded(): self.setExpanded(True) def removeEntry(self, name): @@ -115,7 +118,8 @@ del self.entries[name] if len(self.entries) == 0: - if Preferences.getTemplates("AutoOpenGroups") and self.isExpanded(): + if Preferences.getTemplates("AutoOpenGroups") and \ + self.isExpanded(): self.setExpanded(False) def removeAllEntries(self): @@ -148,8 +152,8 @@ def getEntryNames(self, beginning): """ - Public method to get the names of all entries, who's name starts with the - given string. + Public method to get the names of all entries, who's name starts with + the given string. @param beginning string denoting the beginning of the template name (string) @@ -315,7 +319,8 @@ prefix = line[:ind] postfix = line[ind + len(var):] for v in val.splitlines(): - t = "{0}{1}{2}{3}{4}".format(t, os.linesep, prefix, v, postfix) + t = "{0}{1}{2}{3}{4}".format( + t, os.linesep, prefix, v, postfix) elif format == 'ml': indent = line.replace(line.lstrip(), "") prefix = line[:ind] @@ -348,8 +353,9 @@ """ sepchar = Preferences.getTemplates("SeparatorChar") variablesPattern = \ - re.compile(r"""\{0}[a-zA-Z][a-zA-Z0-9_]*(?::(?:ml|rl))?\{1}""".format( - sepchar, sepchar)) + re.compile( + r"""\{0}[a-zA-Z][a-zA-Z0-9_]*(?::(?:ml|rl))?\{1}""".format( + sepchar, sepchar)) variables = variablesPattern.findall(self.template) self.variables = [] self.formatedVariables = [] @@ -383,8 +389,8 @@ self.setAlternatingRowColors(True) self.__menu = QMenu(self) - self.applyAct = \ - self.__menu.addAction(self.trUtf8("Apply"), self.__templateItemActivated) + self.applyAct = self.__menu.addAction( + self.trUtf8("Apply"), self.__templateItemActivated) self.__menu.addSeparator() self.__menu.addAction(self.trUtf8("Add entry..."), self.__addEntry) self.__menu.addAction(self.trUtf8("Add group..."), self.__addGroup) @@ -396,7 +402,8 @@ self.__menu.addAction(self.trUtf8("Export..."), self.__export) self.__menu.addAction(self.trUtf8("Reload"), self.__reload) self.__menu.addSeparator() - self.__menu.addAction(self.trUtf8("Help about Templates..."), self.__showHelp) + self.__menu.addAction( + self.trUtf8("Help about Templates..."), self.__showHelp) self.__menu.addSeparator() self.__menu.addAction(self.trUtf8("Configure..."), self.__configure) @@ -408,9 +415,11 @@ self.__backMenu.addAction(self.trUtf8("Export..."), self.__export) self.__backMenu.addAction(self.trUtf8("Reload"), self.__reload) self.__backMenu.addSeparator() - self.__backMenu.addAction(self.trUtf8("Help about Templates..."), self.__showHelp) + self.__backMenu.addAction( + self.trUtf8("Help about Templates..."), self.__showHelp) self.__backMenu.addSeparator() - self.__backMenu.addAction(self.trUtf8("Configure..."), self.__configure) + self.__backMenu.addAction( + self.trUtf8("Configure..."), self.__configure) self.__activating = False self.__dirty = False @@ -452,7 +461,8 @@ if itm is None: self.__backMenu.popup(coord) else: - self.applyAct.setEnabled(self.viewmanager.activeWindow() is not None) + self.applyAct.setEnabled( + self.viewmanager.activeWindow() is not None) self.__menu.popup(coord) def __addEntry(self): @@ -573,8 +583,9 @@ if self.__dirty: res = E5MessageBox.yesNo(self, self.trUtf8("Reload Templates"), - self.trUtf8("""The templates contain unsaved changes. Shall these""" - """ changes be discarded?"""), + self.trUtf8( + """The templates contain unsaved changes. Shall these""" + """ changes be discarded?"""), icon=E5MessageBox.Warning) if not res: return @@ -590,15 +601,16 @@ """ E5MessageBox.information(self, self.trUtf8("Template Help"), - self.trUtf8("""<p><b>Template groups</b> are a means of grouping individual""" - """ templates. Groups have an attribute that specifies,""" - """ which programming language they apply for.""" - """ In order to add template entries, at least one group""" - """ has to be defined.</p>""" - """<p><b>Template entries</b> are the actual templates.""" - """ They are grouped by the template groups. Help about""" - """ how to define them is available in the template edit""" - """ dialog.</p>""")) + self.trUtf8( + """<p><b>Template groups</b> are a means of grouping""" + """ individual templates. Groups have an attribute that""" + """ specifies, which programming language they apply for.""" + """ In order to add template entries, at least one group""" + """ has to be defined.</p>""" + """<p><b>Template entries</b> are the actual templates.""" + """ They are grouped by the template groups. Help about""" + """ how to define them is available in the template edit""" + """ dialog.</p>""")) def __getPredefinedVars(self): """ @@ -634,8 +646,10 @@ keyfmt.format('ext'): ext }) - varValues[keyfmt.format('clipboard:ml')] = QApplication.clipboard().text() - varValues[keyfmt.format('clipboard')] = QApplication.clipboard().text() + varValues[keyfmt.format('clipboard:ml')] = \ + QApplication.clipboard().text() + varValues[keyfmt.format('clipboard')] = \ + QApplication.clipboard().text() if editor.hasSelectedText(): varValues[keyfmt.format('cur_select:ml')] = editor.selectedText() @@ -680,7 +694,8 @@ varValues.update(dlg.getVariables()) ok = True else: - from .TemplateSingleVariableDialog import TemplateSingleVariableDialog + from .TemplateSingleVariableDialog import \ + TemplateSingleVariableDialog for var in vars: dlg = TemplateSingleVariableDialog(var, self) if dlg.exec_() == QDialog.Accepted: @@ -712,7 +727,8 @@ count += len(indent) if "i_n_s_e_r_t_i_o_n" in txt and "s_e_l_e_c_t" in txt: - txt = "'Insertion and selection can not be in template together'" + txt = "'Insertion and selection can not be in" \ + " template together'" if "i_n_s_e_r_t_i_o_n" in txt: lines = 1 @@ -752,7 +768,8 @@ editor.insert(txt) if setselect: - editor.setSelection(line + linea - 1, posa, line + lineb - 1, posb) + editor.setSelection(line + linea - 1, posa, + line + lineb - 1, posb) else: editor.setCursorPosition(line + lines - 1, count) @@ -791,7 +808,8 @@ @param template template text of the entry (string) @param quiet flag indicating quiet operation (boolean) """ - self.groups[groupName].addEntry(name, description, template, quiet=quiet) + self.groups[groupName].addEntry( + name, description, template, quiet=quiet) self.__resort() def hasGroup(self, name): @@ -912,13 +930,16 @@ @return flag indicating success (boolean) """ if filename is None: - filename = os.path.join(Utilities.getConfigDir(), "eric5templates.e4c") + filename = os.path.join( + Utilities.getConfigDir(), "eric5templates.e4c") f = QFile(filename) ok = f.open(QIODevice.WriteOnly) if not ok: E5MessageBox.critical(self, self.trUtf8("Save templates"), - self.trUtf8("<p>The templates file <b>{0}</b> could not be written.</p>") + self.trUtf8( + "<p>The templates file <b>{0}</b> could not be" + " written.</p>") .format(filename)) return False @@ -935,7 +956,8 @@ @param filename name of a templates file to read (string) """ if filename is None: - filename = os.path.join(Utilities.getConfigDir(), "eric5templates.e4c") + filename = os.path.join( + Utilities.getConfigDir(), "eric5templates.e4c") if not os.path.exists(filename): return @@ -948,7 +970,8 @@ else: E5MessageBox.critical(self, self.trUtf8("Read templates"), - self.trUtf8("<p>The templates file <b>{0}</b> could not be read.</p>") + self.trUtf8( + "<p>The templates file <b>{0}</b> could not be read.</p>") .format(filename)) def __configure(self): @@ -981,7 +1004,8 @@ def getTemplateNames(self, start, groupName=None): """ - Public method to get the names of templates starting with the given string. + Public method to get the names of templates starting with the + given string. @param start start string of the name (string) @param groupName name of the group to get the entry from (string).
--- a/Tools/TRPreviewer.py Tue Oct 08 19:52:11 2013 +0200 +++ b/Tools/TRPreviewer.py Wed Oct 09 18:34:30 2013 +0200 @@ -11,8 +11,9 @@ from PyQt4.QtCore import QDir, QTimer, QFileInfo, pyqtSignal, QEvent, QSize, \ QTranslator, QObject, Qt -from PyQt4.QtGui import QSizePolicy, QSpacerItem, QWidget, QHBoxLayout, QKeySequence, \ - QWhatsThis, QMdiArea, qApp, QApplication, QComboBox, QVBoxLayout, QAction, QLabel +from PyQt4.QtGui import QSizePolicy, QSpacerItem, QWidget, QHBoxLayout, \ + QKeySequence, QWhatsThis, QMdiArea, qApp, QApplication, QComboBox, \ + QVBoxLayout, QAction, QLabel from PyQt4 import uic from E5Gui import E5MessageBox, E5FileDialog @@ -48,7 +49,8 @@ else: self.setObjectName(name) - self.setStyle(Preferences.getUI("Style"), Preferences.getUI("StyleSheet")) + self.setStyle(Preferences.getUI("Style"), + Preferences.getUI("StyleSheet")) self.resize(QSize(800, 600).expandedTo(self.minimumSizeHint())) self.setAttribute(Qt.WA_DeleteOnClose) @@ -70,7 +72,8 @@ self.languageLayout.setSpacing(6) self.languageLayout.setObjectName("languageLayout") - self.languageLabel = QLabel(self.trUtf8("Select language file"), self.cw) + self.languageLabel = QLabel( + self.trUtf8("Select language file"), self.cw) self.languageLabel.setObjectName("languageLabel") self.languageLayout.addWidget(self.languageLabel) @@ -78,10 +81,12 @@ self.languageCombo.setObjectName("languageCombo") self.languageCombo.setEditable(False) self.languageCombo.setToolTip(self.trUtf8("Select language file")) - self.languageCombo.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) + self.languageCombo.setSizePolicy( + QSizePolicy.Expanding, QSizePolicy.Preferred) self.languageLayout.addWidget(self.languageCombo) - languageSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) + languageSpacer = QSpacerItem( + 40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.languageLayout.addItem(languageSpacer) self.TRPreviewerLayout.addLayout(self.languageLayout) @@ -95,7 +100,8 @@ self.languageCombo.activated[str].connect(self.setTranslation) self.translations = TranslationsDict(self.languageCombo, self) - self.translations.translationChanged.connect(self.preview.rebuildWidgets) + self.translations.translationChanged.connect( + self.preview.rebuildWidgets) self.__initActions() self.__initMenus() @@ -160,7 +166,8 @@ self.openQMAct = QAction(UI.PixmapCache.getIcon("openQM.png"), self.trUtf8('Open &Translation Files...'), self) - self.openQMAct.setStatusTip(self.trUtf8('Open Translation files for display')) + self.openQMAct.setStatusTip(self.trUtf8( + 'Open Translation files for display')) self.openQMAct.setWhatsThis(self.trUtf8( """<b>Open Translation Files</b>""" """<p>This opens some translation files for display.</p>""" @@ -169,16 +176,19 @@ self.reloadAct = QAction(UI.PixmapCache.getIcon("reload.png"), self.trUtf8('&Reload Translations'), self) - self.reloadAct.setStatusTip(self.trUtf8('Reload the loaded translations')) + self.reloadAct.setStatusTip(self.trUtf8( + 'Reload the loaded translations')) self.reloadAct.setWhatsThis(self.trUtf8( - """<b>Reload Translations</b>""" - """<p>This reloads the translations for the loaded languages.</p>""" + """<b>Reload Translations</b>""" + """<p>This reloads the translations for the loaded""" + """ languages.</p>""" )) self.reloadAct.triggered[()].connect(self.translations.reload) self.exitAct = QAction(UI.PixmapCache.getIcon("exit.png"), self.trUtf8('&Quit'), self) - self.exitAct.setShortcut(QKeySequence(self.trUtf8("Ctrl+Q", "File|Quit"))) + self.exitAct.setShortcut(QKeySequence( + self.trUtf8("Ctrl+Q", "File|Quit"))) self.exitAct.setStatusTip(self.trUtf8('Quit the application')) self.exitAct.setWhatsThis(self.trUtf8( """<b>Quit</b>""" @@ -191,17 +201,18 @@ self.whatsThisAct.setShortcut(QKeySequence(self.trUtf8("Shift+F1"))) self.whatsThisAct.setStatusTip(self.trUtf8('Context sensitive help')) self.whatsThisAct.setWhatsThis(self.trUtf8( - """<b>Display context sensitive help</b>""" - """<p>In What's This? mode, the mouse cursor shows an arrow with a""" - """ question mark, and you can click on the interface elements to get""" - """ a short description of what they do and how to use them. In""" - """ dialogs, this feature can be accessed using the context help""" - """ button in the titlebar.</p>""" + """<b>Display context sensitive help</b>""" + """<p>In What's This? mode, the mouse cursor shows an arrow""" + """ with a question mark, and you can click on the interface""" + """ elements to get a short description of what they do and""" + """ how to use them. In dialogs, this feature can be accessed""" + """ using the context help button in the titlebar.</p>""" )) self.whatsThisAct.triggered[()].connect(self.__whatsThis) self.aboutAct = QAction(self.trUtf8('&About'), self) - self.aboutAct.setStatusTip(self.trUtf8('Display information about this software')) + self.aboutAct.setStatusTip(self.trUtf8( + 'Display information about this software')) self.aboutAct.setWhatsThis(self.trUtf8( """<b>About</b>""" """<p>Display some information about this software.</p>""" @@ -220,22 +231,25 @@ self.tileAct = QAction(self.trUtf8('&Tile'), self) self.tileAct.setStatusTip(self.trUtf8('Tile the windows')) self.tileAct.setWhatsThis(self.trUtf8( - """<b>Tile the windows</b>""" - """<p>Rearrange and resize the windows so that they are tiled.</p>""" + """<b>Tile the windows</b>""" + """<p>Rearrange and resize the windows so that they are""" + """ tiled.</p>""" )) self.tileAct.triggered[()].connect(self.preview.tileSubWindows) self.cascadeAct = QAction(self.trUtf8('&Cascade'), self) self.cascadeAct.setStatusTip(self.trUtf8('Cascade the windows')) self.cascadeAct.setWhatsThis(self.trUtf8( - """<b>Cascade the windows</b>""" - """<p>Rearrange and resize the windows so that they are cascaded.</p>""" + """<b>Cascade the windows</b>""" + """<p>Rearrange and resize the windows so that they are""" + """ cascaded.</p>""" )) self.cascadeAct.triggered[()].connect(self.preview.cascadeSubWindows) self.closeAct = QAction(UI.PixmapCache.getIcon("close.png"), self.trUtf8('&Close'), self) - self.closeAct.setShortcut(QKeySequence(self.trUtf8("Ctrl+W", "File|Close"))) + self.closeAct.setShortcut(QKeySequence(self.trUtf8( + "Ctrl+W", "File|Close"))) self.closeAct.setStatusTip(self.trUtf8('Close the current window')) self.closeAct.setWhatsThis(self.trUtf8( """<b>Close Window</b>""" @@ -332,8 +346,9 @@ """ E5MessageBox.about(self, self.trUtf8("TR Previewer"), self.trUtf8( """<h3> About TR Previewer </h3>""" - """<p>The TR Previewer loads and displays Qt User-Interface files""" - """ and translation files and shows dialogs for a selected language.</p>""" + """<p>The TR Previewer loads and displays Qt User-Interface""" + """ files and translation files and shows dialogs for a""" + """ selected language.</p>""" )) def __aboutQt(self): @@ -444,8 +459,8 @@ be loaded automatically. @param fileName name of the translation file to be added (string) - @param setTranslation flag indicating, if this should be set as the active - translation (boolean) + @param setTranslation flag indicating, if this should be set as + the active translation (boolean) """ if not self.__haveFileName(fileName): ntr = Translation() @@ -482,7 +497,8 @@ if trans is None: E5MessageBox.warning(self.parent(), self.trUtf8("Set Translator"), - self.trUtf8("""<p>The translator <b>{0}</b> is not known.</p>""")\ + self.trUtf8( + """<p>The translator <b>{0}</b> is not known.</p>""")\ .format(name)) return @@ -592,7 +608,8 @@ def __del(self, name): """ - Private method to delete a translator from the list of available translators. + Private method to delete a translator from the list of available + translators. @param name name of the translator to delete (string) """ @@ -695,7 +712,8 @@ if not self.__widget: E5MessageBox.warning(self, self.trUtf8("Load UI File"), - self.trUtf8("""<p>The file <b>{0}</b> could not be loaded.</p>""")\ + self.trUtf8( + """<p>The file <b>{0}</b> could not be loaded.</p>""")\ .format(self.__uiFileName)) self.__valid = False return @@ -749,7 +767,8 @@ if not name: E5MessageBox.warning(self, self.trUtf8("Load UI File"), - self.trUtf8("""<p>The file <b>{0}</b> could not be loaded.</p>""")\ + self.trUtf8( + """<p>The file <b>{0}</b> could not be loaded.</p>""")\ .format(uiFileName)) return
--- a/Tools/TRSingleApplication.py Tue Oct 08 19:52:11 2013 +0200 +++ b/Tools/TRSingleApplication.py Wed Oct 09 18:34:30 2013 +0200 @@ -11,7 +11,8 @@ from PyQt4.QtCore import pyqtSignal -from Toolbox.SingleApplication import SingleApplicationClient, SingleApplicationServer +from Toolbox.SingleApplication import SingleApplicationClient, \ + SingleApplicationServer ########################################################################### # define some module global stuff @@ -73,7 +74,8 @@ """ Private method used to handle the "Load Translation" command. - @param fnames filenames of the translations to be loaded (list of strings) + @param fnames filenames of the translations to be loaded + (list of strings) """ first = True for fname in fnames: @@ -83,7 +85,8 @@ class TRSingleApplicationClient(SingleApplicationClient): """ - Class implementing the single application client of the Translations Previewer. + Class implementing the single application client of the Translations + Previewer. """ def __init__(self): """
--- a/Tools/TrayStarter.py Tue Oct 08 19:52:11 2013 +0200 +++ b/Tools/TrayStarter.py Wed Oct 09 18:34:30 2013 +0200 @@ -11,7 +11,8 @@ import os from PyQt4.QtCore import QProcess, QSettings, QFileInfo -from PyQt4.QtGui import QSystemTrayIcon, QMenu, qApp, QCursor, QApplication, QDialog +from PyQt4.QtGui import QSystemTrayIcon, QMenu, qApp, QCursor, \ + QApplication, QDialog from E5Gui import E5MessageBox @@ -33,7 +34,8 @@ Constructor """ super().__init__( - UI.PixmapCache.getIcon(Preferences.getTrayStarter("TrayStarterIcon"))) + UI.PixmapCache.getIcon( + Preferences.getTrayStarter("TrayStarterIcon"))) self.maxMenuFilePathLen = 75 @@ -53,8 +55,10 @@ self.__menu = QMenu(self.trUtf8("Eric5 tray starter")) - self.recentProjectsMenu = QMenu(self.trUtf8('Recent Projects'), self.__menu) - self.recentProjectsMenu.aboutToShow.connect(self.__showRecentProjectsMenu) + self.recentProjectsMenu = QMenu( + self.trUtf8('Recent Projects'), self.__menu) + self.recentProjectsMenu.aboutToShow.connect( + self.__showRecentProjectsMenu) self.recentProjectsMenu.triggered.connect(self.__openRecent) self.recentMultiProjectsMenu = \ @@ -74,8 +78,10 @@ act.setFont(font) self.__menu.addSeparator() - self.__menu.addAction(self.trUtf8("QRegExp editor"), self.__startQRegExp) - self.__menu.addAction(self.trUtf8("Python re editor"), self.__startPyRe) + self.__menu.addAction( + self.trUtf8("QRegExp editor"), self.__startQRegExp) + self.__menu.addAction( + self.trUtf8("Python re editor"), self.__startPyRe) self.__menu.addSeparator() self.__menu.addAction(UI.PixmapCache.getIcon("uiPreviewer.png"), @@ -130,7 +136,8 @@ self.menuRecentMultiProjectsAct = \ self.__menu.addMenu(self.recentMultiProjectsMenu) # recent projects - self.menuRecentProjectsAct = self.__menu.addMenu(self.recentProjectsMenu) + self.menuRecentProjectsAct = self.__menu.addMenu( + self.recentProjectsMenu) self.__menu.addSeparator() self.__menu.addAction(UI.PixmapCache.getIcon("exit.png"), @@ -170,7 +177,8 @@ """ Private slot to handle the activated signal. - @param reason reason code of the signal (QSystemTrayIcon.ActivationReason) + @param reason reason code of the signal + (QSystemTrayIcon.ActivationReason) """ if reason == QSystemTrayIcon.Context or \ reason == QSystemTrayIcon.MiddleClick: @@ -183,7 +191,8 @@ Private slot to show the context menu. """ self.menuRecentProjectsAct.setEnabled(len(self.recentProjects) > 0) - self.menuRecentMultiProjectsAct.setEnabled(len(self.recentMultiProjects) > 0) + self.menuRecentMultiProjectsAct.setEnabled( + len(self.recentMultiProjects) > 0) self.menuRecentFilesAct.setEnabled(len(self.recentFiles) > 0) pos = QCursor.pos() @@ -208,7 +217,8 @@ for arg in applArgs: args.append(arg) - if not os.path.isfile(applPath) or not proc.startDetached(sys.executable, args): + if not os.path.isfile(applPath) or \ + not proc.startDetached(sys.executable, args): E5MessageBox.critical(self, self.trUtf8('Process Generation Error'), self.trUtf8( @@ -404,8 +414,8 @@ def __openRecent(self, act): """ - Private method to open a project or file from the list of rencently opened - projects or files. + Private method to open a project or file from the list of recently + opened projects or files. @param act reference to the action that triggered (QAction) """ @@ -418,9 +428,9 @@ Private slot to set the preferences. """ from Preferences.ConfigurationDialog import ConfigurationDialog - dlg = ConfigurationDialog(None, 'Configuration', True, - fromEric=True, - displayMode=ConfigurationDialog.TrayStarterMode) + dlg = ConfigurationDialog( + None, 'Configuration', True, fromEric=True, + displayMode=ConfigurationDialog.TrayStarterMode) dlg.preferencesChanged.connect(self.preferencesChanged) dlg.show() dlg.showConfigurationPageByName("trayStarterPage") @@ -436,7 +446,8 @@ Public slot to handle a change of preferences. """ self.setIcon( - UI.PixmapCache.getIcon(Preferences.getTrayStarter("TrayStarterIcon"))) + UI.PixmapCache.getIcon( + Preferences.getTrayStarter("TrayStarterIcon"))) def __about(self): """
--- a/Tools/UIPreviewer.py Tue Oct 08 19:52:11 2013 +0200 +++ b/Tools/UIPreviewer.py Wed Oct 09 18:34:30 2013 +0200 @@ -8,10 +8,11 @@ """ from PyQt4.QtCore import qVersion, QDir, QFileInfo, QEvent, QSize, Qt -from PyQt4.QtGui import QSizePolicy, QSpacerItem, QWidget, QHBoxLayout, QCursor, \ - QPrinter, QKeySequence, QPrintDialog, QWhatsThis, QPixmap, QImageWriter, QPainter, \ - QDialog, QScrollArea, qApp, QApplication, QStyleFactory, QFrame, QMainWindow, \ - QComboBox, QVBoxLayout, QAction, QLabel +from PyQt4.QtGui import QSizePolicy, QSpacerItem, QWidget, QHBoxLayout, \ + QCursor, QPrinter, QKeySequence, QPrintDialog, QWhatsThis, QPixmap, \ + QImageWriter, QPainter, QDialog, QScrollArea, qApp, QApplication, \ + QStyleFactory, QFrame, QMainWindow, QComboBox, QVBoxLayout, QAction, \ + QLabel from PyQt4 import uic from E5Gui import E5MessageBox, E5FileDialog @@ -43,7 +44,8 @@ else: self.setObjectName(name) - self.setStyle(Preferences.getUI("Style"), Preferences.getUI("StyleSheet")) + self.setStyle(Preferences.getUI("Style"), + Preferences.getUI("StyleSheet")) self.resize(QSize(600, 480).expandedTo(self.minimumSizeHint())) self.setAttribute(Qt.WA_DeleteOnClose) @@ -79,7 +81,8 @@ if currentStyle is not None: self.styleCombo.setCurrentIndex(int(currentStyle)) - styleSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) + styleSpacer = QSpacerItem( + 40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.styleLayout.addItem(styleSpacer) self.UIPreviewerLayout.addLayout(self.styleLayout) @@ -87,7 +90,8 @@ self.previewSV.setObjectName("preview") self.previewSV.setFrameShape(QFrame.NoFrame) self.previewSV.setFrameShadow(QFrame.Plain) - self.previewSV.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) + self.previewSV.setSizePolicy( + QSizePolicy.Expanding, QSizePolicy.Expanding) self.UIPreviewerLayout.addWidget(self.previewSV) self.setCentralWidget(self.cw) @@ -122,7 +126,8 @@ """ self.openAct = QAction(UI.PixmapCache.getIcon("openUI.png"), self.trUtf8('&Open File'), self) - self.openAct.setShortcut(QKeySequence(self.trUtf8("Ctrl+O", "File|Open"))) + self.openAct.setShortcut( + QKeySequence(self.trUtf8("Ctrl+O", "File|Open"))) self.openAct.setStatusTip(self.trUtf8('Open a UI file for display')) self.openAct.setWhatsThis(self.trUtf8( """<b>Open File</b>""" @@ -132,7 +137,8 @@ self.printAct = QAction(UI.PixmapCache.getIcon("print.png"), self.trUtf8('&Print'), self) - self.printAct.setShortcut(QKeySequence(self.trUtf8("Ctrl+P", "File|Print"))) + self.printAct.setShortcut( + QKeySequence(self.trUtf8("Ctrl+P", "File|Print"))) self.printAct.setStatusTip(self.trUtf8('Print a screen capture')) self.printAct.setWhatsThis(self.trUtf8( """<b>Print</b>""" @@ -140,8 +146,9 @@ )) self.printAct.triggered[()].connect(self.__printImage) - self.printPreviewAct = QAction(UI.PixmapCache.getIcon("printPreview.png"), - self.trUtf8('Print Preview'), self) + self.printPreviewAct = QAction( + UI.PixmapCache.getIcon("printPreview.png"), + self.trUtf8('Print Preview'), self) self.printPreviewAct.setStatusTip(self.trUtf8( 'Print preview a screen capture')) self.printPreviewAct.setWhatsThis(self.trUtf8( @@ -154,7 +161,8 @@ self.trUtf8('&Screen Capture'), self) self.imageAct.setShortcut( QKeySequence(self.trUtf8("Ctrl+S", "File|Screen Capture"))) - self.imageAct.setStatusTip(self.trUtf8('Save a screen capture to an image file')) + self.imageAct.setStatusTip(self.trUtf8( + 'Save a screen capture to an image file')) self.imageAct.setWhatsThis(self.trUtf8( """<b>Screen Capture</b>""" """<p>Save a screen capture to an image file.</p>""" @@ -163,7 +171,8 @@ self.exitAct = QAction(UI.PixmapCache.getIcon("exit.png"), self.trUtf8('&Quit'), self) - self.exitAct.setShortcut(QKeySequence(self.trUtf8("Ctrl+Q", "File|Quit"))) + self.exitAct.setShortcut( + QKeySequence(self.trUtf8("Ctrl+Q", "File|Quit"))) self.exitAct.setStatusTip(self.trUtf8('Quit the application')) self.exitAct.setWhatsThis(self.trUtf8( """<b>Quit</b>""" @@ -173,8 +182,10 @@ self.copyAct = QAction(UI.PixmapCache.getIcon("editCopy.png"), self.trUtf8('&Copy'), self) - self.copyAct.setShortcut(QKeySequence(self.trUtf8("Ctrl+C", "Edit|Copy"))) - self.copyAct.setStatusTip(self.trUtf8('Copy screen capture to clipboard')) + self.copyAct.setShortcut( + QKeySequence(self.trUtf8("Ctrl+C", "Edit|Copy"))) + self.copyAct.setStatusTip( + self.trUtf8('Copy screen capture to clipboard')) self.copyAct.setWhatsThis(self.trUtf8( """<b>Copy</b>""" """<p>Copy screen capture to clipboard.</p>""" @@ -186,17 +197,18 @@ self.whatsThisAct.setShortcut(QKeySequence(self.trUtf8("Shift+F1"))) self.whatsThisAct.setStatusTip(self.trUtf8('Context sensitive help')) self.whatsThisAct.setWhatsThis(self.trUtf8( - """<b>Display context sensitive help</b>""" - """<p>In What's This? mode, the mouse cursor shows an arrow with a""" - """ question mark, and you can click on the interface elements to get""" - """ a short description of what they do and how to use them. In""" - """ dialogs, this feature can be accessed using the context help""" - """ button in the titlebar.</p>""" + """<b>Display context sensitive help</b>""" + """<p>In What's This? mode, the mouse cursor shows an arrow""" + """ with a question mark, and you can click on the interface""" + """ elements to get a short description of what they do and""" + """ how to use them. In dialogs, this feature can be accessed""" + """ using the context help button in the titlebar.</p>""" )) self.whatsThisAct.triggered[()].connect(self.__whatsThis) self.aboutAct = QAction(self.trUtf8('&About'), self) - self.aboutAct.setStatusTip(self.trUtf8('Display information about this software')) + self.aboutAct.setStatusTip(self.trUtf8( + 'Display information about this software')) self.aboutAct.setWhatsThis(self.trUtf8( """<b>About</b>""" """<p>Display some information about this software.</p>""" @@ -284,8 +296,9 @@ """ E5MessageBox.about(self, self.trUtf8("UI Previewer"), self.trUtf8( """<h3> About UI Previewer </h3>""" - """<p>The UI Previewer loads and displays Qt User-Interface files""" - """ with various styles, which are selectable via a selection list.</p>""" + """<p>The UI Previewer loads and displays Qt User-Interface""" + """ files with various styles, which are selectable via a""" + """ selection list.</p>""" )) def __aboutQt(self): @@ -337,7 +350,8 @@ else: E5MessageBox.warning(self, self.trUtf8("Load UI File"), - self.trUtf8("""<p>The file <b>{0}</b> could not be loaded.</p>""")\ + self.trUtf8( + """<p>The file <b>{0}</b> could not be loaded.</p>""")\ .format(fn)) self.__updateActions() @@ -431,7 +445,8 @@ filters = "" formats = QImageWriter.supportedImageFormats() for format in formats: - filters = "{0}*.{1} ".format(filters, bytes(format).decode().lower()) + filters = "{0}*.{1} ".format( + filters, bytes(format).decode().lower()) filter = self.trUtf8("Images ({0})").format(filters[:-1]) fname = E5FileDialog.getSaveFileName( @@ -455,7 +470,8 @@ if not pix.save(fname, str(ext)): E5MessageBox.critical(self, self.trUtf8("Save Image"), - self.trUtf8("""<p>The file <b>{0}</b> could not be saved.</p>""") + self.trUtf8( + """<p>The file <b>{0}</b> could not be saved.</p>""") .format(fname)) def __copyImageToClipboard(self): @@ -494,8 +510,8 @@ QPrinter.PageSize(int(settings.value("UIPreviewer/pagesize")))) printer.setPageOrder( QPrinter.PageOrder(int(settings.value("UIPreviewer/pageorder")))) - printer.setOrientation( - QPrinter.Orientation(int(settings.value("UIPreviewer/orientation")))) + printer.setOrientation(QPrinter.Orientation( + int(settings.value("UIPreviewer/orientation")))) printer.setColorMode( QPrinter.ColorMode(int(settings.value("UIPreviewer/colormode")))) @@ -510,7 +526,8 @@ settings.setValue("UIPreviewer/orientation", printer.orientation()) settings.setValue("UIPreviewer/colormode", printer.colorMode()) - self.statusBar().showMessage(self.trUtf8("Image sent to printer..."), 2000) + self.statusBar().showMessage( + self.trUtf8("Image sent to printer..."), 2000) def __printPreviewImage(self): """ @@ -533,8 +550,8 @@ QPrinter.PageSize(int(settings.value("UIPreviewer/pagesize")))) printer.setPageOrder( QPrinter.PageOrder(int(settings.value("UIPreviewer/pageorder")))) - printer.setOrientation( - QPrinter.Orientation(int(settings.value("UIPreviewer/orientation")))) + printer.setOrientation(QPrinter.Orientation( + int(settings.value("UIPreviewer/orientation")))) printer.setColorMode( QPrinter.ColorMode(int(settings.value("UIPreviewer/colormode"))))
--- a/Utilities/ClassBrowsers/ClbrBaseClasses.py Tue Oct 08 19:52:11 2013 +0200 +++ b/Utilities/ClassBrowsers/ClbrBaseClasses.py Wed Oct 09 18:34:30 2013 +0200 @@ -200,7 +200,8 @@ """ Public method to add another assignment line number. - @param lineno linenumber of the additional attribute assignment (integer) + @param lineno linenumber of the additional attribute assignment + (integer) """ if lineno not in self.linenos: self.linenos.append(lineno)
--- a/Utilities/ClassBrowsers/__init__.py Tue Oct 08 19:52:11 2013 +0200 +++ b/Utilities/ClassBrowsers/__init__.py Wed Oct 09 18:34:30 2013 +0200 @@ -131,9 +131,10 @@ try: return imp.find_module(name, path) except ImportError: - if name.lower().endswith(tuple(Preferences.getPython("PythonExtensions") + \ - Preferences.getPython("Python3Extensions"))) or \ - isPyFile: + if name.lower().endswith( + tuple(Preferences.getPython("PythonExtensions") + + Preferences.getPython("Python3Extensions"))) or \ + isPyFile: for p in path: # search in path pathname = os.path.join(p, name) if os.path.exists(pathname):
--- a/Utilities/ClassBrowsers/idlclbr.py Tue Oct 08 19:52:11 2013 +0200 +++ b/Utilities/ClassBrowsers/idlclbr.py Wed Oct 09 18:34:30 2013 +0200 @@ -4,10 +4,12 @@ # """ -Parse a CORBA IDL file and retrieve modules, interfaces, methods and attributes. +Parse a CORBA IDL file and retrieve modules, interfaces, methods and +attributes. -Parse enough of a CORBA IDL file to recognize module, interface and method definitions -and to find out the superclasses of an interface as well as its attributes. +Parse enough of a CORBA IDL file to recognize module, interface and method +definitions and to find out the superclasses of an interface as well as its +attributes. It is based on the Python class browser found in this package. """ @@ -140,7 +142,8 @@ """ Class to represent a CORBA IDL function. """ - def __init__(self, module, name, file, lineno, signature='', separator=','): + def __init__(self, module, name, file, lineno, signature='', + separator=','): """ Constructor @@ -175,7 +178,8 @@ def readmodule_ex(module, path=[]): """ - Read a CORBA IDL file and return a dictionary of classes, functions and modules. + Read a CORBA IDL file and return a dictionary of classes, functions and + modules. @param module name of the CORBA IDL file (string) @param path path the file should be searched in (list of strings) @@ -241,7 +245,8 @@ if classstack: # it's an interface/module method cur_class = classstack[-1][0] - if isinstance(cur_class, Interface) or isinstance(cur_class, Module): + if isinstance(cur_class, Interface) or \ + isinstance(cur_class, Module): # it's a method f = Function(None, meth_name, file, lineno, meth_sig) @@ -255,7 +260,8 @@ file, lineno, meth_sig) if meth_name in dict_counts: dict_counts[meth_name] += 1 - meth_name = "{0}_{1:d}".format(meth_name, dict_counts[meth_name]) + meth_name = "{0}_{1:d}".format( + meth_name, dict_counts[meth_name]) else: dict_counts[meth_name] = 0 dict[meth_name] = f
--- a/Utilities/ClassBrowsers/jsclbr.py Tue Oct 08 19:52:11 2013 +0200 +++ b/Utilities/ClassBrowsers/jsclbr.py Wed Oct 09 18:34:30 2013 +0200 @@ -40,7 +40,8 @@ """ Class to represent a Python function. """ - def __init__(self, module, name, file, lineno, signature='', separator=','): + def __init__(self, module, name, file, lineno, signature='', + separator=','): """ Constructor @@ -116,7 +117,8 @@ @param root root node to visit """ - call = lambda n: getattr(self, "visit_{0}".format(n.type), self.visit_noop)(n) + call = lambda n: getattr(self, "visit_{0}".format(n.type), + self.visit_noop)(n) call(root) for node in root: self.__visit(node) @@ -140,7 +142,8 @@ node.functionForm == "declared_form": if self.__stack and self.__stack[-1].endlineno < node.line: del self.__stack[-1] - endline = node.line + self.__source.count('\n', node.start, node.end) + endline = node.line + self.__source.count( + '\n', node.start, node.end) if getattr(node, "params", None): func_sig = ", ".join([p.value for p in node.params]) else: @@ -175,7 +178,8 @@ if node.type == "property_init" and node[1].type == "function": if self.__stack and self.__stack[-1].endlineno < node[0].line: del self.__stack[-1] - endline = node[0].line + self.__source.count('\n', node.start, node[1].end) + endline = node[0].line + self.__source.count( + '\n', node.start, node[1].end) if getattr(node[1], "params", None): func_sig = ", ".join([p.value for p in node[1].params]) else: @@ -215,16 +219,17 @@ if self.__stack: # function variables for var in node: - attr = Attribute(self.__module, var.name, self.__file, var.line) + attr = Attribute( + self.__module, var.name, self.__file, var.line) self.__stack[-1]._addattribute(attr) else: # global variable if "@@Globals@@" not in self.__dict: - self.__dict["@@Globals@@"] = \ - ClbrBaseClasses.ClbrBase(self.__module, "Globals", self.__file, 0) + self.__dict["@@Globals@@"] = ClbrBaseClasses.ClbrBase( + self.__module, "Globals", self.__file, 0) for var in node: - self.__dict["@@Globals@@"]._addglobal( - Attribute(self.__module, var.name, self.__file, var.line)) + self.__dict["@@Globals@@"]._addglobal(Attribute( + self.__module, var.name, self.__file, var.line)) def visit_const(self, node): """ @@ -246,8 +251,8 @@ else: # global variable if "@@Globals@@" not in self.__dict: - self.__dict["@@Globals@@"] = \ - ClbrBaseClasses.ClbrBase(self.__module, "Globals", self.__file, 0) + self.__dict["@@Globals@@"] = ClbrBaseClasses.ClbrBase( + self.__module, "Globals", self.__file, 0) for var in node: self.__dict["@@Globals@@"]._addglobal( Attribute(self.__module, "const " + var.name,
--- a/Utilities/ClassBrowsers/pyclbr.py Tue Oct 08 19:52:11 2013 +0200 +++ b/Utilities/ClassBrowsers/pyclbr.py Wed Oct 09 18:34:30 2013 +0200 @@ -341,7 +341,8 @@ file, lineno, meth_sig, modifierType=modifier) if meth_name in dict_counts: dict_counts[meth_name] += 1 - meth_name = "{0}_{1:d}".format(meth_name, dict_counts[meth_name]) + meth_name = "{0}_{1:d}".format( + meth_name, dict_counts[meth_name]) else: dict_counts[meth_name] = 0 dict[meth_name] = f @@ -407,7 +408,8 @@ if not classstack: if class_name in dict_counts: dict_counts[class_name] += 1 - class_name = "{0}_{1:d}".format(class_name, dict_counts[class_name]) + class_name = "{0}_{1:d}".format( + class_name, dict_counts[class_name]) else: dict_counts[class_name] = 0 dict[class_name] = cur_class @@ -426,7 +428,8 @@ while index >= -len(classstack): if classstack[index][0] is not None and \ not isinstance(classstack[index][0], Function): - attr = Attribute(module, m.group("AttributeName"), file, lineno) + attr = Attribute( + module, m.group("AttributeName"), file, lineno) classstack[index][0]._addattribute(attr) break else: @@ -440,8 +443,8 @@ if thisindent == 0: # global variable if "@@Globals@@" not in dict: - dict["@@Globals@@"] = \ - ClbrBaseClasses.ClbrBase(module, "Globals", file, lineno) + dict["@@Globals@@"] = ClbrBaseClasses.ClbrBase( + module, "Globals", file, lineno) dict["@@Globals@@"]._addglobal( Attribute(module, variable_name, file, lineno)) if lastGlobalEntry: @@ -482,7 +485,8 @@ lineno = lineno + src.count('\n', last_lineno_pos, start) last_lineno_pos = start if "@@Coding@@" not in dict: - dict["@@Coding@@"] = ClbrBaseClasses.Coding(module, file, lineno, coding) + dict["@@Coding@@"] = ClbrBaseClasses.Coding( + module, file, lineno, coding) else: assert 0, "regexp _getnext found something unexpected"
--- a/Utilities/ClassBrowsers/rbclbr.py Tue Oct 08 19:52:11 2013 +0200 +++ b/Utilities/ClassBrowsers/rbclbr.py Wed Oct 09 18:34:30 2013 +0200 @@ -47,7 +47,8 @@ (?P<MethodIndent> [ \t]* ) def [ \t]+ (?: - (?P<MethodName2> [a-zA-Z0-9_]+ (?: \. | :: ) [a-zA-Z_] [a-zA-Z0-9_?!=]* ) + (?P<MethodName2> [a-zA-Z0-9_]+ (?: \. | :: ) + [a-zA-Z_] [a-zA-Z0-9_?!=]* ) | (?P<MethodName> [a-zA-Z_] [a-zA-Z0-9_?!=]* ) | @@ -100,11 +101,13 @@ (?: (?P<AccessControlType> private | public | protected ) [^_] | - (?P<AccessControlType2> private_class_method | public_class_method ) + (?P<AccessControlType2> + private_class_method | public_class_method ) ) \(? [ \t]* - (?P<AccessControlList> (?: : [a-zA-Z0-9_]+ , \s* )* (?: : [a-zA-Z0-9_]+ )+ )? + (?P<AccessControlList> (?: : [a-zA-Z0-9_]+ , \s* )* + (?: : [a-zA-Z0-9_]+ )+ )? [ \t]* \)? ) @@ -123,7 +126,8 @@ (?P<AttrType> (?: _accessor | _reader | _writer ) )? \(? [ \t]* - (?P<AttrList> (?: : [a-zA-Z0-9_]+ , \s* )* (?: : [a-zA-Z0-9_]+ | true | false )+ ) + (?P<AttrList> (?: : [a-zA-Z0-9_]+ , \s* )* + (?: : [a-zA-Z0-9_]+ | true | false )+ ) [ \t]* \)? ) @@ -131,7 +135,8 @@ | (?P<Begin> ^ [ \t]* - (?: def | if | unless | case | while | until | for | begin ) \b [^_] + (?: def | if | unless | case | while | until | for | begin ) + \b [^_] | [ \t]* do [ \t]* (?: \| .*? \| )? [ \t]* $ ) @@ -207,7 +212,8 @@ """ Class to represent a Ruby function. """ - def __init__(self, module, name, file, lineno, signature='', separator=','): + def __init__(self, module, name, file, lineno, signature='', + separator=','): """ Constructor @@ -319,7 +325,8 @@ if classstack: # it's a class/module method cur_class = classstack[-1][0] - if isinstance(cur_class, Class) or isinstance(cur_class, Module): + if isinstance(cur_class, Class) or \ + isinstance(cur_class, Module): # it's a method f = Function(None, meth_name, file, lineno, meth_sig) @@ -342,7 +349,8 @@ file, lineno, meth_sig) if meth_name in dict_counts: dict_counts[meth_name] += 1 - meth_name = "{0}_{1:d}".format(meth_name, dict_counts[meth_name]) + meth_name = "{0}_{1:d}".format( + meth_name, dict_counts[meth_name]) else: dict_counts[meth_name] = 0 dict[meth_name] = f @@ -408,7 +416,8 @@ while acstack and \ acstack[-1][1] >= thisindent: del acstack[-1] - acstack.append(["public", thisindent]) # default access control is 'public' + acstack.append(["public", thisindent]) # default access control + # is 'public' elif m.start("Module") >= 0: # we found a module definition @@ -448,7 +457,8 @@ while acstack and \ acstack[-1][1] >= thisindent: del acstack[-1] - acstack.append(["public", thisindent]) # default access control is 'public' + acstack.append(["public", thisindent]) # default access control + # is 'public' elif m.start("AccessControl") >= 0: aclist = m.group("AccessControlList") @@ -473,7 +483,7 @@ m.group("AccessControlType2").split('_')[0] actype = actype.lower() for name in aclist.split(","): - name = name.strip()[1:] # get rid of leading ':' + name = name.strip()[1:] # get rid of leading ':' acmeth = parent._getmethod(name) if acmeth is None: continue @@ -495,7 +505,8 @@ if classstack[index][0] is not None and \ not isinstance(classstack[index][0], Function) and \ not classstack[index][1] >= indent: - attr = Attribute(module, m.group("AttributeName"), file, lineno) + attr = Attribute( + module, m.group("AttributeName"), file, lineno) classstack[index][0]._addattribute(attr) break else: @@ -529,7 +540,7 @@ else: access = m.group("AttrType") for name in m.group("AttrList").split(","): - name = name.strip()[1:] # get rid of leading ':' + name = name.strip()[1:] # get rid of leading ':' attr = parent._getattribute("@" + name) or \ parent._getattribute("@@" + name) or \ Attribute(module, "@" + name, file, lineno) @@ -569,7 +580,8 @@ lineno = lineno + src.count('\n', last_lineno_pos, start) last_lineno_pos = start if "@@Coding@@" not in dict: - dict["@@Coding@@"] = ClbrBaseClasses.Coding(module, file, lineno, coding) + dict["@@Coding@@"] = ClbrBaseClasses.Coding( + module, file, lineno, coding) else: assert 0, "regexp _getnext found something unexpected"
--- a/Utilities/FtpUtilities.py Tue Oct 08 19:52:11 2013 +0200 +++ b/Utilities/FtpUtilities.py Wed Oct 09 18:34:30 2013 +0200 @@ -75,7 +75,8 @@ @exception FtpDirLineParserError Raised if the mode cannot be parsed. """ if len(modeString) != 10: - raise FtpDirLineParserError("invalid mode string '{0}'".format(modeString)) + raise FtpDirLineParserError( + "invalid mode string '{0}'".format(modeString)) modeString = modeString.lower() @@ -134,10 +135,12 @@ not recognized. """ try: - month = FtpDirLineParser.MonthnamesNumbers[monthAbbreviation.lower()] + month = FtpDirLineParser.MonthnamesNumbers[ + monthAbbreviation.lower()] except KeyError: - raise FtpDirLineParserError("illegal month abbreviation '{0}'".format( - monthAbbreviation)) + raise FtpDirLineParserError( + "illegal month abbreviation '{0}'".format( + monthAbbreviation)) day = int(day) if ':' in yearOrTime: year = QDate.currentDate().year() @@ -172,7 +175,8 @@ fieldCountWithoutUserID = 8 fieldCountWithUserID = fieldCountWithoutUserID + 1 if len(lineParts) < fieldCountWithoutUserID: - raise FtpDirLineParserError("line '{0}' cannot be parsed".format(line)) + raise FtpDirLineParserError( + "line '{0}' cannot be parsed".format(line)) # If we have a valid format (either with or without user id field), # the field with index 5 is either the month abbreviation or a day. @@ -238,13 +242,15 @@ else: year = 2000 + year except (ValueError, IndexError): - raise FtpDirLineParserError("illegal date string '{0}'".format(month)) + raise FtpDirLineParserError( + "illegal date string '{0}'".format(month)) try: hour, minute, am_pm = time[0:2], time[3:5], time[5] hour = int(hour) minute = int(minute) except (ValueError, IndexError): - raise FtpDirLineParserError("illegal time string '{0}'".format(month)) + raise FtpDirLineParserError( + "illegal time string '{0}'".format(month)) if hour == 12 and am_pm == 'A': hour = 0 if hour != 12 and am_pm == 'P': @@ -266,7 +272,8 @@ date, time, dirOrSize, name = line.split(None, 3) except ValueError: # "unpack list of wrong size" - raise FtpDirLineParserError("line '{0}' cannot be parsed".format(line)) + raise FtpDirLineParserError( + "line '{0}' cannot be parsed".format(line)) if name in [".", ".."]: return None @@ -282,7 +289,8 @@ try: urlInfo.setSize(int(dirOrSize)) except ValueError: - raise FtpDirLineParserError("illegal size '{0}'".format(dirOrSize)) + raise FtpDirLineParserError( + "illegal size '{0}'".format(dirOrSize)) urlInfo.setName(name) ext = os.path.splitext(name.lower())[1] @@ -292,7 +300,8 @@ | E5UrlInfo.ReadGroup | E5UrlInfo.WriteGroup | E5UrlInfo.ReadOther | E5UrlInfo.WriteOther) if ext in [".exe", ".com", ".bat", ".cmd"]: - permissions |= E5UrlInfo.ExeOwner | E5UrlInfo.ExeGroup | E5UrlInfo.ExeOther + permissions |= E5UrlInfo.ExeOwner | E5UrlInfo.ExeGroup | \ + E5UrlInfo.ExeOther urlInfo.setPermissions(permissions) return urlInfo
--- a/Utilities/ModuleParser.py Tue Oct 08 19:52:11 2013 +0200 +++ b/Utilities/ModuleParser.py Wed Oct 09 18:34:30 2013 +0200 @@ -25,8 +25,8 @@ from functools import reduce import Preferences -__all__ = ["Module", "Class", "Function", "Attribute", "RbModule", "readModule", - "getTypeFromTypeName"] +__all__ = ["Module", "Class", "Function", "Attribute", "RbModule", + "readModule", "getTypeFromTypeName"] TABWIDTH = 4 @@ -123,7 +123,8 @@ ) | (?P<Method> - (^ [ \t]* @ (?: PyQt4 \. )? (?: QtCore \. )? (?: pyqtSignature | pyqtSlot ) + (^ [ \t]* @ (?: PyQt4 \. )? (?: QtCore \. )? + (?: pyqtSignature | pyqtSlot ) [ \t]* \( (?P<MethodPyQtSignature> [^)]* ) \) \s* @@ -215,7 +216,8 @@ (?P<MethodIndent> [ \t]* ) def [ \t]+ (?: - (?P<MethodName2> [a-zA-Z0-9_]+ (?: \. | :: ) [a-zA-Z_] [a-zA-Z0-9_?!=]* ) + (?P<MethodName2> [a-zA-Z0-9_]+ (?: \. | :: ) + [a-zA-Z_] [a-zA-Z0-9_?!=]* ) | (?P<MethodName> [a-zA-Z_] [a-zA-Z0-9_?!=]* ) | @@ -268,11 +270,13 @@ (?: (?P<AccessControlType> private | public | protected ) [^_] | - (?P<AccessControlType2> private_class_method | public_class_method ) + (?P<AccessControlType2> + private_class_method | public_class_method ) ) \(? [ \t]* - (?P<AccessControlList> (?: : [a-zA-Z0-9_]+ , \s* )* (?: : [a-zA-Z0-9_]+ )+ )? + (?P<AccessControlList> (?: : [a-zA-Z0-9_]+ , \s* )* + (?: : [a-zA-Z0-9_]+ )+ )? [ \t]* \)? ) @@ -291,7 +295,8 @@ (?P<AttrType> (?: _accessor | _reader | _writer ) )? \(? [ \t]* - (?P<AttrList> (?: : [a-zA-Z0-9_]+ , \s* )* (?: : [a-zA-Z0-9_]+ | true | false )+ ) + (?P<AttrList> (?: : [a-zA-Z0-9_]+ , \s* )* + (?: : [a-zA-Z0-9_]+ | true | false )+ ) [ \t]* \)? ) @@ -471,7 +476,8 @@ def scan(self, src): """ - Public method to scan the source text and retrieve the relevant information. + Public method to scan the source text and retrieve the relevant + information. @param src the source text to be scanned (string) """ @@ -495,8 +501,8 @@ def __py_scan(self, src): """ - Private method to scan the source text of a Python module and retrieve the - relevant information. + Private method to scan the source text of a Python module and retrieve + the relevant information. @param src the source text to be scanned (string) """ @@ -551,8 +557,10 @@ if conditionalsstack: if thisindent > conditionalsstack[-1]: if not deltaindentcalculated: - deltastack.append(thisindent - conditionalsstack[-1]) - deltaindent = reduce(lambda x, y: x + y, deltastack) + deltastack.append( + thisindent - conditionalsstack[-1]) + deltaindent = reduce( + lambda x, y: x + y, deltastack) deltaindentcalculated = 1 thisindent -= deltaindent else: @@ -581,15 +589,17 @@ if isinstance(cur_class, Class): # it's a class method - f = Function(None, meth_name, None, lineno, - meth_sig, meth_pyqtSig, modifierType=modifier) + f = Function( + None, meth_name, None, lineno, + meth_sig, meth_pyqtSig, modifierType=modifier) self.__py_setVisibility(f) cur_class.addMethod(meth_name, f) break else: # it's a nested function of a module function - f = Function(self.name, meth_name, self.file, lineno, - meth_sig, meth_pyqtSig, modifierType=modifier) + f = Function( + self.name, meth_name, self.file, lineno, + meth_sig, meth_pyqtSig, modifierType=modifier) self.__py_setVisibility(f) self.addFunction(meth_name, f) else: @@ -700,7 +710,8 @@ while index >= -len(classstack): if classstack[index][0] is not None: attrName = m.group("AttributeName") - attr = Attribute(self.name, attrName, self.file, lineno) + attr = Attribute( + self.name, attrName, self.file, lineno) self.__py_setVisibility(attr) classstack[index][0].addAttribute(attrName, attr) break @@ -715,8 +726,9 @@ last_lineno_pos = start if thisindent == 0: # global variable - attr = Attribute(self.name, variable_name, self.file, lineno, - isSignal=isSignal) + attr = Attribute( + self.name, variable_name, self.file, lineno, + isSignal=isSignal) self.__py_setVisibility(attr) self.addGlobal(variable_name, attr) if lastGlobalEntry: @@ -730,16 +742,19 @@ else: if classstack[index][0] is not None and \ isinstance(classstack[index][0], Class): - attr = Attribute(self.name, variable_name, self.file, - lineno, isSignal=isSignal) + attr = Attribute( + self.name, variable_name, self.file, + lineno, isSignal=isSignal) self.__py_setVisibility(attr) - classstack[index][0].addGlobal(variable_name, attr) + classstack[index][0].addGlobal( + variable_name, attr) break elif m.start("Import") >= 0: # import module - names = [n.strip() for n in "".join( - m.group("ImportList").splitlines()).replace("\\", "").split(',')] + names = [n.strip() for n in + "".join(m.group("ImportList").splitlines()) + .replace("\\", "").split(',')] for name in names: if not name in self.imports: self.imports.append(name) @@ -747,8 +762,9 @@ elif m.start("ImportFrom") >= 0: # from module import stuff mod = m.group("ImportFromPath") - names = [n.strip() for n in "".join( - m.group("ImportFromList").splitlines()).replace("\\", "").split(',')] + names = [n.strip() for n in + "".join(m.group("ImportFromList").splitlines()) + .replace("\\", "").split(',')] if mod not in self.from_imports: self.from_imports[mod] = [] self.from_imports[mod].extend(names) @@ -771,8 +787,8 @@ def __rb_scan(self, src): """ - Private method to scan the source text of a Python module and retrieve the - relevant information. + Private method to scan the source text of a Python module and retrieve + the relevant information. @param src the source text to be scanned (string) """ @@ -808,7 +824,8 @@ while classstack and \ classstack[-1][1] >= thisindent: if classstack[-1][0] is not None and \ - isinstance(classstack[-1][0], (Class, Function, RbModule)): + isinstance(classstack[-1][0], + (Class, Function, RbModule)): # record the end line of this class, function or module classstack[-1][0].setEndLine(lineno - 1) del classstack[-1] @@ -833,7 +850,8 @@ break else: # it's a nested function of a module function - f = Function(self.name, meth_name, self.file, lineno, meth_sig) + f = Function( + self.name, meth_name, self.file, lineno, meth_sig) self.addFunction(meth_name, f) # set access control if acstack: @@ -846,7 +864,8 @@ f.setPublic() else: # it's a function - f = Function(self.name, meth_name, self.file, lineno, meth_sig) + f = Function( + self.name, meth_name, self.file, lineno, meth_sig) self.addFunction(meth_name, f) if not classstack: if lastGlobalEntry: @@ -883,7 +902,8 @@ while classstack and \ classstack[-1][1] >= thisindent: if classstack[-1][0] is not None and \ - isinstance(classstack[-1][0], (Class, Function, RbModule)): + isinstance(classstack[-1][0], + (Class, Function, RbModule)): # record the end line of this class, function or module classstack[-1][0].setEndLine(lineno - 1) del classstack[-1] @@ -931,7 +951,8 @@ while classstack and \ classstack[-1][1] >= thisindent: if classstack[-1][0] is not None and \ - isinstance(classstack[-1][0], (Class, Function, RbModule)): + isinstance(classstack[-1][0], + (Class, Function, RbModule)): # record the end line of this class, function or module classstack[-1][0].setEndLine(lineno - 1) del classstack[-1] @@ -962,8 +983,9 @@ index = -1 while index >= -len(acstack): if acstack[index][1] < indent: - actype = m.group("AccessControlType") or \ - m.group("AccessControlType2").split('_')[0] + actype = \ + m.group("AccessControlType") or \ + m.group("AccessControlType2").split('_')[0] acstack[index][0] = actype.lower() break else: @@ -975,11 +997,13 @@ not isinstance(classstack[index][0], Function) and \ not classstack[index][1] >= indent: parent = classstack[index][0] - actype = m.group("AccessControlType") or \ - m.group("AccessControlType2").split('_')[0] + actype = \ + m.group("AccessControlType") or \ + m.group("AccessControlType2").split('_')[0] actype = actype.lower() for name in aclist.split(","): - name = name.strip()[1:] # get rid of leading ':' + # get rid of leading ':' + name = name.strip()[1:] acmeth = parent.getMethod(name) if acmeth is None: continue @@ -1002,7 +1026,8 @@ not isinstance(classstack[index][0], Function) and \ not classstack[index][1] >= indent: attrName = m.group("AttributeName") - attr = Attribute(self.name, attrName, self.file, lineno) + attr = Attribute( + self.name, attrName, self.file, lineno) if attrName.startswith("@@") or attrName[0].isupper(): classstack[index][0].addGlobal(attrName, attr) else: @@ -1013,7 +1038,8 @@ else: attrName = m.group("AttributeName") if attrName[0] != "@": - attr = Attribute(self.name, attrName, self.file, lineno) + attr = Attribute( + self.name, attrName, self.file, lineno) self.addGlobal(attrName, attr) if lastGlobalEntry: lastGlobalEntry.setEndLine(lineno - 1) @@ -1032,10 +1058,12 @@ nv = m.group("AttrList").split(",") if not nv: break - name = nv[0].strip()[1:] # get rid of leading ':' + # get rid of leading ':' + name = nv[0].strip()[1:] attr = parent.getAttribute("@" + name) or \ parent.getAttribute("@@" + name) or \ - Attribute(self.name, "@" + name, self.file, lineno) + Attribute( + self.name, "@" + name, self.file, lineno) if len(nv) == 1 or nv[1].strip() == "false": attr.setProtected() elif nv[1].strip() == "true": @@ -1044,13 +1072,17 @@ else: access = m.group("AttrType") for name in m.group("AttrList").split(","): - name = name.strip()[1:] # get rid of leading ':' + # get rid of leading ':' + name = name.strip()[1:] attr = parent.getAttribute("@" + name) or \ parent.getAttribute("@@" + name) or \ - Attribute(self.name, "@" + name, self.file, lineno) + Attribute( + self.name, "@" + name, self.file, + lineno) if access == "_accessor": attr.setPublic() - elif access == "_reader" or access == "_writer": + elif access == "_reader" or \ + access == "_writer": if attr.isPrivate(): attr.setProtected() elif attr.isProtected(): @@ -1083,7 +1115,8 @@ def createHierarchy(self): """ - Public method to build the inheritance hierarchy for all classes of this module. + Public method to build the inheritance hierarchy for all classes of + this module. @return A dictionary with inheritance hierarchies. """ @@ -1116,7 +1149,8 @@ rv[cls] = {} exhausted = path + [cls] exhausted.reverse() - self.addPathToHierarchy(exhausted, result, self.addPathToHierarchy) + self.addPathToHierarchy( + exhausted, result, self.addPathToHierarchy) else: rv[cls] = self.assembleHierarchy(cls, classes, path + [cls], result) @@ -1315,8 +1349,8 @@ Static = 1 Class = 2 - def __init__(self, module, name, file, lineno, signature='', pyqtSignature=None, - modifierType=General): + def __init__(self, module, name, file, lineno, signature='', + pyqtSignature=None, modifierType=General): """ Constructor @@ -1383,7 +1417,8 @@ """ Public method to add another assignment line number. - @param lineno linenumber of the additional attribute assignment (integer) + @param lineno linenumber of the additional attribute assignment + (integer) """ if lineno not in self.linenos: self.linenos.append(lineno) @@ -1462,12 +1497,14 @@ f = None if inpackage: try: - f, file, (suff, mode, type) = find_module(module, path, _extensions) + f, file, (suff, mode, type) = find_module( + module, path, _extensions) except ImportError: f = None if f is None: fullpath = list(path) + sys.path - f, file, (suff, mode, type) = find_module(module, fullpath, _extensions) + f, file, (suff, mode, type) = find_module( + module, fullpath, _extensions) if f: f.close() if type not in SUPPORTED_TYPES: @@ -1520,12 +1557,15 @@ pathname = os.path.join(p, name) if ext == '.ptl': # Quixote page template - return (open(pathname), pathname, ('.ptl', 'r', PTL_SOURCE)) + return (open(pathname), pathname, + ('.ptl', 'r', PTL_SOURCE)) elif ext == '.rb': # Ruby source file - return (open(pathname), pathname, ('.rb', 'r', RB_SOURCE)) + return (open(pathname), pathname, + ('.rb', 'r', RB_SOURCE)) else: - return (open(pathname), pathname, (ext, 'r', imp.PY_SOURCE)) + return (open(pathname), pathname, + (ext, 'r', imp.PY_SOURCE)) raise ImportError # standard Python module file @@ -1562,7 +1602,8 @@ modname = module.replace(os.sep, '.') else: modname = os.path.basename(module) - if modname.lower().endswith(".ptl") or modname.lower().endswith(".pyw"): + if modname.lower().endswith(".ptl") or \ + modname.lower().endswith(".pyw"): modname = modname[:-4] elif modname.lower().endswith(".rb"): modname = modname[:-3]
--- a/Utilities/PasswordChecker.py Tue Oct 08 19:52:11 2013 +0200 +++ b/Utilities/PasswordChecker.py Wed Oct 09 18:34:30 2013 +0200 @@ -84,8 +84,10 @@ # long enough. we will skip the redudancy penalty if this # number is not exceeded (meaning redundancy < this number) self.redundancy = { - "value": 1, # 1 means, not double characters, default to start - "permitted": 2.0, # 2 means, in average every character can occur twice + "value": 1, # 1 means, not double characters, + # default to start + "permitted": 2.0, # 2 means, in average every character + # can occur twice "status": self.Status_Failed, "rating": 0, } @@ -316,9 +318,10 @@ # calculate a redundancy number self.redundancy["value"] = len(password) / len(uniqueCharacters) - # Check for sequential alpha string patterns (forward and reverse) but only, - # if the string has already a length to check for, does not make sense to check - # the password "ab" for the sequential data "abc" + # Check for sequential alpha string patterns (forward and reverse) + # but only, if the string has already a length to check for, does + # not make sense to check the password "ab" for the sequential data + # "abc" lowercasedPassword = password.lower() if self.passwordLength["count"] >= self.sequentialLetters["length"]: @@ -348,8 +351,10 @@ patternsMatched = [] if self.passwordLength["count"] >= self.keyboardPatterns["length"]: for pattern in self.keyboardPatterns["data"]: - for index in range(len(pattern) - self.keyboardPatterns["length"] + 1): - fwd = pattern[index:index + self.keyboardPatterns["length"]] + for index in range( + len(pattern) - self.keyboardPatterns["length"] + 1): + fwd = pattern[index:index + + self.keyboardPatterns["length"]] rev = self.__strReverse(fwd) if lowercasedPassword.find(fwd) != -1: if fwd not in patternsMatched: @@ -364,7 +369,8 @@ if self.passwordLength["count"] >= self.repeatedSequences["length"]: for index in range(len(lowercasedPassword) - \ self.repeatedSequences["length"] + 1): - fwd = lowercasedPassword[index:index + self.repeatedSequences["length"]] + fwd = lowercasedPassword[ + index:index + self.repeatedSequences["length"]] if lowercasedPassword.find( fwd, index + self.repeatedSequences["length"]) != -1: self.repeatedSequences["count"] += 1 @@ -373,21 +379,24 @@ if self.passwordLength["count"] >= self.mirroredSequences["length"]: for index in range(len(lowercasedPassword) - \ self.mirroredSequences["length"] + 1): - fwd = lowercasedPassword[index:index + self.mirroredSequences["length"]] + fwd = lowercasedPassword[ + index:index + self.mirroredSequences["length"]] rev = self.__strReverse(fwd) if lowercasedPassword.find( fwd, index + self.mirroredSequences["length"]) != -1: self.mirroredSequences["count"] += 1 # Initial score based on length - self.score["count"] = self.passwordLength["count"] * self.passwordLength["factor"] + self.score["count"] = self.passwordLength["count"] * \ + self.passwordLength["factor"] # passwordLength # credit additional length or punish "under" length if self.passwordLength["count"] >= self.passwordLength["minimum"]: # credit additional characters over minimum self.passwordLength["rating"] = self.passwordLength["bonus"] + \ - (self.passwordLength["count"] - self.passwordLength["minimum"]) * \ + (self.passwordLength["count"] - + self.passwordLength["minimum"]) * \ self.passwordLength["factor"] else: self.passwordLength["rating"] = self.passwordLength["penalty"] @@ -396,7 +405,8 @@ # recommendedPasswordLength # Credit reaching the recommended password length or put a # penalty on it - if self.passwordLength["count"] >= self.recommendedPasswordLength["minimum"]: + if self.passwordLength["count"] >= \ + self.recommendedPasswordLength["minimum"]: self.recommendedPasswordLength["rating"] = \ self.recommendedPasswordLength["bonus"] + \ (self.passwordLength["count"] - \ @@ -410,8 +420,10 @@ # lowercaseLetters # Honor or punish the lowercase letter use if self.lowercaseLetters["count"] > 0: - self.lowercaseLetters["rating"] = self.lowercaseLetters["bonus"] + \ - self.lowercaseLetters["count"] * self.lowercaseLetters["factor"] + self.lowercaseLetters["rating"] = \ + self.lowercaseLetters["bonus"] + \ + self.lowercaseLetters["count"] * \ + self.lowercaseLetters["factor"] else: self.lowercaseLetters["rating"] = self.lowercaseLetters["penalty"] self.score["count"] += self.lowercaseLetters["rating"] @@ -419,8 +431,10 @@ # uppercaseLetters # Honor or punish the lowercase letter use if self.uppercaseLetters["count"] > 0: - self.uppercaseLetters["rating"] = self.uppercaseLetters["bonus"] + \ - self.uppercaseLetters["count"] * self.uppercaseLetters["factor"] + self.uppercaseLetters["rating"] = \ + self.uppercaseLetters["bonus"] + \ + self.uppercaseLetters["count"] * \ + self.uppercaseLetters["factor"] else: self.uppercaseLetters["rating"] = self.uppercaseLetters["penalty"] self.score["count"] += self.uppercaseLetters["rating"] @@ -464,26 +478,34 @@ # sequentialLetters # Honor or punish the sequential letter use if self.sequentialLetters["count"] == 0: - self.sequentialLetters["rating"] = self.sequentialLetters["bonus"] + \ - self.sequentialLetters["count"] * self.sequentialLetters["factor"] + self.sequentialLetters["rating"] = \ + self.sequentialLetters["bonus"] + \ + self.sequentialLetters["count"] * \ + self.sequentialLetters["factor"] else: - self.sequentialLetters["rating"] = self.sequentialLetters["penalty"] + self.sequentialLetters["rating"] = \ + self.sequentialLetters["penalty"] self.score["count"] += self.sequentialLetters["rating"] # sequentialNumerics # Honor or punish the sequential numerics use if self.sequentialNumerics["count"] == 0: - self.sequentialNumerics["rating"] = self.sequentialNumerics["bonus"] + \ - self.sequentialNumerics["count"] * self.sequentialNumerics["factor"] + self.sequentialNumerics["rating"] = \ + self.sequentialNumerics["bonus"] + \ + self.sequentialNumerics["count"] * \ + self.sequentialNumerics["factor"] else: - self.sequentialNumerics["rating"] = self.sequentialNumerics["penalty"] + self.sequentialNumerics["rating"] = \ + self.sequentialNumerics["penalty"] self.score["count"] += self.sequentialNumerics["rating"] # keyboardPatterns # Honor or punish the keyboard patterns use if self.keyboardPatterns["count"] == 0: - self.keyboardPatterns["rating"] = self.keyboardPatterns["bonus"] + \ - self.keyboardPatterns["count"] * self.keyboardPatterns["factor"] + self.keyboardPatterns["rating"] = \ + self.keyboardPatterns["bonus"] + \ + self.keyboardPatterns["count"] * \ + self.keyboardPatterns["factor"] else: self.keyboardPatterns["rating"] = self.keyboardPatterns["penalty"] self.score["count"] += self.keyboardPatterns["rating"] @@ -528,13 +550,16 @@ # judge the requirement status self.basicRequirements["status"] = self.__determineStatus( - self.basicRequirements["count"] - self.basicRequirements["minimum"]) + self.basicRequirements["count"] - + self.basicRequirements["minimum"]) if self.basicRequirements["status"] != self.Status_Failed: self.basicRequirements["rating"] = \ self.basicRequirements["bonus"] + \ - self.basicRequirements["factor"] * self.basicRequirements["count"] + self.basicRequirements["factor"] * \ + self.basicRequirements["count"] else: - self.basicRequirements["rating"] = self.basicRequirements["penalty"] + self.basicRequirements["rating"] = \ + self.basicRequirements["penalty"] self.score["count"] += self.basicRequirements["rating"] # beyond basic requirements @@ -563,18 +588,22 @@ # repeatedSequences # Honor or punish the use of repeated sequences if self.repeatedSequences["count"] == 0: - self.repeatedSequences["rating"] = self.repeatedSequences["bonus"] + self.repeatedSequences["rating"] = \ + self.repeatedSequences["bonus"] else: - self.repeatedSequences["rating"] = self.repeatedSequences["penalty"] + \ + self.repeatedSequences["rating"] = \ + self.repeatedSequences["penalty"] + \ self.repeatedSequences["count"] * \ self.repeatedSequences["factor"] # mirroredSequences # Honor or punish the use of mirrored sequences if self.mirroredSequences["count"] == 0: - self.mirroredSequences["rating"] = self.mirroredSequences["bonus"] + self.mirroredSequences["rating"] = \ + self.mirroredSequences["bonus"] else: - self.mirroredSequences["rating"] = self.mirroredSequences["penalty"] + \ + self.mirroredSequences["rating"] = \ + self.mirroredSequences["penalty"] + \ self.mirroredSequences["count"] * \ self.mirroredSequences["factor"] @@ -584,7 +613,8 @@ # apply the redundancy # is the password length requirement fulfilled? if self.recommendedPasswordLength["status"] != self.Status_Exceeded: - # full penalty, because password is not long enough, only for a positive score + # full penalty, because password is not long enough, only for + # a positive score if self.score["count"] > 0: self.score["count"] *= 1.0 / self.redundancy["value"]
--- a/Utilities/__init__.py Tue Oct 08 19:52:11 2013 +0200 +++ b/Utilities/__init__.py Wed Oct 09 18:34:30 2013 +0200 @@ -171,12 +171,14 @@ into proper text. @param filename name of the file to read (string) - @return tuple of decoded text, encoding and hash value (string, string, string) + @return tuple of decoded text, encoding and hash value (string, string, + string) """ f = open(filename, "rb") text = f.read() f.close() - hash = str(QCryptographicHash.hash(QByteArray(text), QCryptographicHash.Md5).toHex(), + hash = str(QCryptographicHash.hash( + QByteArray(text), QCryptographicHash.Md5).toHex(), encoding="ASCII") return decode(text) + (hash, ) @@ -216,7 +218,8 @@ try: import ThirdParty.CharDet.chardet guess = ThirdParty.CharDet.chardet.detect(text) - if guess and guess['confidence'] > 0.95 and guess['encoding'] is not None: + if guess and guess['confidence'] > 0.95 and \ + guess['encoding'] is not None: codec = guess['encoding'].lower() return str(text, codec), '{0}-guessed'.format(codec) except (UnicodeError, LookupError): @@ -598,7 +601,8 @@ def extractLineFlags(line, startComment="#", endComment=""): """ - Function to extract flags starting and ending with '__' from a line comment. + Function to extract flags starting and ending with '__' from a line + comment. @param line line to extract flags from (string) @keyparam startComment string identifying the start of the comment (string) @@ -639,7 +643,8 @@ def normcasepath(path): """ - Function returning a path, that is normalized with respect to its case and references. + Function returning a path, that is normalized with respect to its case + and references. @param path file path (string) @return case normalized path (string) @@ -659,8 +664,8 @@ def normcaseabspath(path): """ - Function returning an absolute path, that is normalized with respect to its case - and references. + Function returning an absolute path, that is normalized with respect to + its case and references. @param path file path (string) @return absolute, normalized path (string) @@ -681,7 +686,8 @@ def normabsjoinpath(a, *p): """ - Function returning a normalized, absolute path of the joined parts passed into it. + Function returning a normalized, absolute path of the joined parts passed + into it. @param a first path to be joined (string) @param p variable number of path parts to be joind (string) @@ -782,9 +788,9 @@ Function to build all full path of an executable file from the environment. @param file filename of the executable (string) - @return list of full executable names (list of strings), if the executable file - is accessible via the searchpath defined by the PATH environment variable, - or an empty list otherwise. + @return list of full executable names (list of strings), if the executable + file is accessible via the searchpath defined by the PATH environment + variable, or an empty list otherwise. """ paths = [] @@ -834,7 +840,8 @@ if f1 is None or f2 is None: return False - if normcaseabspath(os.path.realpath(f1)) == normcaseabspath(os.path.realpath(f2)): + if normcaseabspath(os.path.realpath(f1)) == \ + normcaseabspath(os.path.realpath(f2)): return True return False @@ -872,7 +879,8 @@ @return the complete filename (string) """ if ext[0] != ".": - ext = ".{0}".format(ext) # require leading separator, to match os.path.splitext + ext = ".{0}".format(ext) # require leading separator to match + # os.path.splitext return prefix + EXTSEP + ext[1:] @@ -882,7 +890,8 @@ @param path path to be compacted (string) @param width width for the compacted path (integer) - @param measure reference to a function used to measure the length of the string + @param measure reference to a function used to measure the length of the + string @return compacted path (string) """ if measure(path) <= width: @@ -912,7 +921,8 @@ return "" -def direntries(path, filesonly=False, pattern=None, followsymlinks=True, checkStop=None): +def direntries(path, filesonly=False, pattern=None, followsymlinks=True, + checkStop=None): """ Function returning a list of all files and directories. @@ -953,7 +963,8 @@ if os.path.isdir(fentry): if os.path.islink(fentry) and not followsymlinks: continue - files += direntries(fentry, filesonly, pattern, followsymlinks, checkStop) + files += direntries( + fentry, filesonly, pattern, followsymlinks, checkStop) else: files.append(fentry) except OSError: @@ -1023,7 +1034,8 @@ def parseEnvironmentString(s): """ - Function used to convert an environment string into a list of environment settings. + Function used to convert an environment string into a list of environment + settings. @param s environment string (string) @return list of environment settings (list of strings) @@ -1154,11 +1166,13 @@ """<p>You may use %-codes as placeholders in the string.""" """ Supported codes are:""" """<table>""" - """<tr><td>%C</td><td>column of the cursor of the current editor</td></tr>""" + """<tr><td>%C</td><td>column of the cursor of the current editor""" + """</td></tr>""" """<tr><td>%D</td><td>directory of the current editor</td></tr>""" """<tr><td>%F</td><td>filename of the current editor</td></tr>""" """<tr><td>%H</td><td>home directory of the current user</td></tr>""" - """<tr><td>%L</td><td>line of the cursor of the current editor</td></tr>""" + """<tr><td>%L</td><td>line of the cursor of the current editor""" + """</td></tr>""" """<tr><td>%P</td><td>path of the current project</td></tr>""" """<tr><td>%S</td><td>selected text of the current editor</td></tr>""" """<tr><td>%U</td><td>username of the current user</td></tr>""" @@ -1391,14 +1405,14 @@ return (False, "", "", "", "", "", []) return (True, file, "1", "0", "", - QCoreApplication.translate("Utilities", - "Python2 interpreter did not finish within 30s."), + QCoreApplication.translate( + "Utilities", "Python2 interpreter did not finish within 30s."), []) -################################################################################ +############################################################################### # functions for environment handling -################################################################################ +############################################################################### def getEnvironmentEntry(key, default=None): @@ -1415,7 +1429,8 @@ if isWindowsPlatform(): filter.setCaseSensitivity(Qt.CaseInsensitive) - entries = [e for e in QProcess.systemEnvironment() if filter.indexIn(e) != -1] + entries = [e for e in QProcess.systemEnvironment() + if filter.indexIn(e) != -1] if not entries: return default @@ -1435,17 +1450,19 @@ if isWindowsPlatform(): filter.setCaseSensitivity(Qt.CaseInsensitive) - entries = [e for e in QProcess.systemEnvironment() if filter.indexIn(e) != -1] + entries = [e for e in QProcess.systemEnvironment() + if filter.indexIn(e) != -1] return len(entries) > 0 -################################################################################ +############################################################################### # Qt utility functions below -################################################################################ +############################################################################### def generateQtToolName(toolname): """ - Module function to generate the executable name for a Qt tool like designer. + Module function to generate the executable name for a Qt tool like + designer. @param toolname base name of the tool (string) @return the Qt tool name without extension (string) @@ -1465,9 +1482,11 @@ """ qtDir = getQtBinariesPath() bundles = [ - os.path.join(qtDir, 'bin', generateQtToolName(toolname.capitalize())) + ".app", + os.path.join( + qtDir, 'bin', generateQtToolName(toolname.capitalize())) + ".app", os.path.join(qtDir, 'bin', generateQtToolName(toolname)) + ".app", - os.path.join(qtDir, generateQtToolName(toolname.capitalize())) + ".app", + os.path.join( + qtDir, generateQtToolName(toolname.capitalize())) + ".app", os.path.join(qtDir, generateQtToolName(toolname)) + ".app", ] for bundle in bundles: @@ -1501,9 +1520,9 @@ return ("open", newArgs) -################################################################################ +############################################################################### # Qt utility functions below -################################################################################ +############################################################################### def generatePySideToolPath(toolname): @@ -1521,7 +1540,8 @@ prefix = sys.prefix except ImportError: # step 2: check for a Python2 variant - prefix = os.path.dirname(Preferences.getDebugger("PythonInterpreter")) + prefix = os.path.dirname( + Preferences.getDebugger("PythonInterpreter")) if toolname == "pyside-uic": return os.path.join(prefix, "Scripts", toolname + '.exe') else: @@ -1565,9 +1585,9 @@ return py2, py3 -################################################################################ +############################################################################### # Other utility functions below -################################################################################ +############################################################################### def generateVersionInfo(linesep='\n'): @@ -1670,15 +1690,15 @@ else: return bool(dataStr) -################################################################################ +############################################################################### # posix compatibility functions below -################################################################################ +############################################################################### # None right now -################################################################################ +############################################################################### # win32 compatibility functions below -################################################################################ +############################################################################### def win32_Kill(pid):
--- a/Utilities/binplistlib.py Tue Oct 08 19:52:11 2013 +0200 +++ b/Utilities/binplistlib.py Wed Oct 09 18:34:30 2013 +0200 @@ -4,7 +4,8 @@ # """ -Module implementing a library for reading and writing binary property list files. +Module implementing a library for reading and writing binary property list +files. Binary Property List (plist) files provide a faster and smaller serialization format for property lists on OS X. This is a library for generating binary @@ -73,14 +74,15 @@ # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. # from collections import namedtuple @@ -116,7 +118,8 @@ class Data(bytes): """ - Class implementing a wrapper around bytes types for representing Data values. + Class implementing a wrapper around bytes types for representing Data + values. """ pass @@ -139,7 +142,8 @@ """ Module function to read a plist file. - @param pathOrFile name of the plist file (string) or an open file (file object) + @param pathOrFile name of the plist file (string) or an open file + (file object) @return reference to the read object @exception InvalidPlistException raised to signal an invalid plist file """ @@ -167,8 +171,10 @@ Module function to write a plist file. @param rootObject reference to the object to be written - @param pathOrFile name of the plist file (string) or an open file (file object) - @param binary flag indicating the generation of a binary plist file (boolean) + @param pathOrFile name of the plist file (string) or an open file + (file object) + @param binary flag indicating the generation of a binary plist file + (boolean) """ if not binary: plistlib.writePlist(rootObject, pathOrFile) @@ -228,10 +234,11 @@ return False PlistTrailer = namedtuple('PlistTrailer', - 'offsetSize, objectRefSize, offsetCount, topLevelObjectNumber, offsetTableOffset') + 'offsetSize, objectRefSize, offsetCount, topLevelObjectNumber,' + ' offsetTableOffset') PlistByteCounts = namedtuple('PlistByteCounts', - 'nullBytes, boolBytes, intBytes, realBytes, dateBytes, dataBytes, stringBytes, ' - 'uidBytes, arrayBytes, setBytes, dictBytes') + 'nullBytes, boolBytes, intBytes, realBytes, dateBytes, dataBytes,' + ' stringBytes, uidBytes, arrayBytes, setBytes, dictBytes') class PlistReader(object): @@ -289,18 +296,22 @@ raise InvalidPlistException("File is too short.") trailerContents = self.contents[-32:] try: - self.trailer = PlistTrailer._make(unpack("!xxxxxxBBQQQ", trailerContents)) + self.trailer = PlistTrailer._make( + unpack("!xxxxxxBBQQQ", trailerContents)) offset_size = self.trailer.offsetSize * self.trailer.offsetCount offset = self.trailer.offsetTableOffset offset_contents = self.contents[offset:offset + offset_size] offset_i = 0 while offset_i < self.trailer.offsetCount: begin = self.trailer.offsetSize * offset_i - tmp_contents = offset_contents[begin:begin + self.trailer.offsetSize] - tmp_sized = self.getSizedInteger(tmp_contents, self.trailer.offsetSize) + tmp_contents = offset_contents[ + begin:begin + self.trailer.offsetSize] + tmp_sized = self.getSizedInteger( + tmp_contents, self.trailer.offsetSize) self.offsets.append(tmp_sized) offset_i += 1 - self.setCurrentOffsetToObjectNumber(self.trailer.topLevelObjectNumber) + self.setCurrentOffsetToObjectNumber( + self.trailer.topLevelObjectNumber) result = self.readObject() except TypeError as e: raise InvalidPlistException(e) @@ -347,7 +358,8 @@ pass # fill byte else: raise InvalidPlistException( - "Invalid object found at offset: {0}".format(self.currentOffset - 1)) + "Invalid object found at offset: {0}".format( + self.currentOffset - 1)) # int elif format == 0b0001: extra = proc_extra(extra) @@ -438,7 +450,8 @@ i = 0 while i < count: fragment = self.contents[ - self.currentOffset:self.currentOffset + self.trailer.objectRefSize] + self.currentOffset: + self.currentOffset + self.trailer.objectRefSize] ref = self.getSizedInteger(fragment, len(fragment)) refs.append(ref) self.currentOffset += self.trailer.objectRefSize @@ -503,7 +516,8 @@ @return unicode encoded string """ actual_length = length * 2 - data = self.contents[self.currentOffset:self.currentOffset + actual_length] + data = self.contents[ + self.currentOffset:self.currentOffset + actual_length] # unpack not needed?!! data = unpack(">%ds" % (actual_length), data)[0] self.currentOffset += actual_length return data.decode('utf_16_be') @@ -515,8 +529,10 @@ @return date object (datetime.datetime) """ global apple_reference_date_offset - result = unpack(">d", self.contents[self.currentOffset:self.currentOffset + 8])[0] - result = datetime.datetime.utcfromtimestamp(result + apple_reference_date_offset) + result = unpack(">d", + self.contents[self.currentOffset:self.currentOffset + 8])[0] + result = datetime.datetime.utcfromtimestamp( + result + apple_reference_date_offset) self.currentOffset += 8 return result @@ -561,7 +577,8 @@ elif bytes == 8: result = unpack('>q', data)[0] else: - raise InvalidPlistException("Encountered integer longer than 8 bytes.") + raise InvalidPlistException( + "Encountered integer longer than 8 bytes.") return result @@ -686,12 +703,14 @@ """ output = self.header wrapped_root = self.wrapRoot(root) - should_reference_root = True # not isinstance(wrapped_root, HashableWrapper) - self.computeOffsets(wrapped_root, asReference=should_reference_root, isRoot=True) + should_reference_root = True + self.computeOffsets( + wrapped_root, asReference=should_reference_root, isRoot=True) self.trailer = self.trailer._replace( **{'objectRefSize': self.intSize(len(self.computedUniques))}) (_, output) = self.writeObjectReference(wrapped_root, output) - output = self.writeObject(wrapped_root, output, setReferencePosition=True) + output = self.writeObject( + wrapped_root, output, setReferencePosition=True) # output size at this point is an upper bound on how big the # object reference offsets need to be. @@ -761,9 +780,11 @@ """ # __IGNORE_WARNING__ def check_key(key): if key is None: - raise InvalidPlistException('Dictionary keys cannot be null in plists.') + raise InvalidPlistException( + 'Dictionary keys cannot be null in plists.') elif isinstance(key, Data): - raise InvalidPlistException('Data cannot be dictionary keys in plists.') + raise InvalidPlistException( + 'Data cannot be dictionary keys in plists.') elif not isinstance(key, str): raise InvalidPlistException('Keys must be strings.') @@ -844,7 +865,8 @@ bytes=self.trailer.objectRefSize) return (True, output) else: - output += self.binaryInt(position, bytes=self.trailer.objectRefSize) + output += self.binaryInt( + position, bytes=self.trailer.objectRefSize) return (False, output) def writeObject(self, obj, output, setReferencePosition=False): @@ -916,7 +938,8 @@ if isNew: objectsToWrite.append(objRef) for objRef in objectsToWrite: - output = self.writeObject(objRef, output, setReferencePosition=True) + output = self.writeObject( + objRef, output, setReferencePosition=True) elif isinstance(obj, dict): output += proc_variable_length(0b1101, len(obj)) keys = [] @@ -934,7 +957,8 @@ if isNew: objectsToWrite.append(value) for objRef in objectsToWrite: - output = self.writeObject(objRef, output, setReferencePosition=True) + output = self.writeObject( + objRef, output, setReferencePosition=True) return output def writeOffsetTable(self, output): @@ -993,7 +1017,8 @@ result += pack('>q', obj) else: raise InvalidPlistException( - "Core Foundation can't handle integers with size greater than 8 bytes.") + "Core Foundation can't handle integers with size greater" + " than 8 bytes.") return result def intSize(self, obj): @@ -1022,7 +1047,8 @@ return 8 else: raise InvalidPlistException( - "Core Foundation can't handle integers with size greater than 8 bytes.") + "Core Foundation can't handle integers with size greater" + " than 8 bytes.") def realSize(self, obj): """
--- a/Utilities/crypto/__init__.py Tue Oct 08 19:52:11 2013 +0200 +++ b/Utilities/crypto/__init__.py Wed Oct 09 18:34:30 2013 +0200 @@ -17,9 +17,9 @@ import Preferences -################################################################################ +############################################################################### ## password handling functions below -################################################################################ +############################################################################### EncodeMarker = "CE4" @@ -37,8 +37,10 @@ @param pw password to encode (string) @return encoded password (string) """ - pop = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,;:-_!$?*+#" - rpw = "".join(random.sample(pop, 32)) + pw + "".join(random.sample(pop, 32)) + pop = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" \ + ".,;:-_!$?*+#" + rpw = "".join(random.sample(pop, 32)) + pw + \ + "".join(random.sample(pop, 32)) return EncodeMarker + base64.b64encode(rpw.encode("utf-8")).decode("ascii") @@ -75,8 +77,10 @@ MasterPassword = pwEncode(pw) else: E5MessageBox.warning(None, - QCoreApplication.translate("Crypto", "Master Password"), - QCoreApplication.translate("Crypto", + QCoreApplication.translate( + "Crypto", "Master Password"), + QCoreApplication.translate( + "Crypto", """The given password is incorrect.""")) else: E5MessageBox.critical(None, @@ -252,7 +256,8 @@ @param data data to encrypt (bytes) @param password password to be used for encryption (string) - @keyparam keyLength length of the key to be generated for encryption (16, 24 or 32) + @keyparam keyLength length of the key to be generated for encryption + (16, 24 or 32) @keyparam hashIterations number of hashes to be applied to the password for generating the encryption key (integer) @return encrypted data (bytes) and flag indicating @@ -282,7 +287,8 @@ @param edata hashed data to decrypt (string) @param password password to be used for decryption (string) - @keyparam keyLength length of the key to be generated for decryption (16, 24 or 32) + @keyparam keyLength length of the key to be generated for decryption + (16, 24 or 32) @return decrypted data (bytes) and flag indicating success (boolean) """
--- a/Utilities/crypto/py3AES.py Tue Oct 08 19:52:11 2013 +0200 +++ b/Utilities/crypto/py3AES.py Wed Oct 09 18:34:30 2013 +0200 @@ -6,7 +6,8 @@ # Copyright (c) 2008 Josh Davis ( http://www.josh-davis.org ), # Alex Martelli ( http://www.aleax.it ) # -# Ported from C code written by Laurent Haan ( http://www.progressive-coding.com ) +# Ported from C code written by Laurent Haan +# ( http://www.progressive-coding.com ) # # Licensed under the Apache License, Version 2.0 # http://www.apache.org/licenses/ @@ -46,10 +47,12 @@ @return stripped data (bytes) """ if len(b) % 16 or not b: - raise ValueError("Data of len {0} can't be PCKS7-padded".format(len(b))) + raise ValueError( + "Data of len {0} can't be PCKS7-padded".format(len(b))) numpads = b[-1] if numpads > 16: - raise ValueError("Data ending with {0} can't be PCKS7-padded".format(b[-1])) + raise ValueError( + "Data ending with {0} can't be PCKS7-padded".format(b[-1])) return b[:-numpads] @@ -164,7 +167,8 @@ """ Private method performing Rijndael's key schedule rotate operation. - Rotate the data word eight bits to the left: eg, rotate(1d2c3a4f) == 2c3a4f1d. + Rotate the data word eight bits to the left: eg, + rotate(1d2c3a4f) == 2c3a4f1d. @param data data of size 4 (bytearray) """ @@ -228,12 +232,14 @@ t = self.__core(t, rconIteration) rconIteration += 1 # For 256-bit keys, we add an extra sbox to the calculation - if size == self.KeySize["SIZE_256"] and ((currentSize % size) == 16): + if size == self.KeySize["SIZE_256"] and \ + ((currentSize % size) == 16): for l in range(4): t[l] = self.__getSBoxValue(t[l]) # We XOR t with the four-byte block 16, 24, 32 bytes before the new - # expanded key. This becomes the next four bytes in the expanded key. + # expanded key. This becomes the next four bytes in the expanded + # key. for m in range(4): expandedKey[currentSize] = \ expandedKey[currentSize - size] ^ t[m] @@ -270,7 +276,8 @@ def __galois_multiplication(self, a, b): """ - Private method to perform a Galois multiplication of 8 bit characters a and b. + Private method to perform a Galois multiplication of 8 bit characters + a and b. @param a first factor (byte) @param b second factor (byte) @@ -291,8 +298,8 @@ def __subBytes(self, state, isInv): """ - Private method to substitute all the values from the state with the value in - the SBox using the state value as index for the SBox. + Private method to substitute all the values from the state with the + value in the SBox using the state value as index for the SBox. @param state state to be worked on (bytearray) @param isInv flag indicating an inverse operation (boolean) @@ -366,7 +373,8 @@ # galois multiplication of 1 column of the 4x4 matrix def __mixColumn(self, column, isInv): """ - Private method to perform a galois multiplication of 1 column the 4x4 matrix. + Private method to perform a galois multiplication of 1 column the + 4x4 matrix. @param column column to be worked on (bytearray) @param isInv flag indicating an inverse operation (boolean) @@ -392,7 +400,8 @@ def __aes_round(self, state, roundKey): """ - Private method to apply the 4 operations of the forward round in sequence. + Private method to apply the 4 operations of the forward round in + sequence. @param state state to be worked on (bytearray) @param roundKey round key to be used (bytearray) @@ -406,7 +415,8 @@ def __aes_invRound(self, state, roundKey): """ - Private method to apply the 4 operations of the inverse round in sequence. + Private method to apply the 4 operations of the inverse round in + sequence. @param state state to be worked on (bytearray) @param roundKey round key to be used (bytearray) @@ -420,15 +430,19 @@ def __aes_main(self, state, expandedKey, nbrRounds): """ - Private method to perform the initial operations, the standard round, and the - final operations of the forward AES, creating a round key for each round. + Private method to do the AES encryption for one round. + + Perform the initial operations, the standard round, and the + final operations of the forward AES, creating a round key for + each round. @param state state to be worked on (bytearray) @param expandedKey expanded key to be used (bytearray) @param nbrRounds number of rounds to be done (integer) @return modified state (bytearray) """ - state = self.__addRoundKey(state, self.__createRoundKey(expandedKey, 0)) + state = self.__addRoundKey( + state, self.__createRoundKey(expandedKey, 0)) i = 1 while i < nbrRounds: state = self.__aes_round( @@ -442,8 +456,11 @@ def __aes_invMain(self, state, expandedKey, nbrRounds): """ - Private method to perform the initial operations, the standard round, and the - final operations of the inverse AES, creating a round key for each round. + Private method to do the inverse AES encryption for one round. + + Perform the initial operations, the standard round, and the + final operations of the inverse AES, creating a round key for + each round. @param state state to be worked on (bytearray) @param expandedKey expanded key to be used (bytearray) @@ -459,13 +476,14 @@ i -= 1 state = self.__shiftRows(state, True) state = self.__subBytes(state, True) - state = self.__addRoundKey(state, self.__createRoundKey(expandedKey, 0)) + state = self.__addRoundKey( + state, self.__createRoundKey(expandedKey, 0)) return state def encrypt(self, iput, key, size): """ - Public method to encrypt a 128 bit input block against the given key of size - specified. + Public method to encrypt a 128 bit input block against the given key + of size specified. @param iput input data (bytearray) @param key key to be used (bytes or bytearray) @@ -520,8 +538,8 @@ # decrypts a 128 bit input block against the given key of size specified def decrypt(self, iput, key, size): """ - Public method to decrypt a 128 bit input block against the given key of size - specified. + Public method to decrypt a 128 bit input block against the given key + of size specified. @param iput input data (bytearray) @param key key to be used (bytes or bytearray) @@ -801,7 +819,8 @@ if mode == AESModeOfOperation.ModeOfOperation["CBC"]: data = append_PKCS7_padding(data) keysize = len(key) - assert keysize in AES.KeySize.values(), 'invalid key size: {0}'.format(keysize) + assert keysize in AES.KeySize.values(), \ + 'invalid key size: {0}'.format(keysize) # create a new iv using random data iv = bytearray([i for i in os.urandom(16)]) moo = AESModeOfOperation() @@ -817,7 +836,8 @@ Module function to decrypt the given data with the given key. @param key key to be used for decryption (bytes) - @param data data to be decrypted (with initialization vector prepended) (bytes) + @param data data to be decrypted (with initialization vector prepended) + (bytes) @param mode mode of operations (0, 1 or 2) @return decrypted data (bytes) @exception ValueError key size is invalid or decrypted data is invalid
--- a/Utilities/crypto/py3PBKDF2.py Tue Oct 08 19:52:11 2013 +0200 +++ b/Utilities/crypto/py3PBKDF2.py Wed Oct 09 18:34:30 2013 +0200 @@ -40,7 +40,8 @@ return hash -def hashPasswordTuple(password, digestMod=hashlib.sha512, iterations=10000, saltSize=32): +def hashPasswordTuple(password, digestMod=hashlib.sha512, iterations=10000, + saltSize=32): """ Module function to hash a password according to the PBKDF2 specification. @@ -58,7 +59,8 @@ return digestname, iterations, salt, hash -def hashPassword(password, digestMod=hashlib.sha512, iterations=10000, saltSize=32): +def hashPassword(password, digestMod=hashlib.sha512, iterations=10000, + saltSize=32): """ Module function to hash a password according to the PBKDF2 specification. @@ -94,13 +96,14 @@ digestname, iterations, salt, pwHash = hash.split(Delimiter) except ValueError: raise ValueError( - "Expected hash encoded password in format "\ - "'digestmod{0}iterations{0}salt{0}hashed_password".format(Delimiter)) + "Expected hash encoded password in format " + "'digestmod{0}iterations{0}salt{0}hashed_password" + .format(Delimiter)) if digestname not in Hashes.keys(): raise ValueError( - "Unsupported hash algorithm '{0}' for hash encoded password '{1}'.".format( - digestname, hash)) + "Unsupported hash algorithm '{0}' for hash encoded password '{1}'." + .format(digestname, hash)) iterations = int(iterations) salt = base64.b64decode(salt.encode("ascii")) @@ -117,8 +120,8 @@ @param hashParameters hash parameters in the form 'digestmod$iterations$salt' (string) @return hashed password (bytes) - @exception ValueError the hash parameters string is not of the expected format - or the digest is not one of the known ones + @exception ValueError the hash parameters string is not of the expected + format or the digest is not one of the known ones """ try: digestname, iterations, salt = hashParameters.split(Delimiter) @@ -129,8 +132,8 @@ if digestname not in Hashes.keys(): raise ValueError( - "Unsupported hash algorithm '{0}' for hash parameters '{1}'.".format( - digestname, hash)) + "Unsupported hash algorithm '{0}' for hash parameters '{1}'." + .format(digestname, hash)) iterations = int(iterations) salt = base64.b64decode(salt.encode("ascii"))
--- a/Utilities/py3flakes/checker.py Tue Oct 08 19:52:11 2013 +0200 +++ b/Utilities/py3flakes/checker.py Wed Oct 09 18:34:30 2013 +0200 @@ -279,8 +279,9 @@ if self.traceTree: print(' ' * self.nodeDepth + node.__class__.__name__) self.nodeDepth += 1 - if self.futuresAllowed and not \ - (isinstance(node, ast.ImportFrom) or self.isDocstring(node)): + if self.futuresAllowed and \ + not (isinstance(node, ast.ImportFrom) or + self.isDocstring(node)): self.futuresAllowed = False nodeType = node.__class__.__name__.upper() try: @@ -322,7 +323,8 @@ ''' Called when a binding is altered. - @param lineno line of the statement responsible for the change (integer) + @param lineno line of the statement responsible for the change + (integer) @param value the optional new value, a Binding instance, associated with the binding; if None, the binding is deleted if it exists @param reportRedef flag indicating if rebinding while unused will be @@ -333,7 +335,8 @@ and not self.scope.get(value.name).is_property and not value.is_property): self.report(messages.RedefinedFunction, - lineno, value.name, self.scope[value.name].source.lineno) + lineno, value.name, + self.scope[value.name].source.lineno) if not isinstance(self.scope, ClassScope): for scope in self.scopeStack[::-1]: @@ -345,7 +348,8 @@ value.fullName == existing.fullName) and \ reportRedef: self.report(messages.RedefinedWhileUnused, - lineno, value.name, scope[value.name].source.lineno) + lineno, value.name, + scope[value.name].source.lineno) if isinstance(value, UnBinding): try: @@ -446,10 +450,12 @@ # the special name __path__ is valid only in packages pass else: - self.report(messages.UndefinedName, node.lineno, node.id) + self.report(messages.UndefinedName, + node.lineno, node.id) elif isinstance(node.ctx, (ast.Store, ast.AugStore)): # if the name hasn't already been defined in the current scope - if isinstance(self.scope, FunctionScope) and node.id not in self.scope: + if isinstance(self.scope, FunctionScope) and \ + node.id not in self.scope: # for each function or module scope above us for scope in self.scopeStack[:-1]: if not isinstance(scope, (FunctionScope, ModuleScope)): @@ -486,8 +492,8 @@ else: self.addBinding(node.lineno, UnBinding(node.id, node)) else: - # must be a Param context -- this only happens for names in function - # arguments, but these aren't dispatched through here + # must be a Param context -- this only happens for names in + # function arguments, but these aren't dispatched through here raise RuntimeError( "Got impossible expression context: {0:r}".format(node.ctx,)) @@ -518,7 +524,8 @@ addArgs(arg.arg) else: if arg.arg in args: - self.report(messages.DuplicateArgument, node.lineno, arg.arg) + self.report(messages.DuplicateArgument, + node.lineno, arg.arg) args.append(arg.arg) def checkUnusedAssignments(): @@ -540,7 +547,8 @@ if node.args.kwarg: args.append(node.args.kwarg) for name in args: - self.addBinding(node.lineno, Argument(name, node), reportRedef=False) + self.addBinding(node.lineno, Argument(name, node), + reportRedef=False) if isinstance(node.body, list): self.handleBody(node) else: @@ -628,8 +636,8 @@ self.handleNode(target, node) def AUGASSIGN(self, node): - # AugAssign is awkward: must set the context explicitly and visit twice, - # once with AugLoad context, once with AugStore context + # AugAssign is awkward: must set the context explicitly and + # visit twice, once with AugLoad context, once with AugStore context node.target.ctx = ast.AugLoad() self.handleNode(node.target, node) self.handleNode(node.value, node)
--- a/Utilities/py3flakes/messages.py Tue Oct 08 19:52:11 2013 +0200 +++ b/Utilities/py3flakes/messages.py Wed Oct 09 18:34:30 2013 +0200 @@ -38,7 +38,8 @@ @return string representation of the object (string) """ return '{0}:{1} {2}'.format( - self.filename, self.lineno, self.message.format(*self.message_args)) + self.filename, self.lineno, + self.message.format(*self.message_args)) def getMessageData(self): """ @@ -47,7 +48,8 @@ @return tuple containing file name, line number and message (string, integer, string) """ - return (self.filename, self.lineno, self.message.format(*self.message_args)) + return (self.filename, self.lineno, + self.message.format(*self.message_args)) class UnusedImport(Message): @@ -150,7 +152,8 @@ """ Class defining the "Undefined Export" message. """ - message = QCoreApplication.translate('py3Flakes', 'Undefined name {0!r} in __all__.') + message = QCoreApplication.translate( + 'py3Flakes', 'Undefined name {0!r} in __all__.') def __init__(self, filename, lineno, name): """
--- a/eric5_api.py Tue Oct 08 19:52:11 2013 +0200 +++ b/eric5_api.py Wed Oct 09 18:34:30 2013 +0200 @@ -108,8 +108,8 @@ try: opts, args = getopt.getopt(sys.argv[1:], "b:e:hl:o:pRrt:Vx:", - ["base=", "eol=", "exclude=", "exclude-file=", "extension=", "help", - "language=", "output=", "private", "recursive", + ["base=", "eol=", "exclude=", "exclude-file=", "extension=", + "help", "language=", "output=", "private", "recursive", "version", ]) except getopt.error: usage()