-
Notifications
You must be signed in to change notification settings - Fork 2
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
Mining progress #7
base: master
Are you sure you want to change the base?
Conversation
src/ros_answers_miner/cli.py
Outdated
@@ -1,25 +1,23 @@ | |||
# -*- coding: utf-8 -*- | |||
import argparse | |||
|
|||
from .parser import url_to_question | |||
from ros_answers_miner.parser import url_to_question |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
relative imports are better here; I'd switch back to the original version of the line unless there's a strong reason for the change?
src/ros_answers_miner/cli.py
Outdated
|
||
def main() -> None: | ||
parser = argparse.ArgumentParser('ros-answers-miner') | ||
subparsers = parser.add_subparsers() | ||
|
||
p = subparsers.add_parser( | ||
'scrape', | ||
help='extracts information from a given ROS Answers question URL') | ||
'scrap', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo?
|
||
import attr | ||
class User: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just use attrs
or a dataclass
instead.
} | ||
|
||
|
||
class Comment: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again, prefer attrs
or a data class
|
||
|
||
@attr.s(auto_attribs=True) | ||
class Answer: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was attrs dropped?
src/ros_answers_miner/models.py
Outdated
comments: OrderedSet[Comment] | ||
answers: OrderedSet[Answer] | ||
|
||
def __init__(self, url, date, votes, views, user, title, content, tags, comments, answers): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, this is why attrs exists! Don't roll your own init, hash, cmp, eq, etc.
Mining of a Question in ROS Answers: