




import unittest

from transformers.testing_utils import require_bsa
from transformers.utils import is_bsa_available

from ...test_feature_extraction_common import FeatureExtractionSavingTestMixin


if is_bsa_available():
						from transformers import MarkupLMFeatureExtractor



class    lowercase_		(unittest.TestCase ):



						def __init__(			self	:   Any					,							snake_case__	:   List[Any]  ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_					      =							parent






						def 	__a					(			self	:   Optional[Any]  ):

								"""simple docstring"""

								return {}


def 					_a							(					)->	Optional[int]:
		SCREAMING_SNAKE_CASE_					      =							'''<HTML>

    <HEAD>
    <TITLE>sample document</TITLE>
    </HEAD>

    <BODY BGCOLOR="FFFFFF">
    <HR>
    <a href="http://google.com">Goog</a>
    <H1>This is one header</H1>
    <H2>This is a another Header</H2>
    <P>Travel from
        <P>
        <B>SFO to JFK</B>
        <BR>
        <B><I>on May 2, 2015 at 2:00 pm. For details go to confirm.com </I></B>
        <HR>
        <div style="color:#0000FF">
            <h3>Traveler <b> name </b> is
            <p> John Doe </p>
        </div>'''

		SCREAMING_SNAKE_CASE_					      =							'''
    <!DOCTYPE html>
    <html>
    <body>

    <h1>My First Heading</h1>
    <p>My first paragraph.</p>

    </body>
    </html>
    '''

		return [html_string_a, html_string_a]




@require_bsa
class    lowercase_		(_a							,	unittest.TestCase ):
						lowerCAmelCase__			      =MarkupLMFeatureExtractor if is_bsa_available() else None



						def 	__a					(			self	:   Tuple  ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_					      =							MarkupLMFeatureExtractionTester(self  )



						@property
						def 	__a					(			self	:   int  ):

								"""simple docstring"""

								return self.feature_extract_tester.prepare_feat_extract_dict()






						def 	__a					(			self	:   Optional[int]  ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_					      =							self.feature_extraction_class()

								# Test not batched input
								SCREAMING_SNAKE_CASE_					      =							get_html_strings()[0]
								SCREAMING_SNAKE_CASE_					      =							feature_extractor(_SCREAMING_SNAKE_CASE  )

								# fmt: off
								SCREAMING_SNAKE_CASE_					      =							[['''sample document''', '''Goog''', '''This is one header''', '''This is a another Header''', '''Travel from''', '''SFO to JFK''', '''on May 2, 2015 at 2:00 pm. For details go to confirm.com''', '''Traveler''', '''name''', '''is''', '''John Doe''']]
								SCREAMING_SNAKE_CASE_					      =							[['''/html/head/title''', '''/html/body/a''', '''/html/body/h1''', '''/html/body/h2''', '''/html/body/p''', '''/html/body/p/p/b[1]''', '''/html/body/p/p/b[2]/i''', '''/html/body/p/p/div/h3''', '''/html/body/p/p/div/h3/b''', '''/html/body/p/p/div/h3''', '''/html/body/p/p/div/h3/p''']]
								# fmt: on

								self.assertEqual(encoding.nodes					,							_SCREAMING_SNAKE_CASE  )
								self.assertEqual(encoding.xpaths					,							_SCREAMING_SNAKE_CASE  )

								# Test batched
								SCREAMING_SNAKE_CASE_					      =							get_html_strings()
								SCREAMING_SNAKE_CASE_					      =							feature_extractor(_SCREAMING_SNAKE_CASE  )

								# fmt: off
								SCREAMING_SNAKE_CASE_					      =							expected_nodes + [['''My First Heading''', '''My first paragraph.''']]
								SCREAMING_SNAKE_CASE_					      =							expected_xpaths + [['''/html/body/h1''', '''/html/body/p''']]

								self.assertEqual(len(encoding.nodes  )					,							2  )
								self.assertEqual(len(encoding.xpaths  )					,							2  )

								self.assertEqual(encoding.nodes					,							_SCREAMING_SNAKE_CASE  )
								self.assertEqual(encoding.xpaths					,							_SCREAMING_SNAKE_CASE  )





# Lint as: python3
# pylint: enable=line-too-long
# pylint: disable=g-import-not-at-top,g-bad-import-order,wrong-import-position

__a							     =					'2.13.1'

import platform

import pyarrow
from packaging import version


if version.parse(platform.python_version()) < version.parse('3.7'):
     raise ImportWarning(
         'To use `datasets`, Python>=3.7 is required, and the current version of Python doesn\'t match this condition.'
     )

if version.parse(pyarrow.__version__).major < 8:
     raise ImportWarning(
         'To use `datasets`, the module `pyarrow>=8.0.0` is required, and the current version of `pyarrow` doesn\'t match this condition.\n'
         'If you are running this in a Google Colab, you should probably just restart the runtime to use the right version of `pyarrow`.'
     )

del platform
del pyarrow
del version

from .arrow_dataset import Dataset
from .arrow_reader import ReadInstruction
from .builder import ArrowBasedBuilder, BeamBasedBuilder, BuilderConfig, DatasetBuilder, GeneratorBasedBuilder
from .combine import concatenate_datasets, interleave_datasets
from .dataset_dict import DatasetDict, IterableDatasetDict
from .download import *
from .features import *
from .fingerprint import disable_caching, enable_caching, is_caching_enabled, set_caching_enabled
from .info import DatasetInfo, MetricInfo
from .inspect import (
    get_dataset_config_info,
    get_dataset_config_names,
    get_dataset_infos,
    get_dataset_split_names,
    inspect_dataset,
    inspect_metric,
    list_datasets,
    list_metrics,
)
from .iterable_dataset import IterableDataset
from .load import load_dataset, load_dataset_builder, load_from_disk, load_metric
from .metric import Metric
from .splits import (
    NamedSplit,
    NamedSplitAll,
    Split,
    SplitBase,
    SplitDict,
    SplitGenerator,
    SplitInfo,
    SubSplitInfo,
    percent,
)
from .tasks import *
from .utils import *
from .utils import logging


# deprecated modules
from datasets import arrow_dataset as _arrow_dataset  # isort:skip
from datasets import utils as _utils  # isort:skip
from datasets.utils import download_manager as _deprecated_download_manager  # isort:skip

__a							     =					concatenate_datasets
__a							     =					DownloadConfig
__a							     =					DownloadManager
__a							     =					DownloadMode
__a							     =					DownloadConfig
__a							     =					DownloadMode
__a							     =					DownloadManager

del _arrow_dataset, _utils, _deprecated_download_manager