Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

another usages added #175

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ayushkumar1610
Copy link

@ayushkumar1610 ayushkumar1610 commented Oct 14, 2021

Description

Modification made to usages.rst, a use of browser-history is added. A python scripts to show number of times sites visited using graph.

Fixes #160

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • I have read the contribution guidelines and followed it as far as possible.
  • I have performed a self-review of my own code (if applicable)
  • I have commented my code, particularly in hard-to-understand areas (if applicable)
  • I have made corresponding changes to the documentation (if applicable)
  • My changes generate no new warnings
  • I have enabled the pre-commit hook and it's not detecting any issue.
  • Any dependent and pending changes have been merged and published

Copy link
Member

@Samyak2 Samyak2 left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! I had a few questions and suggestions.

Could you also link the issue in the description? (Change Fixes # (issue) to Fixes #160, that will link the issue with your PR)

docs/usage.rst Outdated Show resolved Hide resolved
docs/usage.rst Outdated Show resolved Hide resolved
docs/usage.rst Outdated Show resolved Hide resolved
Comment on lines +133 to +136
for idx in range(2, len(por)):
if len(por[idx])>1:
site = por[idx]
break
Copy link
Member

Choose a reason for hiding this comment

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

Question - what does this do? Why not use por[2] always?

Copy link
Author

Choose a reason for hiding this comment

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

Yeah initially I thought of that but, if users have a history of local file file:///D... then the site name will be the empty string.
What do you suggest on this?

Copy link
Member

Choose a reason for hiding this comment

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

A better solution would be to use the in-built urllib.parse and get hostname from that. If hostname is None, we can ignore that tuple.

@codecov-commenter
Copy link

codecov-commenter commented Oct 20, 2021

Codecov Report

Merging #175 (10f924f) into master (8d1135d) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #175   +/-   ##
=======================================
  Coverage   92.00%   92.00%           
=======================================
  Files           5        5           
  Lines         475      475           
  Branches       87       87           
=======================================
  Hits          437      437           
  Misses         26       26           
  Partials       12       12           
Flag Coverage Δ
unittests 92.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8d1135d...10f924f. Read the comment docs.

Copy link
Member

@Samyak2 Samyak2 left a comment

Choose a reason for hiding this comment

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

Just noticed a few things. However, I will add the hacktoberfest-accepted tag to approve your PR 🎉. Thanks for contributing.

  • Could you move this to the end of the usage section? Something like an "Examples" subsection seems more appropriate for this.
  • Would it be possible to take just the top 10 or 20 websites and plot them? Instead of using all websites. This is how the graph looks on my system 😆
    image

Comment on lines +133 to +136
for idx in range(2, len(por)):
if len(por[idx])>1:
site = por[idx]
break
Copy link
Member

Choose a reason for hiding this comment

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

A better solution would be to use the in-built urllib.parse and get hostname from that. If hostname is None, we can ignore that tuple.


::

from browser_history.browsers import get_history
Copy link
Member

Choose a reason for hiding this comment

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

Should be

Suggested change
from browser_history.browsers import get_history
from browser_history import get_history

Comment on lines +129 to +131
for tup in history:

url = tup[1]
Copy link
Member

Choose a reason for hiding this comment

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

It would be slightly more idiomatic to use:

Suggested change
for tup in history:
url = tup[1]
for _, url in history:

Comment on lines +138 to +141
if site not in frequency:
frequency[site] += 1
else:
frequency[site] = 1
Copy link
Member

Choose a reason for hiding this comment

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

The conditions are switched :D

Suggested change
if site not in frequency:
frequency[site] += 1
else:
frequency[site] = 1
if site not in frequency:
frequency[site] = 1
else:
frequency[site] += 1

@Samyak2 Samyak2 added the hacktoberfest-accepted PR Accepted for hacktoberfest label Oct 25, 2021
@Samyak2
Copy link
Member

Samyak2 commented Dec 16, 2021

@ayushkumar1610 do you want to continue working on this?

@Samyak2
Copy link
Member

Samyak2 commented Oct 21, 2022

@ayushkumar1610?

@Samyak2 Samyak2 removed the hacktoberfest-accepted PR Accepted for hacktoberfest label Oct 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[DOCS] Add example applications
3 participants