Commit Graph

9 Commits

Author SHA1 Message Date
Per A. Brodtkorb
426258b7b7 Adding missing close for open and replaced "fid=open(filename) fid.close()"
statements with the safer "with open(filename) as fid:" blocks.

Also removed unnecessary "try: ... finally: pass" statements
and refactored code from img2py function into _write_image and _replace_non_alphanumeric_with_underscore

Fixes #1574
2020-03-25 10:36:38 +01: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
4b6ee40a14 Merge pull request #938 from RobinD42/fix-issue932-b
Restore wx.lib.pubsub, and officially deprecate
(cherry picked from commit 8fad2231a0)
2018-07-20 16:45:05 -07:00
David Hughes
5ac3eab051 Remove local pubsub 3.3.0 code and import 4.0.0 from external package 2018-03-12 11:06:21 +00:00
Metallicow
53c1f4f119 Trim Whitespace pubsub directory 2016-10-12 22:50:27 -05:00
Oliver Schoenborn
ea0f874a40 Update from r343 of pubsub trunk/src/pubsub on SF.net
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@75301 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-11-27 05:45:26 +00:00
Oliver Schoenborn
6a1bbb55f5 CHG: update to latest pypubsub (3.3.dev1)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@75077 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-10-27 05:10:22 +00:00
Robin Dunn
247673201b Copy (branch) wx.lib, wx.py and wx.tools from Classic, and include subpackages branched from 3rdParty
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@72061 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-07-13 01:36:07 +00:00