HENNGE / aiodynamo

Asynchronous, fast, pythonic DynamoDB Client
https://aiodynamo.readthedocs.io/
Other
69 stars 20 forks source link

Fix code indent in readme.md #183

Open aisk opened 1 month ago

dimaqq commented 1 month ago

I think that original indentation was intended.

The example tries to show how to use the library in an asynchronous function and what imports are needed.

After all, you can’t have async with at the module level, can you?

aisk commented 1 month ago

I think it's not indented, for example with this code in README:

from aiodynamo.client import Client
from aiodynamo.credentials import Credentials
from aiodynamo.http.httpx import HTTPX
from httpx import AsyncClient

    async with AsyncClient() as h:
        client = Client(HTTPX(h), Credentials.auto(), "us-east-1")

Run it with Python will got this error:

$ python3 a.py
  File "/private/tmp/a.py", line 6
    async with AsyncClient() as h:
IndentationError: unexpected indent

If the example is just a show to how to use this code, I think maybe we can wrap the code with line 6 in a function?

dimaqq commented 1 month ago

Maybe @ojii can make a call on this one.

Doc source code-wise it's fine.

ojii commented 1 month ago

reading our current README I'm not sure what I was thinking with that indentation without having stuff in functions, so this proposed patch makes things a lot nicer, thank you @aisk.