<commit_before>#!/usr/bin/env python
from __future__ import print_function

from datetime import datetime
import glob
import os
import shutil
import subprocess

from netkraken import (settings,
                       formats,
                       thresholds,
                       get_current_timestrings,
                       get_timestamp,
                       get_higher_timestamp,
                       get_stage_filename,
                       get_final_filename)
from counterdb import CountDB, makedirs


class Fetcher(object):
    def __init__(self):
        self.timestamp = get_current_timestrings()["minute"]
        self.filename = get_stage_filename(self.timestamp)

    def fetch(self):
        with CountDB.open_for_counting(self.filename) as db:
            ssp = subprocess.Popen(["ss", "-t4ar"], stdout=subprocess.PIPE)
            stdout, _ = ssp.communicate()
            listening = set()
            for line in stdout.splitlines()[2:]:
                state, recv, send, local, foreign = line.split()<commit_msg>skip only first line with headers<commit_after>#!/usr/bin/env python
from __future__ import print_function

from datetime import datetime
import glob
import os
import shutil
import subprocess

from netkraken import (settings,
                       formats,
                       thresholds,
                       get_current_timestrings,
                       get_timestamp,
                       get_higher_timestamp,
                       get_stage_filename,
                       get_final_filename)
from counterdb import CountDB, makedirs


class Fetcher(object):
    def __init__(self):
        self.timestamp = get_current_timestrings()["minute"]
        self.filename = get_stage_filename(self.timestamp)

    def fetch(self):
        with CountDB.open_for_counting(self.filename) as db:
            ssp = subprocess.Popen(["ss", "-t4ar"], stdout=subprocess.PIPE)
            stdout, _ = ssp.communicate()
            listening = set()
            for line in stdout.splitlines()[1:]:
                state, recv, send, local, foreign = line.split()
{'fraction_non_alphanumeric': 0.0788224121557455, 'fraction_numerical': 0.001899335232668566, 'mean_word_length': 2.0014245014245016, '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': '2991354', 'n_tokens_mistral': 574, 'n_tokens_neox': 549, 'n_words': 136}