MCPcopy Create free account
hub / github.com/RASAAS/docmcp-knowledge / list_posts

Method list_posts

scripts/migrate_posts.py:240–253  ·  view source on GitHub ↗

List all posts and their detected subcategories.

(self)

Source from the content-addressed store, hash-verified

238 json.dump(index_data, f, ensure_ascii=False, indent=2)
239
240 def list_posts(self) -> None:
241 """List all posts and their detected subcategories."""
242 posts = self.get_all_posts()
243 print(f"\nTotal posts: {len(posts)}\n")
244 subcategory_counts: Dict[str, int] = {}
245 for post in posts:
246 title = self.clean_title(post.get("title", {}).get("rendered", ""))
247 date = post.get("date", "")[:10]
248 subcat = self.detect_subcategory(post)
249 subcategory_counts[subcat] = subcategory_counts.get(subcat, 0) + 1
250 print(f" [{date}] [{subcat}] {title[:60]}")
251 print(f"\nSubcategory distribution:")
252 for subcat, count in sorted(subcategory_counts.items()):
253 print(f" {subcat:<30} {count:3d} posts")
254
255 def migrate(self) -> None:
256 """Main migration entry point."""

Callers 1

mainFunction · 0.95

Calls 4

get_all_postsMethod · 0.95
clean_titleMethod · 0.95
detect_subcategoryMethod · 0.95
getMethod · 0.80

Tested by

no test coverage detected