-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add API call to build a json message, given a file in the proper tree. #18
Comments
ok, there is an initial working version on the issue018 branch. It can be tested by: cd GTStoWIS2 it will create the content for a bunch of messages, for files which have been added to the sample_GTS_data folder sample output:
@josusky ? maybe you can grab the sample data from the repo, calculate the checksums and compare to the output of this thing? |
OK added content embedding. made one sample file smaller so it could be included. |
I had to add "retPath" pointing to the real location of the file. The message/notification with URL only (no content) has correct hash, i.e. ended as "Input OK [verified]", but the embedded message failed. I am going to check it. |
Err, one letter variables ("m", "h" ...), @petersilva , your code would not get through me into production :-) |
OK, the notification with embedded content/message is OK too. I have unintentionally corrupted it (added new lines) by copying the script output through clipboard in a lame way, sorry. |
My tendency is to use 1 letter names when it is a routine that is a few lines long and the variable is core of what the routine is doing, or it is a short-use temporary thing... so it is really obvious (in my view) from context. To me, shorter names are good in code that is simple. I agree that in convoluted or complex processing too many one letter variables are a problem, but one or two at a time in a routine where it's obvious seems practical to me. But If you have a style-guide or other guidance to suggest, that's fine. I'm not sure if you are complaining about 1 letter variables in the entire module (there are a lot of those.) We can use this issue as a template to adjust the style. so for this issue I imported the time conversion routines, and added the mapAHLtoMessage() entry point. I guess we can talk style in relation to that. One letter variables in mapAHLtoMessage: m - the python dictionary holding the properties of the message that will be returned at the end of the routine. It's on almost every line of code in the routine. naming them "messageToReturn" , or "hashToCalculate" does not add clarity in my view. It should be obvious ... I mean the The description of the routine says that it is building a python dictionary, the first line of code is
and the last line of code is
and it's the only exit path. dunno... open to advice. |
oh... I added comments describing the time routines... which also had 1 letter variables... perhaps that helps? |
about the retPath. I'm glad you did that. makes it complete as-is. Another option I was considering was to copy the file into the appropriate sub-dir, so that relPath works. What do you think is better for demonstration purposes? |
@petersilva when it concerns the one letter variables, I have jumped into the middle of the function by searching for "content" and got confused for a while. Sure, I was able to understand it, after scanning back and reading the whole thing. And I agree that "messageToReturn" would be unnecessary long in this context. I would be happy with "message". |
When it concerns the "relPath" vs "retPath", as the difference popped up by itself, perhaps we could use this example also to explain/demonstrate it too. |
@petersilva pushed "retPath" changes to branch "issue018" for your review. |
Your changes look good to me. In addition,
I don't mind the nitpicking at all, really do want it to be pretty so people like what they see. But of course one cannot please everyone, so discussion is needed to clarify. In the Canadian stack, I started using yapf3 as a pre-processor on all commits to ensure consistency with pythonic style. It should help with inconsistencies that annoy experienced devs. If that looks better, we can do the same? |
oh... I just noticed... basePath... I'd prefer if that were a property... I pushed that... |
I like the consistency created by "yapf3". As you said, different people may prefer different styles. Over time I learned to adjust, so if you like e.g. space around bracket, I can accept it - as long as it is applied consistently. I guess, that many people have it like me, that is the reason why automatic formatters like "yapf3" and "black" are getting popular :-) |
When it concern the new property "basePath", I am a bit confused. Isn't it logically included in the "baseUrl"? Actually, I have tried to change it and it did not change the result. |
example:
If you serve the same location with a file url... it is:
I would expect the basePath to be a constant value for everything posted, just like a baseURL is, which |
as per the previous note, added f9e9085 to issue018 branch. It makes adding the basePath to the baseURL conditional on using the "file:* scheme. For other protocols, one would not do this. |
added some more samples, so in some cases there is no retPath ( 400eda9 ) |
no mandate for payload format. abandoning generation of reference payload. |
Add a properties to the __init__(), for missing elements. and an API call fileToMsg( relPath )
that builds a sample message with the appropriate topics.
The text was updated successfully, but these errors were encountered: