FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

PEP8 compliant names binding by jhonabreul · Pull Request #83 · QuantConnect/pythonnet · GitHub

PEP8 compliant names binding - #83

Merged
jhonabreul merged 13 commits into
QuantConnect:masterfrom
jhonabreul:feature-snake-case-names-binding
Apr 11, 2024
Merged

PEP8 compliant names binding #83
jhonabreul merged 13 commits into
QuantConnect:masterfrom
jhonabreul:feature-snake-case-names-binding

Conversation

Copy link
Copy Markdown
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.

Martin-Molinero left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Nice work 👍

jhonabreul merged commit 2d864c2 into QuantConnect:master Apr 11, 2024
jhonabreul deleted the feature-snake-case-names-binding branch April 11, 2024 19:48
jhonabreul added a commit that referenced this pull request Jul 9, 2026
…hod (#133)

* Fix IndexOutOfRangeException on empty **kwargs call to overloaded method (#132)

Calling an overloaded method with an empty kwargs mapping (e.g.
obj.Method(arg, **{}), common when forwarding *args/**kwargs from a
wrapper) crashed with an unhandled IndexOutOfRangeException in
MethodBinder.CheckMethodArgumentsMatch. Since 10e721b (PR #83), the
parameter names array is only populated when there are named arguments,
but the kwargs code paths only checked the kwargs dictionary for null,
so a non-null empty dict indexed into an empty names array.

Treat an empty kwargs dict as no keyword arguments, matching Python
semantics where f(x, **{}) is equivalent to f(x).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Update version to 2.0.60

Bump package <Version>, AssemblyVersion/AssemblyFileVersion and the
perf-test baseline reference to 2.0.60.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL