Skip to content

Commit

Permalink
Merge pull request #26 from praw-dev/reformat
Browse files Browse the repository at this point in the history
Reformat
  • Loading branch information
LilSpazJoekp committed Feb 25, 2021
2 parents afce60e + 3db321f commit cb8d4ee
Show file tree
Hide file tree
Showing 185 changed files with 4,111 additions and 4,021 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ jobs:
run: python ./tools/check_documentation.py
- name: Run black
run: black --check --verbose .
- name: Run docstrfmt
run: docstrfmt -cvp pyproject.toml -e "docs/examples/*" .
- name: Run flake8
run: flake8 --exclude docs --statistics
- name: Run flynt
Expand Down
16 changes: 8 additions & 8 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ Author/Maintainer

- Joel Payne <lilspazjoekp@gmail.com> `@LilSpazJoekp <https://github.com/lilspazjoekp>`_


Documentation Contributors
==========================

Expand All @@ -24,19 +23,16 @@ Documentation Contributors

<!-- - Add "Name <email (optional)> and github profile link" above this line. -->


PRAW Author
===========

- Bryce Boe <bbzbryce@gmail.com> `@bboe <https://github.com/bboe>`_


Logo Creator
============

- kungming2 `@kungming2 <https://github.com/kungming2>`_


Source Contributors
===================

Expand All @@ -55,9 +51,11 @@ Source Contributors
- Andrew Arnold `@asquared31415 <https://github.com/asquared31415>`_
- bakonydraco `@bakonydraco <https://github.com/bakonydraco>`_
- salehio `@salehio <https://github.com/salehio>`_
- Amanda O'Neal <amanda.oneal.dev@gmail.com> `@amandaoneal <https://github.com/amandaoneal>`_
- Amanda O'Neal <amanda.oneal.dev@gmail.com> `@amandaoneal
<https://github.com/amandaoneal>`_
- Gourari Oussama <gourari.ouss@gmail.com> `@O-Gourari <https://github.com/O-Gourari>`_
- Declan Hoare <declanhoare@exemail.com.au> `@NetwideRogue <https://github.com/NetwideRogue>`_
- Declan Hoare <declanhoare@exemail.com.au> `@NetwideRogue
<https://github.com/NetwideRogue>`_
- Elaina Martineau `@CrackedP0t <https://github.com/CrackedP0t>`_
- Rob Curtis <BourbonInExile@gmail.com> `@waab76 <https://github.com/waab76>`_
- Pyprohly <pyprohly@outlook.com> `@Pyprohly <https://github.com/Pyprohly>`_
Expand All @@ -68,14 +66,16 @@ Source Contributors
- Jack Steel `@jackodsteel <https://github.com/jackodsteel>`_
- David Mirch `@fwump38 <https://github.com/fwump38>`_
- PythonCoderAS `@PythonCoderAS <https://github.com/PythonCoderAS>`_
- Michael Cetrulo <contact@michael-cetrulo.com> `@git2samus <https://github.com/git2samus>`_
- Michael Cetrulo <contact@michael-cetrulo.com> `@git2samus
<https://github.com/git2samus>`_
- George Schizas `@gschizas <https://github.com/gschizas>`_
- Todd Roberts `@toddrob99 <https://github.com/toddrob99>`_
- MaybeNetwork `@MaybeNetwork <https://github.com/MaybeNetwork>`_
- Nick Kelly `@nickatnight <https://github.com/nickatnight>`_
- Yash Chhabria `@Cyatos <https://github.com/Cyatos>`_
- Justin Krejcha <justin@justinkrejcha.com> `@jkrejcha <https://github.com/jkrejcha>`_
- Gerard Rodes <GerardRodesVidal@gmail.com> `@GerardRodes <https://github.com/GerardRodes>`_
- Gerard Rodes <GerardRodesVidal@gmail.com> `@GerardRodes
<https://github.com/GerardRodes>`_
- cmays90 `@cmays90 <https://github.com/cmays90>`_

<!-- - Add "Name <email (optional)> and github profile link" above this line. -->
64 changes: 31 additions & 33 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ Unreleased

**Added**

* :class:`.Reddit` keyword argument ``token_manager``.
* :class:`.FileTokenManager` and its parent abstract class :class:`.BaseTokenManager`.
- :class:`.Reddit` keyword argument ``token_manager``.
- :class:`.FileTokenManager` and its parent abstract class :class:`.BaseTokenManager`.

**Deprecated**

* The configuration setting ``refresh_token`` is deprecated and its use will result in a
- The configuration setting ``refresh_token`` is deprecated and its use will result in a
:py:class:`DeprecationWarning`. This deprecation applies in all ways of setting
configuration values, i.e., via ``praw.ini``, as a keyword argument when initializing
an instance of :class:`.Reddit`, and via the ``PRAW_REFRESH_TOKEN`` environment
variable. To be prepared for Async PRAW 8, use the new :class:`.Reddit` keyword
argument ``token_manager``. See :ref:`refresh_token` in Async PRAW's documentation for
an example.
* :meth:`.me` will no longer return ``None`` when called in :attr:`.read_only` mode
- :meth:`.me` will no longer return ``None`` when called in :attr:`.read_only` mode
starting in Async PRAW 8. A :py:class:`DeprecationWarning` will be issued. To switch
forward to the Async PRAW 8 behavior set ``praw8_raise_exception_on_me=True`` in your
``asyncpraw.Reddit(...)`` call.
Expand All @@ -28,56 +28,54 @@ Unreleased

**Added**

* Add method :meth:`~.Subreddits.premium` to reflect the naming change in Reddit's API.
* Ability to submit image galleries with :meth:`.submit_gallery`.
* Ability to pass a gallery url to :meth:`.Reddit.submission`.
* Ability to specify modmail mute duration.
* Add method :meth:`.invited` to get invited moderators of a subreddit.
* Ability to submit text/self posts with inline media.
* Add method :meth:`~.Submission.award` and :meth:`~.Comment.award` with the ability to
- Add method :meth:`~.Subreddits.premium` to reflect the naming change in Reddit's API.
- Ability to submit image galleries with :meth:`.submit_gallery`.
- Ability to pass a gallery url to :meth:`.Reddit.submission`.
- Ability to specify modmail mute duration.
- Add method :meth:`.invited` to get invited moderators of a subreddit.
- Ability to submit text/self posts with inline media.
- Add method :meth:`~.Submission.award` and :meth:`~.Comment.award` with the ability to
specify type of award, anonymity, and message when awarding a submission or comment.
* Ability to specify subreddits by name using the `subreddits` parameter in
- Ability to specify subreddits by name using the `subreddits` parameter in
:meth:`.Reddit.info`.
* Added :meth:`.Reddit.close` to close the requestor session.
* Ability to use :class:`.Reddit` as an asynchronous context manager that automatically
- Added :meth:`.Reddit.close` to close the requestor session.
- Ability to use :class:`.Reddit` as an asynchronous context manager that automatically
closes the requestor session on exit.

**Changed**

* :class:`~.BoundedSet` will now utilize a Last-Recently-Used (LRU) storing mechanism,
- :class:`~.BoundedSet` will now utilize a Last-Recently-Used (LRU) storing mechanism,
which will change the order in which elements are removed from the set.
* Improved :meth:`.submit_image` and :meth:`.submit_video` performance in slow
network environments by removing a race condition when establishing a
websocket connection.
- Improved :meth:`.submit_image` and :meth:`.submit_video` performance in slow network
environments by removing a race condition when establishing a websocket connection.

**Deprecated**

