question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

🐞 Types cased like Constants

See original GitHub issue

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

There are some types such as GUARDIAN_ID that are cased incorrectly. These variables function as types and not constants and therefore should be using “CapWords” since these are actually functioning as Type’s.

https://www.python.org/dev/peps/pep-0008/

Expected Behavior

Global Constants should be capitalized with underscores THRESHOLD = 3

Classes and Types should be like this: GuardianId = str

Steps To Reproduce

No response

Environment

- OS: Any

Anything else?

It’s probably helpful just to look at the types from this level for speed.

https://github.com/microsoft/electionguard-python/blob/main/src/electionguard/__init__.py https://github.com/microsoft/electionguard-python/blob/main/src/electionguard_tools/__init__.py https://github.com/microsoft/electionguard-python/blob/main/src/electionguard_verify/__init__.py

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
keithrfungcommented, Oct 26, 2021

@faraazb Interesting dilemma. That’s a good catch.

Change to Private In this case, I think the best case is to change these to private. These don’t need to be exported since these are simply strings and shouldn’t be cast. These types are strings and serving the purpose of making these more readable.

_AuxiliaryPublicKey _AuxiliarySecretKey _Message _EncryptedMessage

Other notes: There is probably an overall naming scheme around public key that should get revisited @AddressXception .

0reactions
faraazbcommented, Oct 26, 2021

@keithrfung There is already a class named AuxiliaryPublicKey. So should I postfix the type AUXILIARY_PUBLIC_KEY with ‘Type’ and rename it as AuxiliaryPublicKeyType? We also have AUXILIARY_SECRET_KEY, so should I append ‘Type’ to that as well to be consistent?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Programming Case Types !Explained | Nerd For Tech - Medium
1. camelCase ; 2. snake_case ; 3. kebab-case ; 4. PascalCase.
Read more >
type error when #Template variables is used in same element
When declaring a template variable using # and then using the template variable immediately within the element it is declared on I get...
Read more >
naming - What are the different kinds of cases? - Stack Overflow
There are many more colorful suggestions, like caterpillar-case, ... say that our variable is a constant) and PascalCase for class names.
Read more >
Think before using BuildConfig.DEBUG - ProAndroidDev
Last week I was working on a feature that syncs data between phone and backend. That sync mechanism is triggered under certain conditions ......
Read more >
Decoding of optionals missing in json - Swift Forums
I've never had a situation where it was dire to differentiate the “present but null” and “not present” situations, but in such cases...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found