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

Now works on both Python 2 and 3 #343

Merged
merged 1 commit into from
Dec 10, 2017

Conversation

cclauss
Copy link
Contributor

@cclauss cclauss commented Nov 24, 2017

Fixes #328, #265

Checklist

  • I have read the Contribution & Best practices Guide and my PR follows them.
  • My branch is up-to-date with the Upstream master branch.
  • I have added necessary documentation (if appropriate)

Changes proposed in this pull request:

  • Use absolute imports
  • import unquote() for both Python 2 and Python 3
  • Only encode on Python 2
  • Simplify by using flask.jsonify()
  • fix minor PEP8 and readability (Human readibility is low #265) issues

@fossasia-bot
Copy link

fossasia-bot bot commented Nov 24, 2017

Hi @cclauss!

Looks like your PR has some conflicts. 😟
Could you resolve them and rebase on top of the latest upstream code ?

@fossasia-bot
Copy link

fossasia-bot bot commented Nov 24, 2017

Hi @cclauss!

It looks like one or more of your builds have failed.
I've added the relevant info below to save you some time.

@fossasia-bot
Copy link

fossasia-bot bot commented Nov 24, 2017

Hi @cclauss!

Looks like your PR has some conflicts. 😟
Could you resolve them and rebase on top of the latest upstream code ?

@fossasia-bot
Copy link

fossasia-bot bot commented Nov 24, 2017

Hi @cclauss!

It looks like one or more of your builds have failed.
I've added the relevant info below to save you some time.

1 similar comment
@fossasia-bot
Copy link

fossasia-bot bot commented Nov 24, 2017

Hi @cclauss!

It looks like one or more of your builds have failed.
I've added the relevant info below to save you some time.

@fossasia-bot
Copy link

fossasia-bot bot commented Nov 24, 2017

Hi @cclauss!

Looks like your PR has some conflicts. 😟
Could you resolve them and rebase on top of the latest upstream code ?

@fossasia-bot
Copy link

fossasia-bot bot commented Nov 27, 2017

Hi @cclauss!

Looks like your PR has some conflicts. 😟
Could you resolve them and rebase on top of the latest upstream code ?

@fossasia-bot
Copy link

fossasia-bot bot commented Nov 30, 2017

Hi @cclauss!

Looks like your PR has some conflicts. 😟
Could you resolve them and rebase on top of the latest upstream code ?

@cclauss
Copy link
Contributor Author

cclauss commented Nov 30, 2017

Rebased again. @ParthS007 @vaibhavsingh97 @AnshulMalik @bhaveshAn @gabru-md Your reviews please.

@fossasia-bot
Copy link

fossasia-bot bot commented Dec 2, 2017

Hi @cclauss!

It looks like one or more of your builds have failed.
I've added the relevant info below to save you some time.

@bhaveshAn
Copy link
Member

@cclauss Checked your branch locally. Working fine. But Exalead search is not working with Python 3.

@fossasia-bot
Copy link

fossasia-bot bot commented Dec 6, 2017

Hi @cclauss!

Looks like your PR has some conflicts. 😟
Could you resolve them and rebase on top of the latest upstream code ?

@cclauss
Copy link
Contributor Author

cclauss commented Dec 6, 2017

Is it useful continually re-base my pull requests?

@bhaveshAn
Copy link
Member

Resolve conflicts

@fossasia-bot
Copy link

fossasia-bot bot commented Dec 7, 2017

Hi @cclauss!

Looks like your PR has some conflicts. 😟
Could you resolve them and rebase on top of the latest upstream code ?

@fossasia-bot
Copy link

fossasia-bot bot commented Dec 7, 2017

Hi @cclauss!

It looks like one or more of your builds have failed.
I've added the relevant info below to save you some time.

@fossasia-bot
Copy link

fossasia-bot bot commented Dec 7, 2017

Hi @cclauss!

Looks like your PR has some conflicts. 😟
Could you resolve them and rebase on top of the latest upstream code ?

@fossasia-bot
Copy link

fossasia-bot bot commented Dec 7, 2017

Hi @cclauss!

Looks like your PR has some conflicts. 😟
Could you resolve them and rebase on top of the latest upstream code ?

@cclauss
Copy link
Contributor Author

cclauss commented Dec 7, 2017

Re-based yet again.

@AnshulMalik
Copy link
Contributor

AnshulMalik commented Dec 8, 2017

Hey @cclauss, I'll have a look sometime today. You have a lot of patience :)

Copy link
Contributor

@AnshulMalik AnshulMalik left a comment

Choose a reason for hiding this comment

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

Looks great!

@@ -25,7 +25,7 @@ def parseResponse(self, soup):
title = div.div.a.text
url = div.div.a['href']
try:
p = div.find('p', {'class': 'PartialSearchResults-item-abstract'})
p = div.find('p', class_='PartialSearchResults-item-abstract')
Copy link
Contributor

Choose a reason for hiding this comment

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

Why this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

PEP8 Compliance: This is equivalent functionality but requires fewer characters and PEP8 says that lines should 79 chars or less.

Copy link
Contributor

Choose a reason for hiding this comment

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

I find previous one more readable.
Let's wait for what others say? @bhaveshAn

Copy link
Contributor Author

@cclauss cclauss Dec 8, 2017

Choose a reason for hiding this comment

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

The BeautifulSoup documentation tends to use the shorter form rather than creating and destroying a custom dict on every call. https://www.crummy.com/software/BeautifulSoup/bs4/doc/#searching-by-css-class class is of course a reserved word in Python, thus the trailing underscore convention.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, but I still find the object notation more readable :P
That's why I was seeking other opinions @vaibhavsingh97

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed the PEP8 fix. It is not worth the wait.

@cclauss cclauss force-pushed the Python-3-compatibility branch 2 times, most recently from 219a29d to 8fc6ccd Compare December 8, 2017 12:43
Copy link
Member

@ParthS007 ParthS007 left a comment

Choose a reason for hiding this comment

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

LGTM!

@cclauss cclauss force-pushed the Python-3-compatibility branch 5 times, most recently from 2b9e12a to ce6f989 Compare December 10, 2017 15:35
Copy link
Member

@vaibhavsingh97 vaibhavsingh97 left a comment

Choose a reason for hiding this comment

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

LGTM!! Will merge after codacy test result

@cclauss
Copy link
Contributor Author

cclauss commented Dec 10, 2017

@vaibhavsingh97 #332

@vaibhavsingh97
Copy link
Member

Merging Since it got two approval

@vaibhavsingh97
Copy link
Member

@cclauss One last thing before merge, can you change the commit message to something relevant

@cclauss
Copy link
Contributor Author

cclauss commented Dec 10, 2017

Commit message is now: Add support for Python 3

@vaibhavsingh97 vaibhavsingh97 merged commit b04b781 into fossasia:master Dec 10, 2017
@vaibhavsingh97
Copy link
Member

Thanks for the patience and contribution

@cclauss cclauss deleted the Python-3-compatibility branch December 10, 2017 17:04
starlord1311 pushed a commit to starlord1311/query-server that referenced this pull request Dec 10, 2017
Lookup scrapers by name, not by initial (fossasia#327)

Add support for Python 3 (fossasia#343)

Fixes fossasia#357 Add Mojeek in README (fossasia#358)

Lookup scrapers by name, not by initial (fossasia#327)

Fixes fossasia#357 Add Mojeek in README (fossasia#358)

Lookup scrapers by name, not by initial (fossasia#327)

changesmade to server.py to prevent XML attacks

defusedxml
starlord1311 pushed a commit to starlord1311/query-server that referenced this pull request Dec 11, 2017
Lookup scrapers by name, not by initial (fossasia#327)

Add support for Python 3 (fossasia#343)

Fixes fossasia#357 Add Mojeek in README (fossasia#358)

Lookup scrapers by name, not by initial (fossasia#327)

Fixes fossasia#357 Add Mojeek in README (fossasia#358)

Lookup scrapers by name, not by initial (fossasia#327)

changesmade to server.py to prevent XML attacks

defusedxml
starlord1311 pushed a commit to starlord1311/query-server that referenced this pull request Dec 11, 2017
Lookup scrapers by name, not by initial (fossasia#327)

Add support for Python 3 (fossasia#343)

Fixes fossasia#357 Add Mojeek in README (fossasia#358)

Lookup scrapers by name, not by initial (fossasia#327)

Fixes fossasia#357 Add Mojeek in README (fossasia#358)

Lookup scrapers by name, not by initial (fossasia#327)

changesmade to server.py to prevent XML attacks

defusedxml
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.

app not executing on Python 3
5 participants