diff --git a/README.md b/README.md index fb5c6f0..2f32597 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,7 @@ sudo apt install python3-lxml pip install pykeepass ``` -Quickstart -------- +# Quickstart General database manipulation @@ -198,19 +197,21 @@ OTP codes ``` -Tests and Debugging -------------------- +# Tests and Debugging Run tests with `python tests/tests.py` or `python tests/tests.py SomeSpecificTest` Enable debugging when doing tests in console: - >>> from pykeepass.pykeepass import debug_setup - >>> debug_setup() - >>> kp.entries[0] - DEBUG:pykeepass.pykeepass:xpath query: //Entry - DEBUG:pykeepass.pykeepass:xpath query: (ancestor::Group)[last()] - DEBUG:pykeepass.pykeepass:xpath query: (ancestor::Group)[last()] - DEBUG:pykeepass.pykeepass:xpath query: String/Key[text()="Title"]/../Value - DEBUG:pykeepass.pykeepass:xpath query: String/Key[text()="UserName"]/../Value - Entry: "root_entry (foobar_user)" +``` python +>>> from pykeepass.pykeepass import debug_setup +>>> debug_setup() +>>> kp.entries[0] +DEBUG:pykeepass.pykeepass:xpath query: //Entry +DEBUG:pykeepass.pykeepass:xpath query: (ancestor::Group)[last()] +DEBUG:pykeepass.pykeepass:xpath query: (ancestor::Group)[last()] +DEBUG:pykeepass.pykeepass:xpath query: String/Key[text()="Title"]/../Value +DEBUG:pykeepass.pykeepass:xpath query: String/Key[text()="UserName"]/../Value +Entry: "root_entry (foobar_user)" +``` + diff --git a/pykeepass/__init__.py b/pykeepass/__init__.py index 0bed1cc..a7a093a 100644 --- a/pykeepass/__init__.py +++ b/pykeepass/__init__.py @@ -6,7 +6,7 @@ from .entry import Entry from .group import Group from .attachment import Attachment -from .icons import icons as icons +from .icons import icons from .version import __version__ __all__ = ["PyKeePass", "Entry", "Group", "Attachment", "icons", "create_database", "__version__"] diff --git a/pykeepass/icons.py b/pykeepass/icons.py index bcaefed..691cb87 100644 --- a/pykeepass/icons.py +++ b/pykeepass/icons.py @@ -145,146 +145,148 @@ CERTIFICATE = '67' SMARTPHONE = '68' -icons = { - "Key": "0", - "World": "1", - "Warning": "2", - "NetworkServer": "3", - "MarkedDirectory": "4", - "UserCommunication": "5", - "Parts": "6", - "Notepad": "7", - "WorldSocket": "8", - "Identity": "9", - "PaperReady": "10", - "Digicam": "11", - "IRCommunication": "12", - "MultiKeys": "13", - "Energy": "14", - "Scanner": "15", - "WorldStar": "16", - "CDRom": "17", - "Monitor": "18", - "EMail": "19", - "Configuration": "20", - "ClipboardReady": "21", - "PaperNew": "22", - "Screen": "23", - "EnergyCareful": "24", - "EMailBox": "25", - "Disk": "26", - "Drive": "27", - "PaperQ": "28", - "TerminalEncrypted": "29", - "Console": "30", - "Printer": "31", - "ProgramIcons": "32", - "Run": "33", - "Settings": "34", - "WorldComputer": "35", - "Archive": "36", - "Homebanking": "37", - "DriveWindows": "38", - "Clock": "39", - "EMailSearch": "40", - "PaperFlag": "41", - "Memory": "42", - "TrashBin": "43", - "Note": "44", - "Expired": "45", - "Info": "46", - "Package": "47", - "Folder": "48", - "FolderOpen": "49", - "FolderPackage": "50", - "LockOpen": "51", - "PaperLocked": "52", - "Checked": "53", - "Pen": "54", - "Thumbnail": "55", - "Book": "56", - "List": "57", - "UserKey": "58", - "Tool": "59", - "Home": "60", - "Star": "61", - "Tux": "62", - "Feather": "63", - "Apple": "64", - "Wiki": "65", - "Money": "66", - "Certificate": "67", - "BlackBerry": "68", +from types import SimpleNamespace + +icons = SimpleNamespace( + Key = '0', + World = '1', + Warning = '2', + NetworkServer = '3', + MarkedDirectory = '4', + UserCommunication = '5', + Parts = '6', + Notepad = '7', + WorldSocket = '8', + Identity = '9', + PaperReady = '10', + Digicam = '11', + IRCommunication = '12', + MultiKeys = '13', + Energy = '14', + Scanner = '15', + WorldStar = '16', + CDRom = '17', + Monitor = '18', + EMail = '19', + Configuration = '20', + ClipboardReady = '21', + PaperNew = '22', + Screen = '23', + EnergyCareful = '24', + EMailBox = '25', + Disk = '26', + Drive = '27', + PaperQ = '28', + TerminalEncrypted = '29', + Console = '30', + Printer = '31', + ProgramIcons = '32', + Run = '33', + Settings = '34', + WorldComputer = '35', + Archive = '36', + Homebanking = '37', + DriveWindows = '38', + Clock = '39', + EMailSearch = '40', + PaperFlag = '41', + Memory = '42', + TrashBin = '43', + Note = '44', + Expired = '45', + Info = '46', + Package = '47', + Folder = '48', + FolderOpen = '49', + FolderPackage = '50', + LockOpen = '51', + PaperLocked = '52', + Checked = '53', + Pen = '54', + Thumbnail = '55', + Book = '56', + List = '57', + UserKey = '58', + Tool = '59', + Home = '60', + Star = '61', + Tux = '62', + Feather = '63', + Apple = '64', + Wiki = '65', + Money = '66', + Certificate = '67', + BlackBerry = '68', # deprecated icons - "KEY": "0", - "GLOBE": "1", - "WARNING_SIGN": "2", - "SERVER": "3", - "PINNED_NOTE": "4", - "SPEECH_BUBBLE": "5", - "SQUARES": "6", - "HANDWRITTEN_NOTE": "7", - "GLOBE_PLUG": "8", - "BUSINESS_CARD": "9", - "GREEN_AND_WHITE_THINGY": "10", - "CAMERA": "11", - "INFRARED": "12", - "KEYS": "13", - "POWER_PLUG": "14", - "FLATBED_SCANNER": "15", - "GLOBE_STAR": "16", - "CD_ROM": "17", - "MONITOR": "18", - "ENVELOPE": "19", - "GEAR": "20", - "CHECKLIST": "21", - "NOTEPAD": "22", - "DESKTOP": "23", - "POWER_FLASH": "24", - "FOLDER_ENVELOPE": "25", - "FLOPPY_DISK": "26", - "SERVER_2": "27", - "GREEN_DOT": "28", - "MONITOR_KEY": "29", - "SHELL": "30", - "PRINTER": "31", - "DASHBOARD": "32", - "CROATIA": "33", - "WRENCH": "34", - "PC_INTERNET": "35", - "ZIP_FILE": "36", - "PERCENT_SIGN": "37", - "SAMBA_SHARE": "38", - "CLOCK": "39", - "SEARCH": "40", - "USED_TAMPON": "41", - "MEMORY_STICK": "42", - "RECYCLE_BIN": "43", - "POST_IT": "44", - "RED_CROSS": "45", - "INFO_SIGN": "46", - "CARDBOARD": "47", - "FOLDER": "48", - "FOLDER_OPEN": "49", - "FOLDER_CUBE": "50", - "LOCK_OPEN": "51", - "LOCK_CLOSED": "52", - "GREEN_CHECKMARK": "53", - "FEATHER_PEN": "54", - "POLAROID_PICTURE": "55", - "BOOK_OPENED": "56", - "UI": "57", - "MANAGER": "58", - "HAMMER": "59", - "HOUSE": "60", - "STAR": "61", - "PENGUIN": "62", - "FEATHER": "63", - "APPLE": "64", - "WIKIPEDIA": "65", - "DOLLAR_SIGN": "66", - "CERTIFICATE": "67", - "SMARTPHONE": "68", -} \ No newline at end of file + KEY = '0', + GLOBE = '1', + WARNING_SIGN = '2', + SERVER = '3', + PINNED_NOTE = '4', + SPEECH_BUBBLE = '5', + SQUARES = '6', + HANDWRITTEN_NOTE = '7', + GLOBE_PLUG = '8', + BUSINESS_CARD = '9', + GREEN_AND_WHITE_THINGY = '10', + CAMERA = '11', + INFRARED = '12', + KEYS = '13', + POWER_PLUG = '14', + FLATBED_SCANNER = '15', + GLOBE_STAR = '16', + CD_ROM = '17', + MONITOR = '18', + ENVELOPE = '19', + GEAR = '20', + CHECKLIST = '21', + NOTEPAD = '22', + DESKTOP = '23', + POWER_FLASH = '24', + FOLDER_ENVELOPE = '25', + FLOPPY_DISK = '26', + SERVER_2 = '27', + GREEN_DOT = '28', + MONITOR_KEY = '29', + SHELL = '30', + PRINTER = '31', + DASHBOARD = '32', + CROATIA = '33', + WRENCH = '34', + PC_INTERNET = '35', + ZIP_FILE = '36', + PERCENT_SIGN = '37', + SAMBA_SHARE = '38', + CLOCK = '39', + SEARCH = '40', + USED_TAMPON = '41', + MEMORY_STICK = '42', + RECYCLE_BIN = '43', + POST_IT = '44', + RED_CROSS = '45', + INFO_SIGN = '46', + CARDBOARD = '47', + FOLDER = '48', + FOLDER_OPEN = '49', + FOLDER_CUBE = '50', + LOCK_OPEN = '51', + LOCK_CLOSED = '52', + GREEN_CHECKMARK = '53', + FEATHER_PEN = '54', + POLAROID_PICTURE = '55', + BOOK_OPENED = '56', + UI = '57', + MANAGER = '58', + HAMMER = '59', + HOUSE = '60', + STAR = '61', + PENGUIN = '62', + FEATHER = '63', + APPLE = '64', + WIKIPEDIA = '65', + DOLLAR_SIGN = '66', + CERTIFICATE = '67', + SMARTPHONE = '68', +) \ No newline at end of file