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

Improve docstrings to better explain args and functions #101

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

DeflateAwning
Copy link

No description provided.

@@ -324,7 +324,7 @@ def _map_category(val: MapCategoryParams):
help="Number of parallel processes. Defaults to 1, set to 0 to use all cores")
def buildtables(library, outdir, ignoreoldstock, jobs):
"""
Build datatables out of the LIBRARY and save them in OUTDIR
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is an improvement "datatables" is term used across the codebase to mark tables with components. You just replaced "what" with type. The best would be to have both.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What format is "datatables"? It should be documented. Is it a JSON, a CSV, or other? It should be indicated at every instance, as it's extremely ambiguous.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be documented, but not here. For the user of the command (this string is what the CLI user sees) data table is something opaque.

It belongs to a system architecture description.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't you think it belongs in the doc strings?

A doc string should describe what a function does. The function generates JSON files.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Abstraction and targeting who sees the message. The fact that datatables are encoded using JSON is just an implementation detail; it doesn't change how you use the function. When you use this function, you operate with datables as a black-box. It's like saying "Here, there is book." What I propose is to say "this book is a catalog of components", what you propose to say "It is in soft cover".

As I started - I think it is the best say both, but I strongly disagree that saying just "this is JSON" is useful. The most important thing to say is that it is a datable.

jlcparts/jlcpcb.py Show resolved Hide resolved
test_out_table.ext Outdated Show resolved Hide resolved
@yaqwsx yaqwsx force-pushed the master branch 2 times, most recently from 3dc9b5b to bb8f331 Compare January 7, 2024 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants