| 1 | import abcscip-python python python-stdlib 3.11 abc/__init__: |
| 2 | import configparserscip-python python python-stdlib 3.11 configparser/__init__: |
| 3 | import osscip-python python python-stdlib 3.11 os/__init__: |
| 4 | from base64scip-python python python-stdlib 3.11 base64/__init__: import decodebytesscip-python python python-stdlib 3.11 base64/decodebytes()., encodebytesscip-python python python-stdlib 3.11 base64/encodebytes(). |
| 5 | |
| 6 | from jaraco.classesscip-python python keyrings.alt 5.0.2 `jaraco.classes`/__init__: import propertiesscip-python python keyrings.alt 5.0.2 `jaraco.classes.properties`/__init__: |
| 7 | from keyring.backendscip-python python keyring 25.7.0 `keyring.backend`/__init__: import KeyringBackend |
| 8 | from keyring.errorsscip-python python keyring 25.7.0 `keyring.errors`/__init__: import PasswordDeleteError |
| 9 | from keyring.utilscip-python python keyring 25.7.0 `keyring.util`/__init__: import platform_scip-python python keyring 25.7.0 `keyring.util.platform_`/__init__: |
| 10 | |
| 11 | from .escapescip-python python keyrings.alt 5.0.2 escape/__init__: import escape as escape_for_iniscip-python python keyrings.alt 5.0.2 `keyrings.alt.escape`/escape(). |
| 12 | |
| 13 | |
| 14 | class FileBackedscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/FileBacked#: |
| 15 | @abcscip-python python python-stdlib 3.11 abc/__init__:.abstractpropertyscip-python python python-stdlib 3.11 abc/abstractproperty# |
| 16 | def filenamescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/FileBacked#filename().(selfscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/FileBacked#filename().(self)): |
| 17 | """ |
| 18 | The filename used to store the passwords. |
| 19 | """ |
| 20 | |
| 21 | @propertiesscip-python python keyrings.alt 5.0.2 `jaraco.classes.properties`/__init__:.NonDataProperty |
| 22 | def file_pathscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/FileBacked#file_path().(selfscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/FileBacked#file_path().(self)): |
| 23 | """ |
| 24 | The path to the file where passwords are stored. This property |
| 25 | may be overridden by the subclass or at the instance level. |
| 26 | """ |
| 27 | return osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..joinscip-python python python-stdlib 3.11 genericpath/exists().(platform_scip-python python keyring 25.7.0 `keyring.util.platform_`/__init__:.data_root(), selfscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/FileBacked#file_path().(self).filenamescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/FileBacked#filename().) |
| 28 | |
| 29 | @abcscip-python python python-stdlib 3.11 abc/__init__:.abstractpropertyscip-python python python-stdlib 3.11 abc/abstractproperty# |
| 30 | def schemescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/FileBacked#scheme().(selfscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/FileBacked#scheme().(self)): |
| 31 | """ |
| 32 | The encryption scheme used to store the passwords. |
| 33 | """ |
| 34 | return 'not defined' |
| 35 | |
| 36 | @abcscip-python python python-stdlib 3.11 abc/__init__:.abstractpropertyscip-python python python-stdlib 3.11 abc/abstractproperty# |
| 37 | def versionscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/FileBacked#version().(selfscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/FileBacked#version().(self)): |
| 38 | """ |
| 39 | The encryption version used to store the passwords. |
| 40 | """ |
| 41 | return None |
| 42 | |
| 43 | @propertiesscip-python python keyrings.alt 5.0.2 `jaraco.classes.properties`/__init__:.NonDataProperty |
| 44 | def file_versionscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/FileBacked#file_version().(selfscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/FileBacked#file_version().(self)): |
| 45 | """ |
| 46 | The encryption version used in file to store the passwords. |
| 47 | """ |
| 48 | return None |
| 49 | |
| 50 | def __repr__scip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/FileBacked#__repr__().(selfscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/FileBacked#__repr__().(self)): |
| 51 | tmpl = ( |
| 52 | "<{self.__class__.__name__} with {self.scheme} " |
| 53 | "v.{self.version} at {self.file_path}>" |
| 54 | ) |
| 55 | return tmpl.format(**locals()) |
| 56 | |
| 57 | |
| 58 | class Keyringscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#(FileBackedscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/FileBacked#, KeyringBackend): |
| 59 | """ |
| 60 | BaseKeyring is a file-based implementation of keyring. |
| 61 | |
| 62 | This keyring stores the password directly in the file and provides methods |
| 63 | which may be overridden by subclasses to support |
| 64 | encryption and decryption. The encrypted payload is stored in base64 |
| 65 | format. |
| 66 | """ |
| 67 | |
| 68 | @abcscip-python python python-stdlib 3.11 abc/__init__:.abstractmethodscip-python python python-stdlib 3.11 abc/abstractmethod(). |
| 69 | def encryptscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#encrypt().(selfscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#encrypt().(self), passwordscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#encrypt().(password), assocscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#encrypt().(assoc)=None): |
| 70 | """ |
| 71 | Given a password (byte string) and assoc (byte string, optional), |
| 72 | return an encrypted byte string. |
| 73 | |
| 74 | assoc provides associated data (typically: service and username) |
| 75 | """ |
| 76 | |
| 77 | @abcscip-python python python-stdlib 3.11 abc/__init__:.abstractmethodscip-python python python-stdlib 3.11 abc/abstractmethod(). |
| 78 | def decryptscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#decrypt().(selfscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#decrypt().(self), password_encryptedscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#decrypt().(password_encrypted), assocscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#decrypt().(assoc)=None): |
| 79 | """ |
| 80 | Given a password encrypted by a previous call to `encrypt`, and assoc |
| 81 | (byte string, optional), return the original byte string. |
| 82 | |
| 83 | assoc provides associated data (typically: service and username) |
| 84 | """ |
| 85 | |
| 86 | def get_passwordscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#get_password().(selfscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#get_password().(self), servicescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#get_password().(service), usernamescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#get_password().(username)): |
| 87 | """ |
| 88 | Read the password from the file. |
| 89 | """ |
| 90 | assoc = selfscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#get_password().(self)._generate_assocscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#_generate_assoc().(servicescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#get_password().(service), usernamescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#get_password().(username)) |
| 91 | servicescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#get_password().(service) = escape_for_iniscip-python python keyrings.alt 5.0.2 `keyrings.alt.escape`/escape().(servicescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#get_password().(service)) |
| 92 | usernamescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#get_password().(username) = escape_for_iniscip-python python keyrings.alt 5.0.2 `keyrings.alt.escape`/escape().(usernamescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#get_password().(username)) |
| 93 | |
| 94 | # load the passwords from the file |
| 95 | config = configparserscip-python python python-stdlib 3.11 configparser/__init__:.RawConfigParserscip-python python python-stdlib 3.11 configparser/RawConfigParser#() |
| 96 | if osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..existsscip-python python python-stdlib 3.11 genericpath/exists().(selfscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#get_password().(self).file_pathscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/FileBacked#file_path().): |
| 97 | config.readscip-python python python-stdlib 3.11 configparser/RawConfigParser#read().(selfscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#get_password().(self).file_pathscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/FileBacked#file_path()., encodingscip-python python python-stdlib 3.11 configparser/RawConfigParser#read().(encoding)='utf-8') |
| 98 | |
| 99 | # fetch the password |
| 100 | try: |
| 101 | password_base64 = config.getscip-python python python-stdlib 3.11 configparser/RawConfigParser#get().(servicescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#get_password().(service), usernamescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#get_password().(username)).encodescip-python python python-stdlib 3.11 builtins/str#encode().() |
| 102 | # decode with base64 |
| 103 | password_encrypted = decodebytesscip-python python python-stdlib 3.11 base64/decodebytes().(password_base64) |
| 104 | # decrypt the password with associated data |
| 105 | try: |
| 106 | password = selfscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#get_password().(self).decryptscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#decrypt().(password_encrypted, assoc).decode('utf-8') |
| 107 | except ValueErrorscip-python python python-stdlib 3.11 builtins/ValueError#: |
| 108 | # decrypt the password without associated data |
| 109 | password = selfscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#get_password().(self).decryptscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#decrypt().(password_encrypted).decode('utf-8') |
| 110 | except (configparserscip-python python python-stdlib 3.11 configparser/__init__:.NoOptionErrorscip-python python python-stdlib 3.11 configparser/NoOptionError#, configparserscip-python python python-stdlib 3.11 configparser/__init__:.NoSectionErrorscip-python python python-stdlib 3.11 configparser/NoSectionError#): |
| 111 | password = None |
| 112 | return password |
| 113 | |
| 114 | def set_passwordscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#set_password().(selfscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#set_password().(self), servicescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#set_password().(service), usernamescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#set_password().(username), passwordscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#set_password().(password)): |
| 115 | """Write the password in the file.""" |
| 116 | if not usernamescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#set_password().(username): |
| 117 | # https://github.com/jaraco/keyrings.alt/issues/21 |
| 118 | raise ValueErrorscip-python python python-stdlib 3.11 builtins/ValueError#("Username cannot be blank.") |
| 119 | if not isinstance(passwordscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#set_password().(password), strscip-python python python-stdlib 3.11 builtins/str#): |
| 120 | raise TypeErrorscip-python python python-stdlib 3.11 builtins/TypeError#("Password should be a unicode string, not bytes.") |
| 121 | assoc = selfscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#set_password().(self)._generate_assocscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#_generate_assoc().(servicescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#set_password().(service), usernamescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#set_password().(username)) |
| 122 | # encrypt the password |
| 123 | password_encrypted = selfscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#set_password().(self).encryptscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#encrypt().(passwordscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#set_password().(password).encodescip-python python python-stdlib 3.11 builtins/str#encode().('utf-8'), assoc) |
| 124 | # encode with base64 and add line break to untangle config file |
| 125 | password_base64 = '\n' + encodebytesscip-python python python-stdlib 3.11 base64/encodebytes().(password_encrypted).decodescip-python python python-stdlib 3.11 builtins/bytes#decode().() |
| 126 | |
| 127 | selfscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#set_password().(self)._write_config_valuescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#_write_config_value().(servicescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#set_password().(service), usernamescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#set_password().(username), password_base64) |
| 128 | |
| 129 | def _generate_assocscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#_generate_assoc().(selfscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#_generate_assoc().(self), servicescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#_generate_assoc().(service), usernamescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#_generate_assoc().(username)): |
| 130 | """Generate tamper resistant bytestring of associated data""" |
| 131 | return (escape_for_iniscip-python python keyrings.alt 5.0.2 `keyrings.alt.escape`/escape().(servicescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#_generate_assoc().(service)) + r'\0' + escape_for_iniscip-python python keyrings.alt 5.0.2 `keyrings.alt.escape`/escape().(usernamescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#_generate_assoc().(username))).encodescip-python python python-stdlib 3.11 builtins/str#encode().() |
| 132 | |
| 133 | def _write_config_valuescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#_write_config_value().(selfscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#_write_config_value().(self), servicescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#_write_config_value().(service), keyscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#_write_config_value().(key), valuescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#_write_config_value().(value)): |
| 134 | # ensure the file exists |
| 135 | selfscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#_write_config_value().(self)._ensure_file_pathscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#_ensure_file_path().() |
| 136 | |
| 137 | # load the keyring from the disk |
| 138 | config = configparserscip-python python python-stdlib 3.11 configparser/__init__:.RawConfigParserscip-python python python-stdlib 3.11 configparser/RawConfigParser#() |
| 139 | config.readscip-python python python-stdlib 3.11 configparser/RawConfigParser#read().(selfscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#_write_config_value().(self).file_pathscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/FileBacked#file_path()., encodingscip-python python python-stdlib 3.11 configparser/RawConfigParser#read().(encoding)='utf-8') |
| 140 | |
| 141 | servicescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#_write_config_value().(service) = escape_for_iniscip-python python keyrings.alt 5.0.2 `keyrings.alt.escape`/escape().(servicescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#_write_config_value().(service)) |
| 142 | keyscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#_write_config_value().(key) = escape_for_iniscip-python python keyrings.alt 5.0.2 `keyrings.alt.escape`/escape().(keyscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#_write_config_value().(key)) |
| 143 | |
| 144 | # update the keyring with the password |
| 145 | if not config.has_sectionscip-python python python-stdlib 3.11 configparser/RawConfigParser#has_section().(servicescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#_write_config_value().(service)): |
| 146 | config.add_sectionscip-python python python-stdlib 3.11 configparser/RawConfigParser#add_section().(servicescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#_write_config_value().(service)) |
| 147 | config.setscip-python python python-stdlib 3.11 builtins/set#(servicescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#_write_config_value().(service), keyscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#_write_config_value().(key), valuescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#_write_config_value().(value)) |
| 148 | |
| 149 | # save the keyring back to the file |
| 150 | with openscip-python python python-stdlib 3.11 builtins/open().(selfscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#_write_config_value().(self).file_pathscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/FileBacked#file_path()., 'w', encodingscip-python python python-stdlib 3.11 builtins/open().(encoding)='utf-8') as config_file: |
| 151 | config.writescip-python python python-stdlib 3.11 configparser/RawConfigParser#write().(config_file) |
| 152 | |
| 153 | def _ensure_file_pathscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#_ensure_file_path().(selfscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#_ensure_file_path().(self)): |
| 154 | """ |
| 155 | Ensure the storage path exists. |
| 156 | If it doesn't, create it with "go-rwx" permissions. |
| 157 | """ |
| 158 | storage_root = osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..dirnamescip-python python python-stdlib 3.11 genericpath/exists().(selfscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#_ensure_file_path().(self).file_pathscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/FileBacked#file_path().) |
| 159 | needs_storage_root = storage_root and not osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..isdirscip-python python python-stdlib 3.11 genericpath/exists().(storage_root) |
| 160 | if needs_storage_root: # pragma: no cover |
| 161 | osscip-python python python-stdlib 3.11 os/__init__:.makedirsscip-python python python-stdlib 3.11 os/makedirs().(storage_root) |
| 162 | if not osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..isfilescip-python python python-stdlib 3.11 genericpath/exists().(selfscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#_ensure_file_path().(self).file_pathscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/FileBacked#file_path().): |
| 163 | # create the file without group/world permissions |
| 164 | with openscip-python python python-stdlib 3.11 builtins/open().(selfscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#_ensure_file_path().(self).file_pathscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/FileBacked#file_path()., 'w', encodingscip-python python python-stdlib 3.11 builtins/open().(encoding)='utf-8'): |
| 165 | pass |
| 166 | user_read_write = 0o600 |
| 167 | osscip-python python python-stdlib 3.11 os/__init__:.chmodscip-python python python-stdlib 3.11 os/chmod().(selfscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#_ensure_file_path().(self).file_pathscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/FileBacked#file_path()., user_read_write) |
| 168 | |
| 169 | def delete_passwordscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#delete_password().(selfscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#delete_password().(self), servicescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#delete_password().(service), usernamescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#delete_password().(username)): |
| 170 | """Delete the password for the username of the service.""" |
| 171 | servicescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#delete_password().(service) = escape_for_iniscip-python python keyrings.alt 5.0.2 `keyrings.alt.escape`/escape().(servicescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#delete_password().(service)) |
| 172 | usernamescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#delete_password().(username) = escape_for_iniscip-python python keyrings.alt 5.0.2 `keyrings.alt.escape`/escape().(usernamescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#delete_password().(username)) |
| 173 | config = configparserscip-python python python-stdlib 3.11 configparser/__init__:.RawConfigParserscip-python python python-stdlib 3.11 configparser/RawConfigParser#() |
| 174 | if osscip-python python python-stdlib 3.11 os/__init__:.pathscip-python python python-stdlib 3.11 os/path..existsscip-python python python-stdlib 3.11 genericpath/exists().(selfscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#delete_password().(self).file_pathscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/FileBacked#file_path().): |
| 175 | config.readscip-python python python-stdlib 3.11 configparser/RawConfigParser#read().(selfscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#delete_password().(self).file_pathscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/FileBacked#file_path()., encodingscip-python python python-stdlib 3.11 configparser/RawConfigParser#read().(encoding)='utf-8') |
| 176 | try: |
| 177 | if not config.remove_optionscip-python python python-stdlib 3.11 configparser/RawConfigParser#remove_option().(servicescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#delete_password().(service), usernamescip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#delete_password().(username)): |
| 178 | raise PasswordDeleteError("Password not found") |
| 179 | except configparserscip-python python python-stdlib 3.11 configparser/__init__:.NoSectionErrorscip-python python python-stdlib 3.11 configparser/NoSectionError#: |
| 180 | raise PasswordDeleteError("Password not found") |
| 181 | # update the file |
| 182 | with openscip-python python python-stdlib 3.11 builtins/open().(selfscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/Keyring#delete_password().(self).file_pathscip-python python keyrings.alt 5.0.2 `keyrings.alt.file_base`/FileBacked#file_path()., 'w', encodingscip-python python python-stdlib 3.11 builtins/open().(encoding)='utf-8') as config_file: |
| 183 | config.writescip-python python python-stdlib 3.11 configparser/RawConfigParser#write().(config_file) |