Skip to content
Snippets Groups Projects

reduce the number of type checking errors

Closed David Schäfer requested to merge type-hints into develop
5 unresolved threads

Merge request reports

Pipeline #199536 passed

Pipeline passed for 6dfb7640 on type-hints

Test coverage 76.00% from 1 job
Approval is optional
Test summary results are loading

Closed by David SchäferDavid Schäfer 2 months ago (Jan 7, 2025 10:10am UTC)

Merge details

  • The changes were not merged into develop.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
378 378 tmp[mask] = value
379 379 except Exception:
380 380 raise ValueError(
381 f"bad mask. cannot use mask of length {len(mask)} on "
382 f"data of length {len(tmp)}"
381 f"attempted to assign sequence of size {len(tmp)} "
382 f"using indexer {mask}"
    • the value Error is a reraise from above and handle miss matched length, which is not reflected in the message (i think)
    • print the whole object, might blow up the error message if we have many entries (eg. list of millions of NaNs)

    better approach: move the error-message out of the try-except block:

    if is_listlike() and len ~= len: 
        raise ValueErorr('missmatch')
    try:
        ...
    except E: 
        ...
  • Please register or sign in to reply
  • Bert Palm
    Bert Palm @palmb started a thread on the diff
  • 120 120 return data
    121 121
    122 122 @property
    123 def flags(self) -> MutableMapping[str, pd.Series]:
    123 def flags(self) -> pd.DataFrame | DictOfSeries:
    • Comment on lines -123 to +123

      i'm not sure about that. We might should stick with MutableMapping and fix the usage of not supported methods/properties (for example all over in the tests) or go with a custom ABC/Type that inherit from MutableMapping and add only really neccessary methods (like .columns that are supported on both pd.Dataframe and DictOfSeries)

    • Please register or sign in to reply
  • Bert Palm
    Bert Palm @palmb started a thread on the diff
  • 10 10 outlier-utils==0.0.5
    11 11 pyarrow==14.0.2
    12 12 pandas==2.1.4
    13 pandas-stubs>=2.1.4
  • Bert Palm
    Bert Palm @palmb started a thread on the diff
  • 206 206 self._data = self._initFromRaw(raw_data, copy)
    207 207
    208 208 @staticmethod
    209 def _initFromRaw(data: Mapping, copy: bool) -> Dict[str, History]:
  • Bert Palm
    Bert Palm @palmb started a thread on the diff
  • 102 104
    103 105
    104 106 @pytest.mark.parametrize("data", testdata)
    105 def test_copy(data: Union[pd.DataFrame, DictOfSeries, Dict[str, pd.Series]]):
  • Please register or sign in to reply
    Loading