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

Dangerous default value [] as argument in enable/enable/savage/svg/backends/kiva/renderer.py #395

Closed
pbrod opened this issue Mar 24, 2020 · 0 comments · Fixed by #467
Closed
Labels
ETS Backlog Good issue for ETS team members to look at

Comments

@pbrod
Copy link
Contributor

pbrod commented Mar 24, 2020

The init method has a dangerous default value [] as argument for "transforms":

def __init__(self, x1,y1, x2,y2, stops, spreadMethod='pad',
transforms=[], units='userSpaceOnUse'):

Consider setting it to None and check for None explicitly.

pbrod added a commit to pbrod/enable that referenced this issue Mar 26, 2020
…ontext.draw_image method

Fixes enthought#396 Made sure rows and columns are integers by replacing "/" with "//" in kiva/agg/freetype2/src/tools/docmaker/tohtml.py

Fixes enthought#400 Made the test examples run on windows and using wx:
 * Replaced deprecated "wx.EVT_XXX(panel, handler)" with "panel.Bind(wx.EVT_XXX, handler)" in   rgba_color_editor.py
 * Replaced faulty "slider.SetTickFreq( 10, 1 )" with "slider.SetTickFreq(10)" in rgba_color_editor.py
 * Fixed the failing ToolkitEditorFactory.all_facenames method in kiva_font_editor.py
 * Replaced deprecated wx.PyPanel with wx.Panel
 * Insulated the xxxtrait.configure_traits() call inside a "if __name__ == '__main__'" block
 * Added the "demo = XXXtrait()" to each demo-script so it can be discovered and run by the traitsui.extra.demo.demo.
 * Changed "from enable.wx_backend import Window" to "from enable.api import Window"
and moved all imports to the top of the file.
 * Replaced call to wx.SystemSettings_GetMetric with wx.SystemSettings.GetMetric
 * Replaced call to deprecated wx.EVT_XXXX( control, self._on_XXXX) with control.Bind(wx.EVT_ERASE_BACKGROUND, self._on_XXXXX)
 * Fixed a bug in BaseWindow._create_control: If parent is None it is set to wx.Frame(None) in order to avoid crash in the unittests.
 * Replaced wx.WXK_PRIOR and wx.WXK_NEXT (which does not exist on wxpython4) with wx.WXK_PAGEUP and wx.WXK_PAGEDOWN

Fixes enthought#399 replaced:
 * wx.GraphicsRenderer_GetDefaultRenderer with wx.GraphicsRenderer.GetDefaultRenderer
 * wx.GraphicsContext_Create with wx.GraphicsContext.Create

Fixed failing examples:
 * examples/kiva/agg/benchmark.py (Float -> float, added missing import of  zeros)
 * examples/kiva/agg/polygon_hit_test.py (point_in_polygon -> points_in_polygon)
 * examples/kiva/gradient.py (added missing import of tempfile)

Moved code in 'if __name___ == "__main__"' block in benchmark.py to the run_all_benchmarks function.

Removed unused stuff:
 * Removed unused import of "FILL_STROKE" in examples/kiva/agg/compiled_path.py
 * Removed unused import of "affine", "constants" in examples/kiva/agg/dummy.py
 * Removed unused ttfdict_to_fnames function in font_manager.py
 * Removed unused import of "sqrt" and "affine" in enable/savage/svr/backends/kiva/renderer.py

Replaced call to deprecated time.clock with time.perf_counter on Python 3 in:
 * examples/kiva/agg/benchmark.py
 * examples/kiva/agg/dash.py
 * examples/kiva/agg/lion.py
 * examples/kiva/agg/pylygon_hit_test.py
 * examples/kiva/agg/simple_clip.py
 * examples/kiva/agg/text_ex.py
 * examples/kiva/simple.py
 * examples/kiva/test_image3.py

Fixes enthought#395
 * Replaced dangerous default value "transforms=[]" with "transforms=None" in __init__ methods.

Python style fixes.
pbrod added a commit to pbrod/enable that referenced this issue Mar 26, 2020
…d tests to expected failure.

Also removed unused import of "allclose" and "nose".

Made wx.VERSION comparison more robust in enable/savage/svg/backends/wx/renderer.py and enable/wx/base_window.py.

Fixes enthought#393 Added self as first argument to AbstractGraphicsContext.draw_image method

Fixes enthought#396 Made sure rows and columns are integers by replacing "/" with "//" in kiva/agg/freetype2/src/tools/docmaker/tohtml.py

Fixes enthought#400 Made the test examples run on windows and using wx:
 * Replaced deprecated "wx.EVT_XXX(panel, handler)" with "panel.Bind(wx.EVT_XXX, handler)" in   rgba_color_editor.py
 * Replaced faulty "slider.SetTickFreq( 10, 1 )" with "slider.SetTickFreq(10)" in rgba_color_editor.py
 * Fixed the failing ToolkitEditorFactory.all_facenames method in kiva_font_editor.py
 * Replaced deprecated wx.PyPanel with wx.Panel
 * Insulated the xxxtrait.configure_traits() call inside a "if __name__ == '__main__'" block
 * Added the "demo = XXXtrait()" to each demo-script so it can be discovered and run by the traitsui.extra.demo.demo.
 * Changed "from enable.wx_backend import Window" to "from enable.api import Window"
and moved all imports to the top of the file.
 * Replaced call to wx.SystemSettings_GetMetric with wx.SystemSettings.GetMetric
 * Replaced call to deprecated wx.EVT_XXXX( control, self._on_XXXX) with control.Bind(wx.EVT_ERASE_BACKGROUND, self._on_XXXXX)
 * Fixed a bug in BaseWindow._create_control: If parent is None it is set to wx.Frame(None) in order to avoid crash in the unittests.
 * Replaced wx.WXK_PRIOR and wx.WXK_NEXT (which does not exist on wxpython4) with wx.WXK_PAGEUP and wx.WXK_PAGEDOWN

