Mathics3 / mathics-core

An open-source Mathematica. This repository contains the Python modules for WL Built-in functions, variables, core primitives, e.g. Symbol, a parser to create Expressions, and an evaluator to execute them.
https://mathics.org
Other
786 stars 48 forks source link

Fix mypy errors #1145

Closed davidar closed 1 month ago

davidar commented 1 month ago

I've been going through fixing mypy errors, and have gotten through about half of them. In the process I've added some extra error handling that fixes some exceptions I've seen due to methods being called on the wrong types.

Current master:

Found 1718 errors in 183 files (checked 443 source files)

This branch:

Found 872 errors in 155 files (checked 443 source files)

Feel free to squash all these commits, the only reason I've left them separate is that I made sure the test suite was passing after each one.

rocky commented 1 month ago

Reducing mypy errors has long been a desire. So I really appreciate this.

The main ask is to be sensitive as to when to use a list versus a tuple. I don't think one can know in advance whether the disruption is too great. Too often in this code base the mess is too great that we can't tackle an entire problem in one go. Instead, personally I have found that for me, I have to do it little by little.

Also, if you would like direct write access to the repositories, let us know.

rocky commented 1 month ago

LGTM. This is a large PR, in the future smaller ones would be nice. @mmatera - your comments?

davidar commented 1 month ago

LGTM. This is a large PR, in the future smaller ones would be nice.

Yeah, sorry about that, I couldn't really find a neat way to cleave it up so I kind of just kept going until I got bored of it...

Also, if you would like direct write access to the repositories, let us know.

Sure, if that would make it easier to make these kinds of changes incrementally?

rocky commented 1 month ago

LGTM. This is a large PR, in the future smaller ones would be nice.

Yeah, sorry about that, I couldn't really find a neat way to cleave it up so I kind of just kept going until I got bored of it...

Also, if you would like direct write access to the repositories, let us know.

Sure, if that would make it easier to make these kinds of changes incrementally?

An invite should have been sent.