Skip to content

Anna_Gonchar_raphaelkyzy@gmail.com#16

Open
AnnaPotter wants to merge 7 commits into
epam-python-courses-7-bsu:masterfrom
AnnaPotter:master
Open

Anna_Gonchar_raphaelkyzy@gmail.com#16
AnnaPotter wants to merge 7 commits into
epam-python-courses-7-bsu:masterfrom
AnnaPotter:master

Conversation

@AnnaPotter

Copy link
Copy Markdown

No description provided.

Comment thread final_task/rss_reader/action_functions.py
Comment thread final_task/rss_reader/models.py Outdated
import argparse


class ArgReader:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need a wrapping class for parser? You could just make a function just like init() method here and return parser object

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Comment thread final_task/rss_reader/models.py
Comment thread final_task/rss_reader/action_functions.py Outdated
Comment thread final_task/rss_reader/rss_reader.py Outdated
Comment thread final_task/rss_reader/validation_functions.py Outdated
Comment thread final_task/rss_reader/validation_functions.py Outdated
Comment thread final_task/rss_reader/validation_functions.py Outdated
Comment thread final_task/rss_reader/json_structure.txt Outdated
@HenadziStantchik

Copy link
Copy Markdown
Collaborator

Here is some feedback on your application work:

  1. There should not be any HTML code in the printed news (check the example and image below)
    Same for the JSON format

  2. Your app has encoding problem (check the image below)

ma

  1. User should be able to get the app version without specifying RSS source. For example like this:
    python rss_reader.py --version

Comment thread final_task/rss_reader/action_functions.py Outdated
@HenadziStantchik

Copy link
Copy Markdown
Collaborator
  1. There should not be any HTML code in the printed news (check the example and image below)
    Same for the JSON format
  2. Your app has encoding problem (check the image below)

ma

@AnnaPotter AnnaPotter changed the title Anna_Gonchar_raphaelkyzy@gmail.com Anna_Gonchar_raphaelkyzy@gmail.com - PLEASE REVIEW Nov 16, 2019
@HenadziStantchik

Copy link
Copy Markdown
Collaborator

Iteration 1 does not seem to have issues anymore. Proceed to the next Iteration

Comment thread final_task/rss_reader/rss_reader.py Outdated
Comment thread final_task/rss_reader/validation_functions.py Outdated
Comment thread final_task/rss_reader/validation_functions.py Outdated
@HenadziStantchik HenadziStantchik changed the title Anna_Gonchar_raphaelkyzy@gmail.com - PLEASE REVIEW Anna_Gonchar_raphaelkyzy@gmail.com Nov 16, 2019
@AnnaPotter AnnaPotter changed the title Anna_Gonchar_raphaelkyzy@gmail.com Anna_Gonchar_raphaelkyzy@gmail.com-PLEASE REVIEW Nov 18, 2019
Comment thread final_task/rss_reader/exceptions.py Outdated
Comment thread final_task/setup.py Outdated
@HenadziStantchik HenadziStantchik changed the title Anna_Gonchar_raphaelkyzy@gmail.com-PLEASE REVIEW Anna_Gonchar_raphaelkyzy@gmail.com Nov 19, 2019
@AnnaPotter

AnnaPotter commented Nov 22, 2019

Copy link
Copy Markdown
Author

README.md will be fixed in the next commit.

@AnnaPotter AnnaPotter changed the title Anna_Gonchar_raphaelkyzy@gmail.com Anna_Gonchar_raphaelkyzy@gmail.com - PLEASE REVIEW Nov 22, 2019
# get valid limit argument
# if not initialize limit argument
if not check_limit_arg(com_line_args, logger):
limit = len(news_collection["entries"])

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, you may want to set limit to None and refactor your logic below.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

limit = com_line_args.limit

if len(news_collection["entries"]) < limit:
logger.warning("The number of news is less than the value of the argument limit.")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To my mind, it's not the warning that user may want to see. For example, we have only 3 news and the limit is 5. It's completly ok. You could notify user, available news > chosen limit. But this is optional

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This warning only for me, users can see only errors or higher level logs.

@dzhigailo dzhigailo changed the title Anna_Gonchar_raphaelkyzy@gmail.com - PLEASE REVIEW Anna_Gonchar_raphaelkyzy@gmail.com Nov 23, 2019
@AnnaPotter AnnaPotter changed the title Anna_Gonchar_raphaelkyzy@gmail.com Anna_Gonchar_raphaelkyzy@gmail.com - PLEASE REVIEW Nov 25, 2019
@HenadziStantchik

