| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| Expand Up | @@ -372,11 +372,6 @@ def __init__(self): | |
| Error.__init__(self, "Support for UNNAMED_SECTION is disabled.") | ||
|
|
||
|
|
||
| class _UnnamedSection: | ||
|
|
||
| def __repr__(self): | ||
| return "<UNNAMED_SECTION>" | ||
|
|
||
| class InvalidWriteError(Error): | ||
| """Raised when attempting to write data that the parser would read back differently. | ||
| ex: writing a key which begins with the section header pattern would read back as a | ||
| Expand All | @@ -386,13 +381,13 @@ def __init__(self, msg=''): | |
| Error.__init__(self, msg) | ||
|
|
||
|
|
||
| UNNAMED_SECTION = _UnnamedSection() | ||
| UNNAMED_SECTION = sentinel("UNNAMED_SECTION", repr="<UNNAMED_SECTION>") | ||
|
Comment thread
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityUNNAMED_SECTION is in the public API, it should not have obscure repr.
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityWhat would you prefer?
Sorry, something went wrong.
All reactions
|
||
|
|
||
|
|
||
| # Used in parser getters to indicate the default behaviour when a specific | ||
| # option is not found it to raise an exception. Created to enable `None` as | ||
| # a valid fallback value. | ||
| _UNSET = object() | ||
| _UNSET = sentinel("_UNSET", repr="<UNSET>") | ||
|
|
||
|
|
||
| class Interpolation: | ||
| Expand Down | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| Expand Up | @@ -1137,7 +1137,7 @@ def register(self): | |
| ### cached_property() - property result cached as instance attribute | ||
| ################################################################################ | ||
|
|
||
| _NOT_FOUND = object() | ||
| _NOT_FOUND = sentinel("_NOT_FOUND", repr="<not found>") | ||
|
Comment thread
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityIt is not visible to user. It can remain object().
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityI think it's still cleaner to use sentinel. Also, users inspecting the cache for debugging purposes can see this object.
Sorry, something went wrong.
All reactions
|
||
|
|
||
| class cached_property: | ||
| def __init__(self, func): | ||
| Expand Down | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Various private sentinels in the standard library are now instances of | ||
| :class:`sentinel`. |
| Back | FazBrowse Home | New Git URL |
There was a problem hiding this comment.
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 QualityWould not it be better to stick to some standard representation like <not specified> for sentinels only exposed in function signatures?
And why do we need a name for private sentinels? They are not supposed to be pickleable.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.