diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
commit | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (patch) | |
tree | 012bb94d777798f1f56ac1cec429509766d05181 /contrib/python/PyYAML/py2/yaml/scanner.py | |
parent | 6751af0b0c1b952fede40b19b71da8025b5d8bcf (diff) | |
download | ydb-2598ef1d0aee359b4b6d5fdd1758916d5907d04f.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/python/PyYAML/py2/yaml/scanner.py')
-rw-r--r-- | contrib/python/PyYAML/py2/yaml/scanner.py | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/contrib/python/PyYAML/py2/yaml/scanner.py b/contrib/python/PyYAML/py2/yaml/scanner.py index 587b73d8b4..00beebc30d 100644 --- a/contrib/python/PyYAML/py2/yaml/scanner.py +++ b/contrib/python/PyYAML/py2/yaml/scanner.py @@ -126,13 +126,13 @@ class Scanner(object): def peek_token(self): # Return the next token, but do not delete if from the queue. - # Return None if no more tokens. + # Return None if no more tokens. while self.need_more_tokens(): self.fetch_more_tokens() if self.tokens: return self.tokens[0] - else: - return None + else: + return None def get_token(self): # Return the next token. @@ -334,7 +334,7 @@ class Scanner(object): ## } #if self.flow_level and self.indent > column: # raise ScannerError(None, None, - # "invalid indentation or unclosed '[' or '{'", + # "invalid indentation or unclosed '[' or '{'", # self.get_mark()) # In the flow context, indentation is ignored. We make the scanner less @@ -372,7 +372,7 @@ class Scanner(object): def fetch_stream_end(self): - # Set the current indentation to -1. + # Set the current indentation to -1. self.unwind_indent(-1) # Reset simple keys. @@ -391,7 +391,7 @@ class Scanner(object): def fetch_directive(self): - # Set the current indentation to -1. + # Set the current indentation to -1. self.unwind_indent(-1) # Reset simple keys. @@ -409,7 +409,7 @@ class Scanner(object): def fetch_document_indicator(self, TokenClass): - # Set the current indentation to -1. + # Set the current indentation to -1. self.unwind_indent(-1) # Reset simple keys. Note that there could not be a block collection @@ -521,7 +521,7 @@ class Scanner(object): # Block context needs additional checks. if not self.flow_level: - # Are we allowed to start a key (not necessary a simple)? + # Are we allowed to start a key (not necessary a simple)? if not self.allow_simple_key: raise ScannerError(None, None, "mapping keys are not allowed here", @@ -569,7 +569,7 @@ class Scanner(object): else: # Block context needs additional checks. - # (Do we really need them? They will be caught by the parser + # (Do we really need them? They will be caught by the parser # anyway.) if not self.flow_level: @@ -907,7 +907,7 @@ class Scanner(object): # The specification does not restrict characters for anchors and # aliases. This may lead to problems, for instance, the document: # [ *alias, value ] - # can be interpreted in two ways, as + # can be interpreted in two ways, as # [ "value" ] # and # [ *alias , "value" ] @@ -1177,7 +1177,7 @@ class Scanner(object): u' ': u'\x20', u'\"': u'\"', u'\\': u'\\', - u'/': u'/', + u'/': u'/', u'N': u'\x85', u'_': u'\xA0', u'L': u'\u2028', @@ -1281,7 +1281,7 @@ class Scanner(object): def scan_plain(self): # See the specification for details. # We add an additional restriction for the flow context: - # plain scalars in the flow context cannot contain ',' or '?'. + # plain scalars in the flow context cannot contain ',' or '?'. # We also keep track of the `allow_simple_key` flag here. # Indentation rules are loosed for the flow context. chunks = [] @@ -1300,10 +1300,10 @@ class Scanner(object): while True: ch = self.peek(length) if ch in u'\0 \t\r\n\x85\u2028\u2029' \ - or (ch == u':' and - self.peek(length+1) in u'\0 \t\r\n\x85\u2028\u2029' - + (u',[]{}' if self.flow_level else u''))\ - or (self.flow_level and ch in u',?[]{}'): + or (ch == u':' and + self.peek(length+1) in u'\0 \t\r\n\x85\u2028\u2029' + + (u',[]{}' if self.flow_level else u''))\ + or (self.flow_level and ch in u',?[]{}'): break length += 1 if length == 0: |