* :meth:`~.Subreddits.gold` is superseded by :meth:`~.Subreddits.premium`.
* :meth:`~.Submission.gild` is superseded by :meth:`~.Submission.award`.
* :meth:`~.Comment.gild` is superseded by :meth:`~.Comment.award`.
* ``PRAWException`` is superseded by :class:`.AsyncPRAWException`.
- :meth:`~.Subreddits.gold` is superseded by :meth:`~.Subreddits.premium`.
- :meth:`~.Submission.gild` is superseded by :meth:`~.Submission.award`.
- :meth:`~.Comment.gild` is superseded by :meth:`~.Comment.award`.
- ``PRAWException`` is superseded by :class:`.AsyncPRAWException`.

**Fixed**

* An issue where leaving as a moderator fails if you are using token auth.
* An issue where an incorrect error was being raised due to invalid submission urls.
* A bug where if you call `.parent()` on a comment it clears its replies.
* An issue where performing a deepcopy on an :class:`.RedditBase` object will fail.
* Some cases where streams yield the same item multiple times. This cannot be
prevented in every case.
* An issue where streams could get stuck on a deleted item and never pull new items.
* Fix subreddit style asset uploading.
- An issue where leaving as a moderator fails if you are using token auth.
- An issue where an incorrect error was being raised due to invalid submission urls.
- A bug where if you call `.parent()` on a comment it clears its replies.
- An issue where performing a deepcopy on an :class:`.RedditBase` object will fail.
- Some cases where streams yield the same item multiple times. This cannot be prevented
in every case.
- An issue where streams could get stuck on a deleted item and never pull new items.
- Fix subreddit style asset uploading.

7.1.0 (2020/07/16)
------------------

* First official Async PRAW release!
- First official Async PRAW release!

7.1.0.pre1 (2020/07/16)
-----------------------

* Initial Async PRAW pre release.

- Initial Async PRAW pre release.

For changes in PRAW please see: `PRAW Changelog
<https://praw.readthedocs.io/en/latest/pages/changelog.html>`_
112 changes: 63 additions & 49 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,43 @@ Async PRAW: The Asynchronous Python Reddit API Wrapper
======================================================

.. image:: https://img.shields.io/pypi/v/asyncpraw.svg
:alt: Latest asyncpraw Version
:target: https://pypi.python.org/pypi/asyncpraw
:alt: Latest asyncpraw Version
:target: https://pypi.python.org/pypi/asyncpraw

.. image:: https://img.shields.io/pypi/pyversions/asyncpraw
:alt: Supported Python Versions
:target: https://pypi.python.org/pypi/asyncpraw
:alt: Supported Python Versions
:target: https://pypi.python.org/pypi/asyncpraw

.. image:: https://img.shields.io/pypi/dm/asyncpraw
:alt: PyPI - Downloads - Monthly
:target: https://pypi.python.org/pypi/asyncpraw
:alt: PyPI - Downloads - Monthly
:target: https://pypi.python.org/pypi/asyncpraw

.. image:: https://coveralls.io/repos/github/praw-dev/asyncpraw/badge.svg?branch=master
:alt: Coveralls Coverage
:target: https://coveralls.io/github/praw-dev/asyncpraw?branch=master
:alt: Coveralls Coverage
:target: https://coveralls.io/github/praw-dev/asyncpraw?branch=master

.. image:: https://github.com/praw-dev/asyncpraw/workflows/CI/badge.svg
:alt: Github Actions Coverage
:target: https://github.com/praw-dev/asyncpraw/actions?query=branch%3Amaster
:alt: Github Actions Coverage
:target: https://github.com/praw-dev/asyncpraw/actions?query=branch%3Amaster

.. image:: https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg
:alt: Contributor Covenant
:target: https://github.com/praw-dev/asyncpraw/blob/master/CODE_OF_CONDUCT.md
:alt: Contributor Covenant
:target: https://github.com/praw-dev/asyncpraw/blob/master/CODE_OF_CONDUCT.md

