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

[Bug]: Wrong typehint for describe_role #2332

Closed
1 task done
graelo opened this issue Nov 6, 2024 · 4 comments
Closed
1 task done

[Bug]: Wrong typehint for describe_role #2332

graelo opened this issue Nov 6, 2024 · 4 comments
Labels
kind/bug Something isn't working

Comments

@graelo
Copy link

graelo commented Nov 6, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

When calling client.describe_role(role_name=some_role), the function returns a dictionary, and this is pretty clear from the code:

def describe_role(
self, role_name: str, timeout: Optional[float] = None, **kwargs
) -> List[Dict]:
conn = self._get_connection()
db_name = kwargs.pop("db_name", "")
try:
res = conn.select_grant_for_one_role(role_name, db_name, timeout=timeout, **kwargs)
except Exception as ex:
raise ex from ex
ret = {}
ret["role"] = role_name
ret["privileges"] = [dict(i) for i in res.groups]
return ret

However, the function signature indicates the returned value is List[Dict].

Expected Behavior

The function signature should simply indicate the returned value is Dict, or Dict[str, Any].

Steps/Code To Reproduce behavior

I believe this is unnecessary for this type of issue.

Environment details

Irrelevant.

Anything else?

I know this seems minor, but with type checkers like pyright, I assure you this kind of problem is a bit confusing.

@XuanYang-cn
Copy link
Contributor

/assign @CaoHaiNam

@sre-ci-robot
Copy link

@XuanYang-cn: GitHub didn't allow me to assign the following users: CaoHaiNam.

Note that only milvus-io members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time.
For more information please see the contributor guide

In response to this:

/assign @CaoHaiNam

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

sre-ci-robot pushed a commit that referenced this issue Nov 8, 2024
XuanYang-cn added a commit to XuanYang-cn/pymilvus that referenced this issue Nov 15, 2024
- Added grpc as a valid protocol for uri (milvus-io#2090)
- build(deps): bump urllib3 from 1.26.18 to 1.26.19 (milvus-io#2140)
- build(deps): bump certifi from 2023.7.22 to 2024.7.4 (milvus-io#2170)
- feat(pymilvus/settings.py): Load configuration without altering the environment (milvus-io#2192)
- feat: Add compact, get_server_version and flush api (milvus-io#2326)
- Fix typo and correct grammar (milvus-io#2333)
- Update return type of describe_role to Dict (milvus-io#2337)
- enhance: Reorganize the examples (milvus-io#2340)

Related: milvus-io#2166, milvus-io#2325, milvus-io#2332

Co-authored-by: Bruno Faria <[email protected]>
Co-authored-by: Bruno Faria <[email protected]>
Co-authored-by: dependabot[bot] <[email protected]>
Co-authored-by: -LAN- <[email protected]>
Co-authored-by: zhenshan.cao <[email protected]>
Co-authored-by: NamCaoHai <[email protected]>
Co-authored-by: yangxuan <[email protected]>
XuanYang-cn added a commit to XuanYang-cn/pymilvus that referenced this issue Nov 15, 2024
- Added grpc as a valid protocol for uri (milvus-io#2090)
- build(deps): bump urllib3 from 1.26.18 to 1.26.19 (milvus-io#2140)
- build(deps): bump certifi from 2023.7.22 to 2024.7.4 (milvus-io#2170)
- feat(pymilvus/settings.py): Load configuration without altering the environment (milvus-io#2192)
- feat: Add compact, get_server_version and flush api (milvus-io#2326)
- Fix typo and correct grammar (milvus-io#2333)
- Update return type of describe_role to Dict (milvus-io#2337)
- enhance: Reorganize the examples (milvus-io#2340)

Related: milvus-io#2166, milvus-io#2325, milvus-io#2332

Co-authored-by: Bruno Faria <[email protected]>
Co-authored-by: Bruno Faria <[email protected]>
Co-authored-by: dependabot[bot] <[email protected]>
Co-authored-by: -LAN- <[email protected]>
Co-authored-by: zhenshan.cao <[email protected]>
Co-authored-by: NamCaoHai <[email protected]>
Co-authored-by: yangxuan <[email protected]>
Signed-off-by: yangxuan <[email protected]>
@XuanYang-cn
Copy link
Contributor

/close

@sre-ci-robot
Copy link

@XuanYang-cn: Closing this issue.

In response to this:

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

sre-ci-robot pushed a commit that referenced this issue Nov 25, 2024
- Added grpc as a valid protocol for uri (#2090)
- build(deps): bump urllib3 from 1.26.18 to 1.26.19 (#2140)
- build(deps): bump certifi from 2023.7.22 to 2024.7.4 (#2170)
- feat(pymilvus/settings.py): Load configuration without altering the
environment (#2192)
- feat: Add compact, get_server_version and flush api (#2326)
- Fix typo and correct grammar (#2333)
- Update return type of describe_role to Dict (#2337)
- enhance: Reorganize the examples (#2340)

Related: #2166, #2325, #2332

Signed-off-by: yangxuan <[email protected]>
Co-authored-by: Bruno Faria <[email protected]>
Co-authored-by: Bruno Faria <[email protected]>
Co-authored-by: dependabot[bot] <[email protected]>
Co-authored-by: -LAN- <[email protected]>
Co-authored-by: zhenshan.cao <[email protected]>
Co-authored-by: NamCaoHai <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants