Replace STRTYPE with str
This commit is contained in:
parent
6d047c946c
commit
beab7892e5
@ -59,7 +59,6 @@ from gramps.gen.plug.report import (CATEGORY_TEXT, CATEGORY_DRAW, CATEGORY_BOOK,
|
|||||||
from gramps.gen.plug.report._paper import paper_sizes
|
from gramps.gen.plug.report._paper import paper_sizes
|
||||||
from gramps.gen.const import USER_HOME
|
from gramps.gen.const import USER_HOME
|
||||||
from gramps.gen.dbstate import DbState
|
from gramps.gen.dbstate import DbState
|
||||||
from gramps.gen.constfunc import STRTYPE
|
|
||||||
from ..grampscli import CLIManager
|
from ..grampscli import CLIManager
|
||||||
from ..user import User
|
from ..user import User
|
||||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||||
@ -77,7 +76,7 @@ def _convert_str_to_match_type(str_val, type_val):
|
|||||||
str_val = str_val.strip()
|
str_val = str_val.strip()
|
||||||
ret_type = type(type_val)
|
ret_type = type(type_val)
|
||||||
|
|
||||||
if isinstance(type_val, STRTYPE):
|
if isinstance(type_val, str):
|
||||||
if ( str_val.startswith("'") and str_val.endswith("'") ) or \
|
if ( str_val.startswith("'") and str_val.endswith("'") ) or \
|
||||||
( str_val.startswith('"') and str_val.endswith('"') ):
|
( str_val.startswith('"') and str_val.endswith('"') ):
|
||||||
# Remove enclosing quotes
|
# Remove enclosing quotes
|
||||||
|
|||||||
@ -51,7 +51,6 @@ WINDOWS = ["Windows", "win32"]
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
STRTYPE = str
|
|
||||||
UNITYPE = str
|
UNITYPE = str
|
||||||
cuni = str
|
cuni = str
|
||||||
def conv_to_unicode(x, y='utf8'):
|
def conv_to_unicode(x, y='utf8'):
|
||||||
|
|||||||
@ -52,7 +52,6 @@ from ..lib.place import Place
|
|||||||
from ..lib.repo import Repository
|
from ..lib.repo import Repository
|
||||||
from ..lib.note import Note
|
from ..lib.note import Note
|
||||||
from ..lib.tag import Tag
|
from ..lib.tag import Tag
|
||||||
from ..constfunc import STRTYPE
|
|
||||||
|
|
||||||
class Cursor(object):
|
class Cursor(object):
|
||||||
"""
|
"""
|
||||||
@ -298,7 +297,7 @@ class DictionaryDb(DbWriteBase, DbReadBase):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _validated_id_prefix(val, default):
|
def _validated_id_prefix(val, default):
|
||||||
if isinstance(val, STRTYPE) and val:
|
if isinstance(val, str) and val:
|
||||||
try:
|
try:
|
||||||
str_ = val % 1
|
str_ = val % 1
|
||||||
except TypeError: # missing conversion specifier
|
except TypeError: # missing conversion specifier
|
||||||
|
|||||||
@ -73,7 +73,7 @@ from ..utils.cast import conv_dbstr_to_unicode
|
|||||||
from . import (BsddbBaseCursor, DbReadBase)
|
from . import (BsddbBaseCursor, DbReadBase)
|
||||||
from ..utils.id import create_id
|
from ..utils.id import create_id
|
||||||
from ..errors import DbError
|
from ..errors import DbError
|
||||||
from ..constfunc import UNITYPE, STRTYPE, cuni, handle2internal, get_env_var
|
from ..constfunc import UNITYPE, cuni, handle2internal, get_env_var
|
||||||
from ..const import GRAMPS_LOCALE as glocale
|
from ..const import GRAMPS_LOCALE as glocale
|
||||||
_ = glocale.translation.gettext
|
_ = glocale.translation.gettext
|
||||||
|
|
||||||
@ -1278,7 +1278,7 @@ class DbBsddbRead(DbReadBase, Callback):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _validated_id_prefix(val, default):
|
def _validated_id_prefix(val, default):
|
||||||
if isinstance(val, STRTYPE) and val:
|
if isinstance(val, str) and val:
|
||||||
try:
|
try:
|
||||||
str_ = val % 1
|
str_ = val % 1
|
||||||
except TypeError: # missing conversion specifier
|
except TypeError: # missing conversion specifier
|
||||||
|
|||||||
@ -36,7 +36,6 @@ import io
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from ._filterparser import FilterParser
|
from ._filterparser import FilterParser
|
||||||
from ..plug import BasePluginManager
|
from ..plug import BasePluginManager
|
||||||
from ..constfunc import STRTYPE
|
|
||||||
from ..const import GRAMPS_LOCALE as glocale
|
from ..const import GRAMPS_LOCALE as glocale
|
||||||
|
|
||||||
PLUGMAN = BasePluginManager.get_instance()
|
PLUGMAN = BasePluginManager.get_instance()
|
||||||
@ -94,7 +93,7 @@ class FilterList(object):
|
|||||||
return filters
|
return filters
|
||||||
|
|
||||||
def add(self, namespace, filt):
|
def add(self, namespace, filt):
|
||||||
assert(isinstance(namespace, STRTYPE))
|
assert(isinstance(namespace, str))
|
||||||
|
|
||||||
if namespace not in self.filter_namespaces:
|
if namespace not in self.filter_namespaces:
|
||||||
self.filter_namespaces[namespace] = []
|
self.filter_namespaces[namespace] = []
|
||||||
|
|||||||
@ -31,7 +31,6 @@ AttributeRootBase class for Gramps.
|
|||||||
from .attribute import Attribute
|
from .attribute import Attribute
|
||||||
from .srcattribute import SrcAttribute
|
from .srcattribute import SrcAttribute
|
||||||
from .const import IDENTICAL, EQUAL
|
from .const import IDENTICAL, EQUAL
|
||||||
from ..constfunc import STRTYPE
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -111,7 +110,7 @@ class AttributeRootBase(object):
|
|||||||
:param attribute: :class:`~.attribute.Attribute` instance to add.
|
:param attribute: :class:`~.attribute.Attribute` instance to add.
|
||||||
:type attribute: :class:`~.attribute.Attribute`
|
:type attribute: :class:`~.attribute.Attribute`
|
||||||
"""
|
"""
|
||||||
assert not isinstance(attribute, STRTYPE)
|
assert not isinstance(attribute, str)
|
||||||
self.attribute_list.append(attribute)
|
self.attribute_list.append(attribute)
|
||||||
|
|
||||||
def remove_attribute(self, attribute):
|
def remove_attribute(self, attribute):
|
||||||
|
|||||||
@ -30,7 +30,7 @@ Base type for all gramps types.
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from ..const import GRAMPS_LOCALE as glocale
|
from ..const import GRAMPS_LOCALE as glocale
|
||||||
_ = glocale.translation.gettext
|
_ = glocale.translation.gettext
|
||||||
from ..constfunc import STRTYPE, cuni
|
from ..constfunc import cuni
|
||||||
|
|
||||||
_UNKNOWN = _('Unknown')
|
_UNKNOWN = _('Unknown')
|
||||||
|
|
||||||
@ -168,7 +168,7 @@ class GrampsType(GrampsTypeC):
|
|||||||
self.__set_int(value)
|
self.__set_int(value)
|
||||||
elif isinstance(value, self.__class__):
|
elif isinstance(value, self.__class__):
|
||||||
self.__set_instance(value)
|
self.__set_instance(value)
|
||||||
elif isinstance(value, STRTYPE):
|
elif isinstance(value, str):
|
||||||
self.__set_str(value)
|
self.__set_str(value)
|
||||||
else:
|
else:
|
||||||
self.__value = self._DEFAULT
|
self.__value = self._DEFAULT
|
||||||
@ -294,7 +294,7 @@ class GrampsType(GrampsTypeC):
|
|||||||
def __eq__(self, value):
|
def __eq__(self, value):
|
||||||
if isinstance(value, int):
|
if isinstance(value, int):
|
||||||
return self.__value == value
|
return self.__value == value
|
||||||
elif isinstance(value, STRTYPE):
|
elif isinstance(value, str):
|
||||||
if self.__value == self._CUSTOM:
|
if self.__value == self._CUSTOM:
|
||||||
return self.__string == value
|
return self.__string == value
|
||||||
else:
|
else:
|
||||||
@ -315,10 +315,10 @@ class GrampsType(GrampsTypeC):
|
|||||||
|
|
||||||
## Python 3 does not have __cmp__
|
## Python 3 does not have __cmp__
|
||||||
## def __cmp__(self, value):
|
## def __cmp__(self, value):
|
||||||
## print ('cmp', type(value), STRTYPE)
|
## print ('cmp', type(value), str)
|
||||||
## if isinstance(value, int):
|
## if isinstance(value, int):
|
||||||
## return cmp(self.__value, value)
|
## return cmp(self.__value, value)
|
||||||
## elif isinstance(value, STRTYPE):
|
## elif isinstance(value, str):
|
||||||
## print('ok!')
|
## print('ok!')
|
||||||
## if self.__value == self._CUSTOM:
|
## if self.__value == self._CUSTOM:
|
||||||
## return cmp(self.__string, value)
|
## return cmp(self.__string, value)
|
||||||
|
|||||||
@ -48,7 +48,6 @@ from .attribute import Attribute
|
|||||||
from .const import IDENTICAL, EQUAL, DIFFERENT
|
from .const import IDENTICAL, EQUAL, DIFFERENT
|
||||||
from ..const import GRAMPS_LOCALE as glocale
|
from ..const import GRAMPS_LOCALE as glocale
|
||||||
_ = glocale.translation.gettext
|
_ = glocale.translation.gettext
|
||||||
from ..constfunc import STRTYPE
|
|
||||||
from .handle import Handle
|
from .handle import Handle
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -997,7 +996,7 @@ class Person(CitationBase, NoteBase, AttributeBase, MediaBase,
|
|||||||
to the Person's :class:`~.family.Family` list.
|
to the Person's :class:`~.family.Family` list.
|
||||||
:type family_handle: str
|
:type family_handle: str
|
||||||
"""
|
"""
|
||||||
if not isinstance(family_handle, STRTYPE):
|
if not isinstance(family_handle, str):
|
||||||
raise ValueError("Expecting handle, obtained %s" % str(family_handle))
|
raise ValueError("Expecting handle, obtained %s" % str(family_handle))
|
||||||
if family_handle not in self.parent_family_list:
|
if family_handle not in self.parent_family_list:
|
||||||
self.parent_family_list.append(family_handle)
|
self.parent_family_list.append(family_handle)
|
||||||
|
|||||||
@ -27,7 +27,7 @@
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from .styledtexttag import StyledTextTag
|
from .styledtexttag import StyledTextTag
|
||||||
from ..constfunc import cuni, STRTYPE
|
from ..constfunc import cuni
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -111,7 +111,7 @@ class StyledText(object):
|
|||||||
|
|
||||||
return self.__class__("".join([self._string, other._string]),
|
return self.__class__("".join([self._string, other._string]),
|
||||||
self._tags + other._tags)
|
self._tags + other._tags)
|
||||||
elif isinstance(other, STRTYPE):
|
elif isinstance(other, str):
|
||||||
# tags remain the same, only text becomes longer
|
# tags remain the same, only text becomes longer
|
||||||
return self.__class__("".join([self._string, other]), self._tags)
|
return self.__class__("".join([self._string, other]), self._tags)
|
||||||
else:
|
else:
|
||||||
|
|||||||
@ -51,7 +51,7 @@ _ = glocale.translation.gettext
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from ..config import config
|
from ..config import config
|
||||||
from . import PluginRegister, ImportPlugin, ExportPlugin, DocGenPlugin
|
from . import PluginRegister, ImportPlugin, ExportPlugin, DocGenPlugin
|
||||||
from ..constfunc import STRTYPE, win
|
from ..constfunc import win
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -245,7 +245,7 @@ class BasePluginManager(object):
|
|||||||
to sys.path first (if needed), import, and then reset path.
|
to sys.path first (if needed), import, and then reset path.
|
||||||
"""
|
"""
|
||||||
module = None
|
module = None
|
||||||
if isinstance(pdata, STRTYPE):
|
if isinstance(pdata, str):
|
||||||
pdata = self.get_plugin(pdata)
|
pdata = self.get_plugin(pdata)
|
||||||
if not pdata:
|
if not pdata:
|
||||||
return None
|
return None
|
||||||
|
|||||||
@ -44,7 +44,6 @@ from ...version import VERSION as GRAMPSVERSION, VERSION_TUPLE
|
|||||||
from ..const import IMAGE_DIR
|
from ..const import IMAGE_DIR
|
||||||
from ..const import GRAMPS_LOCALE as glocale
|
from ..const import GRAMPS_LOCALE as glocale
|
||||||
_ = glocale.translation.gettext
|
_ = glocale.translation.gettext
|
||||||
from ..constfunc import STRTYPE
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -162,7 +161,7 @@ def valid_plugin_version(plugin_version_string):
|
|||||||
Checks to see if string is a valid version string for this version
|
Checks to see if string is a valid version string for this version
|
||||||
of Gramps.
|
of Gramps.
|
||||||
"""
|
"""
|
||||||
if not isinstance(plugin_version_string, STRTYPE): return False
|
if not isinstance(plugin_version_string, str): return False
|
||||||
dots = plugin_version_string.count(".")
|
dots = plugin_version_string.count(".")
|
||||||
if dots == 1:
|
if dots == 1:
|
||||||
plugin_version = tuple(map(int, plugin_version_string.split(".", 1)))
|
plugin_version = tuple(map(int, plugin_version_string.split(".", 1)))
|
||||||
|
|||||||
@ -36,7 +36,6 @@ from ..lib import EventType
|
|||||||
from ..config import config
|
from ..config import config
|
||||||
from ..const import GRAMPS_LOCALE as glocale
|
from ..const import GRAMPS_LOCALE as glocale
|
||||||
_ = glocale.translation.gettext
|
_ = glocale.translation.gettext
|
||||||
from ..constfunc import STRTYPE
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -123,7 +122,7 @@ class SimpleAccess(object):
|
|||||||
:return: Returns the name of the person based of the program preferences
|
:return: Returns the name of the person based of the program preferences
|
||||||
:rtype: unicode
|
:rtype: unicode
|
||||||
"""
|
"""
|
||||||
if isinstance(person, STRTYPE):
|
if isinstance(person, str):
|
||||||
person = self.dbase.get_person_from_handle(person)
|
person = self.dbase.get_person_from_handle(person)
|
||||||
assert(person is None or isinstance(person, Person))
|
assert(person is None or isinstance(person, Person))
|
||||||
if person:
|
if person:
|
||||||
@ -140,7 +139,7 @@ class SimpleAccess(object):
|
|||||||
:return: Returns the name of the person based of the program preferences
|
:return: Returns the name of the person based of the program preferences
|
||||||
:rtype: unicode
|
:rtype: unicode
|
||||||
"""
|
"""
|
||||||
if isinstance(person, STRTYPE):
|
if isinstance(person, str):
|
||||||
person = self.dbase.get_person_from_handle(person)
|
person = self.dbase.get_person_from_handle(person)
|
||||||
assert(person is None or isinstance(person, Person))
|
assert(person is None or isinstance(person, Person))
|
||||||
if person:
|
if person:
|
||||||
@ -160,7 +159,7 @@ class SimpleAccess(object):
|
|||||||
preferences
|
preferences
|
||||||
:rtype: unicode
|
:rtype: unicode
|
||||||
"""
|
"""
|
||||||
if isinstance(person, STRTYPE):
|
if isinstance(person, str):
|
||||||
person = self.dbase.get_person_from_handle(person)
|
person = self.dbase.get_person_from_handle(person)
|
||||||
assert(person is None or isinstance(person, Person))
|
assert(person is None or isinstance(person, Person))
|
||||||
if person:
|
if person:
|
||||||
@ -191,7 +190,7 @@ class SimpleAccess(object):
|
|||||||
:return: Returns a string indentifying the person's gender
|
:return: Returns a string indentifying the person's gender
|
||||||
:rtype: unicode
|
:rtype: unicode
|
||||||
"""
|
"""
|
||||||
if isinstance(person, STRTYPE):
|
if isinstance(person, str):
|
||||||
person = self.dbase.get_person_from_handle(person)
|
person = self.dbase.get_person_from_handle(person)
|
||||||
assert(person is None or isinstance(person, Person))
|
assert(person is None or isinstance(person, Person))
|
||||||
if person:
|
if person:
|
||||||
@ -319,7 +318,7 @@ class SimpleAccess(object):
|
|||||||
:return: The spouse identified as the person's primary spouse
|
:return: The spouse identified as the person's primary spouse
|
||||||
:rtype: :py:class:`.Person`
|
:rtype: :py:class:`.Person`
|
||||||
"""
|
"""
|
||||||
if isinstance(person, STRTYPE):
|
if isinstance(person, str):
|
||||||
person = self.dbase.get_person_from_handle(person)
|
person = self.dbase.get_person_from_handle(person)
|
||||||
assert(person is None or isinstance(person, Person))
|
assert(person is None or isinstance(person, Person))
|
||||||
|
|
||||||
@ -347,7 +346,7 @@ class SimpleAccess(object):
|
|||||||
person and his/per primary spouse.
|
person and his/per primary spouse.
|
||||||
:rtype: unicode
|
:rtype: unicode
|
||||||
"""
|
"""
|
||||||
if isinstance(person, STRTYPE):
|
if isinstance(person, str):
|
||||||
person = self.dbase.get_person_from_handle(person)
|
person = self.dbase.get_person_from_handle(person)
|
||||||
assert(person is None or isinstance(person, Person))
|
assert(person is None or isinstance(person, Person))
|
||||||
|
|
||||||
@ -371,7 +370,7 @@ class SimpleAccess(object):
|
|||||||
his/her spouse where married.
|
his/her spouse where married.
|
||||||
:rtype: unicode
|
:rtype: unicode
|
||||||
"""
|
"""
|
||||||
if isinstance(person, STRTYPE):
|
if isinstance(person, str):
|
||||||
person = self.dbase.get_person_from_handle(person)
|
person = self.dbase.get_person_from_handle(person)
|
||||||
assert(person is None or isinstance(person, Person))
|
assert(person is None or isinstance(person, Person))
|
||||||
|
|
||||||
@ -402,7 +401,7 @@ class SimpleAccess(object):
|
|||||||
his/her spouse where married.
|
his/her spouse where married.
|
||||||
:rtype: unicode
|
:rtype: unicode
|
||||||
"""
|
"""
|
||||||
if isinstance(person, STRTYPE):
|
if isinstance(person, str):
|
||||||
person = self.dbase.get_person_from_handle(person)
|
person = self.dbase.get_person_from_handle(person)
|
||||||
assert(person is None or isinstance(person, Person))
|
assert(person is None or isinstance(person, Person))
|
||||||
|
|
||||||
@ -494,7 +493,7 @@ class SimpleAccess(object):
|
|||||||
:return: Returns a string indicating the date when the person's birth.
|
:return: Returns a string indicating the date when the person's birth.
|
||||||
:rtype: unicode
|
:rtype: unicode
|
||||||
"""
|
"""
|
||||||
if isinstance(person, STRTYPE):
|
if isinstance(person, str):
|
||||||
person = self.dbase.get_person_from_handle(person)
|
person = self.dbase.get_person_from_handle(person)
|
||||||
return self.__event_date(person, Person.get_birth_ref)
|
return self.__event_date(person, Person.get_birth_ref)
|
||||||
|
|
||||||
@ -507,7 +506,7 @@ class SimpleAccess(object):
|
|||||||
:return: Returns the date when the person's birth.
|
:return: Returns the date when the person's birth.
|
||||||
:rtype: :py:class:`.Date`
|
:rtype: :py:class:`.Date`
|
||||||
"""
|
"""
|
||||||
if isinstance(person, STRTYPE):
|
if isinstance(person, str):
|
||||||
person = self.dbase.get_person_from_handle(person)
|
person = self.dbase.get_person_from_handle(person)
|
||||||
return self.__event_date_obj(person, Person.get_birth_ref)
|
return self.__event_date_obj(person, Person.get_birth_ref)
|
||||||
|
|
||||||
@ -521,7 +520,7 @@ class SimpleAccess(object):
|
|||||||
:return: Returns the date when the person's birth or fallback.
|
:return: Returns the date when the person's birth or fallback.
|
||||||
:rtype: :py:class:`.Date`
|
:rtype: :py:class:`.Date`
|
||||||
"""
|
"""
|
||||||
if isinstance(person, STRTYPE):
|
if isinstance(person, str):
|
||||||
person = self.dbase.get_person_from_handle(person)
|
person = self.dbase.get_person_from_handle(person)
|
||||||
event = get_birth_or_fallback(self.dbase, person, "<i>%s</i>")
|
event = get_birth_or_fallback(self.dbase, person, "<i>%s</i>")
|
||||||
if get_event:
|
if get_event:
|
||||||
@ -540,7 +539,7 @@ class SimpleAccess(object):
|
|||||||
:return: Returns a string indicating the place of the person's birth.
|
:return: Returns a string indicating the place of the person's birth.
|
||||||
:rtype: unicode
|
:rtype: unicode
|
||||||
"""
|
"""
|
||||||
if isinstance(person, STRTYPE):
|
if isinstance(person, str):
|
||||||
person = self.dbase.get_person_from_handle(person)
|
person = self.dbase.get_person_from_handle(person)
|
||||||
return self.__event_place(person, Person.get_birth_ref)
|
return self.__event_place(person, Person.get_birth_ref)
|
||||||
|
|
||||||
@ -553,7 +552,7 @@ class SimpleAccess(object):
|
|||||||
:return: Returns a string indicating the date when the person's death.
|
:return: Returns a string indicating the date when the person's death.
|
||||||
:rtype: unicode
|
:rtype: unicode
|
||||||
"""
|
"""
|
||||||
if isinstance(person, STRTYPE):
|
if isinstance(person, str):
|
||||||
person = self.dbase.get_person_from_handle(person)
|
person = self.dbase.get_person_from_handle(person)
|
||||||
return self.__event_date(person, Person.get_death_ref)
|
return self.__event_date(person, Person.get_death_ref)
|
||||||
|
|
||||||
@ -566,7 +565,7 @@ class SimpleAccess(object):
|
|||||||
:return: Returns the date when the person's death.
|
:return: Returns the date when the person's death.
|
||||||
:rtype: :py:class:`.Date`
|
:rtype: :py:class:`.Date`
|
||||||
"""
|
"""
|
||||||
if isinstance(person, STRTYPE):
|
if isinstance(person, str):
|
||||||
person = self.dbase.get_person_from_handle(person)
|
person = self.dbase.get_person_from_handle(person)
|
||||||
return self.__event_date_obj(person, Person.get_death_ref)
|
return self.__event_date_obj(person, Person.get_death_ref)
|
||||||
|
|
||||||
@ -579,7 +578,7 @@ class SimpleAccess(object):
|
|||||||
:return: Returns the date of the person's death or fallback.
|
:return: Returns the date of the person's death or fallback.
|
||||||
:rtype: :py:class:`.Date`
|
:rtype: :py:class:`.Date`
|
||||||
"""
|
"""
|
||||||
if isinstance(person, STRTYPE):
|
if isinstance(person, str):
|
||||||
person = self.dbase.get_person_from_handle(person)
|
person = self.dbase.get_person_from_handle(person)
|
||||||
event = get_death_or_fallback(self.dbase, person, "<i>%s</i>")
|
event = get_death_or_fallback(self.dbase, person, "<i>%s</i>")
|
||||||
if get_event:
|
if get_event:
|
||||||
@ -598,7 +597,7 @@ class SimpleAccess(object):
|
|||||||
:return: Returns a string indicating the place of the person's death.
|
:return: Returns a string indicating the place of the person's death.
|
||||||
:rtype: unicode
|
:rtype: unicode
|
||||||
"""
|
"""
|
||||||
if isinstance(person, STRTYPE):
|
if isinstance(person, str):
|
||||||
person = self.dbase.get_person_from_handle(person)
|
person = self.dbase.get_person_from_handle(person)
|
||||||
return self.__event_place(person, Person.get_death_ref)
|
return self.__event_place(person, Person.get_death_ref)
|
||||||
|
|
||||||
@ -732,7 +731,7 @@ class SimpleAccess(object):
|
|||||||
listed as a parent.
|
listed as a parent.
|
||||||
:rtype: list
|
:rtype: list
|
||||||
"""
|
"""
|
||||||
if isinstance(person, STRTYPE):
|
if isinstance(person, str):
|
||||||
person = self.dbase.get_person_from_handle(person)
|
person = self.dbase.get_person_from_handle(person)
|
||||||
assert(person is None or isinstance(person, Person))
|
assert(person is None or isinstance(person, Person))
|
||||||
|
|
||||||
@ -751,7 +750,7 @@ class SimpleAccess(object):
|
|||||||
listed as a child.
|
listed as a child.
|
||||||
:rtype: list
|
:rtype: list
|
||||||
"""
|
"""
|
||||||
if isinstance(person, STRTYPE):
|
if isinstance(person, str):
|
||||||
person = self.dbase.get_person_from_handle(person)
|
person = self.dbase.get_person_from_handle(person)
|
||||||
assert(person is None or isinstance(person, Person))
|
assert(person is None or isinstance(person, Person))
|
||||||
|
|
||||||
@ -940,15 +939,15 @@ class SimpleAccess(object):
|
|||||||
return ''
|
return ''
|
||||||
|
|
||||||
def person(self, handle):
|
def person(self, handle):
|
||||||
assert(isinstance(handle, STRTYPE))
|
assert(isinstance(handle, str))
|
||||||
return self.dbase.get_person_from_handle(handle)
|
return self.dbase.get_person_from_handle(handle)
|
||||||
|
|
||||||
def event(self, handle):
|
def event(self, handle):
|
||||||
assert(isinstance(handle, STRTYPE))
|
assert(isinstance(handle, str))
|
||||||
return self.dbase.get_event_from_handle(handle)
|
return self.dbase.get_event_from_handle(handle)
|
||||||
|
|
||||||
def family(self, handle):
|
def family(self, handle):
|
||||||
assert(isinstance(handle, STRTYPE))
|
assert(isinstance(handle, str))
|
||||||
return self.dbase.get_family_from_handle(handle)
|
return self.dbase.get_family_from_handle(handle)
|
||||||
|
|
||||||
def display(self, object_class, prop, value):
|
def display(self, object_class, prop, value):
|
||||||
|
|||||||
@ -31,7 +31,6 @@ from ..lib import (Person, Family, Event, Source, Place, Citation,
|
|||||||
Repository, MediaObject, Note, Date, Span)
|
Repository, MediaObject, Note, Date, Span)
|
||||||
from ..config import config
|
from ..config import config
|
||||||
from ..datehandler import displayer
|
from ..datehandler import displayer
|
||||||
from ..constfunc import STRTYPE
|
|
||||||
|
|
||||||
class SimpleTable(object):
|
class SimpleTable(object):
|
||||||
"""
|
"""
|
||||||
@ -100,7 +99,7 @@ class SimpleTable(object):
|
|||||||
# FIXME: add better text representations of these objects
|
# FIXME: add better text representations of these objects
|
||||||
if item is None:
|
if item is None:
|
||||||
retval.append("")
|
retval.append("")
|
||||||
elif isinstance(item, STRTYPE):
|
elif isinstance(item, str):
|
||||||
if item == "checkbox":
|
if item == "checkbox":
|
||||||
retval.append(False)
|
retval.append(False)
|
||||||
self.set_cell_type(col, "checkbox")
|
self.set_cell_type(col, "checkbox")
|
||||||
|
|||||||
@ -41,7 +41,7 @@ LOG = logging.getLogger(".")
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from ..const import GRAMPS_LOCALE as glocale
|
from ..const import GRAMPS_LOCALE as glocale
|
||||||
_ = glocale.translation.gettext
|
_ = glocale.translation.gettext
|
||||||
from ..constfunc import conv_to_unicode, UNITYPE, STRTYPE
|
from ..constfunc import conv_to_unicode, UNITYPE
|
||||||
|
|
||||||
#strings in database are utf-8
|
#strings in database are utf-8
|
||||||
conv_dbstr_to_unicode = lambda x: conv_to_unicode(x, 'UTF-8')
|
conv_dbstr_to_unicode = lambda x: conv_to_unicode(x, 'UTF-8')
|
||||||
@ -54,7 +54,7 @@ def get_type_converter(val):
|
|||||||
Return function that converts strings into the type of val.
|
Return function that converts strings into the type of val.
|
||||||
"""
|
"""
|
||||||
val_type = type(val)
|
val_type = type(val)
|
||||||
if isinstance(val, STRTYPE):
|
if isinstance(val, str):
|
||||||
return str
|
return str
|
||||||
elif val_type == int:
|
elif val_type == int:
|
||||||
return int
|
return int
|
||||||
@ -79,7 +79,7 @@ def type_name(val):
|
|||||||
return 'float'
|
return 'float'
|
||||||
elif val_type == bool:
|
elif val_type == bool:
|
||||||
return 'bool'
|
return 'bool'
|
||||||
elif isinstance(val, STRTYPE):
|
elif isinstance(val, str):
|
||||||
return 'unicode'
|
return 'unicode'
|
||||||
return 'unicode'
|
return 'unicode'
|
||||||
|
|
||||||
|
|||||||
@ -38,7 +38,6 @@ import copy
|
|||||||
import logging
|
import logging
|
||||||
import io
|
import io
|
||||||
|
|
||||||
from ..constfunc import STRTYPE
|
|
||||||
from ..const import GRAMPS_LOCALE as glocale
|
from ..const import GRAMPS_LOCALE as glocale
|
||||||
_ = glocale.translation.gettext
|
_ = glocale.translation.gettext
|
||||||
|
|
||||||
@ -153,7 +152,7 @@ class ConfigManager(object):
|
|||||||
use_plugins_path=False)
|
use_plugins_path=False)
|
||||||
# will use /tmp/Other.ini
|
# will use /tmp/Other.ini
|
||||||
"""
|
"""
|
||||||
if isinstance(override, STRTYPE): # directory or filename
|
if isinstance(override, str): # directory or filename
|
||||||
if override:
|
if override:
|
||||||
path, ininame = os.path.split(os.path.abspath(override))
|
path, ininame = os.path.split(os.path.abspath(override))
|
||||||
else:
|
else:
|
||||||
@ -544,8 +543,8 @@ class ConfigManager(object):
|
|||||||
type2 = type(value2)
|
type2 = type(value2)
|
||||||
if type1 == type2:
|
if type1 == type2:
|
||||||
return True
|
return True
|
||||||
elif (isinstance(value1, STRTYPE) and
|
elif (isinstance(value1, str) and
|
||||||
isinstance(value2, STRTYPE)):
|
isinstance(value2, str)):
|
||||||
return True
|
return True
|
||||||
elif (type1 in [int, float] and
|
elif (type1 in [int, float] and
|
||||||
type2 in [int, float]):
|
type2 in [int, float]):
|
||||||
|
|||||||
@ -30,7 +30,6 @@ Provide autocompletion functionality.
|
|||||||
from gi.repository import Gtk
|
from gi.repository import Gtk
|
||||||
from gi.repository import GObject
|
from gi.repository import GObject
|
||||||
|
|
||||||
from gramps.gen.constfunc import STRTYPE
|
|
||||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||||
_ = glocale.translation.sgettext
|
_ = glocale.translation.sgettext
|
||||||
|
|
||||||
@ -266,7 +265,7 @@ class StandardCustomSelector(object):
|
|||||||
a string representing a custom type, an (int, str) tuple or an EventType
|
a string representing a custom type, an (int, str) tuple or an EventType
|
||||||
instance.
|
instance.
|
||||||
"""
|
"""
|
||||||
if isinstance(event_type, STRTYPE):
|
if isinstance(event_type, str):
|
||||||
return (self.custom_key, event_type)
|
return (self.custom_key, event_type)
|
||||||
elif isinstance(event_type, tuple):
|
elif isinstance(event_type, tuple):
|
||||||
if event_type[1]:
|
if event_type[1]:
|
||||||
|
|||||||
@ -59,7 +59,7 @@ from .glade import Glade
|
|||||||
from .ddtargets import DdTargets
|
from .ddtargets import DdTargets
|
||||||
from .makefilter import make_filter
|
from .makefilter import make_filter
|
||||||
from .utils import is_right_click
|
from .utils import is_right_click
|
||||||
from gramps.gen.constfunc import cuni, STRTYPE
|
from gramps.gen.constfunc import cuni
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -1125,7 +1125,7 @@ class ClipboardListView(object):
|
|||||||
def object_pixbuf(self, column, cell, model, node, user_data=None):
|
def object_pixbuf(self, column, cell, model, node, user_data=None):
|
||||||
o = model.get_value(node, 1)
|
o = model.get_value(node, 1)
|
||||||
if o._dbid != self.dbstate.db.get_dbid():
|
if o._dbid != self.dbstate.db.get_dbid():
|
||||||
if isinstance(o.__class__.UNAVAILABLE_ICON, STRTYPE):
|
if isinstance(o.__class__.UNAVAILABLE_ICON, str):
|
||||||
cell.set_property('stock-id',
|
cell.set_property('stock-id',
|
||||||
o.__class__.UNAVAILABLE_ICON)
|
o.__class__.UNAVAILABLE_ICON)
|
||||||
else:
|
else:
|
||||||
@ -1237,7 +1237,7 @@ class ClipboardListView(object):
|
|||||||
dragtype = pickle.loads(sel_data)[0]
|
dragtype = pickle.loads(sel_data)[0]
|
||||||
except pickle.UnpicklingError as msg :
|
except pickle.UnpicklingError as msg :
|
||||||
# not a pickled object, probably text
|
# not a pickled object, probably text
|
||||||
if isinstance(sel_data, STRTYPE):
|
if isinstance(sel_data, str):
|
||||||
dragtype = DdTargets.TEXT.drag_type
|
dragtype = DdTargets.TEXT.drag_type
|
||||||
if dragtype in self._target_type_to_wrapper_class_map:
|
if dragtype in self._target_type_to_wrapper_class_map:
|
||||||
possible_wrappers = [dragtype]
|
possible_wrappers = [dragtype]
|
||||||
|
|||||||
@ -64,7 +64,7 @@ from gramps.gen.db.exceptions import (DbUpgradeRequiredError,
|
|||||||
BsddbDowngradeRequiredError,
|
BsddbDowngradeRequiredError,
|
||||||
PythonUpgradeRequiredError,
|
PythonUpgradeRequiredError,
|
||||||
PythonDowngradeError)
|
PythonDowngradeError)
|
||||||
from gramps.gen.constfunc import STRTYPE, UNITYPE, conv_to_unicode
|
from gramps.gen.constfunc import conv_to_unicode
|
||||||
from .pluginmanager import GuiPluginManager
|
from .pluginmanager import GuiPluginManager
|
||||||
from .dialog import (DBErrorDialog, ErrorDialog, QuestionDialog2,
|
from .dialog import (DBErrorDialog, ErrorDialog, QuestionDialog2,
|
||||||
WarningDialog)
|
WarningDialog)
|
||||||
@ -210,7 +210,7 @@ class DbLoader(CLIDbLoader):
|
|||||||
In this process, a warning dialog can pop up.
|
In this process, a warning dialog can pop up.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if not isinstance(filename, (STRTYPE, UNITYPE)):
|
if not isinstance(filename, str):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
filename = os.path.normpath(os.path.abspath(filename))
|
filename = os.path.normpath(os.path.abspath(filename))
|
||||||
|
|||||||
@ -26,8 +26,6 @@
|
|||||||
from gi.repository import Gtk
|
from gi.repository import Gtk
|
||||||
from gi.repository import GObject
|
from gi.repository import GObject
|
||||||
|
|
||||||
from gramps.gen.constfunc import STRTYPE
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# This is used by plugins to create a menu of available filters
|
# This is used by plugins to create a menu of available filters
|
||||||
@ -38,7 +36,7 @@ def build_filter_model(space, local = []):
|
|||||||
|
|
||||||
model = Gtk.ListStore(GObject.TYPE_STRING, object)
|
model = Gtk.ListStore(GObject.TYPE_STRING, object)
|
||||||
|
|
||||||
if isinstance(space, STRTYPE):
|
if isinstance(space, str):
|
||||||
flist = local + CustomFilters.get_filters(space)
|
flist = local + CustomFilters.get_filters(space)
|
||||||
elif isinstance(space, (list, tuple)):
|
elif isinstance(space, (list, tuple)):
|
||||||
flist = space
|
flist = space
|
||||||
|
|||||||
@ -47,7 +47,6 @@ from gi.repository import Gtk
|
|||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
from gramps.gen.const import GLADE_DIR, GRAMPS_LOCALE as glocale
|
from gramps.gen.const import GLADE_DIR, GRAMPS_LOCALE as glocale
|
||||||
from gramps.gen.constfunc import STRTYPE
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -203,7 +202,7 @@ class Glade(Gtk.Builder):
|
|||||||
if not toplevel:
|
if not toplevel:
|
||||||
raise ValueError("Top level object required")
|
raise ValueError("Top level object required")
|
||||||
|
|
||||||
if isinstance(toplevel, STRTYPE):
|
if isinstance(toplevel, str):
|
||||||
toplevel = self.get_object(toplevel)
|
toplevel = self.get_object(toplevel)
|
||||||
|
|
||||||
# Simple Breadth-First Search
|
# Simple Breadth-First Search
|
||||||
|
|||||||
@ -59,7 +59,7 @@ from ..selectors import SelectorFactory
|
|||||||
from gramps.gen.display.name import displayer as _nd
|
from gramps.gen.display.name import displayer as _nd
|
||||||
from gramps.gen.display.place import displayer as _pd
|
from gramps.gen.display.place import displayer as _pd
|
||||||
from gramps.gen.filters import GenericFilterFactory, GenericFilter, rules
|
from gramps.gen.filters import GenericFilterFactory, GenericFilter, rules
|
||||||
from gramps.gen.constfunc import (conv_to_unicode, get_curr_dir, STRTYPE, cuni)
|
from gramps.gen.constfunc import (conv_to_unicode, get_curr_dir, cuni)
|
||||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||||
_ = glocale.translation.gettext
|
_ = glocale.translation.gettext
|
||||||
|
|
||||||
@ -407,7 +407,7 @@ class GuiTextOption(Gtk.ScrolledWindow):
|
|||||||
# we'll use that. If not, we'll assume a list and convert
|
# we'll use that. If not, we'll assume a list and convert
|
||||||
# it into a single string by assuming each list element
|
# it into a single string by assuming each list element
|
||||||
# is separated by a newline.
|
# is separated by a newline.
|
||||||
if isinstance(value, STRTYPE):
|
if isinstance(value, str):
|
||||||
self.__buff.set_text(value)
|
self.__buff.set_text(value)
|
||||||
|
|
||||||
# Need to manually call the other handler so that the option
|
# Need to manually call the other handler so that the option
|
||||||
@ -1250,7 +1250,7 @@ class GuiPersonListOption(Gtk.Box):
|
|||||||
"""
|
"""
|
||||||
value = self.__option.get_value()
|
value = self.__option.get_value()
|
||||||
|
|
||||||
if not isinstance(value, STRTYPE):
|
if not isinstance(value, str):
|
||||||
# Convert array into a string
|
# Convert array into a string
|
||||||
# (convienence so that programmers can
|
# (convienence so that programmers can
|
||||||
# set value using a list)
|
# set value using a list)
|
||||||
@ -1393,7 +1393,7 @@ class GuiPlaceListOption(Gtk.Box):
|
|||||||
"""
|
"""
|
||||||
value = self.__option.get_value()
|
value = self.__option.get_value()
|
||||||
|
|
||||||
if not isinstance(value, STRTYPE):
|
if not isinstance(value, str):
|
||||||
# Convert array into a string
|
# Convert array into a string
|
||||||
# (convienence so that programmers can
|
# (convienence so that programmers can
|
||||||
# set value using a list)
|
# set value using a list)
|
||||||
@ -1568,7 +1568,7 @@ class GuiSurnameColorOption(Gtk.Box):
|
|||||||
"""
|
"""
|
||||||
value = self.__option.get_value()
|
value = self.__option.get_value()
|
||||||
|
|
||||||
if not isinstance(value, STRTYPE):
|
if not isinstance(value, str):
|
||||||
# Convert dictionary into a string
|
# Convert dictionary into a string
|
||||||
# (convienence so that programmers can
|
# (convienence so that programmers can
|
||||||
# set value using a dictionary)
|
# set value using a dictionary)
|
||||||
|
|||||||
@ -60,7 +60,6 @@ from gramps.gen.plug import (CATEGORY_QR_PERSON, CATEGORY_QR_FAMILY, CATEGORY_QR
|
|||||||
CATEGORY_QR_PLACE, CATEGORY_QR_REPOSITORY,
|
CATEGORY_QR_PLACE, CATEGORY_QR_REPOSITORY,
|
||||||
CATEGORY_QR_NOTE, CATEGORY_QR_CITATION,
|
CATEGORY_QR_NOTE, CATEGORY_QR_CITATION,
|
||||||
CATEGORY_QR_SOURCE_OR_CITATION)
|
CATEGORY_QR_SOURCE_OR_CITATION)
|
||||||
from gramps.gen.constfunc import STRTYPE
|
|
||||||
from ._textbufdoc import TextBufDoc
|
from ._textbufdoc import TextBufDoc
|
||||||
from gramps.gen.simple import make_basic_stylesheet
|
from gramps.gen.simple import make_basic_stylesheet
|
||||||
|
|
||||||
@ -245,7 +244,7 @@ def run_report(dbstate, uistate, category, handle, pdata, container=None,
|
|||||||
d = TextBufDoc(make_basic_stylesheet(), None)
|
d = TextBufDoc(make_basic_stylesheet(), None)
|
||||||
d.dbstate = dbstate
|
d.dbstate = dbstate
|
||||||
d.uistate = uistate
|
d.uistate = uistate
|
||||||
if isinstance(handle, STRTYPE): # a handle
|
if isinstance(handle, str): # a handle
|
||||||
if category == CATEGORY_QR_PERSON :
|
if category == CATEGORY_QR_PERSON :
|
||||||
obj = dbstate.db.get_person_from_handle(handle)
|
obj = dbstate.db.get_person_from_handle(handle)
|
||||||
elif category == CATEGORY_QR_FAMILY :
|
elif category == CATEGORY_QR_FAMILY :
|
||||||
|
|||||||
@ -55,7 +55,6 @@ from gramps.gen.lib.urltype import UrlType
|
|||||||
from gramps.gen.lib.eventtype import EventType
|
from gramps.gen.lib.eventtype import EventType
|
||||||
from gramps.gen.display.name import displayer as _nd
|
from gramps.gen.display.name import displayer as _nd
|
||||||
from gramps.gen.plug.utils import OpenFileOrStdout
|
from gramps.gen.plug.utils import OpenFileOrStdout
|
||||||
from gramps.gen.constfunc import STRTYPE
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -91,7 +90,7 @@ class VCardWriter(object):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def esc(data):
|
def esc(data):
|
||||||
"""Escape the special chars of the VCard protocol."""
|
"""Escape the special chars of the VCard protocol."""
|
||||||
if isinstance(data, STRTYPE):
|
if isinstance(data, str):
|
||||||
for char in VCardWriter.TOBE_ESCAPED:
|
for char in VCardWriter.TOBE_ESCAPED:
|
||||||
data = data.replace(char, VCardWriter.ESCAPE_CHAR + char)
|
data = data.replace(char, VCardWriter.ESCAPE_CHAR + char)
|
||||||
return data
|
return data
|
||||||
|
|||||||
@ -56,7 +56,7 @@ from gramps.gen.datehandler import parser as _dp
|
|||||||
from gramps.gen.utils.string import gender as gender_map
|
from gramps.gen.utils.string import gender as gender_map
|
||||||
from gramps.gen.utils.id import create_id
|
from gramps.gen.utils.id import create_id
|
||||||
from gramps.gen.lib.eventroletype import EventRoleType
|
from gramps.gen.lib.eventroletype import EventRoleType
|
||||||
from gramps.gen.constfunc import cuni, conv_to_unicode, STRTYPE
|
from gramps.gen.constfunc import cuni, conv_to_unicode
|
||||||
from gramps.gen.config import config
|
from gramps.gen.config import config
|
||||||
from gramps.gen.display.place import displayer as place_displayer
|
from gramps.gen.display.place import displayer as place_displayer
|
||||||
|
|
||||||
|
|||||||
@ -50,7 +50,6 @@ import imp
|
|||||||
imp.reload(module)
|
imp.reload(module)
|
||||||
|
|
||||||
from gramps.gen.config import config
|
from gramps.gen.config import config
|
||||||
from gramps.gen.constfunc import STRTYPE
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -95,7 +94,7 @@ def importData(database, filename, user):
|
|||||||
else:
|
else:
|
||||||
code_set = ""
|
code_set = ""
|
||||||
|
|
||||||
assert(isinstance(code_set, STRTYPE))
|
assert(isinstance(code_set, str))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ifile = open(filename, "rb")
|
ifile = open(filename, "rb")
|
||||||
|
|||||||
@ -52,7 +52,7 @@ from gramps.gen.lib import (Attribute, AttributeType, ChildRef, Citation,
|
|||||||
Family, FamilyRelType, Name, NameType, Note, Person, PersonRef,
|
Family, FamilyRelType, Name, NameType, Note, Person, PersonRef,
|
||||||
Place, Source)
|
Place, Source)
|
||||||
from gramps.gen.db import DbTxn
|
from gramps.gen.db import DbTxn
|
||||||
from gramps.gen.constfunc import STRTYPE, cuni, conv_to_unicode
|
from gramps.gen.constfunc import cuni, conv_to_unicode
|
||||||
from html.entities import name2codepoint
|
from html.entities import name2codepoint
|
||||||
|
|
||||||
_date_parse = re.compile('([kmes~?<>]+)?([0-9/]+)([J|H|F])?(\.\.)?([0-9/]+)?([J|H|F])?')
|
_date_parse = re.compile('([kmes~?<>]+)?([0-9/]+)([J|H|F])?(\.\.)?([0-9/]+)?([J|H|F])?')
|
||||||
|
|||||||
@ -132,7 +132,7 @@ from gramps.gen.db.dbconst import EVENT_KEY
|
|||||||
from gramps.gui.dialog import WarningDialog
|
from gramps.gui.dialog import WarningDialog
|
||||||
from gramps.gen.lib.const import IDENTICAL, DIFFERENT
|
from gramps.gen.lib.const import IDENTICAL, DIFFERENT
|
||||||
from gramps.gen.lib import (StyledText, StyledTextTag, StyledTextTagType)
|
from gramps.gen.lib import (StyledText, StyledTextTag, StyledTextTagType)
|
||||||
from gramps.gen.constfunc import cuni, conv_to_unicode, STRTYPE, UNITYPE, win
|
from gramps.gen.constfunc import cuni, conv_to_unicode, UNITYPE, win
|
||||||
from gramps.plugins.lib.libplaceimport import PlaceImport
|
from gramps.plugins.lib.libplaceimport import PlaceImport
|
||||||
from gramps.gen.display.place import displayer as place_displayer
|
from gramps.gen.display.place import displayer as place_displayer
|
||||||
|
|
||||||
@ -7440,7 +7440,7 @@ class GedcomParser(UpdateCallback):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def build_media_object(self, obj, form, filename, title, note):
|
def build_media_object(self, obj, form, filename, title, note):
|
||||||
if isinstance(form, STRTYPE) and form.lower() == "url":
|
if isinstance(form, str) and form.lower() == "url":
|
||||||
url = Url()
|
url = Url()
|
||||||
url.set_path(filename)
|
url.set_path(filename)
|
||||||
url.set_description(title)
|
url.set_description(title)
|
||||||
@ -7722,7 +7722,7 @@ class GedcomStageOne(object):
|
|||||||
elif key in ("CHIL", "CHILD") and self.__is_xref_value(value):
|
elif key in ("CHIL", "CHILD") and self.__is_xref_value(value):
|
||||||
self.famc[value[1:-1]].append(current_family_id)
|
self.famc[value[1:-1]].append(current_family_id)
|
||||||
elif key == 'CHAR' and not self.enc:
|
elif key == 'CHAR' and not self.enc:
|
||||||
assert(isinstance(value, STRTYPE))
|
assert(isinstance(value, str))
|
||||||
self.enc = value
|
self.enc = value
|
||||||
|
|
||||||
def get_famc_map(self):
|
def get_famc_map(self):
|
||||||
@ -7747,7 +7747,7 @@ class GedcomStageOne(object):
|
|||||||
"""
|
"""
|
||||||
Forces the encoding
|
Forces the encoding
|
||||||
"""
|
"""
|
||||||
assert(isinstance(enc, STRTYPE))
|
assert(isinstance(enc, str))
|
||||||
self.enc = enc
|
self.enc = enc
|
||||||
|
|
||||||
def get_person_count(self):
|
def get_person_count(self):
|
||||||
|
|||||||
@ -36,7 +36,6 @@ import os
|
|||||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||||
_ = glocale.translation.gettext
|
_ = glocale.translation.gettext
|
||||||
from gramps.gen.const import PLUGINS_DIR, USER_PLUGINS
|
from gramps.gen.const import PLUGINS_DIR, USER_PLUGINS
|
||||||
from gramps.gen.constfunc import STRTYPE
|
|
||||||
from gramps.gen.lib.gcalendar import (gregorian_ymd, hebrew_sdn)
|
from gramps.gen.lib.gcalendar import (gregorian_ymd, hebrew_sdn)
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
@ -458,7 +457,7 @@ class _Holidays:
|
|||||||
if isinstance(offset, int):
|
if isinstance(offset, int):
|
||||||
if offset != 0:
|
if offset != 0:
|
||||||
ndate = ndate.fromordinal(ndate.toordinal() + offset)
|
ndate = ndate.fromordinal(ndate.toordinal() + offset)
|
||||||
elif isinstance(offset, STRTYPE):
|
elif isinstance(offset, str):
|
||||||
direction = 1
|
direction = 1
|
||||||
if offset[0] == "-":
|
if offset[0] == "-":
|
||||||
direction = -1
|
direction = -1
|
||||||
|
|||||||
@ -38,7 +38,7 @@ import re
|
|||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||||
from gramps.gen.constfunc import STRTYPE, cuni
|
from gramps.gen.constfunc import cuni
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -322,7 +322,7 @@ class Html(list):
|
|||||||
:returns: reference to object with new value added
|
:returns: reference to object with new value added
|
||||||
"""
|
"""
|
||||||
if (isinstance(value, Html) or not hasattr(value, '__iter__') or
|
if (isinstance(value, Html) or not hasattr(value, '__iter__') or
|
||||||
isinstance(value, STRTYPE)):
|
isinstance(value, str)):
|
||||||
value = [value]
|
value = [value]
|
||||||
index = len(self) - (1 if self.close else 0)
|
index = len(self) - (1 if self.close else 0)
|
||||||
self[index:index] = value
|
self[index:index] = value
|
||||||
@ -546,7 +546,7 @@ class Html(list):
|
|||||||
if len(self) < 2:
|
if len(self) < 2:
|
||||||
raise AttributeError('No closing tag. Cannot set inside value')
|
raise AttributeError('No closing tag. Cannot set inside value')
|
||||||
if (isinstance(value, Html) or not hasattr(value, '__iter__') or
|
if (isinstance(value, Html) or not hasattr(value, '__iter__') or
|
||||||
isinstance(value, STRTYPE)):
|
isinstance(value, str)):
|
||||||
value = [value]
|
value = [value]
|
||||||
self[1:-1] = value
|
self[1:-1] = value
|
||||||
#
|
#
|
||||||
|
|||||||
@ -40,7 +40,7 @@ Mary Smith was born on 3/28/1923.
|
|||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
from gramps.gen.lib import EventType, PlaceType, Location
|
from gramps.gen.lib import EventType, PlaceType, Location
|
||||||
from gramps.gen.utils.db import get_birth_or_fallback, get_death_or_fallback
|
from gramps.gen.utils.db import get_birth_or_fallback, get_death_or_fallback
|
||||||
from gramps.gen.constfunc import STRTYPE, cuni
|
from gramps.gen.constfunc import cuni
|
||||||
from gramps.gen.utils.location import get_main_location
|
from gramps.gen.utils.location import get_main_location
|
||||||
from gramps.gen.display.place import displayer as place_displayer
|
from gramps.gen.display.place import displayer as place_displayer
|
||||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||||
|
|||||||
@ -38,7 +38,6 @@ Italian-Specific classes for relationships.
|
|||||||
|
|
||||||
from gramps.gen.lib import Person
|
from gramps.gen.lib import Person
|
||||||
import gramps.gen.relationship
|
import gramps.gen.relationship
|
||||||
from gramps.gen.constfunc import STRTYPE
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -337,7 +336,7 @@ class RelationshipCalculator(gramps.gen.relationship.RelationshipCalculator):
|
|||||||
(secondRel, firstRel, common) = \
|
(secondRel, firstRel, common) = \
|
||||||
self.get_relationship_distance(db, orig_person, other_person)
|
self.get_relationship_distance(db, orig_person, other_person)
|
||||||
|
|
||||||
if isinstance(common, STRTYPE):
|
if isinstance(common, str):
|
||||||
return (common, [])
|
return (common, [])
|
||||||
elif common:
|
elif common:
|
||||||
person_handle = common[0]
|
person_handle = common[0]
|
||||||
|
|||||||
@ -67,7 +67,7 @@ from gramps.gen.const import CUSTOM_FILTERS
|
|||||||
from gramps.gen.constfunc import is_quartz, win
|
from gramps.gen.constfunc import is_quartz, win
|
||||||
from gramps.gui.dialog import RunDatabaseRepair, ErrorDialog
|
from gramps.gui.dialog import RunDatabaseRepair, ErrorDialog
|
||||||
from gramps.gui.utils import color_graph_box, hex_to_rgb_float, is_right_click
|
from gramps.gui.utils import color_graph_box, hex_to_rgb_float, is_right_click
|
||||||
from gramps.gen.constfunc import STRTYPE, lin
|
from gramps.gen.constfunc import lin
|
||||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||||
_ = glocale.translation.sgettext
|
_ = glocale.translation.sgettext
|
||||||
|
|
||||||
|
|||||||
@ -42,7 +42,6 @@ from gramps.gen.db import (PERSON_KEY,
|
|||||||
REPOSITORY_KEY,
|
REPOSITORY_KEY,
|
||||||
NOTE_KEY)
|
NOTE_KEY)
|
||||||
from gramps.gen.utils.id import create_id
|
from gramps.gen.utils.id import create_id
|
||||||
from gramps.gen.constfunc import STRTYPE
|
|
||||||
from gramps.webapp.libdjango import DjangoInterface
|
from gramps.webapp.libdjango import DjangoInterface
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
|
|
||||||
@ -341,7 +340,7 @@ class DbDjango(DbWriteBase, DbReadBase):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _validated_id_prefix(val, default):
|
def _validated_id_prefix(val, default):
|
||||||
if isinstance(val, STRTYPE) and val:
|
if isinstance(val, str) and val:
|
||||||
try:
|
try:
|
||||||
str_ = val % 1
|
str_ = val % 1
|
||||||
except TypeError: # missing conversion specifier
|
except TypeError: # missing conversion specifier
|
||||||
|
|||||||
@ -64,7 +64,6 @@ from gramps.gen.lib import Person
|
|||||||
from gramps.gen.utils.db import get_birth_or_fallback, get_death_or_fallback
|
from gramps.gen.utils.db import get_birth_or_fallback, get_death_or_fallback
|
||||||
from gramps.gen.plug import BasePluginManager
|
from gramps.gen.plug import BasePluginManager
|
||||||
from gramps.cli.grampscli import CLIManager
|
from gramps.cli.grampscli import CLIManager
|
||||||
from gramps.gen.constfunc import STRTYPE
|
|
||||||
from gramps.gen.utils.grampslocale import GrampsLocale
|
from gramps.gen.utils.grampslocale import GrampsLocale
|
||||||
|
|
||||||
#FIXME: A locale should be obtained from the user and used to
|
#FIXME: A locale should be obtained from the user and used to
|
||||||
@ -277,9 +276,9 @@ def make_button(text, url, *args):
|
|||||||
kwargs = cuni("")
|
kwargs = cuni("")
|
||||||
last = cuni("")
|
last = cuni("")
|
||||||
for arg in args:
|
for arg in args:
|
||||||
if isinstance(arg, STRTYPE) and arg.startswith("?"):
|
if isinstance(arg, str) and arg.startswith("?"):
|
||||||
kwargs = arg
|
kwargs = arg
|
||||||
elif isinstance(arg, STRTYPE) and arg.startswith("#"):
|
elif isinstance(arg, str) and arg.startswith("#"):
|
||||||
last = arg
|
last = arg
|
||||||
elif arg == "":
|
elif arg == "":
|
||||||
pass
|
pass
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user