<commit_before># Given an IP address, geolocate it and send the result over via e-mail

from datamodel.base import graph
from datamodel.nodes import value, apply, transcoders
from datamodel.nodes.quick import email, http


def email_geolocated_ip(recipients_list, smtp_params_list, ip_addr):
    email_params_list = list(smtp_params_list)
    email_params_list.append('<EMAIL>')
    email_params_list.append(recipients_list)

    http_params = dict(url='https://api.ip2country.info/ip?'+ip_addr,
                       output_encoding='json')
    v = value.Value(http_params)
    geolocate = http.Get()
    add_subject = apply.ApplyStatic(lambda body: ['testmail', body])
    to_json = transcoders.ToJSON()
    sendmail = email.SmtpEmail(*email_params_list)

    g = graph.Graph('email_geolocated_ip', [v, geolocate, add_subject, to_json,
                                            sendmail])

    g.connect(sendmail, add_subject)
    g.connect(add_subject, to_json)
    g.connect(to_json, geolocate)
    g.connect(geolocate, v)
<commit_msg>partial fix<commit_after># Given an IP address, geolocate it and send the result over via e-mail

from datamodel.base import graph
from datamodel.nodes import value, apply
from datamodel.nodes.quick import email, http, transcoders


def email_geolocated_ip(recipients_list, smtp_params_list, ip_addr):
    email_params_list = list(smtp_params_list)
    email_params_list.append('<EMAIL>')
    email_params_list.append(recipients_list)

    http_params = dict(url='https://api.ip2country.info/ip?'+ip_addr,
                       output_encoding='json')
    v = value.Value(value=http_params)
    geolocate = http.Get()
    add_subject = apply.Apply(function=lambda body: ['testmail', body])
    to_json = transcoders.ToJSON()
    sendmail = email.SmtpEmail(*email_params_list)

    g = graph.Graph('email_geolocated_ip', [v, geolocate, add_subject, to_json,
                                            sendmail])

    g.connect(sendmail, add_subject)
    g.connect(add_subject, to_json)
    g.connect(to_json, geolocate)
    g.connect(geolocate, v)

{'fraction_non_alphanumeric': 0.10138689622190339, 'fraction_numerical': 0.0009564801530368245, 'mean_word_length': 3.587719298245614, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '1195932', 'n_tokens_mistral': 701, 'n_tokens_neox': 674, 'n_words': 137}