question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

LibModel.items() confusion

See original GitHub issue

The docs describe LibModel.items() to

Iterate over (key, value) pairs that this object contains. Computed fields are not included.

This is the case for Item.items(), but Album.items() gives all the Items associated with the Album.

LibModel.items() is actually defined in Model.items(), and overwritten in the Album class.

So I’m wondering what the intended behavior is 😃

I know I have used Album.items() as it currently is in the past (and it seems to me a sensibly named function). Just now I tried to use it in the sense defined in the docs and ran into this problem (although I want computed fields so not using it any more). In the docs sense I guess the items() mimics dict.items(), but does create some confusion with Items 😄

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
govynnuscommented, Jul 10, 2022

Yep I think just documenting the conflict would be good. Doesn’t seem like it’s been too much of an issue in the past.

2reactions
wisp3rwindcommented, Jul 10, 2022

So yes, it’s not a great situation, but it’s not clear what we should do instead. Perhaps rename Album.items() to something else someday?

While unfortunate; this seems like a change that would break many third-party plugins. In my opinion, we should avoid renaming .items() (unless there’s a stronger reason than being somewhat confusing). Maybe extending the Album.items() docstring to point this out would help to alleviate the issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to get confusion matrix from the below model?
You can use scikit-learn: from sklearn.metrics import confusion_matrix predicted = model.predict(x_test) print(confusion_matrix(y_test ...
Read more >
Vincit/objection.js - Gitter
Im kinda confused on how complicated it is. ... Why can I not insert them like that? await Item.query().insert({ asset, user, shares: 0...
Read more >
Depending on sources generated by Java annotation ...
public static GroupBuilder newBuilder() { ... One of thr things that i'm confused about is that we used Dagger 2.1, and that did...
Read more >
beets Documentation
If beets finds an album or item in your library that seems to be the same as ... works pretty well for most...
Read more >
2. Maintainability depends on modularity: Stop using ...
If things need to be put in the global scope, that code should be ... lib/model.js'); // require a dependency // module implementation...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found