Async PRAW, an abbreviation for "Asynchronous Python Reddit API Wrapper", is a Python package that
allows for simple access to Reddit's API. Async PRAW aims to be easy to use and
internally follows all of `Reddit's API rules
Async PRAW, an abbreviation for "Asynchronous Python Reddit API Wrapper", is a Python
package that allows for simple access to Reddit's API. Async PRAW aims to be easy to use
and internally follows all of `Reddit's API rules
<https://github.com/reddit/reddit/wiki/API>`_. With Async PRAW there's no need to
introduce ``sleep`` calls in your code. Give your client an appropriate user
agent and you're set.
introduce ``sleep`` calls in your code. Give your client an appropriate user agent and
you're set.

.. _installation:

Installation
------------

Async PRAW is supported on Python 3.6+. The recommended way to
install Async PRAW is via `pip <https://pypi.python.org/pypi/pip>`_.
Async PRAW is supported on Python 3.6+. The recommended way to install Async PRAW is via
`pip <https://pypi.python.org/pypi/pip>`_.

.. code-block:: bash
Expand All @@ -45,22 +50,26 @@ To install the latest development version of Async PRAW run the following instea
pip install --upgrade https://github.com/praw-dev/asyncpraw/archive/master.zip
For instructions on installing Python and pip see "The Hitchhiker's Guide to
Python" `Installation Guides
<https://docs.python-guide.org/en/latest/starting/installation/>`_.
For instructions on installing Python and pip see "The Hitchhiker's Guide to Python"
`Installation Guides <https://docs.python-guide.org/en/latest/starting/installation/>`_.

Quickstart
----------

Assuming you already have a credentials for a script-type OAuth application you
can instantiate an instance of Async PRAW like so:
Assuming you already have a credentials for a script-type OAuth application you can
instantiate an instance of Async PRAW like so:

.. code-block:: python
import asyncpraw
reddit = asyncpraw.Reddit(client_id="CLIENT_ID", client_secret="CLIENT_SECRET",
password="PASSWORD", user_agent="USERAGENT",
username="USERNAME")
reddit = asyncpraw.Reddit(
client_id="CLIENT_ID",
client_secret="CLIENT_SECRET",
password="PASSWORD",
user_agent="USERAGENT",
username="USERNAME",
)
With the ``reddit`` instance you can then interact with Reddit:

Expand All @@ -71,7 +80,9 @@ With the ``reddit`` instance you can then interact with Reddit:
await subreddit.submit("Test Submission", url="https://reddit.com")
# Comment on a known submission
submission = await reddit.submission(url="https://www.reddit.com/comments/5e1az9", lazy=True)
submission = await reddit.submission(
url="https://www.reddit.com/comments/5e1az9", lazy=True
)
await submission.reply("Super rad!")
# Reply to the first comment of a weekly top thread of a moderated community
Expand All @@ -89,41 +100,43 @@ With the ``reddit`` instance you can then interact with Reddit:
async for moderator in subreddit.moderator:
print(moderator)
Please see Async PRAW's `documentation <https://asyncpraw.readthedocs.io/>`_ for
more examples of what you can do with Async PRAW.
Please see Async PRAW's `documentation <https://asyncpraw.readthedocs.io/>`_ for more
examples of what you can do with Async PRAW.

Async PRAW Discussion and Support
---------------------------------

For those new to Python, or would otherwise consider themselves a Python
beginner, please consider asking questions on the `r/learnpython
<https://www.reddit.com/r/learnpython>`_ subreddit. There are wonderful people
there who can help with general Python and simple Async PRAW related questions.
For those new to Python, or would otherwise consider themselves a Python beginner,
please consider asking questions on the `r/learnpython
<https://www.reddit.com/r/learnpython>`_ subreddit. There are wonderful people there who
can help with general Python and simple Async PRAW related questions.

Otherwise, there are a few official places to ask questions about Async PRAW:

