Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
331 changes: 331 additions & 0 deletions DmitriyVkhtiuk_FT/README.md

Large diffs are not rendered by default.

Binary file added DmitriyVkhtiuk_FT/dist/rss-reader-1.5.tar.gz
Binary file not shown.
43 changes: 43 additions & 0 deletions DmitriyVkhtiuk_FT/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
arabic-reshaper==2.1.3
asn1crypto==1.5.1
beautifulsoup4==4.11.1
certifi==2022.6.15
cffi==1.15.0
charset-normalizer==2.0.12
click==8.1.3
colorama==0.4.5
coverage==6.4.1
cryptography==37.0.2
cssselect2==0.6.0
future==0.18.2
html5lib==1.1
idna==3.3
lxml==4.9.0
numpy==1.23.0
oscrypto==1.3.0
pandas==1.4.3
Pillow==9.1.1
pycparser==2.21
Pygments==2.12.0
pyHanko==0.13.1
pyhanko-certvalidator==0.19.5
PyPDF3==1.0.6
python-bidi==0.4.2
python-dateutil==2.8.2
pytz==2022.1
pytz-deprecation-shim==0.1.0.post0
PyYAML==6.0
qrcode==7.3.1
reportlab==3.6.10
requests==2.28.0
six==1.16.0
soupsieve==2.3.2.post1
svglib==1.3.0
tinycss2==1.1.1
tqdm==4.64.0
tzdata==2022.1
tzlocal==4.2
uritools==4.0.0
urllib3==1.26.9
webencodings==0.5.1
xhtml2pdf==0.2.8
5 changes: 5 additions & 0 deletions DmitriyVkhtiuk_FT/rss_reader/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import sys
import os

sys.path.append((os.path.dirname(__file__)))

Empty file.
Binary file added DmitriyVkhtiuk_FT/rss_reader/font/calibri.ttf
Binary file not shown.
45 changes: 45 additions & 0 deletions DmitriyVkhtiuk_FT/rss_reader/modified_argparser.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import argparse
import sys
from pathlib import Path


class ArgParser(argparse.ArgumentParser):
def error(self, message):
"""
Method modifies default errors from argparse.ArgumentParser class.
Prints a usage message incorporating the message to stderr and exits.
"""
self.print_help(sys.stderr)
self.exit(2, 'Something went wrong - > %s\nPlease, check the "help" and try again\n' % message)

def valid_path(self, path):
"""
Method checks if passed into function path exists and tries to create it if it doesn't.
If path exists or is created successfully, method returns given path,
else - returns default path value for saving files.
:param path: path to check
:return: path for saving files
"""
p = Path(path)
default = Path.cwd() / "default_dir"
if p.exists():
return p
else:
self.valid_path(p.parent)
try:
if p.suffix == ".pdf":
with open(p, "wb"):
pass
elif p.suffix == ".html":
with open(p, "w"):
pass
else:
if not p.is_dir():
p.mkdir()
except OSError:
print("Invalid path.. Saving to the project default dir")
if not default.is_dir():
default.mkdir()
return default
else:
return p
Loading