frequenz-floss / frequenz-client-dispatch-python

Dispatch API client for Python
https://frequenz-floss.github.io/frequenz-client-dispatch-python/
MIT License
0 stars 2 forks source link

Rename `.create(_type)` to `type` #45

Closed llucax closed 1 week ago

llucax commented 2 months ago

What's needed?

We need a clear interface. Using _type is not necessary and it is confusing, as usually in python stuff that starts with _ is not supposed to be set by users.

Proposed solution

Use type.

Additional context

Marenz commented 2 weeks ago

Well, here is the reason I didn't use type.

nox > pylint src docs noxfile.py tests
************* Module frequenz.client.dispatch._client
src/frequenz/client/dispatch/_client.py:124:8: W0622: Redefining built-in 'type' (redefined-builtin)

-------------------------------------------------------------------
Your code has been rated at 9.99/10 (previous run: 10.00/10, -0.01)

nox > Command pylint src docs noxfile.py tests failed with exit code 4
nox > Session pylint failed.
llucax commented 2 weeks ago

You can add a disable rule. In general I think it is good not to shadow built-ins, but in this case I think it makes sense to make an exception.