pyflyby 1.9.5__tar.gz → 1.9.6__tar.gz

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 pyflyby might be problematic. Click here for more details.

Files changed (154) hide show
  1. {pyflyby-1.9.5/lib/python/pyflyby.egg-info → pyflyby-1.9.6}/PKG-INFO +1 -5
  2. {pyflyby-1.9.5 → pyflyby-1.9.6}/bin/pyflyby/_dbg.py +12 -11
  3. {pyflyby-1.9.5/lib/python → pyflyby-1.9.6/bin}/pyflyby/_importdb.py +1 -1
  4. {pyflyby-1.9.5 → pyflyby-1.9.6}/bin/pyflyby/_interactive.py +1 -1
  5. {pyflyby-1.9.5 → pyflyby-1.9.6}/bin/pyflyby/_modules.py +13 -15
  6. {pyflyby-1.9.5/lib/python → pyflyby-1.9.6/bin}/pyflyby/_parse.py +11 -11
  7. {pyflyby-1.9.5/lib/python → pyflyby-1.9.6/bin}/pyflyby/_py.py +14 -3
  8. {pyflyby-1.9.5/lib/python → pyflyby-1.9.6/bin}/pyflyby/_version.py +1 -1
  9. {pyflyby-1.9.5 → pyflyby-1.9.6}/lib/python/pyflyby/_dbg.py +12 -11
  10. {pyflyby-1.9.5/bin → pyflyby-1.9.6/lib/python}/pyflyby/_importdb.py +1 -1
  11. {pyflyby-1.9.5 → pyflyby-1.9.6}/lib/python/pyflyby/_interactive.py +1 -1
  12. {pyflyby-1.9.5 → pyflyby-1.9.6}/lib/python/pyflyby/_modules.py +13 -15
  13. {pyflyby-1.9.5/bin → pyflyby-1.9.6/lib/python}/pyflyby/_parse.py +11 -11
  14. {pyflyby-1.9.5/bin → pyflyby-1.9.6/lib/python}/pyflyby/_py.py +14 -3
  15. {pyflyby-1.9.5/bin → pyflyby-1.9.6/lib/python}/pyflyby/_version.py +1 -1
  16. {pyflyby-1.9.5 → pyflyby-1.9.6/lib/python/pyflyby.egg-info}/PKG-INFO +1 -5
  17. {pyflyby-1.9.5 → pyflyby-1.9.6}/lib/python/pyflyby.egg-info/SOURCES.txt +0 -5
  18. {pyflyby-1.9.5 → pyflyby-1.9.6}/.pyflyby +0 -0
  19. {pyflyby-1.9.5 → pyflyby-1.9.6}/LICENSE.txt +0 -0
  20. {pyflyby-1.9.5 → pyflyby-1.9.6}/MANIFEST.in +0 -0
  21. {pyflyby-1.9.5 → pyflyby-1.9.6}/README.rst +0 -0
  22. {pyflyby-1.9.5 → pyflyby-1.9.6}/bin/autoipython +0 -0
  23. {pyflyby-1.9.5 → pyflyby-1.9.6}/bin/autopython +0 -0
  24. {pyflyby-1.9.5 → pyflyby-1.9.6}/bin/collect-exports +0 -0
  25. {pyflyby-1.9.5 → pyflyby-1.9.6}/bin/collect-imports +0 -0
  26. {pyflyby-1.9.5 → pyflyby-1.9.6}/bin/create-imports +0 -0
  27. {pyflyby-1.9.5 → pyflyby-1.9.6}/bin/find-import +0 -0
  28. {pyflyby-1.9.5 → pyflyby-1.9.6}/bin/list-bad-xrefs +0 -0
  29. {pyflyby-1.9.5 → pyflyby-1.9.6}/bin/prune-broken-imports +0 -0
  30. {pyflyby-1.9.5 → pyflyby-1.9.6}/bin/py +0 -0
  31. {pyflyby-1.9.5 → pyflyby-1.9.6}/bin/pyflyby/__init__.py +0 -0
  32. {pyflyby-1.9.5 → pyflyby-1.9.6}/bin/pyflyby/__main__.py +0 -0
  33. {pyflyby-1.9.5 → pyflyby-1.9.6}/bin/pyflyby/_autoimp.py +0 -0
  34. {pyflyby-1.9.5 → pyflyby-1.9.6}/bin/pyflyby/_cmdline.py +0 -0
  35. {pyflyby-1.9.5 → pyflyby-1.9.6}/bin/pyflyby/_comms.py +0 -0
  36. {pyflyby-1.9.5 → pyflyby-1.9.6}/bin/pyflyby/_docxref.py +0 -0
  37. {pyflyby-1.9.5 → pyflyby-1.9.6}/bin/pyflyby/_dynimp.py +0 -0
  38. {pyflyby-1.9.5 → pyflyby-1.9.6}/bin/pyflyby/_file.py +0 -0
  39. {pyflyby-1.9.5 → pyflyby-1.9.6}/bin/pyflyby/_flags.py +0 -0
  40. {pyflyby-1.9.5 → pyflyby-1.9.6}/bin/pyflyby/_format.py +0 -0
  41. {pyflyby-1.9.5 → pyflyby-1.9.6}/bin/pyflyby/_idents.py +0 -0
  42. {pyflyby-1.9.5 → pyflyby-1.9.6}/bin/pyflyby/_import_sorting.py +0 -0
  43. {pyflyby-1.9.5 → pyflyby-1.9.6}/bin/pyflyby/_importclns.py +0 -0
  44. {pyflyby-1.9.5 → pyflyby-1.9.6}/bin/pyflyby/_imports2s.py +0 -0
  45. {pyflyby-1.9.5 → pyflyby-1.9.6}/bin/pyflyby/_importstmt.py +0 -0
  46. {pyflyby-1.9.5 → pyflyby-1.9.6}/bin/pyflyby/_livepatch.py +0 -0
  47. {pyflyby-1.9.5 → pyflyby-1.9.6}/bin/pyflyby/_log.py +0 -0
  48. {pyflyby-1.9.5 → pyflyby-1.9.6}/bin/pyflyby/_util.py +0 -0
  49. {pyflyby-1.9.5 → pyflyby-1.9.6}/bin/pyflyby/autoimport.py +0 -0
  50. {pyflyby-1.9.5 → pyflyby-1.9.6}/bin/pyflyby/importdb.py +0 -0
  51. {pyflyby-1.9.5 → pyflyby-1.9.6}/bin/pyflyby-diff +0 -0
  52. {pyflyby-1.9.5 → pyflyby-1.9.6}/bin/reformat-imports +0 -0
  53. {pyflyby-1.9.5 → pyflyby-1.9.6}/bin/replace-star-imports +0 -0
  54. {pyflyby-1.9.5 → pyflyby-1.9.6}/bin/tidy-imports +0 -0
  55. {pyflyby-1.9.5 → pyflyby-1.9.6}/bin/transform-imports +0 -0
  56. {pyflyby-1.9.5 → pyflyby-1.9.6}/doc/LICENSE.txt +0 -0
  57. {pyflyby-1.9.5 → pyflyby-1.9.6}/doc/Makefile +0 -0
  58. {pyflyby-1.9.5 → pyflyby-1.9.6}/doc/TODO.txt +0 -0
  59. {pyflyby-1.9.5 → pyflyby-1.9.6}/doc/__init__.py +0 -0
  60. {pyflyby-1.9.5 → pyflyby-1.9.6}/doc/api/api.rst +0 -0
  61. {pyflyby-1.9.5 → pyflyby-1.9.6}/doc/api/autoimp.rst +0 -0
  62. {pyflyby-1.9.5 → pyflyby-1.9.6}/doc/api/cmdline.rst +0 -0
  63. {pyflyby-1.9.5 → pyflyby-1.9.6}/doc/api/comms.rst +0 -0
  64. {pyflyby-1.9.5 → pyflyby-1.9.6}/doc/api/dbg.rst +0 -0
  65. {pyflyby-1.9.5 → pyflyby-1.9.6}/doc/api/file.rst +0 -0
  66. {pyflyby-1.9.5 → pyflyby-1.9.6}/doc/api/flags.rst +0 -0
  67. {pyflyby-1.9.5 → pyflyby-1.9.6}/doc/api/format.rst +0 -0
  68. {pyflyby-1.9.5 → pyflyby-1.9.6}/doc/api/idents.rst +0 -0
  69. {pyflyby-1.9.5 → pyflyby-1.9.6}/doc/api/importclns.rst +0 -0
  70. {pyflyby-1.9.5 → pyflyby-1.9.6}/doc/api/importdb.rst +0 -0
  71. {pyflyby-1.9.5 → pyflyby-1.9.6}/doc/api/imports2s.rst +0 -0
  72. {pyflyby-1.9.5 → pyflyby-1.9.6}/doc/api/importstmt.rst +0 -0
  73. {pyflyby-1.9.5 → pyflyby-1.9.6}/doc/api/interactive.rst +0 -0
  74. {pyflyby-1.9.5 → pyflyby-1.9.6}/doc/api/livepatch.rst +0 -0
  75. {pyflyby-1.9.5 → pyflyby-1.9.6}/doc/api/log.rst +0 -0
  76. {pyflyby-1.9.5 → pyflyby-1.9.6}/doc/api/modules.rst +0 -0
  77. {pyflyby-1.9.5 → pyflyby-1.9.6}/doc/api/parse.rst +0 -0
  78. {pyflyby-1.9.5 → pyflyby-1.9.6}/doc/api/py.rst +0 -0
  79. {pyflyby-1.9.5 → pyflyby-1.9.6}/doc/api/util.rst +0 -0
  80. {pyflyby-1.9.5 → pyflyby-1.9.6}/doc/cli/autoipython.rst +0 -0
  81. {pyflyby-1.9.5 → pyflyby-1.9.6}/doc/cli/cli.rst +0 -0
  82. {pyflyby-1.9.5 → pyflyby-1.9.6}/doc/cli/collect_exports.rst +0 -0
  83. {pyflyby-1.9.5 → pyflyby-1.9.6}/doc/cli/collect_imports.rst +0 -0
  84. {pyflyby-1.9.5 → pyflyby-1.9.6}/doc/cli/find_import.rst +0 -0
  85. {pyflyby-1.9.5 → pyflyby-1.9.6}/doc/cli/prune_broken_imports.rst +0 -0
  86. {pyflyby-1.9.5 → pyflyby-1.9.6}/doc/cli/py.rst +0 -0
  87. {pyflyby-1.9.5 → pyflyby-1.9.6}/doc/cli/pyflyby_diff.rst +0 -0
  88. {pyflyby-1.9.5 → pyflyby-1.9.6}/doc/cli/reformat_imports.rst +0 -0
  89. {pyflyby-1.9.5 → pyflyby-1.9.6}/doc/cli/replace_star_imports.rst +0 -0
  90. {pyflyby-1.9.5 → pyflyby-1.9.6}/doc/cli/tidy_imports.rst +0 -0
  91. {pyflyby-1.9.5 → pyflyby-1.9.6}/doc/cli/transform_imports.rst +0 -0
  92. {pyflyby-1.9.5 → pyflyby-1.9.6}/doc/conf.py +0 -0
  93. {pyflyby-1.9.5 → pyflyby-1.9.6}/doc/index.rst +0 -0
  94. {pyflyby-1.9.5 → pyflyby-1.9.6}/doc/make.bat +0 -0
  95. {pyflyby-1.9.5 → pyflyby-1.9.6}/doc/testing.txt +0 -0
  96. {pyflyby-1.9.5 → pyflyby-1.9.6}/etc/pyflyby/canonical.py +0 -0
  97. {pyflyby-1.9.5 → pyflyby-1.9.6}/etc/pyflyby/common.py +0 -0
  98. {pyflyby-1.9.5 → pyflyby-1.9.6}/etc/pyflyby/forget.py +0 -0
  99. {pyflyby-1.9.5 → pyflyby-1.9.6}/etc/pyflyby/mandatory.py +0 -0
  100. {pyflyby-1.9.5 → pyflyby-1.9.6}/etc/pyflyby/numpy.py +0 -0
  101. {pyflyby-1.9.5 → pyflyby-1.9.6}/etc/pyflyby/std.py +0 -0
  102. {pyflyby-1.9.5 → pyflyby-1.9.6}/lib/emacs/pyflyby.el +0 -0
  103. {pyflyby-1.9.5 → pyflyby-1.9.6}/lib/python/pyflyby/__init__.py +0 -0
  104. {pyflyby-1.9.5 → pyflyby-1.9.6}/lib/python/pyflyby/__main__.py +0 -0
  105. {pyflyby-1.9.5 → pyflyby-1.9.6}/lib/python/pyflyby/_autoimp.py +0 -0
  106. {pyflyby-1.9.5 → pyflyby-1.9.6}/lib/python/pyflyby/_cmdline.py +0 -0
  107. {pyflyby-1.9.5 → pyflyby-1.9.6}/lib/python/pyflyby/_comms.py +0 -0
  108. {pyflyby-1.9.5 → pyflyby-1.9.6}/lib/python/pyflyby/_docxref.py +0 -0
  109. {pyflyby-1.9.5 → pyflyby-1.9.6}/lib/python/pyflyby/_dynimp.py +0 -0
  110. {pyflyby-1.9.5 → pyflyby-1.9.6}/lib/python/pyflyby/_file.py +0 -0
  111. {pyflyby-1.9.5 → pyflyby-1.9.6}/lib/python/pyflyby/_flags.py +0 -0
  112. {pyflyby-1.9.5 → pyflyby-1.9.6}/lib/python/pyflyby/_format.py +0 -0
  113. {pyflyby-1.9.5 → pyflyby-1.9.6}/lib/python/pyflyby/_idents.py +0 -0
  114. {pyflyby-1.9.5 → pyflyby-1.9.6}/lib/python/pyflyby/_import_sorting.py +0 -0
  115. {pyflyby-1.9.5 → pyflyby-1.9.6}/lib/python/pyflyby/_importclns.py +0 -0
  116. {pyflyby-1.9.5 → pyflyby-1.9.6}/lib/python/pyflyby/_imports2s.py +0 -0
  117. {pyflyby-1.9.5 → pyflyby-1.9.6}/lib/python/pyflyby/_importstmt.py +0 -0
  118. {pyflyby-1.9.5 → pyflyby-1.9.6}/lib/python/pyflyby/_livepatch.py +0 -0
  119. {pyflyby-1.9.5 → pyflyby-1.9.6}/lib/python/pyflyby/_log.py +0 -0
  120. {pyflyby-1.9.5 → pyflyby-1.9.6}/lib/python/pyflyby/_util.py +0 -0
  121. {pyflyby-1.9.5 → pyflyby-1.9.6}/lib/python/pyflyby/autoimport.py +0 -0
  122. {pyflyby-1.9.5 → pyflyby-1.9.6}/lib/python/pyflyby/importdb.py +0 -0
  123. {pyflyby-1.9.5 → pyflyby-1.9.6}/lib/python/pyflyby.egg-info/dependency_links.txt +0 -0
  124. {pyflyby-1.9.5 → pyflyby-1.9.6}/lib/python/pyflyby.egg-info/entry_points.txt +0 -0
  125. {pyflyby-1.9.5 → pyflyby-1.9.6}/lib/python/pyflyby.egg-info/requires.txt +0 -0
  126. {pyflyby-1.9.5 → pyflyby-1.9.6}/lib/python/pyflyby.egg-info/top_level.txt +0 -0
  127. {pyflyby-1.9.5 → pyflyby-1.9.6}/libexec/pyflyby/colordiff +0 -0
  128. {pyflyby-1.9.5 → pyflyby-1.9.6}/libexec/pyflyby/diff-colorize +0 -0
  129. {pyflyby-1.9.5 → pyflyby-1.9.6}/pyproject.toml +0 -0
  130. {pyflyby-1.9.5 → pyflyby-1.9.6}/setup.cfg +0 -0
  131. {pyflyby-1.9.5 → pyflyby-1.9.6}/setup.py +0 -0
  132. {pyflyby-1.9.5 → pyflyby-1.9.6}/tests/__init__.py +0 -0
  133. {pyflyby-1.9.5 → pyflyby-1.9.6}/tests/test_0testconfig.py +0 -0
  134. {pyflyby-1.9.5 → pyflyby-1.9.6}/tests/test_autoimp.py +0 -0
  135. {pyflyby-1.9.5 → pyflyby-1.9.6}/tests/test_cmdline.py +0 -0
  136. {pyflyby-1.9.5 → pyflyby-1.9.6}/tests/test_docxref.py +0 -0
  137. {pyflyby-1.9.5 → pyflyby-1.9.6}/tests/test_file.py +0 -0
  138. {pyflyby-1.9.5 → pyflyby-1.9.6}/tests/test_flags.py +0 -0
  139. {pyflyby-1.9.5 → pyflyby-1.9.6}/tests/test_format.py +0 -0
  140. {pyflyby-1.9.5 → pyflyby-1.9.6}/tests/test_idents.py +0 -0
  141. {pyflyby-1.9.5 → pyflyby-1.9.6}/tests/test_importclns.py +0 -0
  142. {pyflyby-1.9.5 → pyflyby-1.9.6}/tests/test_importdb.py +0 -0
  143. {pyflyby-1.9.5 → pyflyby-1.9.6}/tests/test_imports2s.py +0 -0
  144. {pyflyby-1.9.5 → pyflyby-1.9.6}/tests/test_importstmt.py +0 -0
  145. {pyflyby-1.9.5 → pyflyby-1.9.6}/tests/test_interactive.py +0 -0
  146. {pyflyby-1.9.5 → pyflyby-1.9.6}/tests/test_jupyterlab_pyflyby.py +0 -0
  147. {pyflyby-1.9.5 → pyflyby-1.9.6}/tests/test_livepatch.py +0 -0
  148. {pyflyby-1.9.5 → pyflyby-1.9.6}/tests/test_modules.py +0 -0
  149. {pyflyby-1.9.5 → pyflyby-1.9.6}/tests/test_parse.py +0 -0
  150. {pyflyby-1.9.5 → pyflyby-1.9.6}/tests/test_py.py +0 -0
  151. {pyflyby-1.9.5 → pyflyby-1.9.6}/tests/test_util.py +0 -0
  152. {pyflyby-1.9.5 → pyflyby-1.9.6}/tests/tests_sorts.py +0 -0
  153. {pyflyby-1.9.5 → pyflyby-1.9.6}/tests/xrefs.py +0 -0
  154. {pyflyby-1.9.5 → pyflyby-1.9.6}/tox.ini +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyflyby
3
- Version: 1.9.5
3
+ Version: 1.9.6
4
4
  Summary: pyflyby - Python development productivity tools, in particular automatic import management
5
5
  Home-page: https://pypi.org/project/pyflyby/
6
6
  Author: Karl Chen
@@ -18,10 +18,6 @@ Classifier: License :: OSI Approved :: MIT License
18
18
  Classifier: Programming Language :: Python
19
19
  Requires-Python: >3.8, <4
20
20
  License-File: LICENSE.txt
21
- Requires-Dist: six
22
- Requires-Dist: toml
23
- Requires-Dist: black
24
- Requires-Dist: typing_extensions>=4.6; python_version < "3.12"
25
21
 
26
22
  #########
27
23
  Pyflyby
@@ -909,23 +909,24 @@ def enable_faulthandler():
909
909
  faulthandler.enable()
910
910
 
911
911
 
912
- def add_debug_functions_to_builtins():
913
- '''
912
+ def add_debug_functions_to_builtins(*, add_deprecated: bool):
913
+ """
914
914
  Install debugger(), etc. in the builtin global namespace.
915
- '''
915
+ """
916
916
  functions_to_add = [
917
917
  'debugger',
918
918
  'debug_on_exception',
919
919
  'print_traceback',
920
920
  ]
921
- # DEPRECATED: In the future, the following will not be added to builtins.
922
- # Use debugger() instead.
923
- functions_to_add += [
924
- 'breakpoint',
925
- 'debug_exception',
926
- 'debug_statement',
927
- 'waitpoint',
928
- ]
921
+ if add_deprecated:
922
+ # DEPRECATED: In the future, the following will not be added to builtins.
923
+ # Use debugger() instead.
924
+ functions_to_add += [
925
+ "breakpoint",
926
+ "debug_exception",
927
+ "debug_statement",
928
+ "waitpoint",
929
+ ]
929
930
  for name in functions_to_add:
930
931
  setattr(builtins, name, globals()[name])
931
932
 
@@ -28,7 +28,7 @@ if sys.version_info <= (3, 12):
28
28
  else:
29
29
  from typing import Self
30
30
 
31
- SUPPORT_DEPRECATED_BEHAVIOR = True
31
+ SUPPORT_DEPRECATED_BEHAVIOR = False
32
32
 
33
33
  @memoize
34
34
  def _find_etc_dirs():
@@ -2459,7 +2459,7 @@ def load_ipython_extension(arg=Ellipsis):
2459
2459
  enable_faulthandler()
2460
2460
  enable_signal_handler_debugger()
2461
2461
  enable_sigterm_handler(on_existing_handler='keep_existing')
2462
- add_debug_functions_to_builtins()
2462
+ add_debug_functions_to_builtins(add_deprecated=False)
2463
2463
  inject_dynamic_import()
2464
2464
  initialize_comms()
2465
2465
 
@@ -2,20 +2,18 @@
2
2
  # Copyright (C) 2011, 2012, 2013, 2014, 2015 Karl Chen.
3
3
  # License: MIT http://opensource.org/licenses/MIT
4
4
 
5
-
6
-
5
+ from __future__ import print_function
7
6
 
8
7
  import ast
9
- from functools import total_ordering
8
+ from functools import cached_property, total_ordering
10
9
  import itertools
11
10
  import os
12
11
 
13
12
  from pyflyby._file import FileText, Filename
14
13
  from pyflyby._idents import DottedIdentifier, is_identifier
15
14
  from pyflyby._log import logger
16
- from pyflyby._util import (ExcludeImplicitCwdFromPathCtx,
17
- cached_attribute, cmp, memoize,
18
- prefixes)
15
+ from pyflyby._util import (ExcludeImplicitCwdFromPathCtx, cmp,
16
+ memoize, prefixes)
19
17
 
20
18
  import re
21
19
  from six import reraise
@@ -167,17 +165,17 @@ class ModuleHandle(object):
167
165
  raise NotImplementedError(
168
166
  "TODO: look at sys.path to guess module name")
169
167
 
170
- @cached_attribute
168
+ @cached_property
171
169
  def parent(self):
172
170
  if not self.name.parent:
173
171
  return None
174
172
  return ModuleHandle(self.name.parent)
175
173
 
176
- @cached_attribute
174
+ @cached_property
177
175
  def ancestors(self):
178
176
  return tuple(ModuleHandle(m) for m in self.name.prefixes)
179
177
 
180
- @cached_attribute
178
+ @cached_property
181
179
  def module(self):
182
180
  """
183
181
  Return the module instance.
@@ -196,7 +194,7 @@ class ModuleHandle(object):
196
194
  # Import.
197
195
  return import_module(self.name)
198
196
 
199
- @cached_attribute
197
+ @cached_property
200
198
  def exists(self):
201
199
  """
202
200
  Return whether the module exists, according to pkgutil.
@@ -221,7 +219,7 @@ class ModuleHandle(object):
221
219
  pkg = None
222
220
  return pkg is not None
223
221
 
224
- @cached_attribute
222
+ @cached_property
225
223
  def filename(self):
226
224
  """
227
225
  Return the filename, if appropriate.
@@ -268,14 +266,14 @@ class ModuleHandle(object):
268
266
  return None
269
267
  return Filename(pyc_to_py(filename))
270
268
 
271
- @cached_attribute
269
+ @cached_property
272
270
  def text(self):
273
271
  return FileText(self.filename)
274
272
 
275
273
  def __text__(self):
276
274
  return self.text
277
275
 
278
- @cached_attribute
276
+ @cached_property
279
277
  def block(self):
280
278
  from pyflyby._parse import PythonBlock
281
279
  return PythonBlock(self.text)
@@ -309,7 +307,7 @@ class ModuleHandle(object):
309
307
  # Canonicalize.
310
308
  return tuple(ModuleHandle(m) for m in sorted(set(module_names)))
311
309
 
312
- @cached_attribute
310
+ @cached_property
313
311
  def submodules(self):
314
312
  """
315
313
  Enumerate the importable submodules of this module.
@@ -349,7 +347,7 @@ class ModuleHandle(object):
349
347
  return extractors[type(node)](node)
350
348
  return []
351
349
 
352
- @cached_attribute
350
+ @cached_property
353
351
  def exports(self):
354
352
  """
355
353
  Get symbols exported by this module.
@@ -8,13 +8,13 @@ from ast import AsyncFunctionDef, TypeIgnore
8
8
 
9
9
  from collections import namedtuple
10
10
  from doctest import DocTestParser
11
- from functools import total_ordering
11
+ from functools import cached_property, total_ordering
12
12
  from itertools import groupby
13
13
 
14
14
  from pyflyby._file import FilePos, FileText, Filename
15
15
  from pyflyby._flags import CompilerFlags
16
16
  from pyflyby._log import logger
17
- from pyflyby._util import cached_attribute, cmp
17
+ from pyflyby._util import cmp
18
18
 
19
19
  import re
20
20
  import sys
@@ -1044,7 +1044,7 @@ class PythonBlock:
1044
1044
  def endpos(self):
1045
1045
  return self.text.endpos
1046
1046
 
1047
- @cached_attribute
1047
+ @cached_property
1048
1048
  def _ast_node_or_parse_exception(self):
1049
1049
  """
1050
1050
  Attempt to parse this block of code into an abstract syntax tree.
@@ -1069,7 +1069,7 @@ class PythonBlock:
1069
1069
  # Cache the exception to avoid re-attempting while debugging.
1070
1070
  return e
1071
1071
 
1072
- @cached_attribute
1072
+ @cached_property
1073
1073
  def parsable(self):
1074
1074
  """
1075
1075
  Whether the contents of this ``PythonBlock`` are parsable as Python
@@ -1080,7 +1080,7 @@ class PythonBlock:
1080
1080
  """
1081
1081
  return isinstance(self._ast_node_or_parse_exception, ast.AST)
1082
1082
 
1083
- @cached_attribute
1083
+ @cached_property
1084
1084
  def parsable_as_expression(self):
1085
1085
  """
1086
1086
  Whether the contents of this ``PythonBlock`` are parsable as a single
@@ -1091,7 +1091,7 @@ class PythonBlock:
1091
1091
  """
1092
1092
  return self.parsable and self.expression_ast_node is not None
1093
1093
 
1094
- @cached_attribute
1094
+ @cached_property
1095
1095
  def ast_node(self):
1096
1096
  """
1097
1097
  Parse this block of code into an abstract syntax tree.
@@ -1112,7 +1112,7 @@ class PythonBlock:
1112
1112
  else:
1113
1113
  raise r
1114
1114
 
1115
- @cached_attribute
1115
+ @cached_property
1116
1116
  def annotated_ast_node(self) -> AnnotatedAst:
1117
1117
  """
1118
1118
  Return ``self.ast_node``, annotated in place with positions.
@@ -1127,7 +1127,7 @@ class PythonBlock:
1127
1127
  # ! result is mutated and returned
1128
1128
  return _annotate_ast_nodes(result)
1129
1129
 
1130
- @cached_attribute
1130
+ @cached_property
1131
1131
  def expression_ast_node(self) -> Optional[ast.Expression]:
1132
1132
  """
1133
1133
  Return an ``ast.Expression`` if ``self.ast_node`` can be converted into
@@ -1188,7 +1188,7 @@ class PythonBlock:
1188
1188
  filename = str(self.filename or "<unknown>")
1189
1189
  return compile(ast_node, filename, mode)
1190
1190
 
1191
- @cached_attribute
1191
+ @cached_property
1192
1192
  def statements(self) -> Tuple[PythonStatement, ...]:
1193
1193
  r"""
1194
1194
  Partition of this ``PythonBlock`` into individual ``PythonStatement`` s.
@@ -1245,7 +1245,7 @@ class PythonBlock:
1245
1245
  statements.append(statement)
1246
1246
  return tuple(statements)
1247
1247
 
1248
- @cached_attribute
1248
+ @cached_property
1249
1249
  def source_flags(self):
1250
1250
  """
1251
1251
  If the AST contains __future__ imports, then the compiler_flags
@@ -1261,7 +1261,7 @@ class PythonBlock:
1261
1261
  """
1262
1262
  return self.ast_node.source_flags
1263
1263
 
1264
- @cached_attribute
1264
+ @cached_property
1265
1265
  def flags(self):
1266
1266
  """
1267
1267
  The compiler flags for this code block, including both the input flags
@@ -30,6 +30,12 @@ Invocation summary
30
30
  py nb Start IPython Notebook with autoimporter
31
31
 
32
32
 
33
+ py [--add-deprecated-builtins] Inject "breakpoint", "debug_exception",
34
+ "debug_statement", "waitpoint" into
35
+ builtins. This is deprecated, and
36
+ present for backward compatibilty
37
+ but will be removed in the future.
38
+
33
39
  Features
34
40
  ========
35
41
 
@@ -1688,6 +1694,7 @@ class _PyMain(object):
1688
1694
 
1689
1695
  def _parse_global_opts(self):
1690
1696
  args = list(self.main_args)
1697
+ self.add_deprecated_builtins = False
1691
1698
  self.debug = False
1692
1699
  self.interactive = False
1693
1700
  self.verbosity = 1
@@ -1791,6 +1798,10 @@ class _PyMain(object):
1791
1798
  novalue()
1792
1799
  postmortem = False
1793
1800
  continue
1801
+ if argname in ["add-deprecated-builtins", "add_deprecated_builtins"]:
1802
+ del args[0]
1803
+ self.add_deprecated_builtins = True
1804
+ continue
1794
1805
  break
1795
1806
  self.args = args
1796
1807
  if postmortem == "auto":
@@ -1798,18 +1809,18 @@ class _PyMain(object):
1798
1809
  global _enable_postmortem_debugger
1799
1810
  _enable_postmortem_debugger = postmortem
1800
1811
 
1801
- def _enable_debug_tools(self):
1812
+ def _enable_debug_tools(self, *, add_deprecated: bool):
1802
1813
  # Enable a bunch of debugging tools.
1803
1814
  enable_faulthandler()
1804
1815
  enable_signal_handler_debugger()
1805
1816
  enable_sigterm_handler()
1806
- add_debug_functions_to_builtins()
1817
+ add_debug_functions_to_builtins(add_deprecated=add_deprecated)
1807
1818
 
1808
1819
  def run(self):
1809
1820
  # Parse global options.
1810
1821
  sys.orig_argv = list(sys.argv)
1811
1822
  self._parse_global_opts()
1812
- self._enable_debug_tools()
1823
+ self._enable_debug_tools(add_deprecated=self.add_deprecated_builtins)
1813
1824
  self._run_action()
1814
1825
  self._pre_exit()
1815
1826
 
@@ -4,4 +4,4 @@
4
4
  # http://creativecommons.org/publicdomain/zero/1.0/
5
5
 
6
6
 
7
- __version__ = "1.9.5"
7
+ __version__ = "1.9.6"
@@ -909,23 +909,24 @@ def enable_faulthandler():
909
909
  faulthandler.enable()
910
910
 
911
911
 
912
- def add_debug_functions_to_builtins():
913
- '''
912
+ def add_debug_functions_to_builtins(*, add_deprecated: bool):
913
+ """
914
914
  Install debugger(), etc. in the builtin global namespace.
915
- '''
915
+ """
916
916
  functions_to_add = [
917
917
  'debugger',
918
918
  'debug_on_exception',
919
919
  'print_traceback',
920
920
  ]
921
- # DEPRECATED: In the future, the following will not be added to builtins.
922
- # Use debugger() instead.
923
- functions_to_add += [
924
- 'breakpoint',
925
- 'debug_exception',
926
- 'debug_statement',
927
- 'waitpoint',
928
- ]
921
+ if add_deprecated:
922
+ # DEPRECATED: In the future, the following will not be added to builtins.
923
+ # Use debugger() instead.
924
+ functions_to_add += [
925
+ "breakpoint",
926
+ "debug_exception",
927
+ "debug_statement",
928
+ "waitpoint",
929
+ ]
929
930
  for name in functions_to_add:
930
931
  setattr(builtins, name, globals()[name])
931
932
 
@@ -28,7 +28,7 @@ if sys.version_info <= (3, 12):
28
28
  else:
29
29
  from typing import Self
30
30
 
31
- SUPPORT_DEPRECATED_BEHAVIOR = True
31
+ SUPPORT_DEPRECATED_BEHAVIOR = False
32
32
 
33
33
  @memoize
34
34
  def _find_etc_dirs():
@@ -2459,7 +2459,7 @@ def load_ipython_extension(arg=Ellipsis):
2459
2459
  enable_faulthandler()
2460
2460
  enable_signal_handler_debugger()
2461
2461
  enable_sigterm_handler(on_existing_handler='keep_existing')
2462
- add_debug_functions_to_builtins()
2462
+ add_debug_functions_to_builtins(add_deprecated=False)
2463
2463
  inject_dynamic_import()
2464
2464
  initialize_comms()
2465
2465
 
@@ -2,20 +2,18 @@
2
2
  # Copyright (C) 2011, 2012, 2013, 2014, 2015 Karl Chen.
3
3
  # License: MIT http://opensource.org/licenses/MIT
4
4
 
5
-
6
-
5
+ from __future__ import print_function
7
6
 
8
7
  import ast
9
- from functools import total_ordering
8
+ from functools import cached_property, total_ordering
10
9
  import itertools
11
10
  import os
12
11
 
13
12
  from pyflyby._file import FileText, Filename
14
13
  from pyflyby._idents import DottedIdentifier, is_identifier
15
14
  from pyflyby._log import logger
16
- from pyflyby._util import (ExcludeImplicitCwdFromPathCtx,
17
- cached_attribute, cmp, memoize,
18
- prefixes)
15
+ from pyflyby._util import (ExcludeImplicitCwdFromPathCtx, cmp,
16
+ memoize, prefixes)
19
17
 
20
18
  import re
21
19
  from six import reraise
@@ -167,17 +165,17 @@ class ModuleHandle(object):
167
165
  raise NotImplementedError(
168
166
  "TODO: look at sys.path to guess module name")
169
167
 
170
- @cached_attribute
168
+ @cached_property
171
169
  def parent(self):
172
170
  if not self.name.parent:
173
171
  return None
174
172
  return ModuleHandle(self.name.parent)
175
173
 
176
- @cached_attribute
174
+ @cached_property
177
175
  def ancestors(self):
178
176
  return tuple(ModuleHandle(m) for m in self.name.prefixes)
179
177
 
180
- @cached_attribute
178
+ @cached_property
181
179
  def module(self):
182
180
  """
183
181
  Return the module instance.
@@ -196,7 +194,7 @@ class ModuleHandle(object):
196
194
  # Import.
197
195
  return import_module(self.name)
198
196
 
199
- @cached_attribute
197
+ @cached_property
200
198
  def exists(self):
201
199
  """
202
200
  Return whether the module exists, according to pkgutil.
@@ -221,7 +219,7 @@ class ModuleHandle(object):
221
219
  pkg = None
222
220
  return pkg is not None
223
221
 
224
- @cached_attribute
222
+ @cached_property
225
223
  def filename(self):
226
224
  """
227
225
  Return the filename, if appropriate.
@@ -268,14 +266,14 @@ class ModuleHandle(object):
268
266
  return None
269
267
  return Filename(pyc_to_py(filename))
270
268
 
271
- @cached_attribute
269
+ @cached_property
272
270
  def text(self):
273
271
  return FileText(self.filename)
274
272
 
275
273
  def __text__(self):
276
274
  return self.text
277
275
 
278
- @cached_attribute
276
+ @cached_property
279
277
  def block(self):
280
278
  from pyflyby._parse import PythonBlock
281
279
  return PythonBlock(self.text)
@@ -309,7 +307,7 @@ class ModuleHandle(object):
309
307
  # Canonicalize.
310
308
  return tuple(ModuleHandle(m) for m in sorted(set(module_names)))
311
309
 
312
- @cached_attribute
310
+ @cached_property
313
311
  def submodules(self):
314
312
  """
315
313
  Enumerate the importable submodules of this module.
@@ -349,7 +347,7 @@ class ModuleHandle(object):
349
347
  return extractors[type(node)](node)
350
348
  return []
351
349
 
352
- @cached_attribute
350
+ @cached_property
353
351
  def exports(self):
354
352
  """
355
353
  Get symbols exported by this module.
@@ -8,13 +8,13 @@ from ast import AsyncFunctionDef, TypeIgnore
8
8
 
9
9
  from collections import namedtuple
10
10
  from doctest import DocTestParser
11
- from functools import total_ordering
11
+ from functools import cached_property, total_ordering
12
12
  from itertools import groupby
13
13
 
14
14
  from pyflyby._file import FilePos, FileText, Filename
15
15
  from pyflyby._flags import CompilerFlags
16
16
  from pyflyby._log import logger
17
- from pyflyby._util import cached_attribute, cmp
17
+ from pyflyby._util import cmp
18
18
 
19
19
  import re
20
20
  import sys
@@ -1044,7 +1044,7 @@ class PythonBlock:
1044
1044
  def endpos(self):
1045
1045
  return self.text.endpos
1046
1046
 
1047
- @cached_attribute
1047
+ @cached_property
1048
1048
  def _ast_node_or_parse_exception(self):
1049
1049
  """
1050
1050
  Attempt to parse this block of code into an abstract syntax tree.
@@ -1069,7 +1069,7 @@ class PythonBlock:
1069
1069
  # Cache the exception to avoid re-attempting while debugging.
1070
1070
  return e
1071
1071
 
1072
- @cached_attribute
1072
+ @cached_property
1073
1073
  def parsable(self):
1074
1074
  """
1075
1075
  Whether the contents of this ``PythonBlock`` are parsable as Python
@@ -1080,7 +1080,7 @@ class PythonBlock:
1080
1080
  """
1081
1081
  return isinstance(self._ast_node_or_parse_exception, ast.AST)
1082
1082
 
1083
- @cached_attribute
1083
+ @cached_property
1084
1084
  def parsable_as_expression(self):
1085
1085
  """
1086
1086
  Whether the contents of this ``PythonBlock`` are parsable as a single
@@ -1091,7 +1091,7 @@ class PythonBlock:
1091
1091
  """
1092
1092
  return self.parsable and self.expression_ast_node is not None
1093
1093
 
1094
- @cached_attribute
1094
+ @cached_property
1095
1095
  def ast_node(self):
1096
1096
  """
1097
1097
  Parse this block of code into an abstract syntax tree.
@@ -1112,7 +1112,7 @@ class PythonBlock:
1112
1112
  else:
1113
1113
  raise r
1114
1114
 
1115
- @cached_attribute
1115
+ @cached_property
1116
1116
  def annotated_ast_node(self) -> AnnotatedAst:
1117
1117
  """
1118
1118
  Return ``self.ast_node``, annotated in place with positions.
@@ -1127,7 +1127,7 @@ class PythonBlock:
1127
1127
  # ! result is mutated and returned
1128
1128
  return _annotate_ast_nodes(result)
1129
1129
 
1130
- @cached_attribute
1130
+ @cached_property
1131
1131
  def expression_ast_node(self) -> Optional[ast.Expression]:
1132
1132
  """
1133
1133
  Return an ``ast.Expression`` if ``self.ast_node`` can be converted into
