Skip to content

Commit

Permalink
Refactorize RSS subcmd and related model (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
Guts authored Jun 27, 2023
2 parents 88dcde2 + 41630b9 commit e2cbe96
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 19 deletions.
17 changes: 0 additions & 17 deletions geotribu_cli/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,23 +104,6 @@ def site_git_source_base_url(
)


# Data structures
@dataclass
class RssItem:
"""Model for an RSS item."""

abstract: str = None
author: str = None
categories: list = None
date_pub: str = None
guid: str = None
image_length: str = None
image_type: str = None
image_url: str = None
title: str = None
url: str = None


@dataclass
class MkdocsSearchConfiguration:
"""Search configuration in Mkdocs."""
Expand Down
Empty file added geotribu_cli/rss/__init__.py
Empty file.
24 changes: 24 additions & 0 deletions geotribu_cli/rss/mdl_rss.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#! python3 # noqa: E265


"""Package constants."""


# standard library
from dataclasses import dataclass


@dataclass
class RssItem:
"""Model for an RSS item."""

abstract: str = None
author: str = None
categories: list = None
date_pub: str = None
guid: str = None
image_length: str = None
image_type: str = None
image_url: str = None
title: str = None
url: str = None
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@
# package
from geotribu_cli.__about__ import __title__, __version__
from geotribu_cli.console import console
from geotribu_cli.constants import GeotribuDefaults, RssItem
from geotribu_cli.constants import GeotribuDefaults
from geotribu_cli.history import CliHistory
from geotribu_cli.rss.mdl_rss import RssItem
from geotribu_cli.subcommands.open_result import open_content
from geotribu_cli.utils.file_downloader import download_remote_file_to_local
from geotribu_cli.utils.formatters import convert_octets, url_add_utm
Expand Down
2 changes: 1 addition & 1 deletion geotribu_cli/subcommands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
parser_comments_latest,
)
from geotribu_cli.images.images_optimizer import parser_images_optimizer # noqa: F401
from geotribu_cli.rss.rss_reader import parser_latest_content # noqa: F401

from .open_result import parser_open_result # noqa: F401
from .rss_reader import parser_latest_content # noqa: F401
from .search_content import parser_search_content # noqa: F401
from .search_image import parser_search_image # noqa: F401
from .upgrade import parser_upgrade # noqa: F401

0 comments on commit e2cbe96

Please sign in to comment.