summaryrefslogtreecommitdiff
path: root/isort/utils.py
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2019-08-15 03:47:39 -0700
committerTimothy Edmund Crosley <timothy.crosley@gmail.com>2019-08-15 22:51:08 -0700
commitafa21c7b62e0c4a464ec99103919bfa2c2ef1855 (patch)
tree89b4283e9cd3ee48c13f2f45c92e2147f0882f5b /isort/utils.py
parentf7ce039ece48b7d8dfc3061c90fbc7a566d0b22a (diff)
downloadisort-afa21c7b62e0c4a464ec99103919bfa2c2ef1855.tar.gz
Introduce Black to automate code formatting
Use Black, the uncompromising Python code formatter, to format the project and simplify contributions. Contributors no longer need to think or care about the project's preferred style, just let the tools handle it instead. Black is becoming more and more popular across Python projects and has recently became a project under the Python Software Foundation. This is especially important with the adoption of mypy as type annotations create another obstacle or consideration in code formatting, but Black handles this just fine. Many projects use both Black and isort. Using Black internally also helps ensure continued compatibility between the two popular projects. For more details on Black, see: https://github.com/psf/black > Black is the uncompromising Python code formatter. By using it, you > agree to cede control over minutiae of hand-formatting. In return, > Black gives you speed, determinism, and freedom from pycodestyle > nagging about formatting. You will save time and mental energy for > more important matters.
Diffstat (limited to 'isort/utils.py')
-rw-r--r--isort/utils.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/isort/utils.py b/isort/utils.py
index 0f6f57bf..d0414b1e 100644
--- a/isort/utils.py
+++ b/isort/utils.py
@@ -13,7 +13,7 @@ def exists_case_sensitive(path: str) -> bool:
can only import using the case of the real file.
"""
result = os.path.exists(path)
- if (sys.platform.startswith('win') or sys.platform == 'darwin') and result:
+ if (sys.platform.startswith("win") or sys.platform == "darwin") and result:
directory, basename = os.path.split(path)
result = basename in os.listdir(directory)
return result
@@ -55,9 +55,9 @@ def difference(a: Iterable[Any], b: Container[Any]) -> List[Any]:
def infer_line_separator(file_contents: str) -> str:
- if '\r\n' in file_contents:
- return '\r\n'
- elif '\r' in file_contents:
- return '\r'
+ if "\r\n" in file_contents:
+ return "\r\n"
+ elif "\r" in file_contents:
+ return "\r"
else:
- return '\n'
+ return "\n"