def __init__(self, stream, stream_name): Reader.__init__(self, stream) Scanner.__init__(self) Parser.__init__(self) Composer.__init__(self) Constructor.__init__(self, stream_name) Resolver.__init__(self)
def __init__(self, stream): Reader.__init__(self, stream) Scanner.__init__(self) Parser.__init__(self) Composer.__init__(self) NodeConstructor.__init__(self) Resolver.__init__(self)
def __init__(self, stream): Reader.__init__(self, stream) Scanner.__init__(self) Parser.__init__(self) Composer.__init__(self) ExtendedSafeConstructor.__init__(self) Resolver.__init__(self)
def __init__(self, stream): Reader.__init__(self, stream) PyonYamlScanner.__init__(self) Parser.__init__(self) Composer.__init__(self) Constructor.__init__(self) Resolver.__init__(self)
def __init__(self, stream, file_name=None): Reader.__init__(self, stream) Scanner.__init__(self) Parser.__init__(self) Composer.__init__(self) AnsibleConstructor.__init__(self, file_name=file_name) Resolver.__init__(self)
def __init__(self, stream): Reader.__init__(self, stream) Scanner.__init__(self) Parser.__init__(self) Composer.__init__(self) SafeConstructor.__init__(self) BaseResolver.__init__(self)
def __init__(self, stream: TextIO) -> None: Reader.__init__(self, stream) Scanner.__init__(self) Parser.__init__(self) Composer.__init__(self) BaseConstructor.__init__(self) BaseResolver.__init__(self)
def __init__(self, stream, filename=None): Reader.__init__(self, stream) Scanner.__init__(self) Parser.__init__(self) Composer.__init__(self) HolderConstructor.__init__(self, filename) Resolver.__init__(self)
def __init__(self, stream: TextIO, *, kind: ast.FlowKind) -> None: Reader.__init__(self, stream) Scanner.__init__(self) Parser.__init__(self) Composer.__init__(self) BaseConstructor.__init__(self) BaseResolver.__init__(self) self._kind = kind
def __init__(self, stream, cfg_folder: str = None): self.cfg_folder = cfg_folder Reader.__init__(self, stream) Scanner.__init__(self) Parser.__init__(self) Composer.__init__(self) Constructor.__init__(self) Resolver.__init__(self)
def __init__(self, stream, runtime_args=None): Reader.__init__(self, stream) Scanner.__init__(self) Parser.__init__(self) Composer.__init__(self) JinaConstructor.__init__(self) JinaResolver.__init__(self) self.runtime_args = runtime_args
def __init__(self, stream, file_name=None, vault_secrets=None): Reader.__init__(self, stream) Scanner.__init__(self) Parser.__init__(self) Composer.__init__(self) AssibleConstructor.__init__(self, file_name=file_name, vault_secrets=vault_secrets) Resolver.__init__(self)
def __init__(self, stream, file_name=None, vault_password=None): Reader.__init__(self, stream) Scanner.__init__(self) Parser.__init__(self) Composer.__init__(self) AnsibleConstructor.__init__(self, file_name=file_name, b_vault_password=vault_password) Resolver.__init__(self)
def __init__(self, stream, file_name=None, line=None, column=None, vault_password=None): Reader.__init__(self, stream) Scanner.__init__(self) Parser.__init__(self) Composer.__init__(self) YAMLConstructor.__init__(self, file_name=file_name, line=line, column=column, vault_password=vault_password) Resolver.__init__(self)
def __init__(self, stream, file_name=None, vault_secrets=None): Reader.__init__(self, stream) Scanner.__init__(self) Parser.__init__(self) # pylint: disable=non-parent-init-called Composer.__init__(self) AnsibleConstructor.__init__(self, file_name=file_name, vault_secrets=vault_secrets) Resolver.__init__(self)
def __init__(self, stream): self.meta = Meta(stream, 1, 1) self._root = os.path.split(stream.name)[0] Reader.__init__(self, stream) Scanner.__init__(self) Parser.__init__(self) Composer.__init__(self) YipCons.__init__(self) Resolver.__init__(self)
def __init__(self, stream): """ Return an instance of this customised YAML Loader class. """ Reader.__init__(self, stream) Scanner.__init__(self) Parser.__init__(self) Composer.__init__(self) NodeConstructor.__init__(self) Resolver.__init__(self)
def __init__(self, stream, filename): Reader.__init__(self, stream) Scanner.__init__(self) if cyaml: Parser.__init__(self, stream) else: Parser.__init__(self) Composer.__init__(self) SafeConstructor.__init__(self) Resolver.__init__(self) NodeConstructor.__init__(self, filename)
def __init__(self, filename): self.filename = filename with open(self.filename, encoding='utf-8') as fp: stream = self.preprocess(fp.read()) Reader.__init__(self, stream) self.name = self.filename Scanner.__init__(self) Parser.__init__(self) Composer.__init__(self) Constructor.__init__(self) Resolver.__init__(self)
def __init__(self, stream): Reader.__init__(self, stream) Scanner12.__init__(self) Parser.__init__(self) Composer.__init__(self) # PKM2014 - uses SafeConstructor instead of Constructor. This should make no # difference, because "Is it YAML?" only gets as far as the composition stage, # but - well: it reduces the risk of something bad happening. # Constructor.__init__(self) SafeConstructor.__init__(self) Resolver.__init__(self)
def compose_mapping_node(self, anchor): # the column here will point at the position in the file immediately # after the first key is found, which could be a space or a newline. # We could back this up to find the beginning of the key, but this # should be good enough to determine the error location. self.__mapping_starts.append((self.line + 1, self.column + 1)) return Composer.compose_mapping_node(self, anchor)
def compose_node(parent, index): # the line number where the previous token has ended (plus empty lines) line = loader.line node = Composer.compose_node(loader, parent, index) node.__file__ = file node.__line__ = line + 1 return node
def compose_node(self, parent, index): line = self.line node = Composer.compose_node(self, parent, index) # The line number where the previous token has ended (plus empty lines) node.__line_start__ = line + 1 node.__line_end__ = self.line return node
def compose_node(self, parent, index): # Stash the associated locations on the YAML node ret = Composer.compose_node(self, parent, index) ret.__lineno__ = self.line ret.__linepos__ = self.column return ret
def compose_node(self, parent: yaml.nodes.Node, index: int) -> yaml.nodes.Node: # the line number where the previous token has ended (plus empty lines) line = self.line node = Composer.compose_node(self, parent, index) node._start_line = line + 1 return node
def compose_node(parent: yaml.nodes.Node, index: int) -> yaml.nodes.Node: # the line number where the previous token has ended (plus empty lines) line = loader.line node = Composer.compose_node(loader, parent, index) if not isinstance(node, yaml.nodes.Node): raise RuntimeError("Unexpected yaml data.") setattr(node, '__line__', line + 1) return node
def compose_node(parent, index): # the line number where the previous token has ended (plus empty lines) line = loader.line column = loader.column node = Composer.compose_node(loader, parent, index) node.__line__ = line + 1 node.__column__ = column + 1 node.__basename__ = basename node.__location__ = basename+":"+str(line + 1) return node
def compose_node(self, parent, index): # the line number where the previous token has ended (plus empty lines) node = Composer.compose_node(self, parent, index) if isinstance(node, MappingNode): node.__datasource__ = self.name try: (cur_line, cur_column) = self.__mapping_starts.pop() except: cur_line = None cur_column = None node.__line__ = cur_line node.__column__ = cur_column return node
def __init__(self, stream, cfg_folder: str = None): self.cfg_folder = cfg_folder Reader.__init__(self, stream) Scanner.__init__(self) Parser.__init__(self) Composer.__init__(self) SafeConstructor.__init__(self) Resolver.__init__(self) self.add_constructor("!format", self.__class__.format_string_constructor) self.add_constructor("!file", self.__class__.file_contructor) self.add_constructor("!include", self.__class__.include_file_constructor) self.add_constructor("!include_merge", self.__class__.include_merge_constructor) self.add_constructor( "!include_dir_file_mapped", self.__class__.include_dir_file_mapped_constructor) self.add_constructor("!env_var", self.__class__.env_var_constructor) self.add_constructor("!path", self.__class__.path_constructor) self.add_constructor("!listdir", self.__class__.listdir_constructor)
def compose_node(parent, index): # the line number where the previous token has ended (plus empty lines) line = loader.line node = Composer.compose_node(loader, parent, index) # TODO(jroovers): special case -> document better if isinstance(node.value, list) and len(node.value) > 0: if not isinstance(node.value[0], tuple): # Processing a real yaml list -> substract 1 for list_node in node.value: list_node.value['__line__'] -= 1 node.value = {"__line__": line, "__val__": node.value} return node
def compose_node(parent, index): """ Invoked when a new node (key, value or compound (dict, list) type) is created. """ line = loader.line # the line number where the previous token has ended (plus empty lines) # If we get an alias, just return the alias event, we then know how to handle it in construct_object. # This allows us to not follow aliases which is handy in many cases. # https://github.com/yaml/pyyaml/blob/a7daab723352e68a209479b781b2f03c47e5179a/lib/yaml/composer.py#L64 if loader.check_event(AliasEvent): event = loader.get_event() event.line = line # Do make sure we associate a line number with the alias return event # call the original compose_node node = Composer.compose_node(loader, parent, index) # In case we are dealing with a yaml list, the line numbers turn out to be off by 1 which we need to fix. # What the parser will do is first invoke this method with every item in the list and then invoke it again # with the entire list. At that point we can iterate over the list and substract 1 from the line numbers # of the items in the list. # For single items in a list, Composer.compose_node(...) returns a ScalarNode. node.value is then of type # str, int, float, etc. For the entire list, Composer.compose_node(...) will return a SequenceNode with # node.value being of type 'list'. So by checking for the type of node.value, we can figure out whether # we are currently processing an item in a list or the actual list itself. # The only additional required check is making sure that in case node.value is a list, the items in # node.value are not tuples (because if they are, we are dealing with a nested dictionary instead of a # normal list). We can do this by checking whether node.value[0] is an instance of tuple or not. if isinstance(node.value, list) and len(node.value) > 0: if not isinstance(node.value[0], tuple): # We're processing a real yaml list -> substract 1 from the line numbers in the list for list_node in node.value: list_node.value['__line__'] -= 1 if not isinstance(node.value, dict): # replace the value of the node with a dictionary that contains both the line number and value node.value = {"__line__": line, "__val__": node.value} return node
def compose_node(parent, index): node = Composer.compose_node(loader, parent, index) self.parse_message(node, loader.line) return node
def compose_node(parent, index): # the line number where the previous token has ended (plus empty lines) line = loader.line node = Composer.compose_node(loader, parent, index) node.__line__ = line + 1 return node
def compose_node(self, parent, index): # the line number where the previous token has ended (plus empty lines) node = Composer.compose_node(self, parent, index) node.__lineno__ = self.line + 1 return node
def compose_node(self, parent, index): # the line number where the previous token has ended (plus empty lines) node = Composer.compose_node(self.loader, parent, index) return node
def compose_node(parent, index): line = loader.line node = Composer.compose_node(loader, parent, index) node.__line__ = line + 1 return node