fairseq/file_utils.py

Killed 2 out of 15 mutants

Survived

Survived mutation testing. These mutants show holes in your test suite.

Mutant 2

--- fairseq/file_utils.py
+++ fairseq/file_utils.py
@@ -28,7 +28,7 @@
     torch_cache_home = os.path.expanduser(
         os.getenv('TORCH_HOME', os.path.join(
             os.getenv('XDG_CACHE_HOME', '~/.cache'), 'torch')))
-default_cache_path = os.path.join(torch_cache_home, 'pytorch_fairseq')
+default_cache_path = os.path.join(torch_cache_home, 'XXpytorch_fairseqXX')
 
 try:
     from urllib.parse import urlparse

Mutant 4

--- fairseq/file_utils.py
+++ fairseq/file_utils.py
@@ -38,7 +38,7 @@
 try:
     from pathlib import Path
     PYTORCH_FAIRSEQ_CACHE = Path(
-        os.getenv('PYTORCH_FAIRSEQ_CACHE', default_cache_path))
+        os.getenv('XXPYTORCH_FAIRSEQ_CACHEXX', default_cache_path))
 except (AttributeError, ImportError):
     PYTORCH_FAIRSEQ_CACHE = os.getenv(
         'PYTORCH_FAIRSEQ_CACHE', default_cache_path)

Mutant 5

--- fairseq/file_utils.py
+++ fairseq/file_utils.py
@@ -37,8 +37,7 @@
 
 try:
     from pathlib import Path
-    PYTORCH_FAIRSEQ_CACHE = Path(
-        os.getenv('PYTORCH_FAIRSEQ_CACHE', default_cache_path))
+    PYTORCH_FAIRSEQ_CACHE = None
 except (AttributeError, ImportError):
     PYTORCH_FAIRSEQ_CACHE = os.getenv(
         'PYTORCH_FAIRSEQ_CACHE', default_cache_path)

Mutant 6

--- fairseq/file_utils.py
+++ fairseq/file_utils.py
@@ -43,7 +43,7 @@
     PYTORCH_FAIRSEQ_CACHE = os.getenv(
         'PYTORCH_FAIRSEQ_CACHE', default_cache_path)
 
-CONFIG_NAME = "config.json"
+CONFIG_NAME = "XXconfig.jsonXX"
 WEIGHTS_NAME = "pytorch_model.bin"
 
 logger = logging.getLogger(__name__)  # pylint: disable=invalid-name

Mutant 7

--- fairseq/file_utils.py
+++ fairseq/file_utils.py
@@ -43,7 +43,7 @@
     PYTORCH_FAIRSEQ_CACHE = os.getenv(
         'PYTORCH_FAIRSEQ_CACHE', default_cache_path)
 
-CONFIG_NAME = "config.json"
+CONFIG_NAME = None
 WEIGHTS_NAME = "pytorch_model.bin"
 
 logger = logging.getLogger(__name__)  # pylint: disable=invalid-name

Mutant 8

--- fairseq/file_utils.py
+++ fairseq/file_utils.py
@@ -44,7 +44,7 @@
         'PYTORCH_FAIRSEQ_CACHE', default_cache_path)
 
 CONFIG_NAME = "config.json"
-WEIGHTS_NAME = "pytorch_model.bin"
+WEIGHTS_NAME = "XXpytorch_model.binXX"
 
 logger = logging.getLogger(__name__)  # pylint: disable=invalid-name
 

Mutant 9

--- fairseq/file_utils.py
+++ fairseq/file_utils.py
@@ -44,7 +44,7 @@
         'PYTORCH_FAIRSEQ_CACHE', default_cache_path)
 
 CONFIG_NAME = "config.json"
-WEIGHTS_NAME = "pytorch_model.bin"
+WEIGHTS_NAME = None
 
 logger = logging.getLogger(__name__)  # pylint: disable=invalid-name
 

Mutant 10

--- fairseq/file_utils.py
+++ fairseq/file_utils.py
@@ -46,7 +46,7 @@
 CONFIG_NAME = "config.json"
 WEIGHTS_NAME = "pytorch_model.bin"
 
-logger = logging.getLogger(__name__)  # pylint: disable=invalid-name
+logger = None  # pylint: disable=invalid-name
 
 
 def load_archive_file(archive_file):

Mutant 11

--- fairseq/file_utils.py
+++ fairseq/file_utils.py
@@ -180,7 +180,6 @@
     messages.
     """
 
-    @wraps(func)
     def wrapper(url, *args, **kwargs):
         from botocore.exceptions import ClientError
         try:

Mutant 12

--- fairseq/file_utils.py
+++ fairseq/file_utils.py
@@ -193,8 +193,6 @@
 
     return wrapper
 
-
-@s3_request
 def s3_etag(url):
     """Check ETag on S3 object."""
     import boto3

Mutant 13

--- fairseq/file_utils.py
+++ fairseq/file_utils.py
@@ -203,8 +203,6 @@
     s3_object = s3_resource.Object(bucket_name, s3_path)
     return s3_object.e_tag
 
-
-@s3_request
 def s3_get(url, temp_file):
     """Pull a file directly from S3."""
     import boto3

Mutant 14

--- fairseq/file_utils.py
+++ fairseq/file_utils.py
@@ -325,7 +325,7 @@
     return collection
 
 
-def get_file_extension(path, dot=True, lower=True):
+def get_file_extension(path, dot=False, lower=True):
     ext = os.path.splitext(path)[1]
     ext = ext if dot else ext[1:]
     return ext.lower() if lower else ext

Mutant 15

--- fairseq/file_utils.py
+++ fairseq/file_utils.py
@@ -325,7 +325,7 @@
     return collection
 
 
-def get_file_extension(path, dot=True, lower=True):
+def get_file_extension(path, dot=True, lower=False):
     ext = os.path.splitext(path)[1]
     ext = ext if dot else ext[1:]
     return ext.lower() if lower else ext