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

shortcut for iitem #883

Merged
merged 2 commits into from
Sep 21, 2022
Merged

shortcut for iitem #883

merged 2 commits into from
Sep 21, 2022

Conversation

tg123
Copy link
Member

@tg123 tg123 commented Jun 3, 2022

fix #861
thank @WeihanLi for the idea

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 3, 2022
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 3, 2022
@tg123 tg123 marked this pull request as draft June 3, 2022 16:37
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 3, 2022
@tg123 tg123 marked this pull request as ready for review June 3, 2022 18:54
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 3, 2022
@tg123
Copy link
Member Author

tg123 commented Jun 3, 2022

linq is not available anyway :(

@tg123 tg123 marked this pull request as draft June 5, 2022 06:58
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 5, 2022
{
public static IEnumerator<T> GetEnumerator<T>(this IItems<T> items)
{
return items.Items.GetEnumerator();
Copy link

@xiaomi7732 xiaomi7732 Jun 5, 2022

Choose a reason for hiding this comment

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

Hi, just curious, is it possible for items.Items to be null in any case? What is the expected behavior? Let it throw or gracefully quit the enumeration?

Copy link
Member Author

Choose a reason for hiding this comment

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

yup you are right, would throw npe
maybe make it empty would be better

the issue now is that linq is not compatible with this impl

Choose a reason for hiding this comment

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

I assume we are looking for a cheap fix, my 2 cents if you don't mind:

  • I still think this is a good change even without linq because of the foreach improvement;
  • Linq could still be used on Items and I don't think it is too terrible:
podList.Items.Where(i => i.abc);  // Maybe not as perfect as podList.Where(i => ...) but I think it is okay.
  • Of course, that is based on the idea that interface IItems<T> : IEnumerable<T> looks like a sizable change, maybe there's an easier way to do it.

On a side note: if we can take a major refactor, why IItems<T>? Can't it be IEnumerable<T> to begin with?

Copy link
Member Author

Choose a reason for hiding this comment

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

I am looking into templates to see if can put an IEnumerable there

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Sep 4, 2022
@tg123 tg123 marked this pull request as ready for review September 5, 2022 06:52
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 5, 2022
@tg123
Copy link
Member Author

tg123 commented Sep 20, 2022

@brendanburns I believe this is ready for merge
any comments?

@brendandburns
Copy link
Contributor

/lgtm
/approve

Thanks

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 21, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: brendandburns, tg123

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [brendandburns,tg123]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit f4a638b into kubernetes-client:master Sep 21, 2022
@tg123 tg123 deleted the enumitem branch January 15, 2023 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make await ListNamespacedServiceAsync return enumerable
5 participants