From 129808565802bf9cf9134d1eb5a6577551d94a9f Mon Sep 17 00:00:00 2001 From: maleo Date: Fri, 4 Oct 2024 08:19:16 +0000 Subject: [PATCH] Remove file extension check This causes more issues than it solves. The remaining protections (checking for file existance, checking mime type, checking for predefined names in auto-detect mode) should be sufficient. Furthermore, when explicitly passing a file (either via arg or via inclusion), users should be free to choose whatever extension suits them. --- pip_upgrader/requirements_detector.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pip_upgrader/requirements_detector.py b/pip_upgrader/requirements_detector.py index e1b6adc..a68ebdd 100644 --- a/pip_upgrader/requirements_detector.py +++ b/pip_upgrader/requirements_detector.py @@ -44,8 +44,7 @@ def autodetect_files(self): @staticmethod def _is_valid_requirements_file(filename): - extension_ok = filename.endswith('txt') or filename.endswith('pip') - return extension_ok and os.path.isfile(filename) and mimetypes.guess_type(filename)[0] in ['text/plain', None] + return os.path.isfile(filename) and mimetypes.guess_type(filename)[0] in ['text/plain', None] def _check_inclusions_recursively(self): for filename in self.filenames: