<commit_before># -*- coding: utf8 -*-

from __future__ import unicode_literals

from collections import OrderedDict
from geopy.distance import distance as geopy_distance

from django import template
from django.contrib.gis.measure import D

from maps.models import Place
from genealogio.models import Person, PersonPlace

register = template.Library()

@register.inclusion_tag('genealogio/borndiedhere.rst')
def related_people(place):
    # pylint: disable=no-member
    born_here = Person.objects.filter(personplace__place=place,
                                      personplace__typ=PersonPlace.BIRTH)
    died_here = Person.objects.filter(personplace__place=place,
                                      personplace__typ=PersonPlace.DEATH)

    born_close_by = OrderedDict()
    died_close_by = OrderedDict()

    for typ, results in [
            (PersonPlace.BIRTH, born_close_by),
            (PersonPlace.DEATH, died_close_by),
            ]:
        # pylint: disable=no-member
        pl_close_by = PersonPlace.objects.exclude(place=place).filter(
                typ=typ,
                place__location__distance_lte=(place.location, D(km=50))
                ).select_related('place', 'person')
        print pl_close_by.query
        print len(pl_close_by)

        person_count = 0
        l = [(geopy_distance((ppl.place.location.y, ppl.place.location.x),
                             (place.location.y, place.location.x)),<commit_msg>Bugfix: Remove print statements in genealogio/templatetags.<commit_after># -*- coding: utf8 -*-

from __future__ import unicode_literals

from collections import OrderedDict
from geopy.distance import distance as geopy_distance

from django import template
from django.contrib.gis.measure import D

from maps.models import Place
from genealogio.models import Person, PersonPlace

register = template.Library()

@register.inclusion_tag('genealogio/borndiedhere.rst')
def related_people(place):
    # pylint: disable=no-member
    born_here = Person.objects.filter(personplace__place=place,
                                      personplace__typ=PersonPlace.BIRTH)
    died_here = Person.objects.filter(personplace__place=place,
                                      personplace__typ=PersonPlace.DEATH)

    born_close_by = OrderedDict()
    died_close_by = OrderedDict()

    for typ, results in [
            (PersonPlace.BIRTH, born_close_by),
            (PersonPlace.DEATH, died_close_by),
            ]:
        # pylint: disable=no-member
        pl_close_by = PersonPlace.objects.exclude(place=place).filter(
                typ=typ,
                place__location__distance_lte=(place.location, D(km=50))
                ).select_related('place', 'person')

        person_count = 0
        l = [(geopy_distance((ppl.place.location.y, ppl.place.location.x),
                             (place.location.y, place.location.x)),
{'fraction_non_alphanumeric': 0.09226500173430455, 'fraction_numerical': 0.002774887270204648, 'mean_word_length': 2.646017699115044, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7236976', 'n_tokens_mistral': 853, 'n_tokens_neox': 812, 'n_words': 158}