Sun, 19 Jun 2011 17:50:39 +0200
Removed some obsolete code (forgot about it) and made some PEP-8 related fixes.
--- a/Plugins/CheckerPlugins/Pep8/Pep8Dialog.py Sun Jun 19 17:24:22 2011 +0200 +++ b/Plugins/CheckerPlugins/Pep8/Pep8Dialog.py Sun Jun 19 17:50:39 2011 +0200 @@ -512,8 +512,6 @@ "PEP8/ExcludeMessages", pep8.DEFAULT_IGNORE)) self.includeMessagesEdit.setText(Preferences.Prefs.settings.value( "PEP8/IncludeMessages")) -## self.repeatCheckBox.setChecked(Preferences.toBool( -## Preferences.Prefs.settings.value("PEP8/RepeatMessages"))) self.fixIssuesEdit.setText(Preferences.Prefs.settings.value( "PEP8/FixCodes")) self.fixIssuesCheckBox.setChecked(Preferences.toBool( @@ -531,8 +529,6 @@ self.excludeMessagesEdit.text()) Preferences.Prefs.settings.setValue("PEP8/IncludeMessages", self.includeMessagesEdit.text()) -## Preferences.Prefs.settings.setValue("PEP8/RepeatMessages", -## self.repeatCheckBox.isChecked()) Preferences.Prefs.settings.setValue("PEP8/FixCodes", self.fixIssuesEdit.text()) Preferences.Prefs.settings.setValue("PEP8/FixIssues",
--- a/Preferences/ConfigurationPages/SecurityPage.py Sun Jun 19 17:24:22 2011 +0200 +++ b/Preferences/ConfigurationPages/SecurityPage.py Sun Jun 19 17:50:39 2011 +0200 @@ -76,7 +76,7 @@ if checked: dlg = MasterPasswordEntryDialog("", self) if dlg.exec_() == QDialog.Accepted: - Preferences.setUser("MasterPassword", + Preferences.setUser("MasterPassword", dlg.getMasterPassword()) self.masterPasswordButton.setEnabled(True) self.__newPassword = dlg.getMasterPassword() @@ -93,7 +93,7 @@ """ dlg = MasterPasswordEntryDialog(Preferences.getUser("MasterPassword"), self) if dlg.exec_() == QDialog.Accepted: - Preferences.setUser("MasterPassword", + Preferences.setUser("MasterPassword", dlg.getMasterPassword()) if self.__oldUseMasterPassword != self.masterPasswordCheckBox.isChecked(): @@ -104,6 +104,7 @@ self.__configDlg.masterPasswordChanged.emit( dlg.getCurrentPassword(), dlg.getMasterPassword()) + def create(dlg): """ Module function to create the configuration page.
--- a/Utilities/PasswordChecker.py Sun Jun 19 17:24:22 2011 +0200 +++ b/Utilities/PasswordChecker.py Sun Jun 19 17:50:39 2011 +0200 @@ -101,7 +101,7 @@ "penalty": -10, } - # number of lowercase letters, such as a-z + # number of lowercase letters, such as a-z self.lowercaseLetters = { "count": 0, "minimum": 1, @@ -284,7 +284,7 @@ self.passwordLength["count"] = len(password) self.recommendedPasswordLength["count"] = len(password) - # Loop through password to check for Symbol, Numeric, Lowercase + # Loop through password to check for Symbol, Numeric, Lowercase # and Uppercase pattern matches for index in range(len(password)): if self.uppercaseRe.match(password[index]): @@ -311,7 +311,7 @@ found = True break if not found: - uniqueCharacters.append(password[index1] ) + uniqueCharacters.append(password[index1]) # calculate a redundancy number self.redundancy["value"] = len(password) / len(uniqueCharacters) @@ -319,7 +319,7 @@ # 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(); + lowercasedPassword = password.lower() if self.passwordLength["count"] >= self.sequentialLetters["length"]: for index in range(len(self.sequentialLetters["data"]) - \ @@ -348,7 +348,7 @@ patternsMatched = [] if self.passwordLength["count"] >= self.keyboardPatterns["length"]: for pattern in self.keyboardPatterns["data"]: - for index in range(len(pattern)- self.keyboardPatterns["length"] + 1): + 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: @@ -394,7 +394,7 @@ self.score["count"] += self.passwordLength["rating"] # recommendedPasswordLength - # Credit reaching the recommended password length or put a + # Credit reaching the recommended password length or put a # penalty on it if self.passwordLength["count"] >= self.recommendedPasswordLength["minimum"]: self.recommendedPasswordLength["rating"] = \
--- a/Utilities/crypto/__init__.py Sun Jun 19 17:24:22 2011 +0200 +++ b/Utilities/crypto/__init__.py Sun Jun 19 17:50:39 2011 +0200 @@ -7,10 +7,6 @@ Package implementing cryptography related functionality. """ -##import os -##import sys -##sys.path.insert(1, os.path.join(os.path.dirname(__file__), "../..")) -## import random import base64 @@ -21,8 +17,6 @@ from .py3AES import encryptData, decryptData from .py3PBKDF2 import verifyPassword, hashPasswordTuple, rehashPassword -##from py3AES import encryptData, decryptData -##from py3PBKDF2 import verifyPassword, hashPasswordTuple, rehashPassword import Preferences @@ -64,51 +58,6 @@ return base64.b64decode(epw[3:].encode("ascii"))[32:-32].decode("utf-8") -##def passwordHash(pw): -## """ -## Module function to calculate the hash for the given password. -## -## This is done by hashing it 65.000 times with SHA1 in order to make brute force -## attacks a bit harder. -## -## @param pw password to be hashed (string) -## @return password hash (string) -## """ -## hash = QCryptographicHash.hash(QByteArray(pw.encode("utf-8")), -## QCryptographicHash.Sha1) -## for i in range(65000): -## hash = QCryptographicHash.hash(hash, QCryptographicHash.Sha1) -## return base64.b64encode(bytes(hash)).decode("ascii") -## -## -##def generateCryptoKey(pw, keyLength=32): -## """ -## Module function to calculate a crypto key given a password. -## -## This is done by hashing the password 32.000 times MD5 and 32.000 times with MD4. -## These hashes are concatenated and and the first bytes are taken depending on the -## desired key length. -## -## @param pw password to be used (string) -## @param keyLength length of the desired key (16, 24 or 32) (default is -## 32 bytes suitable for AES256 encryption) -## @return crypto key (bytes) -## """ -## if keyLength not in [16, 24, 32]: -## raise ValueError(QCoreApplication.translate( -## "Crypto", "Illegal key length ({0}) given.").format(keyLength)) -## -## hash1 = QCryptographicHash.hash(QByteArray(pw.encode("utf-8")), -## QCryptographicHash.Md5) -## hash2 = QCryptographicHash.hash(QByteArray(pw.encode("utf-8")), -## QCryptographicHash.Md4) -## for i in range(32000): -## hash1 = QCryptographicHash.hash(hash1, QCryptographicHash.Md5) -## hash2 = QCryptographicHash.hash(hash2, QCryptographicHash.Md4) -## hash = (hash1 + hash2)[:keyLength] -## return bytes(hash) - - def __getMasterPassword(): """ Private module function to get the password from the user. @@ -129,12 +78,12 @@ else: E5MessageBox.warning(None, QCoreApplication.translate("Crypto", "Master Password"), - QCoreApplication.translate("Crypto", + QCoreApplication.translate("Crypto", """The given password is incorrect.""")) else: E5MessageBox.critical(None, QCoreApplication.translate("Crypto", "Master Password"), - QCoreApplication.translate("Crypto", + QCoreApplication.translate("Crypto", """There is no master password registered.""")) except ValueError as why: E5MessageBox.warning(None,
--- a/Utilities/crypto/py3PBKDF2.py Sun Jun 19 17:24:22 2011 +0200 +++ b/Utilities/crypto/py3PBKDF2.py Sun Jun 19 17:50:39 2011 +0200 @@ -23,6 +23,7 @@ Delimiter = "$" + def pbkdf2(password, salt, iterations, digestMod): """ Module function to hash a password according to the PBKDF2 specification.
--- a/install.py Sun Jun 19 17:24:22 2011 +0200 +++ b/install.py Sun Jun 19 17:50:39 2011 +0200 @@ -392,7 +392,7 @@ # copy the various parts of eric5 copyTree(sourceDir, cfg['ericDir'], ['*.py', '*.pyc', '*.pyo', '*.pyw'], - ['{1}{0}Examples'.format(os.sep, sourceDir)], + ['{1}{0}Examples'.format(os.sep, sourceDir)], excludePatterns=["eric5config.py*"]) copyTree(sourceDir, cfg['ericDir'], ['*.rb'], ['{1}{0}Examples'.format(os.sep, sourceDir)])