Repository: pyjanitor-devs/pyjanitor

Issue:
[TST/INF] Weird isort output in `make check`
# Brief Description
When running `make check`, a weird output is being returned:

```
The HTML pages are in _build/html.
make[1]: Leaving directory '/Users/logan/Desktop/repos/pyjanitor/docs'
Sorting imports...
isort -rc . -y -up -tc
usage: isort [-h] [-V] [--vn] [-v] [--only-modified] [--dedup-headings] [-q]
             [-d] [--overwrite-in-place] [--show-config] [--show-files] [--df]
             [-c] [--ws] [--sp SETTINGS_PATH] [--profile PROFILE]
             [--old-finders] [-j [JOBS]] [--ac] [--interactive]
             [--format-error FORMAT_ERROR] [--format-success FORMAT_SUCCESS]
             [--filter-files] [-s SKIP] [--extend-skip EXTEND_SKIP]
             [--sg SKIP_GLOB] [--extend-skip-glob SKIP_GLOB] [--gitignore]
             [--ext SUPPORTED_EXTENSIONS]
             [--blocked-extension BLOCKED_EXTENSIONS] [--dont-follow-links]
             [--filename FILENAME] [--allow-root] [-a ADD_IMPORTS] [--append]
             [--af] [--rm REMOVE_IMPORTS] [--float-to-top]
             [--dont-float-to-top] [--ca] [--cs] [-e] [--ff FROM_FIRST]
             [--fgw [FORCE_GRID_WRAP]] [-i INDENT] [--lai LINES_AFTER_IMPORTS]
             [--lbt LINES_BETWEEN_TYPES] [--le LINE_ENDING] [--ls] [--lss]
             [-m {GRID,VERTICAL,HANGING_INDENT,VERTICAL_HANGING_INDENT,VERTICAL_GRID,VERTICAL_GRID_GROUPED,VERTICAL_GRID_GROUPED_NO_COMMA,NOQA,VERTICAL_HANGING_INDENT_BRACKET,VERTICAL_PREFIX_FROM_MODULE_IMPORT,HANGING_INDENT_WITH_PARENTHESES,BACKSLASH_GRID,0,1,2,3,4,5,6,7,8,9,10,11}]
             [-n] [--nis] [--ot] [--dt] [--rr] [--reverse-sort]
             [--sort-order SORT_ORDER] [--sl] [--nsl SINGLE_LINE_EXCLUSIONS]
             [--tc] [--up] [-l LINE_LENGTH] [--wl WRAP_LENGTH]
             [--case-sensitive] [--remove-redundant-aliases] [--honor-noqa]
             [--treat-comment-as-code TREAT_COMMENTS_AS_CODE]
             [--treat-all-comment-as-code] [--formatter FORMATTER] [--color]
             [--ext-format EXT_FORMAT] [--star-first] [--sd DEFAULT_SECTION]
             [--only-sections] [--ds] [--fas] [--fss] [--hcss] [--srss]
             [--fass] [-t FORCE_TO_TOP] [--combine-straight-imports]
             [--nlb NO_LINES_BEFORE] [--src SRC_PATHS]
             [-b KNOWN_STANDARD_LIBRARY]
             [--extra-builtin EXTRA_STANDARD_LIBRARY] [-f KNOWN_FUTURE_LIBRARY]
             [-o KNOWN_THIRD_PARTY] [-p KNOWN_FIRST_PARTY]
             [--known-local-folder KNOWN_LOCAL_FOLDER]
             [--virtual-env VIRTUAL_ENV] [--conda-env CONDA_ENV]
             [--py {all,2,27,3,35,36,37,38,39,auto}]
             [files [files ...]]
isort: error: unrecognized arguments: -y -up
make: *** [Makefile:35: isort] Error 2
```

[TST/INF] Weird isort output in `make check`
# Brief Description
When running `make check`, a weird output is being returned:

