-
Notifications
You must be signed in to change notification settings - Fork 31
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
Workspace pageId to page_id #874
Conversation
for code in ocrd (e.g. workspace), ocrd_models keep pageId.
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.
I think I found some more :-)
Plus, to be really consistent, let's also do this:
(Perhaps we should also offer
Workspace.find_files
as a delegator toOcrdMets.find_files
and translator offile_grp|file_id|page_id
tofileGrp|ID|pageId
)
Thanks for your help especially for workspace.py line 186, I simply overlooked that. I need to take more time for this stuff, it is too easy to miss that kind of things. |
Splendid!
Just like |
Careful about renaming |
Oh, right, we forgot about It looks like:
|
What's the status here @joschrew? And can we get file ID naming in as well? (That is, by my previous comment, deprecating |
previously only pageId, now also ID and fileGrp
The status is: I (hopefully correctly) rebased this PR to the newest changes. Then I changed ID and fileGrp params according to what I did for pageId. Next I wanted to to tackle the find_files-delegator, but i haven't really started on that yet. I don't know how to do the |
Perhaps something like this to normalize the fields to one consistent set of either CamelCase or snake_case at the beginning of the camel_to_snake = {
'page_id': 'page_id',
'page_id': 'page_id',
'fileGrp': 'file_grp',
'file_grp': 'file_grp',
# [...]
}
output_field = [camel_to_snake[k] for k in output_field] |
Added find_files delegator. But I am not finished yet, the last thing (except fixes) I want to do is convert |
add possible output_field values in workspace_find to allow providing them with snake_case in addition to old camelCase-naming
Ok, finished my changes with finally allowing 'new' variable naming for From my current point of view this PR should be finished now. The test are passing but I didn't make any additional tests except briefly testing |
Update ocrd/ocrd/cli/workspace.py Co-authored-by: Konstantin Baierer <kba@users.noreply.github.com>
Thanks, that hasn't been in my python-repertoire yet. |
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.
Looks good – except for that one place in cli.workspace.find regarding pageId
.
We should also cover that case by the tests. All we have in test.cli.test_workspace is test_find_all_files_multiple_physical_pages_for_fileids
and test_find_all_files
, but nothing with -k pageId
(or -k page-id
now).
Thanks for review. I agree on the tests, I will try to write them. And I agree about the cosmetic workspace.add_file will change that as well. Regarding tests you wrote "but nothing with -k page-id". Actually it is But the pageId references you mentioned (maybe I don't understand correctly what you mean): |
Oh, sorry, I actually did mean
Sorry again. You are right. After your |
Thanks. Please note that I still want to add the tests and change the one occurrence of |
Added 2 tests and changed the call in ocrd/ocrd/cli/workspace.py workspace_add_file() to use the new delegator. In that process I tried to simplify/shorten the code a bit (maybe I just should have kept the |
You mean having kebab-case versions in addition to snake_case and CamelCase? Why? |
No, the more explicit variant you used is fine. |
Because it is actually the least surprising for the CLI users. They cannot be expected to know anything about the API name conventions, neither in But nevermind – whatever works and is documented. |
fix #862. Change kwargs (expect page_id instead of pageId) for ocrd-workspace-api.
I changed
add_file
andmerge
because I think that where the only ones left acceptingpageId
.I didn't change anything regarding toWorkspace.find_files
(offering new functionality), because I think maybe that would be a separate topic.