pylint improvements
This commit is contained in:
parent
75ffd7c41b
commit
ab50490617
@ -38,32 +38,33 @@ import time
|
||||
from urllib.parse import urlparse
|
||||
from urllib.request import urlopen, url2pathname
|
||||
import tempfile
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# set up logging
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import logging
|
||||
LOG = logging.getLogger(".clidbman")
|
||||
from gramps.gen.db.dbconst import DBLOGNAME
|
||||
_LOG = logging.getLogger(DBLOGNAME)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
from gramps.gen.plug import BasePluginManager
|
||||
from gramps.gen.config import config
|
||||
from gramps.gen.constfunc import win
|
||||
from gramps.gen.db.dbconst import DBLOGNAME
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# set up logging
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
LOG = logging.getLogger(".clidbman")
|
||||
_LOG = logging.getLogger(DBLOGNAME)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# constants
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
DEFAULT_TITLE = _("Family Tree")
|
||||
NAME_FILE = "name.txt"
|
||||
META_NAME = "meta_data.db"
|
||||
@ -245,10 +246,10 @@ class CLIDbManager:
|
||||
name = file.readline().strip()
|
||||
|
||||
(tval, last) = time_val(dirpath)
|
||||
(enable, stock_id) = self.icon_values(dirpath, self.active,
|
||||
self.dbstate.db.is_open())
|
||||
(enable, stock_id) = self.icon_values(
|
||||
dirpath, self.active, self.dbstate.db.is_open())
|
||||
|
||||
if (stock_id == 'gramps-lock'):
|
||||
if stock_id == 'gramps-lock':
|
||||
last = find_locker_name(dirpath)
|
||||
|
||||
self.current_names.append(
|
||||
@ -355,9 +356,9 @@ class CLIDbManager:
|
||||
# write locally:
|
||||
temp_fp.write(data)
|
||||
url_fp.close()
|
||||
from gen.db.dbconst import BDBVERSFN
|
||||
from gramps.gen.db.dbconst import BDBVERSFN
|
||||
versionpath = os.path.join(name, BDBVERSFN)
|
||||
_LOG.debug("Write bsddb version %s" % str(dbase.version()))
|
||||
_LOG.debug("Write bsddb version %s", str(dbase.version()))
|
||||
with open(versionpath, "w") as version_file:
|
||||
version_file.write(str(dbase.version()))
|
||||
temp_fp.close()
|
||||
@ -448,8 +449,7 @@ class CLIDbManager:
|
||||
with open(filepath, "w", encoding='utf8') as name_file:
|
||||
name_file.write(new_text)
|
||||
except (OSError, IOError) as msg:
|
||||
CLIDbManager.ERROR(_("Could not rename Family Tree"),
|
||||
str(msg))
|
||||
CLIDbManager.ERROR(_("Could not rename Family Tree"), str(msg))
|
||||
return None, None
|
||||
return old_text, new_text
|
||||
|
||||
@ -484,7 +484,8 @@ def make_dbdir(dbdir):
|
||||
except (IOError, OSError) as msg:
|
||||
LOG.error(_("\nERROR: Wrong database path in Edit Menu->Preferences.\n"
|
||||
"Open preferences and set correct database path.\n\n"
|
||||
"Details: Could not make database directory:\n %s\n\n") % msg)
|
||||
"Details: Could not make database directory:\n %s\n\n"),
|
||||
str(msg))
|
||||
return False
|
||||
return True
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user