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

Exporter Typing with mypy [AARD-1765] #1093

Merged
merged 30 commits into from
Aug 21, 2024
Merged

Conversation

BrandonPacewic
Copy link
Member

@BrandonPacewic BrandonPacewic commented Aug 13, 2024

"Fixed" 400+ type errors...

In addition to the type error fixes:

  • Added a mypy typing workflow.
  • Added .pyi typing files for our compiled proto files for lsp and intellisense.
  • Fixed an issue with the GlobalManager where the internal class instance was the only thing ever being referenced.
    • Essentially because of the return type of the __new__ method the class was simply not working how it was originally designed.
  • Made note of several things todo in future refactors including:
    • OString needing more defined behaviour instead of revolving around the python 2 object type.
      def ThumbnailPath(cls, fileName: str) -> object:
    • JointHierarchy.py's class structure being poorly defined.
      • I resolved the apparent errors that mypy pointed out but the whole structure needs to be rewritten, particularly when it comes to how the various type of nodes are currently being used, many of which I'm sure can just be removed.
      • I also fixed some typing errors that seemingly looked like syntax errors related to the Fusion API and other functions within the module.
  • Provided default_factorys for ExporterOptions' list default fields.
  • Replaced default values for ExporterOptions fields of None where appropriate.
  • Noted various instances of unused code that, given the observed type errors, would never run even if we wanted to use it.
    • This code should be removed in the future as a part of separate refactors.
    • See included Transition: AARD-1765 comment tags for references to individual code sections.
  • Fixed an issue within construct_info that would cause AttributeErrors to be thrown during exporting making debugging painful.
    try:
    # attempt to get entity token
    proto_obj.info.GUID = fus_object.entityToken
    except AttributeError:
    # fails and gets new uuid
    proto_obj.info.GUID = str(uuid.uuid4())

JIRA Issue

@BrandonPacewic BrandonPacewic added exporter refactor The most important part of software development. labels Aug 13, 2024
@BrandonPacewic BrandonPacewic self-assigned this Aug 13, 2024
@BrandonPacewic BrandonPacewic marked this pull request as ready for review August 14, 2024 00:21
@BrandonPacewic BrandonPacewic requested review from PepperLola, azaleacolburn, a-crowell and Dhruv-0-Arora and removed request for a team August 14, 2024 00:21
@Autodesk Autodesk deleted a comment from autodesk-chorus bot Aug 14, 2024
Copy link
Member

@azaleacolburn azaleacolburn left a comment

Choose a reason for hiding this comment

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

Amazing Work!

Co-authored-by: PepperLola <[email protected]>
@autodesk-chorus
Copy link

Chorus detected one or more security issues with this pull request. See the Checks tab for more details.

As a reminder, please follow the secure code review process as part of the Secure Coding Non-Negotiable requirement.

Copy link
Member

@PepperLola PepperLola left a comment

Choose a reason for hiding this comment

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

Good Looking 🌹

@HunterBarclay HunterBarclay merged commit ca0f6d0 into dev Aug 21, 2024
14 checks passed
@HunterBarclay HunterBarclay deleted the branp/1765/mypy-type-hinting branch August 21, 2024 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exporter refactor The most important part of software development.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants