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

PEP8 compliant names binding #83

Merged

Conversation

jhonabreul
Copy link
Collaborator

Binding C# style names from C# method/fields/properties to PEP8 conforming names.

Examples:

  • Properties: C#'s SomePropertyName can be used in Python either with SomePropertyName or some_property_name. Ref: https://peps.python.org/pep-0008/#function-and-variable-names
  • Methods: same rule for properties.
    • Snake-cased methods also get their parameters snake-cased. So using named arguments must follow PEP8 naming.
  • Fields:
    • If fields are not constants, the same properties and methods rule applies.
    • Constant fields are snake-cased and upper-cased: C#'s SomeConstantField can be used in Python as SomeConstantField or SOME_CONSTANT_FIELD.
  • Enum values: same as constant fields, they are snake-cased and upper-cased.

Copy link
Member

@Martin-Molinero Martin-Molinero left a comment

Choose a reason for hiding this comment

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

Awesome work 💪 Minor comments shared


using var method = pyObj.GetAttr("another_int_property");
Assert.IsTrue(method.IsCallable());
Assert.AreEqual(654, method.Invoke().As<int>());
Copy link
Member

Choose a reason for hiding this comment

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

Nice work 👍

@jhonabreul jhonabreul merged commit 2d864c2 into QuantConnect:master Apr 11, 2024
0 of 21 checks passed
@jhonabreul jhonabreul deleted the feature-snake-case-names-binding branch April 11, 2024 19:48
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.

2 participants