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