Skip to content

Roman_Shagun_rshag17@gmail.com#24

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

Roman_Shagun_rshag17@gmail.com#24
mdalag wants to merge 8 commits into
epam-python-courses-7-bsu:masterfrom
mdalag:master

Conversation

@mdalag

@mdalag mdalag commented Nov 16, 2019

Copy link
Copy Markdown

No description provided.

Add exceptions.py for custom exceptions
Add logger.py for convenient output managment
Add rss_feed.py to represent whole rss rss feed
Add rss_item.py to store a single news item
Implement rss_reader.py
Add non-standart libs in requirements.txt
 - Add tests for RssFeed and RssItem classes.
 - Refactor rss_reader.init_feed(): add new func
to init list of news_items separately
 - Change RssFeed.print_feed() to be
more convenient for usage and testing
 - Add README
Comment thread final_task/rss_reader/classes/logger.py Outdated
Comment thread final_task/rss_reader/classes/rss_item.py Outdated
Comment thread final_task/rss_reader/rss_reader.py Outdated
Comment thread final_task/rss_reader/classes/rss_feed.py Outdated
Comment thread final_task/rss_reader/requirements.txt Outdated
@HenadziStantchik

Copy link
Copy Markdown
Collaborator

If the --limit is not specified, user should get all available feed. The same if the limit is too large.

@HenadziStantchik HenadziStantchik changed the title Roman_Shagun_rshag17@gmail.com - PLEASE REVIEW Roman_Shagun_rshag17@gmail.com Nov 17, 2019
 - Implement setup.py
 - Add installation guide to README
 - Refactor code to log without custom logger
 - Fix PEP8 issues in rss_feed.py
 - Refactor rss_item.py to decode symbols via html lib
 - Remove standart libs fom requirements.txt
 - Fix var name issues in rss_feed.py
@mdalag mdalag changed the title Roman_Shagun_rshag17@gmail.com Roman_Shagun_rshag17@gmail.com - PLEASE REVIEW Nov 17, 2019
Comment thread final_task/rss_reader/classes/exceptions.py Outdated
Comment thread final_task/rss_reader/classes/rss_feed.py Outdated
Comment thread final_task/rss_reader/rss_reader.py Outdated
Comment thread final_task/rss_reader/rss_reader.py Outdated
Comment thread final_task/setup.py Outdated
@HenadziStantchik

HenadziStantchik commented Nov 18, 2019

Copy link
Copy Markdown
Collaborator

Your app does not work if user tries to run it without using setuptools. (ModuleNotFoundError)

@HenadziStantchik HenadziStantchik changed the title Roman_Shagun_rshag17@gmail.com - PLEASE REVIEW Roman_Shagun_rshag17@gmail.com Nov 18, 2019
 - Fix function names
 - Fix global variables names
 - Use slices in rss_reader.init_news_list
 - Implement manual adding of packages in setup.py
 - Change project structure to fix import errors
 - Change README
 - Add test for rss_reader.py
 - Add test test_feed.xml as test feed
@mdalag mdalag changed the title Roman_Shagun_rshag17@gmail.com Roman_Shagun_rshag17@gmail.com - PLEASE REVIEW Nov 20, 2019
Comment thread final_task/rss_reader/rss_item.py
Comment thread final_task/rss_reader/rss_item.py Outdated
Comment thread final_task/rss_reader/rss_reader.py Outdated
@HenadziStantchik

Copy link
Copy Markdown
Collaborator

Here is some feedback on your app work:

  1. Your app does not print DESCRIPTION field of news entry. (check the example in FinalTAsk.md)

Keep in mind that it should not have encoding problems too.

  1. --date does not work together with --json

@HenadziStantchik HenadziStantchik changed the title Roman_Shagun_rshag17@gmail.com - PLEASE REVIEW Roman_Shagun_rshag17@gmail.com Nov 20, 2019
 - Fix multiple exit points
 - Add DESCRIPTION
 - Fix --date now working with --json
 - Refactor rss_reader to be more clear
 - Add converters to .pdf and .html
