<commit_before>from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from builtins import *  # NOQA
from future import standard_library
standard_library.install_aliases()

import chainer
import funcsigs

from chainerrl.recurrent import RecurrentChainMixin


class Sequence(chainer.ChainList, RecurrentChainMixin):

    def __init__(self, *layers):
        self.layers = layers
        links = [layer for layer in layers if isinstance(layer, chainer.Link)]
        # Cache the signatures because it might be slow
        self.argnames = [set(funcsigs.signature(layer).parameters)
                         for layer in layers]
        self.argnames = [set(funcsigs.signature(layer).parameters)
                         for layer in layers]
        super().__init__(*links)

    def __call__(self, x, **kwargs):
        h = x
        for layer, argnames in zip(self.layers, self.argnames):
            layer_kwargs = {k: v for k, v in kwargs.items()
                            if k in argnames}<commit_msg>Remove unnecessarily duplicated lines<commit_after>from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from builtins import *  # NOQA
from future import standard_library
standard_library.install_aliases()

import chainer
import funcsigs

from chainerrl.recurrent import RecurrentChainMixin


class Sequence(chainer.ChainList, RecurrentChainMixin):

    def __init__(self, *layers):
        self.layers = layers
        links = [layer for layer in layers if isinstance(layer, chainer.Link)]
        # Cache the signatures because it might be slow
        self.argnames = [set(funcsigs.signature(layer).parameters)
                         for layer in layers]
        super().__init__(*links)

    def __call__(self, x, **kwargs):
        h = x
        for layer, argnames in zip(self.layers, self.argnames):
            layer_kwargs = {k: v for k, v in kwargs.items()
                            if k in argnames}
{'fraction_non_alphanumeric': 0.06922712185870081, 'fraction_numerical': 0.0, 'mean_word_length': 2.94392523364486, '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': '1975712', 'n_tokens_mistral': 579, 'n_tokens_neox': 555, 'n_words': 186}