praw-cli 0.6.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- praw_cli-0.6.0.dist-info/METADATA +105 -0
- praw_cli-0.6.0.dist-info/RECORD +34 -0
- praw_cli-0.6.0.dist-info/WHEEL +4 -0
- praw_cli-0.6.0.dist-info/entry_points.txt +2 -0
- prawler/__init__.py +10 -0
- prawler/__main__.py +4 -0
- prawler/cli/__init__.py +3 -0
- prawler/cli/app.py +16 -0
- prawler/cli/commands/__init__.py +11 -0
- prawler/cli/commands/comments.py +41 -0
- prawler/cli/commands/posts.py +33 -0
- prawler/cli/commands/search.py +34 -0
- prawler/cli/commands/user.py +44 -0
- prawler/cli/options.py +96 -0
- prawler/client/__init__.py +5 -0
- prawler/client/reddit_praw.py +64 -0
- prawler/config.py +31 -0
- prawler/crawler/__init__.py +35 -0
- prawler/crawler/comment.py +58 -0
- prawler/crawler/post.py +125 -0
- prawler/crawler/redditor.py +23 -0
- prawler/model/__init__.py +9 -0
- prawler/model/comment.py +71 -0
- prawler/model/post.py +71 -0
- prawler/model/redditor.py +57 -0
- prawler/output/__init__.py +14 -0
- prawler/output/base.py +15 -0
- prawler/output/formatters.py +79 -0
- prawler/output/registry.py +22 -0
- prawler/output/sinks.py +41 -0
- prawler/pipeline/__init__.py +10 -0
- prawler/pipeline/filters.py +133 -0
- prawler/pipeline/stage.py +14 -0
- prawler/pipeline/transforms.py +15 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Iterator
|
|
4
|
+
|
|
5
|
+
from prawler.pipeline.stage import PipelineStage, Record
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def make_field_select_stage(fields: list[str] | None) -> PipelineStage:
|
|
9
|
+
if not fields:
|
|
10
|
+
return lambda stream: stream
|
|
11
|
+
|
|
12
|
+
def stage(stream: Iterator[Record]) -> Iterator[Record]:
|
|
13
|
+
return ({k: record[k] for k in fields if k in record} for record in stream)
|
|
14
|
+
|
|
15
|
+
return stage
|