Skip to content

Conversation

@ivandasch
Copy link
Contributor

Thank you for submitting the pull request to the Apache Ignite.

In order to streamline the review of the contribution
we ask you to ensure the following steps have been taken:

The Contribution Checklist

  • There is a single JIRA ticket related to the pull request.
  • The web-link to the pull request is attached to the JIRA ticket.
  • The JIRA ticket has the Patch Available state.
  • The pull request body describes changes that have been made.
    The description explains WHAT and WHY was made instead of HOW.
  • The pull request title is treated as the final commit message.
    The following pattern must be used: IGNITE-XXXX Change summary where XXXX - number of JIRA issue.
  • A reviewer has been mentioned through the JIRA comments
    (see the Maintainers list)
  • The pull request has been checked by the Teamcity Bot and
    the green visa attached to the JIRA ticket (see TC.Bot: Check PR)

Notes

If you need any help, please email dev@ignite.apache.org or ask anу advice on http://asf.slack.com #ignite channel.

…cktape-codestyle

# Conflicts:
#	modules/ducktests/tests/ignitetest/services/ignite_app.py
#	modules/ducktests/tests/ignitetest/services/ignite_spark_app.py
#	modules/ducktests/tests/ignitetest/services/utils/ignite_aware.py
#	modules/ducktests/tests/ignitetest/services/utils/ignite_aware_app.py
#	modules/ducktests/tests/ignitetest/services/utils/ignite_config.py
#	modules/ducktests/tests/ignitetest/tests/add_node_rebalance_test.py
#	modules/ducktests/tests/ignitetest/tests/discovery_test.py
#	modules/ducktests/tests/ignitetest/tests/pme_free_switch_test.py
#	modules/ducktests/tests/ignitetest/tests/spark_integration_test.py
#	modules/ducktests/tests/ignitetest/tests/utils/version.py

def _version(self, node_or_version):
@staticmethod
def __version__(node_or_version):
Copy link
Member

Choose a reason for hiding this comment

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

Methods with double underscore on both sides have special meaning. Such methods are mixins and doesn't suppose to be just private methods. Private methods have another naming: __version, without trailing underscores.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, you are right

return os.path.join(self.home(version, project=project), "bin", script_name)

def _version(self, node_or_version):
@staticmethod
Copy link
Member

Choose a reason for hiding this comment

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

there is no need for staticmethod decorator as the method is never used beyond this class

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Both pycharm and pylint generate warnings on it.

def master_log_path(self, node):
return "org.apache.spark.deploy.worker.Worker"

@staticmethod
Copy link
Member

@timoninmaxim timoninmaxim Jul 29, 2020

Choose a reason for hiding this comment

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

Do we really need static methods in our code? I don't see any case in our code where usage of them is required. It just adds more sugar without need. Also some code styles consider them evil, e.g. Google Guide.

Copy link
Contributor Author

@ivandasch ivandasch Jul 30, 2020

Choose a reason for hiding this comment

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

Despite the fact that in mentioned above codestyle staticmethods are not welcome in code, linters generate warnings about unused self. And usage of @staticmethod is a preferrable way to mitigate this case. This is so common in my practice and widely accepted in a python's community.

@anton-vinogradov anton-vinogradov merged commit 330c17b into apache:ignite-ducktape Jul 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants