Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ uv.lock
.ropeproject
node_modules
mutants
.qwen
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Python's built-in [`None`](https://docs.python.org/3/library/constants.html#None

## The problem

Programmers encounter uncertainty everywhere. We [don't know](https://en.wikipedia.org/wiki/Semipredicate_problem) in advance whether a user will enter a valid value into a form, or whether a given operation on two numbers is possible. To highlight uncertainty as a separate entity, programmers have come up with so-called [sentinel objects](https://en.wikipedia.org/wiki/Sentinel_value). These can take many forms: [NULL](https://en.wikipedia.org/wiki/Null_pointer), [`None`](https://docs.python.org/3/library/constants.html#None), [nil](https://ru.wikipedia.org/wiki/Nil), [undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined), [NaN](https://en.wikipedia.org/wiki/NaN), and an infinite number of others.
Programmers encounter uncertainty everywhere. We [don't know](https://en.wikipedia.org/wiki/Semipredicate_problem) in advance whether a user will enter a valid value into a form, or whether a given operation on two numbers is possible. To highlight uncertainty as a separate entity, programmers have come up with so-called [sentinel objects](https://en.wikipedia.org/wiki/Sentinel_value). These can take many forms: [`NULL`](https://en.wikipedia.org/wiki/Null_pointer), [`None`](https://docs.python.org/3/library/constants.html#None), [`nil`](https://ru.wikipedia.org/wiki/Nil), [`undefined`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined), [`NaN`](https://en.wikipedia.org/wiki/NaN), and an infinite number of others.

Different programming languages and environments offer [different models](#analogs) for representing uncertainty as objects. This is usually related to how a particular language has evolved and what forms of uncertainty its users most often encounter. Broadly, I see [three](https://numberwarrior.wordpress.com/2010/07/30/is-one-two-many-a-myth/) main models:

Expand Down
4 changes: 2 additions & 2 deletions denial/inner.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import Any, Optional, Union

from locklib import ContextLockProtocol
from printo import describe_data_object, not_none
from printo import describe_call, not_none

from denial.errors import (
DoubleSingletonsInstantiationError,
Expand Down Expand Up @@ -48,7 +48,7 @@ def __hash__(self) -> int:
def __repr__(self) -> str:
if self.id == 0 and self.auto:
return 'InnerNone'
return describe_data_object(type(self).__name__, (self.id,), {'doc': self.doc, 'auto': self.auto}, filters={'auto': lambda x: x != True, 'doc': not_none})
return describe_call(type(self).__name__, [self.id], {'doc': self.doc, 'auto': self.auto}, filters={'auto': lambda x: x != True, 'doc': not_none})

def __bool__(self) -> bool:
return False
Expand Down
33 changes: 17 additions & 16 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
[build-system]
requires = ["setuptools==68.0.0"]
build-backend = "setuptools.build_meta"
requires = ['setuptools==68.0.0']
build-backend = 'setuptools.build_meta'

[project]
name = "denial"
version = "0.0.13"
authors = [{ name = "Evgeniy Blinov", email = "zheni-b@yandex.ru" }]
name = 'denial'
version = '0.0.14'
authors = [{ name = 'Evgeniy Blinov', email = 'zheni-b@yandex.ru' }]
description = "Is one None not enough for you? There's more"
readme = "README.md"
requires-python = ">=3.8"
readme = 'README.md'
requires-python = '>=3.8'
dependencies = [
'printo>=0.0.22',
'locklib>=0.0.20',
'printo>=0.0.27',
'locklib>=0.0.21',
'typing_extensions ; python_version <= "3.10"',
]
classifiers = [
"Operating System :: OS Independent",
'Operating System :: OS Independent',
'Operating System :: MacOS :: MacOS X',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX',
Expand All @@ -34,23 +34,24 @@ classifiers = [
'License :: OSI Approved :: MIT License',
'Intended Audience :: Developers',
'Topic :: Software Development :: Libraries',
'Typing :: Typed',
]
keywords = ['None', 'sentinel']

[tool.setuptools.package-data]
"denial" = ["py.typed"]
"denial" = ['py.typed']

[tool.mutmut]
paths_to_mutate = "denial"
runner = "pytest"
paths_to_mutate = 'denial'
runner = 'pytest'

[tool.pytest.ini_options]
markers = ["mypy_testing"]
markers = ['mypy_testing']

[tool.ruff]
lint.ignore = ['E501', 'E712', 'PTH123', 'PTH118', 'PLR2004', 'PTH107', 'SIM105', 'SIM102', 'RET503', 'PLR0912', 'C901']
lint.select = ["ERA001", "YTT", "ASYNC", "BLE", "B", "A", "COM", "INP", "PIE", "T20", "PT", "RSE", "RET", "SIM", "SLOT", "TID252", "ARG", "PTH", "I", "C90", "N", "E", "W", "D201", "D202", "D419", "F", "PL", "PLE", "PLR", "PLW", "RUF", "TRY201", "TRY400", "TRY401"]
format.quote-style = "single"
lint.select = ['ERA001', 'YTT', 'ASYNC', 'BLE', 'B', 'A', 'COM', 'INP', 'PIE', 'T20', 'PT', 'RSE', 'RET', 'SIM', 'SLOT', 'TID252', 'ARG', 'PTH', 'I', 'C90', 'N', 'E', 'W', 'D201', 'D202', 'D419', 'F', 'PL', 'PLE', 'PLR', 'PLW', 'RUF', 'TRY201', 'TRY400', 'TRY401']
format.quote-style = 'single'

[project.urls]
'Source' = 'https://github.com/mutating/denial'
Expand Down
Loading