Skip to content
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

add python code style checking #412

Closed

Conversation

QiJune
Copy link
Member

@QiJune QiJune commented Nov 9, 2016

1 use yapf( https://github.com/google/yapf)tool to format python code, and add .style.yapf config file #254
2 contributors can add a git hooks to auto-format changed python code just like this

cat .git/hooks/pre-commit
#!/bin/bash

function python_style_check() {
    #check python code in a git repo
    root=`git rev-parse --show-toplevel`
    exit=0
    for file in `git diff --staged --name-only|grep '\.py$'`; do
        yapf -i --style=$root/.style.yapf $root/$file        
        if [ $? -ne 0 ]; then
            let exit=1
        fi
        git add $root/$file
    done
    exit $exit
}
python_style_check

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.01%) to 62.432% when pulling b347771 on QiJune:feature/python_code_format into 05204af on baidu:develop.

@reyoung
Copy link
Collaborator

reyoung commented Nov 10, 2016

@QiJune Please resolve the conflicts first.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 62.426% when pulling 23a3705 on QiJune:feature/python_code_format into 8d4c453 on baidu:develop.

Copy link
Collaborator

@reyoung reyoung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please split this PR into multiple PRs:

  • Just checkin code format tools
  • Format demo's code
  • Format python's code
  • ...

Then, please assignment them into different people to review.

This PR make my chrome hang, and cost 2-3G memory to give one line comments.

dense_vector(settings.img_raw_size), # image feature
integer_value(settings.num_classes)] # labels
dense_vector(settings.img_raw_size), # image feature
integer_value(settings.num_classes)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment on this line.

@@ -13,9 +13,9 @@
# limitations under the License.

o = open("./" + "train.list", "w")
o.write("./data/raw_data/train" +"\n")
o.write("./data/raw_data/train" + "\n")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个很奇怪呀?直接把\n加到字符串里不就好了

dense_vector(settings.img_input_size), # image feature
integer_value(1)] # labels
dense_vector(settings.img_input_size), # image feature
integer_value(1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment one this line

@reyoung
Copy link
Collaborator

reyoung commented Nov 10, 2016

Also bad for github, we must shrink PR within 2000-5000 lines, because chrome will cost too many memory.

@reyoung reyoung closed this Nov 10, 2016
@QiJune QiJune deleted the feature/python_code_format branch November 11, 2016 11:59
thisjiang pushed a commit to thisjiang/Paddle that referenced this pull request Oct 28, 2021
wangxicoding pushed a commit to wangxicoding/Paddle that referenced this pull request Dec 9, 2021
AnnaTrainingG pushed a commit to AnnaTrainingG/Paddle that referenced this pull request Sep 19, 2022
* add fom lite training

* add fom lite training

* modify according to review

* modify according to review

* fix error of fom trian error
lizexu123 pushed a commit to lizexu123/Paddle that referenced this pull request Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants