<commit_before>{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE CPP                 #-}
{-# LANGUAGE DataKinds           #-}
{-# LANGUAGE RankNTypes          #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeOperators       #-}

module Main
       ( main
       ) where

import           Universum                  hiding (over)

import           Data.Maybe                 (fromJust)
import           Formatting                 (sformat, shown, (%))
import           Mockable                   (Production, currentTime, runProduction)
import           System.Wlog                (logError, logInfo)

import           Pos.Binary                 ()
import           Pos.Client.CLI             (CommonNodeArgs (..))
import qualified Pos.Client.CLI             as CLI
import           Pos.Communication          (ActionSpec (..), OutSpecs, WorkerSpec,
                                             worker)
import           Pos.Context                (HasNodeContext)
import           Pos.Core                   (HasCoreConstants, Timestamp (..),
                                             giveStaticConsts)
import           Pos.Launcher               (NodeParams (..), NodeResources (..),
                                             bracketNodeResources, runNode)
import           Pos.Ssc.Class              (SscParams)
import           Pos.Ssc.GodTossing         (SscGodTossing)
import           Pos.Ssc.NistBeacon         (SscNistBeacon)
import           Pos.Ssc.SscAlgo            (SscAlgo (..))
import           Pos.Util.UserSecret        (usVss)
import           Pos.Wallet.Web             (WalletWebMode, bracketWalletWS,
                                             bracketWalletWebDB, runWRealMode,
                                             walletServeWebFull, walletServerOuts)
import           Pos.Web                    (serveWebGT)
import           Pos.WorkMode               (WorkMode)

import           NodeOptions                (WalletArgs (..), WalletNodeArgs (..),
                                             getWalletNodeOptions)
import           Params                     (getNodeParams)

actionWithWallet :: HasCoreConstants => SscParams SscGodTossing -> NodeParams -> WalletArgs -> Production ()
actionWithWallet sscParams nodeParams wArgs@WalletArgs {..} =
    bracketWalletWebDB walletDbPath walletRebuildDb $ \db ->
        bracketWalletWS $ \conn ->
            bracketNodeResources nodeParams sscParams $ \nr@NodeResources {..} ->
                runWRealMode
                    db
                    conn
                    nr
                    (runNode @SscGodTossing nr plugins)
  where
    convPlugins = (, mempty) . map (\act -> ActionSpec $ \__vI __sA -> act)
    plugins :: HasCoreConstants => ([WorkerSpec WalletWebMode], OutSpecs)
    plugins = convPlugins (pluginsGT wArgs) <> walletProd wArgs<commit_msg>[CSM-409] Remove unused imports<commit_after>{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE CPP                 #-}
{-# LANGUAGE DataKinds           #-}
{-# LANGUAGE RankNTypes          #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeOperators       #-}

module Main
       ( main
       ) where

import           Universum                  hiding (over)

import           Data.Maybe                 (fromJust)
import           Formatting                 (sformat, shown, (%))
import           Mockable                   (Production, currentTime, runProduction)
import           System.Wlog                (logInfo)

import           Pos.Binary                 ()
import           Pos.Client.CLI             (CommonNodeArgs (..))
import qualified Pos.Client.CLI             as CLI
import           Pos.Communication          (ActionSpec (..), OutSpecs, WorkerSpec,
                                             worker)
import           Pos.Context                (HasNodeContext)
import           Pos.Core                   (HasCoreConstants, Timestamp (..),
                                             giveStaticConsts)
import           Pos.Launcher               (NodeParams (..), NodeResources (..),
                                             bracketNodeResources, runNode)
import           Pos.Ssc.Class              (SscParams)
import           Pos.Ssc.GodTossing         (SscGodTossing)
import           Pos.Util.UserSecret        (usVss)
import           Pos.Wallet.Web             (WalletWebMode, bracketWalletWS,
                                             bracketWalletWebDB, runWRealMode,
                                             walletServeWebFull, walletServerOuts)
import           Pos.Web                    (serveWebGT)
import           Pos.WorkMode               (WorkMode)

import           NodeOptions                (WalletArgs (..), WalletNodeArgs (..),
                                             getWalletNodeOptions)
import           Params                     (getNodeParams)

actionWithWallet :: HasCoreConstants => SscParams SscGodTossing -> NodeParams -> WalletArgs -> Production ()
actionWithWallet sscParams nodeParams wArgs@WalletArgs {..} =
    bracketWalletWebDB walletDbPath walletRebuildDb $ \db ->
        bracketWalletWS $ \conn ->
            bracketNodeResources nodeParams sscParams $ \nr@NodeResources {..} ->
                runWRealMode
                    db
                    conn
                    nr
                    (runNode @SscGodTossing nr plugins)
  where
    convPlugins = (, mempty) . map (\act -> ActionSpec $ \__vI __sA -> act)
    plugins :: HasCoreConstants => ([WorkerSpec WalletWebMode], OutSpecs)
    plugins = convPlugins (pluginsGT wArgs) <> walletProd wArgs
{'fraction_non_alphanumeric': 0.0798716348725263, 'fraction_numerical': 0.0005348546978070957, 'mean_word_length': 1.2860635696821516, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 24, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '71647', 'n_tokens_mistral': 1384, 'n_tokens_neox': 1354, 'n_words': 301}