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

Commit

Permalink
#741 Review#1 fixes. Subtask arch improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
duker33 committed Jul 16, 2019
1 parent e7276b1 commit ff4e3c0
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions stroyprombeton/management/commands/parse_stalbeton.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ def text(self) -> str:


class RootCategoryPage(CategoryPage):
# @todo #741:30m Implement parse_stalbeton.Category.children() method.
# And reuse it as polymorphic method in subclasses.
# The task has pros and cons, so, we'll discuss it for the first.
def second_level(self) -> typing.List['SecondLevelCategoryPage']:
return [
SecondLevelCategoryPage(p['href'])
Expand Down Expand Up @@ -116,13 +119,16 @@ def parse():
main = Page(path='/')
through = ThroughElements(page=main)
roots = through.roots()
# @todo #741:30m Create parse_stalbeton.Categories class.
# And hide children list assembling there.
# See PR #758 discussion for example.
seconds = chain.from_iterable((r.second_level() for r in roots))
thirds = chain.from_iterable((s.third_level() for s in seconds))
options = chain.from_iterable((t.options() for t in thirds)) # Ignore PyFlakesBear
# @todo #741:60m Save parsed stalbeton to a DB.
# It should not some high performance DB.
# It can be sqlite for example or even some pickle lib.
# DB is required to analyze data without loading stalbeton site.
# DB isn't required to be high performance.
# It can be sqlite or postgres or pickle lib or whatever else.
# DB is required to analyze data without loading stalbeton site every time.


class Command(BaseCommand):
Expand Down

0 comments on commit ff4e3c0

Please sign in to comment.