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

buildtables overwrites files on (case-insensitive?) category collision #140

Open
ducky64 opened this issue Aug 18, 2024 · 0 comments
Open

Comments

@ducky64
Copy link

ducky64 commented Aug 18, 2024

An example is with inductors, which have category entries

id category subcategory
12 Inductors/Coils/Transformers Inductors (SMD)
695 inductors/coils/transformers Inductors (SMD)

On Windows at least, both write to InductorsakaCoilsakaTransformersInductors__SMD_.json.gz, so in practice the latter one overwrites the former. The latter one is also completely useless, containing just one part.

There's a bunch more of these cases.

Quick and dirty way to not get it to overwrite: in jlcparts/datatables.py, add:

  def saveJson(object, filename, hash=False, pretty=False, compress=False):
+     if os.path.isfile(filename):
+         print(f"**** dropping {filename}")
+         return

A cleaner solution may be to append the tables instead of overwriting, treating it as one giant file. Which doesn't adhere to the input data as strictly (especially in terms of category ID), but maybe is closer to the spirit of the data?

Actually, category name standardization (across case, / vs. & vs. , ) could probably clean up the data quite a bit

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

No branches or pull requests

1 participant