MCPcopy
hub / github.com/praw-dev/praw / things

Method things

praw/models/mod_notes.py:454–507  ·  view source on GitHub ↗

Return notes associated with the author of a :class:`.Comment` or :class:`.Submission`. :param things: One or more things to return notes on. Must be a :class:`.Comment` or :class:`.Submission`. :param all_notes: Whether to return all notes, or only the latest (default:

(
        self,
        *things: Comment | Submission,
        all_notes: bool | None = None,
        **generator_kwargs: Any,
    )

Source from the content-addressed store, hash-verified

452 )
453
454 def things(
455 self,
456 *things: Comment | Submission,
457 all_notes: bool | None = None,
458 **generator_kwargs: Any,
459 ) -> Iterator[models.ModNote]:
460 """Return notes associated with the author of a :class:`.Comment` or :class:`.Submission`.
461
462 :param things: One or more things to return notes on. Must be a
463 :class:`.Comment` or :class:`.Submission`.
464 :param all_notes: Whether to return all notes, or only the latest (default:
465 ``True`` if only one thing is provided otherwise ``False``).
466
467 .. note::
468
469 Setting this to ``True`` will result in a request for each thing.
470
471
472 :returns: A generator that yields the most recent :class:`.ModNote` (or ``None``
473 if the user doesn't have any notes) per entry in their relative order. If
474 ``all_notes`` is ``True``, this will yield all notes for each entry.
475
476 For example, to get the latest note for the authors of the top 25 submissions in
477 r/test:
478
479 .. code-block:: python
480
481 submissions = reddit.subreddit("test").top(limit=25)
482 for note in reddit.notes.things(*submissions):
483 print(f"{note.label}: {note.note}")
484
485 For example, to get the latest note for the authors of the last 25 comments in
486 r/test:
487
488 .. code-block:: python
489
490 comments = reddit.subreddit("test").comments(limit=25)
491 for note in reddit.notes.things(*comments):
492 print(f"{note.label}: {note.note}")
493
494 """
495 subreddits = []
496 redditors = []
497 for thing in things:
498 subreddits.append(thing.subreddit)
499 redditors.append(thing.author)
500 if all_notes is None:
501 all_notes = len(things) == 1
502 return self._notes(
503 all_notes=all_notes,
504 redditors=redditors,
505 subreddits=subreddits,
506 **generator_kwargs,
507 )
508
509
510class RedditorModNotes(BaseModNotes):

Callers 1

test_notes__thingsMethod · 0.80

Calls 1

_notesMethod · 0.80

Tested by 1

test_notes__thingsMethod · 0.64