]> git.donarmstrong.com Git - deb_pkgs/autorandr.git/commit
Fix case in which x and y are not specified in panning
authorJosiah Schwab <jschwab@gmail.com>
Sat, 9 Feb 2019 19:42:45 +0000 (11:42 -0800)
committerJosiah Schwab <jschwab@gmail.com>
Sat, 9 Feb 2019 19:51:08 +0000 (11:51 -0800)
commitb5abba44115053d0c4836afd2936225e9f9ee7ad
tree229bd24f65186d74c19026c5c0368900af000816
parentf24910c746b03e968caec9320fd8f8ba2d6c0feb
Fix case in which x and y are not specified in panning

The regular expression that extracts the panning values has optional
matches for the named groups x and y.

Previously, the case in which there is no match for x and y looks to
have been attempted to be handled by doing

  detail.get("x", "0")

This is a bug.  The default argument to dict.get is only returned when
the key is not a member of the dictionary.  However, when a group
fails to participate in the regex match, the dict does have a key.
The default value of this default key is None.  This would lead to an
error when the get returned None and None was then cast to an integer.

This resolves the issue by explicitly setting the groupdict default to
be "0", which is appropriate for the two groups (x and y) that may
optionally participate in the match.
autorandr.py