gtalarico / pyairtable

Python Api Client for Airtable
https://pyairtable.readthedocs.io
MIT License
765 stars 138 forks source link

Relax type annotation on batch_upsert (and other batch methods) #308

Closed mesozoic closed 11 months ago

mesozoic commented 12 months ago

This branch addresses two issues with the type hints we rolled out in 2.0:

  1. The batch_upsert method only accepts records with an ID, not without an ID. (Fixing this got complicated due to how mypy interprets lists of dicts, and I wound up simply relaxing it to List[Dict[str, Any]] instead of something like List[Union[RecordDict, CreateRecordDict, UpdateRecordDict]].
  2. All of our batch_* methods only accept lists, not other iterable types. That means, among other things, that generator expressions can't be passed directly into these functions. This branch fixes that.

Both changes have test coverage, but I may have missed something. Eyes welcome!

codecov[bot] commented 12 months ago

Codecov Report

Merging #308 (99a2b09) into main (d590247) will increase coverage by 0.01%. Report is 2 commits behind head on main. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #308      +/-   ##
==========================================
+ Coverage   96.07%   96.08%   +0.01%     
==========================================
  Files          21       21              
  Lines        1146     1150       +4     
==========================================
+ Hits         1101     1105       +4     
  Misses         45       45              
Files Changed Coverage Δ
pyairtable/api/table.py 98.16% <100.00%> (+0.06%) :arrow_up: