mwxlib 1.4.20__py3-none-any.whl → 1.5.9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of mwxlib might be problematic. Click here for more details.

mwx/utilus.py CHANGED
@@ -16,7 +16,7 @@ import fnmatch
16
16
  import pkgutil
17
17
  import pydoc
18
18
  import inspect
19
- from inspect import isclass, ismodule, ismethod, isbuiltin, isfunction, isgenerator # noqa
19
+ from inspect import isclass, ismodule, ismethod, isbuiltin, isfunction
20
20
  from pprint import pprint
21
21
 
22
22
 
@@ -50,7 +50,12 @@ def warn(message, category=None, stacklevel=None):
50
50
 
51
51
 
52
52
  def atom(v):
53
- return not hasattr(v, '__name__')
53
+ ## Not a class, method, function, module, or any type (class, int, str, etc.).
54
+ if (isclass(v) or ismethod(v) or isfunction(v) or isbuiltin(v)
55
+ or ismodule(v) or isinstance(v, type)):
56
+ return False
57
+ ## Include the case where __name__ is manually defined for a class instance.
58
+ return not hasattr(v, '__name__') or hasattr(v, '__class__')
54
59
 
55
60
 
56
61
  def isobject(v):
@@ -160,7 +165,7 @@ def apropos(obj, rexpr='', ignorecase=True, alias=None, pred=None, locals=None):
160
165
  except re.error as e:
161
166
  print("- re:miss compilation:", e)
162
167
  else:
163
- keys = sorted(filter(p.search, dir(obj)), key=lambda s:s.upper())
168
+ keys = sorted(filter(p.search, dir(obj)), key=lambda s: s.upper())
164
169
  n = 0
165
170
  for key in keys:
166
171
  try:
@@ -184,22 +189,22 @@ def apropos(obj, rexpr='', ignorecase=True, alias=None, pred=None, locals=None):
184
189
  def typename(obj, docp=False, qualp=True):
185
190
  """Formatted object type name.
186
191
  """
187
- if hasattr(obj, '__name__'): # module, class, method, function, etc.
192
+ if not atom(obj): # module, class, method, function, etc.
188
193
  if qualp:
189
194
  name = getattr(obj, '__qualname__', obj.__name__)
190
195
  else:
191
196
  name = obj.__name__
192
- elif hasattr(obj, '__module__'): # atom -> module.class
197
+ elif hasattr(obj, '__class__'): # class instance -> module.class
193
198
  name = obj.__class__.__name__
194
199
  else:
195
- return pydoc.describe(obj) # atom -> short description
200
+ return pydoc.describe(obj) # atom -> short description
196
201
 
197
202
  modname = getattr(obj, '__module__', None)
198
203
  if modname and modname != "__main__" and not modname.startswith('mwx'):
199
204
  name = modname + ('.' if qualp else '..') + name
200
205
 
201
206
  if docp and callable(obj) and obj.__doc__:
202
- name += "<{!r}>".format(obj.__doc__.splitlines()[0]) # concat the first doc line
207
+ name += "<{!r}>".format(obj.__doc__.splitlines()[0]) # concat the first doc line
203
208
  return name
204
209
 
205
210
 
@@ -272,6 +277,7 @@ def mro(obj):
272
277
  def pp(obj):
273
278
  pprint(obj, **pp.__dict__)
274
279
 
280
+
275
281
  if pp:
276
282
  pp.indent = 1
277
283
  pp.width = 80 # default 80
@@ -725,7 +731,7 @@ class FSM(dict):
725
731
  This method is used for the contexts given to :append and :update
726
732
  so that the original transaction (if they are lists) is not removed.
727
733
  """
728
- return {event:transaction[:] for event, transaction in context.items()}
734
+ return {event: transaction[:] for event, transaction in context.items()}
729
735
 
730
736
  def validate(self, state):
731
737
  """Sort and move to end items with key which includes ``*?[]``."""
@@ -742,7 +748,7 @@ class FSM(dict):
742
748
  context.clear()
743
749
  context.update(temp)
744
750
  context.update(sorted(bra, reverse=1))
745
- context.update(sorted(ast, reverse=1, key=lambda v:len(v[0])))
751
+ context.update(sorted(ast, reverse=1, key=lambda v: len(v[0])))
746
752
 
747
753
  def update(self, contexts):
748
754
  """Update each context or Add new contexts."""
@@ -826,6 +832,22 @@ class FSM(dict):
826
832
  f" The transaction must be a list, not a tuple.")
827
833
  return action
828
834
 
835
+ def binds(self, event, action=None, state=None, state2=None):
836
+ """Append a one-time transaction to the context.
837
+
838
+ Like `bind`, but unbinds itself after being called once.
839
+ """
840
+ if action is None:
841
+ return lambda f: self.binds(event, f, state, state2)
842
+
843
+ @wraps(action)
844
+ def _act(*v, **kw):
845
+ try:
846
+ return action(*v, **kw)
847
+ finally:
848
+ self.unbind(event, _act, state)
849
+ return self.bind(event, _act, state, state2)
850
+
829
851
  def unbind(self, event, action=None, state=None):
830
852
  """Remove a transaction from the context.
831
853
 
mwx/wxpdb.py CHANGED
@@ -52,7 +52,7 @@ class Debugger(Pdb):
52
52
  verbose = False
53
53
  use_rawinput = False
54
54
  prompt = property(lambda self: self.indents + '(Pdb) ',
55
- lambda self,v: None) # fake setter
55
+ lambda self, v: None) # fake setter
56
56
  handler = property(lambda self: self.__handler)
57
57
 
58
58
  @property
@@ -240,7 +240,7 @@ class Debugger(Pdb):
240
240
  except Exception as e:
241
241
  ## Note: post-call to avoid crashing by a kill-focus event.
242
242
  wx.CallAfter(wx.MessageBox,
243
- f"Debugger is closed.\n\n{e}")
243
+ f"Debugger has been closed.\n\n{e}")
244
244
  finally:
245
245
  self.set_quit()
246
246
 
@@ -266,7 +266,7 @@ class Debugger(Pdb):
266
266
  except Exception as e:
267
267
  ## Note: post-call to avoid crashing by a kill-focus event.
268
268
  wx.CallAfter(wx.MessageBox,
269
- f"Debugger is closed.\n\n{e}")
269
+ f"Debugger has been closed.\n\n{e}")
270
270
  finally:
271
271
  self.set_quit()
272
272
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mwxlib
3
- Version: 1.4.20
3
+ Version: 1.5.9
4
4
  Summary: A wrapper of matplotlib and wxPython (phoenix)
5
5
  Home-page: https://github.com/komoto48g/mwxlib
6
6
  Author: Kazuya O'moto
