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]: Explicit return in __init__() #1592

Closed
Sai-Suraj-27 opened this issue Dec 27, 2023 · 3 comments
Closed

[Bug]: Explicit return in __init__() #1592

Sai-Suraj-27 opened this issue Dec 27, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@Sai-Suraj-27
Copy link
Contributor

What happened?

In the following 2 __init__() methods,

def __init__(self, system: System):
self._coordinator_url = system.settings.require("chroma_coordinator_host")
# TODO: break out coordinator_port into a separate setting?
self._coordinator_port = system.settings.require("chroma_server_grpc_port")
return super().__init__(system)

def __init__(self, system: System):
self._server_port = system.settings.require("chroma_server_grpc_port")
self._assignment_policy = system.instance(CollectionAssignmentPolicy)
return super().__init__(system)

We are returning a non-None value.
As per the official docs of Python. Returning a non-None value from an init method causes TypeError to be raised at the runtime.

Versions

Python 3.8, 3.9, 3.10

Relevant log output

No response

@Sai-Suraj-27 Sai-Suraj-27 added the bug Something isn't working label Dec 27, 2023
@Sai-Suraj-27
Copy link
Contributor Author

Hey, @HammadB I see that you implemented these 2 classes (#1229). Can you please look into this. Thank you.

@jeffchuber
Copy link
Contributor

@tazarov can you take a look here?

@tazarov
Copy link
Contributor

tazarov commented Dec 31, 2023

hey @Sai-Suraj-27, have you excluded the possibility that parent classes' __init__ returns None and these statements, granted a bit confusing knowing that __init__ shouldn't return, are just fine?

The team emphasizes on correctness through testing, so if, as you suggest this returns a non-None value thus rasing TypeError, it will show up in testing.

Feel free to clean up this nit, but note as with other distributed parts of the codebase, things are fluid and there may as well already be branches (not yet PRs) that address this or change it altogether.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants