summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Crosley <timothy.crosley@gmail.com>2019-10-25 20:02:33 -0700
committerTimothy Crosley <timothy.crosley@gmail.com>2019-10-25 20:02:33 -0700
commitdf6a6e64eedd6b9a975161589be917bc5fdc57a0 (patch)
treeda5f4f989b87bc90f2a0d125354dae076de1e882
parent5b9c5775f238c9962e69605171f0152bf16bb0e2 (diff)
downloadisort-feature/refactor-wrappping-logic.tar.gz
Remove accidentally checked in filesfeature/refactor-wrappping-logic
-rw-r--r--isort/new_wrap43
-rw-r--r--isort/new_wrap_line61
-rw-r--r--isort/old_wrap1
-rw-r--r--isort/old_wrap_line61
4 files changed, 0 insertions, 166 deletions
diff --git a/isort/new_wrap b/isort/new_wrap
deleted file mode 100644
index 08a644ab..00000000
--- a/isort/new_wrap
+++ /dev/null
@@ -1,43 +0,0 @@
- formatter = _wrap_modes.get(config["multi_line_output"].name.upper(), grid)
- dynamic_indent = " " * (len(import_start) + 1)
- indent = config["indent"]
- line_length = config["wrap_length"] or config["line_length"]
- import_statement = formatter(
- statement=import_start,
- imports=copy.copy(from_imports),
- white_space=dynamic_indent,
- indent=indent,
- line_length=line_length,
- comments=comments,
- line_separator=line_separator,
- comment_prefix=config["comment_prefix"],
- include_trailing_comma=config["include_trailing_comma"],
- remove_comments=config["ignore_comments"],
- )
- if config["balanced_wrapping"]:
- lines = import_statement.split(line_separator)
- line_count = len(lines)
- if len(lines) > 1:
- minimum_length = min(len(line) for line in lines[:-1])
- else:
- minimum_length = 0
- new_import_statement = import_statement
- while len(lines[-1]) < minimum_length and len(lines) == line_count and line_length > 10:
- import_statement = new_import_statement
- line_length -= 1
- new_import_statement = formatter(
- statement=import_start,
- imports=copy.copy(from_imports),
- white_space=dynamic_indent,
- indent=indent,
- line_length=line_length,
- comments=comments,
- line_separator=line_separator,
- comment_prefix=config["comment_prefix"],
- include_trailing_comma=config["include_trailing_comma"],
- remove_comments=config["ignore_comments"],
- )
- lines = new_import_statement.split(line_separator)
- if import_statement.count(line_separator) == 0:
- return wrap_line(import_statement, line_separator, config)
- return import_statement
diff --git a/isort/new_wrap_line b/isort/new_wrap_line
deleted file mode 100644
index 410ac21f..00000000
--- a/isort/new_wrap_line
+++ /dev/null
@@ -1,61 +0,0 @@
-wrap_mode = config["multi_line_output"]
-print(wrap_mode)
-print("line: ", repr(line_separator))
-if len(line) > config["line_length"] and wrap_mode != WrapModes.NOQA: # type: ignore
- line_without_comment = line
- comment = None
- if "#" in line:
- line_without_comment, comment = line.split("#", 1)
- for splitter in ("import ", ".", "as "):
- exp = r"\b" + re.escape(splitter) + r"\b"
- if re.search(exp, line_without_comment) and not line_without_comment.strip().startswith(
- splitter
- ):
- line_parts = re.split(exp, line_without_comment)
- if comment:
- line_parts[-1] = "{}{} #{}".format(
- line_parts[-1].strip(),
- "," if config["include_trailing_comma"] else "",
- comment,
- )
- next_line = []
- while (len(line) + 2) > (
- config["wrap_length"] or config["line_length"]
- ) and line_parts:
- next_line.append(line_parts.pop())
- line = splitter.join(line_parts)
- if not line:
- line = next_line.pop()
-
- cont_line = wrap_line(
- config["indent"] + splitter.join(next_line).lstrip(), line_separator, config
- )
- if config["use_parentheses"]:
- if splitter == "as ":
- output = "{}{}{}".format(line, splitter, cont_line.lstrip())
- else:
- output = "{}{}({}{}{}{})".format(
- line,
- splitter,
- line_separator,
- cont_line,
- "," if config["include_trailing_comma"] and not comment else "",
- line_separator
- if wrap_mode
- in {
- WrapModes.VERTICAL_HANGING_INDENT, # type: ignore
- WrapModes.VERTICAL_GRID_GROUPED, # type: ignore
- }
- else "",
- )
- lines = output.split(line_separator)
- if config["comment_prefix"] in lines[-1] and lines[-1].endswith(")"):
- line, comment = lines[-1].split(config["comment_prefix"], 1)
- lines[-1] = line + ")" + config["comment_prefix"] + comment[:-1]
- return line_separator.join(lines)
- return "{}{}\\{}{}".format(line, splitter, line_separator, cont_line)
-elif len(line) > config["line_length"] and wrap_mode == WrapModes.NOQA: # type: ignore
- if "# NOQA" not in line:
- return "{}{} NOQA".format(line, config["comment_prefix"])
-
-return line
diff --git a/isort/old_wrap b/isort/old_wrap
deleted file mode 100644
index 8b137891..00000000
--- a/isort/old_wrap
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/isort/old_wrap_line b/isort/old_wrap_line
deleted file mode 100644
index ce22969d..00000000
--- a/isort/old_wrap_line
+++ /dev/null
@@ -1,61 +0,0 @@
-wrap_mode = self.config["multi_line_output"]
-if len(line) > self.config["line_length"] and wrap_mode != WrapModes.NOQA:
- line_without_comment = line
- comment = None
- if "#" in line:
- line_without_comment, comment = line.split("#", 1)
- for splitter in ("import ", ".", "as "):
- exp = r"\b" + re.escape(splitter) + r"\b"
- if re.search(
- exp, line_without_comment
- ) and not line_without_comment.strip().startswith(splitter):
- line_parts = re.split(exp, line_without_comment)
- if comment:
- line_parts[-1] = "{}{} #{}".format(
- line_parts[-1].strip(),
- "," if self.config["include_trailing_comma"] else "",
- comment,
- )
- next_line = []
- while (len(line) + 2) > (
- self.config["wrap_length"] or self.config["line_length"]
- ) and line_parts:
- next_line.append(line_parts.pop())
- line = splitter.join(line_parts)
- if not line:
- line = next_line.pop()
-
- cont_line = self._wrap(
- self.config["indent"] + splitter.join(next_line).lstrip()
- )
- if self.config["use_parentheses"]:
- if splitter == "as ":
- output = "{}{}{}".format(line, splitter, cont_line.lstrip())
- else:
- output = "{}{}({}{}{}{})".format(
- line,
- splitter,
- self.line_separator,
- cont_line,
- ","
- if self.config["include_trailing_comma"] and not comment
- else "",
- self.line_separator
- if wrap_mode
- in {
- WrapModes.VERTICAL_HANGING_INDENT,
- WrapModes.VERTICAL_GRID_GROUPED,
- }
- else "",
- )
- lines = output.split(self.line_separator)
- if self.config["comment_prefix"] in lines[-1] and lines[-1].endswith(")"):
- line, comment = lines[-1].split(self.config["comment_prefix"], 1)
- lines[-1] = line + ")" + self.config["comment_prefix"] + comment[:-1]
- return self.line_separator.join(lines)
- return "{}{}\\{}{}".format(line, splitter, self.line_separator, cont_line)
-elif len(line) > self.config["line_length"] and wrap_mode == settings.WrapModes.NOQA:
- if "# NOQA" not in line:
- return "{}{} NOQA".format(line, self.config["comment_prefix"])
-
-return line