Merge pull request 'vars refactor and, stub file to type annotation and add way to take version' (#3) from a2p1k02/fb3test:master into master

Reviewed-on: SiberiaBreadFactory/fb3test#3
This commit is contained in:
SiberiaBreadFactory 2021-05-24 12:30:45 +00:00
commit e7e72e96b0
4 changed files with 13 additions and 11 deletions

Binary file not shown.

View File

@ -1,12 +1,8 @@
import sys
from zipfile import ZipFile
# from bs4 import BeautifulSoup
# from lxml import etree
def reader():
files = input("Enter the path to file: ")
with ZipFile(files) as book:
for row in book.read('2/fb3/body.xml').decode('utf-8').splitlines():
opened = open("test.txt", "a")
opened.write(row)
def reader(path_to_file):
with ZipFile(path_to_file) as book:
for book_content in book.read('2/fb3/body.xml').decode('utf-8').splitlines():
output_content = open("test.txt", "a")
output_content.write(book_content)

1
src/fb3_reader/fb3.pyi Normal file
View File

@ -0,0 +1 @@
def reader(path_to_file: str): ...

View File

@ -1,4 +1,9 @@
from fb3_reader import fb3
from sys import argv
from fb3_reader import fb3, __version__
if __name__ == '__main__':
fb3.reader()
try:
if argv[1] == "--version" or argv[1] == "-v":
print(__version__)
except IndexError:
fb3.reader(input("Enter path to file: "))