<commit_before>#! /usr/bin/env python
# -*- coding:utf-8 -*-

from __future__ import print_function

import sys, random, unittest, struct, errno
import ctypes

from cpylmnl import netlink
import cpylmnl as mnl

from .netlink.buf import *


class TestSuite(unittest.TestCase):
    def setUp(self):
        buflen = 512

        self.msg_attr_hlen = mnl.MNL_NLMSG_HDRLEN + mnl.MNL_ATTR_HDRLEN

        # nlmsghdr
        self.hbuf = NlmsghdrBuf(buflen)
        self.nlh = mnl.Header(self.hbuf)
        self.rand_hbuf = NlmsghdrBuf(bytearray([random.randrange(0, 255) for j in range(buflen)]))
        self.rand_hbuf.len = buflen
        self.rand_nhl = mnl.Header(self.hbuf)

        # nlattr
        self.abuf = NlattrBuf(buflen)
        self.nla = mnl.Attribute(self.abuf)
        self.rand_abuf = NlattrBuf(bytearray([random.randrange(0, 255) for j in range(buflen)]))
        self.rand_abuf.len = buflen
        self.rand_nla = mnl.Attribute(self.rand_abuf)

        # for nla validation
        self.valid_len = {
            # {data_type: (nla.len, exp_len)
            mnl.MNL_TYPE_UNSPEC		: (0, 0),
            mnl.MNL_TYPE_U8		: (1, 1),
            mnl.MNL_TYPE_U16		: (2, 2),
            mnl.MNL_TYPE_U32		: (4, 4),
            mnl.MNL_TYPE_U64		: (8, 8),
            mnl.MNL_TYPE_STRING		: (64, 64),
            mnl.MNL_TYPE_FLAG		: (0, 0),
            mnl.MNL_TYPE_MSECS		: (8, 8),
            mnl.MNL_TYPE_NESTED		: (32, 32),
            mnl.MNL_TYPE_NESTED_COMPAT	: (32, 32),
            mnl.MNL_TYPE_NUL_STRING	: (64, 64),
            mnl.MNL_TYPE_BINARY		: (64, 64),
            # mnl.TYPE_MAX		: (, ),
        }
        self.invalid_len = {
            mnl.MNL_TYPE_U8		: (2, 3),<commit_msg>test: remove unused (and wrong name) variables<commit_after>#! /usr/bin/env python
# -*- coding:utf-8 -*-

from __future__ import print_function

import sys, random, unittest, struct, errno
import ctypes

from cpylmnl import netlink
import cpylmnl as mnl

from .netlink.buf import *


class TestSuite(unittest.TestCase):
    def setUp(self):
        buflen = 512

        self.msg_attr_hlen = mnl.MNL_NLMSG_HDRLEN + mnl.MNL_ATTR_HDRLEN

        # nlmsghdr
        self.hbuf = NlmsghdrBuf(buflen)
        self.nlh = mnl.Header(self.hbuf)

        # nlattr
        self.abuf = NlattrBuf(buflen)
        self.nla = mnl.Attribute(self.abuf)
        self.rand_abuf = NlattrBuf(bytearray([random.randrange(0, 255) for j in range(buflen)]))
        self.rand_abuf.len = buflen
        self.rand_nla = mnl.Attribute(self.rand_abuf)

        # for nla validation
        self.valid_len = {
            # {data_type: (nla.len, exp_len)
            mnl.MNL_TYPE_UNSPEC		: (0, 0),
            mnl.MNL_TYPE_U8		: (1, 1),
            mnl.MNL_TYPE_U16		: (2, 2),
            mnl.MNL_TYPE_U32		: (4, 4),
            mnl.MNL_TYPE_U64		: (8, 8),
            mnl.MNL_TYPE_STRING		: (64, 64),
            mnl.MNL_TYPE_FLAG		: (0, 0),
            mnl.MNL_TYPE_MSECS		: (8, 8),
            mnl.MNL_TYPE_NESTED		: (32, 32),
            mnl.MNL_TYPE_NESTED_COMPAT	: (32, 32),
            mnl.MNL_TYPE_NUL_STRING	: (64, 64),
            mnl.MNL_TYPE_BINARY		: (64, 64),
            # mnl.TYPE_MAX		: (, ),
        }
        self.invalid_len = {
            mnl.MNL_TYPE_U8		: (2, 3),
{'fraction_non_alphanumeric': 0.11948529411764706, 'fraction_numerical': 0.03308823529411765, 'mean_word_length': 2.011992619926199, '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': '4410292', 'n_tokens_mistral': 1400, 'n_tokens_neox': 1315, 'n_words': 226}