


from unittest.mock import Mock, patch

from file_transfer.send_file import send_file





@patch("""socket.socket"""						)
@patch("""builtins.open"""						)
def   _lowerCAmelCase				(   UpperCamelCase__:     Tuple							,					UpperCamelCase__:     List[Any]						) ->   List[Any]:





 """simple docstring"""







 A								=				Mock()
 A								=				conn, Mock()
 A								=				iter([1, None]						)
 A								=				lambda UpperCamelCase__						: next(lowerCamelCase_						)

 # ===== invoke =====
 send_file(filename="""mytext.txt"""							,					testing=lowerCamelCase_						)

 # ===== ensurance =====
 sock.assert_called_once()
 sock.return_value.bind.assert_called_once()
 sock.return_value.listen.assert_called_once()
 sock.return_value.accept.assert_called_once()
 conn.recv.assert_called_once()

 file.return_value.__enter__.assert_called_once()
 file.return_value.__enter__.return_value.read.assert_called()

 conn.send.assert_called_once()
 conn.close.assert_called_once()
 sock.return_value.shutdown.assert_called_once()
 sock.return_value.close.assert_called_once()







from __future__ import annotations

import requests





def   _lowerCAmelCase				(   UpperCamelCase__:     str						) ->   dict:





	"""simple docstring"""







	A								=				f'https://hacker-news.firebaseio.com/v0/item/{story_id}.json?print=pretty'
	return requests.get(UpperCamelCase__						).json()





def   _lowerCAmelCase				(   UpperCamelCase__:     int = 10						) ->   list[dict]:





	"""simple docstring"""







	A								=				"""https://hacker-news.firebaseio.com/v0/topstories.json?print=pretty"""
	A								=				requests.get(UpperCamelCase__						).json()[:max_stories]
	return [get_hackernews_story(UpperCamelCase__						) for story_id in story_ids]





def   _lowerCAmelCase				(   UpperCamelCase__:     int = 10						) ->   str:





	"""simple docstring"""







	A								=				hackernews_top_stories(UpperCamelCase__						)
	return "\n".join("""* [{title}]({url})""".format(**UpperCamelCase__						) for story in stories						)


if __name__ == "__main__":
				print(hackernews_top_stories_as_markdown())



