Code is not standard python, wondering about the code quality
Closed this issue · 2 comments
It looks like this code was written by people who ported it from some other language, and aren't familiar with python.
Please follow the famous PEP8 https://www.python.org/dev/peps/pep-0008/ in the code.
First thing you should do is place in CMText.__init__.py
is
from CMText.TextClient import TextClient
__akll__ = (TextClient, )
So people can import directly from CMText.
Some examples of not following the standards:
Captials are for classes, not variables names.
Docstrings:
# This is not where docstring goes
def some_function()
"""Here is where the string does"""
The gateway is ignored, it is defaulted to the global:
def __init__(self, apikey, gateway=Gateways.Global):
But then hardcoded when sending: response = requests.post("https://gw.cmtelecom.com/v1.0/message", data=data, headers=headers)
Python modules are named in lower case, spot the odd ones out:
cffi/
cffi-1.14.6.dist-info/
cffi.libs/
charset_normalizer/
charset_normalizer-2.0.4.dist-info/
click/
click-8.0.3.dist-info/
click_didyoumean/
click_didyoumean-0.3.0.dist-info/
click_plugins/
click_plugins-1.1.1.dist-info/
click_repl/
click_repl-0.2.0.dist-info/
CM_text_sdk_python-1.1.3.dist-info/
CMText/
colorama/
colorama-0.4.3.dist-info/
coverage/
coverage-5.3.dist-info/
cryptography/
cryptography-36.0.0.dist-info/
cssselect2/
cssselect2-0.4.1.dist-info/
cuser/
dal/
I just looked at twilio-python
, and that is done right. They follow the standands and have tests. This code seems less production ready.
Hi @mangelozzi
Sorry for the half year wait on this.
Not a full time python developer here but I tried to implement most of your comments.
Feel free to add any additional comments!
Will merge once some of our devs had time to look over the changes.
We could still do some minor improvements here and there, like removing some mutable function parameters, but in this case they are not affecting functionality. Closing this issue.