Copy link
Copy Markdown
Collaborator
  1. It there are no images in the article, Images links are printed empty:
    image

  2. -h is bugged:
    image

  3. Keep in mind that converted file should contain images, not just links to them.

  4. Pdf conversion does not work:
    image

@HenadziStantchik HenadziStantchik changed the title Anna_Gonchar_raphaelkyzy@gmail.com - PLEASE REVIEW Anna_Gonchar_raphaelkyzy@gmail.com Nov 25, 2019
Comment on lines +3 to +13
Functions:
create_logger(com_line_args) -> logger
get_com_line_args() -> com_line_args
get_news(command_line_args, logger) -> news_collection
print_news_stdout(news_collection) -> None
print_news_json(news_collection) -> None
print_news(news_collection, com_line_args, logger) -> None
print_cache_news(news_collection, logger) -> None
print_cache_news_json(news_collection, logger) -> None
convert_date(date_str, logger) -> str_date
clean_str(string) -> clean_string """

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here and below: there is actually no need to write function list in module docstring.

Comment on lines +48 to +70
pdf.set_font('Arial', size=12)
pdf.set_text_color(0, 255, 0)
pdf.ln(10)
pdf.multi_cell(0, 10, align="C", txt="News")
pdf.set_text_color(0, 0, 255)
pdf.write(10, "Feed title: ")
pdf.set_text_color(0, 0, 0)
pdf.multi_cell(0, 10, txt=f" {news.feed_title}")
pdf.set_text_color(0, 0, 255)
pdf.write(10, "News title: ")
pdf.set_text_color(0, 0, 0)
pdf.multi_cell(0, 10, txt=f"{news.title}")
pdf.set_text_color(0, 0, 255)
pdf.write(10, "News publication date: ")
pdf.set_text_color(0, 0, 0)
pdf.multi_cell(0, 10, txt=f"{news.date}")
pdf.set_text_color(0, 0, 255)
pdf.write(10, "Summary: ")
pdf.set_text_color(0, 0, 0)
pdf.multi_cell(0, 10, txt=f"{news.summary}")
pdf.set_text_color(0, 0, 255)
pdf.write(10, "News link: ")
pdf.set_text_color(0, 0, 0)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better to think of a way to simplify this.

@HenadziStantchik

Copy link
Copy Markdown
Collaborator

Here is feedback on your application:
Iteration 1:
Everything works fine.
Iteration 2:
Installs, but does not work:
image
Iteration 3:
Does not work:
image
Iteration 4:
Everything works fine

Tests are decently written. Coverage percentage is high enough.
The code overall is readable, absolutely corresponds to the PEP8 guidelines.
Commit messages could be a bit more informative. Also they mostly correspond to the recommended commit message style.

@AnnaPotter

Copy link
Copy Markdown
Author

Thanks a lot for review. A little annoying for the third iteration, because I checked. But now it really does not work... Thanks again)

if source:
for hash_date_key in news_dict:
if date in hash_date_key:
if hash_date_key.split()[1] == date.partition(' ')[0]:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line (and the same line below) breaks your date search algorithm for days of month that start from 0, e.g. 01,02,03.
For example for specified --date 20191203 in this function:

date = 3 Dec 2019
hash_date_key = 'Tue, 03 Dec 2019 07:11:16 -0500'
date in hash_date_key -> True

BUT:
hash_date_key.split()[1] -> '03'
and
date.partition(' ')[0] -> '3'

I actually noted that your Iteration 3 worked before final review.

@HenadziStantchik

Copy link
Copy Markdown
Collaborator

A little annoying for the third iteration, because I checked. But now it really does not work...

After a bit of investigation, check my comment about caching_functions.py above

@AnnaPotter

Copy link
Copy Markdown
Author

You are right, it was these two lines that broke the whole iteration. It’s just that the dates came in the format (Publication date: Wed, 5 Feb 2014 09:00:00 -0500) on my news feed and my previous version of the function with parameter --date 20190205 / 2019025, for example, did not work correctly. It displayed either the lack of news, or the news from 20190215/20190225. I tried to fix this bug, but I did not think through it thoroughly. Next time I will be more attentive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants