symbex 1.4__py3-none-any.whl → 2.0__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.
symbex/cli.py CHANGED
@@ -396,7 +396,7 @@ def cli(
396
396
  for directory in directories:
397
397
  for path in pathlib.Path(directory).rglob("*.py"):
398
398
  # Skip if path is inside any of 'excludes'
399
- if any(is_subpath(path, exclude) for exclude in excludes):
399
+ if any(path.resolve().is_relative_to(exclude) for exclude in excludes):
400
400
  continue
401
401
  if path.is_file():
402
402
  yield path
@@ -538,11 +538,13 @@ def cli(
538
538
  )
539
539
 
540
540
  if sum(output_formats) == 0:
541
+ seen_imports = set()
541
542
  for item in stuff_to_output():
542
543
  if item.output_identifier_line:
543
544
  click.echo(item.output_identifier_line)
544
- if item.output_import_line:
545
+ if item.output_import_line and item.output_import_line not in seen_imports:
545
546
  click.echo(item.output_import_line)
547
+ seen_imports.add(item.output_import_line)
546
548
  click.echo(item.snippet)
547
549
  click.echo()
548
550
  else:
@@ -601,14 +603,6 @@ def cli(
601
603
  filepath.write_text(new, "utf-8")
602
604
 
603
605
 
604
- def is_subpath(path: pathlib.Path, parent: pathlib.Path) -> bool:
605
- try:
606
- path.relative_to(parent)
607
- return True
608
- except ValueError:
609
- return False
610
-
611
-
612
606
  def is_dunder(name):
613
607
  return name.startswith("__") and name.endswith("__")
614
608
 
@@ -1,10 +1,10 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: symbex
3
- Version: 1.4
3
+ Version: 2.0
4
4
  Summary: Find the Python code for specified symbols
5
- Home-page: https://github.com/simonw/symbex
6
5
  Author: Simon Willison
7
- License: Apache License, Version 2.0
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/simonw/symbex
8
8
  Project-URL: Issues, https://github.com/simonw/symbex/issues
9
9
  Project-URL: CI, https://github.com/simonw/symbex/actions
10
10
  Project-URL: Changelog, https://github.com/simonw/symbex/releases
@@ -13,13 +13,14 @@ Description-Content-Type: text/markdown
13
13
  License-File: LICENSE
14
14
  Requires-Dist: click
15
15
  Provides-Extra: test
16
- Requires-Dist: pytest ; extra == 'test'
17
- Requires-Dist: pytest-icdiff ; extra == 'test'
18
- Requires-Dist: cogapp ; extra == 'test'
19
- Requires-Dist: PyYAML ; extra == 'test'
20
- Requires-Dist: ruff ; extra == 'test'
16
+ Requires-Dist: pytest; extra == "test"
17
+ Requires-Dist: pytest-icdiff; extra == "test"
18
+ Requires-Dist: cogapp; extra == "test"
19
+ Requires-Dist: PyYAML; extra == "test"
20
+ Requires-Dist: ruff; extra == "test"
21
+ Dynamic: license-file
21
22
 
22
- # symbex
23
+ # Symbex
23
24
 
24
25
  [![PyPI](https://img.shields.io/pypi/v/symbex.svg)](https://pypi.org/project/symbex/)
25
26
  [![Changelog](https://img.shields.io/github/v/release/simonw/symbex?include_prereleases&label=changelog)](https://github.com/simonw/symbex/releases)
@@ -28,7 +29,7 @@ Requires-Dist: ruff ; extra == 'test'
28
29
 
29
30
  Find the Python code for specified symbols
30
31
 
31
- Read [symbex: search Python code for functions and classes, then pipe them into a LLM](https://simonwillison.net/2023/Jun/18/symbex/) for background on this project.
32
+ Read [Symbex: search Python code for functions and classes, then pipe them into a LLM](https://simonwillison.net/2023/Jun/18/symbex/) for background on this project.
32
33
 
33
34
  ## Installation
34
35
 
@@ -0,0 +1,10 @@
1
+ symbex/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ symbex/__main__.py,sha256=8hDtWlaFZK24KhfNq_ZKgtXqYHsDQDetukOCMlsbW0Q,59
3
+ symbex/cli.py,sha256=oYesN03MS2v89Ol__4eSMaik4zvj6L1oWFMghLjbxHo,18231
4
+ symbex/lib.py,sha256=CiKKOOyc6Ne_7igzNItMZpa5I6o12LEbIPrQU9al7Ro,11436
5
+ symbex-2.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
6
+ symbex-2.0.dist-info/METADATA,sha256=j6AWlBlQhTl4fFWhkPVx7fsOvO2xzklHb8Bc5DbTOGo,21373
7
+ symbex-2.0.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
8
+ symbex-2.0.dist-info/entry_points.txt,sha256=YgMSEfEGqNMHM9RysFObH8lkQKVZKyymKLnXbVue_Uk,42
9
+ symbex-2.0.dist-info/top_level.txt,sha256=qwle8HjAaYgpdMIHlJcTcN4gaG4wmDqUvkt54beTBTs,7
10
+ symbex-2.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.41.2)
2
+ Generator: setuptools (79.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,10 +0,0 @@
1
- symbex/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- symbex/__main__.py,sha256=8hDtWlaFZK24KhfNq_ZKgtXqYHsDQDetukOCMlsbW0Q,59
3
- symbex/cli.py,sha256=aphJzLYES-kqvNMl2Pa2wxAounWPhyhqUbp8qxLK8U8,18257
4
- symbex/lib.py,sha256=CiKKOOyc6Ne_7igzNItMZpa5I6o12LEbIPrQU9al7Ro,11436
5
- symbex-1.4.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
6
- symbex-1.4.dist-info/METADATA,sha256=HK_k1FuVTT4MG4dA48RicoMravije7-lzfhywwpE_g4,21350
7
- symbex-1.4.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
8
- symbex-1.4.dist-info/entry_points.txt,sha256=YgMSEfEGqNMHM9RysFObH8lkQKVZKyymKLnXbVue_Uk,42
9
- symbex-1.4.dist-info/top_level.txt,sha256=qwle8HjAaYgpdMIHlJcTcN4gaG4wmDqUvkt54beTBTs,7
10
- symbex-1.4.dist-info/RECORD,,