From 4bc5e274305635dfebf8039868d3fbc5342b03e4 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Fri, 19 May 2017 10:05:45 -0400 Subject: [PATCH] Make an internal function public, because it was used outside of the defining module. --- parso/python/__init__.py | 4 ++-- parso/python/diff.py | 4 ++-- parso/python/parser.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/parso/python/__init__.py b/parso/python/__init__.py index dbbc6d6..f544d8a 100644 --- a/parso/python/__init__.py +++ b/parso/python/__init__.py @@ -6,7 +6,7 @@ import os from parso.utils import splitlines, source_to_unicode from parso._compatibility import FileNotFoundError from parso.pgen2.pgen import generate_grammar -from parso.python.parser import Parser, _remove_last_newline +from parso.python.parser import Parser, remove_last_newline from parso.python.diff import DiffParser from parso.tokenize import generate_tokens from parso.cache import parser_cache, load_module, save_module @@ -136,7 +136,7 @@ def parse(code=None, **kwargs): p = Parser(grammar, error_recovery=error_recovery, start_symbol=start_symbol) root_node = p.parse(tokens=tokens) if added_newline: - _remove_last_newline(root_node) + remove_last_newline(root_node) if cache or diff_cache: save_module(grammar, path, root_node, lines, pickling=cache, diff --git a/parso/python/diff.py b/parso/python/diff.py index abfa9bb..1928fa9 100644 --- a/parso/python/diff.py +++ b/parso/python/diff.py @@ -11,7 +11,7 @@ from collections import namedtuple import logging from parso.utils import splitlines -from parso.python.parser import Parser, _remove_last_newline +from parso.python.parser import Parser, remove_last_newline from parso.python.tree import EndMarker from parso.tokenize import (generate_tokens, NEWLINE, TokenInfo, ENDMARKER, INDENT, DEDENT) @@ -160,7 +160,7 @@ class DiffParser(object): self._nodes_stack.close() if self._added_newline: - _remove_last_newline(self._module) + remove_last_newline(self._module) last_pos = self._module.end_pos[0] if last_pos != line_length: diff --git a/parso/python/parser.py b/parso/python/parser.py index baf5dcc..ceb4c59 100644 --- a/parso/python/parser.py +++ b/parso/python/parser.py @@ -195,7 +195,7 @@ class Parser(BaseParser): yield typ, value, start_pos, prefix -def _remove_last_newline(node): +def remove_last_newline(node): endmarker = node.children[-1] # The newline is either in the endmarker as a prefix or the previous # leaf as a newline token.