






'''simple docstring'''





import itertools
from dataclasses import dataclass
from io import StringIO
from typing import Optional

import pyarrow as pa

import datasets
from datasets.features.features import require_storage_cast
from datasets.table import table_cast


a_      = datasets.utils.logging.get_logger(__name__)





@dataclass
class 		SCREAMING_SNAKE_CASE__   (     datasets.BuilderConfig    ):
		_UpperCAmelCase         =None
		_UpperCAmelCase         ="utf-8"
		_UpperCAmelCase         =None
		_UpperCAmelCase         =10 << 20  # 10MB
		_UpperCAmelCase         =False
		_UpperCAmelCase         ="line"





class 		SCREAMING_SNAKE_CASE__   (     datasets.ArrowBasedBuilder    ):
		_UpperCAmelCase         =TextConfig



		def _lowerCAmelCase     (    self:    Any)  ->Dict:






								'''simple docstring'''


								return datasets.DatasetInfo(features=self.config.features)



		def _lowerCAmelCase     (    self:    str				,   a:    str)  ->Union[str, Any]:






								'''simple docstring'''


								if not self.config.data_files:
														raise ValueError(f"""At least one data file must be specified, but got data_files={self.config.data_files}""")
								a_				     =   dl_manager.download_and_extract(self.config.data_files)
								if isinstance(a				,   (str, list, tuple)):
														a_				     =   data_files
														if isinstance(a				,   a):
																				a_				     =   [files]
														a_				     =   [dl_manager.iter_files(a) for file in files]
														return [datasets.SplitGenerator(name=datasets.Split.TRAIN				,   gen_kwargs={"files": files})]
								a_				     =   []
								for split_name, files in data_files.items():
														if isinstance(a				,   a):
																				a_				     =   [files]
														a_				     =   [dl_manager.iter_files(a) for file in files]
														splits.append(datasets.SplitGenerator(name=a				,   gen_kwargs={"files": files}))
								return splits



		def _lowerCAmelCase     (    self:    List[str]				,   a:    pa.Table)  ->pa.Table:






								'''simple docstring'''


								if self.config.features is not None:
														a_				     =   self.config.features.arrow_schema
														if all(not require_storage_cast(a) for feature in self.config.features.values()):
																				# cheaper cast
																				a_				     =   pa_table.cast(a)
														else:
																				# more expensive cast; allows str <-> int/float or str to Audio for example
																				a_				     =   table_cast(a				,   a)
														return pa_table
								else:
														return pa_table.cast(pa.schema({"text": pa.string()}))




		def _lowerCAmelCase     (    self:    List[Any]				,   a:    Tuple)  ->int:






								'''simple docstring'''


								a_				     =   list(self.config.features) if self.config.features is not None else ["text"]
								for file_idx, file in enumerate(itertools.chain.from_iterable(a)):
														# open in text mode, by default translates universal newlines ("\n", "\r\n" and "\r") into "\n"
														with open(a				,   encoding=self.config.encoding				,   errors=self.config.errors) as f:
																				if self.config.sample_by == "line":
																										a_				     =   0
																										while True:
																																a_				     =   f.read(self.config.chunksize)
																																if not batch:
																																						break
																																batch += f.readline()  # finish current line
																																# StringIO.readlines, by default splits only on "\n" (and keeps line breaks)
																																a_				     =   StringIO(a).readlines()
																																if not self.config.keep_linebreaks:
																																						a_				     =   [line.rstrip("\n") for line in batch]
																																a_				     =   pa.Table.from_arrays([pa.array(a)]				,   names=a)
																																# Uncomment for debugging (will print the Arrow table size and elements)
																																# logger.warning(f"pa_table: {pa_table} num rows: {pa_table.num_rows}")
																																# logger.warning('\n'.join(str(pa_table.slice(i, 1).to_pydict()) for i in range(pa_table.num_rows)))
																																yield (file_idx, batch_idx), self._cast_table(a)
																																batch_idx += 1
																				elif self.config.sample_by == "paragraph":
																										a_				     =   0
																										a_				     =   ""
																										while True:
																																a_				     =   f.read(self.config.chunksize)
																																if not new_batch:
																																						break
																																batch += new_batch
																																batch += f.readline()  # finish current line
																																a_				     =   batch.split("\n\n")
																																a_				     =   pa.Table.from_arrays(
																																    [pa.array([example for example in batch[:-1] if example])]				,   names=a)
																																# Uncomment for debugging (will print the Arrow table size and elements)
																																# logger.warning(f"pa_table: {pa_table} num rows: {pa_table.num_rows}")
																																# logger.warning('\n'.join(str(pa_table.slice(i, 1).to_pydict()) for i in range(pa_table.num_rows)))
																																yield (file_idx, batch_idx), self._cast_table(a)
																																batch_idx += 1
																																a_				     =   batch[-1]
																										if batch:
																																a_				     =   pa.Table.from_arrays([pa.array([batch])]				,   names=a)
																																yield (file_idx, batch_idx), self._cast_table(a)
																				elif self.config.sample_by == "document":
																										a_				     =   f.read()
																										a_				     =   pa.Table.from_arrays([pa.array([text])]				,   names=a)
																										yield file_idx, self._cast_table(a)











'''simple docstring'''





import requests
from bsa import BeautifulSoup



def 			__UpperCAmelCase				(lowercase__	,lowercase__				)		->				str:

						'''simple docstring'''


						a_				     =   (
						    "https://www.horoscope.com/us/horoscopes/general/"
						    F"""horoscope-general-daily-{day}.aspx?sign={zodiac_sign}"""
						)
						a_				     =   BeautifulSoup(requests.get(lowercase__				).content	,"html.parser"				)
						return soup.find("div"	,class_="main-horoscope"				).p.text


if __name__ == "__main__":
							print('Daily Horoscope. \n')
							print(
							    'enter your Zodiac sign number:\n',
							    '1. Aries\n',
							    '2. Taurus\n',
							    '3. Gemini\n',
							    '4. Cancer\n',
							    '5. Leo\n',
							    '6. Virgo\n',
							    '7. Libra\n',
							    '8. Scorpio\n',
							    '9. Sagittarius\n',
							    '10. Capricorn\n',
							    '11. Aquarius\n',
							    '12. Pisces\n',
							)
							a_      = int(input('number> ').strip())
							print('choose some day:\n', 'yesterday\n', 'today\n', 'tomorrow\n')
							a_      = input('enter the day> ')
							a_      = horoscope(zodiac_sign, day)
							print(horoscope_text)



