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

Update liberbatch.py #9

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

CThierrin
Copy link
Contributor

Fixes issues #8 (remove commented code from scripts) and #7 (directory is no longer hardcoded)

@CThierrin CThierrin linked an issue Jun 5, 2024 that may be closed by this pull request
@dchiller
Copy link
Contributor

dchiller commented Jun 5, 2024

@CThierrin You may already know this, but in the upper-right corner you can request reviews from people. I will generally wait to review until requested so that I know that you're ready for it and so I don't step on your toes :)

@CThierrin CThierrin requested a review from dchiller June 5, 2024 14:53
Copy link
Contributor

@dchiller dchiller left a comment

Choose a reason for hiding this comment

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

Left a bunch of comments...some are out-of-scope of the issues referenced, so feel free to address them here or make new issue(s).

This PR could also use a more descriptive name (what are you updating?). And for future changes, your commit messages need more detail (again, what are you updating? If I needed to go back later and find the specific commit where something was changed, how would I do that?)

liberbatch.py Outdated
for mefile in os.listdir(directory):
filename = os.fsdecode(mefile)
if filename.endswith("corr.mei"):
liberupdate.main(filename)
liberupdatev5.main(filename)
print(filename +" has been updated")
err= err+ (meichecker.main(filename[:-4]+"NEW2.mei")+"\n")
# print(err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove this?

liberbatch.py Outdated
@@ -1,19 +1,15 @@
import os, meichecker, liberupdatev5
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you using a code linter? This is not PEP8 compliant (https://peps.python.org/pep-0008/#imports)

@@ -1,19 +1,15 @@
import os, meichecker, liberupdatev5
PATH = "your path here"
Copy link
Contributor

Choose a reason for hiding this comment

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

If you want the user to go in and change the path, that should be documented. I think a command line argument would be generally preferable.

liberbatch.py Outdated
err=""

i = 0 #for debugging
for mefile in os.listdir(directory):
filename = os.fsdecode(mefile)
if filename.endswith("corr.mei"):
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks like a requirement (that the files end with corr.mei)! This should be documented somwhere.

liberbatch.py Outdated
for mefile in os.listdir(directory):
filename = os.fsdecode(mefile)
if filename.endswith("corr.mei"):
liberupdate.main(filename)
liberupdatev5.main(filename)
print(filename +" has been updated")
err= err+ (meichecker.main(filename[:-4]+"NEW2.mei")+"\n")
Copy link
Contributor

Choose a reason for hiding this comment

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

For something like this, a linter will generally prefer an f-string.

Suggested change
err= err+ (meichecker.main(filename[:-4]+"NEW2.mei")+"\n")
err += f"{meichecker.main(filename[:-4]}NEW2.mei)\n")

@dchiller
Copy link
Contributor

dchiller commented Jun 5, 2024

Fixes issues #8 (remove commented code from scripts) and #7 (directory is no longer hardcoded)

You mention two issues here but only one issue is linked.

@dchiller
Copy link
Contributor

dchiller commented Jun 5, 2024

Also, has this been formatted with black? I am seeing some non-PEP8 compliant things (no space around operators, for example).

@dchiller
Copy link
Contributor

dchiller commented Aug 5, 2024

@CThierrin Are you still trying to merge this?

@CThierrin
Copy link
Contributor Author

@dchiller The changes made in this branch were carried over to #15, so this branch can be closed

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.

Remove commented code from scripts
2 participants