-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge commit 'b659b9adcdb70151cdba2ebb9e8c4c56e1fe71a2' into fix-sv-n…
…orm-type
- Loading branch information
Showing
24 changed files
with
459 additions
and
273 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
class EnumMetaProperties(type): | ||
""" | ||
This metaclass: | ||
- intercepts attempts to set *class* attributes, and rejects them. | ||
- NOTE: In the class or abstract class using this, you should also define an __init__() which raises | ||
an exception, to prevent instantiation. | ||
- defines the class string representation as being *just* the class name, without any fluff. | ||
Loosely based on carefully reviewed AI generated examples from Microsoft Copilot. | ||
""" | ||
|
||
def __setattr__(cls, name: str, value) -> None: | ||
raise AttributeError(f"Attributes of {cls} act as constants. Do not modify them.") | ||
|
||
def __repr__(cls) -> str: | ||
return f"{cls.__name__}" |
This file contains 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
Oops, something went wrong.