pnijhara / gitsome

if expression used can be simplified PYL-R1719
Anti-pattern
Minor
4 years ago4 years old
The if expression can be replaced with 'bool(test)'
 963        return False
 964    # if the file exists and is writable, we're fine
 965    if os.path.exists(filepath):
 966        return True if os.access(filepath, os.W_OK) else False 967    # if the path doesn't exist, isolate its directory component
 968    # and ensure that directory is writable instead
 969    return os.access(os.path.dirname(filepath), os.W_OK)
The if expression can be replaced with 'not test'
1235    if isinstance(x, bool):
1236        return x
1237    elif isinstance(x, str):
1238        return False if x.lower() in _FALSES else True1239    else:
1240        return bool(x)
1241
The if expression can be replaced with 'not test'
 52        except OSError as e:  # NOQA
 53            pass
 54
 55    return False if wval else True 56
 57
 58def _is_unc_path(some_path) -> bool:
The if expression can be replaced with 'not test'
333                repo = self.config.api.repository(user, repo)
334                items = repo.events()
335            else:
336                public = False if private else True337                items = self.config.api.user(user_or_repo).events(public=public)
338            self.table.build_table_setup(
339                items,