Skip to content

Commit a8fc20c

Browse files
committed
Rename _strip_syntax to strip_syntax
1 parent 15e5bd1 commit a8fc20c

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

isort/identify.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from pathlib import Path
66
from typing import Iterator, NamedTuple, Optional, TextIO, Tuple
77

8-
from isort.parse import _strip_syntax, normalize_line, skip_line
8+
from isort.parse import normalize_line, skip_line, strip_syntax
99

1010
from .comments import parse as parse_comments
1111
from .settings import DEFAULT_CONFIG, Config
@@ -162,7 +162,7 @@ def imports(
162162

163163
just_imports = [
164164
item.replace("{|", "{ ").replace("|}", " }")
165-
for item in _strip_syntax(import_string).split()
165+
for item in strip_syntax(import_string).split()
166166
]
167167

168168
direct_imports = just_imports[1:]

isort/parse.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def import_type(line: str, config: Config = DEFAULT_CONFIG) -> Optional[str]:
6464
return None
6565

6666

67-
def _strip_syntax(import_string: str) -> str:
67+
def strip_syntax(import_string: str) -> str:
6868
import_string = import_string.replace("_import", "[[i]]")
6969
import_string = import_string.replace("_cimport", "[[ci]]")
7070
for remove_syntax in ["\\", "(", ")", ","]:
@@ -276,7 +276,7 @@ def file_contents(contents: str, config: Config = DEFAULT_CONFIG) -> ParsedConte
276276
nested_comments = {}
277277
import_string, comment = parse_comments(line)
278278
comments = [comment] if comment else []
279-
line_parts = [part for part in _strip_syntax(import_string).strip().split(" ") if part]
279+
line_parts = [part for part in strip_syntax(import_string).strip().split(" ") if part]
280280
if type_of_import == "from" and len(line_parts) == 2 and comments:
281281
nested_comments[line_parts[-1]] = comments[0]
282282

@@ -286,7 +286,7 @@ def file_contents(contents: str, config: Config = DEFAULT_CONFIG) -> ParsedConte
286286
index += 1
287287
if new_comment:
288288
comments.append(new_comment)
289-
stripped_line = _strip_syntax(line).strip()
289+
stripped_line = strip_syntax(line).strip()
290290
if (
291291
type_of_import == "from"
292292
and stripped_line
@@ -310,7 +310,7 @@ def file_contents(contents: str, config: Config = DEFAULT_CONFIG) -> ParsedConte
310310
and ")" not in line.split("#")[0]
311311
and index < line_count
312312
):
313-
stripped_line = _strip_syntax(line).strip()
313+
stripped_line = strip_syntax(line).strip()
314314
if (
315315
type_of_import == "from"
316316
and stripped_line
@@ -326,7 +326,7 @@ def file_contents(contents: str, config: Config = DEFAULT_CONFIG) -> ParsedConte
326326
index += 1
327327
if new_comment:
328328
comments.append(new_comment)
329-
stripped_line = _strip_syntax(line).strip()
329+
stripped_line = strip_syntax(line).strip()
330330
if (
331331
type_of_import == "from"
332332
and stripped_line
@@ -337,7 +337,7 @@ def file_contents(contents: str, config: Config = DEFAULT_CONFIG) -> ParsedConte
337337
import_string += line_separator + line
338338
raw_lines.append(line)
339339

340-
stripped_line = _strip_syntax(line).strip()
340+
stripped_line = strip_syntax(line).strip()
341341
if (
342342
type_of_import == "from"
343343
and stripped_line
@@ -378,7 +378,7 @@ def file_contents(contents: str, config: Config = DEFAULT_CONFIG) -> ParsedConte
378378

379379
just_imports = [
380380
item.replace("{|", "{ ").replace("|}", " }")
381-
for item in _strip_syntax(import_string).split()
381+
for item in strip_syntax(import_string).split()
382382
]
383383

384384
attach_comments_to: Optional[List[Any]] = None

tests/unit/test_parse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def test_fuzz__infer_line_separator(contents):
5959

6060
@given(import_string=st.text())
6161
def test_fuzz__strip_syntax(import_string):
62-
parse._strip_syntax(import_string=import_string)
62+
parse.strip_syntax(import_string=import_string)
6363

6464

6565
@given(line=st.text(), config=st.builds(Config))

0 commit comments

Comments
 (0)