`r/redditdev <https://www.reddit.com/r/redditdev>`_ is the best place on
Reddit to ask Async PRAW related questions. This subreddit is for all Reddit API
related discussion so please tag submissions with *[Async PRAW]*. Please perform a
search on the subreddit first to see if anyone has similar questions.
`r/redditdev <https://www.reddit.com/r/redditdev>`_ is the best place on Reddit to ask
Async PRAW related questions. This subreddit is for all Reddit API related discussion so
please tag submissions with *[Async PRAW]*. Please perform a search on the subreddit
first to see if anyone has similar questions.

Real-time chat can be conducted via the `PRAW Slack Organization
<https://join.slack.com/t/praw/shared_invite/enQtOTUwMDcxOTQ0NzY5LWVkMGQ3ZDk5YmQ5MDEwYTZmMmJkMTJkNjBkNTY3OTU0Y2E2NGRlY2ZhZTAzMWZmMWRiMTMwYjdjODkxOGYyZjY>`_
(please create an issue if that invite link has expired).

Please do not directly message any of the contributors via Reddit, email, or
Slack unless they have indicated otherwise. We strongly encourage everyone to
help others with their questions.
Please do not directly message any of the contributors via Reddit, email, or Slack
unless they have indicated otherwise. We strongly encourage everyone to help others with
their questions.

Please file bugs and feature requests as issues on `GitHub
<https://github.com/praw-dev/asyncpraw/issues>`_ after first searching to ensure a
similar issue was not already filed. If such an issue already exists please
give it a thumbs up reaction. Comments to issues containing additional
information are certainly welcome.
similar issue was not already filed. If such an issue already exists please give it a
thumbs up reaction. Comments to issues containing additional information are certainly
welcome.

.. note::

.. note:: This project is released with a `Contributor Code of Conduct
<https://github.com/praw-dev/asyncpraw/blob/master/CODE_OF_CONDUCT.md>`_. By
participating in this project you agree to abide by its terms.
This project is released with a `Contributor Code of Conduct
<https://github.com/praw-dev/asyncpraw/blob/master/CODE_OF_CONDUCT.md>`_. By
participating in this project you agree to abide by its terms.

Documentation
-------------
Expand All @@ -135,7 +148,8 @@ History

`February 2019
<https://github.com/praw-dev/asyncpraw/commit/55480eb3d59dc7bc3d1480d83b98c95effc77181>`_:
Joel forked PRAW and began work on Async PRAW, an asynchronous compatible version of PRAW.
Joel forked PRAW and began work on Async PRAW, an asynchronous compatible version of
PRAW.

`July 2020
<https://github.com/praw-dev/asyncpraw/commit/b8b8a4bf3618639968e8be379e85e2ff84f2307a>`_:
Expand All @@ -147,4 +161,4 @@ License
Async PRAW's source (v7.1.1+) is provided under the `Simplified BSD License
<https://github.com/praw-dev/asyncpraw/blob/30796acc29b4ba2335cf0eab414477702c29452f/LICENSE.txt>`_.

* Copyright ©, 2020, Joel Payne
- Copyright ©, 2020, Joel Payne
11 changes: 6 additions & 5 deletions asyncpraw/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
"""Asynchronous Python Reddit API Wrapper.
Async PRAW, an abbreviation for "Asynchronous Python Reddit API Wrapper", is a python package that
allows for simple access to reddit's API. Async PRAW aims to be as easy to use as
possible and is designed to follow all of reddit's API rules. You have to give
a useragent, everything else is handled by Async PRAW so you needn't worry about
violating them.
Async PRAW, an abbreviation for "Asynchronous Python Reddit API Wrapper", is a python
package that allows for simple access to reddit's API. Async PRAW aims to be as easy to
use as possible and is designed to follow all of reddit's API rules. You have to give a
useragent, everything else is handled by Async PRAW so you needn't worry about violating
them.
More information about Async PRAW can be found at https://github.com/praw-dev/asyncpraw
"""

from .const import __version__ # NOQA
Expand Down

0 comments on commit cb8d4ee

Please sign in to comment.