ADAPT-Chase commited on
Commit
0ea1830
·
verified ·
1 Parent(s): bb282a4

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/humanfriendly/terminal/__pycache__/__init__.cpython-312.pyc +0 -0
  2. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/hyperframe/__pycache__/frame.cpython-312.pyc +0 -0
  3. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/completion/__init__.py +0 -0
  4. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/completion/__pycache__/__init__.cpython-312.pyc +0 -0
  5. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/completion/__pycache__/complete.cpython-312.pyc +0 -0
  6. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/completion/zsh.completion +33 -0
  7. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/parser/__pycache__/__init__.cpython-312.pyc +0 -0
  8. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/parser/__pycache__/argument.cpython-312.pyc +0 -0
  9. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/parser/__pycache__/context.cpython-312.pyc +0 -0
  10. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/parser/__pycache__/parser.cpython-312.pyc +0 -0
  11. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/parser/argument.py +178 -0
  12. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/parser/parser.py +455 -0
  13. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/__init__.py +0 -0
  14. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/__pycache__/__init__.cpython-312.pyc +0 -0
  15. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/fluidity/__init__.py +4 -0
  16. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/fluidity/__pycache__/__init__.cpython-312.pyc +0 -0
  17. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/fluidity/__pycache__/backwardscompat.cpython-312.pyc +0 -0
  18. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/fluidity/__pycache__/machine.cpython-312.pyc +0 -0
  19. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/fluidity/backwardscompat.py +8 -0
  20. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/fluidity/machine.py +270 -0
  21. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/lexicon/__init__.py +24 -0
  22. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/lexicon/__pycache__/__init__.cpython-312.pyc +0 -0
  23. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/lexicon/__pycache__/_version.cpython-312.pyc +0 -0
  24. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/lexicon/__pycache__/alias_dict.cpython-312.pyc +0 -0
  25. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/lexicon/__pycache__/attribute_dict.cpython-312.pyc +0 -0
  26. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/lexicon/_version.py +2 -0
  27. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/lexicon/alias_dict.py +95 -0
  28. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/lexicon/attribute_dict.py +16 -0
  29. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/__init__.py +427 -0
  30. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/__pycache__/__init__.cpython-312.pyc +0 -0
  31. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/__pycache__/composer.cpython-312.pyc +0 -0
  32. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/__pycache__/constructor.cpython-312.pyc +0 -0
  33. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/__pycache__/cyaml.cpython-312.pyc +0 -0
  34. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/__pycache__/dumper.cpython-312.pyc +0 -0
  35. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/__pycache__/emitter.cpython-312.pyc +0 -0
  36. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/__pycache__/error.cpython-312.pyc +0 -0
  37. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/__pycache__/events.cpython-312.pyc +0 -0
  38. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/__pycache__/loader.cpython-312.pyc +0 -0
  39. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/__pycache__/nodes.cpython-312.pyc +0 -0
  40. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/__pycache__/parser.cpython-312.pyc +0 -0
  41. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/__pycache__/reader.cpython-312.pyc +0 -0
  42. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/__pycache__/representer.cpython-312.pyc +0 -0
  43. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/__pycache__/resolver.cpython-312.pyc +0 -0
  44. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/__pycache__/scanner.cpython-312.pyc +0 -0
  45. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/__pycache__/serializer.cpython-312.pyc +0 -0
  46. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/__pycache__/tokens.cpython-312.pyc +0 -0
  47. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/composer.py +139 -0
  48. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/constructor.py +748 -0
  49. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/cyaml.py +101 -0
  50. platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/dumper.py +62 -0
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/humanfriendly/terminal/__pycache__/__init__.cpython-312.pyc ADDED
Binary file (30.8 kB). View file
 
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/hyperframe/__pycache__/frame.cpython-312.pyc ADDED
Binary file (40.1 kB). View file
 
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/completion/__init__.py ADDED
File without changes
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/completion/__pycache__/__init__.cpython-312.pyc ADDED
Binary file (170 Bytes). View file
 
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/completion/__pycache__/complete.cpython-312.pyc ADDED
Binary file (5.69 kB). View file
 
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/completion/zsh.completion ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Invoke tab-completion script to be sourced with the Z shell.
2
+ # Known to work on zsh 5.0.x, probably works on later 4.x releases as well (as
3
+ # it uses the older compctl completion system).
4
+
5
+ _complete_{binary}() {{
6
+ # `words` contains the entire command string up til now (including
7
+ # program name).
8
+ #
9
+ # We hand it to Invoke so it can figure out the current context: spit back
10
+ # core options, task names, the current task's options, or some combo.
11
+ #
12
+ # Before doing so, we attempt to tease out any collection flag+arg so we
13
+ # can ensure it is applied correctly.
14
+ collection_arg=''
15
+ if [[ "${{words}}" =~ "(-c|--collection) [^ ]+" ]]; then
16
+ collection_arg=$MATCH
17
+ fi
18
+ # `reply` is the array of valid completions handed back to `compctl`.
19
+ # Use ${{=...}} to force whitespace splitting in expansion of
20
+ # $collection_arg
21
+ reply=( $({binary} ${{=collection_arg}} --complete -- ${{words}}) )
22
+ }}
23
+
24
+
25
+ # Tell shell builtin to use the above for completing our given binary name(s).
26
+ # * -K: use given function name to generate completions.
27
+ # * +: specifies 'alternative' completion, where options after the '+' are only
28
+ # used if the completion from the options before the '+' result in no matches.
29
+ # * -f: when function generates no results, use filenames.
30
+ # * positional args: program names to complete for.
31
+ compctl -K _complete_{binary} + -f {spaced_names}
32
+
33
+ # vim: set ft=sh :
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/parser/__pycache__/__init__.cpython-312.pyc ADDED
Binary file (366 Bytes). View file
 
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/parser/__pycache__/argument.cpython-312.pyc ADDED
Binary file (7.45 kB). View file
 
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/parser/__pycache__/context.cpython-312.pyc ADDED
Binary file (12.5 kB). View file
 
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/parser/__pycache__/parser.cpython-312.pyc ADDED
Binary file (20.4 kB). View file
 
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/parser/argument.py ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Any, Iterable, Optional, Tuple
2
+
3
+ # TODO: dynamic type for kind
4
+ # T = TypeVar('T')
5
+
6
+
7
+ class Argument:
8
+ """
9
+ A command-line argument/flag.
10
+
11
+ :param name:
12
+ Syntactic sugar for ``names=[<name>]``. Giving both ``name`` and
13
+ ``names`` is invalid.
14
+ :param names:
15
+ List of valid identifiers for this argument. For example, a "help"
16
+ argument may be defined with a name list of ``['-h', '--help']``.
17
+ :param kind:
18
+ Type factory & parser hint. E.g. ``int`` will turn the default text
19
+ value parsed, into a Python integer; and ``bool`` will tell the
20
+ parser not to expect an actual value but to treat the argument as a
21
+ toggle/flag.
22
+ :param default:
23
+ Default value made available to the parser if no value is given on the
24
+ command line.
25
+ :param help:
26
+ Help text, intended for use with ``--help``.
27
+ :param positional:
28
+ Whether or not this argument's value may be given positionally. When
29
+ ``False`` (default) arguments must be explicitly named.
30
+ :param optional:
31
+ Whether or not this (non-``bool``) argument requires a value.
32
+ :param incrementable:
33
+ Whether or not this (``int``) argument is to be incremented instead of
34
+ overwritten/assigned to.
35
+ :param attr_name:
36
+ A Python identifier/attribute friendly name, typically filled in with
37
+ the underscored version when ``name``/``names`` contain dashes.
38
+
39
+ .. versionadded:: 1.0
40
+ """
41
+
42
+ def __init__(
43
+ self,
44
+ name: Optional[str] = None,
45
+ names: Iterable[str] = (),
46
+ kind: Any = str,
47
+ default: Optional[Any] = None,
48
+ help: Optional[str] = None,
49
+ positional: bool = False,
50
+ optional: bool = False,
51
+ incrementable: bool = False,
52
+ attr_name: Optional[str] = None,
53
+ ) -> None:
54
+ if name and names:
55
+ raise TypeError(
56
+ "Cannot give both 'name' and 'names' arguments! Pick one."
57
+ )
58
+ if not (name or names):
59
+ raise TypeError("An Argument must have at least one name.")
60
+ if names:
61
+ self.names = tuple(names)
62
+ elif name and not names:
63
+ self.names = (name,)
64
+ self.kind = kind
65
+ initial_value: Optional[Any] = None
66
+ # Special case: list-type args start out as empty list, not None.
67
+ if kind is list:
68
+ initial_value = []
69
+ # Another: incrementable args start out as their default value.
70
+ if incrementable:
71
+ initial_value = default
72
+ self.raw_value = self._value = initial_value
73
+ self.default = default
74
+ self.help = help
75
+ self.positional = positional
76
+ self.optional = optional
77
+ self.incrementable = incrementable
78
+ self.attr_name = attr_name
79
+
80
+ def __repr__(self) -> str:
81
+ nicks = ""
82
+ if self.nicknames:
83
+ nicks = " ({})".format(", ".join(self.nicknames))
84
+ flags = ""
85
+ if self.positional or self.optional:
86
+ flags = " "
87
+ if self.positional:
88
+ flags += "*"
89
+ if self.optional:
90
+ flags += "?"
91
+ # TODO: store this default value somewhere other than signature of
92
+ # Argument.__init__?
93
+ kind = ""
94
+ if self.kind != str:
95
+ kind = " [{}]".format(self.kind.__name__)
96
+ return "<{}: {}{}{}{}>".format(
97
+ self.__class__.__name__, self.name, nicks, kind, flags
98
+ )
99
+
100
+ @property
101
+ def name(self) -> Optional[str]:
102
+ """
103
+ The canonical attribute-friendly name for this argument.
104
+
105
+ Will be ``attr_name`` (if given to constructor) or the first name in
106
+ ``names`` otherwise.
107
+
108
+ .. versionadded:: 1.0
109
+ """
110
+ return self.attr_name or self.names[0]
111
+
112
+ @property
113
+ def nicknames(self) -> Tuple[str, ...]:
114
+ return self.names[1:]
115
+
116
+ @property
117
+ def takes_value(self) -> bool:
118
+ if self.kind is bool:
119
+ return False
120
+ if self.incrementable:
121
+ return False
122
+ return True
123
+
124
+ @property
125
+ def value(self) -> Any:
126
+ # TODO: should probably be optional instead
127
+ return self._value if self._value is not None else self.default
128
+
129
+ @value.setter
130
+ def value(self, arg: str) -> None:
131
+ self.set_value(arg, cast=True)
132
+
133
+ def set_value(self, value: Any, cast: bool = True) -> None:
134
+ """
135
+ Actual explicit value-setting API call.
136
+
137
+ Sets ``self.raw_value`` to ``value`` directly.
138
+
139
+ Sets ``self.value`` to ``self.kind(value)``, unless:
140
+
141
+ - ``cast=False``, in which case the raw value is also used.
142
+ - ``self.kind==list``, in which case the value is appended to
143
+ ``self.value`` instead of cast & overwritten.
144
+ - ``self.incrementable==True``, in which case the value is ignored and
145
+ the current (assumed int) value is simply incremented.
146
+
147
+ .. versionadded:: 1.0
148
+ """
149
+ self.raw_value = value
150
+ # Default to do-nothing/identity function
151
+ func = lambda x: x
152
+ # If cast, set to self.kind, which should be str/int/etc
153
+ if cast:
154
+ func = self.kind
155
+ # If self.kind is a list, append instead of using cast func.
156
+ if self.kind is list:
157
+ func = lambda x: self.value + [x]
158
+ # If incrementable, just increment.
159
+ if self.incrementable:
160
+ # TODO: explode nicely if self.value was not an int to start
161
+ # with
162
+ func = lambda x: self.value + 1
163
+ self._value = func(value)
164
+
165
+ @property
166
+ def got_value(self) -> bool:
167
+ """
168
+ Returns whether the argument was ever given a (non-default) value.
169
+
170
+ For most argument kinds, this simply checks whether the internally
171
+ stored value is non-``None``; for others, such as ``list`` kinds,
172
+ different checks may be used.
173
+
174
+ .. versionadded:: 1.3
175
+ """
176
+ if self.kind is list:
177
+ return bool(self._value)
178
+ return self._value is not None
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/parser/parser.py ADDED
@@ -0,0 +1,455 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import copy
2
+ from typing import TYPE_CHECKING, Any, Iterable, List, Optional
3
+
4
+ try:
5
+ from ..vendor.lexicon import Lexicon
6
+ from ..vendor.fluidity import StateMachine, state, transition
7
+ except ImportError:
8
+ from lexicon import Lexicon # type: ignore[no-redef]
9
+ from fluidity import ( # type: ignore[no-redef]
10
+ StateMachine,
11
+ state,
12
+ transition,
13
+ )
14
+
15
+ from ..exceptions import ParseError
16
+ from ..util import debug
17
+
18
+ if TYPE_CHECKING:
19
+ from .context import ParserContext
20
+
21
+
22
+ def is_flag(value: str) -> bool:
23
+ return value.startswith("-")
24
+
25
+
26
+ def is_long_flag(value: str) -> bool:
27
+ return value.startswith("--")
28
+
29
+
30
+ class ParseResult(List["ParserContext"]):
31
+ """
32
+ List-like object with some extra parse-related attributes.
33
+
34
+ Specifically, a ``.remainder`` attribute, which is the string found after a
35
+ ``--`` in any parsed argv list; and an ``.unparsed`` attribute, a list of
36
+ tokens that were unable to be parsed.
37
+
38
+ .. versionadded:: 1.0
39
+ """
40
+
41
+ def __init__(self, *args: Any, **kwargs: Any) -> None:
42
+ super().__init__(*args, **kwargs)
43
+ self.remainder = ""
44
+ self.unparsed: List[str] = []
45
+
46
+
47
+ class Parser:
48
+ """
49
+ Create parser conscious of ``contexts`` and optional ``initial`` context.
50
+
51
+ ``contexts`` should be an iterable of ``Context`` instances which will be
52
+ searched when new context names are encountered during a parse. These
53
+ Contexts determine what flags may follow them, as well as whether given
54
+ flags take values.
55
+
56
+ ``initial`` is optional and will be used to determine validity of "core"
57
+ options/flags at the start of the parse run, if any are encountered.
58
+
59
+ ``ignore_unknown`` determines what to do when contexts are found which do
60
+ not map to any members of ``contexts``. By default it is ``False``, meaning
61
+ any unknown contexts result in a parse error exception. If ``True``,
62
+ encountering an unknown context halts parsing and populates the return
63
+ value's ``.unparsed`` attribute with the remaining parse tokens.
64
+
65
+ .. versionadded:: 1.0
66
+ """
67
+
68
+ def __init__(
69
+ self,
70
+ contexts: Iterable["ParserContext"] = (),
71
+ initial: Optional["ParserContext"] = None,
72
+ ignore_unknown: bool = False,
73
+ ) -> None:
74
+ self.initial = initial
75
+ self.contexts = Lexicon()
76
+ self.ignore_unknown = ignore_unknown
77
+ for context in contexts:
78
+ debug("Adding {}".format(context))
79
+ if not context.name:
80
+ raise ValueError("Non-initial contexts must have names.")
81
+ exists = "A context named/aliased {!r} is already in this parser!"
82
+ if context.name in self.contexts:
83
+ raise ValueError(exists.format(context.name))
84
+ self.contexts[context.name] = context
85
+ for alias in context.aliases:
86
+ if alias in self.contexts:
87
+ raise ValueError(exists.format(alias))
88
+ self.contexts.alias(alias, to=context.name)
89
+
90
+ def parse_argv(self, argv: List[str]) -> ParseResult:
91
+ """
92
+ Parse an argv-style token list ``argv``.
93
+
94
+ Returns a list (actually a subclass, `.ParseResult`) of
95
+ `.ParserContext` objects matching the order they were found in the
96
+ ``argv`` and containing `.Argument` objects with updated values based
97
+ on any flags given.
98
+
99
+ Assumes any program name has already been stripped out. Good::
100
+
101
+ Parser(...).parse_argv(['--core-opt', 'task', '--task-opt'])
102
+
103
+ Bad::
104
+
105
+ Parser(...).parse_argv(['invoke', '--core-opt', ...])
106
+
107
+ :param argv: List of argument string tokens.
108
+ :returns:
109
+ A `.ParseResult` (a ``list`` subclass containing some number of
110
+ `.ParserContext` objects).
111
+
112
+ .. versionadded:: 1.0
113
+ """
114
+ machine = ParseMachine(
115
+ # FIXME: initial should not be none
116
+ initial=self.initial, # type: ignore[arg-type]
117
+ contexts=self.contexts,
118
+ ignore_unknown=self.ignore_unknown,
119
+ )
120
+ # FIXME: Why isn't there str.partition for lists? There must be a
121
+ # better way to do this. Split argv around the double-dash remainder
122
+ # sentinel.
123
+ debug("Starting argv: {!r}".format(argv))
124
+ try:
125
+ ddash = argv.index("--")
126
+ except ValueError:
127
+ ddash = len(argv) # No remainder == body gets all
128
+ body = argv[:ddash]
129
+ remainder = argv[ddash:][1:] # [1:] to strip off remainder itself
130
+ if remainder:
131
+ debug(
132
+ "Remainder: argv[{!r}:][1:] => {!r}".format(ddash, remainder)
133
+ )
134
+ for index, token in enumerate(body):
135
+ # Handle non-space-delimited forms, if not currently expecting a
136
+ # flag value and still in valid parsing territory (i.e. not in
137
+ # "unknown" state which implies store-only)
138
+ # NOTE: we do this in a few steps so we can
139
+ # split-then-check-validity; necessary for things like when the
140
+ # previously seen flag optionally takes a value.
141
+ mutations = []
142
+ orig = token
143
+ if is_flag(token) and not machine.result.unparsed:
144
+ # Equals-sign-delimited flags, eg --foo=bar or -f=bar
145
+ if "=" in token:
146
+ token, _, value = token.partition("=")
147
+ msg = "Splitting x=y expr {!r} into tokens {!r} and {!r}"
148
+ debug(msg.format(orig, token, value))
149
+ mutations.append((index + 1, value))
150
+ # Contiguous boolean short flags, e.g. -qv
151
+ elif not is_long_flag(token) and len(token) > 2:
152
+ full_token = token[:]
153
+ rest, token = token[2:], token[:2]
154
+ err = "Splitting {!r} into token {!r} and rest {!r}"
155
+ debug(err.format(full_token, token, rest))
156
+ # Handle boolean flag block vs short-flag + value. Make
157
+ # sure not to test the token as a context flag if we've
158
+ # passed into 'storing unknown stuff' territory (e.g. on a
159
+ # core-args pass, handling what are going to be task args)
160
+ have_flag = (
161
+ token in machine.context.flags
162
+ and machine.current_state != "unknown"
163
+ )
164
+ if have_flag and machine.context.flags[token].takes_value:
165
+ msg = "{!r} is a flag for current context & it takes a value, giving it {!r}" # noqa
166
+ debug(msg.format(token, rest))
167
+ mutations.append((index + 1, rest))
168
+ else:
169
+ _rest = ["-{}".format(x) for x in rest]
170
+ msg = "Splitting multi-flag glob {!r} into {!r} and {!r}" # noqa
171
+ debug(msg.format(orig, token, _rest))
172
+ for item in reversed(_rest):
173
+ mutations.append((index + 1, item))
174
+ # Here, we've got some possible mutations queued up, and 'token'
175
+ # may have been overwritten as well. Whether we apply those and
176
+ # continue as-is, or roll it back, depends:
177
+ # - If the parser wasn't waiting for a flag value, we're already on
178
+ # the right track, so apply mutations and move along to the
179
+ # handle() step.
180
+ # - If we ARE waiting for a value, and the flag expecting it ALWAYS
181
+ # wants a value (it's not optional), we go back to using the
182
+ # original token. (TODO: could reorganize this to avoid the
183
+ # sub-parsing in this case, but optimizing for human-facing
184
+ # execution isn't critical.)
185
+ # - Finally, if we are waiting for a value AND it's optional, we
186
+ # inspect the first sub-token/mutation to see if it would otherwise
187
+ # have been a valid flag, and let that determine what we do (if
188
+ # valid, we apply the mutations; if invalid, we reinstate the
189
+ # original token.)
190
+ if machine.waiting_for_flag_value:
191
+ optional = machine.flag and machine.flag.optional
192
+ subtoken_is_valid_flag = token in machine.context.flags
193
+ if not (optional and subtoken_is_valid_flag):
194
+ token = orig
195
+ mutations = []
196
+ for index, value in mutations:
197
+ body.insert(index, value)
198
+ machine.handle(token)
199
+ machine.finish()
200
+ result = machine.result
201
+ result.remainder = " ".join(remainder)
202
+ return result
203
+
204
+
205
+ class ParseMachine(StateMachine):
206
+ initial_state = "context"
207
+
208
+ state("context", enter=["complete_flag", "complete_context"])
209
+ state("unknown", enter=["complete_flag", "complete_context"])
210
+ state("end", enter=["complete_flag", "complete_context"])
211
+
212
+ transition(from_=("context", "unknown"), event="finish", to="end")
213
+ transition(
214
+ from_="context",
215
+ event="see_context",
216
+ action="switch_to_context",
217
+ to="context",
218
+ )
219
+ transition(
220
+ from_=("context", "unknown"),
221
+ event="see_unknown",
222
+ action="store_only",
223
+ to="unknown",
224
+ )
225
+
226
+ def changing_state(self, from_: str, to: str) -> None:
227
+ debug("ParseMachine: {!r} => {!r}".format(from_, to))
228
+
229
+ def __init__(
230
+ self,
231
+ initial: "ParserContext",
232
+ contexts: Lexicon,
233
+ ignore_unknown: bool,
234
+ ) -> None:
235
+ # Initialize
236
+ self.ignore_unknown = ignore_unknown
237
+ self.initial = self.context = copy.deepcopy(initial)
238
+ debug("Initialized with context: {!r}".format(self.context))
239
+ self.flag = None
240
+ self.flag_got_value = False
241
+ self.result = ParseResult()
242
+ self.contexts = copy.deepcopy(contexts)
243
+ debug("Available contexts: {!r}".format(self.contexts))
244
+ # In case StateMachine does anything in __init__
245
+ super().__init__()
246
+
247
+ @property
248
+ def waiting_for_flag_value(self) -> bool:
249
+ # Do we have a current flag, and does it expect a value (vs being a
250
+ # bool/toggle)?
251
+ takes_value = self.flag and self.flag.takes_value
252
+ if not takes_value:
253
+ return False
254
+ # OK, this flag is one that takes values.
255
+ # Is it a list type (which has only just been switched to)? Then it'll
256
+ # always accept more values.
257
+ # TODO: how to handle somebody wanting it to be some other iterable
258
+ # like tuple or custom class? Or do we just say unsupported?
259
+ if self.flag.kind is list and not self.flag_got_value:
260
+ return True
261
+ # Not a list, okay. Does it already have a value?
262
+ has_value = self.flag.raw_value is not None
263
+ # If it doesn't have one, we're waiting for one (which tells the parser
264
+ # how to proceed and typically to store the next token.)
265
+ # TODO: in the negative case here, we should do something else instead:
266
+ # - Except, "hey you screwed up, you already gave that flag!"
267
+ # - Overwrite, "oh you changed your mind?" - which requires more work
268
+ # elsewhere too, unfortunately. (Perhaps additional properties on
269
+ # Argument that can be queried, e.g. "arg.is_iterable"?)
270
+ return not has_value
271
+
272
+ def handle(self, token: str) -> None:
273
+ debug("Handling token: {!r}".format(token))
274
+ # Handle unknown state at the top: we don't care about even
275
+ # possibly-valid input if we've encountered unknown input.
276
+ if self.current_state == "unknown":
277
+ debug("Top-of-handle() see_unknown({!r})".format(token))
278
+ self.see_unknown(token)
279
+ return
280
+ # Flag
281
+ if self.context and token in self.context.flags:
282
+ debug("Saw flag {!r}".format(token))
283
+ self.switch_to_flag(token)
284
+ elif self.context and token in self.context.inverse_flags:
285
+ debug("Saw inverse flag {!r}".format(token))
286
+ self.switch_to_flag(token, inverse=True)
287
+ # Value for current flag
288
+ elif self.waiting_for_flag_value:
289
+ debug(
290
+ "We're waiting for a flag value so {!r} must be it?".format(
291
+ token
292
+ )
293
+ ) # noqa
294
+ self.see_value(token)
295
+ # Positional args (must come above context-name check in case we still
296
+ # need a posarg and the user legitimately wants to give it a value that
297
+ # just happens to be a valid context name.)
298
+ elif self.context and self.context.missing_positional_args:
299
+ msg = "Context {!r} requires positional args, eating {!r}"
300
+ debug(msg.format(self.context, token))
301
+ self.see_positional_arg(token)
302
+ # New context
303
+ elif token in self.contexts:
304
+ self.see_context(token)
305
+ # Initial-context flag being given as per-task flag (e.g. --help)
306
+ elif self.initial and token in self.initial.flags:
307
+ debug("Saw (initial-context) flag {!r}".format(token))
308
+ flag = self.initial.flags[token]
309
+ # Special-case for core --help flag: context name is used as value.
310
+ if flag.name == "help":
311
+ flag.value = self.context.name
312
+ msg = "Saw --help in a per-task context, setting task name ({!r}) as its value" # noqa
313
+ debug(msg.format(flag.value))
314
+ # All others: just enter the 'switch to flag' parser state
315
+ else:
316
+ # TODO: handle inverse core flags too? There are none at the
317
+ # moment (e.g. --no-dedupe is actually 'no_dedupe', not a
318
+ # default-False 'dedupe') and it's up to us whether we actually
319
+ # put any in place.
320
+ self.switch_to_flag(token)
321
+ # Unknown
322
+ else:
323
+ if not self.ignore_unknown:
324
+ debug("Can't find context named {!r}, erroring".format(token))
325
+ self.error("No idea what {!r} is!".format(token))
326
+ else:
327
+ debug("Bottom-of-handle() see_unknown({!r})".format(token))
328
+ self.see_unknown(token)
329
+
330
+ def store_only(self, token: str) -> None:
331
+ # Start off the unparsed list
332
+ debug("Storing unknown token {!r}".format(token))
333
+ self.result.unparsed.append(token)
334
+
335
+ def complete_context(self) -> None:
336
+ debug(
337
+ "Wrapping up context {!r}".format(
338
+ self.context.name if self.context else self.context
339
+ )
340
+ )
341
+ # Ensure all of context's positional args have been given.
342
+ if self.context and self.context.missing_positional_args:
343
+ err = "'{}' did not receive required positional arguments: {}"
344
+ names = ", ".join(
345
+ "'{}'".format(x.name)
346
+ for x in self.context.missing_positional_args
347
+ )
348
+ self.error(err.format(self.context.name, names))
349
+ if self.context and self.context not in self.result:
350
+ self.result.append(self.context)
351
+
352
+ def switch_to_context(self, name: str) -> None:
353
+ self.context = copy.deepcopy(self.contexts[name])
354
+ debug("Moving to context {!r}".format(name))
355
+ debug("Context args: {!r}".format(self.context.args))
356
+ debug("Context flags: {!r}".format(self.context.flags))
357
+ debug("Context inverse_flags: {!r}".format(self.context.inverse_flags))
358
+
359
+ def complete_flag(self) -> None:
360
+ if self.flag:
361
+ msg = "Completing current flag {} before moving on"
362
+ debug(msg.format(self.flag))
363
+ # Barf if we needed a value and didn't get one
364
+ if (
365
+ self.flag
366
+ and self.flag.takes_value
367
+ and self.flag.raw_value is None
368
+ and not self.flag.optional
369
+ ):
370
+ err = "Flag {!r} needed value and was not given one!"
371
+ self.error(err.format(self.flag))
372
+ # Handle optional-value flags; at this point they were not given an
373
+ # explicit value, but they were seen, ergo they should get treated like
374
+ # bools.
375
+ if self.flag and self.flag.raw_value is None and self.flag.optional:
376
+ msg = "Saw optional flag {!r} go by w/ no value; setting to True"
377
+ debug(msg.format(self.flag.name))
378
+ # Skip casting so the bool gets preserved
379
+ self.flag.set_value(True, cast=False)
380
+
381
+ def check_ambiguity(self, value: Any) -> bool:
382
+ """
383
+ Guard against ambiguity when current flag takes an optional value.
384
+
385
+ .. versionadded:: 1.0
386
+ """
387
+ # No flag is currently being examined, or one is but it doesn't take an
388
+ # optional value? Ambiguity isn't possible.
389
+ if not (self.flag and self.flag.optional):
390
+ return False
391
+ # We *are* dealing with an optional-value flag, but it's already
392
+ # received a value? There can't be ambiguity here either.
393
+ if self.flag.raw_value is not None:
394
+ return False
395
+ # Otherwise, there *may* be ambiguity if 1 or more of the below tests
396
+ # fail.
397
+ tests = []
398
+ # Unfilled posargs still exist?
399
+ tests.append(self.context and self.context.missing_positional_args)
400
+ # Value matches another valid task/context name?
401
+ tests.append(value in self.contexts)
402
+ if any(tests):
403
+ msg = "{!r} is ambiguous when given after an optional-value flag"
404
+ raise ParseError(msg.format(value))
405
+
406
+ def switch_to_flag(self, flag: str, inverse: bool = False) -> None:
407
+ # Sanity check for ambiguity w/ prior optional-value flag
408
+ self.check_ambiguity(flag)
409
+ # Also tie it off, in case prior had optional value or etc. Seems to be
410
+ # harmless for other kinds of flags. (TODO: this is a serious indicator
411
+ # that we need to move some of this flag-by-flag bookkeeping into the
412
+ # state machine bits, if possible - as-is it was REAL confusing re: why
413
+ # this was manually required!)
414
+ self.complete_flag()
415
+ # Set flag/arg obj
416
+ flag = self.context.inverse_flags[flag] if inverse else flag
417
+ # Update state
418
+ try:
419
+ self.flag = self.context.flags[flag]
420
+ except KeyError as e:
421
+ # Try fallback to initial/core flag
422
+ try:
423
+ self.flag = self.initial.flags[flag]
424
+ except KeyError:
425
+ # If it wasn't in either, raise the original context's
426
+ # exception, as that's more useful / correct.
427
+ raise e
428
+ debug("Moving to flag {!r}".format(self.flag))
429
+ # Bookkeeping for iterable-type flags (where the typical 'value
430
+ # non-empty/nondefault -> clearly it got its value already' test is
431
+ # insufficient)
432
+ self.flag_got_value = False
433
+ # Handle boolean flags (which can immediately be updated)
434
+ if self.flag and not self.flag.takes_value:
435
+ val = not inverse
436
+ debug("Marking seen flag {!r} as {}".format(self.flag, val))
437
+ self.flag.value = val
438
+
439
+ def see_value(self, value: Any) -> None:
440
+ self.check_ambiguity(value)
441
+ if self.flag and self.flag.takes_value:
442
+ debug("Setting flag {!r} to value {!r}".format(self.flag, value))
443
+ self.flag.value = value
444
+ self.flag_got_value = True
445
+ else:
446
+ self.error("Flag {!r} doesn't take any value!".format(self.flag))
447
+
448
+ def see_positional_arg(self, value: Any) -> None:
449
+ for arg in self.context.positional_args:
450
+ if arg.value is None:
451
+ arg.value = value
452
+ break
453
+
454
+ def error(self, msg: str) -> None:
455
+ raise ParseError(msg, self.context)
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/__init__.py ADDED
File without changes
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/__pycache__/__init__.cpython-312.pyc ADDED
Binary file (166 Bytes). View file
 
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/fluidity/__init__.py ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ from .machine import (StateMachine, state, transition,
2
+ InvalidConfiguration, InvalidTransition,
3
+ GuardNotSatisfied, ForkedTransition)
4
+
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/fluidity/__pycache__/__init__.cpython-312.pyc ADDED
Binary file (388 Bytes). View file
 
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/fluidity/__pycache__/backwardscompat.cpython-312.pyc ADDED
Binary file (432 Bytes). View file
 
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/fluidity/__pycache__/machine.cpython-312.pyc ADDED
Binary file (16.5 kB). View file
 
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/fluidity/backwardscompat.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ import sys
2
+
3
+ if sys.version_info >= (3,):
4
+ def callable(obj):
5
+ return hasattr(obj, '__call__')
6
+ else:
7
+ callable = callable
8
+
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/fluidity/machine.py ADDED
@@ -0,0 +1,270 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import re
2
+ import inspect
3
+ from .backwardscompat import callable
4
+
5
+ # metaclass implementation idea from
6
+ # http://blog.ianbicking.org/more-on-python-metaprogramming-comment-14.html
7
+ _transition_gatherer = []
8
+
9
+ def transition(event, from_, to, action=None, guard=None):
10
+ _transition_gatherer.append([event, from_, to, action, guard])
11
+
12
+ _state_gatherer = []
13
+
14
+ def state(name, enter=None, exit=None):
15
+ _state_gatherer.append([name, enter, exit])
16
+
17
+
18
+ class MetaStateMachine(type):
19
+
20
+ def __new__(cls, name, bases, dictionary):
21
+ global _transition_gatherer, _state_gatherer
22
+ Machine = super(MetaStateMachine, cls).__new__(cls, name, bases, dictionary)
23
+ Machine._class_transitions = []
24
+ Machine._class_states = {}
25
+ for s in _state_gatherer:
26
+ Machine._add_class_state(*s)
27
+ for i in _transition_gatherer:
28
+ Machine._add_class_transition(*i)
29
+ _transition_gatherer = []
30
+ _state_gatherer = []
31
+ return Machine
32
+
33
+
34
+ StateMachineBase = MetaStateMachine('StateMachineBase', (object, ), {})
35
+
36
+
37
+ class StateMachine(StateMachineBase):
38
+
39
+ def __init__(self):
40
+ self._bring_definitions_to_object_level()
41
+ self._inject_into_parts()
42
+ self._validate_machine_definitions()
43
+ if callable(self.initial_state):
44
+ self.initial_state = self.initial_state()
45
+ self._current_state_object = self._state_by_name(self.initial_state)
46
+ self._current_state_object.run_enter(self)
47
+ self._create_state_getters()
48
+
49
+ def __new__(cls, *args, **kwargs):
50
+ obj = super(StateMachine, cls).__new__(cls)
51
+ obj._states = {}
52
+ obj._transitions = []
53
+ return obj
54
+
55
+ def _bring_definitions_to_object_level(self):
56
+ self._states.update(self.__class__._class_states)
57
+ self._transitions.extend(self.__class__._class_transitions)
58
+
59
+ def _inject_into_parts(self):
60
+ for collection in [self._states.values(), self._transitions]:
61
+ for component in collection:
62
+ component.machine = self
63
+
64
+ def _validate_machine_definitions(self):
65
+ if len(self._states) < 2:
66
+ raise InvalidConfiguration('There must be at least two states')
67
+ if not getattr(self, 'initial_state', None):
68
+ raise InvalidConfiguration('There must exist an initial state')
69
+
70
+ @classmethod
71
+ def _add_class_state(cls, name, enter, exit):
72
+ cls._class_states[name] = _State(name, enter, exit)
73
+
74
+ def add_state(self, name, enter=None, exit=None):
75
+ state = _State(name, enter, exit)
76
+ setattr(self, state.getter_name(), state.getter_method().__get__(self, self.__class__))
77
+ self._states[name] = state
78
+
79
+ def _current_state_name(self):
80
+ return self._current_state_object.name
81
+
82
+ current_state = property(_current_state_name)
83
+
84
+ def changing_state(self, from_, to):
85
+ """
86
+ This method is called whenever a state change is executed
87
+ """
88
+ pass
89
+
90
+ def _new_state(self, state):
91
+ self.changing_state(self._current_state_object.name, state.name)
92
+ self._current_state_object = state
93
+
94
+ def _state_objects(self):
95
+ return list(self._states.values())
96
+
97
+ def states(self):
98
+ return [s.name for s in self._state_objects()]
99
+
100
+ @classmethod
101
+ def _add_class_transition(cls, event, from_, to, action, guard):
102
+ transition = _Transition(event, [cls._class_states[s] for s in _listize(from_)],
103
+ cls._class_states[to], action, guard)
104
+ cls._class_transitions.append(transition)
105
+ setattr(cls, event, transition.event_method())
106
+
107
+ def add_transition(self, event, from_, to, action=None, guard=None):
108
+ transition = _Transition(event, [self._state_by_name(s) for s in _listize(from_)],
109
+ self._state_by_name(to), action, guard)
110
+ self._transitions.append(transition)
111
+ setattr(self, event, transition.event_method().__get__(self, self.__class__))
112
+
113
+ def _process_transitions(self, event_name, *args, **kwargs):
114
+ transitions = self._transitions_by_name(event_name)
115
+ transitions = self._ensure_from_validity(transitions)
116
+ this_transition = self._check_guards(transitions)
117
+ this_transition.run(self, *args, **kwargs)
118
+
119
+ def _create_state_getters(self):
120
+ for state in self._state_objects():
121
+ setattr(self, state.getter_name(), state.getter_method().__get__(self, self.__class__))
122
+
123
+ def _state_by_name(self, name):
124
+ for state in self._state_objects():
125
+ if state.name == name:
126
+ return state
127
+
128
+ def _transitions_by_name(self, name):
129
+ return list(filter(lambda transition: transition.event == name, self._transitions))
130
+
131
+ def _ensure_from_validity(self, transitions):
132
+ valid_transitions = list(filter(
133
+ lambda transition: transition.is_valid_from(self._current_state_object),
134
+ transitions))
135
+ if len(valid_transitions) == 0:
136
+ raise InvalidTransition("Cannot %s from %s" % (
137
+ transitions[0].event, self.current_state))
138
+ return valid_transitions
139
+
140
+ def _check_guards(self, transitions):
141
+ allowed_transitions = []
142
+ for transition in transitions:
143
+ if transition.check_guard(self):
144
+ allowed_transitions.append(transition)
145
+ if len(allowed_transitions) == 0:
146
+ raise GuardNotSatisfied("Guard is not satisfied for this transition")
147
+ elif len(allowed_transitions) > 1:
148
+ raise ForkedTransition("More than one transition was allowed for this event")
149
+ return allowed_transitions[0]
150
+
151
+
152
+ class _Transition(object):
153
+
154
+ def __init__(self, event, from_, to, action, guard):
155
+ self.event = event
156
+ self.from_ = from_
157
+ self.to = to
158
+ self.action = action
159
+ self.guard = _Guard(guard)
160
+
161
+ def event_method(self):
162
+ def generated_event(machine, *args, **kwargs):
163
+ these_transitions = machine._process_transitions(self.event, *args, **kwargs)
164
+ generated_event.__doc__ = 'event %s' % self.event
165
+ generated_event.__name__ = self.event
166
+ return generated_event
167
+
168
+ def is_valid_from(self, from_):
169
+ return from_ in _listize(self.from_)
170
+
171
+ def check_guard(self, machine):
172
+ return self.guard.check(machine)
173
+
174
+ def run(self, machine, *args, **kwargs):
175
+ machine._current_state_object.run_exit(machine)
176
+ machine._new_state(self.to)
177
+ self.to.run_enter(machine)
178
+ _ActionRunner(machine).run(self.action, *args, **kwargs)
179
+
180
+
181
+ class _Guard(object):
182
+
183
+ def __init__(self, action):
184
+ self.action = action
185
+
186
+ def check(self, machine):
187
+ if self.action is None:
188
+ return True
189
+ items = _listize(self.action)
190
+ result = True
191
+ for item in items:
192
+ result = result and self._evaluate(machine, item)
193
+ return result
194
+
195
+ def _evaluate(self, machine, item):
196
+ if callable(item):
197
+ return item(machine)
198
+ else:
199
+ guard = getattr(machine, item)
200
+ if callable(guard):
201
+ guard = guard()
202
+ return guard
203
+
204
+
205
+ class _State(object):
206
+
207
+ def __init__(self, name, enter, exit):
208
+ self.name = name
209
+ self.enter = enter
210
+ self.exit = exit
211
+
212
+ def getter_name(self):
213
+ return 'is_%s' % self.name
214
+
215
+ def getter_method(self):
216
+ def state_getter(self_machine):
217
+ return self_machine.current_state == self.name
218
+ return state_getter
219
+
220
+ def run_enter(self, machine):
221
+ _ActionRunner(machine).run(self.enter)
222
+
223
+ def run_exit(self, machine):
224
+ _ActionRunner(machine).run(self.exit)
225
+
226
+
227
+ class _ActionRunner(object):
228
+
229
+ def __init__(self, machine):
230
+ self.machine = machine
231
+
232
+ def run(self, action_param, *args, **kwargs):
233
+ if not action_param:
234
+ return
235
+ action_items = _listize(action_param)
236
+ for action_item in action_items:
237
+ self._run_action(action_item, *args, **kwargs)
238
+
239
+ def _run_action(self, action, *args, **kwargs):
240
+ if callable(action):
241
+ self._try_to_run_with_args(action, self.machine, *args, **kwargs)
242
+ else:
243
+ self._try_to_run_with_args(getattr(self.machine, action), *args, **kwargs)
244
+
245
+ def _try_to_run_with_args(self, action, *args, **kwargs):
246
+ try:
247
+ action(*args, **kwargs)
248
+ except TypeError:
249
+ action()
250
+
251
+
252
+ class InvalidConfiguration(Exception):
253
+ pass
254
+
255
+
256
+ class InvalidTransition(Exception):
257
+ pass
258
+
259
+
260
+ class GuardNotSatisfied(Exception):
261
+ pass
262
+
263
+
264
+ class ForkedTransition(Exception):
265
+ pass
266
+
267
+
268
+ def _listize(value):
269
+ return type(value) in [list, tuple] and value or [value]
270
+
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/lexicon/__init__.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from ._version import __version_info__, __version__ # noqa
2
+ from .attribute_dict import AttributeDict
3
+ from .alias_dict import AliasDict
4
+
5
+
6
+ class Lexicon(AttributeDict, AliasDict):
7
+ def __init__(self, *args, **kwargs):
8
+ # Need to avoid combining AliasDict's initial attribute write on
9
+ # self.aliases, with AttributeDict's __setattr__. Doing so results in
10
+ # an infinite loop. Instead, just skip straight to dict() for both
11
+ # explicitly (i.e. we override AliasDict.__init__ instead of extending
12
+ # it.)
13
+ # NOTE: could tickle AttributeDict.__init__ instead, in case it ever
14
+ # grows one.
15
+ dict.__init__(self, *args, **kwargs)
16
+ dict.__setattr__(self, "aliases", {})
17
+
18
+ def __getattr__(self, key):
19
+ # Intercept deepcopy/etc driven access to self.aliases when not
20
+ # actually set. (Only a problem for us, due to abovementioned combo of
21
+ # Alias and Attribute Dicts, so not solvable in a parent alone.)
22
+ if key == "aliases" and key not in self.__dict__:
23
+ self.__dict__[key] = {}
24
+ return super(Lexicon, self).__getattr__(key)
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/lexicon/__pycache__/__init__.cpython-312.pyc ADDED
Binary file (1.19 kB). View file
 
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/lexicon/__pycache__/_version.cpython-312.pyc ADDED
Binary file (318 Bytes). View file
 
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/lexicon/__pycache__/alias_dict.cpython-312.pyc ADDED
Binary file (5.44 kB). View file
 
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/lexicon/__pycache__/attribute_dict.cpython-312.pyc ADDED
Binary file (1.19 kB). View file
 
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/lexicon/_version.py ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ __version_info__ = (2, 0, 1)
2
+ __version__ = ".".join(map(str, __version_info__))
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/lexicon/alias_dict.py ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class AliasDict(dict):
2
+ def __init__(self, *args, **kwargs):
3
+ super(AliasDict, self).__init__(*args, **kwargs)
4
+ self.aliases = {}
5
+
6
+ def alias(self, from_, to):
7
+ self.aliases[from_] = to
8
+
9
+ def unalias(self, from_):
10
+ del self.aliases[from_]
11
+
12
+ def aliases_of(self, name):
13
+ """
14
+ Returns other names for given real key or alias ``name``.
15
+
16
+ If given a real key, returns its aliases.
17
+
18
+ If given an alias, returns the real key it points to, plus any other
19
+ aliases of that real key. (The given alias itself is not included in
20
+ the return value.)
21
+ """
22
+ names = []
23
+ key = name
24
+ # self.aliases keys are aliases, not realkeys. Easy test to see if we
25
+ # should flip around to the POV of a realkey when given an alias.
26
+ if name in self.aliases:
27
+ key = self.aliases[name]
28
+ # Ensure the real key shows up in output.
29
+ names.append(key)
30
+ # 'key' is now a realkey, whose aliases are all keys whose value is
31
+ # itself. Filter out the original name given.
32
+ names.extend(
33
+ [k for k, v in self.aliases.items() if v == key and k != name]
34
+ )
35
+ return names
36
+
37
+ def _handle(self, key, value, single, multi, unaliased):
38
+ # Attribute existence test required to not blow up when deepcopy'd
39
+ if key in getattr(self, "aliases", {}):
40
+ target = self.aliases[key]
41
+ # Single-string targets
42
+ if isinstance(target, str):
43
+ return single(self, target, value)
44
+ # Multi-string targets
45
+ else:
46
+ if multi:
47
+ return multi(self, target, value)
48
+ else:
49
+ for subkey in target:
50
+ single(self, subkey, value)
51
+ else:
52
+ return unaliased(self, key, value)
53
+
54
+ def __setitem__(self, key, value):
55
+ def single(d, target, value):
56
+ d[target] = value
57
+
58
+ def unaliased(d, key, value):
59
+ super(AliasDict, d).__setitem__(key, value)
60
+
61
+ return self._handle(key, value, single, None, unaliased)
62
+
63
+ def __getitem__(self, key):
64
+ def single(d, target, value):
65
+ return d[target]
66
+
67
+ def unaliased(d, key, value):
68
+ return super(AliasDict, d).__getitem__(key)
69
+
70
+ def multi(d, target, value):
71
+ msg = "Multi-target aliases have no well-defined value and can't be read." # noqa
72
+ raise ValueError(msg)
73
+
74
+ return self._handle(key, None, single, multi, unaliased)
75
+
76
+ def __contains__(self, key):
77
+ def single(d, target, value):
78
+ return target in d
79
+
80
+ def multi(d, target, value):
81
+ return all(subkey in self for subkey in self.aliases[key])
82
+
83
+ def unaliased(d, key, value):
84
+ return super(AliasDict, d).__contains__(key)
85
+
86
+ return self._handle(key, None, single, multi, unaliased)
87
+
88
+ def __delitem__(self, key):
89
+ def single(d, target, value):
90
+ del d[target]
91
+
92
+ def unaliased(d, key, value):
93
+ return super(AliasDict, d).__delitem__(key)
94
+
95
+ return self._handle(key, None, single, None, unaliased)
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/lexicon/attribute_dict.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class AttributeDict(dict):
2
+ def __getattr__(self, key):
3
+ try:
4
+ return self[key]
5
+ except KeyError:
6
+ # to conform with __getattr__ spec
7
+ raise AttributeError(key)
8
+
9
+ def __setattr__(self, key, value):
10
+ self[key] = value
11
+
12
+ def __delattr__(self, key):
13
+ del self[key]
14
+
15
+ def __dir__(self):
16
+ return dir(type(self)) + list(self.keys())
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/__init__.py ADDED
@@ -0,0 +1,427 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ from .error import *
3
+
4
+ from .tokens import *
5
+ from .events import *
6
+ from .nodes import *
7
+
8
+ from .loader import *
9
+ from .dumper import *
10
+
11
+ __version__ = '5.4.1'
12
+ try:
13
+ from .cyaml import *
14
+ __with_libyaml__ = True
15
+ except ImportError:
16
+ __with_libyaml__ = False
17
+
18
+ import io
19
+
20
+ #------------------------------------------------------------------------------
21
+ # Warnings control
22
+ #------------------------------------------------------------------------------
23
+
24
+ # 'Global' warnings state:
25
+ _warnings_enabled = {
26
+ 'YAMLLoadWarning': True,
27
+ }
28
+
29
+ # Get or set global warnings' state
30
+ def warnings(settings=None):
31
+ if settings is None:
32
+ return _warnings_enabled
33
+
34
+ if type(settings) is dict:
35
+ for key in settings:
36
+ if key in _warnings_enabled:
37
+ _warnings_enabled[key] = settings[key]
38
+
39
+ # Warn when load() is called without Loader=...
40
+ class YAMLLoadWarning(RuntimeWarning):
41
+ pass
42
+
43
+ def load_warning(method):
44
+ if _warnings_enabled['YAMLLoadWarning'] is False:
45
+ return
46
+
47
+ import warnings
48
+
49
+ message = (
50
+ "calling yaml.%s() without Loader=... is deprecated, as the "
51
+ "default Loader is unsafe. Please read "
52
+ "https://msg.pyyaml.org/load for full details."
53
+ ) % method
54
+
55
+ warnings.warn(message, YAMLLoadWarning, stacklevel=3)
56
+
57
+ #------------------------------------------------------------------------------
58
+ def scan(stream, Loader=Loader):
59
+ """
60
+ Scan a YAML stream and produce scanning tokens.
61
+ """
62
+ loader = Loader(stream)
63
+ try:
64
+ while loader.check_token():
65
+ yield loader.get_token()
66
+ finally:
67
+ loader.dispose()
68
+
69
+ def parse(stream, Loader=Loader):
70
+ """
71
+ Parse a YAML stream and produce parsing events.
72
+ """
73
+ loader = Loader(stream)
74
+ try:
75
+ while loader.check_event():
76
+ yield loader.get_event()
77
+ finally:
78
+ loader.dispose()
79
+
80
+ def compose(stream, Loader=Loader):
81
+ """
82
+ Parse the first YAML document in a stream
83
+ and produce the corresponding representation tree.
84
+ """
85
+ loader = Loader(stream)
86
+ try:
87
+ return loader.get_single_node()
88
+ finally:
89
+ loader.dispose()
90
+
91
+ def compose_all(stream, Loader=Loader):
92
+ """
93
+ Parse all YAML documents in a stream
94
+ and produce corresponding representation trees.
95
+ """
96
+ loader = Loader(stream)
97
+ try:
98
+ while loader.check_node():
99
+ yield loader.get_node()
100
+ finally:
101
+ loader.dispose()
102
+
103
+ def load(stream, Loader=None):
104
+ """
105
+ Parse the first YAML document in a stream
106
+ and produce the corresponding Python object.
107
+ """
108
+ if Loader is None:
109
+ load_warning('load')
110
+ Loader = FullLoader
111
+
112
+ loader = Loader(stream)
113
+ try:
114
+ return loader.get_single_data()
115
+ finally:
116
+ loader.dispose()
117
+
118
+ def load_all(stream, Loader=None):
119
+ """
120
+ Parse all YAML documents in a stream
121
+ and produce corresponding Python objects.
122
+ """
123
+ if Loader is None:
124
+ load_warning('load_all')
125
+ Loader = FullLoader
126
+
127
+ loader = Loader(stream)
128
+ try:
129
+ while loader.check_data():
130
+ yield loader.get_data()
131
+ finally:
132
+ loader.dispose()
133
+
134
+ def full_load(stream):
135
+ """
136
+ Parse the first YAML document in a stream
137
+ and produce the corresponding Python object.
138
+
139
+ Resolve all tags except those known to be
140
+ unsafe on untrusted input.
141
+ """
142
+ return load(stream, FullLoader)
143
+
144
+ def full_load_all(stream):
145
+ """
146
+ Parse all YAML documents in a stream
147
+ and produce corresponding Python objects.
148
+
149
+ Resolve all tags except those known to be
150
+ unsafe on untrusted input.
151
+ """
152
+ return load_all(stream, FullLoader)
153
+
154
+ def safe_load(stream):
155
+ """
156
+ Parse the first YAML document in a stream
157
+ and produce the corresponding Python object.
158
+
159
+ Resolve only basic YAML tags. This is known
160
+ to be safe for untrusted input.
161
+ """
162
+ return load(stream, SafeLoader)
163
+
164
+ def safe_load_all(stream):
165
+ """
166
+ Parse all YAML documents in a stream
167
+ and produce corresponding Python objects.
168
+
169
+ Resolve only basic YAML tags. This is known
170
+ to be safe for untrusted input.
171
+ """
172
+ return load_all(stream, SafeLoader)
173
+
174
+ def unsafe_load(stream):
175
+ """
176
+ Parse the first YAML document in a stream
177
+ and produce the corresponding Python object.
178
+
179
+ Resolve all tags, even those known to be
180
+ unsafe on untrusted input.
181
+ """
182
+ return load(stream, UnsafeLoader)
183
+
184
+ def unsafe_load_all(stream):
185
+ """
186
+ Parse all YAML documents in a stream
187
+ and produce corresponding Python objects.
188
+
189
+ Resolve all tags, even those known to be
190
+ unsafe on untrusted input.
191
+ """
192
+ return load_all(stream, UnsafeLoader)
193
+
194
+ def emit(events, stream=None, Dumper=Dumper,
195
+ canonical=None, indent=None, width=None,
196
+ allow_unicode=None, line_break=None):
197
+ """
198
+ Emit YAML parsing events into a stream.
199
+ If stream is None, return the produced string instead.
200
+ """
201
+ getvalue = None
202
+ if stream is None:
203
+ stream = io.StringIO()
204
+ getvalue = stream.getvalue
205
+ dumper = Dumper(stream, canonical=canonical, indent=indent, width=width,
206
+ allow_unicode=allow_unicode, line_break=line_break)
207
+ try:
208
+ for event in events:
209
+ dumper.emit(event)
210
+ finally:
211
+ dumper.dispose()
212
+ if getvalue:
213
+ return getvalue()
214
+
215
+ def serialize_all(nodes, stream=None, Dumper=Dumper,
216
+ canonical=None, indent=None, width=None,
217
+ allow_unicode=None, line_break=None,
218
+ encoding=None, explicit_start=None, explicit_end=None,
219
+ version=None, tags=None):
220
+ """
221
+ Serialize a sequence of representation trees into a YAML stream.
222
+ If stream is None, return the produced string instead.
223
+ """
224
+ getvalue = None
225
+ if stream is None:
226
+ if encoding is None:
227
+ stream = io.StringIO()
228
+ else:
229
+ stream = io.BytesIO()
230
+ getvalue = stream.getvalue
231
+ dumper = Dumper(stream, canonical=canonical, indent=indent, width=width,
232
+ allow_unicode=allow_unicode, line_break=line_break,
233
+ encoding=encoding, version=version, tags=tags,
234
+ explicit_start=explicit_start, explicit_end=explicit_end)
235
+ try:
236
+ dumper.open()
237
+ for node in nodes:
238
+ dumper.serialize(node)
239
+ dumper.close()
240
+ finally:
241
+ dumper.dispose()
242
+ if getvalue:
243
+ return getvalue()
244
+
245
+ def serialize(node, stream=None, Dumper=Dumper, **kwds):
246
+ """
247
+ Serialize a representation tree into a YAML stream.
248
+ If stream is None, return the produced string instead.
249
+ """
250
+ return serialize_all([node], stream, Dumper=Dumper, **kwds)
251
+
252
+ def dump_all(documents, stream=None, Dumper=Dumper,
253
+ default_style=None, default_flow_style=False,
254
+ canonical=None, indent=None, width=None,
255
+ allow_unicode=None, line_break=None,
256
+ encoding=None, explicit_start=None, explicit_end=None,
257
+ version=None, tags=None, sort_keys=True):
258
+ """
259
+ Serialize a sequence of Python objects into a YAML stream.
260
+ If stream is None, return the produced string instead.
261
+ """
262
+ getvalue = None
263
+ if stream is None:
264
+ if encoding is None:
265
+ stream = io.StringIO()
266
+ else:
267
+ stream = io.BytesIO()
268
+ getvalue = stream.getvalue
269
+ dumper = Dumper(stream, default_style=default_style,
270
+ default_flow_style=default_flow_style,
271
+ canonical=canonical, indent=indent, width=width,
272
+ allow_unicode=allow_unicode, line_break=line_break,
273
+ encoding=encoding, version=version, tags=tags,
274
+ explicit_start=explicit_start, explicit_end=explicit_end, sort_keys=sort_keys)
275
+ try:
276
+ dumper.open()
277
+ for data in documents:
278
+ dumper.represent(data)
279
+ dumper.close()
280
+ finally:
281
+ dumper.dispose()
282
+ if getvalue:
283
+ return getvalue()
284
+
285
+ def dump(data, stream=None, Dumper=Dumper, **kwds):
286
+ """
287
+ Serialize a Python object into a YAML stream.
288
+ If stream is None, return the produced string instead.
289
+ """
290
+ return dump_all([data], stream, Dumper=Dumper, **kwds)
291
+
292
+ def safe_dump_all(documents, stream=None, **kwds):
293
+ """
294
+ Serialize a sequence of Python objects into a YAML stream.
295
+ Produce only basic YAML tags.
296
+ If stream is None, return the produced string instead.
297
+ """
298
+ return dump_all(documents, stream, Dumper=SafeDumper, **kwds)
299
+
300
+ def safe_dump(data, stream=None, **kwds):
301
+ """
302
+ Serialize a Python object into a YAML stream.
303
+ Produce only basic YAML tags.
304
+ If stream is None, return the produced string instead.
305
+ """
306
+ return dump_all([data], stream, Dumper=SafeDumper, **kwds)
307
+
308
+ def add_implicit_resolver(tag, regexp, first=None,
309
+ Loader=None, Dumper=Dumper):
310
+ """
311
+ Add an implicit scalar detector.
312
+ If an implicit scalar value matches the given regexp,
313
+ the corresponding tag is assigned to the scalar.
314
+ first is a sequence of possible initial characters or None.
315
+ """
316
+ if Loader is None:
317
+ loader.Loader.add_implicit_resolver(tag, regexp, first)
318
+ loader.FullLoader.add_implicit_resolver(tag, regexp, first)
319
+ loader.UnsafeLoader.add_implicit_resolver(tag, regexp, first)
320
+ else:
321
+ Loader.add_implicit_resolver(tag, regexp, first)
322
+ Dumper.add_implicit_resolver(tag, regexp, first)
323
+
324
+ def add_path_resolver(tag, path, kind=None, Loader=None, Dumper=Dumper):
325
+ """
326
+ Add a path based resolver for the given tag.
327
+ A path is a list of keys that forms a path
328
+ to a node in the representation tree.
329
+ Keys can be string values, integers, or None.
330
+ """
331
+ if Loader is None:
332
+ loader.Loader.add_path_resolver(tag, path, kind)
333
+ loader.FullLoader.add_path_resolver(tag, path, kind)
334
+ loader.UnsafeLoader.add_path_resolver(tag, path, kind)
335
+ else:
336
+ Loader.add_path_resolver(tag, path, kind)
337
+ Dumper.add_path_resolver(tag, path, kind)
338
+
339
+ def add_constructor(tag, constructor, Loader=None):
340
+ """
341
+ Add a constructor for the given tag.
342
+ Constructor is a function that accepts a Loader instance
343
+ and a node object and produces the corresponding Python object.
344
+ """
345
+ if Loader is None:
346
+ loader.Loader.add_constructor(tag, constructor)
347
+ loader.FullLoader.add_constructor(tag, constructor)
348
+ loader.UnsafeLoader.add_constructor(tag, constructor)
349
+ else:
350
+ Loader.add_constructor(tag, constructor)
351
+
352
+ def add_multi_constructor(tag_prefix, multi_constructor, Loader=None):
353
+ """
354
+ Add a multi-constructor for the given tag prefix.
355
+ Multi-constructor is called for a node if its tag starts with tag_prefix.
356
+ Multi-constructor accepts a Loader instance, a tag suffix,
357
+ and a node object and produces the corresponding Python object.
358
+ """
359
+ if Loader is None:
360
+ loader.Loader.add_multi_constructor(tag_prefix, multi_constructor)
361
+ loader.FullLoader.add_multi_constructor(tag_prefix, multi_constructor)
362
+ loader.UnsafeLoader.add_multi_constructor(tag_prefix, multi_constructor)
363
+ else:
364
+ Loader.add_multi_constructor(tag_prefix, multi_constructor)
365
+
366
+ def add_representer(data_type, representer, Dumper=Dumper):
367
+ """
368
+ Add a representer for the given type.
369
+ Representer is a function accepting a Dumper instance
370
+ and an instance of the given data type
371
+ and producing the corresponding representation node.
372
+ """
373
+ Dumper.add_representer(data_type, representer)
374
+
375
+ def add_multi_representer(data_type, multi_representer, Dumper=Dumper):
376
+ """
377
+ Add a representer for the given type.
378
+ Multi-representer is a function accepting a Dumper instance
379
+ and an instance of the given data type or subtype
380
+ and producing the corresponding representation node.
381
+ """
382
+ Dumper.add_multi_representer(data_type, multi_representer)
383
+
384
+ class YAMLObjectMetaclass(type):
385
+ """
386
+ The metaclass for YAMLObject.
387
+ """
388
+ def __init__(cls, name, bases, kwds):
389
+ super(YAMLObjectMetaclass, cls).__init__(name, bases, kwds)
390
+ if 'yaml_tag' in kwds and kwds['yaml_tag'] is not None:
391
+ if isinstance(cls.yaml_loader, list):
392
+ for loader in cls.yaml_loader:
393
+ loader.add_constructor(cls.yaml_tag, cls.from_yaml)
394
+ else:
395
+ cls.yaml_loader.add_constructor(cls.yaml_tag, cls.from_yaml)
396
+
397
+ cls.yaml_dumper.add_representer(cls, cls.to_yaml)
398
+
399
+ class YAMLObject(metaclass=YAMLObjectMetaclass):
400
+ """
401
+ An object that can dump itself to a YAML stream
402
+ and load itself from a YAML stream.
403
+ """
404
+
405
+ __slots__ = () # no direct instantiation, so allow immutable subclasses
406
+
407
+ yaml_loader = [Loader, FullLoader, UnsafeLoader]
408
+ yaml_dumper = Dumper
409
+
410
+ yaml_tag = None
411
+ yaml_flow_style = None
412
+
413
+ @classmethod
414
+ def from_yaml(cls, loader, node):
415
+ """
416
+ Convert a representation node to a Python object.
417
+ """
418
+ return loader.construct_yaml_object(node, cls)
419
+
420
+ @classmethod
421
+ def to_yaml(cls, dumper, data):
422
+ """
423
+ Convert a Python object to a representation node.
424
+ """
425
+ return dumper.represent_yaml_object(cls.yaml_tag, data, cls,
426
+ flow_style=cls.yaml_flow_style)
427
+
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/__pycache__/__init__.cpython-312.pyc ADDED
Binary file (16.8 kB). View file
 
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/__pycache__/composer.cpython-312.pyc ADDED
Binary file (6.52 kB). View file
 
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/__pycache__/constructor.cpython-312.pyc ADDED
Binary file (34.9 kB). View file
 
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/__pycache__/cyaml.cpython-312.pyc ADDED
Binary file (4.62 kB). View file
 
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/__pycache__/dumper.cpython-312.pyc ADDED
Binary file (2.45 kB). View file
 
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/__pycache__/emitter.cpython-312.pyc ADDED
Binary file (50.2 kB). View file
 
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/__pycache__/error.cpython-312.pyc ADDED
Binary file (4.26 kB). View file
 
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/__pycache__/events.cpython-312.pyc ADDED
Binary file (4.7 kB). View file
 
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/__pycache__/loader.cpython-312.pyc ADDED
Binary file (3.52 kB). View file
 
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/__pycache__/nodes.cpython-312.pyc ADDED
Binary file (2.2 kB). View file
 
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/__pycache__/parser.cpython-312.pyc ADDED
Binary file (24.7 kB). View file
 
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/__pycache__/reader.cpython-312.pyc ADDED
Binary file (8.84 kB). View file
 
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/__pycache__/representer.cpython-312.pyc ADDED
Binary file (16.9 kB). View file
 
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/__pycache__/resolver.cpython-312.pyc ADDED
Binary file (9.05 kB). View file
 
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/__pycache__/scanner.cpython-312.pyc ADDED
Binary file (49.8 kB). View file
 
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/__pycache__/serializer.cpython-312.pyc ADDED
Binary file (6.19 kB). View file
 
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/__pycache__/tokens.cpython-312.pyc ADDED
Binary file (5.77 kB). View file
 
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/composer.py ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ __all__ = ['Composer', 'ComposerError']
3
+
4
+ from .error import MarkedYAMLError
5
+ from .events import *
6
+ from .nodes import *
7
+
8
+ class ComposerError(MarkedYAMLError):
9
+ pass
10
+
11
+ class Composer:
12
+
13
+ def __init__(self):
14
+ self.anchors = {}
15
+
16
+ def check_node(self):
17
+ # Drop the STREAM-START event.
18
+ if self.check_event(StreamStartEvent):
19
+ self.get_event()
20
+
21
+ # If there are more documents available?
22
+ return not self.check_event(StreamEndEvent)
23
+
24
+ def get_node(self):
25
+ # Get the root node of the next document.
26
+ if not self.check_event(StreamEndEvent):
27
+ return self.compose_document()
28
+
29
+ def get_single_node(self):
30
+ # Drop the STREAM-START event.
31
+ self.get_event()
32
+
33
+ # Compose a document if the stream is not empty.
34
+ document = None
35
+ if not self.check_event(StreamEndEvent):
36
+ document = self.compose_document()
37
+
38
+ # Ensure that the stream contains no more documents.
39
+ if not self.check_event(StreamEndEvent):
40
+ event = self.get_event()
41
+ raise ComposerError("expected a single document in the stream",
42
+ document.start_mark, "but found another document",
43
+ event.start_mark)
44
+
45
+ # Drop the STREAM-END event.
46
+ self.get_event()
47
+
48
+ return document
49
+
50
+ def compose_document(self):
51
+ # Drop the DOCUMENT-START event.
52
+ self.get_event()
53
+
54
+ # Compose the root node.
55
+ node = self.compose_node(None, None)
56
+
57
+ # Drop the DOCUMENT-END event.
58
+ self.get_event()
59
+
60
+ self.anchors = {}
61
+ return node
62
+
63
+ def compose_node(self, parent, index):
64
+ if self.check_event(AliasEvent):
65
+ event = self.get_event()
66
+ anchor = event.anchor
67
+ if anchor not in self.anchors:
68
+ raise ComposerError(None, None, "found undefined alias %r"
69
+ % anchor, event.start_mark)
70
+ return self.anchors[anchor]
71
+ event = self.peek_event()
72
+ anchor = event.anchor
73
+ if anchor is not None:
74
+ if anchor in self.anchors:
75
+ raise ComposerError("found duplicate anchor %r; first occurrence"
76
+ % anchor, self.anchors[anchor].start_mark,
77
+ "second occurrence", event.start_mark)
78
+ self.descend_resolver(parent, index)
79
+ if self.check_event(ScalarEvent):
80
+ node = self.compose_scalar_node(anchor)
81
+ elif self.check_event(SequenceStartEvent):
82
+ node = self.compose_sequence_node(anchor)
83
+ elif self.check_event(MappingStartEvent):
84
+ node = self.compose_mapping_node(anchor)
85
+ self.ascend_resolver()
86
+ return node
87
+
88
+ def compose_scalar_node(self, anchor):
89
+ event = self.get_event()
90
+ tag = event.tag
91
+ if tag is None or tag == '!':
92
+ tag = self.resolve(ScalarNode, event.value, event.implicit)
93
+ node = ScalarNode(tag, event.value,
94
+ event.start_mark, event.end_mark, style=event.style)
95
+ if anchor is not None:
96
+ self.anchors[anchor] = node
97
+ return node
98
+
99
+ def compose_sequence_node(self, anchor):
100
+ start_event = self.get_event()
101
+ tag = start_event.tag
102
+ if tag is None or tag == '!':
103
+ tag = self.resolve(SequenceNode, None, start_event.implicit)
104
+ node = SequenceNode(tag, [],
105
+ start_event.start_mark, None,
106
+ flow_style=start_event.flow_style)
107
+ if anchor is not None:
108
+ self.anchors[anchor] = node
109
+ index = 0
110
+ while not self.check_event(SequenceEndEvent):
111
+ node.value.append(self.compose_node(node, index))
112
+ index += 1
113
+ end_event = self.get_event()
114
+ node.end_mark = end_event.end_mark
115
+ return node
116
+
117
+ def compose_mapping_node(self, anchor):
118
+ start_event = self.get_event()
119
+ tag = start_event.tag
120
+ if tag is None or tag == '!':
121
+ tag = self.resolve(MappingNode, None, start_event.implicit)
122
+ node = MappingNode(tag, [],
123
+ start_event.start_mark, None,
124
+ flow_style=start_event.flow_style)
125
+ if anchor is not None:
126
+ self.anchors[anchor] = node
127
+ while not self.check_event(MappingEndEvent):
128
+ #key_event = self.peek_event()
129
+ item_key = self.compose_node(node, None)
130
+ #if item_key in node.value:
131
+ # raise ComposerError("while composing a mapping", start_event.start_mark,
132
+ # "found duplicate key", key_event.start_mark)
133
+ item_value = self.compose_node(node, item_key)
134
+ #node.value[item_key] = item_value
135
+ node.value.append((item_key, item_value))
136
+ end_event = self.get_event()
137
+ node.end_mark = end_event.end_mark
138
+ return node
139
+
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/constructor.py ADDED
@@ -0,0 +1,748 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ __all__ = [
3
+ 'BaseConstructor',
4
+ 'SafeConstructor',
5
+ 'FullConstructor',
6
+ 'UnsafeConstructor',
7
+ 'Constructor',
8
+ 'ConstructorError'
9
+ ]
10
+
11
+ from .error import *
12
+ from .nodes import *
13
+
14
+ import collections.abc, datetime, base64, binascii, re, sys, types
15
+
16
+ class ConstructorError(MarkedYAMLError):
17
+ pass
18
+
19
+ class BaseConstructor:
20
+
21
+ yaml_constructors = {}
22
+ yaml_multi_constructors = {}
23
+
24
+ def __init__(self):
25
+ self.constructed_objects = {}
26
+ self.recursive_objects = {}
27
+ self.state_generators = []
28
+ self.deep_construct = False
29
+
30
+ def check_data(self):
31
+ # If there are more documents available?
32
+ return self.check_node()
33
+
34
+ def check_state_key(self, key):
35
+ """Block special attributes/methods from being set in a newly created
36
+ object, to prevent user-controlled methods from being called during
37
+ deserialization"""
38
+ if self.get_state_keys_blacklist_regexp().match(key):
39
+ raise ConstructorError(None, None,
40
+ "blacklisted key '%s' in instance state found" % (key,), None)
41
+
42
+ def get_data(self):
43
+ # Construct and return the next document.
44
+ if self.check_node():
45
+ return self.construct_document(self.get_node())
46
+
47
+ def get_single_data(self):
48
+ # Ensure that the stream contains a single document and construct it.
49
+ node = self.get_single_node()
50
+ if node is not None:
51
+ return self.construct_document(node)
52
+ return None
53
+
54
+ def construct_document(self, node):
55
+ data = self.construct_object(node)
56
+ while self.state_generators:
57
+ state_generators = self.state_generators
58
+ self.state_generators = []
59
+ for generator in state_generators:
60
+ for dummy in generator:
61
+ pass
62
+ self.constructed_objects = {}
63
+ self.recursive_objects = {}
64
+ self.deep_construct = False
65
+ return data
66
+
67
+ def construct_object(self, node, deep=False):
68
+ if node in self.constructed_objects:
69
+ return self.constructed_objects[node]
70
+ if deep:
71
+ old_deep = self.deep_construct
72
+ self.deep_construct = True
73
+ if node in self.recursive_objects:
74
+ raise ConstructorError(None, None,
75
+ "found unconstructable recursive node", node.start_mark)
76
+ self.recursive_objects[node] = None
77
+ constructor = None
78
+ tag_suffix = None
79
+ if node.tag in self.yaml_constructors:
80
+ constructor = self.yaml_constructors[node.tag]
81
+ else:
82
+ for tag_prefix in self.yaml_multi_constructors:
83
+ if tag_prefix is not None and node.tag.startswith(tag_prefix):
84
+ tag_suffix = node.tag[len(tag_prefix):]
85
+ constructor = self.yaml_multi_constructors[tag_prefix]
86
+ break
87
+ else:
88
+ if None in self.yaml_multi_constructors:
89
+ tag_suffix = node.tag
90
+ constructor = self.yaml_multi_constructors[None]
91
+ elif None in self.yaml_constructors:
92
+ constructor = self.yaml_constructors[None]
93
+ elif isinstance(node, ScalarNode):
94
+ constructor = self.__class__.construct_scalar
95
+ elif isinstance(node, SequenceNode):
96
+ constructor = self.__class__.construct_sequence
97
+ elif isinstance(node, MappingNode):
98
+ constructor = self.__class__.construct_mapping
99
+ if tag_suffix is None:
100
+ data = constructor(self, node)
101
+ else:
102
+ data = constructor(self, tag_suffix, node)
103
+ if isinstance(data, types.GeneratorType):
104
+ generator = data
105
+ data = next(generator)
106
+ if self.deep_construct:
107
+ for dummy in generator:
108
+ pass
109
+ else:
110
+ self.state_generators.append(generator)
111
+ self.constructed_objects[node] = data
112
+ del self.recursive_objects[node]
113
+ if deep:
114
+ self.deep_construct = old_deep
115
+ return data
116
+
117
+ def construct_scalar(self, node):
118
+ if not isinstance(node, ScalarNode):
119
+ raise ConstructorError(None, None,
120
+ "expected a scalar node, but found %s" % node.id,
121
+ node.start_mark)
122
+ return node.value
123
+
124
+ def construct_sequence(self, node, deep=False):
125
+ if not isinstance(node, SequenceNode):
126
+ raise ConstructorError(None, None,
127
+ "expected a sequence node, but found %s" % node.id,
128
+ node.start_mark)
129
+ return [self.construct_object(child, deep=deep)
130
+ for child in node.value]
131
+
132
+ def construct_mapping(self, node, deep=False):
133
+ if not isinstance(node, MappingNode):
134
+ raise ConstructorError(None, None,
135
+ "expected a mapping node, but found %s" % node.id,
136
+ node.start_mark)
137
+ mapping = {}
138
+ for key_node, value_node in node.value:
139
+ key = self.construct_object(key_node, deep=deep)
140
+ if not isinstance(key, collections.abc.Hashable):
141
+ raise ConstructorError("while constructing a mapping", node.start_mark,
142
+ "found unhashable key", key_node.start_mark)
143
+ value = self.construct_object(value_node, deep=deep)
144
+ mapping[key] = value
145
+ return mapping
146
+
147
+ def construct_pairs(self, node, deep=False):
148
+ if not isinstance(node, MappingNode):
149
+ raise ConstructorError(None, None,
150
+ "expected a mapping node, but found %s" % node.id,
151
+ node.start_mark)
152
+ pairs = []
153
+ for key_node, value_node in node.value:
154
+ key = self.construct_object(key_node, deep=deep)
155
+ value = self.construct_object(value_node, deep=deep)
156
+ pairs.append((key, value))
157
+ return pairs
158
+
159
+ @classmethod
160
+ def add_constructor(cls, tag, constructor):
161
+ if not 'yaml_constructors' in cls.__dict__:
162
+ cls.yaml_constructors = cls.yaml_constructors.copy()
163
+ cls.yaml_constructors[tag] = constructor
164
+
165
+ @classmethod
166
+ def add_multi_constructor(cls, tag_prefix, multi_constructor):
167
+ if not 'yaml_multi_constructors' in cls.__dict__:
168
+ cls.yaml_multi_constructors = cls.yaml_multi_constructors.copy()
169
+ cls.yaml_multi_constructors[tag_prefix] = multi_constructor
170
+
171
+ class SafeConstructor(BaseConstructor):
172
+
173
+ def construct_scalar(self, node):
174
+ if isinstance(node, MappingNode):
175
+ for key_node, value_node in node.value:
176
+ if key_node.tag == 'tag:yaml.org,2002:value':
177
+ return self.construct_scalar(value_node)
178
+ return super().construct_scalar(node)
179
+
180
+ def flatten_mapping(self, node):
181
+ merge = []
182
+ index = 0
183
+ while index < len(node.value):
184
+ key_node, value_node = node.value[index]
185
+ if key_node.tag == 'tag:yaml.org,2002:merge':
186
+ del node.value[index]
187
+ if isinstance(value_node, MappingNode):
188
+ self.flatten_mapping(value_node)
189
+ merge.extend(value_node.value)
190
+ elif isinstance(value_node, SequenceNode):
191
+ submerge = []
192
+ for subnode in value_node.value:
193
+ if not isinstance(subnode, MappingNode):
194
+ raise ConstructorError("while constructing a mapping",
195
+ node.start_mark,
196
+ "expected a mapping for merging, but found %s"
197
+ % subnode.id, subnode.start_mark)
198
+ self.flatten_mapping(subnode)
199
+ submerge.append(subnode.value)
200
+ submerge.reverse()
201
+ for value in submerge:
202
+ merge.extend(value)
203
+ else:
204
+ raise ConstructorError("while constructing a mapping", node.start_mark,
205
+ "expected a mapping or list of mappings for merging, but found %s"
206
+ % value_node.id, value_node.start_mark)
207
+ elif key_node.tag == 'tag:yaml.org,2002:value':
208
+ key_node.tag = 'tag:yaml.org,2002:str'
209
+ index += 1
210
+ else:
211
+ index += 1
212
+ if merge:
213
+ node.value = merge + node.value
214
+
215
+ def construct_mapping(self, node, deep=False):
216
+ if isinstance(node, MappingNode):
217
+ self.flatten_mapping(node)
218
+ return super().construct_mapping(node, deep=deep)
219
+
220
+ def construct_yaml_null(self, node):
221
+ self.construct_scalar(node)
222
+ return None
223
+
224
+ bool_values = {
225
+ 'yes': True,
226
+ 'no': False,
227
+ 'true': True,
228
+ 'false': False,
229
+ 'on': True,
230
+ 'off': False,
231
+ }
232
+
233
+ def construct_yaml_bool(self, node):
234
+ value = self.construct_scalar(node)
235
+ return self.bool_values[value.lower()]
236
+
237
+ def construct_yaml_int(self, node):
238
+ value = self.construct_scalar(node)
239
+ value = value.replace('_', '')
240
+ sign = +1
241
+ if value[0] == '-':
242
+ sign = -1
243
+ if value[0] in '+-':
244
+ value = value[1:]
245
+ if value == '0':
246
+ return 0
247
+ elif value.startswith('0b'):
248
+ return sign*int(value[2:], 2)
249
+ elif value.startswith('0x'):
250
+ return sign*int(value[2:], 16)
251
+ elif value[0] == '0':
252
+ return sign*int(value, 8)
253
+ elif ':' in value:
254
+ digits = [int(part) for part in value.split(':')]
255
+ digits.reverse()
256
+ base = 1
257
+ value = 0
258
+ for digit in digits:
259
+ value += digit*base
260
+ base *= 60
261
+ return sign*value
262
+ else:
263
+ return sign*int(value)
264
+
265
+ inf_value = 1e300
266
+ while inf_value != inf_value*inf_value:
267
+ inf_value *= inf_value
268
+ nan_value = -inf_value/inf_value # Trying to make a quiet NaN (like C99).
269
+
270
+ def construct_yaml_float(self, node):
271
+ value = self.construct_scalar(node)
272
+ value = value.replace('_', '').lower()
273
+ sign = +1
274
+ if value[0] == '-':
275
+ sign = -1
276
+ if value[0] in '+-':
277
+ value = value[1:]
278
+ if value == '.inf':
279
+ return sign*self.inf_value
280
+ elif value == '.nan':
281
+ return self.nan_value
282
+ elif ':' in value:
283
+ digits = [float(part) for part in value.split(':')]
284
+ digits.reverse()
285
+ base = 1
286
+ value = 0.0
287
+ for digit in digits:
288
+ value += digit*base
289
+ base *= 60
290
+ return sign*value
291
+ else:
292
+ return sign*float(value)
293
+
294
+ def construct_yaml_binary(self, node):
295
+ try:
296
+ value = self.construct_scalar(node).encode('ascii')
297
+ except UnicodeEncodeError as exc:
298
+ raise ConstructorError(None, None,
299
+ "failed to convert base64 data into ascii: %s" % exc,
300
+ node.start_mark)
301
+ try:
302
+ if hasattr(base64, 'decodebytes'):
303
+ return base64.decodebytes(value)
304
+ else:
305
+ return base64.decodestring(value)
306
+ except binascii.Error as exc:
307
+ raise ConstructorError(None, None,
308
+ "failed to decode base64 data: %s" % exc, node.start_mark)
309
+
310
+ timestamp_regexp = re.compile(
311
+ r'''^(?P<year>[0-9][0-9][0-9][0-9])
312
+ -(?P<month>[0-9][0-9]?)
313
+ -(?P<day>[0-9][0-9]?)
314
+ (?:(?:[Tt]|[ \t]+)
315
+ (?P<hour>[0-9][0-9]?)
316
+ :(?P<minute>[0-9][0-9])
317
+ :(?P<second>[0-9][0-9])
318
+ (?:\.(?P<fraction>[0-9]*))?
319
+ (?:[ \t]*(?P<tz>Z|(?P<tz_sign>[-+])(?P<tz_hour>[0-9][0-9]?)
320
+ (?::(?P<tz_minute>[0-9][0-9]))?))?)?$''', re.X)
321
+
322
+ def construct_yaml_timestamp(self, node):
323
+ value = self.construct_scalar(node)
324
+ match = self.timestamp_regexp.match(node.value)
325
+ values = match.groupdict()
326
+ year = int(values['year'])
327
+ month = int(values['month'])
328
+ day = int(values['day'])
329
+ if not values['hour']:
330
+ return datetime.date(year, month, day)
331
+ hour = int(values['hour'])
332
+ minute = int(values['minute'])
333
+ second = int(values['second'])
334
+ fraction = 0
335
+ tzinfo = None
336
+ if values['fraction']:
337
+ fraction = values['fraction'][:6]
338
+ while len(fraction) < 6:
339
+ fraction += '0'
340
+ fraction = int(fraction)
341
+ if values['tz_sign']:
342
+ tz_hour = int(values['tz_hour'])
343
+ tz_minute = int(values['tz_minute'] or 0)
344
+ delta = datetime.timedelta(hours=tz_hour, minutes=tz_minute)
345
+ if values['tz_sign'] == '-':
346
+ delta = -delta
347
+ tzinfo = datetime.timezone(delta)
348
+ elif values['tz']:
349
+ tzinfo = datetime.timezone.utc
350
+ return datetime.datetime(year, month, day, hour, minute, second, fraction,
351
+ tzinfo=tzinfo)
352
+
353
+ def construct_yaml_omap(self, node):
354
+ # Note: we do not check for duplicate keys, because it's too
355
+ # CPU-expensive.
356
+ omap = []
357
+ yield omap
358
+ if not isinstance(node, SequenceNode):
359
+ raise ConstructorError("while constructing an ordered map", node.start_mark,
360
+ "expected a sequence, but found %s" % node.id, node.start_mark)
361
+ for subnode in node.value:
362
+ if not isinstance(subnode, MappingNode):
363
+ raise ConstructorError("while constructing an ordered map", node.start_mark,
364
+ "expected a mapping of length 1, but found %s" % subnode.id,
365
+ subnode.start_mark)
366
+ if len(subnode.value) != 1:
367
+ raise ConstructorError("while constructing an ordered map", node.start_mark,
368
+ "expected a single mapping item, but found %d items" % len(subnode.value),
369
+ subnode.start_mark)
370
+ key_node, value_node = subnode.value[0]
371
+ key = self.construct_object(key_node)
372
+ value = self.construct_object(value_node)
373
+ omap.append((key, value))
374
+
375
+ def construct_yaml_pairs(self, node):
376
+ # Note: the same code as `construct_yaml_omap`.
377
+ pairs = []
378
+ yield pairs
379
+ if not isinstance(node, SequenceNode):
380
+ raise ConstructorError("while constructing pairs", node.start_mark,
381
+ "expected a sequence, but found %s" % node.id, node.start_mark)
382
+ for subnode in node.value:
383
+ if not isinstance(subnode, MappingNode):
384
+ raise ConstructorError("while constructing pairs", node.start_mark,
385
+ "expected a mapping of length 1, but found %s" % subnode.id,
386
+ subnode.start_mark)
387
+ if len(subnode.value) != 1:
388
+ raise ConstructorError("while constructing pairs", node.start_mark,
389
+ "expected a single mapping item, but found %d items" % len(subnode.value),
390
+ subnode.start_mark)
391
+ key_node, value_node = subnode.value[0]
392
+ key = self.construct_object(key_node)
393
+ value = self.construct_object(value_node)
394
+ pairs.append((key, value))
395
+
396
+ def construct_yaml_set(self, node):
397
+ data = set()
398
+ yield data
399
+ value = self.construct_mapping(node)
400
+ data.update(value)
401
+
402
+ def construct_yaml_str(self, node):
403
+ return self.construct_scalar(node)
404
+
405
+ def construct_yaml_seq(self, node):
406
+ data = []
407
+ yield data
408
+ data.extend(self.construct_sequence(node))
409
+
410
+ def construct_yaml_map(self, node):
411
+ data = {}
412
+ yield data
413
+ value = self.construct_mapping(node)
414
+ data.update(value)
415
+
416
+ def construct_yaml_object(self, node, cls):
417
+ data = cls.__new__(cls)
418
+ yield data
419
+ if hasattr(data, '__setstate__'):
420
+ state = self.construct_mapping(node, deep=True)
421
+ data.__setstate__(state)
422
+ else:
423
+ state = self.construct_mapping(node)
424
+ data.__dict__.update(state)
425
+
426
+ def construct_undefined(self, node):
427
+ raise ConstructorError(None, None,
428
+ "could not determine a constructor for the tag %r" % node.tag,
429
+ node.start_mark)
430
+
431
+ SafeConstructor.add_constructor(
432
+ 'tag:yaml.org,2002:null',
433
+ SafeConstructor.construct_yaml_null)
434
+
435
+ SafeConstructor.add_constructor(
436
+ 'tag:yaml.org,2002:bool',
437
+ SafeConstructor.construct_yaml_bool)
438
+
439
+ SafeConstructor.add_constructor(
440
+ 'tag:yaml.org,2002:int',
441
+ SafeConstructor.construct_yaml_int)
442
+
443
+ SafeConstructor.add_constructor(
444
+ 'tag:yaml.org,2002:float',
445
+ SafeConstructor.construct_yaml_float)
446
+
447
+ SafeConstructor.add_constructor(
448
+ 'tag:yaml.org,2002:binary',
449
+ SafeConstructor.construct_yaml_binary)
450
+
451
+ SafeConstructor.add_constructor(
452
+ 'tag:yaml.org,2002:timestamp',
453
+ SafeConstructor.construct_yaml_timestamp)
454
+
455
+ SafeConstructor.add_constructor(
456
+ 'tag:yaml.org,2002:omap',
457
+ SafeConstructor.construct_yaml_omap)
458
+
459
+ SafeConstructor.add_constructor(
460
+ 'tag:yaml.org,2002:pairs',
461
+ SafeConstructor.construct_yaml_pairs)
462
+
463
+ SafeConstructor.add_constructor(
464
+ 'tag:yaml.org,2002:set',
465
+ SafeConstructor.construct_yaml_set)
466
+
467
+ SafeConstructor.add_constructor(
468
+ 'tag:yaml.org,2002:str',
469
+ SafeConstructor.construct_yaml_str)
470
+
471
+ SafeConstructor.add_constructor(
472
+ 'tag:yaml.org,2002:seq',
473
+ SafeConstructor.construct_yaml_seq)
474
+
475
+ SafeConstructor.add_constructor(
476
+ 'tag:yaml.org,2002:map',
477
+ SafeConstructor.construct_yaml_map)
478
+
479
+ SafeConstructor.add_constructor(None,
480
+ SafeConstructor.construct_undefined)
481
+
482
+ class FullConstructor(SafeConstructor):
483
+ # 'extend' is blacklisted because it is used by
484
+ # construct_python_object_apply to add `listitems` to a newly generate
485
+ # python instance
486
+ def get_state_keys_blacklist(self):
487
+ return ['^extend$', '^__.*__$']
488
+
489
+ def get_state_keys_blacklist_regexp(self):
490
+ if not hasattr(self, 'state_keys_blacklist_regexp'):
491
+ self.state_keys_blacklist_regexp = re.compile('(' + '|'.join(self.get_state_keys_blacklist()) + ')')
492
+ return self.state_keys_blacklist_regexp
493
+
494
+ def construct_python_str(self, node):
495
+ return self.construct_scalar(node)
496
+
497
+ def construct_python_unicode(self, node):
498
+ return self.construct_scalar(node)
499
+
500
+ def construct_python_bytes(self, node):
501
+ try:
502
+ value = self.construct_scalar(node).encode('ascii')
503
+ except UnicodeEncodeError as exc:
504
+ raise ConstructorError(None, None,
505
+ "failed to convert base64 data into ascii: %s" % exc,
506
+ node.start_mark)
507
+ try:
508
+ if hasattr(base64, 'decodebytes'):
509
+ return base64.decodebytes(value)
510
+ else:
511
+ return base64.decodestring(value)
512
+ except binascii.Error as exc:
513
+ raise ConstructorError(None, None,
514
+ "failed to decode base64 data: %s" % exc, node.start_mark)
515
+
516
+ def construct_python_long(self, node):
517
+ return self.construct_yaml_int(node)
518
+
519
+ def construct_python_complex(self, node):
520
+ return complex(self.construct_scalar(node))
521
+
522
+ def construct_python_tuple(self, node):
523
+ return tuple(self.construct_sequence(node))
524
+
525
+ def find_python_module(self, name, mark, unsafe=False):
526
+ if not name:
527
+ raise ConstructorError("while constructing a Python module", mark,
528
+ "expected non-empty name appended to the tag", mark)
529
+ if unsafe:
530
+ try:
531
+ __import__(name)
532
+ except ImportError as exc:
533
+ raise ConstructorError("while constructing a Python module", mark,
534
+ "cannot find module %r (%s)" % (name, exc), mark)
535
+ if name not in sys.modules:
536
+ raise ConstructorError("while constructing a Python module", mark,
537
+ "module %r is not imported" % name, mark)
538
+ return sys.modules[name]
539
+
540
+ def find_python_name(self, name, mark, unsafe=False):
541
+ if not name:
542
+ raise ConstructorError("while constructing a Python object", mark,
543
+ "expected non-empty name appended to the tag", mark)
544
+ if '.' in name:
545
+ module_name, object_name = name.rsplit('.', 1)
546
+ else:
547
+ module_name = 'builtins'
548
+ object_name = name
549
+ if unsafe:
550
+ try:
551
+ __import__(module_name)
552
+ except ImportError as exc:
553
+ raise ConstructorError("while constructing a Python object", mark,
554
+ "cannot find module %r (%s)" % (module_name, exc), mark)
555
+ if module_name not in sys.modules:
556
+ raise ConstructorError("while constructing a Python object", mark,
557
+ "module %r is not imported" % module_name, mark)
558
+ module = sys.modules[module_name]
559
+ if not hasattr(module, object_name):
560
+ raise ConstructorError("while constructing a Python object", mark,
561
+ "cannot find %r in the module %r"
562
+ % (object_name, module.__name__), mark)
563
+ return getattr(module, object_name)
564
+
565
+ def construct_python_name(self, suffix, node):
566
+ value = self.construct_scalar(node)
567
+ if value:
568
+ raise ConstructorError("while constructing a Python name", node.start_mark,
569
+ "expected the empty value, but found %r" % value, node.start_mark)
570
+ return self.find_python_name(suffix, node.start_mark)
571
+
572
+ def construct_python_module(self, suffix, node):
573
+ value = self.construct_scalar(node)
574
+ if value:
575
+ raise ConstructorError("while constructing a Python module", node.start_mark,
576
+ "expected the empty value, but found %r" % value, node.start_mark)
577
+ return self.find_python_module(suffix, node.start_mark)
578
+
579
+ def make_python_instance(self, suffix, node,
580
+ args=None, kwds=None, newobj=False, unsafe=False):
581
+ if not args:
582
+ args = []
583
+ if not kwds:
584
+ kwds = {}
585
+ cls = self.find_python_name(suffix, node.start_mark)
586
+ if not (unsafe or isinstance(cls, type)):
587
+ raise ConstructorError("while constructing a Python instance", node.start_mark,
588
+ "expected a class, but found %r" % type(cls),
589
+ node.start_mark)
590
+ if newobj and isinstance(cls, type):
591
+ return cls.__new__(cls, *args, **kwds)
592
+ else:
593
+ return cls(*args, **kwds)
594
+
595
+ def set_python_instance_state(self, instance, state, unsafe=False):
596
+ if hasattr(instance, '__setstate__'):
597
+ instance.__setstate__(state)
598
+ else:
599
+ slotstate = {}
600
+ if isinstance(state, tuple) and len(state) == 2:
601
+ state, slotstate = state
602
+ if hasattr(instance, '__dict__'):
603
+ if not unsafe and state:
604
+ for key in state.keys():
605
+ self.check_state_key(key)
606
+ instance.__dict__.update(state)
607
+ elif state:
608
+ slotstate.update(state)
609
+ for key, value in slotstate.items():
610
+ if not unsafe:
611
+ self.check_state_key(key)
612
+ setattr(instance, key, value)
613
+
614
+ def construct_python_object(self, suffix, node):
615
+ # Format:
616
+ # !!python/object:module.name { ... state ... }
617
+ instance = self.make_python_instance(suffix, node, newobj=True)
618
+ yield instance
619
+ deep = hasattr(instance, '__setstate__')
620
+ state = self.construct_mapping(node, deep=deep)
621
+ self.set_python_instance_state(instance, state)
622
+
623
+ def construct_python_object_apply(self, suffix, node, newobj=False):
624
+ # Format:
625
+ # !!python/object/apply # (or !!python/object/new)
626
+ # args: [ ... arguments ... ]
627
+ # kwds: { ... keywords ... }
628
+ # state: ... state ...
629
+ # listitems: [ ... listitems ... ]
630
+ # dictitems: { ... dictitems ... }
631
+ # or short format:
632
+ # !!python/object/apply [ ... arguments ... ]
633
+ # The difference between !!python/object/apply and !!python/object/new
634
+ # is how an object is created, check make_python_instance for details.
635
+ if isinstance(node, SequenceNode):
636
+ args = self.construct_sequence(node, deep=True)
637
+ kwds = {}
638
+ state = {}
639
+ listitems = []
640
+ dictitems = {}
641
+ else:
642
+ value = self.construct_mapping(node, deep=True)
643
+ args = value.get('args', [])
644
+ kwds = value.get('kwds', {})
645
+ state = value.get('state', {})
646
+ listitems = value.get('listitems', [])
647
+ dictitems = value.get('dictitems', {})
648
+ instance = self.make_python_instance(suffix, node, args, kwds, newobj)
649
+ if state:
650
+ self.set_python_instance_state(instance, state)
651
+ if listitems:
652
+ instance.extend(listitems)
653
+ if dictitems:
654
+ for key in dictitems:
655
+ instance[key] = dictitems[key]
656
+ return instance
657
+
658
+ def construct_python_object_new(self, suffix, node):
659
+ return self.construct_python_object_apply(suffix, node, newobj=True)
660
+
661
+ FullConstructor.add_constructor(
662
+ 'tag:yaml.org,2002:python/none',
663
+ FullConstructor.construct_yaml_null)
664
+
665
+ FullConstructor.add_constructor(
666
+ 'tag:yaml.org,2002:python/bool',
667
+ FullConstructor.construct_yaml_bool)
668
+
669
+ FullConstructor.add_constructor(
670
+ 'tag:yaml.org,2002:python/str',
671
+ FullConstructor.construct_python_str)
672
+
673
+ FullConstructor.add_constructor(
674
+ 'tag:yaml.org,2002:python/unicode',
675
+ FullConstructor.construct_python_unicode)
676
+
677
+ FullConstructor.add_constructor(
678
+ 'tag:yaml.org,2002:python/bytes',
679
+ FullConstructor.construct_python_bytes)
680
+
681
+ FullConstructor.add_constructor(
682
+ 'tag:yaml.org,2002:python/int',
683
+ FullConstructor.construct_yaml_int)
684
+
685
+ FullConstructor.add_constructor(
686
+ 'tag:yaml.org,2002:python/long',
687
+ FullConstructor.construct_python_long)
688
+
689
+ FullConstructor.add_constructor(
690
+ 'tag:yaml.org,2002:python/float',
691
+ FullConstructor.construct_yaml_float)
692
+
693
+ FullConstructor.add_constructor(
694
+ 'tag:yaml.org,2002:python/complex',
695
+ FullConstructor.construct_python_complex)
696
+
697
+ FullConstructor.add_constructor(
698
+ 'tag:yaml.org,2002:python/list',
699
+ FullConstructor.construct_yaml_seq)
700
+
701
+ FullConstructor.add_constructor(
702
+ 'tag:yaml.org,2002:python/tuple',
703
+ FullConstructor.construct_python_tuple)
704
+
705
+ FullConstructor.add_constructor(
706
+ 'tag:yaml.org,2002:python/dict',
707
+ FullConstructor.construct_yaml_map)
708
+
709
+ FullConstructor.add_multi_constructor(
710
+ 'tag:yaml.org,2002:python/name:',
711
+ FullConstructor.construct_python_name)
712
+
713
+ class UnsafeConstructor(FullConstructor):
714
+
715
+ def find_python_module(self, name, mark):
716
+ return super(UnsafeConstructor, self).find_python_module(name, mark, unsafe=True)
717
+
718
+ def find_python_name(self, name, mark):
719
+ return super(UnsafeConstructor, self).find_python_name(name, mark, unsafe=True)
720
+
721
+ def make_python_instance(self, suffix, node, args=None, kwds=None, newobj=False):
722
+ return super(UnsafeConstructor, self).make_python_instance(
723
+ suffix, node, args, kwds, newobj, unsafe=True)
724
+
725
+ def set_python_instance_state(self, instance, state):
726
+ return super(UnsafeConstructor, self).set_python_instance_state(
727
+ instance, state, unsafe=True)
728
+
729
+ UnsafeConstructor.add_multi_constructor(
730
+ 'tag:yaml.org,2002:python/module:',
731
+ UnsafeConstructor.construct_python_module)
732
+
733
+ UnsafeConstructor.add_multi_constructor(
734
+ 'tag:yaml.org,2002:python/object:',
735
+ UnsafeConstructor.construct_python_object)
736
+
737
+ UnsafeConstructor.add_multi_constructor(
738
+ 'tag:yaml.org,2002:python/object/new:',
739
+ UnsafeConstructor.construct_python_object_new)
740
+
741
+ UnsafeConstructor.add_multi_constructor(
742
+ 'tag:yaml.org,2002:python/object/apply:',
743
+ UnsafeConstructor.construct_python_object_apply)
744
+
745
+ # Constructor is same as UnsafeConstructor. Need to leave this in place in case
746
+ # people have extended it directly.
747
+ class Constructor(UnsafeConstructor):
748
+ pass
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/cyaml.py ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ __all__ = [
3
+ 'CBaseLoader', 'CSafeLoader', 'CFullLoader', 'CUnsafeLoader', 'CLoader',
4
+ 'CBaseDumper', 'CSafeDumper', 'CDumper'
5
+ ]
6
+
7
+ from yaml._yaml import CParser, CEmitter
8
+
9
+ from .constructor import *
10
+
11
+ from .serializer import *
12
+ from .representer import *
13
+
14
+ from .resolver import *
15
+
16
+ class CBaseLoader(CParser, BaseConstructor, BaseResolver):
17
+
18
+ def __init__(self, stream):
19
+ CParser.__init__(self, stream)
20
+ BaseConstructor.__init__(self)
21
+ BaseResolver.__init__(self)
22
+
23
+ class CSafeLoader(CParser, SafeConstructor, Resolver):
24
+
25
+ def __init__(self, stream):
26
+ CParser.__init__(self, stream)
27
+ SafeConstructor.__init__(self)
28
+ Resolver.__init__(self)
29
+
30
+ class CFullLoader(CParser, FullConstructor, Resolver):
31
+
32
+ def __init__(self, stream):
33
+ CParser.__init__(self, stream)
34
+ FullConstructor.__init__(self)
35
+ Resolver.__init__(self)
36
+
37
+ class CUnsafeLoader(CParser, UnsafeConstructor, Resolver):
38
+
39
+ def __init__(self, stream):
40
+ CParser.__init__(self, stream)
41
+ UnsafeConstructor.__init__(self)
42
+ Resolver.__init__(self)
43
+
44
+ class CLoader(CParser, Constructor, Resolver):
45
+
46
+ def __init__(self, stream):
47
+ CParser.__init__(self, stream)
48
+ Constructor.__init__(self)
49
+ Resolver.__init__(self)
50
+
51
+ class CBaseDumper(CEmitter, BaseRepresenter, BaseResolver):
52
+
53
+ def __init__(self, stream,
54
+ default_style=None, default_flow_style=False,
55
+ canonical=None, indent=None, width=None,
56
+ allow_unicode=None, line_break=None,
57
+ encoding=None, explicit_start=None, explicit_end=None,
58
+ version=None, tags=None, sort_keys=True):
59
+ CEmitter.__init__(self, stream, canonical=canonical,
60
+ indent=indent, width=width, encoding=encoding,
61
+ allow_unicode=allow_unicode, line_break=line_break,
62
+ explicit_start=explicit_start, explicit_end=explicit_end,
63
+ version=version, tags=tags)
64
+ Representer.__init__(self, default_style=default_style,
65
+ default_flow_style=default_flow_style, sort_keys=sort_keys)
66
+ Resolver.__init__(self)
67
+
68
+ class CSafeDumper(CEmitter, SafeRepresenter, Resolver):
69
+
70
+ def __init__(self, stream,
71
+ default_style=None, default_flow_style=False,
72
+ canonical=None, indent=None, width=None,
73
+ allow_unicode=None, line_break=None,
74
+ encoding=None, explicit_start=None, explicit_end=None,
75
+ version=None, tags=None, sort_keys=True):
76
+ CEmitter.__init__(self, stream, canonical=canonical,
77
+ indent=indent, width=width, encoding=encoding,
78
+ allow_unicode=allow_unicode, line_break=line_break,
79
+ explicit_start=explicit_start, explicit_end=explicit_end,
80
+ version=version, tags=tags)
81
+ SafeRepresenter.__init__(self, default_style=default_style,
82
+ default_flow_style=default_flow_style, sort_keys=sort_keys)
83
+ Resolver.__init__(self)
84
+
85
+ class CDumper(CEmitter, Serializer, Representer, Resolver):
86
+
87
+ def __init__(self, stream,
88
+ default_style=None, default_flow_style=False,
89
+ canonical=None, indent=None, width=None,
90
+ allow_unicode=None, line_break=None,
91
+ encoding=None, explicit_start=None, explicit_end=None,
92
+ version=None, tags=None, sort_keys=True):
93
+ CEmitter.__init__(self, stream, canonical=canonical,
94
+ indent=indent, width=width, encoding=encoding,
95
+ allow_unicode=allow_unicode, line_break=line_break,
96
+ explicit_start=explicit_start, explicit_end=explicit_end,
97
+ version=version, tags=tags)
98
+ Representer.__init__(self, default_style=default_style,
99
+ default_flow_style=default_flow_style, sort_keys=sort_keys)
100
+ Resolver.__init__(self)
101
+
platform/dbops/archive/databases_old/data/home/x/.local/lib/python3.12/site-packages/invoke/vendor/yaml/dumper.py ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ __all__ = ['BaseDumper', 'SafeDumper', 'Dumper']
3
+
4
+ from .emitter import *
5
+ from .serializer import *
6
+ from .representer import *
7
+ from .resolver import *
8
+
9
+ class BaseDumper(Emitter, Serializer, BaseRepresenter, BaseResolver):
10
+
11
+ def __init__(self, stream,
12
+ default_style=None, default_flow_style=False,
13
+ canonical=None, indent=None, width=None,
14
+ allow_unicode=None, line_break=None,
15
+ encoding=None, explicit_start=None, explicit_end=None,
16
+ version=None, tags=None, sort_keys=True):
17
+ Emitter.__init__(self, stream, canonical=canonical,
18
+ indent=indent, width=width,
19
+ allow_unicode=allow_unicode, line_break=line_break)
20
+ Serializer.__init__(self, encoding=encoding,
21
+ explicit_start=explicit_start, explicit_end=explicit_end,
22
+ version=version, tags=tags)
23
+ Representer.__init__(self, default_style=default_style,
24
+ default_flow_style=default_flow_style, sort_keys=sort_keys)
25
+ Resolver.__init__(self)
26
+
27
+ class SafeDumper(Emitter, Serializer, SafeRepresenter, Resolver):
28
+
29
+ def __init__(self, stream,
30
+ default_style=None, default_flow_style=False,
31
+ canonical=None, indent=None, width=None,
32
+ allow_unicode=None, line_break=None,
33
+ encoding=None, explicit_start=None, explicit_end=None,
34
+ version=None, tags=None, sort_keys=True):
35
+ Emitter.__init__(self, stream, canonical=canonical,
36
+ indent=indent, width=width,
37
+ allow_unicode=allow_unicode, line_break=line_break)
38
+ Serializer.__init__(self, encoding=encoding,
39
+ explicit_start=explicit_start, explicit_end=explicit_end,
40
+ version=version, tags=tags)
41
+ SafeRepresenter.__init__(self, default_style=default_style,
42
+ default_flow_style=default_flow_style, sort_keys=sort_keys)
43
+ Resolver.__init__(self)
44
+
45
+ class Dumper(Emitter, Serializer, Representer, Resolver):
46
+
47
+ def __init__(self, stream,
48
+ default_style=None, default_flow_style=False,
49
+ canonical=None, indent=None, width=None,
50
+ allow_unicode=None, line_break=None,
51
+ encoding=None, explicit_start=None, explicit_end=None,
52
+ version=None, tags=None, sort_keys=True):
53
+ Emitter.__init__(self, stream, canonical=canonical,
54
+ indent=indent, width=width,
55
+ allow_unicode=allow_unicode, line_break=line_break)
56
+ Serializer.__init__(self, encoding=encoding,
57
+ explicit_start=explicit_start, explicit_end=explicit_end,
58
+ version=version, tags=tags)
59
+ Representer.__init__(self, default_style=default_style,
60
+ default_flow_style=default_flow_style, sort_keys=sort_keys)
61
+ Resolver.__init__(self)
62
+