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

quick hack to have validate_ucis_xml return true/false #6

Closed
wants to merge 4 commits into from

Conversation

nsdjg
Copy link
Contributor

@nsdjg nsdjg commented May 17, 2022

This is a work in progress WIP. I'm doing this in conjunction with this [fc4sc pull request(https://github.com/amiq-consulting/fc4sc/pull/23)

@mballance
Copy link
Member

I'd be happy to accept this if the patch is just the addition of line 65. I'm unclear as to why all the whitespace diffs show up in the PR.

@nsdjg
Copy link
Contributor Author

nsdjg commented May 18, 2022

I just adjusted to have a single line diff. Github should auto pickup the mod.

The white space was because in my editor its configured to highlight any whitepace. Its kind of annoying. I didn't set it up that way. I believe it will flag lint warnings. I can assist you with lint warnings later if you wish.

Lastly, I am impressed with your makefile auto setting up venv so that it can build. Iv'e never seen that before and I hope to use your setup as a reference in fc4sc similarly. Good job on that!

@nsdjg
Copy link
Contributor Author

nsdjg commented May 18, 2022

btw, here is where github autopicked up the merge per your request for mod.

image

Copy link
Member

@mballance mballance left a comment

Choose a reason for hiding this comment

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

Thanks, @nsdjg. This looks good

@nsdjg
Copy link
Contributor Author

nsdjg commented May 19, 2022

Thanks, @nsdjg. This looks good

You are welcome @mballance

@nsdjg
Copy link
Contributor Author

nsdjg commented May 20, 2022

Matthew, I was talking to Ed offline about this pull request. There is some consternation regarding the False|None+exception vs True|False return. Being that I have been criticized in the past regarding my python looking like C, or my matlab looking like C, Swift looking like C, or just about any programming not looking pythonic, matlabish, Swifty, etc, I took this as an opportunity to read the docs to see what is the preferred approach.

With that said, I did not find anything definitive. The closest I found is about the 15th bullet in this section of the PEP. There is an example of wrong vs correct on how to return a float result. When the calculated result is invalid they don't raise an exception, they return None.

So, I don't know which is best and I don't want to be pedantic. I noticed you did not catch the exception so perhaps you are following that method. I apologize if it seems that I am being over pedantic.

Lastly you have not accepted/closed the pull request so perhaps you are mulling it over. I strive for flexibility so please let me know which style you prefer and I will adjust as you desire. Like I said, I am just trying to resolve it so that I don't pip install from a git repo. If you deem it unnecessary change, I'll modify the unit test case in FC4SC to assert on a raised exception instead of True/False. Anyway, just dropping you a line to say I looked further into the matter.

@mballance
Copy link
Member

Hi John, apologies about the pull request. I had to hand-merge your final commit for some reason in order to avoid the whitespace issue. If you have a look at the 'Files changed' tab on the PR, you'll see that it still shows the whitespace.
You can find the commit with your updates here: fd850ff
For future PRs, I'd suggest creating a new branch in your repo with just the PR changes instead of creating a PR from 'main'.

You raise a good point about a method that both returns a value and that may raise an exception. Probably best to only do one. In this case, because the exception contains information on the source of the validation failure, I'd prefer to raise the exception. Will that work for you?

@mballance mballance closed this May 20, 2022
@nsdjg
Copy link
Contributor Author

nsdjg commented May 20, 2022

Hi John, apologies about the pull request. I had to hand-merge your final commit for some reason in order to avoid the whitespace issue. If you have a look at the 'Files changed' tab on the PR, you'll see that it still shows the whitespace. You can find the commit with your updates here: fd850ff For future PRs, I'd suggest creating a new branch in your repo with just the PR changes instead of creating a PR from 'main'.

You raise a good point about a method that both returns a value and that may raise an exception. Probably best to only do one. In this case, because the exception contains information on the source of the validation failure, I'd prefer to raise the exception. Will that work for you?

Yes, I can use a separate branch. Yes, I can test for an exception or False. Thank you for the quick reply. You are quick. Many thanks.

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.

None yet

2 participants