Skip to content

Add type hints to skll.data module & improve types in skll.config - #730

Merged
desilinguist merged 8 commits into
mainfrom
561-type-hints-2
May 18, 2023
Merged

Add type hints to skll.data module & improve types in skll.config #730
desilinguist merged 8 commits into
mainfrom
561-type-hints-2

Conversation

@desilinguist

Copy link
Copy Markdown
Collaborator
  1. Update pre-commit checks to include a check for commit message format and to exclude missing imports from the mypy check.
  2. Add new custom types to skll.types module.
  3. Add type hints to skll.data module
    • Refactor code to ensure correct types.
    • Add a lot of checks for labels, features, vectorizer being None that was previously unhandled.
    • Update docstrings to use the type hints.
  4. Improve type hints in config/__init__.py
    • Use new ClassMap custom type.
    • Make sure pos_label is typed correctly.
    • Fix incorrect default value for sampler parameters.

- Use new `ClassMap` custom type.
- Make sure `pos_label` is typed correctly.
- Fix incorrect default value for sampler parameters.
- Refactor code to ensure correct types.
- Add a lot of checks for labels, features, vectorizer being ``None``
  that was previously handled.
- Update docstrings to use the type hints.
- Add new tests for merging featuresets.
- Tweak tests that were using `StringIO` to use actual files.
Comment thread skll/types.py Outdated
Comment thread skll/data/featureset.py Outdated
Comment thread skll/data/featureset.py
Comment thread skll/data/featureset.py Outdated
Comment thread skll/data/featureset.py Outdated
@codecov

codecov Bot commented May 17, 2023

Copy link
Copy Markdown

Codecov Report

Patch coverage: 92.44% and project coverage change: -0.22 ⚠️

Comparison is base (d7f0eb2) 95.37% compared to head (482f4df) 95.16%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #730      +/-   ##
==========================================
- Coverage   95.37%   95.16%   -0.22%     
==========================================
  Files          29       29              
  Lines        3415     3451      +36     
==========================================
+ Hits         3257     3284      +27     
- Misses        158      167       +9     
Impacted Files Coverage Δ
skll/data/featureset.py 90.00% <86.04%> (-0.57%) ⬇️
skll/data/writers.py 93.65% <93.93%> (-0.76%) ⬇️
skll/data/readers.py 90.36% <98.33%> (ø)
skll/config/__init__.py 94.75% <100.00%> (-0.02%) ⬇️
skll/types.py 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Comment thread skll/data/featureset.py Outdated
Comment thread skll/data/featureset.py Outdated
Comment thread skll/data/readers.py Outdated
Comment thread skll/data/readers.py Outdated
Comment thread skll/data/readers.py Outdated
Comment thread skll/data/readers.py Outdated
Comment thread skll/data/readers.py Outdated
Comment thread skll/data/readers.py Outdated
Comment thread skll/data/readers.py
Comment thread skll/data/readers.py Outdated
Comment thread skll/data/readers.py Outdated
Comment thread skll/data/readers.py
Comment thread skll/data/writers.py Outdated
Comment thread skll/data/featureset.py Outdated
Comment thread skll/data/featureset.py Outdated
Comment thread skll/data/featureset.py
Comment thread skll/data/featureset.py Outdated
Comment thread skll/data/writers.py Outdated
Co-authored-by: tamarl08 <102983105+tamarl08@users.noreply.github.com>
@desilinguist
desilinguist merged commit 9f26caf into main May 18, 2023
@delete-merged-branch
delete-merged-branch Bot deleted the 561-type-hints-2 branch May 18, 2023 15:54
@desilinguist

Copy link
Copy Markdown
Collaborator Author

This is part of #561.

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.

3 participants