@@ -1188,7 +1188,7 @@ class PythonBlock:
1188
1188
  filename = str(self.filename or "<unknown>")
1189
1189
  return compile(ast_node, filename, mode)
1190
1190
 
1191
- @cached_attribute
1191
+ @cached_property
1192
1192
  def statements(self) -> Tuple[PythonStatement, ...]:
1193
1193
  r"""
1194
1194
  Partition of this ``PythonBlock`` into individual ``PythonStatement`` s.
@@ -1245,7 +1245,7 @@ class PythonBlock:
1245
1245
  statements.append(statement)
1246
1246
  return tuple(statements)
1247
1247
 
1248
- @cached_attribute
1248
+ @cached_property
1249
1249
  def source_flags(self):
1250
1250
  """
1251
1251
  If the AST contains __future__ imports, then the compiler_flags
@@ -1261,7 +1261,7 @@ class PythonBlock:
1261
1261
  """
1262
1262
  return self.ast_node.source_flags
1263
1263
 
1264
- @cached_attribute
1264
+ @cached_property
1265
1265
  def flags(self):
1266
1266
  """
1267
1267
  The compiler flags for this code block, including both the input flags
@@ -30,6 +30,12 @@ Invocation summary
30
30
  py nb Start IPython Notebook with autoimporter
31
31
 
32
32
 
33
+ py [--add-deprecated-builtins] Inject "breakpoint", "debug_exception",
34
+ "debug_statement", "waitpoint" into
35
+ builtins. This is deprecated, and
36
+ present for backward compatibilty
37
+ but will be removed in the future.
38
+
33
39
  Features
34
40
  ========
35
41
 
@@ -1688,6 +1694,7 @@ class _PyMain(object):
1688
1694
 
1689
1695
  def _parse_global_opts(self):
1690
1696
  args = list(self.main_args)
1697
+ self.add_deprecated_builtins = False
1691
1698
  self.debug = False
1692
1699
  self.interactive = False
1693
1700
  self.verbosity = 1
@@ -1791,6 +1798,10 @@ class _PyMain(object):
1791
1798
  novalue()
1792
1799
  postmortem = False
1793
1800
  continue
1801
+ if argname in ["add-deprecated-builtins", "add_deprecated_builtins"]:
1802
+ del args[0]
1803
+ self.add_deprecated_builtins = True
1804
+ continue
1794
1805
  break
1795
1806
  self.args = args
1796
1807
  if postmortem == "auto":
@@ -1798,18 +1809,18 @@ class _PyMain(object):
1798
1809
  global _enable_postmortem_debugger
1799
1810
  _enable_postmortem_debugger = postmortem
1800
1811
 
1801
- def _enable_debug_tools(self):
1812
+ def _enable_debug_tools(self, *, add_deprecated: bool):
1802
1813
  # Enable a bunch of debugging tools.
1803
1814
  enable_faulthandler()
1804
1815
  enable_signal_handler_debugger()
1805
1816
  enable_sigterm_handler()
1806
- add_debug_functions_to_builtins()
1817
+ add_debug_functions_to_builtins(add_deprecated=add_deprecated)
1807
1818
 
1808
1819
  def run(self):
1809
1820
  # Parse global options.
1810
1821
  sys.orig_argv = list(sys.argv)
1811
1822
  self._parse_global_opts()
1812
- self._enable_debug_tools()
1823
+ self._enable_debug_tools(add_deprecated=self.add_deprecated_builtins)
1813
1824
  self._run_action()
1814
1825
  self._pre_exit()
1815
1826
 
@@ -4,4 +4,4 @@
4
4
  # http://creativecommons.org/publicdomain/zero/1.0/
5
5
 
6
6
 
7
- __version__ = "1.9.5"
7
+ __version__ = "1.9.6"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyflyby
3
- Version: 1.9.5
3
+ Version: 1.9.6
4
4
  Summary: pyflyby - Python development productivity tools, in particular automatic import management
5
5
  Home-page: https://pypi.org/project/pyflyby/
6
6
  Author: Karl Chen
@@ -18,10 +18,6 @@ Classifier: License :: OSI Approved :: MIT License
18
18
  Classifier: Programming Language :: Python
19
19
  Requires-Python: >3.8, <4
20
20
  License-File: LICENSE.txt
21
- Requires-Dist: six
22
- Requires-Dist: toml
23
- Requires-Dist: black
24
- Requires-Dist: typing_extensions>=4.6; python_version < "3.12"
25
21
 
26
22
  #########
27
23
  Pyflyby
@@ -19,7 +19,6 @@ bin/reformat-imports
19
19
  bin/replace-star-imports
20
20
  bin/tidy-imports
21
21
  bin/transform-imports
22
- bin/pyflyby/.DS_Store
23
22
  bin/pyflyby/__init__.py
24
23
  bin/pyflyby/__main__.py
25
24
  bin/pyflyby/_autoimp.py
@@ -47,7 +46,6 @@ bin/pyflyby/_util.py
47
46
  bin/pyflyby/_version.py
48
47
  bin/pyflyby/autoimport.py
49
48
  bin/pyflyby/importdb.py
50
- doc/.DS_Store
51
49
  doc/LICENSE.txt
52
50
  doc/Makefile
53
51
  doc/TODO.txt
@@ -94,10 +92,7 @@ etc/pyflyby/forget.py
94
92
  etc/pyflyby/mandatory.py
95
93
  etc/pyflyby/numpy.py
96
94
  etc/pyflyby/std.py
97
- lib/.DS_Store
98
95
  lib/emacs/pyflyby.el
99
- lib/python/.DS_Store
100
- lib/python/pyflyby/.DS_Store
101
96
  lib/python/pyflyby/__init__.py
102
97
  lib/python/pyflyby/__main__.py
103
98
  lib/python/pyflyby/_autoimp.py
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes