<commit_before>#!/usr/bin/env python
# coding=utf-8
# Filename: jpp.py
# pylint: disable=
"""
Pump for the jpp file read through aanet interface.

"""
from __future__ import division, absolute_import, print_function

import numpy as np

from km3pipe import Pump
from km3pipe.dataclasses import HitSeries
from km3pipe.logger import logging

log = logging.getLogger(__name__)  # pylint: disable=C0103


class JPPPump(Pump):
    """A pump for JPP ROOT files."""

    def __init__(self, **context):
        super(self.__class__, self).__init__(**context)

        try:
            import jppy  # noqa
        except ImportError:
            raise ImportError("\nPlease install the jppy package:\n\n"
                              "    pip install jppy\n")

        self.index = self.get('index') or 0
        self.filename = self.get('filename')

        self.reader = jppy.PyJDAQEventReader(self.filename)
		self.blobs = self.blob_generator()

    def blob_generator(self):
        while self.reader.has_next():
            self.reader.retrieve_next_event()
            self.index += 1

            n = self.reader.get_number_of_snapshot_hits()
            channel_ids = np.zeros(n, dtype='i')
            dom_ids = np.zeros(n, dtype='i')
            times = np.zeros(n, dtype='i')
            tots = np.zeros(n, dtype='i')
            triggereds = np.zeros(n, dtype='i')

            self.reader.get_hits(channel_ids, dom_ids, times, tots, triggereds)

            hit_series = HitSeries.from_arrays(
                channel_ids, dom_ids, np.arange(n), np.zeros(n), times, tots,
                triggereds, self.index
            )

            yield {'FrameIndex': self.reader.get_frame_index(),
                   'Hits': hit_series}

	def process(self, blob):
		return next(self.blobs)

    def __iter__(self):
        return self

    def next(self):
        """Python 2/3 compatibility for iterators"""
        return self.__next__()

    def __next__(self):
        return next(self.blobs)<commit_msg>Fix mixed indent<commit_after>#!/usr/bin/env python
# coding=utf-8
# Filename: jpp.py
# pylint: disable=
"""
Pump for the jpp file read through aanet interface.

"""
from __future__ import division, absolute_import, print_function

import numpy as np

from km3pipe import Pump
from km3pipe.dataclasses import HitSeries
from km3pipe.logger import logging

log = logging.getLogger(__name__)  # pylint: disable=C0103


class JPPPump(Pump):
    """A pump for JPP ROOT files."""

    def __init__(self, **context):
        super(self.__class__, self).__init__(**context)

        try:
            import jppy  # noqa
        except ImportError:
            raise ImportError("\nPlease install the jppy package:\n\n"
                              "    pip install jppy\n")

        self.index = self.get('index') or 0
        self.filename = self.get('filename')

        self.reader = jppy.PyJDAQEventReader(self.filename)
        self.blobs = self.blob_generator()

    def blob_generator(self):
        while self.reader.has_next():
            self.reader.retrieve_next_event()
            self.index += 1

            n = self.reader.get_number_of_snapshot_hits()
            channel_ids = np.zeros(n, dtype='i')
            dom_ids = np.zeros(n, dtype='i')
            times = np.zeros(n, dtype='i')
            tots = np.zeros(n, dtype='i')
            triggereds = np.zeros(n, dtype='i')

            self.reader.get_hits(channel_ids, dom_ids, times, tots, triggereds)

            hit_series = HitSeries.from_arrays(
                channel_ids, dom_ids, np.arange(n), np.zeros(n), times, tots,
                triggereds, self.index
            )

            yield {'FrameIndex': self.reader.get_frame_index(),
                   'Hits': hit_series}

    def process(self, blob):
        return next(self.blobs)

    def __iter__(self):
        return self

    def next(self):
        """Python 2/3 compatibility for iterators"""
        return self.__next__()

    def __next__(self):
        return next(self.blobs)
{'fraction_non_alphanumeric': 0.11271102284011916, 'fraction_numerical': 0.005958291956305859, 'mean_word_length': 2.2756097560975608, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4851925', 'n_tokens_mistral': 1291, 'n_tokens_neox': 1227, 'n_words': 293}