@mdalag mdalag changed the title Roman_Shagun_rshag17@gmail.com Roman_Shagun_rshag17@gmail.com - PLEASE REVIEW Nov 22, 2019
Comment thread final_task/rss_reader/converters.py Outdated
Comment thread final_task/rss_reader/converters.py Outdated
Comment thread final_task/rss_reader/rss_reader.py Outdated
Comment thread .coverage Outdated
@@ -0,0 +1 @@
!coverage.py: This is a private format, don't read it directly!{"lines":{"/home/mdalag/Documents/epam_task/FinalTaskRssParser/final_task/rss_reader/converters.py":[1,2,3,5,6,7,8,10,12,13,15,19,20,21,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,76,78,87,88,89,90,91,92,93,96,158],"/home/mdalag/Documents/epam_task/FinalTaskRssParser/final_task/rss_reader/exceptions_.py":[1,4,5,8,9,12,13],"/home/mdalag/Documents/epam_task/FinalTaskRssParser/final_task/rss_reader/rss_feed.py":[1,2,3,4,5,6,7,8,10,11,13,14,17,18,19,20,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36,37,38,45,46,47,49,50,52,53,54,55,56,61,62,63,64,65,67,68,69,70,71,72,73,74,75,76,77,78,79],"/home/mdalag/Documents/epam_task/FinalTaskRssParser/final_task/rss_reader/rss_reader.py":[1,2,3,4,5,6,7,8,9,10,11,13,14,15,16,19,22,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,120,132,141,157,159,168,183,199,201,206],"/home/mdalag/Documents/epam_task/FinalTaskRssParser/final_task/rss_reader/rss_item.py":[1,2,3,4,5,8,17,18,19,20,21,22,23,24,25,27,28,29,30,32,33,34,35,36,37,38,39,40,41,42,43,44,45,47,48,50,51,52,53,54,56,57,59,60,62,63],"/home/mdalag/Documents/epam_task/FinalTaskRssParser/final_task/__init__.py":[1],"/home/mdalag/Documents/epam_task/FinalTaskRssParser/final_task/rss_reader/__init__.py":[1]}} No newline at end of file

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.

Please, add this file and file below to .gitignore

Comment thread final_task/rss_reader/.coverage Outdated
@@ -0,0 +1 @@
!coverage.py: This is a private format, don't read it directly!{"lines":{"/usr/local/lib/python3.7/dist-packages/rss_reader-1.0-py3.7.egg/tests/test_rss_item.py":[1,2,3,4,6,7,10,12],"/home/mdalag/Documents/epam_task/FinalTaskRssParser/final_task/rss_reader/rss_item.py":[1,2,3,4,5,8,17,18,19,20,21,22,23,24,25,27,32,33,45,52,62],"/home/mdalag/.local/lib/python3.7/site-packages/jsonpickle/__init__.py":[55,56,58,59,60,63,64,65,66,67,68,70,73,76,77,78,79,80,81,84,85],"/home/mdalag/.local/lib/python3.7/site-packages/jsonpickle/backend.py":[1,129,3,132,133,6,135,268,269,270,16,17,146,19,274,277,21,24,25,28,30,31,32,36,167,39,169,42,44,45,46,175,47,48,49,51,59,198,200,77,205,99,101,230,102,103,106,107,112,113,116,249,122,125,126],"/home/mdalag/.local/lib/python3.7/site-packages/jsonpickle/compat.py":[1,2,3,4,33,6,7,8,10,11,13,14,15,16,17,18,19,20],"/usr/lib/python3/dist-packages/simplejson/__init__.py":[132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,402,403,408,538,158,288,573,466,99,100,101,103,104,105,108,110,112,113,114,115,116,117,118,119,123,125],"/usr/lib/python3/dist-packages/simplejson/errors.py":[2,3,6,38,40,15,52,26],"/usr/lib/python3/dist-packages/simplejson/raw_json.py":[8,2,4,7],"/usr/lib/python3/dist-packages/simplejson/decoder.py":[2,3,4,5,6,7,8,137,10,11,12,13,139,140,16,143,144,272,20,22,24,25,29,30,31,33,36,37,38,41,43,44,300,47,304,49,50,51,348,349,350,351,352,353,354,355,356,357,358,359,360,361,363,236,376],"/usr/lib/python3/dist-packages/simplejson/compat.py":[32,2,3,4,34,20,21,22,25,27,28,29,30,31],"/usr/lib/python3/dist-packages/simplejson/scanner.py":[2,3,4,5,6,7,8,11,13,15,16,17,20,85],"/usr/lib/python3/dist-packages/simplejson/encoder.py":[2,3,4,5,7,8,9,10,11,12,137,138,15,139,17,18,147,20,21,22,275,24,25,26,27,28,29,30,406,32,34,36,38,427,428,429,430,431,304,432,433,434,435,436,437,438,439,65,395,397,229,230,231,232,233,234,107,235,109,236,237,238,239,240,241,242,243,245,246,248,250,252,254,383],"/home/mdalag/.local/lib/python3.7/site-packages/jsonpickle/pickler.py":[7,8,9,10,11,12,139,14,15,16,17,18,19,144,149,533,158,34,546,295,171,559,307,181,184,314,322,581,592,598,216,220,606,99,612,487,622,111,495,241,244],"/home/mdalag/.local/lib/python3.7/site-packages/jsonpickle/util.py":[257,387,517,137,10,11,12,13,14,15,16,17,18,147,20,21,22,23,276,25,535,28,29,156,287,32,165,174,46,49,179,307,440,188,323,327,455,456,202,459,333,340,471,526,220,479,97,231,369,114,498,499,500,503,377,510,127],"/home/mdalag/.local/lib/python3.7/site-packages/jsonpickle/tags.py":[8,9,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],"/home/mdalag/.local/lib/python3.7/site-packages/jsonpickle/handlers.py":[129,9,10,11,12,13,14,140,16,17,144,141,20,22,23,24,152,26,153,164,44,174,175,176,179,180,182,186,61,190,193,66,71,72,199,200,203,76,207,82,83,84,85,210,211,88,213,90,216,220,226,227,100,229,233,109,237,121],"/home/mdalag/.local/lib/python3.7/site-packages/jsonpickle/unpickler.py":[134,7,8,9,392,11,12,13,14,15,16,522,20,661,664,155,667,285,541,292,550,167,295,678,44,173,301,308,53,439,696,574,325,328,456,586,80,81,209,336,84,212,598,87,216,91,92,219,222,96,100,484,104,108,110,498,117,501,504,635],"/home/mdalag/.local/lib/python3.7/site-packages/jsonpickle/version.py":[1]}} No newline at end of file

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.

