if
expression used can be simplified PYL-R1719 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)
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
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:
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,
The if
expression used here can be simplified to increase the code readability.
Example:
value = True if arg else False
This can be simplified into:
value = bool(arg)