@@ -0,0 +1,28 @@
1
+ mwx/__init__.py,sha256=pS7ZG8QKRypiFFiaWAq_opBB6I_1viZ0zUMk2TbjzE0,667
2
+ mwx/bookshelf.py,sha256=yW17nMNPXKHM7LLXLpr9DaRhyFHz_OBAZ_DsuEK2QzA,8387
3
+ mwx/controls.py,sha256=Mpzpp2eWyS_X7RjxTJay1-Fldchk-x-rUBpUhHSG-5w,49924
4
+ mwx/framework.py,sha256=Bgvh2fqP5oRE79H0NFU5n_bFVLaE1c8JYHEJ8SUuqfw,77784
5
+ mwx/graphman.py,sha256=zaKfcWbj6YYg2GFj_ijiqLd44OORFVKOvbQwucxNpno,69894
6
+ mwx/images.py,sha256=Kkfy9QI_hMtwShSjUS4-ZpC_EkVuah_XhpBOR4wAKkM,49792
7
+ mwx/matplot2.py,sha256=5Z-m9KXtSXpzBQs3swqPbfl_mfVdDoPaWKqpiepfau8,33019
8
+ mwx/matplot2g.py,sha256=hLBYWjXPc2jgtKPTQWCdieIegQvS4jjUUaedV4qDLoE,65255
9
+ mwx/matplot2lg.py,sha256=fpxOX18vonUTpA_nAr-wBhQ_2YNsL_nfxdCDliuP1sU,27430
10
+ mwx/mgplt.py,sha256=SVUJ0ls4gC9xulbWxK2qqmDxf0uBCflvwoPkxoF5s3M,5566
11
+ mwx/nutshell.py,sha256=CX-NK3kOEi3JHhjKh39R2_m1po1SvMxraaDk2xt6q-Y,147617
12
+ mwx/testsuite.py,sha256=0Q_n_XOOsZ8lsLWUkuO8QW00hts9wEQfnUKMpf0BAyU,1235
13
+ mwx/utilus.py,sha256=RiBKZLLnVqT-YrU3gFZ69eZAD25RaPARm2_fOGXG4cw,38964
14
+ mwx/wxmon.py,sha256=NIksW_CZv7Kw4dod8tWVwakO4iJuvE8hJSAcjkYfLaE,12800
15
+ mwx/wxpdb.py,sha256=kKzEGivjoZ9zGcB3ttYsAym4putyilmXZXj-5CGaivQ,18813
16
+ mwx/wxwil.py,sha256=hhyB1lPrF9ixeObxCOKQv0Theu-B-kpJg_yVU3EGSNg,5406
17
+ mwx/wxwit.py,sha256=mTH92bWw1F3ycaq4EoxVD_4hIxy2fbKZZbQg3f1ZD1Y,7350
18
+ mwx/plugins/__init__.py,sha256=jnJ-Sl9XJ_7BFDslD_r7dsbxsOT57q_IaEriV53XIGY,41
19
+ mwx/plugins/ffmpeg_view.py,sha256=GT3mAP7cvAgkzHyA0Em_FP8wiWS-dRekUyBgaXIBQCc,10982
20
+ mwx/plugins/fft_view.py,sha256=Hsho8y-42hG3htQAJ9ct1347NHJ8qPvN4snq_1jYOxw,2793
21
+ mwx/plugins/frame_listview.py,sha256=q-8CrWPovgkEe4ICESfdRUDfAWJYoriElufuAcyu30U,10380
22
+ mwx/plugins/line_profile.py,sha256=zzm6_7lnAnNepLbh07ordp3nRWDFQJtu719ZVjrVf8s,819
23
+ mwx/py/__init__.py,sha256=xykgfOytOwNuvXsfkLoumFZSTN-iBsHOjczYXngjmUE,12
24
+ mwx/py/filling.py,sha256=fumUG1F5M9TL-Dfqni4G85uk7TmvnUunTbdcPDV0vfo,16857
25
+ mwxlib-1.5.9.dist-info/METADATA,sha256=nOrVtH-e2vPfhgGbjSkhKVVF-E1i8Z3pyP-HryhUPhs,7381
26
+ mwxlib-1.5.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
27
+ mwxlib-1.5.9.dist-info/top_level.txt,sha256=SI1Mh118AstnUFGPNq5aMNKiAnVNmZk1S9Ij-OwAEpY,4
28
+ mwxlib-1.5.9.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.3.1)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,28 +0,0 @@
1
- mwx/__init__.py,sha256=pS7ZG8QKRypiFFiaWAq_opBB6I_1viZ0zUMk2TbjzE0,667
2
- mwx/bookshelf.py,sha256=XbJ9HUH5COUm-BVI7iLC7gr9Hj9l-sFjOoaCAqNS4aA,8178
3
- mwx/controls.py,sha256=cgYEeBn1GD1s2YrDZd3jzhlACTc9IOZED_JOA8dqTJI,49914
4
- mwx/framework.py,sha256=D1KILJNmv-eQ0HY8ayphIA_Fd9K19d6jHA5q27fp61M,77031
5
- mwx/graphman.py,sha256=sb9Y2z5bW30arFxQnOoMhjxILNUdnAZsDh9rNbY_IPI,70037
6
- mwx/images.py,sha256=Kkfy9QI_hMtwShSjUS4-ZpC_EkVuah_XhpBOR4wAKkM,49792
7
- mwx/matplot2.py,sha256=U0axLQeZAR_ys5rXHykVKkvXLibnNwXS-gm-c0U2MGw,33003
8
- mwx/matplot2g.py,sha256=foq-NdksvTV_I55UGxLzghp1YXaFfWgzTmigmnIe58E,65376
9
- mwx/matplot2lg.py,sha256=cb0EZXivccDQu4oFj5ddSUF9pEE4f5UuFJJK2ELItww,27404
10
- mwx/mgplt.py,sha256=KR7MWdl9J6hiiBdO0NB25Y37rP21aFdwBVsB9KZKXo8,5564
11
- mwx/nutshell.py,sha256=sAvHbrD9V4lMaeX_h_r8e5VYnhAe47GMRaRzoNJmtV0,146629
12
- mwx/testsuite.py,sha256=Zk75onPSEn2tf0swS3l-vIn6yTXGB7allIyvJsPHj20,1229
13
- mwx/utilus.py,sha256=ZcKEkY2jR9pvf0bDFXyKk2Z7dDBf-NW84tDPiBlWdic,38081
14
- mwx/wxmon.py,sha256=NIksW_CZv7Kw4dod8tWVwakO4iJuvE8hJSAcjkYfLaE,12800
15
- mwx/wxpdb.py,sha256=aZIH7Xs-9ahDLut2P4NmvbB2zHVpI95kx4je1ophNQM,18799
16
- mwx/wxwil.py,sha256=hhyB1lPrF9ixeObxCOKQv0Theu-B-kpJg_yVU3EGSNg,5406
17
- mwx/wxwit.py,sha256=mTH92bWw1F3ycaq4EoxVD_4hIxy2fbKZZbQg3f1ZD1Y,7350
18
- mwx/plugins/__init__.py,sha256=jnJ-Sl9XJ_7BFDslD_r7dsbxsOT57q_IaEriV53XIGY,41
19
- mwx/plugins/ffmpeg_view.py,sha256=-xf1Kmu4H5UZRCatqPLfstr2NbnJDZ2_xLfBLV4vczo,11001
20
- mwx/plugins/fft_view.py,sha256=08A_Y73XirV7kXpwf-v0mUA0Hr0MOfdMXv3tvL1hvWA,2789
21
- mwx/plugins/frame_listview.py,sha256=xH1au3lI-bZwCzmhVmvNTOHDoVQIBzH4p9_8Y36Qs5U,10380
22
- mwx/plugins/line_profile.py,sha256=zzm6_7lnAnNepLbh07ordp3nRWDFQJtu719ZVjrVf8s,819
23
- mwx/py/__init__.py,sha256=xykgfOytOwNuvXsfkLoumFZSTN-iBsHOjczYXngjmUE,12
24
- mwx/py/filling.py,sha256=fumUG1F5M9TL-Dfqni4G85uk7TmvnUunTbdcPDV0vfo,16857
25
- mwxlib-1.4.20.dist-info/METADATA,sha256=4uLVWBcmszTutWuvX_2Sv3s4nynp2J6hEXRLo1O-uhU,7382
26
- mwxlib-1.4.20.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
27
- mwxlib-1.4.20.dist-info/top_level.txt,sha256=SI1Mh118AstnUFGPNq5aMNKiAnVNmZk1S9Ij-OwAEpY,4
28
- mwxlib-1.4.20.dist-info/RECORD,,