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

The arguments to create_subcom are not clear #10

Open
devos50 opened this issue Oct 2, 2020 · 1 comment
Open

The arguments to create_subcom are not clear #10

devos50 opened this issue Oct 2, 2020 · 1 comment
Labels
bug Something isn't working documentation Improvements or additions to documentation

Comments

@devos50
Copy link
Collaborator

devos50 commented Oct 2, 2020

The create_subcom method currently has the following signature:

def create_subcom(self, *args, **kwargs) -> BaseSubCommunity:

From this signature alone, is not clear what arguments are expected here. The call to this method gave me a bit more information, but I think the expected arguments should be added to the signature:

subcom = self.subcom_factory.create_subcom(
                subcom_id=subcom_id, max_peers=self.settings.subcom_max_peers
            )
@grimadas grimadas added bug Something isn't working documentation Improvements or additions to documentation labels Oct 5, 2020
@Solomon1732
Copy link

It seems there are at least three places where the create_subcom method is implemented. In all three places it looks to be a wrapper around either IPv8SubCommunity or LightSubCommunity.

https://github.com/Tribler/bami/blob/master/src/bami/backbone/community.py#L205
https://github.com/Tribler/bami/blob/master/src/bami/backbone/sub_community.py#L80
https://github.com/Tribler/bami/blob/master/src/bami/backbone/sub_community.py#L100

The last link, which calls LightSubCommunity, also requires only subcom_id, while LightSubCommunity requires that and max_peers, the latter of which is unused in the class.
LightSubCommunity:
https://github.com/Tribler/bami/blob/master/src/bami/backbone/sub_community.py#L54

Even though it is unused, it still can give a clue as to what is the expected type of each argument. In this case they both look like int.

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

No branches or pull requests

3 participants