Skip to content

Python code examples for file IO in xml and yml format#14666

Merged
alalek merged 12 commits intoopencv:3.4from
ihsan314:file_io_xml_yml
Jan 12, 2020
Merged

Python code examples for file IO in xml and yml format#14666
alalek merged 12 commits intoopencv:3.4from
ihsan314:file_io_xml_yml

Conversation

@ihsan314
Copy link
Copy Markdown
Contributor

@ihsan314 ihsan314 commented May 28, 2019

resolves #14665

This pullrequest changes

the fact that Python tutorials do not exist for File Input Output with XML and YML.

force_builders=Docs

@alalek
Copy link
Copy Markdown
Member

alalek commented May 31, 2019

Thank you for contribution!

Please add fixes to make "Docs" builder green.

@asmorkalov asmorkalov requested a review from alalek November 6, 2019 06:41
@asmorkalov
Copy link
Copy Markdown
Contributor

@alalek Docs build is green. Could you look at the patch.

@asmorkalov asmorkalov changed the title File io xml yml Python code examples for file IO in xml and yml format Nov 6, 2019
Copy link
Copy Markdown
Member

@alalek alalek left a comment

Choose a reason for hiding this comment

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

Thank you for contribution!

Please follow template of Python samples (wrap this code into "main()" function): https://github.com/opencv/opencv/wiki/Coding_Style_Guide#python-samples

As a documentation/samples improvement this patch should go into 3.4 branch first. We will merge changes from 3.4 into master regularly (weekly/bi-weekly).

So, please:

  • change "base" branch of this PR: master => 3.4 (use "Edit" button near PR title)
  • rebase your commits from master onto 3.4 branch. For example:
    git rebase -i --onto upstream/3.4 upstream/master
    (check list of your commits, save and quit (Esc + "wq" + Enter)
    where upstream is configured by following this GitHub guide and fetched (git fetch upstream).
  • push rebased commits into source branch of your fork (with --force option)

Note: no needs to re-open PR, apply changes "inplace".

import sys

def help(filename):
print (filename, 'shows the usage of the OpenCV serialization functionality.',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please use normal print from Python3 (+ from __future__ import print_function for Python 2.7).

Also it is better to use docstring.

@ihsan314
Copy link
Copy Markdown
Contributor Author

ihsan314 commented Nov 6, 2019

Thanks for reviewing the pull request. I will work on all the changes by the end of this week.

@asmorkalov
Copy link
Copy Markdown
Contributor

@ihsan314 Do you have any progress on the patch?

@ihsan314 ihsan314 changed the base branch from master to 3.4 November 22, 2019 17:02
@ihsan314
Copy link
Copy Markdown
Contributor Author

I didn't have that much time in the last two weeks, so here they are today. The docstrings will be added hopefully by tomorrow.

@asmorkalov
Copy link
Copy Markdown
Contributor

@ihsan314 Please pay attention on CI status, it still reports some issues with the code.

@ihsan314
Copy link
Copy Markdown
Contributor Author

ihsan314 commented Dec 23, 2019

The CI status had only one failed build, and that failed build was on Mac. I fast-forwarded my branch and tried the failed build on my machine. It worked on mine, so I hope it will pass. I also changed the strings to a docstring in the help() method.

@asmorkalov
Copy link
Copy Markdown
Contributor

@ihsan314 Please remove "WIP" from the PR description to trigger CI builds automatically.

@asmorkalov
Copy link
Copy Markdown
Contributor

@alalek could you look at it again.

Copy link
Copy Markdown
Member

@alalek alalek left a comment

Choose a reason for hiding this comment

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

Well done! Thank you 👍


@add_toggle_python
You can [download this from here
](https://github.com/opencv/opencv/tree/master/samples/python/tutorial_code/core/file_input_output/file_input_output.py) or find it in the
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

master

Please use "3.4" in URLs (as patch is targeted to 3.4 branch).

@alalek alalek merged commit 2c21ea2 into opencv:3.4 Jan 12, 2020
@alalek alalek mentioned this pull request Jan 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants