Skip to content

Commit

Permalink
Add codespell support: pre-commit entry, configuration, some typoes g…
Browse files Browse the repository at this point in the history
…et fixed (#7775)

## What do these changes do?

See https://github.com/codespell-project/codespell for the codespell
project. I like it and promote everywhere I go ;)

but feel free to disregard this PR, may be take just last commit with 1
obvious typo and may be the "repr" typo fix.

Another commit fixes typos it found and some were I guess whitelisted in
docs/spelling_wordlist.txt where it fixed them too. What is the role/how
that file is used? (I am not familiar, but found similar ones in
jsonschema and few other projects)

## Are there changes in behavior for the user?

somewhat since there is following fix

```
         if t is None:
-            t_repr = "<<Unkown>>"
+            t_repr = "<<Unknown>>"
```

so some reprs would be effected . another change is functional in the
test (taking "an" not "ans" from "answer") but that must not be user
visible

please advise on either you see value for me to bother with CHANGES etc

## Checklist

- [ ] I think the code is well written
- [ ] Unit tests for the changes exist
- [ ] Documentation reflects the changes
- [ ] If you provide code modification, please add yourself to
`CONTRIBUTORS.txt`
  * The format is &lt;Name&gt; &lt;Surname&gt;.
  * Please keep alphabetical order, the file is sorted by names.
- [ ] Add a new news fragment into the `CHANGES` folder
  * name it `<issue_id>.<type>` for example (588.bugfix)
* if you don't have an `issue_id` change it to the pr id after creating
the pr
  * ensure type is one of the following:
    * `.feature`: Signifying a new feature.
    * `.bugfix`: Signifying a bug fix.
    * `.doc`: Signifying a documentation improvement.
    * `.removal`: Signifying a deprecation or removal of public API.
* `.misc`: A ticket has been closed, but it is not of interest to users.
* Make sure to use full sentences with correct case and punctuation, for
example: "Fix issue with non-ascii contents in doctest text files."

---------

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
  • Loading branch information
yarikoptic and webknjaz authored Nov 7, 2023
1 parent 27c308b commit 5f64328
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 12 deletions.
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,9 @@ repos:
^[^/]+[.]rst$
exclude: >-
^CHANGES\.rst$
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
additional_dependencies:
- tomli
2 changes: 1 addition & 1 deletion aiohttp/client_reqrep.py
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,7 @@ async def read(self) -> bytes:
except BaseException:
self.close()
raise
elif self._released: # Response explicity released
elif self._released: # Response explicitly released
raise ClientConnectionError("Connection closed")

await self._wait_released() # Underlying connection released
Expand Down
2 changes: 1 addition & 1 deletion aiohttp/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ def __repr__(self) -> str:
t = get_args(self.__orig_class__)[0]

if t is None:
t_repr = "<<Unkown>>"
t_repr = "<<Unknown>>"
elif isinstance(t, type):
if t.__module__ == "builtins":
t_repr = t.__qualname__
Expand Down
2 changes: 1 addition & 1 deletion aiohttp/http_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ def feed_data(

# if stream does not contain trailer, after 0\r\n
# we should get another \r\n otherwise
# trailers needs to be skiped until \r\n\r\n
# trailers needs to be skipped until \r\n\r\n
if self._chunk == ChunkState.PARSE_MAYBE_TRAILERS:
head = chunk[: len(SEP)]
if head == SEP:
Expand Down
2 changes: 1 addition & 1 deletion docs/abc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ but few of them are.
aiohttp.web is built on top of few concepts: *application*, *router*,
*request* and *response*.

*router* is a *plugable* part: a library user may build a *router*
*router* is a *pluggable* part: a library user may build a *router*
from scratch, all other parts should work with new router seamlessly.

:class:`aiohttp.abc.AbstractRouter` has the only mandatory method:
Expand Down
2 changes: 1 addition & 1 deletion docs/client_quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ endpoints of ``http://httpbin.org`` can be used the following code::
every request is a **very bad** idea.

A session contains a connection pool inside. Connection reusage and
keep-alives (both are on by default) may speed up total performance.
keep-alive (both are on by default) may speed up total performance.

You may find more information about creating persistent sessions
in :ref:`aiohttp-persistent-session`.
Expand Down
2 changes: 1 addition & 1 deletion docs/client_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1316,7 +1316,7 @@ Response object
Reading from the stream may raise
:exc:`aiohttp.ClientPayloadError` if the response object is
closed before response receives all data or in case if any
transfer encoding related errors like misformed chunked
transfer encoding related errors like malformed chunked
encoding of broken compression data.

.. attribute:: cookies
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Key Features
:ref:`Client WebSockets <aiohttp-client-websockets>` out-of-the-box
without the Callback Hell.
- Web-server has :ref:`aiohttp-web-middlewares`,
:ref:`aiohttp-web-signals` and plugable routing.
:ref:`aiohttp-web-signals` and pluggable routing.

.. _aiohttp-installation:

Expand Down
4 changes: 1 addition & 3 deletions docs/spelling_wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ middleware
middlewares
miltidict
misbehaviors
misformed
Mixcloud
Mongo
msg
Expand Down Expand Up @@ -223,7 +222,7 @@ performant
pickleable
ping
pipelining
plugable
pluggable
plugin
poller
pong
Expand Down Expand Up @@ -285,7 +284,6 @@ shourtcuts
skipuntil
Skyscanner
SocketSocketTransport
softwares
ssl
SSLContext
startup
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ issue_format = "`#{issue} <https://github.com/aio-libs/aiohttp/issues/{issue}>`_
test-command = ""
# don't build PyPy wheels, install from source instead
skip = "pp*"

[tool.codespell]
skip = '.git,*.pdf,*.svg,Makefile,CONTRIBUTORS.txt,venvs,_build'
ignore-words-list = 'te'
4 changes: 2 additions & 2 deletions tests/test_client_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -2014,7 +2014,7 @@ async def handler(request):

async def test_payload_content_length_by_chunks(aiohttp_client: Any) -> None:
async def handler(request):
resp = web.StreamResponse(headers={"content-length": "3"})
resp = web.StreamResponse(headers={"content-length": "2"})
await resp.prepare(request)
await resp.write(b"answer")
await resp.write(b"two")
Expand All @@ -2027,7 +2027,7 @@ async def handler(request):

resp = await client.get("/")
data = await resp.read()
assert data == b"ans"
assert data == b"an"
resp.close()


Expand Down

0 comments on commit 5f64328

Please sign in to comment.