diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
commit | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (patch) | |
tree | 012bb94d777798f1f56ac1cec429509766d05181 /contrib/tools/python3/src/Lib/dbm | |
parent | 6751af0b0c1b952fede40b19b71da8025b5d8bcf (diff) | |
download | ydb-2598ef1d0aee359b4b6d5fdd1758916d5907d04f.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/tools/python3/src/Lib/dbm')
-rw-r--r-- | contrib/tools/python3/src/Lib/dbm/__init__.py | 4 | ||||
-rw-r--r-- | contrib/tools/python3/src/Lib/dbm/dumb.py | 16 |
2 files changed, 10 insertions, 10 deletions
diff --git a/contrib/tools/python3/src/Lib/dbm/__init__.py b/contrib/tools/python3/src/Lib/dbm/__init__.py index f65da521af..fef8065a2b 100644 --- a/contrib/tools/python3/src/Lib/dbm/__init__.py +++ b/contrib/tools/python3/src/Lib/dbm/__init__.py @@ -82,8 +82,8 @@ def open(file, flag='r', mode=0o666): # file doesn't exist and the new flag was used so use default type mod = _defaultmod else: - raise error[0]("db file doesn't exist; " - "use 'c' or 'n' flag to create a new db") + raise error[0]("db file doesn't exist; " + "use 'c' or 'n' flag to create a new db") elif result == "": # db type cannot be determined raise error[0]("db type could not be determined") diff --git a/contrib/tools/python3/src/Lib/dbm/dumb.py b/contrib/tools/python3/src/Lib/dbm/dumb.py index 864ad371ec..82b29dd6be 100644 --- a/contrib/tools/python3/src/Lib/dbm/dumb.py +++ b/contrib/tools/python3/src/Lib/dbm/dumb.py @@ -82,7 +82,7 @@ class _Database(collections.abc.MutableMapping): f = _io.open(self._datfile, 'r', encoding="Latin-1") except OSError: if flag not in ('c', 'n'): - raise + raise with _io.open(self._datfile, 'w', encoding="Latin-1") as f: self._chmod(self._datfile) else: @@ -90,14 +90,14 @@ class _Database(collections.abc.MutableMapping): # Read directory file into the in-memory index dict. def _update(self, flag): - self._modified = False + self._modified = False self._index = {} try: f = _io.open(self._dirfile, 'r', encoding="Latin-1") except OSError: if flag not in ('c', 'n'): - raise - self._modified = True + raise + self._modified = True else: with f: for line in f: @@ -185,7 +185,7 @@ class _Database(collections.abc.MutableMapping): def __setitem__(self, key, val): if self._readonly: - raise error('The database is opened for reading only') + raise error('The database is opened for reading only') if isinstance(key, str): key = key.encode('utf-8') elif not isinstance(key, (bytes, bytearray)): @@ -222,7 +222,7 @@ class _Database(collections.abc.MutableMapping): def __delitem__(self, key): if self._readonly: - raise error('The database is opened for reading only') + raise error('The database is opened for reading only') if isinstance(key, str): key = key.encode('utf-8') self._verify_open() @@ -278,7 +278,7 @@ class _Database(collections.abc.MutableMapping): __del__ = close def _chmod(self, file): - self._os.chmod(file, self._mode) + self._os.chmod(file, self._mode) def __enter__(self): return self @@ -312,5 +312,5 @@ def open(file, flag='c', mode=0o666): # Turn off any bits that are set in the umask mode = mode & (~um) if flag not in ('r', 'w', 'c', 'n'): - raise ValueError("Flag must be one of 'r', 'w', 'c', or 'n'") + raise ValueError("Flag must be one of 'r', 'w', 'c', or 'n'") return _Database(file, mode, flag=flag) |