From cfe909611a56035263c4d22aa850665e2ecdcc07 Mon Sep 17 00:00:00 2001 From: AN Long Date: Tue, 18 Jun 2024 15:52:35 +0800 Subject: [PATCH] Fix typos (#275) * Fix typo for Hander * Fix typos in error message --- thriftpy2/http.py | 4 ++-- thriftpy2/parser/lexer.py | 2 +- thriftpy2/parser/parser.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/thriftpy2/http.py b/thriftpy2/http.py index ae18c3a7..33fd35e7 100644 --- a/thriftpy2/http.py +++ b/thriftpy2/http.py @@ -125,7 +125,7 @@ def __init__(self, thttpserver = self - class RequestHander(http_server.BaseHTTPRequestHandler): + class RequestHandler(http_server.BaseHTTPRequestHandler): # Don't care about the request path. def do_POST(self): @@ -153,7 +153,7 @@ def do_POST(self): self.end_headers() self.wfile.write(otrans.getvalue()) - self.httpd = server_class(server_address, RequestHander) + self.httpd = server_class(server_address, RequestHandler) def serve(self): self.httpd.serve_forever() diff --git a/thriftpy2/parser/lexer.py b/thriftpy2/parser/lexer.py index 091c927b..581cd6e2 100644 --- a/thriftpy2/parser/lexer.py +++ b/thriftpy2/parser/lexer.py @@ -238,7 +238,7 @@ def t_LITERAL(t): if s[i] in maps: val += maps[s[i]] else: - msg = 'Unexcepted escaping characher: %s' % s[i] + msg = 'Unexpected escaping character: %s' % s[i] raise ThriftLexerError(msg) else: val += s[i] diff --git a/thriftpy2/parser/parser.py b/thriftpy2/parser/parser.py index a67d87fb..bf6c5257 100644 --- a/thriftpy2/parser/parser.py +++ b/thriftpy2/parser/parser.py @@ -169,7 +169,7 @@ def p_const_ref(p): father = child child = getattr(child, name, None) if child is None: - raise ThriftParserError('Cann\'t find name %r at line %d' + raise ThriftParserError('Can\'t find name %r at line %d' % (p[1], p.lineno(1))) if _get_ttype(child) is None or _get_ttype(father) == TType.I32: