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

ENH: add helpers to merge extra data into a cycler instance #47

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

tacaswell
Copy link
Member

From private discussions with @WeatherGod

This still needs:

  • is this actually a good idea to include?
  • tests
  • make sure it is in the docs + example

@codecov-io
Copy link

codecov-io commented Apr 23, 2018

Codecov Report

Merging #47 into master will decrease coverage by 1.58%.
The diff coverage is 40%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #47      +/-   ##
==========================================
- Coverage     100%   98.41%   -1.59%     
==========================================
  Files           1        1              
  Lines         184      189       +5     
  Branches       51       53       +2     
==========================================
+ Hits          184      186       +2     
- Misses          0        3       +3
Impacted Files Coverage Δ
cycler.py 98.41% <40%> (-1.59%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1dc2965...5f00bec. Read the comment docs.

cycler.py Outdated Show resolved Hide resolved
cycler.py Outdated Show resolved Hide resolved
@tacaswell
Copy link
Member Author

@WeatherGod took 18 months, but I addressed your comments!

Copy link
Member

@WeatherGod WeatherGod left a comment

Choose a reason for hiding this comment

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

Should also have unit test, which could just be duplicated for the docstring example I mentioned, too.


Parameters
----------
inp : Iterable[Mapping[Any, Any]]
Copy link
Member

Choose a reason for hiding this comment

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

to be pedantic, wouldn't the first Any be Hashable? I haven't gotten fully into the annotation habit yet, so I don't know if Mapping already implies Hashable for the keys.

"""Update a cycler with some supplemental data

Given a cycler, add extra keys to each entry based
on the value of ``index_key`` in that entry.
Copy link
Member

Choose a reason for hiding this comment

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

name here doesn't match the name in the call signature.

A mapping between the values of ``index_key`` in ``source``
and mappings of additional keys and values.

Each mapping must have the same set of keys.
Copy link
Member

Choose a reason for hiding this comment

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

This docstring would greatly benefit from an example. As it stands right now, I have to think really hard to understand the use-cases for this function (and I am the one who originally thought of this idea!).

@timhoffm
Copy link
Member

Is there a reason these are stand alone functions? I would have expected

  • a class method Cycler.from_dicts
  • an instance method Cycler.merge_supplemental

@tacaswell
Copy link
Member Author

@timhoffm Fair, but I think that one level of nesting cycler.Cycler.from_dicts and neither function needs access to the class object.

Still not sure this is a good idea. Maybe this should just go into the docs as an example?

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.

None yet

4 participants