Repository: pyqtgraph/pyqtgraph

Issue:
Fixed stale data about children in Parameter.opts
See issue #493
Parameter.opts keeps stale data about children
We can initialize a `Parameter` like so:

```python
Parameter.create( ..., children=[...])
```
This way, a key called `'children'` ends up in the `opts` of the newly created parameter. It is never updated though, as children are added, renamed or deleted. Eventually it causes trouble when `Parameter.storeState` is called, as some code paths of that function store the stale `opts['children']`, rather than generate it dynamically.

AFAICT, `opts['children']` is needed only when initializing the `Parameter`. After that it only contains redundant (and potentially stale) information. I thus suggest not to keep `opts['children']` around beyond the `Parameter.__init__` function. Just `del opts['children']` after use, e.g. in `Parameter.py:183`.

I will submit a PR shortly.


Discussion:
# [Codecov](https://codecov.io/gh/pyqtgraph/pyqtgraph/pull/494?src=pr&el=h1) Report
> Merging [#494](https://codecov.io/gh/pyqtgraph/pyqtgraph/pull/494?src=pr&el=desc) into [develop](https://codecov.io/gh/pyqtgraph/pyqtgraph/commit/af4c6735eabd7a1244100ecde70145b125300cd9?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/pyqtgraph/pyqtgraph/pull/494/graphs/tree.svg?width=650&height=150&src=pr&token=DcSjzPLFsk)](https://codecov.io/gh/pyqtgraph/pyqtgraph/pull/494?src=pr&el=tree)

```diff
@@             Coverage Diff             @@
##           develop     #494      +/-   ##
===========================================
- Coverage    35.85%   35.84%   -0.01%     
===========================================
  Files          196      196              
  Lines        27209    27211       +2     
  Branches      4550     4551       +1     
===========================================
- Hits          9755     9753       -2     
- Misses       16581    16585       +4     
  Partials       873      873
```


| [Impacted Files](https://codecov.io/gh/pyqtgraph/pyqtgraph/pull/494?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pyqtgraph/parametertree/Parameter.py](https://codecov.io/gh/pyqtgraph/pyqtgraph/pull/494?src=pr&el=tree#diff-cHlxdGdyYXBoL3BhcmFtZXRlcnRyZWUvUGFyYW1ldGVyLnB5) | `43.29% <100%> (+0.31%)` | :arrow_up: |
| [pyqtgraph/multiprocess/remoteproxy.py](https://codecov.io/gh/pyqtgraph/pyqtgraph/pull/494?src=pr&el=tree#diff-cHlxdGdyYXBoL211bHRpcHJvY2Vzcy9yZW1vdGVwcm94eS5weQ==) | `57.96% <0%> (-0.75%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pyqtgraph/pyqtgraph/pull/494?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pyqtgraph/pyqtgraph/pull/494?src=pr&el=footer). Last update [af4c673...ddaf58e](https://codecov.io/gh/pyqtgraph/pyqtgraph/pull/494?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).



Resolving patch:
diff --git a/pyqtgraph/parametertree/Parameter.py b/pyqtgraph/parametertree/Parameter.py
--- a/pyqtgraph/parametertree/Parameter.py
+++ b/pyqtgraph/parametertree/Parameter.py
@@ -180,7 +180,7 @@ def __init__(self, **opts):
             raise Exception("Parameter must have a string name specified in opts.")
         self.setName(name)
         
-        self.addChildren(self.opts.get('children', []))
+        self.addChildren(self.opts.pop('children', []))
         
         self.opts['value'] = None
         if value is not None:


Test patch: