-
-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
style: 💄 add pylint, black and other tools #52
base: master
Are you sure you want to change the base?
Conversation
@david30907d Thanks for the PR! I will provide my comments aside from the source codes. |
berrynet/client/camera.py
Outdated
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with BerryNet. If not, see <http://www.gnu.org/licenses/>. | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will keep license description in the comment header instead of module docstring.
Module docstring is for providing the high-level description of the module.
Example: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/ops/accumulate_n_benchmark.py
berrynet/client/camera.py
Outdated
'--mode', | ||
default='stream', | ||
help='Camera creates frame(s) from stream or file. (default: stream)' | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the function name is self-explanatory, I suggest to remove the docstring.
If the goal is for generating the development document in the future, we can make a plan to provide informative docstrings in the functions and modules.
berrynet/client/camera.py
Outdated
|
||
|
||
def main(): | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same as the "args" docstring.
berrynet/client/camera.py
Outdated
) | ||
ap.add_argument( | ||
'--stream-src', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As described in PEP8:
In Python, single-quoted strings and double-quoted strings are the same. This PEP does not make a recommendation for this.
We choose single quote because most of the Python official docs use single quote.
Example: https://docs.python.org/3/tutorial/controlflow.html#for-statements
However, we are open to adopt a new rule if there is a good reason behind. It will be great if you can share more about your opinions with me. 😃
https://stackoverflow.com/questions/56011/single-quotes-vs-double-quotes-in-python
More comments for the questions in the PR:
如果 linter 的修改建議是 optional 而非 necessary,那麼加上 linter 沒有問題 BerryNet dev is goal driven with startup mindset: 有效率地解決問題是 1st priority。有 linter 絕對很棒,但希望它是提供建議者而非強制性的 blocker
TensorFlow 升版最常見的問題就是 API compatibility issues (API breaks),建議升版前先確認客戶或產品所使用的 BerryNet engine / service 不會受到影響 RaspberryPi 上的 TensorFlow,是使用朋友 PINTO0309 的 Tensorflow-bin,通常PINTO0309 會跟上最新版,若要更新 RPi TF,建議先看看 PINTO0309 是否已提供支援
許多 BerryNet JS clients 還是 BerryNet v1 的架構 (目前是 v2),因此無法安裝是符合預期的 如果你希望能用 JS clients,建議可以先開 GitHub issue 留個紀錄,dev priority 就會提高
The same as the item 1.
建議當確認效能受到影響,再修正 logging level >= INFO 的 statements. 不希望強制執行此 rule 的原因:
聽起來很棒 👍 Thanks for all the great inputs in this PR! |
|
These tools would help us maintain our code quality
skip-string-normalization can ignore quote normalization
提議:我平常喜歡把這些 linter, formatter 綁在 git hook 上,每次 commit 自動檢查,不確定會不會跟大家的習慣衝突
npm install
會噴很多 error,想問大家現在還能正常安裝嗎?camera.py
logging.info(...format())
intologging.info( % )
according to logging-format-interpolation