Commit Graph

22 Commits

Author SHA1 Message Date
Edouard Choinière
95cafd1a3f style: Normalise numpy imports with import numpy as np
The convention when importing numpy is to use `import numpy as np`

Fixes: unconventional-import-alias (ICN001)
Ruff rule: https://docs.astral.sh/ruff/rules/unconventional-import-alias/
2025-02-08 16:48:57 +00:00
Alexandre Detiste
0257f755cf remove most of Python2 compatibility code 2025-02-02 20:17:45 -05:00
Randy Döring
f7d1d8188c Fix NumPy 2.0 deprecations via running ruff (#2580)
* Fix NumPy 2.0 deprecations via running `ruff check --select NPY201 --fix --exclude docs/sphinx/rest_substitutions/snippets/python/converted`

See https://numpy.org/devdocs/numpy_2_0_migration_guide.html#numpy-2-0-migration-guide

* Use `numpy.any` instead of `any` because the latter does not work for multidimensional arrays.
2024-08-21 19:53:57 -04:00
Tim Riddermann
516539a7a0 Since numpy 1.20 the aliases np.int and np.float are deprecated (see https://numpy.org/devdocs/release/1.20.0-notes.html#using-the-aliases-of-builtin-types-like-np-int-is-deprecated). The buildin types should be used instead. Since numpy 1.24 an AttributeError exception is thrown when np.int or np.float is used. 2023-02-28 16:07:02 +01:00
PChemGuy
8d771a389c py3: use six.moves.range instead of xrange
The xrange module  was removed in Python 3 and we should
use 'six.moves.range' instead of 'xrange' to make
code compatible with py 2 and 3 as well.
2022-08-20 13:58:51 +03:00
Robin Dunn
92f8cd2d55 Fix lots of misspelled words 2020-07-14 11:38:32 -07:00
Per A. Brodtkorb
e4e8bf8317 Fixes issue 1571:
Adding missing close for open.
If the "close()" call is missing after a "open(filename)" call, the filename isn't guaranteed to be closed before the interpreter exits.
This is generally a bad practice as explained here: https://stackoverflow.com/questions/7395542/is-explicitly-closing-files-important

Also replaced "fid=open(filename) fid.close()" statements for files with the safer
"with open(filename) as fid:" blocks. See https://www.python.org/dev/peps/pep-0343/
2020-03-23 17:16:44 +01:00
Per A. Brodtkorb
033c18fd9f Fixes issue #1556
Replaced XXX.keys() calls with idiomatic python 3 calls that are compatible with python 2 such as eg:
 * replaced "y = xxx.keys()" or "y = list(xxx.keys())" with just "y = list(xxx)"
 * replaced "sorted(xxx.keys())" or "sorted(list(xxx.keys()))" with just "sorted(xxx)"
 * replaced "if not A in B.keys():" with "if A not in B:"
 * replaced "for A in B.keys():"  with "for A in B:"

See also https://python-future.org/compatible_idioms.html
https://python-future.org/compatible_idioms.html#dict-keys-values-items-as-a-list
2020-03-20 18:51:19 +01:00
Robin Dunn
b680b7f16e More color name fixes 2020-02-27 14:33:23 -08:00
Robin Dunn
91b4c8077e No need to call wx.InitAllImageHandlers any more, it is called when wx is first imported. 2020-02-26 09:56:08 -08:00
Robin Dunn
81001efb9b Use a valid color name 2020-02-26 09:55:17 -08:00
topic2k
873fd00a41 time.clock() is removed in Python 3.8
Two more places where `time.clock()` is called. Adopt the imports accordingly.
2019-09-15 12:55:34 +02:00
Metallicow
230bf5d6d3 Optimize All PNGs Nov2018
Since I had to fix a image issue and optimize it. I decided to rerun FileOptimizer 13.30.2393 over all pngs. Small bytes for some that had been optimized before, but this comit covers all pngs that may have been missed in the past. Maybe revisit running them all again in 2 years. Total time to process all pngs: approx 8 hours.
As technology improves this will only get better/faster when downloading, loading in browser, embedded, etc...
2018-11-13 16:08:12 -06:00
Robin Dunn
705aa63d75 Merge branch 'more-windowidref' into wxPy-4.0.x
(cherry picked from commit ada7b2fc51)
2018-06-25 19:12:00 -07:00
Metallicow
01f8f09f60 Trim trailing space samples directory 2016-12-05 16:34:47 -06:00
Werner F Bruhin
871241c66b - refactor of FloatCanvas package, unittest and demo run on Py27 and Py33 2014-06-05 11:09:18 +02:00
Werner F Bruhin
ca162ee926 - a few Py3 changes
- add tags
2014-05-26 12:58:45 +02:00
Robin Dunn
784673e690 PR 44 (modified): fixes print statements/functions in samples.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@75629 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-01-15 08:13:12 +00:00
Robin Dunn
9dcfa69ca0 Add missing image for floatcanvas sample
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@73900 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-05-02 01:00:58 +00:00
Robin Dunn
9ad818a4a7 turn off execute property, ensure native eol.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@73883 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-04-30 05:31:31 +00:00
Robin Dunn
7bc7aaf7f8 Floatcanvas samples updates for Phoenix
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@73882 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-04-30 05:19:51 +00:00
Robin Dunn
c7cd5d5fe9 Add the FloatCanvas demo modules
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@73860 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-04-26 07:04:14 +00:00