-
Notifications
You must be signed in to change notification settings - Fork 20
Sourcery Starbot ⭐ refactored jaekookang/p2fa_py3 #8
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
base: master
Are you sure you want to change the base?
Conversation
if len(val) == 0: | ||
if not val: |
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.
Function getopt2
refactored with the following changes:
- Simplify sequence comparison (
simplify-len-comparison
)
if wave_end is not None: | ||
soxopts += " " + str(float(wave_end) - float(wave_start)) | ||
if wave_end is not None: | ||
soxopts += " " + str(float(wave_end) - float(wave_start)) |
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.
Function prep_wav
refactored with the following changes:
- Hoist conditional out of nested conditional (
hoist-if-from-if
)
fw = open(mlffile, 'w') | ||
fw.write('#!MLF!#\n') | ||
fw.write('"*/tmp.lab"\n') | ||
for wrd in words: | ||
fw.write(wrd + '\n') | ||
fw.write('.\n') | ||
fw.close() | ||
with open(mlffile, 'w') as fw: | ||
fw.write('#!MLF!#\n') | ||
fw.write('"*/tmp.lab"\n') | ||
for wrd in words: | ||
fw.write(wrd + '\n') | ||
fw.write('.\n') |
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.
Function write_input_mlf
refactored with the following changes:
- Use
with
when opening file to ensure closure (ensure-file-closed
)
def write_text_grid(outfile, word_alignments, state_alignments=None) : | ||
def write_text_grid(outfile, word_alignments, state_alignments=None): |
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.
Function write_text_grid
refactored with the following changes:
- Use
with
when opening file to ensure closure (ensure-file-closed
)
fw = open(os.path.join(TEMP_DIR, 'codetr.scp'), 'w') | ||
fw.write(wavfile + ' ' + os.path.join(TEMP_DIR, 'tmp.plp') + '\n') | ||
fw.close() | ||
fw = open(os.path.join(TEMP_DIR, 'test.scp'), 'w') | ||
fw.write(os.path.join(TEMP_DIR, 'tmp.plp') + '\n') | ||
fw.close() | ||
with open(os.path.join(TEMP_DIR, 'codetr.scp'), 'w') as fw: | ||
fw.write(wavfile + ' ' + os.path.join(TEMP_DIR, 'tmp.plp') + '\n') | ||
with open(os.path.join(TEMP_DIR, 'test.scp'), 'w') as fw: | ||
fw.write(os.path.join(TEMP_DIR, 'tmp.plp') + '\n') |
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.
Function prep_scp
refactored with the following changes:
- Use
with
when opening file to ensure closure (ensure-file-closed
)
if state_align: | ||
salign = ' -f -y lab' | ||
else: | ||
salign = '' | ||
|
||
salign = ' -f -y lab' if state_align else '' |
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.
Function viterbi
refactored with the following changes:
- Replace if statement with if expression (
assign-if-exp
)
Sourcery Code Quality Report❌ Merging this PR will decrease code quality in the affected files by 0.35%.
Here are some functions in these files that still need a tune-up:
Legend and ExplanationThe emojis denote the absolute quality of the code:
The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request. Please see our documentation here for details on how these metrics are calculated. We are actively working on this report - lots more documentation and extra metrics to come! Let us know what you think of it by mentioning @sourcery-ai in a comment. |
Thanks for starring sourcery-ai/sourcery ✨ 🌟 ✨
Here's your pull request refactoring your most popular Python repo.
If you want Sourcery to refactor all your Python repos and incoming pull requests install our bot.
Review changes via command line
To manually merge these changes, make sure you're on the
master
branch, then run: