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

Handle/remove unused variables #2094

Merged
merged 5 commits into from
Apr 20, 2022
Merged

Conversation

ksunden
Copy link
Contributor

@ksunden ksunden commented Nov 15, 2021

All found via CodeQL

All found via CodeQL
@ksunden
Copy link
Contributor Author

ksunden commented Nov 15, 2021

Test failure caused by something that isn't actually new, and is addressed in #2095

@@ -269,7 +268,6 @@ def boundingRect(self):
return br

def paint(self, p, *args):
profiler = debug.Profiler()
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't these profiler assignments actually do something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

as far as I'm aware, these are debugging tools that probably shouldn't be scattered in production code, no?

Copy link
Member

Choose a reason for hiding this comment

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

So, I'm inclined to keep them; they're a signal that this is a very performance sensitive function, and when implementing new features, it's trivial to re-enable them so they spew output in the console (either via setting environment variables, or modifying the line to add disabled=False and delayed=False).

That said; they're not crucial on their own, when profiling/debugging, the developer can re-add them as needed, and if we're really wanting to do profiling, we probably shouldn't be dependent on these buy use a tool that can capture runtimes and average them out sort of thing.

Copy link
Member

@j9ac9k j9ac9k Nov 15, 2021

Choose a reason for hiding this comment

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

What might be a fair compromise here is to remove the assignment for cases where profilers are not used throughout the function/method they're in such as this case. So instead of

profiler = debug.Profiler()

we can have

debug.Profiler()

This serves the same thing and should make the static code checker happy.

@ksunden
Copy link
Contributor Author

ksunden commented Mar 12, 2022

I believe this is ready for review

@j9ac9k
Copy link
Member

j9ac9k commented Apr 20, 2022

Should have merged this a while back, sorry about that @ksunden LGTM, thanks!

@j9ac9k j9ac9k merged commit 74fa36d into pyqtgraph:master Apr 20, 2022
@ksunden ksunden deleted the unused-local-var branch April 21, 2022 01:58
ntjess added a commit to ntjess/pyqtgraph that referenced this pull request May 11, 2022
commit dd25d7c
Merge: 81c9749 00c8fe1
Author: Ogi Moore <[email protected]>
Date:   Fri May 6 13:05:38 2022 -0700

    Merge pull request pyqtgraph#2294 from j9ac9k/fix-member-lookup-from-2185

    Ensure in lookup occurs in tuple, not str

commit 00c8fe1
Author: Ogi Moore <[email protected]>
Date:   Fri May 6 12:50:52 2022 -0700

    Ensure in lookup occurs in tuple, not str

commit 81c9749
Merge: 1dd6b9d 651f1f4
Author: Ogi Moore <[email protected]>
Date:   Fri May 6 12:31:48 2022 -0700

    Merge pull request pyqtgraph#2293 from j9ac9k/update-tox

    Update tox for currently supported configs

commit 651f1f4
Author: Ogi Moore <[email protected]>
Date:   Fri May 6 11:37:06 2022 -0700

    Update tox for currently supported configs

commit 1dd6b9d
Author: Sietze van Buuren <[email protected]>
Date:   Thu May 5 20:29:51 2022 +0200

    Introduce API option to control whether lines are drawn as segmented lines (pyqtgraph#2185)

    * Introduce API option to control whether lines are drawn as segmented lines

    - Adds a global options to set mode for drawing segmented lines
    - Mode can be 'auto' (use existing method),  'on' (always draw segmented lines), 'off' (never draw segmented lines)
    - Global option can be overridden for given ``PlotCurveItem`` instance using new setter method
    - **This is a proposal!** Added activation of anti-aliasing as criterion to decide whether to draw segmented lines in 'auto' mode

    * Added segmented line mode as option to `examples/PlotSpeedTest.py`

    Included 'segmentedLineMode' as argument to `setData` method in `PlotCurveItem.py`

    * Change of segmented line mode in `PlotSpeedTest.py` implemented analogue to pen options

    * Removed option to set segmentedLineMode through setData keyword

    Signed-off-by: Sietze van Buuren <[email protected]>

    * Segmented line mode option now also accepts booleans `True` (same as `'on'`) and `False` (same as `'off'`) as possible modes

    * Removed `True`/`False` option possibilities for segmentedLineMode in `PlotCurveItem.py`
    Added documentation to `config_options.rst` for global option segmentedLineMode

commit e0b3a30
Merge: 4ef3762 d15f70d
Author: Ogi Moore <[email protected]>
Date:   Tue May 3 10:05:46 2022 -0700

    Merge pull request pyqtgraph#2286 from pijyoi/double_dockdrop

    avoid double __init__ of DockDrop

commit d15f70d
Author: KIU Shueng Chuan <[email protected]>
Date:   Tue May 3 10:26:01 2022 +0800

    avoid double __init__ of DockDrop

commit 4ef3762
Merge: 6f6e86e f084a88
Author: Ogi Moore <[email protected]>
Date:   Sun May 1 11:36:48 2022 -0700

    Merge pull request pyqtgraph#2285 from sasha-sem/pyqtgraph#2283-fix-width-limit

    pyqtgraph#2283 delete limitation by rectangle width

commit f084a88
Author: Aleksandr Semenenko <[email protected]>
Date:   Sun May 1 20:08:56 2022 +0300

    pyqtgraph#2283 delete limitation by rectangle width
    deleted unused variable

commit 32dce76
Author: Aleksandr Semenenko <[email protected]>
Date:   Sun May 1 01:48:20 2022 +0300

    pyqtgraph#2283 delete limitation by rectangle width

commit 6f6e86e
Merge: a6aa780 f67e4cf
Author: Ogi Moore <[email protected]>
Date:   Wed Apr 27 21:52:12 2022 -0700

    Merge pull request pyqtgraph#2274 from ardiloot/custom-dock-label

    Added possibility to use custom dock labels

commit a6aa780
Merge: 74fa36d 0913f51
Author: Ogi Moore <[email protected]>
Date:   Wed Apr 27 09:50:45 2022 -0700

    Merge pull request pyqtgraph#2275 from StSav012/patch-11

    Fixed division by zero when no pixmap is loaded

commit 0913f51
Author: Anton Yablokov <[email protected]>
Date:   Wed Apr 27 17:13:09 2022 +0300

    Fixed division by zero when no pixmap is loaded

    `QtGui.QPixmap().width() == 0`

commit f67e4cf
Author: Ardi Loot <[email protected]>
Date:   Wed Apr 27 11:20:22 2022 +0300

    Added possibility to use custom dock labels

commit 74fa36d
Author: Kyle Sunden <[email protected]>
Date:   Wed Apr 20 18:41:02 2022 -0500

    Handle/remove unused variables (pyqtgraph#2094)

    * Handle/remove unused variables

    All found via CodeQL

    * Errors that cropped up as a result of initial errors being fixed

    * Even more things that were only used in now removed statements

    * Update comment to reflect code change

    * Undo profiler removals, add comment about GC behavior

commit 5c62894
Merge: 6820c43 a1a5b38
Author: Ogi Moore <[email protected]>
Date:   Wed Apr 20 16:39:36 2022 -0700

    Merge pull request pyqtgraph#2181 from StSav012/patch-2

    Used the power of `blockIfUnchanged` decorator

commit 6820c43
Author: Etienne Dumur <[email protected]>
Date:   Wed Apr 20 19:49:48 2022 +0200

    Add glow example (pyqtgraph#2242)

    * Add glow example

    * Add new line at the end of the file

    * Fix nb_lines issue.
    Reduce curves amplitude.

commit 6a54f39
Author: bbc131 <[email protected]>
Date:   Wed Apr 20 18:00:03 2022 +0200

    Improve performance of PlotCurveItem (pyqtgraph#2264)

    * Improve performance of PlotCurveItem

    * Hide chunksize in private method and comment it

commit ff233b6
Merge: 714428a 1841e56
Author: Ogi Moore <[email protected]>
Date:   Mon Apr 18 20:31:33 2022 -0700

    Merge pull request pyqtgraph#2249 from campagnola/clip-fix

    Fix UFuncTypeError when plotting integer data on windows

commit 714428a
Merge: d956b08 3ed8d27
Author: Ogi Moore <[email protected]>
Date:   Mon Apr 18 16:22:34 2022 -0700

    Merge pull request pyqtgraph#2263 from pijyoi/fix_busycursor

    add support for PySide6 6.3.0 QOverrideCursorGuard

commit 3ed8d27
Author: KIU Shueng Chuan <[email protected]>
Date:   Mon Apr 18 19:57:26 2022 +0800

    add support for PySide6 6.3.0 QOverrideCursorGuard

commit d956b08
Merge: 55b1c12 b66f194
Author: Ogi Moore <[email protected]>
Date:   Thu Apr 14 20:42:57 2022 -0700

    Merge pull request pyqtgraph#2260 from campagnola/qpoint-floats

    Fix : QPoint() no longer accepts float arguments

commit b66f194
Author: Luke Campagnola <[email protected]>
Date:   Thu Apr 14 19:31:18 2022 -0700

    Fix : QPoint() no longer accepts float arguments

commit 55b1c12
Merge: 3e91567 4525595
Author: Ogi Moore <[email protected]>
Date:   Thu Apr 14 17:48:59 2022 -0700

    Merge pull request pyqtgraph#2250 from pijyoi/tryfix_pyqt512_btns

    test enum using : "enums & enum"

commit 3e91567
Merge: d7cda66 32dce76
Author: Ogi Moore <[email protected]>
Date:   Thu Apr 14 17:48:11 2022 -0700

    Merge pull request pyqtgraph#2259 from campagnola/export-import

    Avoid import error in HDF5 exporter

commit 32dce76
Author: Luke Campagnola <[email protected]>
Date:   Thu Apr 14 17:27:26 2022 -0700

    Avoid import error in HDF5 exporter

commit 4525595
Author: KIU Shueng Chuan <[email protected]>
Date:   Sat Apr 9 21:36:23 2022 +0800

    keyPressEvent() is void and expects no return value

    fixes a CodeQL warning

commit 4ee7921
Author: KIU Shueng Chuan <[email protected]>
Date:   Sat Apr 9 16:47:24 2022 +0800

    test enum using : "enums & enum"

commit 1841e56
Author: Luke Campagnola <[email protected]>
Date:   Fri Apr 8 10:52:25 2022 -0700

    Be more careful about selecting dtype for clipping output

commit d7cda66
Merge: 5c2057e cead5cd
Author: Ogi Moore <[email protected]>
Date:   Thu Mar 31 09:33:35 2022 -0700

    Merge pull request pyqtgraph#2241 from campagnola/revert-2034

    Fix Regression in in ViewBox.updateScaleBox Caused by pyqtgraph#2034

commit cead5cd
Author: Luke Campagnola <[email protected]>
Date:   Tue Mar 29 17:22:17 2022 -0700

    Revert "Fix displace between selection area and mouse pos (pyqtgraph#2034)"

    This reverts commit 5ed6e6a.

commit 5c2057e
Author: Kanak <[email protected]>
Date:   Sat Mar 26 04:09:15 2022 +0530

    Fixed the app crash on right clicked (pyqtgraph#2236)

    * Fixed the app crash on right clicked

    Fixed the application crash when QGraphicsTextItem(node-label) is right-clicked

    * used the full namespace to set text interaction flags

    * Add focus along with setting flag

commit 8f7d50c
Merge: 349d498 c11dc57
Author: Ogi Moore <[email protected]>
Date:   Tue Mar 22 22:49:55 2022 -0700

    Merge pull request pyqtgraph#2235 from ixjlyons/scatterplotitem-tooltipclearling

    Track when ScatterPlotItem clears the tooltip, only clear when needed

commit c11dc57
Author: Kenneth Lyons <[email protected]>
Date:   Tue Mar 22 21:21:05 2022 -0700

    Track when ScatterPlotItem clears the tooltip, only clear when needed

commit 349d498
Merge: 088b488 68d76ca
Author: Ogi Moore <[email protected]>
Date:   Thu Mar 17 08:50:44 2022 -0700

    Merge pull request pyqtgraph#2232 from pijyoi/fix_glimageitem_regression

    Fix GLImageItem regression

commit 68d76ca
Author: KIU Shueng Chuan <[email protected]>
Date:   Thu Mar 17 17:43:35 2022 +0800

    avoid pyopengl automatic conversion to contiguous array

commit 7dce519
Author: KIU Shueng Chuan <[email protected]>
Date:   Thu Mar 17 17:39:46 2022 +0800

    Revert "fix GLImageItem"

    This reverts commit 36b2e49.

commit 088b488
Author: Ogi Moore <[email protected]>
Date:   Tue Mar 15 08:14:48 2022 -0700

    Remove Python 3.7 from CI - Add Conda Package Testing (pyqtgraph#2211)

    Remove Python 3.7 CI Pipelines

    In order to conform to NEP-29, we now stop testing bindings on Py 3.7.
    Unfortunately, this means that we cannot test against PySide2 5.12 as the
    pip installable version doesn't work with Python 3.8.  To test against
    PySide2 5.12, we will have to add conda-based CI pipelines as the
    conda-forge version of PySide2 has various fixes.

    This PR also updates

    * `.pre-commit-config.yaml`
    * `.gitignore`
    * `pytest.ini` to filter out warnings specific to conda-forge/pyside2/python 3.8

commit f83b472
Merge: d34ef52 2f80fa7
Author: Ogi Moore <[email protected]>
Date:   Sat Mar 12 07:57:12 2022 -0800

    Merge pull request pyqtgraph#2225 from pijyoi/fix_issue_2173

commit d34ef52
Merge: 6ed7d4f c422db0
Author: Ogi Moore <[email protected]>
Date:   Sat Mar 12 07:45:55 2022 -0800

    Merge pull request pyqtgraph#2224 from pijyoi/remove_old_workarounds

commit 2f80fa7
Author: KIU Shueng Chuan <[email protected]>
Date:   Sat Mar 12 14:30:57 2022 +0800

    remove border QGraphicsRectItem from scene

    this fixes issue pyqtgraph#2173 where the QGraphicsRectItem representing the
    border for the item is leaked when the item is removed.

commit c422db0
Author: KIU Shueng Chuan <[email protected]>
Date:   Tue Mar 8 07:50:12 2022 +0800

    remove py2 fallbacks cPickle and __builtin__

commit 1f02652
Author: KIU Shueng Chuan <[email protected]>
Date:   Mon Mar 7 10:16:08 2022 +0800

    restrict workaround to PySide6 6.2.2.x

    the bug has been fixed since PySide6 6.2.3, however the workaround
    codepath will still get taken.
    i.e. the workaround worked by detecting that the instance was no longer
    a MethodType. The fix done in PySide6 6.2.3 keeps the instance as a
    non-MethodType.

commit ae6fa41
Author: KIU Shueng Chuan <[email protected]>
Date:   Mon Mar 7 09:31:36 2022 +0800

    GraphicsItem: itemTransform always returns a tuple

    various other places in the code base already assume this

commit 07e0bfc
Author: KIU Shueng Chuan <[email protected]>
Date:   Mon Mar 7 09:00:28 2022 +0800

    test_parametertypes: no more python2 long, unicode

commit f3bc413
Author: KIU Shueng Chuan <[email protected]>
Date:   Mon Mar 7 08:39:59 2022 +0800

    SpinBox: remove pyqt4 api support

    the old api passed a QString into the method and expected the method to
    mutate it.

commit 32bed46
Author: KIU Shueng Chuan <[email protected]>
Date:   Thu Dec 16 10:43:18 2021 +0800

    remove PyQt5 sip.cast to QGraphicsItem

    given that this bug was in 2012 (corresponding to Qt 5.0) and we
    haven't been needing it for PyQt6, chances are good that it is not
    needed for the new versions of PyQt5 supported by pyqtgraph.

commit f8da909
Author: KIU Shueng Chuan <[email protected]>
Date:   Thu Dec 16 10:39:12 2021 +0800

    remove translateGraphicsItem : workaround for PyQt < 4.9

commit 8f6b623
Author: KIU Shueng Chuan <[email protected]>
Date:   Thu Dec 16 10:55:59 2021 +0800

    Vector: remove __add__ since PySide no longer supported

commit a072414
Author: KIU Shueng Chuan <[email protected]>
Date:   Thu Dec 16 10:54:00 2021 +0800

    GraphicsView: PySide is no longer supported

commit 2f7ecea
Author: KIU Shueng Chuan <[email protected]>
Date:   Thu Dec 16 10:51:10 2021 +0800

    bootstrap and remoteproxy : no more python2

commit 2ab0aa7
Author: KIU Shueng Chuan <[email protected]>
Date:   Thu Dec 16 10:47:40 2021 +0800

    no more setting of pyqtapis

commit 6ed7d4f
Author: Keziah Milligan <[email protected]>
Date:   Sat Mar 5 18:55:34 2022 +0000

    implementing SpinBox prefix (pyqtgraph#2191)

    * implementing SpinBox prefix

    * adding prefixGap and adding to format docstring

    * adding prefix to test_SpinBox_formatting

    * Typo fix

    Co-authored-by: Kenneth Lyons <[email protected]>

commit c056fd8
Author: Andrii Oriekhov <[email protected]>
Date:   Sat Mar 5 18:12:38 2022 +0200

    add GitHub URL for PyPi (pyqtgraph#2212)

    * add GitHub URL for PyPi

    * add docs URL for PyPi

commit 91e35be
Merge: cd855bd e84d408
Author: Ogi Moore <[email protected]>
Date:   Fri Mar 4 18:02:02 2022 -0800

    Merge pull request pyqtgraph#2210 from j9ac9k/bump-to-0.12.4.dev0

    Have version number reflect development release

commit e84d408
Author: Ogi Moore <[email protected]>
Date:   Fri Mar 4 17:45:24 2022 -0800

    Have version number reflect development release

commit cd855bd
Author: Ogi Moore <[email protected]>
Date:   Fri Mar 4 10:28:12 2022 -0800

    Bump to 0.12.4 (pyqtgraph#2209)

    * Generate Changelog for 0.12.4

    * Bump version to 0.12.4

commit ae559cf
Author: Ogi Moore <[email protected]>
Date:   Thu Mar 3 22:52:24 2022 -0800

    Add Python 3.10 to CI - Re-Enable pytest-xdist in CI (pyqtgraph#2150)

    * Have CI run on Python 3.10 and update README

commit 87df346
Merge: 814de9c 03750cb
Author: Ogi Moore <[email protected]>
Date:   Tue Feb 22 13:30:09 2022 -0800

    Merge pull request pyqtgraph#2194 from outofculture/frombuffer

    numpy deprecated binary use of fromstring

commit 814de9c
Author: Daniel Hrisca <[email protected]>
Date:   Tue Feb 22 23:29:20 2022 +0200

    improve GraphicsWidget paint speed by caching the bounding rect and the path used by the shape method (pyqtgraph#2198)

    * improve GraphicsWidget paint speed by caching the bounding rect

    * forgot to give the argument to the mapRectFromParent function

    * also cache the path used by the shape method

    * changes after review

    * use meaningful variable names

commit b40eef5
Merge: 508a84f 1f51a3b
Author: Ogi Moore <[email protected]>
Date:   Tue Feb 22 11:23:17 2022 -0800

    Merge pull request pyqtgraph#2202 from danielhrisca/cache_viewPixelSize

    cache the ViewBox view pixel size

commit 1f51a3b
Author: danielhrisca <[email protected]>
Date:   Tue Feb 22 20:25:08 2022 +0200

    use meaningful variable name

commit 508a84f
Merge: 7e82af3 4e9f714
Author: Ogi Moore <[email protected]>
Date:   Tue Feb 22 10:07:38 2022 -0800

    Merge pull request pyqtgraph#2201 from danielhrisca/plotcurveitem_plot_optimization

    micro-optimization for plotcurveitem paint

commit b092d86
Author: danielhrisca <[email protected]>
Date:   Wed Feb 16 14:36:02 2022 +0200

    cache the ViewBox view pixel size

commit 4e9f714
Author: danielhrisca <[email protected]>
Date:   Tue Feb 15 14:53:45 2022 +0200

    micro-optimization for plotcurveitem paint

commit 7e82af3
Merge: 67ad965 c78f757
Author: Ogi Moore <[email protected]>
Date:   Mon Feb 14 09:09:55 2022 -0800

    Merge pull request pyqtgraph#2199 from danielhrisca/autorange

    avoid unnecessary call if autorange is disabled

commit c78f757
Author: danielhrisca <[email protected]>
Date:   Mon Feb 14 18:14:31 2022 +0200

    avoid unnecessary call if autorange is disabled

commit 67ad965
Merge: 8279a0a 0b32fb8
Author: Martin Chase <[email protected]>
Date:   Wed Feb 9 12:47:54 2022 -0800

    Merge pull request pyqtgraph#2192 from JamesWrigley/master

    Add an option to makeARGB to disable masking NaNs

commit 03750cb
Author: Martin Chase <[email protected]>
Date:   Wed Feb 9 12:38:15 2022 -0800

    numpy deprecated binary use of fromstring

commit 0b32fb8
Author: JamesWrigley <[email protected]>
Date:   Wed Feb 9 17:36:14 2022 +0100

    fixup! Add an option to makeARGB to disable masking NaNs

commit 671b02c
Author: JamesWrigley <[email protected]>
Date:   Mon Feb 7 15:09:36 2022 +0100

    Add an option to makeARGB to disable masking NaNs

commit a1a5b38
Author: Anton Yablokov <[email protected]>
Date:   Tue Jan 25 01:10:07 2022 +0300

    Use `blockIfUnchanged` decorator

    If the signals are blocked externally, keep the state. Before the patch, the block got released unconditionally. There has been a `blockIfUnchanged` decorator for this, but its code has been re-used with a logical error, so the decorator couldn't have worked.

commit 8279a0a
Merge: 4cecdfe a1e495a
Author: Luke Campagnola <[email protected]>
Date:   Wed Jan 19 09:13:50 2022 -0800

    Merge pull request pyqtgraph#2170 from CanisUrsa/gradient_legend_min_format

    Fix formatting on minimum value of GradientLegend.

commit 4cecdfe
Merge: ac3887a 942bf0b
Author: Ogi Moore <[email protected]>
Date:   Wed Jan 12 11:48:36 2022 -0800

    Merge pull request pyqtgraph#2172 from EnMAP-Box/master

    Added projects to Used by list

commit 942bf0b
Author: Benjamin Jakimow [email protected] <[email protected]>
Date:   Wed Jan 12 12:35:38 2022 +0100

    added projects to Used by list

commit a1e495a
Author: Christopher Contaxis <[email protected]>
Date:   Mon Jan 10 08:40:00 2022 -0500

    Fix formatting on minimum value of GradientLegend.

commit ac3887a
Merge: 288e7e4 b582425
Author: Ogi Moore <[email protected]>
Date:   Wed Dec 15 10:20:57 2021 -0800

    Merge pull request pyqtgraph#2154 from JamesWrigley/cleanup

    Fix typos and formatting errors

commit 288e7e4
Merge: a5f48ec de29c14
Author: Ogi Moore <[email protected]>
Date:   Wed Dec 15 07:22:41 2021 -0800

    Merge pull request pyqtgraph#2153 from JamesWrigley/python3.10

commit b582425
Author: JamesWrigley <[email protected]>
Date:   Wed Dec 15 13:39:49 2021 +0100

    Fix typos and formatting errors

    Also change the docs of `TargetItem` to point to `ScatterPlotItem.setSymbol()`
    in reference to what symbols are accepted, since the documentation for this
    method lists all the symbols.

commit de29c14
Author: JamesWrigley <[email protected]>
Date:   Wed Dec 15 13:30:01 2021 +0100

    Fix more int-casting code for Python 3.10 compatibility
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.

3 participants