Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idea: filters for private (starts with an underscore) functions and methods #38

Closed
simonw opened this issue Jul 16, 2023 · 3 comments
Closed
Labels
enhancement New feature or request

Comments

@simonw
Copy link
Owner

simonw commented Jul 16, 2023

Maybe like this:

  • --private - only functions and methods with a name that starts with _
  • --unprivate (or --public - but --unprivate is more consistent with --undocumented and --untypedand--unasync`) - exclude those private methods and functions
  • --dunder - only functions and methods that match are __blah__.

Open question: should --private return __init__ etc? Are dunder methods considered private? I think probably not.

@simonw simonw added the enhancement New feature or request label Jul 16, 2023
@simonw
Copy link
Owner Author

simonw commented Jul 16, 2023

My main use-case for this is a CI check which enforces documentation on everything except for private functions and methods:

symbex --unprivate --undocumented --check

For that example though I do think this might feel more natural:

symbex --public --undocumented --check

@simonw
Copy link
Owner Author

simonw commented Jul 16, 2023

I think classes with a leading _ in their name _MyClass should be treated as matching the private filter too.

@simonw simonw closed this as completed in ced957d Jul 19, 2023
@simonw
Copy link
Owner Author

simonw commented Jul 19, 2023

Docs:

symbex/README.md

Lines 103 to 105 in ced957d

- `--public` - functions/classes that are public - don't have a `_name` prefix (or are `__*__` methods)
- `--private` - functions/classes that are private - have a `_name` prefix and are not `__*__`
- `--dunder` - functions matching `__*__` - this should usually be used with `*.*` to find all dunder methods

simonw added a commit that referenced this issue Jul 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant