File: scalarbool.py

package info (click to toggle)
python-dynaconf 3.2.12-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,900 kB
  • sloc: python: 21,464; sh: 9; makefile: 4
file content (19 lines) | stat: -rw-r--r-- 709 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from __future__ import print_function,absolute_import,division,unicode_literals
_A=False
from.anchor import Anchor
if _A:from typing import Text,Any,Dict,List
__all__=['ScalarBoolean']
class ScalarBoolean(int):
	def __new__(D,*E,**A):
		B=A.pop('anchor',None);C=int.__new__(D,*E,**A)
		if B is not None:C.yaml_set_anchor(B,always_dump=True)
		return C
	@property
	def anchor(self):
		A=self
		if not hasattr(A,Anchor.attrib):setattr(A,Anchor.attrib,Anchor())
		return getattr(A,Anchor.attrib)
	def yaml_anchor(A,any=_A):
		if not hasattr(A,Anchor.attrib):return
		if any or A.anchor.always_dump:return A.anchor
	def yaml_set_anchor(A,value,always_dump=_A):A.anchor.value=value;A.anchor.always_dump=always_dump