summaryrefslogtreecommitdiffstats
path: root/third_party/python/PyYAML/lib/yaml/parser.py
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/python/PyYAML/lib/yaml/parser.py')
-rw-r--r--third_party/python/PyYAML/lib/yaml/parser.py32
1 files changed, 16 insertions, 16 deletions
diff --git a/third_party/python/PyYAML/lib/yaml/parser.py b/third_party/python/PyYAML/lib/yaml/parser.py
index f9e3057f33..13a5995d29 100644
--- a/third_party/python/PyYAML/lib/yaml/parser.py
+++ b/third_party/python/PyYAML/lib/yaml/parser.py
@@ -61,21 +61,21 @@
__all__ = ['Parser', 'ParserError']
-from error import MarkedYAMLError
-from tokens import *
-from events import *
-from scanner import *
+from .error import MarkedYAMLError
+from .tokens import *
+from .events import *
+from .scanner import *
class ParserError(MarkedYAMLError):
pass
-class Parser(object):
+class Parser:
# Since writing a recursive-descendant parser is a straightforward task, we
# do not give many comments here.
DEFAULT_TAGS = {
- u'!': u'!',
- u'!!': u'tag:yaml.org,2002:',
+ '!': '!',
+ '!!': 'tag:yaml.org,2002:',
}
def __init__(self):
@@ -219,7 +219,7 @@ class Parser(object):
self.tag_handles = {}
while self.check_token(DirectiveToken):
token = self.get_token()
- if token.name == u'YAML':
+ if token.name == 'YAML':
if self.yaml_version is not None:
raise ParserError(None, None,
"found duplicate YAML directive", token.start_mark)
@@ -229,11 +229,11 @@ class Parser(object):
"found incompatible YAML document (version 1.* is required)",
token.start_mark)
self.yaml_version = token.value
- elif token.name == u'TAG':
+ elif token.name == 'TAG':
handle, prefix = token.value
if handle in self.tag_handles:
raise ParserError(None, None,
- "duplicate tag handle %r" % handle.encode('utf-8'),
+ "duplicate tag handle %r" % handle,
token.start_mark)
self.tag_handles[handle] = prefix
if self.tag_handles:
@@ -303,19 +303,19 @@ class Parser(object):
if handle is not None:
if handle not in self.tag_handles:
raise ParserError("while parsing a node", start_mark,
- "found undefined tag handle %r" % handle.encode('utf-8'),
+ "found undefined tag handle %r" % handle,
tag_mark)
tag = self.tag_handles[handle]+suffix
else:
tag = suffix
- #if tag == u'!':
+ #if tag == '!':
# raise ParserError("while parsing a node", start_mark,
# "found non-specific tag '!'", tag_mark,
# "Please check 'http://pyyaml.org/wiki/YAMLNonSpecificTag' and share your opinion.")
if start_mark is None:
start_mark = end_mark = self.peek_token().start_mark
event = None
- implicit = (tag is None or tag == u'!')
+ implicit = (tag is None or tag == '!')
if indentless_sequence and self.check_token(BlockEntryToken):
end_mark = self.peek_token().end_mark
event = SequenceStartEvent(anchor, tag, implicit,
@@ -325,7 +325,7 @@ class Parser(object):
if self.check_token(ScalarToken):
token = self.get_token()
end_mark = token.end_mark
- if (token.plain and tag is None) or tag == u'!':
+ if (token.plain and tag is None) or tag == '!':
implicit = (True, False)
elif tag is None:
implicit = (False, True)
@@ -357,7 +357,7 @@ class Parser(object):
elif anchor is not None or tag is not None:
# Empty scalars are allowed even if a tag or an anchor is
# specified.
- event = ScalarEvent(anchor, tag, (implicit, False), u'',
+ event = ScalarEvent(anchor, tag, (implicit, False), '',
start_mark, end_mark)
self.state = self.states.pop()
else:
@@ -585,5 +585,5 @@ class Parser(object):
return self.process_empty_scalar(self.peek_token().start_mark)
def process_empty_scalar(self, mark):
- return ScalarEvent(None, None, (True, False), u'', mark, mark)
+ return ScalarEvent(None, None, (True, False), '', mark, mark)