```
The HTML pages are in _build/html.
make[1]: Leaving directory '/Users/logan/Desktop/repos/pyjanitor/docs'
Sorting imports...
isort -rc . -y -up -tc
usage: isort [-h] [-V] [--vn] [-v] [--only-modified] [--dedup-headings] [-q]
             [-d] [--overwrite-in-place] [--show-config] [--show-files] [--df]
             [-c] [--ws] [--sp SETTINGS_PATH] [--profile PROFILE]
             [--old-finders] [-j [JOBS]] [--ac] [--interactive]
             [--format-error FORMAT_ERROR] [--format-success FORMAT_SUCCESS]
             [--filter-files] [-s SKIP] [--extend-skip EXTEND_SKIP]
             [--sg SKIP_GLOB] [--extend-skip-glob SKIP_GLOB] [--gitignore]
             [--ext SUPPORTED_EXTENSIONS]
             [--blocked-extension BLOCKED_EXTENSIONS] [--dont-follow-links]
             [--filename FILENAME] [--allow-root] [-a ADD_IMPORTS] [--append]
             [--af] [--rm REMOVE_IMPORTS] [--float-to-top]
             [--dont-float-to-top] [--ca] [--cs] [-e] [--ff FROM_FIRST]
             [--fgw [FORCE_GRID_WRAP]] [-i INDENT] [--lai LINES_AFTER_IMPORTS]
             [--lbt LINES_BETWEEN_TYPES] [--le LINE_ENDING] [--ls] [--lss]
             [-m {GRID,VERTICAL,HANGING_INDENT,VERTICAL_HANGING_INDENT,VERTICAL_GRID,VERTICAL_GRID_GROUPED,VERTICAL_GRID_GROUPED_NO_COMMA,NOQA,VERTICAL_HANGING_INDENT_BRACKET,VERTICAL_PREFIX_FROM_MODULE_IMPORT,HANGING_INDENT_WITH_PARENTHESES,BACKSLASH_GRID,0,1,2,3,4,5,6,7,8,9,10,11}]
             [-n] [--nis] [--ot] [--dt] [--rr] [--reverse-sort]
             [--sort-order SORT_ORDER] [--sl] [--nsl SINGLE_LINE_EXCLUSIONS]
             [--tc] [--up] [-l LINE_LENGTH] [--wl WRAP_LENGTH]
             [--case-sensitive] [--remove-redundant-aliases] [--honor-noqa]
             [--treat-comment-as-code TREAT_COMMENTS_AS_CODE]
             [--treat-all-comment-as-code] [--formatter FORMATTER] [--color]
             [--ext-format EXT_FORMAT] [--star-first] [--sd DEFAULT_SECTION]
             [--only-sections] [--ds] [--fas] [--fss] [--hcss] [--srss]
             [--fass] [-t FORCE_TO_TOP] [--combine-straight-imports]
             [--nlb NO_LINES_BEFORE] [--src SRC_PATHS]
             [-b KNOWN_STANDARD_LIBRARY]
             [--extra-builtin EXTRA_STANDARD_LIBRARY] [-f KNOWN_FUTURE_LIBRARY]
             [-o KNOWN_THIRD_PARTY] [-p KNOWN_FIRST_PARTY]
             [--known-local-folder KNOWN_LOCAL_FOLDER]
             [--virtual-env VIRTUAL_ENV] [--conda-env CONDA_ENV]
             [--py {all,2,27,3,35,36,37,38,39,auto}]
             [files [files ...]]
isort: error: unrecognized arguments: -y -up
make: *** [Makefile:35: isort] Error 2
```



Discussion:
Looks like `isort` should be configured by the appropriate config files.
Looks like `isort` should be configured by the appropriate config files.

Resolving patch:
diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -9,18 +9,15 @@
 # http://www.sphinx-doc.org/en/stable/config
 
 # -- Path setup --------------------------------------------------------------
-
 import datetime
-
-# If extensions (or modules to document with autodoc) are in another directory,
-# add these directories to sys.path here. If the directory is relative to the
-# documentation root, use os.path.abspath to make it absolute, like shown here.
-#
 import os
 import platform
 import sys
 from pathlib import Path
 
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
 sys.path.insert(0, os.path.abspath("."))
 sys.path.insert(0, os.path.abspath("../examples"))
 
diff --git a/janitor/chemistry.py b/janitor/chemistry.py
--- a/janitor/chemistry.py
+++ b/janitor/chemistry.py
@@ -13,8 +13,6 @@
 try:
     from rdkit import Chem, DataStructs
     from rdkit.Chem.rdMolDescriptors import (
-        GetHashedMorganFingerprint,
-        GetMorganFingerprintAsBitVect,
         CalcChi0n,
         CalcChi0v,
         CalcChi1n,
@@ -54,7 +52,9 @@
         CalcNumSpiroAtoms,
         CalcNumUnspecifiedAtomStereoCenters,
         CalcTPSA,
+        GetHashedMorganFingerprint,
         GetMACCSKeysFingerprint,
+        GetMorganFingerprintAsBitVect,
     )
 except ImportError:
     import_message(
diff --git a/janitor/utils.py b/janitor/utils.py
--- a/janitor/utils.py
+++ b/janitor/utils.py
@@ -14,11 +14,11 @@
     Dict,
     Iterable,
     List,
+    NamedTuple,
     Optional,
     Pattern,
     Tuple,
     Union,
-    NamedTuple,
 )
 
 import numpy as np