Fixes enthought#399 replaced:
 * wx.GraphicsRenderer_GetDefaultRenderer with wx.GraphicsRenderer.GetDefaultRenderer
 * wx.GraphicsContext_Create with wx.GraphicsContext.Create

Fixed failing examples:
 * examples/kiva/agg/benchmark.py (Float -> float, added missing import of  zeros)
 * examples/kiva/agg/polygon_hit_test.py (point_in_polygon -> points_in_polygon)
 * examples/kiva/gradient.py (added missing import of tempfile)

Moved code in 'if __name___ == "__main__"' block in benchmark.py to the run_all_benchmarks function.

Removed unused stuff:
 * Removed unused import of "FILL_STROKE" in examples/kiva/agg/compiled_path.py
 * Removed unused import of "affine", "constants" in examples/kiva/agg/dummy.py
 * Removed unused ttfdict_to_fnames function in font_manager.py
 * Removed unused import of "sqrt" and "affine" in enable/savage/svr/backends/kiva/renderer.py

Replaced call to deprecated time.clock with time.perf_counter on Python 3 in:
 * examples/kiva/agg/benchmark.py
 * examples/kiva/agg/dash.py
 * examples/kiva/agg/lion.py
 * examples/kiva/agg/pylygon_hit_test.py
 * examples/kiva/agg/simple_clip.py
 * examples/kiva/agg/text_ex.py
 * examples/kiva/simple.py
 * examples/kiva/test_image3.py

Fixes enthought#395
 * Replaced dangerous default value "transforms=[]" with "transforms=None" in __init__ methods.

Python style fixes.
pbrod added a commit to pbrod/enable that referenced this issue Mar 26, 2020
…d tests to expected failure.

Also removed unused import of "allclose" and "nose".

Made wx.VERSION comparison more robust in enable/savage/svg/backends/wx/renderer.py and enable/wx/base_window.py.

Fixes enthought#393 Added self as first argument to AbstractGraphicsContext.draw_image method

Fixes enthought#396 Made sure rows and columns are integers by replacing "/" with "//" in kiva/agg/freetype2/src/tools/docmaker/tohtml.py

Fixes enthought#400 Made the test examples run on windows and using wx:
 * Replaced deprecated "wx.EVT_XXX(panel, handler)" with "panel.Bind(wx.EVT_XXX, handler)" in   rgba_color_editor.py
 * Replaced faulty "slider.SetTickFreq( 10, 1 )" with "slider.SetTickFreq(10)" in rgba_color_editor.py
 * Fixed the failing ToolkitEditorFactory.all_facenames method in kiva_font_editor.py
 * Replaced deprecated wx.PyPanel with wx.Panel
 * Insulated the xxxtrait.configure_traits() call inside a "if __name__ == '__main__'" block
 * Added the "demo = XXXtrait()" to each demo-script so it can be discovered and run by the traitsui.extra.demo.demo.
 * Changed "from enable.wx_backend import Window" to "from enable.api import Window"
and moved all imports to the top of the file.
 * Replaced call to wx.SystemSettings_GetMetric with wx.SystemSettings.GetMetric
 * Replaced call to deprecated wx.EVT_XXXX( control, self._on_XXXX) with control.Bind(wx.EVT_ERASE_BACKGROUND, self._on_XXXXX)
 * Fixed a bug in BaseWindow._create_control: If parent is None it is set to wx.Frame(None) in order to avoid crash in the unittests.
 * Replaced wx.WXK_PRIOR and wx.WXK_NEXT (which does not exist on wxpython4) with wx.WXK_PAGEUP and wx.WXK_PAGEDOWN

Fixes enthought#399 replaced:
 * wx.GraphicsRenderer_GetDefaultRenderer with wx.GraphicsRenderer.GetDefaultRenderer
 * wx.GraphicsContext_Create with wx.GraphicsContext.Create

Fixed failing examples:
 * examples/kiva/agg/benchmark.py (Float -> float, added missing import of  zeros)
 * examples/kiva/agg/polygon_hit_test.py (point_in_polygon -> points_in_polygon)
 * examples/kiva/gradient.py (added missing import of tempfile)

Moved code in 'if __name___ == "__main__"' block in benchmark.py to the run_all_benchmarks function.

Removed unused stuff:
 * Removed unused import of "FILL_STROKE" in examples/kiva/agg/compiled_path.py
 * Removed unused import of "affine", "constants" in examples/kiva/agg/dummy.py
 * Removed unused ttfdict_to_fnames function in font_manager.py
 * Removed unused import of "sqrt" and "affine" in enable/savage/svr/backends/kiva/renderer.py

Replaced call to deprecated time.clock with time.perf_counter on Python 3 in:
 * examples/kiva/agg/benchmark.py
 * examples/kiva/agg/dash.py
 * examples/kiva/agg/lion.py
 * examples/kiva/agg/pylygon_hit_test.py
 * examples/kiva/agg/simple_clip.py
 * examples/kiva/agg/text_ex.py
 * examples/kiva/simple.py
 * examples/kiva/test_image3.py

Fixes enthought#395
 * Replaced dangerous default value "transforms=[]" with "transforms=None" in __init__ methods.

Python style fixes.
@corranwebster corranwebster added the ETS Backlog Good issue for ETS team members to look at label Apr 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ETS Backlog Good issue for ETS team members to look at
Projects
None yet
2 participants