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

Apply new Black style changes #690

Merged
merged 4 commits into from
Nov 17, 2022
Merged

Conversation

desh2608
Copy link
Collaborator

This PR applies the new line-length configuration (see lhotse-speech/lhotse#890) on all the files.

We have added a .git-blame-ignore-revs file containing the hash of the main commit to ensure that git blame history is not affected. Please follow the instructions in this link to enable this setting in your git config. This option is available in git 2.23 and later (and also enabled by default on Github).

hooks:
- id: black
args: [--line-length=80]
args: ["--line-length=88"]
additional_dependencies: ['click==8.0.1']
Copy link
Collaborator

Choose a reason for hiding this comment

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

shouldn't it use click 8.1.0 like in CI?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch. I'll change it!

Copy link
Collaborator

@pzelasko pzelasko left a comment

Choose a reason for hiding this comment

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

This PR is going to make you the top contributor as measured by modified LOC :D

@desh2608
Copy link
Collaborator Author

This PR is going to make you the top contributor as measured by modified LOC :D

Yeah apparently I removed about 8k lines of code.
image

@pzelasko
Copy link
Collaborator

pzelasko commented Nov 16, 2022

Yeah apparently I removed about 8k lines of code.

Just remember to never do this if you're being paid per LOC ;)

@csukuangfj
Copy link
Collaborator

Is it ready to merge

@desh2608
Copy link
Collaborator Author

Is it ready to merge

Yes!

flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 \
--statistics --extend-ignore=E203,E266,E501,F401,E402,F403,F841,W503
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@pzelasko @csukuangfj
There's just this one annoying little detail. I had to add E501 to the flake8 check, but it actually ignores line length issues. This is because there are about a few hundred violations in the repo that could not be fixed by black because they are in the comments or docstrings.

@csukuangfj
Copy link
Collaborator

Shall I use "squash merge" or just "merge"?

@desh2608
Copy link
Collaborator Author

Shall I use "squash merge" or just "merge"?

Piotr advised that you should merge "without" squashing so that all the commit hashes are retained.

@csukuangfj
Copy link
Collaborator

Shall I use "squash merge" or just "merge"?

Piotr advised that you should merge "without" squashing so that all the commit hashes are retained.

Thanks

@abb128
Copy link
Contributor

abb128 commented Nov 17, 2022

Why have some of the files gone blank? Was this intended?
https://github.com/desh2608/icefall/blob/d89766d85dbb023a8fcb47221545d00b1a015c69/egs/librispeech/ASR/lstm_transducer_stateless/lstm.py

Some of the scripts are not working after this

@csukuangfj
Copy link
Collaborator

Why have some of the files gone blank? Was this intended?

No, that is not intended.

)

parser.add_argument(
"--tokens-file",
type=str,
help="Path to tokens.txt" "Used only when method is ctc-decoding",
help="Path to tokens.txtUsed only when method is ctc-decoding",
Copy link
Collaborator

Choose a reason for hiding this comment

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

There should be a space between ".txt" and "Used".
Looks like black cannot handle such a case properly.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think this and the other issues were caused due to using the --experimental-string-processing feature which is not stable yet. I will run black again without this flag to fix the issues

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks

@@ -1,818 +0,0 @@
#!/usr/bin/env python3
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like this file is removed.

@@ -1,388 +0,0 @@
#!/usr/bin/env python3
Copy link
Collaborator

Choose a reason for hiding this comment

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

and this file

@@ -1,1157 +0,0 @@
#!/usr/bin/env python3
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like many files from this directory are removed.

@@ -25,15 +25,10 @@
from typing import List, Tuple

import torch
from lhotse import (
from lhotse import ( # fmt: off; See the following for why LilcomChunkyWriter is preferred; https://github.com/k2-fsa/icefall/pull/404; https://github.com/lhotse-speech/lhotse/pull/527; fmt: on
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment looks a bit messed up also

f'Unsupported direction: {direction}. " \
"Expect either "left" or "right"'
f'Unsupported direction: {direction}. " "Expect either "left"'
' or "right"'
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like this string was wrongly mixing single quotes and double quotes, and was formatted weirdly

@desh2608
Copy link
Collaborator Author

@csukuangfj please revert the merge for now. I'll take a look at this today and fix the issues.

@csukuangfj
Copy link
Collaborator

@csukuangfj please revert the merge for now. I'll take a look at this today and fix the issues.

Is it possible to just upload the missing files without reverting?

@desh2608
Copy link
Collaborator Author

@csukuangfj please revert the merge for now. I'll take a look at this today and fix the issues.

Is it possible to just upload the missing files without reverting?

Yeah that can be done too, but I'm concerned that the experiment string processing may have introduced additional problems which we haven't caught yet. I shouldn't have used this unstable feature in the first place.

@csukuangfj
Copy link
Collaborator

ok, I will revert it then.

@desh2608
Copy link
Collaborator Author

ok, I will revert it then.

Thanks.

@desh2608 desh2608 mentioned this pull request Nov 17, 2022
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.

4 participants