From 1e1885c45a28190dc1cbde993a9ddcf1729ee4d1 Mon Sep 17 00:00:00 2001 From: Anish Athalye Date: Fri, 3 Jan 2020 14:42:45 -0500 Subject: [PATCH] Fix incorrect use of `is` over `==` Comparing strings and integers with `is` is a bug: comparisons should be done with `==`. It might not have caused observable problems in the past because small integers and strings can be interned. --- dotbot/plugins/link.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dotbot/plugins/link.py b/dotbot/plugins/link.py index bf3db3e..d38c0ab 100644 --- a/dotbot/plugins/link.py +++ b/dotbot/plugins/link.py @@ -51,19 +51,19 @@ class Link(dotbot.Plugin): if use_glob: self._log.debug("Globbing with path: " + str(path)) glob_results = glob.glob(path) - if len(glob_results) is 0: + if len(glob_results) == 0: self._log.warning("Globbing couldn't find anything matching " + str(path)) success = False continue glob_star_loc = path.find('*') - if glob_star_loc is -1 and destination[-1] is '/': + if glob_star_loc == -1 and destination[-1] == '/': self._log.error("Ambiguous action requested.") self._log.error("No wildcard in glob, directory use undefined: " + destination + " -> " + str(glob_results)) self._log.warning("Did you want to link the directory or into it?") success = False continue - elif glob_star_loc is -1 and len(glob_results) is 1: + elif glob_star_loc == -1 and len(glob_results) == 1: # perform a normal link operation if create: success &= self._create(destination)