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

Results of running ruff format and ruff check #119

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mkitti
Copy link

@mkitti mkitti commented Nov 14, 2024

I used the ruff tool to apply formatting.

Also here is the output of pixi run ruff check utility/bin/name_match.py:

utility/bin/name_match.py:139:40: E712 Avoid equality comparisons to `True`; use `if author_info["asserted"]:` for truth checks
    |
137 |     orcid = author_info["paper_orcid"] if "paper_orcid" in author_info else None
138 |     affiliations = (
139 |         author_info["affiliations"] if author_info["asserted"] == True else None
    |                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E712
140 |     )
141 |     return Author(name, orcid, affiliations)
    |
    = help: Replace with `author_info["asserted"]`

utility/bin/name_match.py:490:47: F541 [*] f-string without any placeholders
    |
488 |                             last_names=guess.last_names,
489 |                             exists=guess.exists,
490 |                             name=guess.name + f"-1",
    |                                               ^^^^^ F541
491 |                             score=guess.score,
492 |                         )
    |
    = help: Remove extraneous `f` prefix

utility/bin/name_match.py:663:64: F821 Undefined name `best_guess`
    |
661 |                     lookup_by="orcid",
662 |                     coll=orcid_collection,
663 |                     given=first_names_for_orcid_record(author, best_guess),
    |                                                                ^^^^^^^^^^ F821
664 |                     family=last_names_for_orcid_record(author, best_guess),
665 |                 )
    |

utility/bin/name_match.py:664:64: F821 Undefined name `best_guess`
    |
662 |                     coll=orcid_collection,
663 |                     given=first_names_for_orcid_record(author, best_guess),
664 |                     family=last_names_for_orcid_record(author, best_guess),
    |                                                                ^^^^^^^^^^ F821
665 |                 )
666 |         else:
    |

utility/bin/name_match.py:680:64: F821 Undefined name `best_guess`
    |
678 |                     lookup_by="employeeId",
679 |                     coll=orcid_collection,
680 |                     given=first_names_for_orcid_record(author, best_guess),
    |                                                                ^^^^^^^^^^ F821
681 |                     family=last_names_for_orcid_record(author, best_guess),
682 |                 )
    |

utility/bin/name_match.py:681:64: F821 Undefined name `best_guess`
    |
679 |                     coll=orcid_collection,
680 |                     given=first_names_for_orcid_record(author, best_guess),
681 |                     family=last_names_for_orcid_record(author, best_guess),
    |                                                                ^^^^^^^^^^ F821
682 |                 )
683 |         else:
    |

utility/bin/name_match.py:811:29: F841 [*] Local variable `err` is assigned to but never used
    |
809 |                 for doi in instream.read().splitlines():
810 |                     dois.append(doi.strip().lower())
811 |         except Exception as err:
    |                             ^^^ F841
812 |             print(f"Could not process {file_arg}")
813 |             exit()
    |
    = help: Remove assignment to unused variable `err`

utility/bin/name_match.py:825:53: E712 Avoid equality comparisons to `True`; use `if a.check:` for truth checks
    |
824 | def print_janelia_authors(all_authors):
825 |     print(", ".join([a.name for a in all_authors if a.check == True]))
    |                                                     ^^^^^^^^^^^^^^^ E712
    |
    = help: Replace with `a.check`

utility/bin/name_match.py:948:20: E712 Avoid equality comparisons to `True`; use `if author.check:` for truth checks
    |
947 |             for author in all_authors:
948 |                 if author.check == True:
    |                    ^^^^^^^^^^^^^^^^^^^^ E712
949 |                     final_choice = get_corresponding_employee(
950 |                         author, orcid_collection, arg.VERBOSE, arg.WRITE
    |
    = help: Replace with `author.check`

utility/bin/name_match.py:952:40: E711 Comparison to `None` should be `cond is None`
    |
950 |                         author, orcid_collection, arg.VERBOSE, arg.WRITE
951 |                     )
952 |                     if final_choice == None:
    |                                        ^^^^ E711
953 |                         revised_jrc_authors.append(Employee(exists=False))
954 |                     else:
    |
    = help: Replace with `cond is None`

Found 10 errors.
[*] 2 fixable with the `--fix` option (4 hidden fixes can be enabled with the `--unsafe-fixes` option).

@mkitti mkitti changed the title Results of running ruff format Results of running ruff format and ruff check Nov 14, 2024
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.

1 participant