

def place(self, levels=4, ignore=None):
    "Format entry's location as string, with places separated by commas.\n\n        :param levels: levels of specificity to include\n        :type levels: list of int\n        :keyword ignore: locations to ignore\n        :type ignore: string or list of strings\n\n        The *levels* parameter should be a list of integers corresponding to\n        the following levels of specificity defined by Day One.\n\n        - 0: Place Name\n        - 1: Locality (e.g. city)\n        - 2: Administrative Area (e.g. state)\n        - 3: Country\n\n        Alternately, *levels* can be an integer *n* to specify the *n*\n        smallest levels.\n\n        The keyword argument *ignore* directs the method to ignore one\n        or more place names. For example, you may want to ignore\n        your home country so that only foreign countries are shown.\n        "
    if isinstance(levels, int):
        levels = list(range(levels))
    if (ignore is None):
        ignore = []
    if isinstance(ignore, compat.string_types):
        ignore = [ignore]
    if (not ('Location' in self)):
        return ''
    order = ['Place Name', 'Locality', 'Administrative Area', 'Country']
    try:
        order_keys = [order[n] for n in levels]
    except TypeError:
        raise TypeError("'levels' argument must be an integer or list")
    names = (self[key] for key in order_keys if (key in self))
    try:
        names = [name for name in names if (len(name) and (name not in ignore))]
    except TypeError:
        raise TypeError("'ignore' argument must be a string or list")
    return ', '.join(names)

dataset/ETHPy150Open nathangrigg/dayone_export/dayone_export/__init__.py Entry.place/original