# Path: android_env/components/log_stream.py
# class LogStream(metaclass=abc.ABCMeta):
#   def __init__(self, verbose: bool = False):
#   def get_stream_output(self):
#   def _get_stream_output(self):
#   def stop_stream(self):
#   def set_log_filters(self, log_filters: List[str]):
# 
# Path: android_env/components/thread_function.py
# class ThreadFunction(metaclass=abc.ABCMeta):
#   class Signal(enum.IntEnum):
#     KILL = 1
#   def __init__(self, block_input: bool, block_output: bool, name: str):
#   def read(self, block: bool = True, timeout: Optional[float] = None):
#   def write(self, value, block: bool = True, timeout: Optional[float] = None):
#   def main(self):
#   def kill(self):
#   def _run(self):
#   def _read_value(self):
#   def _write_value(self, value):


import re
import threading
from typing import Callable, Match, NamedTuple, Optional, Pattern
from absl import logging
from android_env.components import log_stream as log_stream_lib
from android_env.components import thread_function
from android_env.proto import task_pb2
# coding=utf-8
# Copyright 2021 DeepMind Technologies Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""A class that launches a thread to read Android logcat outputs."""

# `typing.Pattern` has been deprecated in Python 3.9 in favor of `re.Pattern`,
# but it is not available even in slightly older Python versions.
# Please see https://www.python.org/dev/peps/pep-0585/



class EventListener(NamedTuple):
  regexp: Pattern[str]
  handler_fn: Callable[[Pattern[str], Match[str]], None]



# Path: android_env/components/log_stream.py
# class LogStream(metaclass=abc.ABCMeta):
#   def __init__(self, verbose: bool = False):
#   def get_stream_output(self):
#   def _get_stream_output(self):
#   def stop_stream(self):
#   def set_log_filters(self, log_filters: List[str]):
# 
# Path: android_env/components/thread_function.py
# class ThreadFunction(metaclass=abc.ABCMeta):
#   class Signal(enum.IntEnum):
#     KILL = 1
#   def __init__(self, block_input: bool, block_output: bool, name: str):
#   def read(self, block: bool = True, timeout: Optional[float] = None):
#   def write(self, value, block: bool = True, timeout: Optional[float] = None):
#   def main(self):
#   def kill(self):
#   def _run(self):
#   def _read_value(self):
#   def _write_value(self, value):


# Path: android_env/components/logcat_thread.py
import re
import threading
from typing import Callable, Match, NamedTuple, Optional, Pattern
from absl import logging
from android_env.components import log_stream as log_stream_lib
from android_env.components import thread_function
from android_env.proto import task_pb2

# coding=utf-8
# Copyright 2021 DeepMind Technologies Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""A class that launches a thread to read Android logcat outputs."""

# `typing.Pattern` has been deprecated in Python 3.9 in favor of `re.Pattern`,
# but it is not available even in slightly older Python versions.
# Please see https://www.python.org/dev/peps/pep-0585/



class EventListener(NamedTuple):
  regexp: Pattern[str]
  handler_fn: Callable[[Pattern[str], Match[str]], None]



class LogcatThread(thread_function.ThreadFunction):