diff options
author | Timothy Crosley <timothy.crosley@gmail.com> | 2019-03-02 00:35:41 -0800 |
---|---|---|
committer | Timothy Crosley <timothy.crosley@gmail.com> | 2019-03-02 00:35:41 -0800 |
commit | 6fdb1d67ca4c3b1ebcea4436c8b4cc20c13b2862 (patch) | |
tree | ca8414eb5b69d7d13f4691019bcfec32a1600a92 | |
parent | bc6c0874bd7de0711df7e717c4375bd496b04e76 (diff) | |
download | isort-6fdb1d67ca4c3b1ebcea4436c8b4cc20c13b2862.tar.gz |
Fix return failure
-rw-r--r-- | isort/finders.py | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/isort/finders.py b/isort/finders.py index 05abb585..e6483c50 100644 --- a/isort/finders.py +++ b/isort/finders.py @@ -8,6 +8,7 @@ import sys import sysconfig from abc import ABCMeta, abstractmethod from fnmatch import fnmatch +from functools import lru_cache from glob import glob from typing import Any, Dict, Iterable, Iterator, List, Mapping, Optional, Pattern, Sequence, Tuple, Type @@ -34,12 +35,6 @@ try: except ImportError: Pipfile = None -try: - from functools import lru_cache -except ImportError: - from backports.functools_lru_cache import lru_cache - - KNOWN_SECTION_MAPPING = { 'STDLIB': 'STANDARD_LIBRARY', 'FUTURE': 'FUTURE_LIBRARY', @@ -278,7 +273,7 @@ class RequirementsFinder(ReqsBaseFinder): @classmethod @lru_cache(maxsize=16) def _get_files_from_dir_cached(cls, path): - result = [] + results = [] for fname in os.listdir(path): if 'requirements' not in fname: @@ -290,16 +285,18 @@ class RequirementsFinder(ReqsBaseFinder): for subfile_name in os.listdir(path): for ext in cls.exts: if subfile_name.endswith(ext): - result.append(os.path.join(path, subfile_name)) + results.append(os.path.join(path, subfile_name)) continue # *requirements*.{txt,in} if os.path.isfile(full_path): for ext in cls.exts: if fname.endswith(ext): - result.append(full_path) + results.append(full_path) break + return results + def _get_names(self, path: str) -> Iterator[str]: """Load required packages from path to requirements file """ |