<commit_before>--[[
@file geolocation.lua
@license The MIT License (MIT)
@copyright 2017 transitd
--]]

--- @module geolocation

local geolocation = {}

local config = require("config")
local shell = require("lib.shell")
local threadman = require("threadman")
local support = require("support")

function geolocation.run()


    local listener = threadman.registerListener("geolocation",{"exit", "heartbeat"}

    while true do
        local msg = listener:listen()
        if msg ~= nil then
            if msg["type"] == "exit" then
                break
            end
        end
    end

    if cmd then

        local result = shrunner.execute(cmd)

        if result then
            threadman.notify({type = "info", module = "daemon", info = "Command `"..cmd.."` successfully executed"})
        else
            threadman.notify({type = "error", module = "daemon", error = "Command `"..cmd.."` failed"})
        end
    end

    threadman.unregisterListener(listener)
end

function geolocation.updateLocation()

    local modules = support.getGeo()
    local bestlocation = []
    for geomod, geo in pairs(modules) do
        bestlocation = module.queryLocation()
    end

    threadman.setShared('geolocation', bestlocation)

end<commit_msg>gps: bugfix: typos<commit_after>--[[
@file geolocation.lua
@license The MIT License (MIT)
@copyright 2017 transitd
--]]

--- @module geolocation

local geolocation = {}

local config = require("config")
local shell = require("lib.shell")
local threadman = require("threadman")
local support = require("support")

function geolocation.run()

    local listener = threadman.registerListener("geolocation",{"exit", "heartbeat"})

    while true do
        local msg = listener:listen()
        if msg ~= nil then
            if msg["type"] == "exit" then
                break
            end
        end
    end

    if cmd then

        local result = shrunner.execute(cmd)

        if result then
            threadman.notify({type = "info", module = "daemon", info = "Command `"..cmd.."` successfully executed"})
        else
            threadman.notify({type = "error", module = "daemon", error = "Command `"..cmd.."` failed"})
        end
    end

    threadman.unregisterListener(listener)

end

function geolocation.updateLocation()

    local modules = support.getGeo()
    local bestlocation = {}
    for geomod, geo in pairs(modules) do
        bestlocation = module.queryLocation()
    end

    threadman.setShared('geolocation', bestlocation)

end
{'fraction_non_alphanumeric': 0.12310756972111554, 'fraction_numerical': 0.0031872509960159364, 'mean_word_length': 2.709010339734121, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6570336', 'n_tokens_mistral': 727, 'n_tokens_neox': 694, 'n_words': 203}