diff options
author | Anish Athalye <me@anishathalye.com> | 2020-01-03 14:42:45 -0500 |
---|---|---|
committer | Anish Athalye <me@anishathalye.com> | 2020-01-03 15:31:24 -0500 |
commit | 1e1885c45a28190dc1cbde993a9ddcf1729ee4d1 (patch) | |
tree | 54f87b800455f680cd81361443f0ff1293cf7ef0 | |
parent | a7ed16681752f9297d626480f67a5bada24cd62a (diff) |
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.
-rw-r--r-- | dotbot/plugins/link.py | 6 |
1 files 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) |