Test patch:
diff --git a/tests/biology/test_join_fasta.py b/tests/biology/test_join_fasta.py
--- a/tests/biology/test_join_fasta.py
+++ b/tests/biology/test_join_fasta.py
@@ -2,9 +2,9 @@
 import os
 
 import pytest
+from helpers import running_on_ci
 
 import janitor.biology  # noqa: F403, F401
-from helpers import running_on_ci
 
 # Skip all tests if Biopython not installed
 pytestmark = pytest.mark.skipif(
diff --git a/tests/chemistry/test_maccs_keys_fingerprint.py b/tests/chemistry/test_maccs_keys_fingerprint.py
--- a/tests/chemistry/test_maccs_keys_fingerprint.py
+++ b/tests/chemistry/test_maccs_keys_fingerprint.py
@@ -1,9 +1,9 @@
 import importlib
 
 import pytest
+from helpers import running_on_ci
 
 import janitor.chemistry  # noqa: disable=unused-import
-from helpers import running_on_ci
 
 # Skip all tests if rdkit not installed
 pytestmark = pytest.mark.skipif(
diff --git a/tests/chemistry/test_molecular_descriptors.py b/tests/chemistry/test_molecular_descriptors.py
--- a/tests/chemistry/test_molecular_descriptors.py
+++ b/tests/chemistry/test_molecular_descriptors.py
@@ -1,9 +1,9 @@
 import importlib
 
 import pytest
+from helpers import running_on_ci
 
 import janitor.chemistry  # noqa: disable=unused-import
-from helpers import running_on_ci
 
 # Skip all tests if rdkit not installed
 pytestmark = pytest.mark.skipif(
diff --git a/tests/chemistry/test_morgan_fingerprint.py b/tests/chemistry/test_morgan_fingerprint.py
--- a/tests/chemistry/test_morgan_fingerprint.py
+++ b/tests/chemistry/test_morgan_fingerprint.py
@@ -1,9 +1,9 @@
 import importlib
 
 import pytest
+from helpers import running_on_ci
 
 import janitor.chemistry  # noqa: disable=unused-import
-from helpers import running_on_ci
 
 # Skip all tests if rdkit not installed
 pytestmark = pytest.mark.skipif(
diff --git a/tests/chemistry/test_smiles2mol.py b/tests/chemistry/test_smiles2mol.py
--- a/tests/chemistry/test_smiles2mol.py
+++ b/tests/chemistry/test_smiles2mol.py
@@ -1,7 +1,6 @@
 import importlib
 
 import pytest
-
 from helpers import running_on_ci
 
 # Skip all tests if rdkit not installed
diff --git a/tests/finance/test_convert_stock.py b/tests/finance/test_convert_stock.py
--- a/tests/finance/test_convert_stock.py
+++ b/tests/finance/test_convert_stock.py
@@ -1,6 +1,7 @@
-from janitor.finance import get_symbol
 import pytest
 
+from janitor.finance import get_symbol
+
 
 @pytest.mark.xfail(reason="Flaky because it depends on internet connectivity.")
 def test_convert_stock():
diff --git a/tests/finance/test_get_symbol.py b/tests/finance/test_get_symbol.py
--- a/tests/finance/test_get_symbol.py
+++ b/tests/finance/test_get_symbol.py
@@ -1,6 +1,7 @@
-from janitor.finance import get_symbol
 import pytest
 
+from janitor.finance import get_symbol
+
 """
 tests the convert_symbol helper function.
 
diff --git a/tests/spark/functions/test_clean_names_spark.py b/tests/spark/functions/test_clean_names_spark.py
--- a/tests/spark/functions/test_clean_names_spark.py
+++ b/tests/spark/functions/test_clean_names_spark.py
@@ -1,6 +1,6 @@
 import pytest
-
 from helpers import running_on_ci
+
 from janitor.errors import JanitorError
 
 if running_on_ci():
diff --git a/tests/spark/functions/test_update_where_spark.py b/tests/spark/functions/test_update_where_spark.py
--- a/tests/spark/functions/test_update_where_spark.py
+++ b/tests/spark/functions/test_update_where_spark.py
@@ -1,7 +1,6 @@
 import pytest
-from pandas.testing import assert_frame_equal
-
 from helpers import running_on_ci
+from pandas.testing import assert_frame_equal
 
 if running_on_ci():
     import pyspark
diff --git a/tests/utils/test_is_connected.py b/tests/utils/test_is_connected.py
--- a/tests/utils/test_is_connected.py
+++ b/tests/utils/test_is_connected.py
@@ -1,7 +1,8 @@
-from janitor.utils import is_connected
 import socket
+
 import pytest
 
+from janitor.utils import is_connected
 
 """
 Tests the is_connected helper function,