<commit_before><?php

namespace App\Console\Commands\Dump;

use Illuminate\Support\Facades\DB;
use League\Csv\Reader;

class DumpImport extends AbstractDumpCommand
{

    protected $signature = 'dump:import
                            {--path= : Directory from where to import dump, with `tables` subdir }';

    protected $description = "Import CSV dumps of all whitelisted tables";

    protected $chunkSize = 100;

    public function handle()
    {
        // Export to database/dumps/local unless specified otherwise
        $dumpPath = $this->getDumpPathOption();

        foreach ($this->whitelistedTables as $tableName)
        {
            $this->info($tableName);

            $csvPath = $dumpPath . 'tables/' . $tableName . '.csv';

            if (!file_exists($csvPath))
            {
                $this->warn(' Skipped: CSV not found.');
                continue;
            }<commit_msg>Add `--from-remote` option to `dump:import`<commit_after><?php

namespace App\Console\Commands\Dump;

use Illuminate\Support\Facades\DB;
use League\Csv\Reader;

class DumpImport extends AbstractDumpCommand
{

    protected $signature = 'dump:import
                            {--path= : Directory from where to import dump, with `tables` subdir }
                            {--from-remote : Shortcut to import from `database/dumps/remote` }';

    protected $description = "Import CSV dumps of all whitelisted tables";

    protected $chunkSize = 100;

    public function handle()
    {
        if ($this->option('from-remote')) {
            $this->input->setOption('path', $this->getDumpPath('remote'));
        }

        // Import from database/dumps/local unless specified otherwise
        $dumpPath = $this->getDumpPathOption();

        foreach ($this->whitelistedTables as $tableName)
        {
            $this->info($tableName);

            $csvPath = $dumpPath . 'tables/' . $tableName . '.csv';

            if (!file_exists($csvPath))
            {
                $this->warn(' Skipped: CSV not found.');
                continue;
            }
{'fraction_non_alphanumeric': 0.12168034765813616, 'fraction_numerical': 0.0028971511347175277, 'mean_word_length': 2.13464447806354, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '6526997', 'n_tokens_mistral': 581, 'n_tokens_neox': 557, 'n_words': 144}