All .coverage related files should be added to .gitignore

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.

Done

Comment thread final_task/rss_reader/converters.py Outdated
path += '/feed-' + str(datetime.datetime.now()) + get_extention(mode)
try:
LOGGER.debug('TRYING TO CREATE FILE...')
export_file = open(path, 'w', encoding='utf-8')

@dzhigailo dzhigailo Nov 23, 2019

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.

'w' flag in open function will always create new file if one not exists or overwrite existing file. If you want to check if path is valid, you could use tools from os lib
Also, please always use context manager while working with files.

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.

Got it

@HenadziStantchik

Copy link
Copy Markdown
Collaborator
  1. Please ensure that you have no encoding problems in converted html file.

Aside from this, i did not discover any issues with Iteration 4 work

@HenadziStantchik HenadziStantchik changed the title Roman_Shagun_rshag17@gmail.com - PLEASE REVIEW Roman_Shagun_rshag17@gmail.com Nov 23, 2019
Comment thread final_task/rss_reader/converters.py Outdated
pdf.set_x(4)
pdf.cell(20, 6, 'Description:', ln=1)
pdf.set_x(20)
if len(news_item['description']) == 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.

if not news_item['description']:

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

 - Fix indicated errors
 - Use pkg_resources for dynamic font detection
 - Change .pdf font to handle more symbols
 - Add font to MANIFEST.in
 - Fix unescaped characters in json and html
 - Change README.md setup section
 - Add tests for rss_reader
@mdalag mdalag changed the title Roman_Shagun_rshag17@gmail.com Roman_Shagun_rshag17@gmail.com - PLEASE REVIEW Nov 24, 2019
@HenadziStantchik

Copy link
Copy Markdown
Collaborator

I did not discover any issues with Iteration 4 functionality, but be sure to test it thoroughly in case I missed something

@HenadziStantchik HenadziStantchik changed the title Roman_Shagun_rshag17@gmail.com - PLEASE REVIEW Roman_Shagun_rshag17@gmail.com Nov 24, 2019
- Add colored output for news feed via colorama
 - Convertion now works on Windows
Comment thread final_task/README.md
Comment on lines +8 to +26
usage: rss_reader.py [-h] [--version] [--json] [--verbose] [--limit LIMIT] [--date DATE] [source]

RRS feed receiver

positional arguments:
source URL for RSS feed

optional arguments:
-h, --help show this help message and exit
--version prints version
--json converts news to JSON
--verbose output verbose status messages
--limit LIMIT determines the number of showed news.
--date DATE shows cached news at given date
--to_pdf TO_PDF coverts news to PDF.
--to_html TO_HTML coverts news to HTML.

TO_PDF/TO_HTML - path to directory for file
File's name is in format feed-*current datetime*.*extention*

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 seems you forgot to add --colorize here.

return temp_img


def get_pdf_doc(news_list):

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 function is too large, it is better to try to split it.

@@ -0,0 +1,3 @@
Some shit happend :c with imports and I was had to run tests from /FinalTaskRssParser dir like this

@HenadziStantchik HenadziStantchik Dec 3, 2019

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.

Please do not use such language on work in any form.

@HenadziStantchik

Copy link
Copy Markdown
Collaborator

Here is feedback on your application:
Iteration 1:
Everything works fine.
Iteration 2:
Installs fine, all iterations work.
Iteration 3:
--date should be specified in YYYYMMDD format, not YYYYMMD:
image
Iteration 4:
Everything works fine.
Iteration 5:
--colorize must be just an option.

Tests are low in number, but the coverage percentage is enough. Still this is not a really good thing.
Code is mostly readable, absolutely corresponds to the PEP8 guidelines.
Commit messages are very informative and absolutely correspond to the recommended commit message style.

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