Skip to content

Reverse Pull Request#19

Open
iamrobinhood12345 wants to merge 105 commits into
startfrom
master
Open

Reverse Pull Request#19
iamrobinhood12345 wants to merge 105 commits into
startfrom
master

Conversation

@iamrobinhood12345
Copy link
Copy Markdown
Contributor

No description provided.

Your Name and others added 30 commits January 9, 2017 14:56
layout and result templates. routes.
…into development

Pulling Marc's changes into local development branch.:wq
…tializedb.py to drop all on init and input Keyword models, adjusted views/default.py to return results from postgres pysearch database.
Comment thread pysearch/__init__.py
""" This function returns a Pyramid WSGI application.
"""
settings["sqlachemy.url"] = os.environ["DATABASE_URL"]
# settings["sqlachemy.url"] = os.environ["DATABASE_URL"]
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

remove corpse code

session.rollback()
raise
finally:
session.close()
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This monolith of a function could probably be broken down into some smaller, more testable functions.

#HTTPCACHE_EXPIRATION_SECS = 0
#HTTPCACHE_DIR = 'httpcache'
#HTTPCACHE_IGNORE_HTTP_CODES = []
#HTTPCACHE_STORAGE = 'scrapy.extensions.httpcache.FilesystemCacheStorage'
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You could probably remove all of the commented lines since they're not being used anyway.

del word_count[key]

to_add = []
session = self.Session()
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is a lot of logic for one method. You could've broken up this monolith of a method into several smaller, more testable functions.

{'keyword': 'soccer', 'weight': 5, 'url': 'url2', 'count': 25},
{'keyword': 'football', 'weight': 10, 'url': 'url3', 'count': 5},
{'keyword': 'soccer', 'weight': 5, 'url': 'url3', 'count': 5}
]
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Why is this here? What's it used for?

Comment thread pysearch/views/default.py
def computing_results_view(request):
"""Initiates crawler and routes to results."""
url = request.params["url"]
print('computing results view ', url)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

print statement

Comment thread pysearch/views/default.py
# entries = query.all()
unique_urls = []
for val in request.dbsession.query(Match.page_url).distinct():

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Why whitespace?

Comment thread pysearch/views/default.py

unique_urls.append(val[0])

print(unique_urls)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Print statement

Comment thread pysearch/views/default.py
unique_keywords = []
for val in request.dbsession.query(Match.keyword).distinct():
unique_keywords.append(val[0])
print(unique_keywords)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Print statement

Comment thread pysearch/views/default.py
results.append({'keyword': kw, 'weight': url_q.keyword_weight, 'url': url, 'count': url_q.count})

except DBAPIError:
return Response(db_err_msg, content_type='text/plain', status=500)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

When would this ever get used?

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.

3 participants