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

Force user to use bool for delete_existing_job #1437

Merged
merged 7 commits into from
May 23, 2024
Merged

Conversation

samwaseda
Copy link
Member

I constantly fall into the trap to set a job name like:

job = pr.create.job.Lammps("lmp", strain)

without realising I had to write more parentheses. As the first argument after the job name is delete_existing_job, this often erases the job, which just shouldn't happen for a small typo.

@samwaseda samwaseda added the code_smell It's working, but something smells off label May 17, 2024
@samwaseda samwaseda requested a review from pmrv May 17, 2024 14:22
@samwaseda samwaseda added the format_black reformat the code using the black standard label May 17, 2024
@samwaseda samwaseda requested a review from liamhuber May 17, 2024 15:04
Copy link
Member

@liamhuber liamhuber left a comment

Choose a reason for hiding this comment

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

I like fixing this problem, but I actually totally disagree with the attack. Let's rather go back to whatever __init__ is responsible and just add * to force the subsequent values to be keyword-only.

@samwaseda
Copy link
Member Author

I like fixing this problem, but I actually totally disagree with the attack. Let's rather go back to whatever __init__ is responsible and just add * to force the subsequent values to be keyword-only.

That’s actually more or less what I suggested when the possibility to put multiple keywords was introduced. I cannot remember why it got rejected, but it got rejected at that time. Anyway wouldn’t it be a bit problematic concerning the backward compatibility?

@liamhuber
Copy link
Member

That’s actually more or less what I suggested when the possibility to put multiple keywords was introduced. I cannot remember why it got rejected, but it got rejected at that time.

That's unfortunate, it sure seems like the right solution now...

Anyway wouldn’t it be a bit problematic concerning the backward compatibility?

🤦‍♂️ Ugh, yes. Ok, I'll review this as-is. Stupid backwards compatibility.

Copy link
Member

@liamhuber liamhuber left a comment

Choose a reason for hiding this comment

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

So the the caveat of our preceding conversation about how I wish we were in a different timeline, lgtm.

The only thing I would recommend is to make a custom error class so that when you're running the behaviour tests you can be 100% sure you're catching exactly the value error you're trying to catch and not accidentally passing because some other, unrelated value error is getting raised.

@samwaseda samwaseda merged commit f9513e1 into main May 23, 2024
46 checks passed
@samwaseda samwaseda deleted the force_bool_restart branch May 23, 2024 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code_smell It's working, but something smells off format_black reformat the code using the black standard
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants