Skip to content
This repository has been archived by the owner on Aug 28, 2020. It is now read-only.

Refactor update_package_manager_data method #143

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Deborah-Digges
Copy link
Contributor

@Deborah-Digges Deborah-Digges commented Oct 9, 2018

Fixes #106

Checklist

  • I have made a material change to the repo (functionality, testing, spelling, grammar)
  • I have read the [Contribution Guide] and my PR follows them.
  • I updated my branch with the master branch.
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation about the functionality in the appropriate .md file
  • I have added in line documentation to the code I modified

Short description of what this PR does:

  • Refactors the method update_package_manager_data into 2 methods


"""
if 'https://www.nuget.org/packages/SendGrid' == url:
data["num_total_csharp_downloads"] = self.csharp_downloads(url)
Copy link

Choose a reason for hiding this comment

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

Looks like this is indented 4 spaces too far.

"""
if 'https://www.nuget.org/packages/SendGrid' == url:
data["num_total_csharp_downloads"] = self.csharp_downloads(url)
if 'https://www.nuget.org/packages/SendGrid.CSharp.HTTP.Client' == url:
Copy link

@42B 42B Oct 28, 2018

Choose a reason for hiding this comment

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

Is there any reason why you wouldn't change some of these to elif statements? If url == 'https://www.nuget.org/packages/SendGrid', it couldn't also be equal to 'https://www.nuget.org/packages/SendGrid.CSharp.HTTP.Client'. All of the checks using == would be prime candidates but some of the if statements which use in would have to be thought about more.

For example, there might be a url which satisfies both of these checks:

        if 'pypi' in url and 'sendgrid' in url:
            data["num_python_downloads"] = self.python_downloads(url)
        if 'pypi' in url and 'python_http_client' in url:
            data["num_python_http_client_downloads"] = self.python_downloads(url)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix "method_lines" issue in package_managers.py
4 participants