Skip to content

Commit

Permalink
Made _UndefinedType as a Singleton class. (#402)
Browse files Browse the repository at this point in the history
Co-authored-by: Alexander Maximenyuk <alex.maximenyuk@ccsteam.ru>
  • Loading branch information
alexhook and Alexander Maximenyuk committed Jun 22, 2023
1 parent dc234fb commit 06af540
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 65 deletions.
126 changes: 63 additions & 63 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion pybotx/missing.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
from typing import Literal, TypeVar, Union
from typing import Any, List, Literal, TypeVar, Union


class _UndefinedType:
"""For fields that can be skipped."""

_instances: List["_UndefinedType"] = []

def __new__(cls, *args: Any) -> "_UndefinedType":
if not cls._instances:
cls._instances.append(super().__new__(cls, *args))
return cls._instances[-1]

def __bool__(self) -> Literal[False]:
return False

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pybotx"
version = "0.55.5"
version = "0.55.6"
description = "A python library for interacting with eXpress BotX API"
authors = [
"Sidnev Nikolay <nsidnev@ccsteam.ru>",
Expand Down

0 comments on commit 06af540

Please sign in to comment.